org.eclipse.swt.layout.FormAttachment Java Examples

The following examples show how to use org.eclipse.swt.layout.FormAttachment. 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: HopGuiPipelineGraph.java    License: Apache License 2.0 6 votes vote down vote up
private void addToolBar() {

    try {
      // Create a new toolbar at the top of the main composite...
      //
      toolBar = new ToolBar( this, SWT.WRAP | SWT.LEFT | SWT.HORIZONTAL );
      toolBarWidgets = new GuiToolbarWidgets();
      toolBarWidgets.registerGuiPluginObject( this );
      toolBarWidgets.createToolbarWidgets( toolBar, GUI_PLUGIN_TOOLBAR_PARENT_ID );
      FormData layoutData = new FormData();
      layoutData.left = new FormAttachment( 0, 0 );
      layoutData.top = new FormAttachment( 0, 0 );
      layoutData.right = new FormAttachment( 100, 0 );
      toolBar.setLayoutData( layoutData );
      toolBar.pack();

      // enable / disable the icons in the toolbar too.
      //
      updateGui();

    } catch ( Throwable t ) {
      log.logError( "Error setting up the navigation toolbar for HopUI", t );
      new ErrorDialog( hopShell(), "Error", "Error setting up the navigation toolbar for HopGUI", new Exception( t ) );
    }
  }
 
Example #4
Source Project: hop   Author: project-hop   File: HopGuiWorkflowGraph.java    License: Apache License 2.0 6 votes vote down vote up
private void addToolBar() {

    try {
      // Create a new toolbar at the top of the main composite...
      //
      toolBar = new ToolBar( this, SWT.WRAP | SWT.LEFT | SWT.HORIZONTAL );
      toolBarWidgets = new GuiToolbarWidgets();
      toolBarWidgets.registerGuiPluginObject( this );
      toolBarWidgets.createToolbarWidgets( toolBar, GUI_PLUGIN_TOOLBAR_PARENT_ID );
      FormData layoutData = new FormData();
      layoutData.left = new FormAttachment( 0, 0 );
      layoutData.top = new FormAttachment( 0, 0 );
      layoutData.right = new FormAttachment( 100, 0 );
      toolBar.setLayoutData( layoutData );
      toolBar.pack();

      // enable / disable the icons in the toolbar too.
      //
      updateGui();

    } catch ( Throwable t ) {
      log.logError( "Error setting up the navigation toolbar for HopUI", t );
      new ErrorDialog( hopShell(), "Error", "Error setting up the navigation toolbar for HopGUI", new Exception( t ) );
    }
  }
 
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: ActionCopyFilesDialog.java    License: Apache License 2.0 6 votes vote down vote up
protected Button createSettingsButton( Composite p, String text, String title, Control top, SelectionAdapter sa ) {
  Button button = new Button( p, SWT.CHECK );
  button.setText( text );
  button.setToolTipText( title );
  props.setLook( button );
  FormData fd = new FormData();
  fd.left = new FormAttachment( 0, Const.MARGIN * 2 );
  if ( top == null ) {
    fd.top = new FormAttachment( 0, 10 );
  } else {
    fd.top = new FormAttachment( top, 5 );
  }
  fd.right = new FormAttachment( 100, 0 );
  button.setLayoutData( fd );
  button.addSelectionListener( sa );
  return button;
}
 
Example #8
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 #9
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 buildControlFileLine( final PluginWidgetFactory factory ) {
  final Control topControl = this.wUseControlFile;

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

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

  this.wControlFile = factory.createSingleTextVarLeft();
  this.props.setLook( this.wControlFile );
  formData = factory.createControlLayoutData( topControl );
  formData.right = new FormAttachment( this.wbControlFile, -factory.getMargin() );
  this.wControlFile.setLayoutData( formData );
}
 
Example #10
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 #11
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 buildDataFileLine( final PluginWidgetFactory factory ) {
  final Control topControl = this.wbTruncateTable;

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

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

  this.wDataFile = factory.createSingleTextVarLeft();
  this.props.setLook( this.wDataFile );
  formData = factory.createControlLayoutData( topControl );
  formData.right = new FormAttachment( this.wbDataFile, -factory.getMargin() );
  this.wDataFile.setLayoutData( formData );
}
 
Example #12
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 #13
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 #14
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 #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: 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 #19
Source Project: hop   Author: project-hop   File: MultiMergeJoinDialog.java    License: Apache License 2.0 5 votes vote down vote up
/**
 * Create widgets for join type selection
 *
 * @param lsMod
 */
