org.eclipse.swt.layout.FormData Java Examples

The following examples show how to use org.eclipse.swt.layout.FormData. 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 Project: hop   Author: project-hop   File: RadioTab.java    License: Apache License 2.0 8 votes vote down vote up
public Composite createContent( String radioText ) {
  Control[] existingButtons = radioGroup.getChildren();
  Button button = new Button( radioGroup, SWT.RADIO );
  button.setText( radioText );
  props.setLook( button );
  FormData fdButton = new FormData();
  fdButton.top = new FormAttachment( 0 );
  fdButton.left = existingButtons.length == 0
    ? new FormAttachment( 0 ) : new FormAttachment( existingButtons[ existingButtons.length - 1 ], 40 );
  button.setLayoutData( fdButton );
  button.setSelection( existingButtons.length == 0 );
  Composite content = new Composite( contentArea, SWT.NONE );
  content.setVisible( existingButtons.length == 0 );
  props.setLook( content );
  content.setLayout( noMarginLayout );
  content.setLayoutData( fdMaximize );
  button.addSelectionListener( new SelectionAdapter() {
    @Override public void widgetSelected( SelectionEvent selectionEvent ) {
      for ( Control control : contentArea.getChildren() ) {
        control.setVisible( false );
      }
      content.setVisible( true );
    }
  } );
  return content;
}
 
Example #2
Source Project: hop   Author: project-hop   File: HopGui.java    License: Apache License 2.0 6 votes vote down vote up
protected void addPerspectivesToolbar() {
  // We can't mix horizontal and vertical toolbars so we need to add a composite.
  //
  shell.setLayout( new FormLayout() );
  mainHopGuiComposite = new Composite( shell, SWT.NO_BACKGROUND );
  mainHopGuiComposite.setLayout( new FormLayout() );
  FormData formData = new FormData();
  formData.left = new FormAttachment( 0, 0 );
  formData.right = new FormAttachment( 100, 0 );
  formData.top = new FormAttachment( mainToolbar, 0 );
  formData.bottom = new FormAttachment( 100, 0 );
  mainHopGuiComposite.setLayoutData( formData );

  perspectivesToolbar = new ToolBar( mainHopGuiComposite, SWT.WRAP | SWT.RIGHT | SWT.VERTICAL );
  props.setLook( perspectivesToolbar, PropsUi.WIDGET_STYLE_TOOLBAR );
  FormData fdToolBar = new FormData();
  fdToolBar.left = new FormAttachment( 0, 0 );
  fdToolBar.top = new FormAttachment( 0, 0 );
  fdToolBar.bottom = new FormAttachment( 100, 0 );
  perspectivesToolbar.setLayoutData( fdToolBar );

  perspectivesToolbarWidgets = new GuiToolbarWidgets();
  perspectivesToolbarWidgets.registerGuiPluginObject( this );
  perspectivesToolbarWidgets.createToolbarWidgets( perspectivesToolbar, GUI_PLUGIN_PERSPECTIVES_PARENT_ID );
  perspectivesToolbar.pack();
}
 
Example #3
Source Project: hop   Author: project-hop   File: TeraFastDialog.java    License: Apache License 2.0 6 votes vote down vote up
/**
 * @param factory factory to use.
 */
protected void buildFastloadLine( final PluginWidgetFactory factory ) {
  final Control topControl = this.wVariableSubstitution;

  this.wlFastLoadPath =
    factory.createRightLabel( BaseMessages.getString( PKG, "TeraFastDialog.FastloadPath.Label" ) );
  this.props.setLook( this.wlFastLoadPath );
  this.wlFastLoadPath.setLayoutData( factory.createLabelLayoutData( topControl ) );

  this.wbFastLoadPath = factory.createPushButton( BaseMessages.getString( PKG, "TeraFastDialog.Browse.Button" ) );
  this.props.setLook( this.wbFastLoadPath );
  FormData formData = factory.createControlLayoutData( topControl );
  formData.left = null;
  this.wbFastLoadPath.setLayoutData( formData );

  this.wFastLoadPath = factory.createSingleTextVarLeft();
  this.props.setLook( this.wFastLoadPath );
  formData = factory.createControlLayoutData( topControl );
  formData.right = new FormAttachment( this.wbFastLoadPath, -factory.getMargin() );
  this.wFastLoadPath.setLayoutData( formData );
}
 
Example #4
Source Project: hop   Author: project-hop   File: TeraFastDialog.java    License: Apache License 2.0 6 votes vote down vote up
/**
 * @param factory factory to use.
 */
protected void buildLogFileLine( final PluginWidgetFactory factory ) {
  final Control topControl = this.wFastLoadPath;

  this.wlLogFile = factory.createRightLabel( BaseMessages.getString( PKG, "TeraFastDialog.LogFile.Label" ) );
  this.props.setLook( this.wlLogFile );
  this.wlLogFile.setLayoutData( factory.createLabelLayoutData( topControl ) );

  this.wbLogFile = factory.createPushButton( BaseMessages.getString( PKG, "TeraFastDialog.Browse.Button" ) );
  this.props.setLook( this.wbLogFile );
  FormData formData = factory.createControlLayoutData( topControl );
  formData.left = null;
  this.wbLogFile.setLayoutData( formData );

  this.wLogFile = factory.createSingleTextVarLeft();
  this.props.setLook( this.wLogFile );
  formData = factory.createControlLayoutData( topControl );
  formData.right = new FormAttachment( this.wbLogFile, -factory.getMargin() );
  this.wLogFile.setLayoutData( formData );
}
 
Example #5
Source Project: hop   Author: project-hop   File: BaseTransformDialog.java    License: Apache License 2.0 6 votes vote down vote up
/**
 * Aligns the buttons as left-aligned on the dialog.
 *
 * @param buttons     the array of buttons to align
 * @param width       the standardized width of all the buttons
 * @param margin      the margin between buttons
 * @param lastControl (optional) the bottom most control used for aligning the buttons relative to the bottom of the
 *                    controls on the dialog
 */
protected static void leftAlignButtons( Button[] buttons, int width, int margin, Control lastControl ) {
  for ( int i = 0; i < buttons.length; ++i ) {
    FormData formData = createDefaultFormData( buttons[ i ], width, margin, lastControl );

    // Set the left side of the buttons (either offset from the edge, or relative to the previous button)
    if ( i == 0 ) {
      formData.left = new FormAttachment( 0, margin );
    } else {
      formData.left = new FormAttachment( buttons[ i - 1 ], margin );
    }

    // Apply the layout data
    buttons[ i ].setLayoutData( formData );
  }
}
 
Example #6
Source Project: hop   Author: project-hop   File: BaseTransformDialog.java    License: Apache License 2.0 6 votes vote down vote up
/**
 * Aligns the buttons as right-aligned on the dialog.
 *
 * @param buttons     the array of buttons to align
 * @param width       the standardized width of all the buttons
 * @param margin      the margin between buttons
 * @param lastControl (optional) the bottom most control used for aligning the buttons relative to the bottom of the
 *                    controls on the dialog
 */
protected static void rightAlignButtons( Button[] buttons, int width, int margin, Control lastControl ) {
  for ( int i = buttons.length - 1; i >= 0; --i ) {
    FormData formData = createDefaultFormData( buttons[ i ], width, margin, lastControl );

    // Set the right side of the buttons (either offset from the edge, or relative to the previous button)
    if ( i == buttons.length - 1 ) {
      formData.left = new FormAttachment( 100, -( width + margin ) );
    } else {
      formData.left = new FormAttachment( buttons[ i + 1 ], -( 2 * ( width + margin ) ) - margin );
    }

    // Apply the layout data
    buttons[ i ].setLayoutData( formData );
  }
}
 
Example #7
Source Project: hop   Author: project-hop   File: ConfigurationDialog.java    License: Apache License 2.0 6 votes vote down vote up
protected void optionsSectionLayout( Class<?> PKG, String prefix ) {
  gDetails = new Group( shell, SWT.SHADOW_ETCHED_IN );
  gDetails.setText( BaseMessages.getString( PKG, prefix + ".DetailsGroup.Label" ) );
  props.setLook( gDetails );

  // The layout
  gDetails.setLayout( new FormLayout() );
  fdDetails = new FormData();
  fdDetails.top = new FormAttachment( wRunConfigurationControl, 15 );
  fdDetails.right = new FormAttachment( 100, -15 );
  fdDetails.left = new FormAttachment( 0, 15 );
  gDetails.setBackground( shell.getBackground() ); // the default looks ugly
  gDetails.setLayoutData( fdDetails );

  optionsSectionControls();
}
 
