org.pentaho.ui.xul.containers.XulTree Java Examples
The following examples show how to use
org.pentaho.ui.xul.containers.XulTree.
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: DataSourceAndQueryStep.java From pentaho-reporting with GNU Lesser General Public License v2.1 | 6 votes |
public void doEditDatasource() { final XulTree tree = (XulTree) document.getElementById( DATASOURCES_TREE_ID ); final DatasourceModelNode node = (DatasourceModelNode) tree.getSelectedItem(); switch( node.getType() ) { case CONNECTION: final DataFactory df = (DataFactory) node.getUserObject(); final DataFactoryMetaData o = getMetaForDataFactory( df, dataFactoryMetas ); editOrCreateDataFactory( o ); break; case QUERY: editQuery( node.getValue() ); break; default: break; } }
Example #2
Source File: ConnectionsController.java From pentaho-kettle with Apache License 2.0 | 6 votes |
private void createBindings() { refreshConnectionList(); connectionsTable = (XulTree) document.getElementById( "connections-table" ); // Bind the connection table to a list of connections bf.setBindingType( Binding.Type.ONE_WAY ); //CHECKSTYLE:LineLength:OFF try { bf.createBinding( dbConnectionList, "children", connectionsTable, "elements" ).fireSourceChanged(); ( bindButtonNew = bf.createBinding( this, "repReadOnly", "connections-new", "disabled" ) ).fireSourceChanged(); ( bindButtonEdit = bf.createBinding( this, "repReadOnly", "connections-edit", "disabled" ) ).fireSourceChanged(); ( bindButtonRemove = bf.createBinding( this, "repReadOnly", "connections-remove", "disabled" ) ).fireSourceChanged(); if ( repository != null ) { bf.createBinding( connectionsTable, "selectedItems", this, "selectedConnections" ); } } catch ( Exception ex ) { if ( mainController == null || !mainController.handleLostRepository( ex ) ) { // convert to runtime exception so it bubbles up through the UI throw new RuntimeException( ex ); } } }
Example #3
Source File: ConnectionsControllerTest.java From pentaho-kettle with Apache License 2.0 | 6 votes |
@Before public void setUp() throws Exception { // a tricky initialisation - first inject private fields controller = new ConnectionsController(); connectionsTable = mock( XulTree.class ); FieldUtils.writeDeclaredField( controller, "connectionsTable", connectionsTable, true ); // and then spy the controller controller = spy( controller ); databaseDialog = mock( DatabaseDialog.class ); doReturn( databaseDialog ).when( controller ).getDatabaseDialog(); databaseMeta = mock( DatabaseMeta.class ); doReturn( databaseMeta ).when( databaseDialog ).getDatabaseMeta(); doNothing().when( controller ).refreshConnectionList(); doNothing().when( controller ).showAlreadyExistsMessage(); repository = mock( Repository.class ); controller.init( repository ); }
Example #4
Source File: DataSourceAndQueryStep.java From pentaho-reporting with GNU Lesser General Public License v2.1 | 5 votes |
public void doDeleteDatasourceItem() { final XulTree tree = (XulTree) document.getElementById( DATASOURCES_TREE_ID ); final DatasourceModelNode node = (DatasourceModelNode) tree.getSelectedItem(); switch( node.getType() ) { case DATAFACTORY: deleteDataFactory( (DataFactoryMetaData) node.getUserObject() ); break; case CONNECTION: deleteConnection( (DataFactory) node.getUserObject() ); default: break; } updateDatasourceTree(); }
Example #5
Source File: AggListController.java From pentaho-aggdesigner with GNU General Public License v2.0 | 5 votes |
public void saveAggChange(int idx) { UIAggregate agg = getAggList().getAgg(idx); XulTree aggTable = (XulTree) document.getElementById("definedAggTable"); XulTreeRow row = aggTable.getRootChildren().getItem(idx).getRow(); agg.setEnabled((Boolean) row.getCell(0).getValue()); // get row count estimate Aggregate algoAggregate = algorithm.createAggregate(connectionModel.getSchema(), agg.getAttributes()); agg.setEstimateRowCount(algoAggregate.estimateRowCount()); agg.setEstimateSpace(algoAggregate.estimateSpace()); getAggList().aggChanged(agg); System.out.println("Saving agg, enabled? " + row.getCell(0).getValue()); }
Example #6
Source File: RepositoryLockController.java From pentaho-kettle with Apache License 2.0 | 5 votes |
public void init( Repository rep ) throws ControllerInitializationException { try { if ( rep != null && rep.hasService( ILockService.class ) ) { repository = rep; service = (ILockService) rep.getService( ILockService.class ); } else { throw new ControllerInitializationException( BaseMessages.getString( PKG, "RepositoryLockController.ERROR_0001_UNABLE_TO_INITIAL_REPOSITORY_SERVICE", ILockService.class ) ); //$NON-NLS-1$ } bindingFactory = new DefaultBindingFactory(); bindingFactory.setDocument( getXulDomContainer().getDocumentRoot() ); XulEventHandler eventHandler = getXulDomContainer().getEventHandler( "browseController" ); //$NON-NLS-1$ if ( eventHandler instanceof BrowseController ) { browseController = (BrowseController) eventHandler; } // Disable row dragging if it is locked and the user does not have permissions fileTable = (XulTree) getXulDomContainer().getDocumentRoot().getElementById( "file-table" ); //$NON-NLS-1$ folderTree = (XulTree) document.getElementById( "folder-tree" ); //$NON-NLS-1$ lockFileMenuItem = (XulMenuitem) getXulDomContainer().getDocumentRoot().getElementById( "file-context-lock" ); //$NON-NLS-1$ deleteFileMenuItem = (XulMenuitem) getXulDomContainer().getDocumentRoot().getElementById( "file-context-delete" ); //$NON-NLS-1$ renameFileMenuItem = (XulMenuitem) getXulDomContainer().getDocumentRoot().getElementById( "file-context-rename" ); //$NON-NLS-1$ messageBox = (XulMessageBox) document.createElement( "messagebox" ); //$NON-NLS-1$ createBindings(); } catch ( Exception e ) { throw new RuntimeException( e ); } }
Example #7
Source File: TrashBrowseController.java From pentaho-kettle with Apache License 2.0 | 5 votes |
private void createTrashTableBindings( BindingConvertor<List<UIDeletedObject>, Boolean> buttonConverter, XulTree trashFileTable ) { bf.createBinding( trashFileTable, "selectedItems", this, "selectedTrashFileItems" ); //$NON-NLS-1$ //$NON-NLS-2$ bf.createBinding( trashFileTable, "selectedItems", deleteButton, "!disabled", buttonConverter ); //$NON-NLS-1$ //$NON-NLS-2$ bf.createBinding( trashFileTable, "selectedItems", undeleteButton, "!disabled", buttonConverter ); //$NON-NLS-1$ //$NON-NLS-2$ bf.createBinding( trashFileTable, "selectedItems", "trash-context-delete", "!disabled", buttonConverter ); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ bf.createBinding( trashFileTable, "selectedItems", "trash-context-restore", "!disabled", buttonConverter ); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ bf.setBindingType( Binding.Type.ONE_WAY ); bf.createBinding( this, "trash", trashFileTable, "elements", //$NON-NLS-1$ //$NON-NLS-2$ new BindingConvertor<List<IDeletedObject>, List<UIDeletedObject>>() { @Override public List<UIDeletedObject> sourceToTarget( List<IDeletedObject> trash ) { List<UIDeletedObject> newList = new ArrayList<UIDeletedObject>( trash.size() ); for ( IDeletedObject obj : trash ) { newList.add( new UIDeletedObject( obj ) ); } Collections.sort( newList, new UIDeletedObjectComparator() ); return newList; } @Override public List<IDeletedObject> targetToSource( List<UIDeletedObject> elements ) { return null; } } ); }
Example #8
Source File: RulesExecutorDialog.java From pentaho-kettle with Apache License 2.0 | 5 votes |
public void init() { workingStepname = stepname; metaMapper = new RulesExecutorMetaMapper(); metaMapper.loadMeta( (RulesExecutorMeta) baseStepMeta ); // Set dialog values ( (XulTextbox) document.getElementById( "step-name" ) ).setValue( getStepName() ); ( (XulTextbox) document.getElementById( "rule-file" ) ).setValue( metaMapper.getRuleFile() ); ( (XulTextbox) document.getElementById( "rule-definition" ) ).setValue( metaMapper.getRuleDefinition() ); ( (XulTree) document.getElementById( "fields-table" ) ).setElements( metaMapper.getColumnList() ); // Set the initial dialog state if ( metaMapper.getRuleDefinition() != null && !metaMapper.getRuleDefinition().equals( "" ) ) { setRuleSource( "definition" ); ( (XulRadio) document.getElementById( "rule-definition-radio-button" ) ).setSelected( true ); } else { setRuleSource( "file" ); ( (XulRadio) document.getElementById( "rule-file-radio-button" ) ).setSelected( true ); } // Bind data objects to UI bf.setBindingType( Binding.Type.ONE_WAY ); try { bf.createBinding( "step-name", "value", this, "stepName" ); bf.createBinding( "rule-file", "value", metaMapper, "ruleFile" ); bf.createBinding( "rule-definition", "value", metaMapper, "ruleDefinition" ); bf.createBinding( metaMapper.getColumnList(), "children", "fields-table", "elements" ).fireSourceChanged(); // TODO: Add converter to clear out opposing text box bf.createBinding( "rule-file-radio-button", "selected", "rule-file", "!disabled" ).fireSourceChanged(); bf.createBinding( "rule-file-radio-button", "selected", "rule-definition", "disabled" ).fireSourceChanged(); bf .createBinding( "rule-definition-radio-button", "selected", "rule-definition", "!disabled" ) .fireSourceChanged(); bf.createBinding( "rule-definition-radio-button", "selected", "rule-file", "disabled" ).fireSourceChanged(); } catch ( Exception e ) { e.printStackTrace(); } }
Example #9
Source File: RulesAccumulatorDialog.java From pentaho-kettle with Apache License 2.0 | 5 votes |
public void init() { workingStepname = stepname; metaMapper = new RulesAccumulatorMetaMapper(); metaMapper.loadMeta( (RulesAccumulatorMeta) baseStepMeta ); // Set dialog values ( (XulTextbox) document.getElementById( "step-name" ) ).setValue( getStepName() ); ( (XulTextbox) document.getElementById( "rule-file" ) ).setValue( metaMapper.getRuleFile() ); ( (XulTextbox) document.getElementById( "rule-definition" ) ).setValue( metaMapper.getRuleDefinition() ); ( (XulTree) document.getElementById( "fields-table" ) ).setElements( metaMapper.getColumnList() ); // Set the initial dialog state if ( metaMapper.getRuleDefinition() != null && !metaMapper.getRuleDefinition().equals( "" ) ) { setRuleSource( "definition" ); ( (XulRadio) document.getElementById( "rule-definition-radio-button" ) ).setSelected( true ); } else { setRuleSource( "file" ); ( (XulRadio) document.getElementById( "rule-file-radio-button" ) ).setSelected( true ); } // Bind data objects to UI bf.setBindingType( Binding.Type.ONE_WAY ); try { bf.createBinding( "step-name", "value", this, "stepName" ); bf.createBinding( "rule-file", "value", metaMapper, "ruleFile" ); bf.createBinding( "rule-definition", "value", metaMapper, "ruleDefinition" ); bf.createBinding( metaMapper.getColumnList(), "children", "fields-table", "elements" ).fireSourceChanged(); // TODO: Add converter to clear out opposing text box bf.createBinding( "rule-file-radio-button", "selected", "rule-file", "!disabled" ).fireSourceChanged(); bf.createBinding( "rule-file-radio-button", "selected", "rule-definition", "disabled" ).fireSourceChanged(); bf .createBinding( "rule-definition-radio-button", "selected", "rule-definition", "!disabled" ) .fireSourceChanged(); bf.createBinding( "rule-definition-radio-button", "selected", "rule-file", "disabled" ).fireSourceChanged(); } catch ( Exception e ) { e.printStackTrace(); } }
Example #10
Source File: BrowseControllerTest.java From pentaho-kettle with Apache License 2.0 | 5 votes |
@Before public void setUp() throws Exception { DocumentFactory.registerElementClass( ElementDom4J.class ); controller = spy( new BrowseController() ); controller.setRepositoryDirectory( mock( UIRepositoryDirectory.class ) ); directoryMap = new HashMap<>( 8 ); controller.setDirMap( directoryMap ); document = mock( Document.class ); XulDomContainer xulDomContainer = mock( XulDomContainer.class ); when( xulDomContainer.getDocumentRoot() ).thenReturn( document ); controller.setXulDomContainer( xulDomContainer ); UIRepositoryDirectory someDirectory = mock( UIRepositoryDirectory.class ); selectedFolder = mock( UIRepositoryDirectory.class ); when( selectedFolder.createFolder( FOLDER_NAME ) ).thenReturn( someDirectory ); XulTree folderTree = mock( XulTree.class ); when( folderTree.getSelectedItems() ).thenReturn( Collections.<Object>singleton( selectedFolder ) ); controller.setFolderTree( folderTree ); directoryBinding = mock( Binding.class ); controller.setDirectoryBinding( directoryBinding ); selectedItemsBinding = mock( Binding.class ); controller.setSelectedItemsBinding( selectedItemsBinding ); }
Example #11
Source File: SlavesController.java From pentaho-kettle with Apache License 2.0 | 5 votes |
public void createBindings() { refreshSlaves(); try { slavesTable = (XulTree) document.getElementById( "slaves-table" ); bf.setBindingType( Binding.Type.ONE_WAY ); bf.createBinding( slaveList, "children", slavesTable, "elements" ).fireSourceChanged(); bf.createBinding( slavesTable, "selectedItems", this, "enableButtons" ); } catch ( Exception e ) { if ( mainController == null || !mainController.handleLostRepository( e ) ) { // convert to runtime exception so it bubbles up through the UI throw new RuntimeException( e ); } } }
Example #12
Source File: ClustersController.java From pentaho-kettle with Apache License 2.0 | 5 votes |
public void createBindings() { refreshClusters(); try { clustersTable = (XulTree) document.getElementById( "clusters-table" ); bf.setBindingType( Binding.Type.ONE_WAY ); bf.createBinding( clusterList, "children", clustersTable, "elements" ).fireSourceChanged(); bf.createBinding( clustersTable, "selectedItems", this, "enableButtons" ); } catch ( Exception e ) { if ( mainController == null || !mainController.handleLostRepository( e ) ) { throw new RuntimeException( e ); } } }
Example #13
Source File: PartitionsController.java From pentaho-kettle with Apache License 2.0 | 5 votes |
public void createBindings() { refreshPartitions(); try { partitionsTable = (XulTree) document.getElementById( "partitions-table" ); bf.setBindingType( Binding.Type.ONE_WAY ); bf.createBinding( partitionList, "children", partitionsTable, "elements" ).fireSourceChanged(); bf.createBinding( partitionsTable, "selectedItems", this, "enableButtons" ); } catch ( Exception e ) { if ( mainController == null || !mainController.handleLostRepository( e ) ) { // convert to runtime exception so it bubbles up through the UI throw new RuntimeException( e ); } } }
Example #14
Source File: PreviewRowsSwingDialog.java From pentaho-mongodb-plugin with Apache License 2.0 | 5 votes |
/** * TODO: replace this method with XUL bindings * <p/> * This is a bad bad method. We need a way to load the column definitions and * data through standard XUL bindings. * * @param data * @param columns */ protected void createPreviewRows( List<Object[]> data, List<String> columns ) { // Adds table rows. Object[] theObj = null; XulTreeRow theRow = null; Object theValue = null; SwingTreeCell theCell = null; XulTree table = (XulTree) super.document.getElementById( "tableData" ); table.getRootChildren().removeAll(); Iterator<Object[]> theItr = data.iterator(); while ( theItr.hasNext() ) { theObj = theItr.next(); theRow = table.getRootChildren().addNewRow(); for ( int i = 0; i < theObj.length; i++ ) { theValue = theObj[i]; theCell = new SwingTreeCell( null ); theCell.setLabel( theValue == null ? "" : theValue.toString() ); theRow.addCell( theCell ); } } // Adds table columns. SwingTreeCol theColumn = null; SwingTreeCols theColumns = new SwingTreeCols( null, table, null, null ); for ( int i = 0; i < columns.size(); i++ ) { theColumn = new SwingTreeCol( null, null, null, null ); theColumn.setWidth( 100 ); theColumn.setLabel( columns.get( i ) ); theColumns.addColumn( theColumn ); } table.setColumns( theColumns ); table.update(); }
Example #15
Source File: XulPreviewRowsController.java From pentaho-kettle with Apache License 2.0 | 4 votes |
private void createPreviewRows() { GetPreviewTableProgressDialog theProgressDialog = new GetPreviewTableProgressDialog( this.shell, this.databaseMeta, this.schema, this.table, this.limit ); List<Object[]> thePreviewData = theProgressDialog.open(); // Adds table rows. Object[] theObj = null; XulTreeRow theRow = null; Object theValue = null; SwtTreeCell theCell = null; int theRowCount = 0; XulTree thePreviewTable = (XulTree) super.document.getElementById( "table_data" ); thePreviewTable.getRootChildren().removeAll(); Iterator<Object[]> theItr = thePreviewData.iterator(); while ( theItr.hasNext() ) { theObj = theItr.next(); theRow = thePreviewTable.getRootChildren().addNewRow(); theRowCount++; for ( int i = 0; i < theObj.length; i++ ) { theValue = theObj[i]; theCell = new SwtTreeCell( null ); theCell.setLabel( theValue == null ? "" : theValue.toString() ); theRow.addCell( theCell ); } } // Adds table columns. SwtTreeCol theColumn = null; String[] theFieldNames = theProgressDialog.getRowMeta().getFieldNames(); SwtTreeCols theColumns = new SwtTreeCols( null, thePreviewTable, null, null ); for ( int i = 0; i < theFieldNames.length; i++ ) { theColumn = new SwtTreeCol( null, null, null, null ); theColumn.setWidth( 100 ); theColumn.setLabel( theFieldNames[i] ); theColumns.addColumn( theColumn ); } thePreviewTable.setColumns( theColumns ); thePreviewTable.update(); setRowCount( "Rows of step: " + this.table + " (" + theRowCount + " rows)" ); }
Example #16
Source File: BaseStepXulDialog.java From pentaho-kettle with Apache License 2.0 | 4 votes |
public static void getFieldsFromPrevious( RowMetaInterface row, XulTree tableView, List<Object> fields, StepTableDataObject field, TableItemInsertXulListener listener ) { if ( row == null || row.size() == 0 ) { return; // nothing to do } // get a list of all the non-empty keys (names) // List<String> keys = new ArrayList<String>(); for ( Object entry : fields ) { keys.add( ( (StepTableDataObject) entry ).getName() ); } int choice = 0; if ( keys.size() > 0 ) { // Ask what we should do with the existing data in the step. // Shell shell = ( (TableViewer) tableView.getManagedObject() ).getTable().getShell(); MessageDialog md = new MessageDialog( shell, BaseMessages.getString( PKG, "BaseStepDialog.GetFieldsChoice.Title" ), // "Warning!" null, BaseMessages.getString( PKG, "BaseStepDialog.GetFieldsChoice.Message", "" + keys.size(), "" + row.size() ), MessageDialog.WARNING, new String[] { BaseMessages.getString( PKG, "BaseStepDialog.AddNew" ), BaseMessages.getString( PKG, "BaseStepDialog.Add" ), BaseMessages.getString( PKG, "BaseStepDialog.ClearAndAdd" ), BaseMessages.getString( PKG, "BaseStepDialog.Cancel" ), }, 0 ); MessageDialog.setDefaultImage( GUIResource.getInstance().getImageSpoon() ); int idx = md.open(); choice = idx & 0xFF; } if ( choice == 3 || choice == 255 ) { return; // Cancel clicked } if ( choice == 2 ) { fields.clear(); } for ( int i = 0; i < row.size(); i++ ) { ValueMetaInterface v = row.getValueMeta( i ); if ( choice == 0 ) { // hang on, see if it's not yet in the table view if ( keys.indexOf( v.getName() ) >= 0 ) { continue; } } if ( listener != null && !listener.tableItemInsertedFor( v ) ) { continue; } StepTableDataObject newField = field.createNew( v ); fields.add( newField ); } }
Example #17
Source File: DataHandler.java From pentaho-kettle with Apache License 2.0 | 4 votes |
protected void getControls() { // Not all of these controls are created at the same time.. that's OK, for now, just check // each one for null before using. dialogDeck = (XulDeck) document.getElementById( "dialog-panel-deck" ); deckOptionsBox = (XulListbox) document.getElementById( "deck-options-list" ); connectionBox = (XulListbox) document.getElementById( "connection-type-list" ); databaseDialectList = (XulMenuList) document.getElementById( "database-dialect-list" ); accessBox = (XulListbox) document.getElementById( "access-type-list" ); connectionNameBox = (XulTextbox) document.getElementById( "connection-name-text" ); hostNameBox = (XulTextbox) document.getElementById( "server-host-name-text" ); databaseNameBox = (XulTextbox) document.getElementById( "database-name-text" ); portNumberBox = (XulTextbox) document.getElementById( "port-number-text" ); userNameBox = (XulTextbox) document.getElementById( "username-text" ); passwordBox = (XulTextbox) document.getElementById( "password-text" ); dataTablespaceBox = (XulTextbox) document.getElementById( "data-tablespace-text" ); indexTablespaceBox = (XulTextbox) document.getElementById( "index-tablespace-text" ); serverInstanceBox = (XulTextbox) document.getElementById( "instance-text" ); serverNameBox = (XulTextbox) document.getElementById( "server-name-text" ); customUrlBox = (XulTextbox) document.getElementById( "custom-url-text" ); customDriverClassBox = (XulTextbox) document.getElementById( "custom-driver-class-text" ); languageBox = (XulTextbox) document.getElementById( "language-text" ); warehouseBox = (XulTextbox) document.getElementById( "warehouse-text" ); systemNumberBox = (XulTextbox) document.getElementById( "system-number-text" ); clientBox = (XulTextbox) document.getElementById( "client-text" ); doubleDecimalSeparatorCheck = (XulCheckbox) document.getElementById( "decimal-separator-check" ); resultStreamingCursorCheck = (XulCheckbox) document.getElementById( "result-streaming-check" ); webAppName = (XulTextbox) document.getElementById( "web-application-name-text" ); poolingCheck = (XulCheckbox) document.getElementById( "use-pool-check" ); clusteringCheck = (XulCheckbox) document.getElementById( "use-cluster-check" ); clusterParameterDescriptionLabel = (XulLabel) document.getElementById( "cluster-parameter-description-label" ); poolSizeLabel = (XulLabel) document.getElementById( "pool-size-label" ); poolSizeBox = (XulTextbox) document.getElementById( "pool-size-text" ); maxPoolSizeLabel = (XulLabel) document.getElementById( "max-pool-size-label" ); maxPoolSizeBox = (XulTextbox) document.getElementById( "max-pool-size-text" ); poolParameterTree = (XulTree) document.getElementById( "pool-parameter-tree" ); clusterParameterTree = (XulTree) document.getElementById( "cluster-parameter-tree" ); optionsParameterTree = (XulTree) document.getElementById( "options-parameter-tree" ); poolingDescription = (XulTextbox) document.getElementById( "pooling-description" ); poolingParameterDescriptionLabel = (XulLabel) document.getElementById( "pool-parameter-description-label" ); poolingDescriptionLabel = (XulLabel) document.getElementById( "pooling-description-label" ); supportBooleanDataType = (XulCheckbox) document.getElementById( "supports-boolean-data-type" ); supportTimestampDataType = (XulCheckbox) document.getElementById( "supports-timestamp-data-type" ); quoteIdentifiersCheck = (XulCheckbox) document.getElementById( "quote-identifiers-check" ); lowerCaseIdentifiersCheck = (XulCheckbox) document.getElementById( "force-lower-case-check" ); upperCaseIdentifiersCheck = (XulCheckbox) document.getElementById( "force-upper-case-check" ); preserveReservedCaseCheck = (XulCheckbox) document.getElementById( "preserve-reserved-case" ); strictBigNumberInterpretaion = (XulCheckbox) document.getElementById( "strict-bignum-interpretation" ); preferredSchemaName = (XulTextbox) document.getElementById( "preferred-schema-name-text" ); sqlBox = (XulTextbox) document.getElementById( "sql-text" ); useIntegratedSecurityCheck = (XulCheckbox) document.getElementById( "use-integrated-security-check" ); acceptButton = (XulButton) document.getElementById( "general-datasource-window_accept" ); cancelButton = (XulButton) document.getElementById( "general-datasource-window_cancel" ); testButton = (XulButton) document.getElementById( "test-button" ); noticeLabel = (XulLabel) document.getElementById( "notice-label" ); jdbcAuthMethod = (XulMenuList) document.getElementById( "redshift-auth-method-list" ); iamAccessKeyId = (XulTextbox) document.getElementById( "iam-access-key-id" ); iamSecretKeyId = (XulTextbox) document.getElementById( "iam-secret-access-key" ); iamSessionToken = (XulTextbox) document.getElementById( "iam-session-token" ); iamProfileName = (XulTextbox) document.getElementById( "iam-profile-name" ); namedClusterList = (XulMenuList) document.getElementById( "named-cluster-list" ); if ( portNumberBox != null && serverInstanceBox != null ) { if ( Boolean.parseBoolean( serverInstanceBox.getAttributeValue( "shouldDisablePortIfPopulated" ) ) ) { serverInstanceBox.addPropertyChangeListener( new PropertyChangeListener() { @Override public void propertyChange( PropertyChangeEvent evt ) { if ( "value".equals( evt.getPropertyName() ) ) { disablePortIfInstancePopulated(); } } } ); } } }
Example #18
Source File: TrashBrowseController.java From pentaho-kettle with Apache License 2.0 | 4 votes |
private XulTree selectDeletedFileTable( boolean isAdmin ) { XulDeck treeDeck = (XulDeck) document.getElementById( "tree-deck" ); treeDeck.setSelectedIndex( isAdmin ? 1 : 0 ); return (XulTree) document.getElementById( isAdmin ? "deleted-file-table-admin" : "deleted-file-table" ); }
Example #19
Source File: BrowseController.java From pentaho-kettle with Apache License 2.0 | 4 votes |
@VisibleForTesting void setFolderTree( XulTree folderTree ) { this.folderTree = folderTree; }
Example #20
Source File: DataSourceAndQueryStep.java From pentaho-reporting with GNU Lesser General Public License v2.1 | 4 votes |
/** * */ private void updateDatasourceTree() { final DatasourceModelNode newRoot = new DatasourceModelNode( DATASOURCES_ROOT_NODE_NAME, null, DATASOURCE_TYPE.ROOT ); for ( int i = 0; i < cdf.size(); i++ ) { final DataFactory df = cdf.getReference( i ); final DataFactoryMetaData dfmd = getMetaForDataFactory( df, dataFactoryMetas ); if ( dfmd == null ) { continue; } DatasourceModelNode dfmdNode = findUserObjectInTree( dfmd, newRoot ); if ( dfmdNode == null ) { dfmdNode = new DatasourceModelNode( dfmd.getDisplayName( Locale.getDefault() ), dfmd, DATASOURCE_TYPE.DATAFACTORY ); newRoot.add( dfmdNode ); } DatasourceModelNode dataSourceNode = null; final String connectionName = dfmd.getDisplayConnectionName( df ); if ( connectionName != null ) { dataSourceNode = new DatasourceModelNode( connectionName, df, DATASOURCE_TYPE.CONNECTION ); } if ( dataSourceNode != null ) { dfmdNode.add( dataSourceNode ); } for ( final String queryName : df.getQueryNames() ) { final DatasourceModelNode queryNode = new DatasourceModelNode( queryName, null, DATASOURCE_TYPE.QUERY ); if ( dataSourceNode != null ) { dataSourceNode.add( queryNode ); } else { dfmdNode.add( queryNode ); } } } this.setDataSourcesRoot( newRoot ); final XulTree tree = (XulTree) getDocument().getElementById( DATASOURCES_TREE_ID ); final String currentQuery = getCurrentQuery(); final int selectedQueryRow = findRowForObject( getDataSourcesRoot(), currentQuery, new int[] { 0 } ); if ( selectedQueryRow == -1 ) { final int[] selectedRows = new int[ 1 ]; selectedRows[ 0 ] = selectedQueryRow - 1; // have to subtract one for the (unshown) root tree.setSelectedRows( selectedRows ); } }