Add example dialog
This commit is contained in:
parent
ba11b410e0
commit
59f8cd34c2
6 changed files with 258 additions and 3 deletions
43
source/org/libreoffice/example/dialog/ActionOneDialog.java
Normal file
43
source/org/libreoffice/example/dialog/ActionOneDialog.java
Normal file
|
@ -0,0 +1,43 @@
|
|||
package org.libreoffice.example.dialog;
|
||||
|
||||
import org.libreoffice.example.helper.DialogHelper;
|
||||
|
||||
import com.sun.star.awt.XDialog;
|
||||
import com.sun.star.awt.XDialogEventHandler;
|
||||
import com.sun.star.lang.WrappedTargetException;
|
||||
import com.sun.star.uno.XComponentContext;
|
||||
|
||||
|
||||
public class ActionOneDialog implements XDialogEventHandler {
|
||||
|
||||
private XDialog dialog;
|
||||
private static final String actionOk = "actionOk";
|
||||
private String[] supportedActions = new String[] { actionOk };
|
||||
|
||||
public ActionOneDialog(XComponentContext xContext) {
|
||||
this.dialog = DialogHelper.createDialog("ActionOneDialog.xdl", xContext, this);
|
||||
}
|
||||
|
||||
public void show() {
|
||||
dialog.execute();
|
||||
}
|
||||
|
||||
private void onOkButtonPressed() {
|
||||
dialog.endExecute();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean callHandlerMethod(XDialog dialog, Object eventObject, String methodName) throws WrappedTargetException {
|
||||
if (methodName.equals(actionOk)) {
|
||||
onOkButtonPressed();
|
||||
return true; // Event was handled
|
||||
}
|
||||
return false; // Event was not handled
|
||||
}
|
||||
|
||||
@Override
|
||||
public String[] getSupportedMethodNames() {
|
||||
return supportedActions;
|
||||
}
|
||||
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue