Java Code Examples for org.pentaho.di.ui.trans.step.BaseStepDialog#setSize()

The following examples show how to use org.pentaho.di.ui.trans.step.BaseStepDialog#setSize() . 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: JobEntryJobDialog.java    From pentaho-kettle with Apache License 2.0 5 votes vote down vote up
public JobEntryInterface open() {
  Shell parent = getParent();
  display = parent.getDisplay();

  shell = new Shell( parent, props.getJobsDialogStyle() );
  props.setLook( shell );
  JobDialog.setShellImage( shell, jobEntry );

  backupChanged = jobEntry.hasChanged();

  createElements();

  // Detect [X] or ALT-F4 or something that kills this window...
  shell.addShellListener( new ShellAdapter() {
    public void shellClosed( ShellEvent e ) {
      cancel();
    }
  } );

  getData();
  setActive();

  BaseStepDialog.setSize( shell );

  int width = 750;
  int height = Const.isWindows() ? 730 : 718;

  shell.setSize( width, height );
  shell.open();
  while ( !shell.isDisposed() ) {
    if ( !display.readAndDispatch() ) {
      display.sleep();
    }
  }
  return jobEntry;
}
 
Example 2
Source File: JobEntryTransDialog.java    From pentaho-kettle with Apache License 2.0 5 votes vote down vote up
public JobEntryInterface open() {
  Shell parent = getParent();
  display = parent.getDisplay();

  shell = new Shell( parent, props.getJobsDialogStyle() );
  props.setLook( shell );
  JobDialog.setShellImage( shell, jobEntry );

  backupChanged = jobEntry.hasChanged();

  createElements();

  // Detect [X] or ALT-F4 or something that kills this window...
  shell.addShellListener( new ShellAdapter() {
    public void shellClosed( ShellEvent e ) {
      cancel();
    }
  } );

  getData();
  setActive();

  BaseStepDialog.setSize( shell );

  int width = 750;
  int height = Const.isWindows() ? 730 : 720;

  shell.setSize( width, height );
  shell.open();
  while ( !shell.isDisposed() ) {
    if ( !display.readAndDispatch() ) {
      display.sleep();
    }
  }
  return jobEntry;
}
 
Example 3
Source File: JobEntryCopyFilesDialog.java    From pentaho-kettle with Apache License 2.0 5 votes vote down vote up
public JobEntryInterface open() {
  initUI();
  BaseStepDialog.setSize( shell );
  shell.open();
  Display display = getParent().getDisplay();
  while ( !shell.isDisposed() ) {
    if ( !display.readAndDispatch() ) {
      display.sleep();
    }
  }
  return jobEntry;
}
 
Example 4
Source File: KettleDialog.java    From pentaho-kettle with Apache License 2.0 5 votes vote down vote up
@SuppressWarnings( "deprecation" )
@Override
public void show( boolean force ) {
  if ( ( force ) || ( !buttonsCreated ) ) {
    setButtons();
  }

  isDialogHidden = false;

  dialog.getShell().setText( title );

  // Remember the size from a last time or do proper layouting of the window.
  //
  if ( getWidth() > 0 && getHeight() > 0 ) {
    BaseStepDialog.setSize( getShell(), getWidth(), getHeight(), true );
  } else {
    BaseStepDialog.setSize( getShell() );
  }

  width = getShell().getSize().x;
  height = getShell().getSize().y;

  dialog.getShell().layout( true, true );

  // Timing is everything - fire the onLoad events so that anyone who is trying to listens gets notified
  //
  notifyListeners( XulRoot.EVENT_ON_LOAD );

  setAppicon( appIcon );

  returnCode = dialog.open();
}
 
Example 5
Source File: Translator.java    From pentaho-kettle with Apache License 2.0 5 votes vote down vote up
public void open() {
  shell = new Shell( display );
  shell.setLayout( new FillLayout() );
  shell.setText( APP_NAME );

  try {
    readFiles( ROOT );
  } catch ( Exception e ) {
    new ErrorDialog(
      shell, "Error reading translations", "There was an unexpected error reading the translations", e );
  }

  // Put something on the screen
  sashform = new SashForm( shell, SWT.HORIZONTAL );
  sashform.setLayout( new FillLayout() );

  addList();
  addGrid();
  addListeners();

  sashform.setWeights( new int[] { 30, 70 } );
  sashform.setVisible( true );

  refresh();

  BaseStepDialog.setSize( shell );

  shell.open();
}
 
Example 6
Source File: GraphModelDialog.java    From knowbi-pentaho-pdi-neo4j-output with Apache License 2.0 4 votes vote down vote up
/**
 * @return true when OK is hit, false when CANCEL
 */
