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 File: RadioTab.java    From hop with 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 File: TeraFastDialog.java    From hop with 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 #3
Source File: ConfigurationDialog.java    From hop with 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 #4
Source File: ActionCopyFilesDialog.java    From hop with 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 #5
Source File: BaseTransformDialog.java    From hop with 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 File: HopGuiWorkflowGraph.java    From hop with 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 #7
Source File: BaseTransformDialog.java    From hop with 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 #8
Source File: HopGuiPipelineGraph.java    From hop with 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 #9
Source File: FormInput.java    From hop with 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 #10
Source File: TeraFastDialog.java    From hop with 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 #11
Source File: TeraFastDialog.java    From hop with 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 #12
Source File: HopGui.java    From hop with 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 #13
Source File: HopGuiPipelineGridDelegate.java    From hop with 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 #14
Source File: PipelineExecutionConfigurationDialog.java    From hop with 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 #15
Source File: MultiMergeJoinDialog.java    From hop with 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 #16
Source File: NumberRangeDialog.java    From hop with 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 #17
Source File: WorkflowExecutionConfigurationDialog.java    From hop with 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 #18
Source File: ActionSpecialDialog.java    From hop with 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 #19
Source File: LabelComboVar.java    From hop with Apache License 2.0 5 votes vote down vote up
public LabelComboVar( IVariables variables, Composite composite, int flags, String labelText, String toolTipText ) {
  super( composite, SWT.NONE );
  props.setLook( this );

  int middle = props.getMiddlePct();
  int margin = props.getMargin();

  FormLayout formLayout = new FormLayout();
  formLayout.marginWidth = 0;
  formLayout.marginHeight = 0;
  formLayout.marginTop = 0;
  formLayout.marginBottom = 0;

  this.setLayout( formLayout );

  int textFlags = SWT.SINGLE | SWT.LEFT | SWT.BORDER;
  if ( flags != SWT.NONE ) {
    textFlags = flags;
  }

  wCombo = new ComboVar( variables, this, textFlags, toolTipText );
  FormData fdText = new FormData();
  fdText.left = new FormAttachment( middle, margin );
  fdText.right = new FormAttachment( 100, 0 );
  wCombo.setLayoutData( fdText );
  wCombo.getCComboWidget().setToolTipText( toolTipText );

  wLabel = new Label( this, SWT.RIGHT );
  props.setLook( wLabel );
  wLabel.setText( labelText );
  FormData fdLabel = new FormData();
  fdLabel.left = new FormAttachment( 0, 0 );
  fdLabel.right = new FormAttachment( middle, 0 );
  fdLabel.top = new FormAttachment( wCombo, 0, SWT.CENTER );
  wLabel.setLayoutData( fdLabel );
  wLabel.setToolTipText( toolTipText );
}
 
Example #20
Source File: HelpUtils.java    From hop with 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 #21
Source File: BrowserEnvironmentWarningDialog.java    From hop with 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 #22
Source File: BrowserEnvironmentWarningDialog.java    From hop with 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 );
        }
      }
    }
  } );
}
 
Example #23
Source File: TextFileImportWizardPage1.java    From hop with 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 );
}
 
Example #24
Source File: TextFileImportWizardPage1.java    From hop with 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 );
}
 
Example #25
Source File: WidgetUtils.java    From hop with Apache License 2.0 5 votes vote down vote up
/**
 * Creates a FormData object specifying placement below anchorControl, with pixelsBetweeenAnchor space between
 * anchor and the control.
 */
public static FormData formDataBelow( Control anchorControl, int width, int pixelsBetweenAnchor ) {
  FormData fdMessageField = new FormData();
  fdMessageField.left = new FormAttachment( 0, 0 );
  fdMessageField.top = new FormAttachment( anchorControl, pixelsBetweenAnchor );
  fdMessageField.right = new FormAttachment( 0, width );
  return fdMessageField;
}
 
