Java Code Examples for org.pentaho.ui.xul.containers.XulDialog#show()

The following examples show how to use org.pentaho.ui.xul.containers.XulDialog#show() . 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: XulPreviewRowsDialog.java    From pentaho-kettle with Apache License 2.0 6 votes vote down vote up
public void open() {
  try {
    KettleXulLoader theLoader = new KettleXulLoader();
    theLoader.setSettingsManager( XulSpoonSettingsManager.getInstance() );
    theLoader.setOuterContext( this.shell );
    this.container = theLoader.loadXul( XUL );

    this.controller =
      new XulPreviewRowsController( this.shell, this.databaseMeta, this.schema, this.table, this.limit );
    this.container.addEventHandler( this.controller );

    this.runner = new SwtXulRunner();
    this.runner.addContainer( this.container );
    this.runner.initialize();

    XulDialog thePreviewDialog =
      (XulDialog) this.container.getDocumentRoot().getElementById( "previewRowsDialog" );
    thePreviewDialog.show();

  } catch ( Exception e ) {
    logger.info( e );
  }
}
 
Example 2
Source File: XulStepFieldsDialog.java    From pentaho-kettle with Apache License 2.0 6 votes vote down vote up
public void open( boolean isAcceptButtonHidden ) {
  try {
    KettleXulLoader theLoader = new KettleXulLoader();
    theLoader.setOuterContext( this.shell );
    theLoader.setSettingsManager( XulSpoonSettingsManager.getInstance() );
    this.container = theLoader.loadXul( XUL );

    this.controller =
      new XulStepFieldsController( this.shell, this.databaseMeta, this.schemaTableCombo, this.rowMeta );
    this.controller.setShowAcceptButton( isAcceptButtonHidden );
    this.container.addEventHandler( this.controller );

    this.runner = new SwtXulRunner();
    this.runner.addContainer( this.container );
    this.runner.initialize();

    XulDialog thePreviewDialog =
      (XulDialog) this.container.getDocumentRoot().getElementById( "stepFieldsDialog" );
    thePreviewDialog.show();
    ( (SwtDialog) thePreviewDialog ).dispose();
  } catch ( Exception e ) {
    logger.info( e );
  }
}
 
Example 3
Source File: XulDatabaseExplorerDialog.java    From pentaho-kettle with Apache License 2.0 5 votes vote down vote up
public boolean open() {
  try {

    KettleXulLoader theLoader = new KettleXulLoader();
    theLoader.setSettingsManager( XulSpoonSettingsManager.getInstance() );
    theLoader.setSettingsManager( new DefaultSettingsManager( new File( Const.getKettleDirectory()
      + Const.FILE_SEPARATOR + "xulSettings.properties" ) ) );
    theLoader.setOuterContext( this.shell );

    this.container = theLoader.loadXul( XUL, new XulDatabaseExplorerResourceBundle() );

    XulDialog theExplorerDialog =
      (XulDialog) this.container.getDocumentRoot().getElementById( "databaseExplorerDialog" );

    SpoonPluginManager.getInstance().applyPluginsForContainer( "database_dialog", container );

    this.controller =
      new XulDatabaseExplorerController(
        this.shell, this.databaseMeta, this.databases, look );

    this.container.addEventHandler( this.controller );

    this.runner = new SwtXulRunner();
    this.runner.addContainer( this.container );

    this.runner.initialize();

    this.controller.setSelectedSchemaAndTable( schemaName, selectedTable );

    // show dialog if connection is success only.
    if ( controller.getActionStatus() == UiPostActionStatus.OK ) {
      theExplorerDialog.show();
    }

  } catch ( Exception e ) {
    LogChannel.GENERAL.logError( "Error exploring database", e );
  }
  return this.controller.getSelectedTable() != null;
}
 
Example 4
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();
}
 
