Java Code Examples for org.pentaho.ui.xul.components.XulFileDialog#showOpenDialog()

The following examples show how to use org.pentaho.ui.xul.components.XulFileDialog#showOpenDialog() . 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 vote down vote up
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 vote down vote up
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 vote down vote up
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);
  }
}