org.pentaho.ui.xul.XulException Java Examples
The following examples show how to use
org.pentaho.ui.xul.XulException.
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: ReportDesignerFrame.java From pentaho-reporting with GNU Lesser General Public License v2.1 | 6 votes |
private void insertReports( final TreeModel model, final Object currentLevel, final XulMenupopup popup ) throws XulException { final int childCount = model.getChildCount( currentLevel ); for ( int i = 0; i < childCount; i += 1 ) { final ReportDesignerView frame = context.getView(); final Object child = model.getChild( currentLevel, i ); if ( model.isLeaf( child ) ) { final DefaultMutableTreeNode node = (DefaultMutableTreeNode) child; final File file = new File( String.valueOf( node.getUserObject() ) ); final OpenSampleReportAction action = new OpenSampleReportAction( file, node.toString() ); action.setReportDesignerContext( context ); popup.addChild( frame.createMenuItem( action ) ); } else { final XulMenupopup childPopup = frame.createPopupMenu( String.valueOf( child ), popup ); insertReports( model, child, childPopup ); } } }
Example #2
Source File: ExportHandler.java From pentaho-aggdesigner with GNU General Public License v2.0 | 6 votes |
public void setConnected(boolean connected) throws XulException { final String OVERLAY = "org/pentaho/aggdes/ui/resources/exportDialogOverlay.xul"; //$NON-NLS-1$ if (!connected) { document.removeOverlay(OVERLAY); overlayAdded = false; return; } boolean addOverlay = false; Class[] classes = outputService.getSupportedArtifactGeneratorClasses(); for (Class clazz : classes) { if (PopulateScriptGenerator.class.isAssignableFrom(clazz)) { // just check for DML and assume that schema generator is there too addOverlay = true; } } if (addOverlay) { // don't add more than once if (!overlayAdded) { document.addOverlay(OVERLAY); overlayAdded = true; } } }
Example #3
Source File: MainController.java From pentaho-aggdesigner with GNU General Public License v2.0 | 6 votes |
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: BeamPerspective.java From kettle-beam with Apache License 2.0 | 6 votes |
public XulTabAndPanel createTab() { try { XulTab tab = (XulTab) document.createElement( "tab" ); XulTabpanel panel = (XulTabpanel) document.createElement( "tabpanel" ); panel.setSpacing( 0 ); panel.setPadding( 0 ); tabs.addChild( tab ); panels.addChild( panel ); tabbox.setSelectedIndex( panels.getChildNodes().indexOf( panel ) ); tab.addPropertyChangeListener( new PropertyChangeListener() { @Override public void propertyChange( PropertyChangeEvent evt ) { LogChannel.GENERAL.logBasic( "Property changed: " + evt.getPropertyName() + ", " + evt.toString() ); } } ); return new XulTabAndPanel( tab, panel ); } catch ( XulException e ) { e.printStackTrace(); } return null; }
Example #5
Source File: StarModelerPerspective.java From pentaho-kettle with Apache License 2.0 | 6 votes |
public boolean onFileClose() { int idx = tabbox.getSelectedIndex(); if (idx == -1 || idx >= tabbox.getTabs().getChildNodes().size()) { return false; } try { if (onTabClose(idx)) { XulComponent panel = panels.getChildNodes().get(idx); XulComponent tab = tabs.getChildNodes().get(idx); panels.removeChild(panel); tabs.removeChild(tab); return true; } } catch (XulException e) { e.printStackTrace(); } return false; }
Example #6
Source File: FragmentHandler.java From pentaho-kettle with Apache License 2.0 | 6 votes |
protected void loadDatabaseOptionsFragment( String fragmentUri ) throws XulException { XulComponent groupElement = document.getElementById( "database-options-box" ); XulComponent parentElement = groupElement.getParent(); XulDomContainer fragmentContainer; try { // Get new group box fragment ... // This will effectively set up the SWT parent child relationship... fragmentContainer = this.xulDomContainer.loadFragment( fragmentUri, Messages.getBundle() ); XulComponent newGroup = fragmentContainer.getDocumentRoot().getFirstChild(); parentElement.replaceChild( groupElement, newGroup ); } catch ( XulException e ) { e.printStackTrace(); throw e; } }
Example #7
Source File: Neo4jPerspective.java From knowbi-pentaho-pdi-neo4j-output with Apache License 2.0 | 6 votes |
public XulTabAndPanel createTab() { try { XulTab tab = (XulTab) document.createElement( "tab" ); XulTabpanel panel = (XulTabpanel) document.createElement( "tabpanel" ); panel.setSpacing( 0 ); panel.setPadding( 0 ); tabs.addChild( tab ); panels.addChild( panel ); tabbox.setSelectedIndex( panels.getChildNodes().indexOf( panel ) ); tab.addPropertyChangeListener( new PropertyChangeListener() { @Override public void propertyChange( PropertyChangeEvent evt ) { LogChannel.GENERAL.logBasic( "Property changed: " + evt.getPropertyName() + ", " + evt.toString() ); } } ); return new XulTabAndPanel( tab, panel ); } catch ( XulException e ) { e.printStackTrace(); } return null; }
Example #8
Source File: ConnectionEditorPanel.java From pentaho-reporting with GNU Lesser General Public License v2.1 | 6 votes |
public void actionPerformed( final ActionEvent e ) { try { final Window parentWindow = LibSwingUtil.getWindowAncestor( ConnectionEditorPanel.this ); final XulDatabaseDialog connectionDialog = new XulDatabaseDialog( parentWindow ); final IDatabaseConnection connectionDefinition = connectionDialog.open( null ); if ( connectionDefinition != null && !StringUtils.isEmpty( connectionDefinition.getName() ) ) { // A new JNDI source was created dialogModel.createDatasource( connectionDefinition ); dataSourceModel.addElement( connectionDefinition ); dataSourceList.setSelectedValue( connectionDefinition, true ); } } catch ( XulException e1 ) { UncaughtExceptionsModel.getInstance().addException( e1 ); } }
Example #9
Source File: BaseStepGenericXulDialog.java From pentaho-kettle with Apache License 2.0 | 6 votes |
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 #10
Source File: BaseStepGenericXulDialog.java From pentaho-kettle with Apache License 2.0 | 6 votes |
protected void initializeXul( XulLoader loader, BindingFactory bindingFactory, XulRunner runner, Object parent ) throws XulException { bf = bindingFactory; this.runner = runner; loader.registerClassLoader( getClass().getClassLoader() ); loader.setSettingsManager( getSettingsManager() ); loader.setOuterContext( parent ); container = loader.loadXul( xulFile, getResourceBundle() ); bf.setDocument( container.getDocumentRoot() ); for ( XulEventHandler h : getEventHandlers() ) { container.addEventHandler( h ); } this.runner.addContainer( container ); // try and get the dialog xulDialog = (XulDialog) container.getDocumentRoot().getRootElement(); runner.initialize(); }
Example #11
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 #12
Source File: ConnectionControllerTest.java From pentaho-aggdesigner with GNU General Public License v2.0 | 6 votes |
@Test public void testApply_Success() throws XulException, AggDesignerException { setupSchemaProviderDefaults(); context.checking(new Expectations() { { //using dialog stub here instead of a mock so we get thread blocking which is needed to have this test run sucessfully final XulDialog waitDialog = new XulDialogStub(); allowing(doc).getElementById(ConnectionController.ANON_WAIT_DIALOG); will(returnValue(waitDialog)); one(model).setCubeNames(cubeNames); one(model).setSelectedSchemaModel(providerModel); } }); controller.apply(); }
Example #13
Source File: AbstractWizardStep.java From pentaho-reporting with GNU Lesser General Public License v2.1 | 6 votes |
/** * @throws XulException */ public void createPresentationComponent( final XulDomContainer mainWizardContainer ) throws XulException { final XulVbox stepContainer = (XulVbox) mainWizardContainer.getDocumentRoot().getElementById( STEP_CONTAINER ); XulHbox row = (XulHbox) mainWizardContainer.getDocumentRoot().createElement( XUL_HBOX_TYPE ); // Create and add the activeImage to the row (goes in the first column) stepImage = (XulImage) mainWizardContainer.getDocumentRoot().createElement( XUL_IMAGE_TYPE ); stepImage.setSrc( STEP_IMAGE_SRC ); stepImage.setId( this.getStepName() ); stepImage.setVisible( false ); row.addChild( stepImage ); // Create and add the text label to the row (goes in the second column) stepLabel = (XulLabel) mainWizardContainer.getDocumentRoot().createElement( XUL_LABEL_TYPE ); stepLabel.setValue( this.getStepName() ); stepLabel.setFlex( 1 ); stepLabel.setDisabled( true ); row.addChild( stepLabel ); stepContainer.addChild( row ); }
Example #14
Source File: AbstractPreviewRowsXulDialog.java From pentaho-kettle with Apache License 2.0 | 6 votes |
protected void initializeXul( XulLoader loader, BindingFactory bindingFactory, XulRunner runner, Object parent ) throws XulException { bf = bindingFactory; this.runner = runner; loader.registerClassLoader( getClass().getClassLoader() ); loader.setSettingsManager( getSettingsManager() ); loader.setOuterContext( parent ); container = loader.loadXul( xulFile, getResourceBundle() ); bf.setDocument( container.getDocumentRoot() ); for ( XulEventHandler h : getEventHandlers() ) { container.addEventHandler( h ); } this.runner.addContainer( container ); // try and get the dialog xulDialog = (XulDialog) container.getDocumentRoot().getRootElement(); runner.initialize(); }
Example #15
Source File: PartitionsController.java From pentaho-kettle with Apache License 2.0 | 6 votes |
protected boolean doLazyInit() { // Load the SWT Shell from the explorer dialog shell = ( (SwtDialog) document.getElementById( "repository-explorer-dialog" ) ).getShell(); try { mainController = (MainController) this.getXulDomContainer().getEventHandler( "mainController" ); } catch ( XulException e ) { return false; } enableButtons( true, false, false ); bf = new SwtBindingFactory(); bf.setDocument( this.getXulDomContainer().getDocumentRoot() ); if ( bf != null ) { createBindings(); } return true; }
Example #16
Source File: SlavesController.java From pentaho-kettle with Apache License 2.0 | 6 votes |
@Override protected boolean doLazyInit() { // Load the SWT Shell from the explorer dialog shell = ( (SwtDialog) document.getElementById( "repository-explorer-dialog" ) ).getShell(); enableButtons( true, false, false ); bf = new SwtBindingFactory(); bf.setDocument( this.getXulDomContainer().getDocumentRoot() ); try { mainController = (MainController) this.getXulDomContainer().getEventHandler( "mainController" ); } catch ( XulException e ) { return false; } if ( bf != null ) { createBindings(); } return true; }
Example #17
Source File: ConnectionPanel.java From pentaho-reporting with GNU Lesser General Public License v2.1 | 6 votes |
public void actionPerformed(final ActionEvent e) { final DesignTimeContext designTimeContext = getDesignTimeContext(); try { final Window parentWindow = LibSwingUtil.getWindowAncestor(ConnectionPanel.this); final XulDatabaseDialog connectionDialog = new XulDatabaseDialog(parentWindow, designTimeContext); final JdbcConnectionDefinition connectionDefinition = connectionDialog.open(null); if (connectionDefinition != null && !StringUtils.isEmpty(connectionDefinition.getName())) { // A new JNDI source was created if (getDialogModel().getConnectionDefinitionManager().updateSourceList(connectionDefinition) == false) { getDialogModel().addConnection(connectionDefinition); dataSourceList.setSelectedValue(connectionDefinition, true); } } } catch (XulException e1) { designTimeContext.error(e1); } }
Example #18
Source File: ExportHandler.java From pentaho-aggdesigner with GNU General Public License v2.0 | 5 votes |
public void copyDdlToClipboard() { try { XulTextbox ddlField = (XulTextbox) document.getElementById(ELEM_ID_DDL_FIELD); Assert.notNull(ddlField, "could not find element with id '" + ELEM_ID_DDL_FIELD + "'"); ((XulWindow) document.getRootElement()).copy(ddlField.getValue()); } catch (XulException e) { if (logger.isErrorEnabled()) { logger.error("an exception occurred", e); } } }
Example #19
Source File: OldSwtMqlEditor.java From mql-editor with GNU Lesser General Public License v2.1 | 5 votes |
private void loadOverlays() { // Load the overlay to remove the "dynamic" behavior of the "combine" column in the "conditions" table // SWT table cannot accommodate more then one widget type in a given column yet try { container.loadOverlay( "org/pentaho/commons/metadata/mqleditor/editor/xul/mainFrame-swt-overlay.xul" ); //$NON-NLS-1$ } catch ( XulException e ) { log.error( "Error loading Xul overlay: mainFrame-swt-overlay.xul" ); e.printStackTrace(); } }
Example #20
Source File: AbstractMqlEditor.java From mql-editor with GNU Lesser General Public License v2.1 | 5 votes |
private void init() { try { XulLoader loader = getLoader(); loader.setOuterContext( parentWindow ); container = loader.loadXul( "org/pentaho/commons/metadata/mqleditor/editor/xul/mainFrame.xul" ); getRunner().addContainer( container ); BindingFactory bf = new DefaultBindingFactory(); bf.setDocument( container.getDocumentRoot() ); mainController.setBindingFactory( bf ); selectedColumnController.setBindingFactory( bf ); constraintController.setBindingFactory( bf ); orderController.setBindingFactory( bf ); previewController.setBindingFactory( bf ); container.addEventHandler( mainController ); container.addEventHandler( selectedColumnController ); container.addEventHandler( constraintController ); container.addEventHandler( orderController ); container.addEventHandler( previewController ); mainController.setWorkspace( workspace ); selectedColumnController.setWorkspace( workspace ); constraintController.setWorkspace( workspace ); orderController.setWorkspace( workspace ); previewController.setWorkspace( workspace ); } catch ( XulException e ) { log.error( "error loading Xul application", e ); } }
Example #21
Source File: FormulaDialogTest.java From pentaho-reporting with GNU Lesser General Public License v2.1 | 5 votes |
public void testGui() throws XulException { if ( GraphicsEnvironment.isHeadless() ) { return; } ReportDesignerBoot.getInstance().start(); final FormulaEditorDialog dialog = GUIUtils.createFormulaEditorDialog( new DefaultReportDesignerContext( new TestReportDesignerView() ), null ); dialog.editFormula( "=AND(", new FieldDefinition[ 0 ] ); }
Example #22
Source File: SwtMqlEditor.java From mql-editor with GNU Lesser General Public License v2.1 | 5 votes |
@Override protected XulLoader getLoader() { if ( xulLoader == null ) { try { xulLoader = new SwtXulLoader(); } catch ( XulException e ) { log.error( "error loading Xul application", e ); } } return xulLoader; }
Example #23
Source File: FragmentHandlerTest.java From pentaho-kettle with Apache License 2.0 | 5 votes |
@Test public void testShowMessage() throws Exception { XulMessageBox messageBox = mock( XulMessageBox.class ); when( document.createElement( "messagebox" ) ).thenReturn( messageBox ); fragmentHandler.showMessage( null ); // Generate exception, should see a message in standard output when( document.createElement( "messagebox" ) ).thenThrow( new XulException() ); fragmentHandler.showMessage( "" ); }
Example #24
Source File: FragmentHandler.java From pentaho-kettle with Apache License 2.0 | 5 votes |
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 #25
Source File: BrowseController.java From pentaho-kettle with Apache License 2.0 | 5 votes |
protected XulPromptBox promptForName( final UIRepositoryObject object ) throws XulException { XulPromptBox prompt = (XulPromptBox) document.createElement( "promptbox" ); String currentName = ( object == null ) ? BaseMessages.getString( PKG, "BrowserController.NewFolder" ) : object.getName(); prompt.setTitle( BaseMessages.getString( PKG, "BrowserController.Name" ).concat( currentName ) ); prompt.setButtons( new DialogConstant[] { DialogConstant.OK, DialogConstant.CANCEL } ); prompt.setMessage( BaseMessages.getString( PKG, "BrowserController.NameLabel" ).concat( currentName ) ); prompt.setValue( currentName ); return prompt; }
Example #26
Source File: KettleXulLoader.java From pentaho-kettle with Apache License 2.0 | 5 votes |
public KettleXulLoader() throws XulException { parser.handlers.remove( "DIALOG" ); parser.registerHandler( "DIALOG", org.pentaho.di.ui.xul.KettleDialog.class.getName() ); parser.handlers.remove( "ICONWAITBOX" ); parser.registerHandler( "ICONWAITBOX", org.pentaho.di.ui.xul.KettleWaitBox.class.getName() ); }
Example #27
Source File: SpoonPluginManager.java From pentaho-kettle with Apache License 2.0 | 5 votes |
public void applyPluginsForContainer( final String category, final XulDomContainer container ) throws XulException { List<SpoonPluginInterface> plugins = pluginCategoryMap.get( category ); if ( plugins != null ) { for ( SpoonPluginInterface sp : plugins ) { sp.applyToContainer( category, container ); } } }
Example #28
Source File: AuthProviderController.java From pentaho-kettle with Apache License 2.0 | 5 votes |
public void setNewOverlay( AuthProvider provider ) throws XulException { if ( provider == null ) { provider = new NoAuthAuthProvider( bf ); } // Don't use this provider... it is the one that is created to populate // the combobox. Only use it to select the proper overlay, then // bind the provider associated with the NamedObject selected // in the main authProvider list. if ( this.activeProvider != null ) { getXulDomContainer().removeOverlay( activeProvider.getOverlay() ); } getXulDomContainer().loadOverlay( provider.getOverlay() ); if ( model.getSelectedItem() != null ) { AuthProvider current = (AuthProvider) model.getSelectedItem().getItem(); // Only bind the selected provider if it matches the overlay... the selected // provider may not have been updated and cloned yet. if ( current.getOverlay().equalsIgnoreCase( provider.getOverlay() ) ) { try { current.bind(); } catch ( Exception e ) { log.logError( resourceBundle.getString( "error.on_bind" ), e ); } } } this.activeProvider = provider; }
Example #29
Source File: DatabaseConnectionDialog.java From pentaho-kettle with Apache License 2.0 | 5 votes |
public XulDomContainer getSwtInstance( SwtXulLoader loader, Shell shell ) throws XulException { XulDomContainer container = null; Iterable<String> keyIterable = extendedClasses.keySet(); for ( Object key : keyIterable ) { loader.register( (String) key, extendedClasses.get( key ) ); } loader.setOuterContext( shell ); container = loader.loadXul( DIALOG_DEFINITION_FILE, Messages.getBundle() ); container.initialize(); return container; }
Example #30
Source File: SparkTuningPopupMenu.java From pentaho-kettle with Apache License 2.0 | 5 votes |
@Override public void applyToContainer( String category, XulDomContainer container ) throws XulException { if ( category.equals( "trans-graph" ) ) { container.registerClassLoader( getClass().getClassLoader() ); container.loadOverlay( "org/pentaho/di/engine/configuration/impl/spark/spark-tuning-menu.xul", resourceBundle ); container.addEventHandler( this.handler ); } }