Example #8
Source Project: hop   Author: project-hop   File: BrowserEnvironmentWarningDialog.java    License: Apache License 2.0 6 votes vote down vote up
private void setCloseButton() {
  closeButton = new Button( shell, SWT.PUSH );
  closeButton.setText( BaseMessages.getString( PKG, "System.Button.Close" ) );
  FormData fdbutton = new FormData();
  fdbutton.right = new FormAttachment( 100, 0 ); //Button should below the link and separated by 30
  fdbutton.top = new FormAttachment( link, padding );
  fdbutton.height = padding;
  closeButton.setLayoutData( fdbutton );
  props.setLook( closeButton );

  // Add listeners
  closeButton.addListener( SWT.Selection, new Listener() {
    public void handleEvent( Event e ) {
      close();
    }
  } );
}
 
Example #9
Source Project: hop   Author: project-hop   File: EnterOptionsDialog.java    License: Apache License 2.0 6 votes vote down vote up
/**
 * Setting the layout of a <i>Reset</i> option button. Either a button image is set - if existing - or a text.
 *
 * @param button The button
 */
private FormData layoutResetOptionButton( Button button ) {
  FormData fd = new FormData();
  Image editButton = GuiResource.getInstance().getResetOptionButton();
  if ( editButton != null ) {
    button.setImage( editButton );
    button.setBackground( GuiResource.getInstance().getColorWhite() );
    fd.width = editButton.getBounds().width + 20;
    fd.height = editButton.getBounds().height;
  } else {
    button.setText( BaseMessages.getString( PKG, "EnterOptionsDialog.Button.Reset" ) );
  }

  button.setToolTipText( BaseMessages.getString( PKG, "EnterOptionsDialog.Button.Reset.Tooltip" ) );
  return fd;
}
 
Example #10
Source Project: hop   Author: project-hop   File: EnterOptionsDialog.java    License: Apache License 2.0 6 votes vote down vote up
/**
 * Setting the layout of an <i>Edit</i> option button. Either a button image is set - if existing - or a text.
 *
 * @param button The button
 */
private FormData layoutEditOptionButton( Button button ) {
  FormData fd = new FormData();
  Image editButton = GuiResource.getInstance().getEditOptionButton();
  if ( editButton != null ) {
    button.setImage( editButton );
    button.setBackground( GuiResource.getInstance().getColorWhite() );
    fd.width = editButton.getBounds().width + 20;
    fd.height = editButton.getBounds().height;
  } else {
    button.setText( BaseMessages.getString( PKG, "EnterOptionsDialog.Button.Edit" ) );
  }

  button.setToolTipText( BaseMessages.getString( PKG, "EnterOptionsDialog.Button.Edit.Tooltip" ) );
  return fd;
}
 
Example #11
Source Project: hop   Author: project-hop   File: FormInput.java    License: Apache License 2.0 6 votes vote down vote up
/**
 * setter for the element position
 *
 * @param FormAttachment position
 * @param widget         to set position, [ lable, input ]
 * @param position       side, [ left, right, top, bottom ]
 */
public void setPosition( FormAttachment position, Widget widget, Position side ) {
  FormData layout = widget == Widget.LABEL ? getLabelFD() : getInputFD();

  switch ( side ) {
    case LEFT:
      layout.left = position;
      break;
    case RIGHT:
      layout.right = position;
      break;
    case TOP:
      layout.top = position;
      break;
    case BOTTOM:
      layout.bottom = position;
      break;
    default:
      break;
  }
}
 
Example #12
Source Project: hop   Author: project-hop   File: HopGui.java    License: Apache License 2.0 5 votes vote down vote up
protected void addMainToolbar() {
  mainToolbar = new ToolBar( shell, SWT.WRAP | SWT.LEFT | SWT.HORIZONTAL );
  FormData fdToolBar = new FormData();
  fdToolBar.left = new FormAttachment( 0, 0 );
  fdToolBar.top = new FormAttachment( 0, 0 );
  fdToolBar.right = new FormAttachment( 100, 0 );
  mainToolbar.setLayoutData( fdToolBar );
  props.setLook( mainToolbar, Props.WIDGET_STYLE_TOOLBAR );

  mainToolbarWidgets = new GuiToolbarWidgets();
  mainToolbarWidgets.registerGuiPluginObject( this );
  mainToolbarWidgets.createToolbarWidgets( mainToolbar, ID_MAIN_TOOLBAR );
  mainToolbar.pack();
}
 