Example #26
Source File: RadioTab.java    From hop with Apache License 2.0 5 votes vote down vote up
public RadioTab( Composite composite, int i, String title, PropsUi props ) {
  super( composite, i );
  this.props = props;
  props.setLook( this );
  noMarginLayout = new FormLayout();
  this.setLayout( noMarginLayout );

  fdMaximize = new FormData();
  fdMaximize.left = new FormAttachment( 0 );
  fdMaximize.top = new FormAttachment( 0 );
  fdMaximize.right = new FormAttachment( 100 );
  fdMaximize.bottom = new FormAttachment( 100 );
  this.setLayoutData( fdMaximize );

  FormLayout marginLayout = new FormLayout();
  marginLayout.marginWidth = 15;
  marginLayout.marginHeight = 15;

  radioGroup = new Group( this, i );
  radioGroup.setLayout( marginLayout );
  radioGroup.setText( title );
  FormData fdRadioGroup = new FormData();
  fdRadioGroup.top = new FormAttachment( 0 );
  fdRadioGroup.left = new FormAttachment( 0 );
  fdRadioGroup.right = new FormAttachment( 100 );
  radioGroup.setLayoutData( fdRadioGroup );
  props.setLook( radioGroup );

  contentArea = new Composite( this, i );
  contentArea.setLayout( noMarginLayout );
  FormData fdContentArea = new FormData();
  fdContentArea.left = new FormAttachment( 0 );
  fdContentArea.top = new FormAttachment( radioGroup, 15 );
  fdContentArea.bottom = new FormAttachment( 100 );
  fdContentArea.right = new FormAttachment( 100 );
  contentArea.setLayoutData( fdContentArea );
  props.setLook( contentArea );
}
 
Example #27
Source File: PluginWidgetFactory.java    From hop with Apache License 2.0 5 votes vote down vote up
/**
 * Convenience method to create FormData for Controls beside a label.
 *
 * @param topControl the control which is above the current label, or null if none above.
 * @return layoutData.
 */
public FormData createControlLayoutData( final Control topControl ) {
  FormData formData = new FormData();

  formData.left = new FormAttachment( this.middle, 0 );
  if ( topControl != null ) {
    formData.top = new FormAttachment( topControl, this.margin );
  } else {
    formData.top = new FormAttachment( 0, this.margin );
  }
  formData.right = new FormAttachment( this.rightOffset, 0 );

  return formData;
}
 
Example #28
Source File: LabelText.java    From hop with Apache License 2.0 5 votes vote down vote up
public LabelText( Composite composite, int textStyle, String labelText, String toolTipText, int middle,
                  int margin ) {
  super( composite, SWT.NONE );
  props.setLook( this );

  FormLayout formLayout = new FormLayout();
  formLayout.marginWidth = 0;
  formLayout.marginHeight = 0;
  this.setLayout( formLayout );

  wText = new Text( this, textStyle );
  FormData fdText = new FormData();
  fdText.left = new FormAttachment( middle, margin );
  fdText.right = new FormAttachment( 100, 0 );
  wText.setLayoutData( fdText );
  wText.setToolTipText( toolTipText );

  wLabel = new Label( this, SWT.RIGHT );
  props.setLook( wLabel );
  wLabel.setText( labelText );
  FormData fdLabel = new FormData();
  fdLabel.left = new FormAttachment( 0, 0 );
  fdLabel.right = new FormAttachment( middle, 0 );
  fdLabel.top = new FormAttachment( wText, 0, SWT.CENTER );
  wLabel.setLayoutData( fdLabel );
  wLabel.setToolTipText( toolTipText );
}
 
Example #29
Source File: LabelCombo.java    From hop with Apache License 2.0 5 votes vote down vote up
public LabelCombo( Composite composite, int flags, String labelText, String toolTipText ) {
  super( composite, SWT.NONE );
  props.setLook( this );

  int middle = props.getMiddlePct();
  int margin = props.getMargin();

  FormLayout formLayout = new FormLayout();
  formLayout.marginWidth = 0;
  formLayout.marginHeight = 0;
  formLayout.marginTop = 0;
  formLayout.marginBottom = 0;

  this.setLayout( formLayout );

  int textFlags = SWT.SINGLE | SWT.LEFT | SWT.BORDER;
  if ( flags != SWT.NONE ) {
    textFlags = flags;
  }

  wCombo = new CCombo( this, textFlags );
  FormData fdText = new FormData();
  fdText.left = new FormAttachment( middle, margin );
  fdText.right = new FormAttachment( 100, 0 );
  wCombo.setLayoutData( fdText );
  wCombo.setToolTipText( toolTipText );

  wLabel = new Label( this, SWT.RIGHT );
  props.setLook( wLabel );
  wLabel.setText( labelText );
  FormData fdLabel = new FormData();
  fdLabel.left = new FormAttachment( 0, 0 );
  fdLabel.right = new FormAttachment( middle, 0 );
  fdLabel.top = new FormAttachment( wCombo, 0, SWT.CENTER );
  wLabel.setLayoutData( fdLabel );
  wLabel.setToolTipText( toolTipText );
}
 
Example #30
Source File: HopGui.java    From hop with 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();
}