Example 5
Source File: ExportHandler.java    From pentaho-aggdesigner with GNU General Public License v2.0 5 votes vote down vote up
public void startExecuteDml() {
  if (logger.isDebugEnabled()) {
    logger.debug("enter startExecuteDdlDml");
  }

  XulDialog dialog = (XulDialog) document.getElementById(ELEM_ID_EXEC_PROGRESS_DIALOG);
  Assert.notNull(dialog, "could not find element with id '" + ELEM_ID_EXEC_PROGRESS_DIALOG + "'");

  final ExecutorCallback cb = new ExecutorCallback() {
    public void executionComplete(Exception e) {
      ExportHandler.this.done(e);
    }
  };

  new Thread() {

    @Override
    public void run() {
      if (logger.isDebugEnabled()) {
        logger.debug("enter run");
      }

      List<String> sqls = ExportHandler.this.getOutput(false, true);

      ExportHandler.this.ddlDmlExecutor.execute(sqls.toArray(new String[0]), cb);

      if (logger.isDebugEnabled()) {
        logger.debug("exit run");
      }

    }

  }.start();

  dialog.show();
  if (logger.isDebugEnabled()) {
    logger.debug("exit startExecuteDdlDml");
  }
}
 
Example 6
Source File: ConnectionController.java    From pentaho-aggdesigner with GNU General Public License v2.0 5 votes vote down vote up
@RequestHandler
public void loadDatabaseDialog() {
  dataHandler.setData(connectionModel.getDatabaseMeta());

  XulDialog dialog = (XulDialog) document.getElementById(GENERAL_DATASOURCE_WINDOW);
  dialog.show();

  DatabaseMeta databaseMeta = (DatabaseMeta) dataHandler.getData();

  if (databaseMeta != null) {
    connectionModel.setDatabaseMeta(databaseMeta);
  }
}
 
Example 7
Source File: EmbeddedWizard.java    From pentaho-reporting with GNU Lesser General Public License v2.1 4 votes vote down vote up
public AbstractReportDefinition run( final AbstractReportDefinition original ) throws ReportProcessingException {
  // Set the report if we have one otherwise create a new one
  if ( original != null ) {
    wizardController.getEditorModel().setReportDefinition( original, true );
  } else {
    final MasterReport report = new MasterReport();
    report.setDataFactory( new CompoundDataFactory() );
    report.setQuery( null );
    report.setAutoSort( Boolean.TRUE );
    wizardController.getEditorModel().setReportDefinition( report, false );
  }

  // Create the gui
  try {
    final SwingXulLoader loader = new SwingXulLoader();
    loader.setOuterContext( owner );

    final XulDomContainer mainWizardContainer = new SwingXulLoader().loadXul( MAIN_WIZARD_PANEL );
    new WizardContentPanel( wizardController ).addContent( mainWizardContainer );
    mainWizardContainer.setOuterContext( this.owner );
    wizardController.registerMainXULContainer( mainWizardContainer );
    wizardController.onLoad();

    final Document documentRoot = mainWizardContainer.getDocumentRoot();
    final XulComponent root = documentRoot.getRootElement();

    if ( !( root instanceof XulDialog ) ) {
      throw new XulException(
        Messages.getInstance().getString( "EMBEDDED_WIZARD.Root_Error" ) + " " + root ); //$NON-NLS-1$ //$NON-NLS-2$
    }

    dialog = (XulDialog) root;
    // This is a hack to get the JDialog (this wizard) to become the parent window of windows/dialogs
    // that the wizard creates.
    final DesignTimeContext context = new DefaultWizardDesignTimeContext
      ( wizardController.getEditorModel(), (Window) dialog.getRootObject(), designTimeContext );
    dataSourceAndQueryStep.setDesignTimeContext( context );
    wizardController.setDesignTimeContext( context );

    // if we're doing an edit drop into the layout step
    if ( wizardController.getEditorModel().isEditing() ) {
      if ( wizardController.getStep( 0 ).isValid() ) {
        wizardController.setActiveStep( 1 ); // initializes the data
        if ( wizardController.getStep( 1 ).isValid() ) {
          wizardController.setActiveStep( 2 );
        }
      }
    }

    dialog.show();

  } catch ( Exception e ) {
    DebugLog.log( "Failed to initialize the wizard", e );
    return null;
  }

  // -----------------------------------
  if ( !wizardController.isFinished() ) {
    return null;
  }
  final AbstractReportDefinition reportDefinition = wizardController.getEditorModel().getReportDefinition();
  try {
    final WizardSpecification spec = wizardController.getEditorModel().getReportSpec();
    WizardProcessorUtil.applyWizardSpec( reportDefinition, spec );
    WizardProcessorUtil.ensureWizardProcessorIsAdded( reportDefinition, null );
  } catch ( Exception ex ) {
    throw new IllegalStateException();
  }

  if ( reportDefinition instanceof MasterReport ) {
    return WizardProcessorUtil.materialize( (MasterReport) reportDefinition, new WizardProcessor() );
  } else if ( reportDefinition instanceof SubReport ) {
    return WizardProcessorUtil.materialize( (SubReport) reportDefinition, new WizardProcessor() );
  } else {
    throw new IllegalStateException();
  }
}
 
