use of org.pentaho.ui.xul.containers.XulWindow in project pentaho-kettle by pentaho.
the class DataHandler method windowClosed.
private boolean windowClosed() {
boolean closedWindow = true;
XulComponent window = document.getElementById("general-datasource-window");
if (window == null) {
// window must be root
window = document.getRootElement();
}
if (window instanceof XulWindow) {
closedWindow = ((XulWindow) window).isClosed();
}
return closedWindow;
}
use of org.pentaho.ui.xul.containers.XulWindow in project pentaho-kettle by pentaho.
the class DatabaseDialogHarness method showDialog.
private void showDialog() {
XulDomContainer container = null;
try {
DatabaseConnectionDialog dcDialog = new DatabaseConnectionDialog();
container = dcDialog.getSwtInstance(new Shell(SWT.NONE));
if (database != null) {
container.getEventHandler("dataHandler").setData(database);
}
} catch (XulException e) {
e.printStackTrace();
}
XulRoot root = (XulRoot) container.getDocumentRoot().getRootElement();
if (root instanceof XulDialog) {
((XulDialog) root).show();
}
if (root instanceof XulWindow) {
((XulWindow) root).open();
}
try {
database = (DatabaseMeta) container.getEventHandler("dataHandler").getData();
} catch (Exception e) {
e.printStackTrace();
}
String message = DatabaseDialogHarness.setMessage(database);
Shell shell = new Shell(SWT.DIALOG_TRIM);
shell.setLayout(new RowLayout());
Label label = new Label(shell, SWT.NONE);
label.setText(message);
Button button = new Button(shell, SWT.NONE);
button.setText("Edit Database ...");
button.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent event) {
try {
showDialog();
} catch (Exception e) {
e.printStackTrace();
}
}
});
shell.pack();
shell.open();
while (!shell.isDisposed()) {
if (!shell.getDisplay().readAndDispatch()) {
shell.getDisplay().sleep();
}
}
}
Aggregations