Java Code Examples for org.pentaho.ui.xul.dom.Document#getRootElement()
The following examples show how to use
org.pentaho.ui.xul.dom.Document#getRootElement() .
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: XulDatabaseDialog.java From pentaho-reporting with GNU Lesser General Public License v2.1 | 6 votes |
public XulDatabaseDialog( final Window parent, final DesignTimeContext designTimeContext ) throws XulException { this.designTimeContext = designTimeContext; final SwingXulLoader loader = new SwingXulLoader(); if ( parent != null ) { loader.setOuterContext( parent ); } final XulDomContainer container = loader.loadXul( DIALOG_DEFINITION_FILE, Messages.getBundle() ); container.getDocumentRoot().addOverlay( OVERLAY_DEFINITION_FILE ); container.initialize(); handler = new XulDatabaseHandler(); container.addEventHandler( handler ); //$NON-NLS-1$ final Document documentRoot = container.getDocumentRoot(); final XulComponent root = documentRoot.getRootElement(); if ( root instanceof XulDialog ) { dialog = (XulDialog) root; dialog.setResizable( Boolean.TRUE ); } else { throw new XulException( "Error getting Xul Database Dialog root, element of type: " + root ); } }
Example 2
Source File: XulDatabaseDialog.java From pentaho-reporting with GNU Lesser General Public License v2.1 | 5 votes |
public XulDatabaseDialog( final Window parent ) throws XulException { final SwingXulLoader loader = new SwingXulLoader(); if ( parent != null ) { loader.setOuterContext( parent ); } final XulDomContainer container = loader.loadXul( DIALOG_DEFINITION_FILE, Messages.getBundle() ); container.getDocumentRoot().addOverlay( OVERLAY_DEFINITION_FILE ); container.initialize(); handler = new XulDatabaseHandler(); container.addEventHandler( handler ); //$NON-NLS-1$ final Document documentRoot = container.getDocumentRoot(); final XulComponent root = documentRoot.getRootElement(); if ( root instanceof XulDialog ) { dialog = (XulDialog) root; dialog.setResizable( Boolean.TRUE ); } else { throw new XulException( "Error getting Xul Database Dialog root, element of type: " + root ); } final ObjectFactory objectFactory = ClassicEngineBoot.getInstance().getObjectFactory(); final IDatabaseDialectService dialectService = objectFactory.get( IDatabaseDialectService.class ); this.databaseTypeHelper = new DatabaseTypeHelper( dialectService.getDatabaseTypes() ); }
Example 3
Source File: StandaloneWizard.java From pentaho-reporting with GNU Lesser General Public License v2.1 | 5 votes |
public StandaloneWizard() { wizardController = new LinearWizardController( new WizardEditorModel(), new DefaultBindingFactory() ); wizardController.addPropertyChangeListener( new CloseListener() ); final DataSourceAndQueryStep dataSourceAndQueryStep = new DataSourceAndQueryStep(); // add the steps .. wizardController.addStep( new LookAndFeelStep() ); wizardController.addStep( dataSourceAndQueryStep ); wizardController.addStep( new LayoutStep() ); wizardController.addStep( new FormatStep() ); try { final XulDomContainer mainWizardContainer = new SwingXulLoader().loadXul( MAIN_WIZARD_PANEL ); new WizardContentPanel( wizardController ).addContent( mainWizardContainer ); wizardController.registerMainXULContainer( mainWizardContainer ); final Document documentRoot = mainWizardContainer.getDocumentRoot(); final XulDialog root = (XulDialog) documentRoot.getRootElement(); final Window window = (Window) root.getRootObject(); final DesignTimeContext designTimeContext = new DefaultWizardDesignTimeContext( wizardController.getEditorModel(), window ); dataSourceAndQueryStep.setDesignTimeContext( designTimeContext ); wizardController.setDesignTimeContext( designTimeContext ); final XulRunner runner = new SwingXulRunner(); runner.addContainer( mainWizardContainer ); runner.initialize(); runner.start(); } catch ( Exception e ) { ExceptionDialog.showExceptionDialog( null, "Error", e.getMessage(), e ); } }
Example 4
Source File: EmbeddedWizard.java From pentaho-reporting with GNU Lesser General Public License v2.1 | 4 votes |
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(); } }