org.pentaho.ui.xul.components.XulTextbox Java Examples
The following examples show how to use
org.pentaho.ui.xul.components.XulTextbox.
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: LookAndFeelStep.java From pentaho-reporting with GNU Lesser General Public License v2.1 | 6 votes |
public void selectFile() { try { final XulFileDialog fd = (XulFileDialog) document.createElement( "filedialog" ); //$NON-NLS-1$ fd.setModalParent( LookAndFeelStep.this.getDesignTimeContext().getParentWindow() ); fd.showOpenDialog(); file = (File) fd.getFile(); if ( file != null ) { // If the file is null then the user hit cancel final String filePath = file.getAbsolutePath(); final XulTextbox fileTextBox = (XulTextbox) document.getElementById( WIZARD_FILENAME_TB_ID ); fileTextBox.setValue( filePath ); LookAndFeelStep.this.setFileName( filePath ); } } catch ( XulException e ) { getDesignTimeContext().error( e ); } }
Example #2
Source File: AuthProviderController.java From pentaho-kettle with Apache License 2.0 | 6 votes |
public void browse() { try { XulTextbox filename = (XulTextbox) document.getElementById( "keytab" ); XulFileDialog dialog = (XulFileDialog) document.createElement( "filedialog" ); XulFileDialog.RETURN_CODE retval = dialog.showOpenDialog(); if ( retval == XulFileDialog.RETURN_CODE.OK ) { File file = (File) dialog.getFile(); filename.setValue( file.getAbsolutePath() ); } } catch ( XulException e ) { log.logError( resourceBundle.getString( "error.file_browse" ), e ); } }
Example #3
Source File: ExportHandlerTest.java From pentaho-aggdesigner with GNU General Public License v2.0 | 6 votes |
/** * Tests all of the copy* methods. */ @Test public void testCopyToClipboard() throws Exception { final XulTextbox textbox = context.mock(XulTextbox.class); final XulWindow window = context.mock(XulWindow.class); final String stringToCopy = "ignored"; //$NON-NLS-1$ context.checking(new Expectations() { { exactly(3).of(doc).getElementById(with(any(String.class))); will(returnValue(textbox)); exactly(3).of(textbox).getValue(); will(returnValue(stringToCopy)); exactly(3).of(doc).getRootElement(); will(returnValue(window)); exactly(3).of(window).copy(with(equal(stringToCopy))); } }); controller.copyDdlToClipboard(); controller.copyDmlToClipboard(); controller.copyToClipboardMultiDimPreview(); }
Example #4
Source File: SpoonBrowser.java From pentaho-kettle with Apache License 2.0 | 5 votes |
protected void addToolBar() { try { XulLoader loader = new KettleXulLoader(); loader.setSettingsManager( XulSpoonSettingsManager.getInstance() ); ResourceBundle bundle = GlobalMessages.getBundle( "org/pentaho/di/ui/spoon/messages/messages" ); XulDomContainer xulDomContainer = loader.loadXul( XUL_FILE_BROWSER_TOOLBAR, bundle ); xulDomContainer.addEventHandler( this ); toolbar = (XulToolbar) xulDomContainer.getDocumentRoot().getElementById( "nav-toolbar" ); @SuppressWarnings( "unused" ) ToolBar swtToolBar = (ToolBar) toolbar.getManagedObject(); spoon.props.setLook( swtToolBar, Props.WIDGET_STYLE_TOOLBAR ); // Add a URL back = (XulToolbarbutton) toolbar.getElementById( "browse-back" ); back.setDisabled( true ); forward = (XulToolbarbutton) toolbar.getElementById( "browse-forward" ); forward.setLabel( BaseMessages.getString( PKG, "SpoonBrowser.Dialog.Forward" ) ); forward.setDisabled( false ); location = (XulTextbox) toolbar.getElementById( "browser-address" ); Control toolbarControl = (Control) toolbar.getManagedObject(); toolbarControl.setLayoutData( new FormData() ); toolbarControl.setParent( composite ); } catch ( Exception e ) { e.printStackTrace(); new ErrorDialog( shell, BaseMessages.getString( PKG, "Spoon.Exception.ErrorReadingXULFile.Title" ), BaseMessages .getString( PKG, "Spoon.Exception.ErrorReadingXULFile.Message", XUL_FILE_BROWSER_TOOLBAR ), e ); } }
Example #5
Source File: FragmentHandlerTest.java From pentaho-kettle with Apache License 2.0 | 5 votes |
@Test public void testRefreshOptions() throws Exception { XulListbox connectionBox = mock( XulListbox.class ); when( document.getElementById( "connection-type-list" ) ).thenReturn( connectionBox ); when( connectionBox.getSelectedItem() ).thenReturn( "myDb" ); XulListbox accessBox = mock( XulListbox.class ); when( document.getElementById( "access-type-list" ) ).thenReturn( accessBox ); when( accessBox.getSelectedItem() ).thenReturn( "Native" ); DataHandler dataHandler = mock( DataHandler.class ); when( xulDomContainer.getEventHandler( "dataHandler" ) ).thenReturn( dataHandler ); DatabaseInterface dbInterface = mock( DatabaseInterface.class ); when( dbInterface.getDefaultDatabasePort() ).thenReturn( 5309 ); DataHandler.connectionMap.put( "myDb", dbInterface ); XulComponent component = mock( XulComponent.class ); XulComponent parent = mock( XulComponent.class ); when( component.getParent() ).thenReturn( parent ); when( document.getElementById( "database-options-box" ) ).thenReturn( component ); XulDomContainer fragmentContainer = mock( XulDomContainer.class ); Document mockDoc = mock( Document.class ); XulComponent firstChild = mock( XulComponent.class ); when( mockDoc.getFirstChild() ).thenReturn( firstChild ); when( fragmentContainer.getDocumentRoot() ).thenReturn( mockDoc ); when( xulDomContainer.loadFragment( anyString(), any( Object.class ) ) ).thenReturn( fragmentContainer ); XulTextbox portBox = mock( XulTextbox.class ); when( document.getElementById( "port-number-text" ) ).thenReturn( portBox ); fragmentHandler.refreshOptions(); // Iterate through the other database access types when( accessBox.getSelectedItem() ).thenReturn( "JNDI" ); fragmentHandler.refreshOptions(); when( accessBox.getSelectedItem() ).thenReturn( "ODBC" ); fragmentHandler.refreshOptions(); when( accessBox.getSelectedItem() ).thenReturn( "OCI" ); fragmentHandler.refreshOptions(); when( accessBox.getSelectedItem() ).thenReturn( "Plugin" ); fragmentHandler.refreshOptions(); }
Example #6
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 #7
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 #8
Source File: RepositoryConfigController.java From pentaho-kettle with Apache License 2.0 | 5 votes |
private void createBindings() { repositoryConfigDialog = (XulDialog) document.getElementById( "repository-config-dialog" );//$NON-NLS-1$ url = (XulTextbox) document.getElementById( "repository-url" );//$NON-NLS-1$ name = (XulTextbox) document.getElementById( "repository-name" );//$NON-NLS-1$ id = (XulTextbox) document.getElementById( "repository-id" );//$NON-NLS-1$ modificationComments = (XulCheckbox) document.getElementById( "repository-modification-comments" );//$NON-NLS-1$ okButton = (XulButton) document.getElementById( "repository-config-dialog_accept" ); //$NON-NLS-1$ bf.setBindingType( Type.BI_DIRECTIONAL ); bf.createBinding( model, "url", url, "value" );//$NON-NLS-1$ //$NON-NLS-2$ bf.createBinding( model, "name", name, "value" );//$NON-NLS-1$ //$NON-NLS-2$ bf.createBinding( model, "id", id, "value" );//$NON-NLS-1$ //$NON-NLS-2$ bf.createBinding( model, "modificationComments", modificationComments, "checked" );//$NON-NLS-1$ //$NON-NLS-2$ bf.setBindingType( Type.ONE_WAY ); bf.createBinding( model, "valid", okButton, "!disabled" );//$NON-NLS-1$ //$NON-NLS-2$ }
Example #9
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 #10
Source File: ExportHandler.java From pentaho-aggdesigner with GNU General Public License v2.0 | 5 votes |
public void copyDmlToClipboard() { try { XulTextbox dmlField = (XulTextbox) document.getElementById(ELEM_ID_DML_FIELD); Assert.notNull(dmlField, "could not find element with id '" + ELEM_ID_DML_FIELD + "'"); ((XulWindow) document.getRootElement()).copy(dmlField.getValue()); } catch (XulException e) { if (logger.isErrorEnabled()) { logger.error("an exception occurred", e); } } }
Example #11
Source File: ExportHandler.java From pentaho-aggdesigner with GNU General Public License v2.0 | 5 votes |
public void copyToClipboardMultiDimPreview() { XulTextbox multiDimSchemaField = (XulTextbox) document.getElementById("multiDimSchemaField"); try { ((XulWindow) document.getRootElement()).copy(multiDimSchemaField.getValue()); } catch (XulException e) { if (logger.isErrorEnabled()) { logger.error("an exception occurred", e); } } }
Example #12
Source File: ExportHandlerTest.java From pentaho-aggdesigner with GNU General Public License v2.0 | 5 votes |
@Test public void testShowPreviewWithAggs() throws Exception { final XulDialog diag = context.mock(XulDialog.class); final XulTextbox textbox = context.mock(XulTextbox.class); final XulComponent ignored = context.mock(XulComponent.class); context.checking(new Expectations() { { // get preview dialog one(doc).getElementById(with(any(String.class))); will(returnValue(diag)); // get ddl field one(doc).getElementById(with(any(String.class))); will(returnValue(textbox)); one(outputService).getFullArtifact(with(any(List.class)), with(equal(CreateScriptGenerator.class))); one(textbox).setValue(with(any(String.class))); // get dml field one(doc).getElementById(with(any(String.class))); will(returnValue(textbox)); // get dml tab (if exists) one(doc).getElementById(with(any(String.class))); // returnValue doesn't matter as long as not null will(returnValue(ignored)); one(outputService).getFullArtifact(with(any(List.class)), with(equal(PopulateScriptGenerator.class))); one(textbox).setValue(with(any(String.class))); // get olap field one(doc).getElementById(with(any(String.class))); will(returnValue(textbox)); one(outputService).getFullArtifact(with(any(List.class)), with(equal(SchemaGenerator.class))); one(textbox).setValue(with(any(String.class))); one(diag).show(); } }); aggList.addAgg(new UIAggregateImpl()); controller.showPreview(); }
Example #13
Source File: BeamController.java From kettle-beam with Apache License 2.0 | 4 votes |
public void init() throws IllegalArgumentException, InvocationTargetException, XulException { XulTextbox diffText = (XulTextbox) document.getElementById( "diff" ); Text text = (Text) diffText.getManagedObject(); text.setFont( JFaceResources.getFont( JFaceResources.TEXT_FONT ) ); }
Example #14
Source File: Neo4jController.java From knowbi-pentaho-pdi-neo4j-output with Apache License 2.0 | 4 votes |
public void init() throws IllegalArgumentException, InvocationTargetException, XulException { XulTextbox diffText = (XulTextbox) document.getElementById( "diff" ); Text text = (Text) diffText.getManagedObject(); text.setFont( JFaceResources.getFont( JFaceResources.TEXT_FONT ) ); }
Example #15
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 #16
Source File: DataHandlerTest.java From pentaho-kettle with Apache License 2.0 | 4 votes |
@Before public void setUp() throws Exception { dataHandler = new DataHandler(); xulDomContainer = mock( XulDomContainer.class ); document = mock( Document.class ); XulComponent rootElement = mock( XulComponent.class ); when( document.getRootElement() ).thenReturn( rootElement ); // Mock the UI components accessBox = mock( XulListbox.class ); when( document.getElementById( "access-type-list" ) ).thenReturn( accessBox ); connectionBox = mock( XulListbox.class ); when( document.getElementById( "connection-type-list" ) ).thenReturn( connectionBox ); connectionNameBox = mock( XulTextbox.class ); when( document.getElementById( "connection-name-text" ) ).thenReturn( connectionNameBox ); dialogDeck = mock( XulDeck.class ); when( document.getElementById( "dialog-panel-deck" ) ).thenReturn( dialogDeck ); deckOptionsBox = mock( XulListbox.class ); when( document.getElementById( "deck-options-list" ) ).thenReturn( deckOptionsBox ); hostNameBox = mock( XulTextbox.class ); when( document.getElementById( "server-host-name-text" ) ).thenReturn( hostNameBox ); databaseNameBox = mock( XulTextbox.class ); when( document.getElementById( "database-name-text" ) ).thenReturn( databaseNameBox ); portNumberBox = mock( XulTextbox.class ); when( document.getElementById( "port-number-text" ) ).thenReturn( portNumberBox ); userNameBox = mock( XulTextbox.class ); when( document.getElementById( "username-text" ) ).thenReturn( userNameBox ); passwordBox = mock( XulTextbox.class ); when( document.getElementById( "password-text" ) ).thenReturn( passwordBox ); serverInstanceBox = mock( XulTextbox.class ); when( document.getElementById( "instance-text" ) ).thenReturn( serverInstanceBox ); when( serverInstanceBox.getValue() ).thenReturn( "instance" ); when( serverInstanceBox.getAttributeValue( "shouldDisablePortIfPopulated" ) ).thenReturn( "true" ); webappName = mock( XulTextbox.class ); when( document.getElementById( "web-application-name-text" ) ).thenReturn( webappName ); when( webappName.getValue() ).thenReturn( "webappName" ); messageBox = mock( XulMessageBox.class ); when( document.createElement( "messagebox" ) ).thenReturn( messageBox ); when( xulDomContainer.getDocumentRoot() ).thenReturn( document ); generalDatasourceWindow = mock( XulRoot.class ); when( generalDatasourceWindow.getRootObject() ).thenReturn( mock( XulComponent.class ) ); when( document.getElementById( "general-datasource-window" ) ).thenReturn( generalDatasourceWindow ); dataHandler.setXulDomContainer( xulDomContainer ); }