Example 8
Source File: OldSwtMqlEditor.java    From mql-editor with GNU Lesser General Public License v2.1 4 votes vote down vote up
public void show() {
  XulDialog dialog = (XulDialog) container.getDocumentRoot().getElementById( "mqlEditorDialog" );
  dialog.show();

}
 
Example 9
Source File: AbstractMqlEditor.java    From mql-editor with GNU Lesser General Public License v2.1 4 votes vote down vote up
public void show() {
  XulDialog dialog = (XulDialog) container.getDocumentRoot().getElementById( "mqlEditorDialog" );
  dialog.show();
}
 
Example 10
Source File: RepositoryExplorer.java    From pentaho-kettle with Apache License 2.0 4 votes vote down vote up
public void show() {
  XulDialog dialog = (XulDialog) container.getDocumentRoot().getElementById( "repository-explorer-dialog" );
  dialog.show();

}
 
Example 11
Source File: PurRepositoryDialog.java    From pentaho-kettle with Apache License 2.0 4 votes vote down vote up
public void show() {
  XulDialog dialog = (XulDialog) container.getDocumentRoot().getElementById( "repository-config-dialog" ); //$NON-NLS-1$
  dialog.show();
}
 
Example 12
Source File: ExportHandler.java    From pentaho-aggdesigner with GNU General Public License v2.0 4 votes vote down vote up
public void startExecuteDdl() {
  if (logger.isDebugEnabled()) {
    logger.debug("enter startExecuteDdlDml");
  }

  XulDialog dialog = (XulDialog) document.getElementById(ELEM_ID_EXEC_PROGRESS_DIALOG);
  Assert.notNull(dialog, "could not find element with id '" + ELEM_ID_EXEC_PROGRESS_DIALOG + "'");

  final ExecutorCallback cb = new ExecutorCallback() {
    public void executionComplete(Exception e) {
      ExportHandler.this.done(e);
      if (ddlExecCallbackService != null && ddlExecCallbackService.getDdlCallbacks() != null) {
          for (DDLExecutionCompleteCallback callback : ddlExecCallbackService.getDdlCallbacks()) {
              callback.executionComplete(getEnabledAggs(), e);
          }
      }
    }
  };

  new Thread() {

    @Override
    public void run() {
      if (logger.isDebugEnabled()) {
        logger.debug("enter run");
      }

      List<String> sqls = ExportHandler.this.getOutput(true, false);

      ExportHandler.this.ddlDmlExecutor.execute(sqls.toArray(new String[0]), cb);

      if (logger.isDebugEnabled()) {
        logger.debug("exit run");
      }

    }

  }.start();

  dialog.show();
  if (logger.isDebugEnabled()) {
    logger.debug("exit startExecuteDdlDml");
  }
}
 
Example 13
Source File: MainController.java    From pentaho-aggdesigner with GNU General Public License v2.0 4 votes vote down vote up
public void helpAboutOpen() {
  XulDialog helpAboutDialog = (XulDialog) document.getElementById("helpAboutDialog");
  helpAboutDialog.show();
}
 
Example 14
Source File: ConnectionController.java    From pentaho-aggdesigner with GNU General Public License v2.0 4 votes vote down vote up
@RequestHandler
public void showConnectionDialog() {
  logger.debug("In Thread showing mondrian dialog");
  XulDialog connectionDialog = (XulDialog) document.getElementById(CONNECTION_DIALOG);
  connectionDialog.show();
}
 
Example 15
Source File: AlgorithmController.java    From pentaho-aggdesigner with GNU General Public License v2.0 4 votes vote down vote up
public void openDialog(){
  dialog = (XulDialog) document.getElementById("algorithm_dialog");
  dialog.show();
}