Example #13
Source Project: hop   Author: project-hop   File: HopGui.java    License: Apache License 2.0 5 votes vote down vote up
/**
 * Add a main composite where the various perspectives can parent on to show stuff...
 * Its area is to just below the main toolbar and to the right of the perspectives toolbar
 */
private void addMainPerspectivesComposite() {
  mainPerspectivesComposite = new Composite( mainHopGuiComposite, SWT.NO_BACKGROUND );
  mainPerspectivesComposite.setLayout( new FormLayout() );
  FormData fdMain = new FormData();
  fdMain.top = new FormAttachment( 0, 0 );
  fdMain.left = new FormAttachment( perspectivesToolbar, 0 );
  fdMain.bottom = new FormAttachment( 100, 0 );
  fdMain.right = new FormAttachment( 100, 0 );
  mainPerspectivesComposite.setLayoutData( fdMain );
}
 
Example #14
Source Project: hop   Author: project-hop   File: NumberRangeDialog.java    License: Apache License 2.0 5 votes vote down vote up
/**
 * Creates the table of rules
 */
private void createRulesTable( ModifyListener lsMod ) {
  Label rulesLable = new Label( shell, SWT.NONE );
  rulesLable.setText( BaseMessages.getString( PKG, "NumberRange.Ranges" ) );
  props.setLook( rulesLable );
  FormData lableFormData = new FormData();
  lableFormData.left = new FormAttachment( 0, 0 );
  lableFormData.right = new FormAttachment( props.getMiddlePct(), -props.getMargin() );
  lableFormData.top = new FormAttachment( fallBackValueControl, props.getMargin() );
  rulesLable.setLayoutData( lableFormData );

  final int FieldsRows = input.getRules().size();

  ColumnInfo[] colinf = new ColumnInfo[ 3 ];
  colinf[ 0 ] =
    new ColumnInfo(
      BaseMessages.getString( PKG, "NumberRange.LowerBound" ), ColumnInfo.COLUMN_TYPE_TEXT, false );
  colinf[ 1 ] =
    new ColumnInfo(
      BaseMessages.getString( PKG, "NumberRange.UpperBound" ), ColumnInfo.COLUMN_TYPE_TEXT, false );
  colinf[ 2 ] =
    new ColumnInfo( BaseMessages.getString( PKG, "NumberRange.Value" ), ColumnInfo.COLUMN_TYPE_TEXT, false );

  rulesControl =
    new TableView(
      pipelineMeta, shell, SWT.BORDER | SWT.FULL_SELECTION | SWT.MULTI, colinf, FieldsRows, lsMod, props );

  fdFields = new FormData();
  fdFields.left = new FormAttachment( 0, 0 );
  fdFields.top = new FormAttachment( rulesLable, props.getMargin() );
  fdFields.right = new FormAttachment( 100, 0 );
  fdFields.bottom = new FormAttachment( 100, -50 );
  rulesControl.setLayoutData( fdFields );
}
 
Example #15
Source Project: hop   Author: project-hop   File: HopGuiPipelinePerfDelegate.java    License: Apache License 2.0 5 votes vote down vote up
/**
 * Tell the user that the pipeline is not running or that there is no monitoring configured.
 */
private void showEmptyGraph() {
  if ( perfComposite.isDisposed() ) {
    return;
  }

  emptyGraph = true;

  Label label = new Label( perfComposite, SWT.CENTER );
  label.setText( BaseMessages.getString( PKG, "PipelineLog.Dialog.PerformanceMonitoringNotEnabled.Message" ) );
  label.setBackground( perfComposite.getBackground() );
  label.setFont( GuiResource.getInstance().getFontMedium() );

  FormData fdLabel = new FormData();
  fdLabel.left = new FormAttachment( 5, 0 );
  fdLabel.right = new FormAttachment( 95, 0 );
  fdLabel.top = new FormAttachment( 5, 0 );
  label.setLayoutData( fdLabel );

  Button button = new Button( perfComposite, SWT.CENTER );
  button.setText( BaseMessages.getString( PKG, "PipelineLog.Dialog.PerformanceMonitoring.Button" ) );
  button.setBackground( perfComposite.getBackground() );
  button.setFont( GuiResource.getInstance().getFontMedium() );

  button.addSelectionListener( new SelectionAdapter() {
    public void widgetSelected( SelectionEvent event ) {
      pipelineGraph.editProperties( pipelineGraph.getPipelineMeta(), hopGui, true, PipelineDialog.Tabs.MONITOR_TAB );
    }
  } );

  FormData fdButton = new FormData();
  fdButton.left = new FormAttachment( 40, 0 );
  fdButton.right = new FormAttachment( 60, 0 );
  fdButton.top = new FormAttachment( label, 5 );
  button.setLayoutData( fdButton );

  perfComposite.layout( true, true );
}
 
