Java Code Examples for org.pentaho.ui.xul.components.XulMessageBox#open()

The following examples show how to use org.pentaho.ui.xul.components.XulMessageBox#open() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: BaseStepGenericXulDialog.java    From pentaho-kettle with Apache License 2.0 6 votes vote down vote up
public int showPromptMessage( final String message, final String title, Object[] buttons ) {

    try {

      final XulMessageBox msg = (XulMessageBox) document.createElement( "messagebox" );
      msg.setModalParent( modalParent );
      msg.setTitle( title );
      msg.setMessage( message );
      msg.setButtons( buttons );
      return msg.open();

    } catch ( XulException e ) {
      log.logError( "Error displaying message: {0}", message );
    }
    return -1;
  }
 
Example 2
Source File: XulDatabaseExplorerController.java    From pentaho-kettle with Apache License 2.0 6 votes vote down vote up
public void displayRowCount() {
  if ( this.model.getTable() == null ) {
    return;
  }
  try {
    GetTableSizeProgressDialog pd =
      new GetTableSizeProgressDialog(
        this.dbExplorerDialog.getShell(), this.model.getDatabaseMeta(), this.model.getTable(), model
          .getSchema() );
    Long theCount = pd.open();
    if ( theCount != null ) {
      XulMessageBox theMessageBox = (XulMessageBox) document.createElement( "messagebox" );
      theMessageBox.setModalParent( this.dbExplorerDialog.getShell() );
      theMessageBox.setTitle( BaseMessages.getString( PKG, "DatabaseExplorerDialog.TableSize.Title" ) );
      theMessageBox.setMessage( BaseMessages.getString(
        PKG, "DatabaseExplorerDialog.TableSize.Message", this.model.getTable(), theCount.toString() ) );
      theMessageBox.open();
    }
  } catch ( XulException e ) {
    LogChannel.GENERAL.logError( "Error displaying row count", e );
  }
}
 
Example 3
Source File: MainController.java    From pentaho-aggdesigner with GNU General Public License v2.0 6 votes vote down vote up
public boolean promptIfSaveRequired() throws XulException {
  // prompt to save if the app is in a non-saved state
  if (workspace.isApplicationUnlocked() && !workspace.getWorkspaceUpToDate()) {
    XulMessageBox msgBox = (XulMessageBox) document.createElement("messagebox");
    msgBox.setTitle(Messages.getString("MainController.SaveWorkspaceTitle"));
    msgBox.setMessage(Messages.getString("MainController.SaveWorkspaceMessage"));
    msgBox.setButtons(new String[]{
        Messages.getString("MainController.SaveButton"),
        Messages.getString("MainController.DoNotSaveButton"),
        Messages.getString("MainController.CancelButton")});

    int id = msgBox.open();
    if (id == 2) { // CANCEL
      return false;
    } else if (id == 0) { // SAVE
      // what if they click cancel?
      return saveWorkspace(false);
    }
  }
  return true;
}
 
Example 4
Source File: BaseStepGenericXulDialog.java    From pentaho-kettle with Apache License 2.0 5 votes vote down vote up
public void showMessage( final String message, final String title ) {

    try {

      final XulMessageBox msg = (XulMessageBox) document.createElement( "messagebox" );
      msg.setModalParent( modalParent );
      msg.setTitle( title );
      msg.setMessage( message );
      msg.open();

    } catch ( XulException e ) {
      log.logError( "Error displaying message: {0}", message );
    }

  }
 
Example 5
Source File: FragmentHandler.java    From pentaho-kettle with Apache License 2.0 5 votes vote down vote up
protected void showMessage( String message ) {
  try {
    XulMessageBox box = (XulMessageBox) document.createElement( "messagebox" );
    box.setMessage( message );
    box.open();
  } catch ( XulException e ) {
    System.out.println( "Error creating messagebox " + e.getMessage() );
  }
}
 
Example 6
Source File: DataHandler.java    From pentaho-kettle with Apache License 2.0 5 votes vote down vote up
protected void showMessage( String message, boolean scroll ) {
  try {
    XulMessageBox box = (XulMessageBox) document.createElement( "messagebox" );
    box.setMessage( message );
    box.setModalParent( ( (XulRoot) document.getElementById( "general-datasource-window" ) ).getRootObject() );
    if ( scroll ) {
      box.setScrollable( true );
      box.setWidth( 500 );
      box.setHeight( 400 );
    }
    box.open();
  } catch ( XulException e ) {
    System.out.println( "Error creating messagebox " + e.getMessage() );
  }
}
 
Example 7
Source File: AbsController.java    From pentaho-kettle with Apache License 2.0 5 votes vote down vote up
/**
 * Save the permission for the selected role
 */
