org.pentaho.ui.xul.components.XulFileDialog Java Examples
The following examples show how to use
org.pentaho.ui.xul.components.XulFileDialog.
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: MondrianFileSchemaProvider.java From pentaho-aggdesigner with GNU General Public License v2.0 | 6 votes |
public void chooseFile() throws AggDesignerException { try { XulFileDialog fc = (XulFileDialog) document.createElement("filedialog"); RETURN_CODE retVal; if (getLastFile() != null) { retVal = fc.showOpenDialog(getLastFile()); } else { retVal = fc.showOpenDialog(); } if (retVal == RETURN_CODE.OK) { File selectedFile = (File) fc.getFile(); setLastFile(selectedFile); setMondrianSchemaFilename(((File)fc.getFile()).getAbsolutePath()); } } catch (Exception e) { logger.error("Error showing file chooser", e); throw new AggDesignerException(e); } }
Example #4
Source File: ExportHandlerTest.java From pentaho-aggdesigner with GNU General Public License v2.0 | 5 votes |
@Test public void testSaveDdl() throws Exception { final XulFileDialog fileBox = context.mock(XulFileDialog.class); final XulDialog diag = context.mock(XulDialog.class); final File tmpFile = File.createTempFile("whatever", ".sql"); // save path so that it can be deleted after test tmpFilePath = tmpFile.getAbsolutePath(); context.checking(new Expectations() { { // show error messagebox stating no aggs one(doc).createElement(with(equal("filedialog"))); will(returnValue(fileBox)); ignoring(doc).getElementById(with(any(String.class))); will(returnValue(diag)); ignoring(diag).getRootObject(); will(returnValue(null)); one(fileBox).setModalParent(with(any(Object.class))); one(fileBox).showSaveDialog(); will(returnValue(RETURN_CODE.OK)); one(fileBox).getFile(); will(returnValue(tmpFile)); } }); UIAggregate agg = new UIAggregateImpl(); agg.setEnabled(false); aggList.addAgg(agg); controller.saveDdl(); System.out.println(FileUtils.readFileToString(new File(tmpFilePath))); }
Example #5
Source File: ExportHandlerTest.java From pentaho-aggdesigner with GNU General Public License v2.0 | 5 votes |
@Test public void testSaveDml() throws Exception { final XulFileDialog fileBox = context.mock(XulFileDialog.class); final XulDialog diag = context.mock(XulDialog.class); final File tmpFile = File.createTempFile("whatever", ".sql"); // save path so that it can be deleted after test tmpFilePath = tmpFile.getAbsolutePath(); context.checking(new Expectations() { { // show error messagebox stating no aggs one(doc).createElement(with(equal("filedialog"))); will(returnValue(fileBox)); ignoring(doc).getElementById(with(any(String.class))); will(returnValue(diag)); ignoring(diag).getRootObject(); will(returnValue(null)); one(fileBox).setModalParent(with(any(Object.class))); one(fileBox).showSaveDialog(); will(returnValue(RETURN_CODE.OK)); one(fileBox).getFile(); will(returnValue(tmpFile)); } }); UIAggregate agg = new UIAggregateImpl(); agg.setEnabled(false); aggList.addAgg(agg); controller.saveDml(); System.out.println(FileUtils.readFileToString(new File(tmpFilePath))); }
Example #6
Source File: ExportHandlerTest.java From pentaho-aggdesigner with GNU General Public License v2.0 | 5 votes |
@Test public void testSaveOlap() throws Exception { final XulFileDialog fileBox = context.mock(XulFileDialog.class); final XulDialog diag = context.mock(XulDialog.class); final ConnectionModel connModel = context.mock(ConnectionModel.class); final MondrianFileSchemaModel schemaModel = context.mock(MondrianFileSchemaModel.class); final File tmpFile = File.createTempFile("whatever", ".sql"); // save path so that it can be deleted after test tmpFilePath = tmpFile.getAbsolutePath(); controller.setConnectionModel(connModel); context.checking(new Expectations() { { // show error messagebox stating no aggs one(doc).createElement(with(equal("filedialog"))); will(returnValue(fileBox)); ignoring(doc).getElementById(with(any(String.class))); will(returnValue(diag)); ignoring(diag).getRootObject(); will(returnValue(null)); one(fileBox).setModalParent(with(any(Object.class))); one(fileBox).showSaveDialog(with(any(File.class))); will(returnValue(RETURN_CODE.OK)); one(fileBox).getFile(); will(returnValue(tmpFile)); exactly(2).of(connModel).getSelectedSchemaModel(); will(returnValue(schemaModel)); one(schemaModel).getMondrianSchemaFilename(); will(returnValue(tmpFile.getAbsolutePath())); one(outputService).getFullArtifact(with(any(List.class)), with(equal(SchemaGenerator.class))); one(schemaModel).setMondrianSchemaFilename(with(any(String.class))); one(connModel).setSchemaUpToDate(true); } }); UIAggregate agg = new UIAggregateImpl(); agg.setEnabled(false); aggList.addAgg(agg); controller.saveOlap(); System.out.println(FileUtils.readFileToString(new File(tmpFilePath))); }