Example #16
Source Project: hop   Author: project-hop   File: HopGuiPipelineLogDelegate.java    License: Apache License 2.0 5 votes vote down vote up
private void addToolBar() {
  toolbar = new ToolBar( pipelineLogComposite, SWT.BORDER | SWT.WRAP | SWT.SHADOW_OUT | SWT.LEFT | SWT.HORIZONTAL );
  FormData fdToolBar = new FormData();
  fdToolBar.left = new FormAttachment( 0, 0 );
  fdToolBar.top = new FormAttachment( 0, 0 );
  fdToolBar.right = new FormAttachment( 100, 0 );
  toolbar.setLayoutData( fdToolBar );
  hopGui.getProps().setLook( toolbar, Props.WIDGET_STYLE_TOOLBAR );

  toolBarWidgets = new GuiToolbarWidgets();
  toolBarWidgets.registerGuiPluginObject( this );
  toolBarWidgets.createToolbarWidgets( toolbar, GUI_PLUGIN_TOOLBAR_PARENT_ID );
  toolbar.pack();
}
 
Example #17
Source Project: hop   Author: project-hop   File: HopGuiPipelineGridDelegate.java    License: Apache License 2.0 5 votes vote down vote up
private void addToolBar() {

    toolbar = new ToolBar( pipelineGridComposite, SWT.BORDER | SWT.WRAP | SWT.SHADOW_OUT | SWT.LEFT | SWT.HORIZONTAL );
    FormData fdToolBar = new FormData();
    fdToolBar.left = new FormAttachment( 0, 0 );
    fdToolBar.top = new FormAttachment( 0, 0 );
    fdToolBar.right = new FormAttachment( 100, 0 );
    toolbar.setLayoutData( fdToolBar );
    hopGui.getProps().setLook( toolbar, Props.WIDGET_STYLE_TOOLBAR );

    toolbarWidget = new GuiToolbarWidgets();
    toolbarWidget.registerGuiPluginObject( this );
    toolbarWidget.createToolbarWidgets( toolbar, GUI_PLUGIN_TOOLBAR_PARENT_ID );
    toolbar.pack();
  }
 
Example #18
Source Project: hop   Author: project-hop   File: CheckBoxTableCombo.java    License: Apache License 2.0 5 votes vote down vote up
private void buildSSLTable( Composite parentWidget, Control relativePosition ) {
  ColumnInfo[] columns = getSSLColumns();

  propertiesTable = new TableView(
    pipelineMeta,
    parentWidget,
    SWT.BORDER | SWT.FULL_SELECTION | SWT.MULTI,
    columns,
    0,  // num of starting rows (will be added later)
    true,
    lsMod,
    props,
    false
  );

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

  populateSSLData();

  FormData fdData = new FormData();
  fdData.left = new FormAttachment( 0, 0 );
  fdData.top = new FormAttachment( relativePosition, 5 );
  fdData.bottom = new FormAttachment( 100, 0 );
  fdData.width = 800;

  // resize the columns to fit the data in them
  stream( propertiesTable.getTable().getColumns() ).forEach( column -> {
    if ( column.getWidth() > 0 ) {
      // don't pack anything with a 0 width, it will resize it to make it visible (like the index column)
      column.setWidth( 200 );
    }
  } );

  propertiesTable.setLayoutData( fdData );
}
 
Example #19
Source Project: hop   Author: project-hop   File: HopGuiWorkflowLogDelegate.java    License: Apache License 2.0 5 votes vote down vote up
private void addToolBar() {
  toolbar = new ToolBar( jobLogComposite, SWT.BORDER | SWT.WRAP | SWT.SHADOW_OUT | SWT.LEFT | SWT.HORIZONTAL );
  FormData fdToolBar = new FormData();
  fdToolBar.left = new FormAttachment( 0, 0 );
  fdToolBar.top = new FormAttachment( 0, 0 );
  fdToolBar.right = new FormAttachment( 100, 0 );
  toolbar.setLayoutData( fdToolBar );
  hopGui.getProps().setLook( toolbar, Props.WIDGET_STYLE_TOOLBAR );

  toolBarWidgets = new GuiToolbarWidgets();
  toolBarWidgets.registerGuiPluginObject( this );
  toolBarWidgets.createToolbarWidgets( toolbar, GUI_PLUGIN_TOOLBAR_PARENT_ID );
  toolbar.pack();
}
 