public void applyRoleActionPermission() {
  XulMessageBox messageBox = this.getMessageBox();
  IUIRole role = null;
  IUIAbsRole absRole = null;
  try {
    role = absSecurity.getSelectedRole();
    if ( role instanceof IUIAbsRole ) {
      absRole = (IUIAbsRole) role;
    } else {
      throw new IllegalStateException();
    }
    ( (IAbsSecurityManager) service ).setLogicalRoles( absRole.getName(), absRole.getLogicalRoles() );
    messageBox.setTitle( BaseMessages.getString( PKG, "Dialog.Success" ) );//$NON-NLS-1$
    messageBox.setAcceptLabel( BaseMessages.getString( PKG, "Dialog.Ok" ) );//$NON-NLS-1$
    messageBox.setMessage( BaseMessages.getString( PKG, "AbsController.RoleActionPermission.Success" ) );//$NON-NLS-1$
    messageBox.open();
    // Refresh permissions in open tabs
    SpoonPluginManager.getInstance().notifyLifecycleListeners(
        SpoonLifecycleListener.SpoonLifeCycleEvent.REPOSITORY_CHANGED );
  } catch ( KettleException e ) {
    messageBox.setTitle( BaseMessages.getString( PKG, "Dialog.Error" ) );//$NON-NLS-1$
    messageBox.setAcceptLabel( BaseMessages.getString( PKG, "Dialog.Ok" ) );//$NON-NLS-1$
    messageBox.setMessage( BaseMessages.getString( PKG,
        "AbsController.RoleActionPermission.UnableToApplyPermissions", role.getName(), e.getLocalizedMessage() ) );//$NON-NLS-1$
    messageBox.open();
  }
}
 
Example 8
Source File: AbsController.java    From pentaho-kettle with Apache License 2.0 5 votes vote down vote up
/**
 * Save the permission for the selected system role
 */
public void applySystemRoleActionPermission() {
  XulMessageBox messageBox = this.getMessageBox();
  IUIRole role = null;
  IUIAbsRole absRole = null;
  try {
    role = absSecurity.getSelectedSystemRole();
    if ( role instanceof IUIAbsRole ) {
      absRole = (IUIAbsRole) role;
    } else {
      throw new IllegalStateException();
    }
    ( (IAbsSecurityManager) service ).setLogicalRoles( absRole.getName(), absRole.getLogicalRoles() );
    messageBox.setTitle( BaseMessages.getString( PKG, "Dialog.Success" ) );//$NON-NLS-1$
    messageBox.setAcceptLabel( BaseMessages.getString( PKG, "Dialog.Ok" ) );//$NON-NLS-1$
    messageBox.setMessage( BaseMessages.getString( PKG, "AbsController.RoleActionPermission.Success" ) );//$NON-NLS-1$
    messageBox.open();
    // Refresh permissions in open tabs
    SpoonPluginManager.getInstance().notifyLifecycleListeners(
        SpoonLifecycleListener.SpoonLifeCycleEvent.REPOSITORY_CHANGED );
  } catch ( KettleException e ) {
    messageBox.setTitle( BaseMessages.getString( PKG, "Dialog.Error" ) );//$NON-NLS-1$
    messageBox.setAcceptLabel( BaseMessages.getString( PKG, "Dialog.Ok" ) );//$NON-NLS-1$
    messageBox.setMessage( BaseMessages.getString( PKG,
        "AbsController.RoleActionPermission.UnableToApplyPermissions", role.getName(), e.getLocalizedMessage() ) );//$NON-NLS-1$
    messageBox.open();
  }
}
 
Example 9
Source File: RepositoryLockController.java    From pentaho-kettle with Apache License 2.0 5 votes vote down vote up
public void viewLockNote() throws Exception {
  List<UIRepositoryObject> selectedRepoObjects = browseController.getSelectedFileItems();
  if ( selectedRepoObjects.size() > 0 && selectedRepoObjects.get( 0 ) instanceof UIRepositoryContent ) {
    final UIRepositoryContent contentToLock = (UIRepositoryContent) selectedRepoObjects.get( 0 );

    XulMessageBox msgBox = (XulMessageBox) document.createElement( "messagebox" ); //$NON-NLS-1$
    msgBox.setTitle( BaseMessages.getString( PKG, "PurRepository.LockNote.Title" ) ); //$NON-NLS-1$
    msgBox.setMessage( ( (ILockObject) contentToLock ).getLockMessage() );

    msgBox.open();
  }
}
 
Example 10
Source File: PurRepositoryDialog.java    From pentaho-kettle with Apache License 2.0 5 votes vote down vote up
private void displayRepositoryAlreadyExistMessage( String name ) {
  try {
    XulMessageBox messageBox = (XulMessageBox) container.getDocumentRoot().createElement( "messagebox" );
    messageBox.setTitle( resourceBundle.getString( "Dialog.Error" ) );//$NON-NLS-1$
    messageBox.setAcceptLabel( resourceBundle.getString( "Dialog.Ok" ) );//$NON-NLS-1$
    messageBox.setMessage( BaseMessages.getString( PKG, "PurRepositoryDialog.Dialog.ErrorIdExist.Message", name ) );//$NON-NLS-1$
    messageBox.open();

  } catch ( XulException e ) {
    throw new RuntimeException( e );
  }
}
 
Example 11
Source File: ExportHandler.java    From pentaho-aggdesigner with GNU General Public License v2.0 5 votes vote down vote up
public void openDialog() throws Exception {
  if (getEnabledAggs().size() == 0) {
    XulMessageBox msgBox = (XulMessageBox) document.createElement(ELEM_ID_MESSAGEBOX);
    msgBox.setMessage(Messages.getString("ExportHandler.NoAggsDefinedOrEnabled")); //$NON-NLS-1$
    msgBox.open();

    logger.info("Exiting showRelationalPreview as there are no Aggs defined");
    return;
  }
  XulDialog dialog = (XulDialog) document.getElementById(ELEM_ID_EXPORT_DIALOG);
  dialog.show();
}