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
}
}
}
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();
}
Aggregations