Example #20
Source Project: hop   Author: project-hop   File: PipelineExecutionConfigurationDialog.java    License: Apache License 2.0 5 votes vote down vote up
protected void optionsSectionControls() {

    wlLogLevel = new Label( gDetails, SWT.NONE );
    props.setLook( wlLogLevel );
    wlLogLevel.setText( BaseMessages.getString( PKG, "PipelineExecutionConfigurationDialog.LogLevel.Label" ) );
    wlLogLevel.setToolTipText( BaseMessages.getString( PKG, "PipelineExecutionConfigurationDialog.LogLevel.Tooltip" ) );
    FormData fdlLogLevel = new FormData();
    fdlLogLevel.top = new FormAttachment( 0, 10 );
    fdlLogLevel.left = new FormAttachment( 0, 10 );
    wlLogLevel.setLayoutData( fdlLogLevel );

    wLogLevel = new CCombo( gDetails, SWT.READ_ONLY | SWT.BORDER );
    wLogLevel.setToolTipText( BaseMessages.getString( PKG, "PipelineExecutionConfigurationDialog.LogLevel.Tooltip" ) );
    props.setLook( wLogLevel );
    FormData fdLogLevel = new FormData();
    fdLogLevel.top = new FormAttachment( wlLogLevel, -2, SWT.TOP );
    fdLogLevel.width = 350;
    fdLogLevel.left = new FormAttachment( wlLogLevel, 6 );
    wLogLevel.setLayoutData( fdLogLevel );
    wLogLevel.setItems( LogLevel.getLogLevelDescriptions() );

    wClearLog = new Button( gDetails, SWT.CHECK );
    wClearLog.setText( BaseMessages.getString( PKG, "PipelineExecutionConfigurationDialog.ClearLog.Label" ) );
    wClearLog.setToolTipText( BaseMessages.getString( PKG, "PipelineExecutionConfigurationDialog.ClearLog.Tooltip" ) );
    props.setLook( wClearLog );
    FormData fdClearLog = new FormData();
    fdClearLog.top = new FormAttachment( wLogLevel, 10 );
    fdClearLog.left = new FormAttachment( 0, 10 );
    wClearLog.setLayoutData( fdClearLog );

  }
 
Example #21
Source Project: hop   Author: project-hop   File: PipelineExecutionConfigurationDialog.java    License: Apache License 2.0 5 votes vote down vote up
private void addRunConfigurationSectionLayout() {
  String runConfigLabel = BaseMessages.getString( PKG, "PipelineExecutionConfigurationDialog.PipelineRunConfiguration.Label" );
  String runConfigTooltip = BaseMessages.getString( PKG, "PipelineExecutionConfigurationDialog.PipelineRunConfiguration.Tooltip" );

  wRunConfiguration = new MetaSelectionLine<>( hopGui.getVariables(), hopGui.getMetadataProvider(), PipelineRunConfiguration.class,
    shell, SWT.BORDER, runConfigLabel, runConfigTooltip, true );
  wRunConfigurationControl = wRunConfiguration;
  props.setLook( wRunConfiguration );
  FormData fdRunConfiguration = new FormData();
  fdRunConfiguration.right = new FormAttachment( 100, -10 );
  fdRunConfiguration.top = new FormAttachment( 0, props.getMargin() );
  fdRunConfiguration.left = new FormAttachment( 0, 10 );
  wRunConfiguration.setLayoutData( fdRunConfiguration );
}
 
Example #22
Source Project: hop   Author: project-hop   File: TeraFastDialog.java    License: Apache License 2.0 5 votes vote down vote up
/**
 * @param factory factory to use.
 */
protected void buildAscLink( final PluginWidgetFactory factory ) {
  final Control topControl = this.wReturn;

  FormData formData = factory.createLabelLayoutData( topControl );
  formData.right = null;
}
 
