Search in sources :

Example 6 with XulConfirmBox

use of org.pentaho.ui.xul.components.XulConfirmBox 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();
}
Also used : XulConfirmBox(org.pentaho.ui.xul.components.XulConfirmBox) XulComponent(org.pentaho.ui.xul.XulComponent)

Example 7 with XulConfirmBox

use of org.pentaho.ui.xul.components.XulConfirmBox 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();
}
Also used : XulException(org.pentaho.ui.xul.XulException) XulConfirmBox(org.pentaho.ui.xul.components.XulConfirmBox) XulComponent(org.pentaho.ui.xul.XulComponent)

Example 8 with XulConfirmBox

use of org.pentaho.ui.xul.components.XulConfirmBox 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();
}
Also used : XulException(org.pentaho.ui.xul.XulException) XulConfirmBox(org.pentaho.ui.xul.components.XulConfirmBox) XulComponent(org.pentaho.ui.xul.XulComponent) Bindable(org.pentaho.ui.xul.stereotype.Bindable)

Example 9 with XulConfirmBox

use of org.pentaho.ui.xul.components.XulConfirmBox 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();
}
Also used : HttpStatus(org.apache.http.HttpStatus) VerticalPanel(com.google.gwt.user.client.ui.VerticalPanel) XulConfirmBox(org.pentaho.ui.xul.components.XulConfirmBox) Label(com.google.gwt.user.client.ui.Label) XulLabel(org.pentaho.ui.xul.components.XulLabel) GwtConfirmBox(org.pentaho.ui.xul.gwt.tags.GwtConfirmBox) XulComponent(org.pentaho.ui.xul.XulComponent)

Aggregations

XulConfirmBox (org.pentaho.ui.xul.components.XulConfirmBox)9 XulComponent (org.pentaho.ui.xul.XulComponent)8 KettleException (org.pentaho.di.core.exception.KettleException)2 XulException (org.pentaho.ui.xul.XulException)2 Label (com.google.gwt.user.client.ui.Label)1 VerticalPanel (com.google.gwt.user.client.ui.VerticalPanel)1 HttpStatus (org.apache.http.HttpStatus)1 KettleSecurityException (org.pentaho.di.core.exception.KettleSecurityException)1 KettleRepositoryLostException (org.pentaho.di.repository.KettleRepositoryLostException)1 RepositoryMeta (org.pentaho.di.repository.RepositoryMeta)1 ErrorDialog (org.pentaho.di.ui.core.dialog.ErrorDialog)1 IAclObject (org.pentaho.di.ui.repository.pur.repositoryexplorer.IAclObject)1 ControllerInitializationException (org.pentaho.di.ui.repository.repositoryexplorer.ControllerInitializationException)1 XulLabel (org.pentaho.ui.xul.components.XulLabel)1 GwtConfirmBox (org.pentaho.ui.xul.gwt.tags.GwtConfirmBox)1 Bindable (org.pentaho.ui.xul.stereotype.Bindable)1