Search in sources :

Example 1 with IDialogValidatorCallback

use of org.pentaho.gwt.widgets.client.dialogs.IDialogValidatorCallback in project pentaho-platform by pentaho.

the class ImportDialog method onOk.

protected void onOk() {
    IDialogCallback callback = this.getCallback();
    IDialogValidatorCallback validatorCallback = this.getValidatorCallback();
    if (validatorCallback == null || (validatorCallback != null && validatorCallback.validate())) {
        try {
            if (callback != null) {
                setFormAction();
                callback.okPressed();
            }
        } catch (Throwable dontCare) {
        // ignored
        }
    }
}
Also used : IDialogCallback(org.pentaho.gwt.widgets.client.dialogs.IDialogCallback) IDialogValidatorCallback(org.pentaho.gwt.widgets.client.dialogs.IDialogValidatorCallback)

Example 2 with IDialogValidatorCallback

use of org.pentaho.gwt.widgets.client.dialogs.IDialogValidatorCallback in project pentaho-platform by pentaho.

the class OpenURLCommand method performOperation.

protected void performOperation(boolean feedback) {
    final TextBox textBox = new TextBox();
    // $NON-NLS-1$
    textBox.setText("http://");
    // $NON-NLS-1$
    textBox.setWidth("500px");
    textBox.setVisibleLength(72);
    IDialogCallback callback = new IDialogCallback() {

        public void cancelPressed() {
        }

        public void okPressed() {
            SolutionBrowserPanel.getInstance().getContentTabPanel().showNewURLTab(textBox.getText(), textBox.getText(), textBox.getText(), false);
        }
    };
    IDialogValidatorCallback validatorCallback = new IDialogValidatorCallback() {

        public boolean validate() {
            // $NON-NLS-1$
            boolean isValid = !"".equals(textBox.getText()) && textBox.getText() != null;
            if (!isValid) {
                MessageDialogBox dialogBox = new MessageDialogBox(Messages.getString("error"), Messages.getString("urlNotSpecified"), false, false, // $NON-NLS-1$ //$NON-NLS-2$
                true);
                dialogBox.center();
            }
            return isValid;
        }
    };
    PromptDialogBox promptDialog = new PromptDialogBox(Messages.getString("enterURL"), Messages.getString("ok"), Messages.getString("cancel"), false, true, // $NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
    textBox);
    promptDialog.setValidatorCallback(validatorCallback);
    promptDialog.setCallback(callback);
    // $NON-NLS-1$
    promptDialog.setWidth("500px");
    promptDialog.center();
}
Also used : MessageDialogBox(org.pentaho.gwt.widgets.client.dialogs.MessageDialogBox) PromptDialogBox(org.pentaho.gwt.widgets.client.dialogs.PromptDialogBox) TextBox(com.google.gwt.user.client.ui.TextBox) IDialogCallback(org.pentaho.gwt.widgets.client.dialogs.IDialogCallback) IDialogValidatorCallback(org.pentaho.gwt.widgets.client.dialogs.IDialogValidatorCallback)

Aggregations

IDialogCallback (org.pentaho.gwt.widgets.client.dialogs.IDialogCallback)2 IDialogValidatorCallback (org.pentaho.gwt.widgets.client.dialogs.IDialogValidatorCallback)2 TextBox (com.google.gwt.user.client.ui.TextBox)1 MessageDialogBox (org.pentaho.gwt.widgets.client.dialogs.MessageDialogBox)1 PromptDialogBox (org.pentaho.gwt.widgets.client.dialogs.PromptDialogBox)1