Example #23
Source Project: hop   Author: project-hop   File: BaseTransformDialog.java    License: Apache License 2.0 5 votes vote down vote up
/**
 * Creats a default FormData object with the top / bottom / and left set (this is done to cut down on repetative code
 * lines.
 *
 * @param button      the button to which this form data will be applied
 * @param width       the width of the button
 * @param margin      the margin between buttons
 * @param lastControl the last control above the buttons
 * @return the newly created FormData object
 */
private static FormData createDefaultFormData( Button button, int width, int margin, Control lastControl ) {
  FormData formData = new FormData();
  if ( lastControl != null ) {
    formData.top = new FormAttachment( lastControl, margin * 3 );
  } else {
    formData.bottom = new FormAttachment( 100, 0 );
  }
  formData.right = new FormAttachment( button, width + margin );
  return formData;
}
 
Example #24
Source Project: hop   Author: project-hop   File: BaseTransformDialog.java    License: Apache License 2.0 5 votes vote down vote up
/**
 * Aligns the buttons as centered on the dialog.
 *
 * @param buttons     the array of buttons to align
 * @param width       the standardized width of all the buttons
 * @param margin      the margin between buttons
 * @param lastControl (optional) the bottom most control used for aligning the buttons relative to the bottom of the
 *                    controls on the dialog
 */
protected static void centerButtons( Button[] buttons, int width, int margin, Control lastControl ) {
  // Setup the middle button
  int middleButtonIndex = buttons.length / 2;
  FormData formData = createDefaultFormData( buttons[ middleButtonIndex ], width, margin, lastControl );

  // See if we have an even or odd number of buttons...
  int leftOffset = 0;
  if ( buttons.length % 2 == 0 ) {
    // Even number of buttons - the middle is between buttons. The "middle" button is
    // actually to the right of middle
    leftOffset = margin;
  } else {
    // Odd number of buttons - tht middle is in the middle of the button
    leftOffset = -( width + margin ) / 2;
  }
  formData.left = new FormAttachment( 50, leftOffset );
  buttons[ middleButtonIndex ].setLayoutData( formData );

  // Do the buttons to the right of the middle
  for ( int i = middleButtonIndex + 1; i < buttons.length; ++i ) {
    formData = createDefaultFormData( buttons[ i ], width, margin, lastControl );
    formData.left = new FormAttachment( buttons[ i - 1 ], margin );
    buttons[ i ].setLayoutData( formData );
  }

  // Do the buttons to the left of the middle
  for ( int i = middleButtonIndex - 1; i >= 0; --i ) {
    formData = createDefaultFormData( buttons[ i ], width, margin, lastControl );
    formData.left = new FormAttachment( buttons[ i + 1 ], -( 2 * ( width + margin ) ) - margin );
    buttons[ i ].setLayoutData( formData );
  }
}
 
Example #25
Source Project: hop   Author: project-hop   File: WorkflowExecutionConfigurationDialog.java    License: Apache License 2.0 5 votes vote down vote up
private void addRunConfigurationSectionLayout() {
  String runConfigLabel = BaseMessages.getString( PKG, "ConfigurationDialog.RunConfiguration.Label" );
  String runConfigTooltip = BaseMessages.getString( PKG, "ConfigurationDialog.RunConfiguration.Tooltip" );

  wRunConfiguration = new MetaSelectionLine<>( hopGui.getVariables(), hopGui.getMetadataProvider(), WorkflowRunConfiguration.class,
    shell, SWT.BORDER, runConfigLabel, runConfigTooltip, true );
  wRunConfigurationControl = wRunConfiguration;
  props.setLook( wRunConfiguration );
  FormData fdRunConfiguration = new FormData();
  fdRunConfiguration.right = new FormAttachment( 100, 0 );
  fdRunConfiguration.top = new FormAttachment( 0, props.getMargin() );
  fdRunConfiguration.left = new FormAttachment( 0, 0 );
  wRunConfiguration.setLayoutData( fdRunConfiguration );
}
 