public boolean open() {

  Shell parent = getParent();
  Display display = parent.getDisplay();

  shell = new Shell( parent, SWT.RESIZE | SWT.MAX | SWT.MIN | SWT.DIALOG_TRIM );
  shell.setImage( GUIResource.getInstance().getImageSpoon() );
  props.setLook( shell );

  margin = Const.MARGIN + 2;
  middle = Const.MIDDLE_PCT;

  FormLayout formLayout = new FormLayout();

  shell.setLayout( formLayout );
  shell.setText( "Graph Model Editor" );

  Button wOK = new Button( shell, SWT.PUSH );
  wOK.setText( BaseMessages.getString( PKG, "System.Button.OK" ) );
  wOK.addListener( SWT.Selection, event -> ok() );
  Button wCancel = new Button( shell, SWT.PUSH );
  wCancel.setText( BaseMessages.getString( PKG, "System.Button.Cancel" ) );
  wCancel.addListener( SWT.Selection, event -> cancel() );

  BaseStepDialog.positionBottomButtons( shell, new Button[] { wOK, wCancel }, margin, null );

  // Add a tab folder
  //
  wTabs = new CTabFolder( shell, SWT.BORDER );
  FormData fdTabs = new FormData();
  fdTabs.left = new FormAttachment( 0, 0 );
  fdTabs.right = new FormAttachment( 100, 0 );
  fdTabs.top = new FormAttachment( 0, 0 );
  fdTabs.bottom = new FormAttachment( wOK, -margin * 2 );
  wTabs.setLayoutData( fdTabs );

  addModelTab();
  addNodesTab();
  addRelationshipsTab();
  addGraphTab();

  // Select the model tab
  //
  wTabs.setSelection( 0 );

  // Set the shell size, based upon previous time...
  BaseStepDialog.setSize( shell );

  getData();

  shell.open();
  while ( !shell.isDisposed() ) {
    if ( !display.readAndDispatch() ) {
      display.sleep();
    }
  }

  return ok;
}
 
Example 7
Source File: ShowHelpDialog.java    From pentaho-kettle with Apache License 2.0 4 votes vote down vote up
public void open() {
  Shell parent = getParent();
  display = parent.getDisplay();

  shell = createShell( parent );
  shell.setImage( GUIResource.getInstance().getImageSpoon() );
  props.setLook( shell );

  FormLayout formLayout = new FormLayout();

  shell.setLayout( formLayout );
  shell.setText( dialogTitle );

  //Set Images
  setImages();

  // Canvas
  wBrowser = new Browser( shell, SWT.NONE );
  props.setLook( wBrowser );

  // Browser canvas
  FormData fdBrowser = new FormData();
  fdBrowser.top = new FormAttachment( 0, TOOLBAR_HEIGHT );
  fdBrowser.bottom = new FormAttachment( 100, 0 );
  fdBrowser.right = new FormAttachment( 100, 0 );
  fdBrowser.left = new FormAttachment( 0, 0 );
  wBrowser.setLayoutData( fdBrowser );
  wBrowser.setUrl( url );

  // Left toolbar (back, forward, refresh, home)
  toolbarLeft = new ToolBar( shell, SWT.WRAP );
  FormData fdToolbarLeft = new FormData();
  fdToolbarLeft.top = new FormAttachment( 0, MARGIN );
  toolbarLeft.setLayoutData( fdToolbarLeft );
  toolbarLeft.setCursor( cursorEnabled );
  toolbarLeft.setBackground( toolbarLeft.getParent().getBackground() );

  tltmBack = new ToolItem( toolbarLeft, SWT.PUSH );
  tltmBack.setImage( imageBackEnabled );
  tltmBack.setDisabledImage( imageBackDisabled );
  tltmBack.setToolTipText( BaseMessages.getString( PKG, "Spoon.Documentation.Tooltip.Back" ) );
  tltmBack.setEnabled( false );

  tltmForward = new ToolItem( toolbarLeft, SWT.PUSH );
  tltmForward.setImage( imageForwardEnabled );
  tltmForward.setDisabledImage( imageForwardDisabled );
  tltmForward.setToolTipText( BaseMessages.getString( PKG, "Spoon.Documentation.Tooltip.Forward" ) );
  tltmForward.setEnabled( false );

  tltmRefresh = new ToolItem( toolbarLeft, SWT.PUSH );
  tltmRefresh.setImage( imageRefreshEnabled );
  tltmRefresh.setDisabledImage( imageRefreshDisabled );
  tltmRefresh.setToolTipText( BaseMessages.getString( PKG, "Spoon.Documentation.Tooltip.Refresh" ) );
  tltmRefresh.setEnabled( true );

  tltmHome = new ToolItem( toolbarLeft, SWT.PUSH );
  tltmHome.setImage( imageHomeEnabled );
  tltmHome.setDisabledImage( imageHomeDisabled );
  tltmHome.setToolTipText( BaseMessages.getString( PKG, "Spoon.Documentation.Tooltip.Home" ) );
  tltmHome.setEnabled( true );

  // Right toolbar (print)
  toolbarRight = new ToolBar( shell, SWT.WRAP );
  FormData fdToolbarRight = new FormData();
  fdToolbarRight.top = new FormAttachment( 0, MARGIN );
  fdToolbarRight.right = new FormAttachment( 100, -1 * TOOL_ITEM_SPACING );
  toolbarRight.setLayoutData( fdToolbarRight );
  toolbarRight.setCursor( cursorEnabled );
  toolbarRight.setBackground( toolbarRight.getParent().getBackground() );

  // URL toolbar element
  textURL = new Text( shell, SWT.BORDER );
  FormData fdText = new FormData();
  fdText.top = new FormAttachment( 0, MARGIN );
  fdText.right = new FormAttachment( toolbarRight, -1 * TOOL_ITEM_SPACING );
  fdText.left = new FormAttachment( toolbarLeft, TOOL_ITEM_SPACING );
  textURL.setLayoutData( fdText );
  textURL.setForeground( new Color( display, 101, 101, 101 ) );

  tltmPrint = new ToolItem( toolbarRight, SWT.PUSH );
  tltmPrint.setImage( imagePrintEnabled );
  tltmPrint.setDisabledImage( imagePrintDisabled );
  tltmPrint.setToolTipText( BaseMessages.getString( PKG, "Spoon.Documentation.Tooltip.Print" ) );
  tltmPrint.setEnabled( true );

  setUpListeners();

  // Specs are 760/530, but due to rendering differences, we need to adjust the actual hgt/wdt used
  BaseStepDialog.setSize( shell, 755, 538, true );
  shell.setMinimumSize( 515, 408 );

  shell.open();
  while ( !shell.isDisposed() ) {
    if ( !display.readAndDispatch() ) {
      display.sleep();
    }
  }
}
 
