use of org.pentaho.ui.xul.XulComponent in project pentaho-kettle by pentaho.
the class TrashBrowseController method renameRepositoryObject.
@Override
protected void renameRepositoryObject(final UIRepositoryObject repoObject) throws XulException {
// final Document doc = document;
XulPromptBox prompt = promptForName(repoObject);
prompt.addDialogCallback(new XulDialogCallback<String>() {
public void onClose(XulComponent component, Status status, String value) {
if (status == Status.ACCEPT) {
final String newName = value;
try {
repoObject.setName(newName);
} catch (KettleException ke) {
if (ke.getCause() instanceof RepositoryObjectAccessException) {
moveDeletePrompt(ke, repoObject, new XulDialogCallback<Object>() {
public void onClose(XulComponent sender, Status returnCode, Object retVal) {
if (returnCode == Status.ACCEPT) {
try {
((UIEERepositoryDirectory) repoObject).setName(newName, true);
} catch (Exception e) {
if (mainController == null || !mainController.handleLostRepository(e)) {
displayExceptionMessage(BaseMessages.getString(PKG, e.getLocalizedMessage()));
}
}
}
}
public void onError(XulComponent sender, Throwable t) {
if (mainController == null || !mainController.handleLostRepository(t)) {
throw new RuntimeException(t);
}
}
});
} else {
if (mainController == null || !mainController.handleLostRepository(ke)) {
throw new RuntimeException(ke);
}
}
} catch (Exception e) {
if (mainController == null || !mainController.handleLostRepository(e)) {
// convert to runtime exception so it bubbles up through the UI
throw new RuntimeException(e);
}
}
}
}
public void onError(XulComponent component, Throwable err) {
if (mainController == null || !mainController.handleLostRepository(err)) {
throw new RuntimeException(err);
}
}
});
prompt.open();
}
use of org.pentaho.ui.xul.XulComponent in project data-access by pentaho.
the class GwtDatasourceEditorEntryPoint method showConfirm.
public void showConfirm(final JavaScriptObject callback, String message, String title, String okText, String cancelText) throws XulException {
XulConfirmBox confirm = (XulConfirmBox) wizard.getMainWizardContainer().getDocumentRoot().createElement("confirmbox");
confirm.setTitle(title);
confirm.setMessage(message);
confirm.setAcceptLabel(okText);
confirm.setCancelLabel(cancelText);
confirm.addDialogCallback(new XulDialogCallback<String>() {
public void onClose(XulComponent component, Status status, String value) {
if (status == XulDialogCallback.Status.ACCEPT) {
notifyDialogCallbackSuccess(callback, value);
}
}
public void onError(XulComponent component, Throwable err) {
notifyDialogCallbackError(callback, err.getMessage());
}
});
confirm.open();
}
use of org.pentaho.ui.xul.XulComponent in project data-access by pentaho.
the class GwtDatasourceEditorEntryPoint method overwriteFileDialog.
/**
* used to handle the overwrite in repository message
*
* @param parentFormPanel
* @param message
* @param controller
*/
public void overwriteFileDialog(final FormPanel parentFormPanel, String message, final IOverwritableController controller) {
// Experiment
XulConfirmBox confirm = null;
try {
confirm = (XulConfirmBox) wizard.getMainWizardContainer().getDocumentRoot().createElement("confirmbox");
} catch (XulException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
confirm.setTitle("Confirmation");
confirm.setMessage(message);
confirm.setAcceptLabel("Ok");
confirm.setCancelLabel("Cancel");
confirm.addDialogCallback(new XulDialogCallback<String>() {
public void onClose(XulComponent component, Status status, String value) {
if (status == XulDialogCallback.Status.ACCEPT) {
controller.setOverwrite(true);
controller.removeHiddenPanels();
controller.buildAndSetParameters();
parentFormPanel.submit();
}
}
public void onError(XulComponent component, Throwable err) {
return;
}
});
confirm.open();
}
use of org.pentaho.ui.xul.XulComponent in project data-access by pentaho.
the class AnalysisImportDialogController method overwriteFileDialog.
@Bindable
public void overwriteFileDialog(int code) {
if (code != PUBLISH_SCHEMA_CATALOG_EXISTS_ERROR && code != PUBLISH_SCHEMA_EXISTS_ERROR) {
return;
}
String msg = messages.getString("Mondrian.OVERWRITE_EXISTING_SCHEMA");
if (PUBLISH_SCHEMA_CATALOG_EXISTS_ERROR == code) {
msg = messages.getString("Mondrian.OVERWRITE_EXISTING_CATALOG");
}
XulConfirmBox confirm = null;
try {
confirm = (XulConfirmBox) document.createElement("confirmbox");
} catch (XulException e) {
Window.alert(e.getMessage());
}
confirm.setTitle("Confirmation");
confirm.setMessage(msg);
confirm.setAcceptLabel("Ok");
confirm.setCancelLabel("Cancel");
confirm.addDialogCallback(new XulDialogCallback<String>() {
public void onClose(XulComponent component, Status status, String value) {
if (status == XulDialogCallback.Status.ACCEPT) {
overwrite = true;
removeHiddenPanels();
buildAndSetParameters();
formPanel.submit();
}
}
public void onError(XulComponent component, Throwable err) {
return;
}
});
confirm.open();
}
use of org.pentaho.ui.xul.XulComponent in project data-access by pentaho.
the class MetadataImportDialogController method confirm.
/**
* Shows a confirmation dialog
*
* @param title
* @param message
* @param okButtonLabel
* @param cancelButtonLabel
* @param onResulthandler
*/
private void confirm(final String title, final String message, final String okButtonLabel, final String cancelButtonLabel, final AsyncCallback<Boolean> onResulthandler) {
XulConfirmBox confirm = new GwtConfirmBox() {
@Override
public Panel getDialogContents() {
VerticalPanel vp = new VerticalPanel();
Label lbl = new Label(this.getMessage());
vp.add(lbl);
vp.setCellHorizontalAlignment(lbl, VerticalPanel.ALIGN_LEFT);
vp.setCellVerticalAlignment(lbl, VerticalPanel.ALIGN_MIDDLE);
return vp;
}
};
confirm.setTitle(title);
confirm.setMessage(message);
confirm.setAcceptLabel(okButtonLabel);
confirm.setCancelLabel(cancelButtonLabel);
confirm.addDialogCallback(new XulDialogCallback<String>() {
public void onClose(XulComponent component, Status status, String value) {
if (onResulthandler != null) {
onResulthandler.onSuccess(status == XulDialogCallback.Status.ACCEPT);
}
}
public void onError(XulComponent component, Throwable err) {
onResulthandler.onFailure(err);
return;
}
});
confirm.open();
}
Aggregations