Example #26
Source Project: hop   Author: project-hop   File: ActionSpecialDialog.java    License: Apache License 2.0 5 votes vote down vote up
private void placeControl( Shell pShell, String text, Control control, Control under ) {
  int middle = props.getMiddlePct();
  int margin = props.getMargin();
  Label label = new Label( pShell, SWT.RIGHT );
  label.setText( text );
  props.setLook( label );
  FormData formDataLabel = new FormData();
  formDataLabel.left = new FormAttachment( 0, 0 );
  if ( under != null ) {
    formDataLabel.top = new FormAttachment( under, margin );
  } else {
    formDataLabel.top = new FormAttachment( 0, 0 );
  }
  formDataLabel.right = new FormAttachment( middle, 0 );
  label.setLayoutData( formDataLabel );

  props.setLook( control );
  FormData formDataControl = new FormData();
  formDataControl.left = new FormAttachment( middle, 0 );
  if ( under != null ) {
    formDataControl.top = new FormAttachment( under, margin );
  } else {
    formDataControl.top = new FormAttachment( 0, 0 );
  }
  formDataControl.right = new FormAttachment( 100, 0 );
  control.setLayoutData( formDataControl );
}
 
Example #27
Source Project: hop   Author: project-hop   File: HelpUtils.java    License: Apache License 2.0 5 votes vote down vote up
private static Button newButton( final Composite parent ) {
  Button button = new Button( parent, SWT.PUSH );
  button.setImage( GuiResource.getInstance().getImageHelpWeb() );
  button.setText( BaseMessages.getString( PKG, "System.Button.Help" ) );
  button.setToolTipText( BaseMessages.getString( PKG, "System.Tooltip.Help" ) );
  FormData fdButton = new FormData();
  fdButton.left = new FormAttachment( 0, 0 );
  fdButton.bottom = new FormAttachment( 100, 0 );
  button.setLayoutData( fdButton );
  return button;
}
 
Example #28
Source Project: hop   Author: project-hop   File: BrowserEnvironmentWarningDialog.java    License: Apache License 2.0 5 votes vote down vote up
private void setWarningIcon( Display display ) {
  warningIcon = new Label( shell, SWT.NONE );
  Image image = display.getSystemImage( SWT.ICON_WARNING );
  warningIcon.setImage( image );
  props.setLook( warningIcon );
  FormData fdIcon = new FormData();
  fdIcon.left = new FormAttachment( 0, 0 );
  fdIcon.top = new FormAttachment( 0, 0 );
  fdIcon.right = new FormAttachment( 0, image.getBounds().width );
  fdIcon.bottom = new FormAttachment( 0, image.getBounds().height ); //icon should be at the top left corner
  warningIcon.setLayoutData( fdIcon );
}
 
Example #29
Source Project: hop   Author: project-hop   File: BrowserEnvironmentWarningDialog.java    License: Apache License 2.0 5 votes vote down vote up
private void setWarningText( String message, int maxTextWidth ) {
  description = new Text( shell, SWT.MULTI | SWT.LEFT | SWT.WRAP | SWT.NO_FOCUS | SWT.HIDE_SELECTION );
  description.setText( message );
  description.setEditable( false );
  FormData fdlDesc = new FormData();
  fdlDesc.left = new FormAttachment( warningIcon, margin ); // Text should be right of the icon and at the top
  fdlDesc.top = new FormAttachment( 0, 0 );
  fdlDesc.width = maxTextWidth;
  description.setLayoutData( fdlDesc );
  props.setLook( description );
}
 
Example #30
Source Project: hop   Author: project-hop   File: TextFileImportWizardPage1.java    License: Apache License 2.0 5 votes vote down vote up
public void createControl( Composite parent ) {
  // create the composite to hold the widgets
  Composite composite = new Composite( parent, SWT.NONE );
  props.setLook( composite );

  FormLayout compLayout = new FormLayout();
  compLayout.marginHeight = Const.FORM_MARGIN;
  compLayout.marginWidth = Const.FORM_MARGIN;
  composite.setLayout( compLayout );

  MouseAdapter lsMouse = new MouseAdapter() {
    public void mouseDown( MouseEvent e ) {
      int s = getSize();
      setPageComplete( s > 0 );
    }
  };

  wTable = new TableDraw( composite, props, this, fields );
  wTable.setRows( rows );
  props.setLook( wTable );
  wTable.setFields( fields );
  fdTable = new FormData();
  fdTable.left = new FormAttachment( 0, 0 );
  fdTable.right = new FormAttachment( 100, 0 );
  fdTable.top = new FormAttachment( 0, 0 );
  fdTable.bottom = new FormAttachment( 100, 0 );
  wTable.setLayoutData( fdTable );
  wTable.addMouseListener( lsMouse );

  // set the composite as the control for this page
  setControl( composite );
}