Example 8
Source File: PropertiesDialog.java    From pentaho-kettle with Apache License 2.0 4 votes vote down vote up
public Map<String, String> open() {
  PropsUI props = PropsUI.getInstance();
  Shell parent = getParent();
  Display display = parent.getDisplay();

  shell = new Shell( parent, SWT.DIALOG_TRIM | SWT.RESIZE );
  props.setLook( shell );
  shell.setImage( GUIResource.getInstance().getImageSpoon() );

  FormLayout formLayout = new FormLayout();
  formLayout.marginWidth = Const.FORM_MARGIN;
  formLayout.marginHeight = Const.FORM_MARGIN;

  shell.setLayout( formLayout );
  shell.setText( getText() );

  if ( StringUtils.isNotEmpty( helpUrl ) ) {
    HelpUtils.createHelpButton( shell, helpTitle, helpUrl, helpHeader );
  }

  Button wCancel = new Button( shell, SWT.PUSH );
  wCancel.setText( BaseMessages.getString( PKG, "System.Button.Cancel" ) );
  FormData fdCancel = new FormData();
  fdCancel.right = new FormAttachment( 100, 0 );
  fdCancel.bottom = new FormAttachment( 100, 0 );
  wCancel.setLayoutData( fdCancel );
  wCancel.addListener( SWT.Selection, e -> close() );

  Button wOK = new Button( shell, SWT.PUSH );
  wOK.setText( BaseMessages.getString( PKG, "System.Button.OK" ) );
  FormData fdOk = new FormData();
  fdOk.right = new FormAttachment( wCancel, -5 );
  fdOk.bottom = new FormAttachment( 100, 0 );
  wOK.setLayoutData( fdOk );
  wOK.addListener( SWT.Selection, e -> ok() );

  ColumnInfo[] columns = createColumns();

  propertiesTable = new TableView(
    transMeta,
    shell,
    SWT.BORDER | SWT.FULL_SELECTION | SWT.MULTI,
    columns,
    10,
    false,
    null,
    props,
    false
  );

  propertiesTable.setSortable( false );
  propertiesTable.getTable().addListener( SWT.Resize, event -> {
    Table table = (Table) event.widget;
    table.getColumn( 1 ).setWidth( 220 );
    table.getColumn( 2 ).setWidth( 220 );
  } );

  populateData();

  FormData fdData = new FormData();
  fdData.left = new FormAttachment( 0, 0 );
  fdData.top = new FormAttachment( 0, 0 );
  fdData.right = new FormAttachment( 100, 0 );
  fdData.bottom = new FormAttachment( wOK, 0 );
  fdData.width = 450;

  propertiesTable.setLayoutData( fdData );

  BaseStepDialog.setSize( shell );

  shell.open();
  while ( !shell.isDisposed() ) {
    if ( !display.readAndDispatch() ) {
      display.sleep();
    }
  }

  return properties;
}