private void createJoinTypeWidget( final ModifyListener lsMod ) {
  Label joinTypeLabel = new Label( shell, SWT.LEFT );
  joinTypeLabel.setText( BaseMessages.getString( PKG, "MultiMergeJoinDialog.Type.Label" ) );
  props.setLook( joinTypeLabel );
  FormData fdlType = new FormData();
  fdlType.left = new FormAttachment( 0, 0 );
  fdlType.right = new FormAttachment( 15, -margin );
  if ( wInputTransformArray.length > 0 ) {
    fdlType.top = new FormAttachment( wInputTransformArray[ wInputTransformArray.length - 1 ], margin );
  } else {
    fdlType.top = new FormAttachment( wTransformName, margin );
  }
  joinTypeLabel.setLayoutData( fdlType );
  joinTypeCombo = new CCombo( shell, SWT.BORDER );
  props.setLook( joinTypeCombo );

  joinTypeCombo.setItems( MultiMergeJoinMeta.join_types );

  joinTypeCombo.addModifyListener( lsMod );
  FormData fdType = new FormData();
  if ( wInputTransformArray.length > 0 ) {
    fdType.top = new FormAttachment( wInputTransformArray[ wInputTransformArray.length - 1 ], margin );
  } else {
    fdType.top = new FormAttachment( wTransformName, margin );
  }
  fdType.left = new FormAttachment( 15, 0 );
  fdType.right = new FormAttachment( 35, 0 );
  joinTypeCombo.setLayoutData( fdType );
}
 
Example #20
Source Project: hop   Author: project-hop   File: NumberRangeDialog.java    License: Apache License 2.0 5 votes vote down vote up
private CCombo createLineCombo( ModifyListener lsMod, String lableText, Control prevControl ) {
  // Value line
  Label lable = new Label( shell, SWT.RIGHT );
  lable.setText( lableText );
  props.setLook( lable );
  FormData lableFormData = new FormData();
  lableFormData.left = new FormAttachment( 0, 0 );
  lableFormData.right = new FormAttachment( props.getMiddlePct(), -props.getMargin() );
  // In case it is the first control
  if ( prevControl != null ) {
    lableFormData.top = new FormAttachment( prevControl, props.getMargin() );
  } else {
    lableFormData.top = new FormAttachment( 0, props.getMargin() );
  }
  lable.setLayoutData( lableFormData );

  CCombo control = new CCombo( shell, SWT.BORDER );
  props.setLook( control );
  control.addModifyListener( lsMod );
  FormData widgetFormData = new FormData();
  widgetFormData.left = new FormAttachment( props.getMiddlePct(), 0 );
  // In case it is the first control
  if ( prevControl != null ) {
    widgetFormData.top = new FormAttachment( prevControl, props.getMargin() );
  } else {
    widgetFormData.top = new FormAttachment( 0, props.getMargin() );
  }
  widgetFormData.right = new FormAttachment( 100, 0 );
  control.setLayoutData( widgetFormData );

  return control;
}
 
Example #21
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 #22
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 #23
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 #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: 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 #26
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 #27
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 #28
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 #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: BrowserEnvironmentWarningDialog.java    License: Apache License 2.0 5 votes vote down vote up
private void setHelpLink( Display display, String helpLink, int maxTextWidth, EnvironmentCase environment ) {
  link = new Link( shell, SWT.SINGLE | SWT.WRAP );
  link.setText( helpLink );
  if ( environment == EnvironmentCase.MAC_OS_X || environment == EnvironmentCase.MAC_OS_X_THIN ) {
    FontData[] fD = link.getFont().getFontData();
    fD[ 0 ].setHeight( 13 );
    link.setFont( new Font( display, fD[ 0 ] ) );
  }
  FormData fdlink = new FormData();
  fdlink.left = new FormAttachment( warningIcon, margin ); // Link should be below description right of icon
  fdlink.top = new FormAttachment( description, margin );
  fdlink.width = maxTextWidth;
  link.setLayoutData( fdlink );
  props.setLook( link );

  link.addListener( SWT.Selection, new Listener() {
    public void handleEvent( Event event ) {
      if ( Desktop.isDesktopSupported() ) {
        try {
          Desktop.getDesktop().browse( new URI( Const.getDocUrl( URI_PATH ) ) );
        } catch ( Exception e ) {
          log.logError( "Error opening external browser", e );
        }
      }
    }
  } );
}