Java Code Examples for org.eclipse.swt.custom.CTabItem#setToolTipText()

The following examples show how to use org.eclipse.swt.custom.CTabItem#setToolTipText() . 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: SimpleMappingDialog.java    From hop with Apache License 2.0 6 votes vote down vote up
private void setMappingDefinitionTabNameAndToolTip( CTabItem wTab, String tabTitle, String tabTooltip,
                                                    MappingIODefinition definition, boolean input ) {

  String transformName;
  if ( input ) {
    transformName = definition.getInputTransformName();
  } else {
    transformName = definition.getOutputTransformName();
  }
  String description = definition.getDescription();

  if ( Utils.isEmpty( transformName ) ) {
    wTab.setText( tabTitle );
  } else {
    wTab.setText( tabTitle + " : " + transformName );
  }
  String tooltip = tabTooltip;
  if ( !Utils.isEmpty( transformName ) ) {
    tooltip += Const.CR + Const.CR + transformName;
  }
  if ( !Utils.isEmpty( description ) ) {
    tooltip += Const.CR + Const.CR + description;
  }
  wTab.setToolTipText( tooltip );
}
 
Example 2
Source File: TabFolderReorder.java    From hop with Apache License 2.0 5 votes vote down vote up
private void moveTabs( CTabFolder folder, DropTargetEvent event ) {
  Point point = folder.toControl( folder.getDisplay().getCursorLocation() );
  CTabItem item = folder.getItem( new Point( point.x, point.y ) );
  if ( item != null && dragItem != null ) {
    Control dragControl = dragItem.getControl();
    String dragText = dragItem.getText();
    Image dragImage = dragItem.getImage();
    String dragToolTip = dragItem.getToolTipText();
    boolean dragShowClose = dragItem.getShowClose();
    Object dragData = dragItem.getData();

    dragItem.setText( item.getText() );
    dragItem.setImage( item.getImage() );
    dragItem.setToolTipText( item.getToolTipText() );
    dragItem.setData( item.getData() );
    dragItem.setShowClose( item.getShowClose() );
    dragItem.setControl( item.getControl() );

    item.setText( dragText );
    item.setImage( dragImage );
    item.setToolTipText( dragToolTip );
    item.setData( dragData );
    item.setShowClose( dragShowClose );
    item.setControl( dragControl );

    folder.setSelection( item );
  }
}
 
Example 3
Source File: MappingDialog.java    From hop with Apache License 2.0 4 votes vote down vote up
private void addParametersTab( final MappingParameters parameters ) {

    CTabItem wParametersTab = new CTabItem( wTabFolder, SWT.NONE );
    wParametersTab.setText( BaseMessages.getString( PKG, "MappingDialog.Parameters.Title" ) );
    wParametersTab.setToolTipText( BaseMessages.getString( PKG, "MappingDialog.Parameters.Tooltip" ) );

    Composite wParametersComposite = new Composite( wTabFolder, SWT.NONE );
    props.setLook( wParametersComposite );

    FormLayout parameterTabLayout = new FormLayout();
    parameterTabLayout.marginWidth = 15;
    parameterTabLayout.marginHeight = 15;
    wParametersComposite.setLayout( parameterTabLayout );

    // Add a checkbox: inherit all variables...
    //
    Button wInheritAll = new Button( wParametersComposite, SWT.CHECK );
    wInheritAll.setText( BaseMessages.getString( PKG, "MappingDialog.Parameters.InheritAll" ) );
    props.setLook( wInheritAll );
    FormData fdInheritAll = new FormData();
    fdInheritAll.bottom = new FormAttachment( 100, 0 );
    fdInheritAll.left = new FormAttachment( 0, 0 );
    fdInheritAll.right = new FormAttachment( 100, -30 );
    wInheritAll.setLayoutData( fdInheritAll );
    wInheritAll.setSelection( parameters.isInheritingAllVariables() );

    // Now add a tableview with the 2 columns to specify: input and output
    // fields for the source and target transforms.
    //
    ColumnInfo[] colinfo =
      new ColumnInfo[] {
        new ColumnInfo(
          BaseMessages.getString( PKG, "MappingDialog.Parameters.column.Variable" ),
          ColumnInfo.COLUMN_TYPE_TEXT, false, false ),
        new ColumnInfo(
          BaseMessages.getString( PKG, "MappingDialog.Parameters.column.ValueOrField" ),
          ColumnInfo.COLUMN_TYPE_TEXT, false, false ), };
    colinfo[ 1 ].setUsingVariables( true );

    final TableView wMappingParameters =
      new TableView(
        pipelineMeta, wParametersComposite, SWT.FULL_SELECTION | SWT.SINGLE | SWT.BORDER, colinfo, parameters
        .getVariable().length, lsMod, props
      );
    props.setLook( wMappingParameters );
    FormData fdMappings = new FormData();
    fdMappings.left = new FormAttachment( 0, 0 );
    fdMappings.right = new FormAttachment( 100, 0 );
    fdMappings.top = new FormAttachment( 0, 0 );
    fdMappings.bottom = new FormAttachment( wInheritAll, -10 );
    wMappingParameters.setLayoutData( fdMappings );
    wMappingParameters.getTable().addListener( SWT.Resize, new ColumnsResizer( 0, 50, 50 ) );

    for ( int i = 0; i < parameters.getVariable().length; i++ ) {
      TableItem tableItem = wMappingParameters.table.getItem( i );
      tableItem.setText( 1, Const.NVL( parameters.getVariable()[ i ], "" ) );
      tableItem.setText( 2, Const.NVL( parameters.getInputField()[ i ], "" ) );
    }
    wMappingParameters.setRowNums();
    wMappingParameters.optWidth( true );

    FormData fdParametersComposite = new FormData();
    fdParametersComposite.left = new FormAttachment( 0, 0 );
    fdParametersComposite.top = new FormAttachment( 0, 0 );
    fdParametersComposite.right = new FormAttachment( 100, 0 );
    fdParametersComposite.bottom = new FormAttachment( 100, 0 );
    wParametersComposite.setLayoutData( fdParametersComposite );

    wParametersComposite.layout();
    wParametersTab.setControl( wParametersComposite );

    parameterChanges = new MappingParametersTab( wMappingParameters, wInheritAll, parameters );
  }
 
Example 4
Source File: UserDefinedJavaClassDialog.java    From pentaho-kettle with Apache License 2.0 4 votes vote down vote up
private void addTargetTab() {
  targetTab = new CTabItem( wTabFolder, SWT.NONE );
  targetTab.setText( BaseMessages.getString( PKG, "UserDefinedJavaClassDialog.Tabs.Target.Title" ) );
  targetTab.setToolTipText( BaseMessages.getString( PKG, "UserDefinedJavaClassDialog.Tabs.Target.TooltipText" ) );

  Composite wBottom = new Composite( wTabFolder, SWT.NONE );
  props.setLook( wBottom );
  targetTab.setControl( wBottom );
  FormLayout bottomLayout = new FormLayout();
  bottomLayout.marginWidth = Const.FORM_MARGIN;
  bottomLayout.marginHeight = Const.FORM_MARGIN;
  wBottom.setLayout( bottomLayout );

  Label wlFields = new Label( wBottom, SWT.NONE );
  wlFields.setText( BaseMessages.getString( PKG, "UserDefinedJavaClassDialog.TargetSteps.Label" ) );
  props.setLook( wlFields );
  FormData fdlFields = new FormData();
  fdlFields.left = new FormAttachment( 0, 0 );
  fdlFields.top = new FormAttachment( 0, 0 );
  wlFields.setLayoutData( fdlFields );

  final int nrRows = input.getTargetStepDefinitions().size();
  ColumnInfo[] colinf =
    new ColumnInfo[] {
      new ColumnInfo(
        BaseMessages.getString( PKG, "UserDefinedJavaClassDialog.ColumnInfo.StepTag" ),
        ColumnInfo.COLUMN_TYPE_TEXT, false ),
      new ColumnInfo(
        BaseMessages.getString( PKG, "UserDefinedJavaClassDialog.ColumnInfo.StepName" ),
        ColumnInfo.COLUMN_TYPE_CCOMBO, nextStepNames ),
      new ColumnInfo(
        BaseMessages.getString( PKG, "UserDefinedJavaClassDialog.ColumnInfo.StepDescription" ),
        ColumnInfo.COLUMN_TYPE_TEXT, false ), };

  wTargetSteps =
    new TableView(
      transMeta, wBottom, SWT.BORDER | SWT.FULL_SELECTION | SWT.MULTI, colinf, nrRows, lsMod, props );

  FormData fdFields = new FormData();
  fdFields.left = new FormAttachment( 0, 0 );
  fdFields.top = new FormAttachment( wlFields, margin );
  fdFields.right = new FormAttachment( 100, 0 );
  fdFields.bottom = new FormAttachment( 100, 0 );
  wTargetSteps.setLayoutData( fdFields );

  FormData fdBottom = new FormData();
  fdBottom.left = new FormAttachment( 0, 0 );
  fdBottom.top = new FormAttachment( 0, 0 );
  fdBottom.right = new FormAttachment( 100, 0 );
  fdBottom.bottom = new FormAttachment( 100, 0 );
  wBottom.setLayoutData( fdBottom );
}
 
Example 5
Source File: TransExecutorDialog.java    From pentaho-kettle with Apache License 2.0 4 votes vote down vote up
private void addParametersTab() {
  CTabItem wParametersTab = new CTabItem( wTabFolder, SWT.NONE );
  wParametersTab.setText( BaseMessages.getString( PKG, "TransExecutorDialog.Parameters.Title" ) );
  wParametersTab.setToolTipText( BaseMessages.getString( PKG, "TransExecutorDialog.Parameters.Tooltip" ) );

  Composite wParametersComposite = new Composite( wTabFolder, SWT.NONE );
  props.setLook( wParametersComposite );

  FormLayout parameterTabLayout = new FormLayout();
  parameterTabLayout.marginWidth = 15;
  parameterTabLayout.marginHeight = 15;
  wParametersComposite.setLayout( parameterTabLayout );

  // Add a button: get parameters
  //
  wGetParameters = new Button( wParametersComposite, SWT.PUSH );
  wGetParameters.setText( BaseMessages.getString( PKG, "TransExecutorDialog.Parameters.GetParameters" ) );
  props.setLook( wGetParameters );
  FormData fdGetParameters = new FormData();
  fdGetParameters.bottom = new FormAttachment( 100, 0 );
  fdGetParameters.right = new FormAttachment( 100, 0 );
  wGetParameters.setLayoutData( fdGetParameters );
  wGetParameters.setSelection( transExecutorMeta.getParameters().isInheritingAllVariables() );
  wGetParameters.addSelectionListener( new SelectionAdapter() {
    public void widgetSelected( SelectionEvent e ) {
      getParametersFromTrans( null ); // null = force reload of data on disk
    }
  } );

  // Now add a table view with the 3 columns to specify: variable name, input field & optional static input
  //
  parameterColumns =
    new ColumnInfo[] {
      new ColumnInfo( BaseMessages.getString( PKG, "TransExecutorDialog.Parameters.column.Variable" ),
        ColumnInfo.COLUMN_TYPE_TEXT, false, false ),
      new ColumnInfo( BaseMessages.getString( PKG, "TransExecutorDialog.Parameters.column.Field" ),
        ColumnInfo.COLUMN_TYPE_CCOMBO, new String[] {}, false ),
      new ColumnInfo( BaseMessages.getString( PKG, "TransExecutorDialog.Parameters.column.Input" ),
        ColumnInfo.COLUMN_TYPE_TEXT, false, false ), };
  parameterColumns[ 1 ].setUsingVariables( true );

  TransExecutorParameters parameters = transExecutorMeta.getParameters();
  wTransExecutorParameters =
    new TableView( transMeta, wParametersComposite, SWT.FULL_SELECTION | SWT.SINGLE | SWT.BORDER, parameterColumns,
      parameters.getVariable().length, false, lsModParams, props, false );
  props.setLook( wTransExecutorParameters );
  FormData fdTransExecutors = new FormData();
  fdTransExecutors.left = new FormAttachment( 0, 0 );
  fdTransExecutors.right = new FormAttachment( 100, 0 );
  fdTransExecutors.top = new FormAttachment( 0, 0 );
  fdTransExecutors.bottom = new FormAttachment( wGetParameters, -10 );
  wTransExecutorParameters.setLayoutData( fdTransExecutors );
  wTransExecutorParameters.getTable().addListener( SWT.Resize, new ColumnsResizer( 0, 33, 33, 33 ) );

  parameterTableHelper.setParameterTableView( wTransExecutorParameters );
  parameterTableHelper.setUpDisabledListeners();
  // Add disabled listeners to columns
  parameterColumns[0].setDisabledListener( parameterTableHelper.getVarDisabledListener() );
  parameterColumns[1].setDisabledListener( parameterTableHelper.getFieldDisabledListener() );
  parameterColumns[2].setDisabledListener( parameterTableHelper.getInputDisabledListener() );

  for ( int i = 0; i < parameters.getVariable().length; i++ ) {
    TableItem tableItem = wTransExecutorParameters.table.getItem( i );
    tableItem.setText( 1, Const.NVL( parameters.getVariable()[ i ], "" ) );
    tableItem.setText( 2, Const.NVL( parameters.getField()[ i ], "" ) );
    tableItem.setText( 3, Const.NVL( parameters.getInput()[ i ], "" ) );
    // Check disable listeners to shade fields gray
    parameterTableHelper.checkTableOnOpen( tableItem, i );
  }
  wTransExecutorParameters.setRowNums();
  wTransExecutorParameters.optWidth( true );

  // Add a checkbox: inherit all variables...
  //
  wInheritAll = new Button( wParametersComposite, SWT.CHECK );
  wInheritAll.setText( BaseMessages.getString( PKG, "TransExecutorDialog.Parameters.InheritAll" ) );
  props.setLook( wInheritAll );
  FormData fdInheritAll = new FormData();
  fdInheritAll.top = new FormAttachment( wTransExecutorParameters, 15 );
  fdInheritAll.left = new FormAttachment( 0, 0 );
  wInheritAll.setLayoutData( fdInheritAll );
  wInheritAll.setSelection( transExecutorMeta.getParameters().isInheritingAllVariables() );

  FormData fdParametersComposite = new FormData();
  fdParametersComposite.left = new FormAttachment( 0, 0 );
  fdParametersComposite.top = new FormAttachment( 0, 0 );
  fdParametersComposite.right = new FormAttachment( 100, 0 );
  fdParametersComposite.bottom = new FormAttachment( 100, 0 );
  wParametersComposite.setLayoutData( fdParametersComposite );

  wParametersComposite.layout();
  wParametersTab.setControl( wParametersComposite );
}
 
Example 6
Source File: UserDefinedJavaClassDialog.java    From pentaho-kettle with Apache License 2.0 4 votes vote down vote up
private void addInfoTab() {
  infoTab = new CTabItem( wTabFolder, SWT.NONE );
  infoTab.setText( BaseMessages.getString( PKG, "UserDefinedJavaClassDialog.Tabs.Info.Title" ) );
  infoTab.setToolTipText( BaseMessages.getString( PKG, "UserDefinedJavaClassDialog.Tabs.Info.TooltipText" ) );

  Composite wBottom = new Composite( wTabFolder, SWT.NONE );
  props.setLook( wBottom );
  infoTab.setControl( wBottom );
  FormLayout bottomLayout = new FormLayout();
  bottomLayout.marginWidth = Const.FORM_MARGIN;
  bottomLayout.marginHeight = Const.FORM_MARGIN;
  wBottom.setLayout( bottomLayout );

  Label wlFields = new Label( wBottom, SWT.NONE );
  wlFields.setText( BaseMessages.getString( PKG, "UserDefinedJavaClassDialog.InfoSteps.Label" ) );
  props.setLook( wlFields );
  FormData fdlFields = new FormData();
  fdlFields.left = new FormAttachment( 0, 0 );
  fdlFields.top = new FormAttachment( 0, 0 );
  wlFields.setLayoutData( fdlFields );

  final int nrRows = input.getInfoStepDefinitions().size();
  ColumnInfo[] colinf =
    new ColumnInfo[] {
      new ColumnInfo(
        BaseMessages.getString( PKG, "UserDefinedJavaClassDialog.ColumnInfo.StepTag" ),
        ColumnInfo.COLUMN_TYPE_TEXT, false ),
      new ColumnInfo(
        BaseMessages.getString( PKG, "UserDefinedJavaClassDialog.ColumnInfo.StepName" ),
        ColumnInfo.COLUMN_TYPE_CCOMBO, prevStepNames ),
      new ColumnInfo(
        BaseMessages.getString( PKG, "UserDefinedJavaClassDialog.ColumnInfo.StepDescription" ),
        ColumnInfo.COLUMN_TYPE_TEXT, false ), };

  wInfoSteps =
    new TableView(
      transMeta, wBottom, SWT.BORDER | SWT.FULL_SELECTION | SWT.MULTI, colinf, nrRows, lsMod, props );

  FormData fdFields = new FormData();
  fdFields.left = new FormAttachment( 0, 0 );
  fdFields.top = new FormAttachment( wlFields, margin );
  fdFields.right = new FormAttachment( 100, 0 );
  fdFields.bottom = new FormAttachment( 100, 0 );
  wInfoSteps.setLayoutData( fdFields );

  FormData fdBottom = new FormData();
  fdBottom.left = new FormAttachment( 0, 0 );
  fdBottom.top = new FormAttachment( 0, 0 );
  fdBottom.right = new FormAttachment( 100, 0 );
  fdBottom.bottom = new FormAttachment( 100, 0 );
  wBottom.setLayoutData( fdBottom );
}
 
Example 7
Source File: SimpleMappingDialog.java    From hop with Apache License 2.0 4 votes vote down vote up
private void addParametersTab( final MappingParameters parameters ) {

    CTabItem wParametersTab = new CTabItem( wTabFolder, SWT.NONE );
    wParametersTab.setText( BaseMessages.getString( PKG, "SimpleMappingDialog.Parameters.Title" ) );
    wParametersTab.setToolTipText( BaseMessages.getString( PKG, "SimpleMappingDialog.Parameters.Tooltip" ) );

    Composite wParametersComposite = new Composite( wTabFolder, SWT.NONE );
    props.setLook( wParametersComposite );

    FormLayout parameterTabLayout = new FormLayout();
    parameterTabLayout.marginWidth = 15;
    parameterTabLayout.marginHeight = 15;
    wParametersComposite.setLayout( parameterTabLayout );

    // Add a checkbox: inherit all variables...
    //
    Button wInheritAll = new Button( wParametersComposite, SWT.CHECK );
    wInheritAll.setText( BaseMessages.getString( PKG, "SimpleMappingDialog.Parameters.InheritAll" ) );
    props.setLook( wInheritAll );
    FormData fdInheritAll = new FormData();
    fdInheritAll.bottom = new FormAttachment( 100, 0 );
    fdInheritAll.left = new FormAttachment( 0, 0 );
    fdInheritAll.right = new FormAttachment( 100, -30 );
    wInheritAll.setLayoutData( fdInheritAll );
    wInheritAll.setSelection( parameters.isInheritingAllVariables() );

    // Now add a tableview with the 2 columns to specify: input and output
    // fields for the source and target transforms.
    //
    ColumnInfo[] colinfo =
      new ColumnInfo[] {
        new ColumnInfo(
          BaseMessages.getString( PKG, "SimpleMappingDialog.Parameters.column.Variable" ),
          ColumnInfo.COLUMN_TYPE_TEXT, false, false ),
        new ColumnInfo(
          BaseMessages.getString( PKG, "SimpleMappingDialog.Parameters.column.ValueOrField" ),
          ColumnInfo.COLUMN_TYPE_TEXT, false, false ), };
    colinfo[ 1 ].setUsingVariables( true );

    final TableView wMappingParameters =
      new TableView(
        pipelineMeta, wParametersComposite, SWT.FULL_SELECTION | SWT.SINGLE | SWT.BORDER, colinfo, parameters
        .getVariable().length, false, lsMod, props, false
      );
    props.setLook( wMappingParameters );
    FormData fdMappings = new FormData();
    fdMappings.left = new FormAttachment( 0, 0 );
    fdMappings.right = new FormAttachment( 100, 0 );
    fdMappings.top = new FormAttachment( 0, 0 );
    fdMappings.bottom = new FormAttachment( wInheritAll, -10 );
    wMappingParameters.setLayoutData( fdMappings );
    wMappingParameters.getTable().addListener( SWT.Resize, new ColumnsResizer( 0, 50, 50 ) );

    for ( int i = 0; i < parameters.getVariable().length; i++ ) {
      TableItem tableItem = wMappingParameters.table.getItem( i );
      tableItem.setText( 1, parameters.getVariable()[ i ] );
      tableItem.setText( 2, parameters.getInputField()[ i ] );
    }
    wMappingParameters.setRowNums();
    wMappingParameters.optWidth( true );

    FormData fdParametersComposite = new FormData();
    fdParametersComposite.left = new FormAttachment( 0, 0 );
    fdParametersComposite.top = new FormAttachment( 0, 0 );
    fdParametersComposite.right = new FormAttachment( 100, 0 );
    fdParametersComposite.bottom = new FormAttachment( 100, 0 );
    wParametersComposite.setLayoutData( fdParametersComposite );

    wParametersComposite.layout();
    wParametersTab.setControl( wParametersComposite );

    changeList.add( new MappingParametersTab( wMappingParameters, wInheritAll, parameters ) );
  }
 
Example 8
Source File: JobExecutorDialog.java    From pentaho-kettle with Apache License 2.0 4 votes vote down vote up
private void addRowGroupTab() {

    final CTabItem wTab = new CTabItem( wTabFolder, SWT.NONE );
    wTab.setText( BaseMessages.getString( PKG, "JobExecutorDialog.RowGroup.Title" ) );
    wTab.setToolTipText( BaseMessages.getString( PKG, "JobExecutorDialog.RowGroup.Tooltip" ) );

    Composite wInputComposite = new Composite( wTabFolder, SWT.NONE );
    props.setLook( wInputComposite );

    FormLayout tabLayout = new FormLayout();
    tabLayout.marginWidth = 15;
    tabLayout.marginHeight = 15;
    wInputComposite.setLayout( tabLayout );

    // Group size
    //
    wlGroupSize = new Label( wInputComposite, SWT.RIGHT );
    props.setLook( wlGroupSize );
    wlGroupSize.setText( BaseMessages.getString( PKG, "JobExecutorDialog.GroupSize.Label" ) );
    FormData fdlGroupSize = new FormData();
    fdlGroupSize.top = new FormAttachment( 0, 0 );
    fdlGroupSize.left = new FormAttachment( 0, 0 );
    wlGroupSize.setLayoutData( fdlGroupSize );

    wGroupSize = new TextVar( transMeta, wInputComposite, SWT.SINGLE | SWT.LEFT | SWT.BORDER );
    props.setLook( wGroupSize );
    wGroupSize.addModifyListener( lsMod );
    FormData fdGroupSize = new FormData();
    fdGroupSize.width = 250;
    fdGroupSize.top = new FormAttachment( wlGroupSize, 5 );
    fdGroupSize.left = new FormAttachment( 0, 0 );
    wGroupSize.setLayoutData( fdGroupSize );

    // Group field
    //
    wlGroupField = new Label( wInputComposite, SWT.RIGHT );
    props.setLook( wlGroupField );
    wlGroupField.setText( BaseMessages.getString( PKG, "JobExecutorDialog.GroupField.Label" ) );
    FormData fdlGroupField = new FormData();
    fdlGroupField.top = new FormAttachment( wGroupSize, 10 );
    fdlGroupField.left = new FormAttachment( 0, 0 );
    wlGroupField.setLayoutData( fdlGroupField );

    wGroupField = new CCombo( wInputComposite, SWT.SINGLE | SWT.LEFT | SWT.BORDER );
    props.setLook( wGroupField );
    wGroupField.addModifyListener( lsMod );
    FormData fdGroupField = new FormData();
    fdGroupField.width = 250;
    fdGroupField.top = new FormAttachment( wlGroupField, 5 );
    fdGroupField.left = new FormAttachment( 0, 0 );
    wGroupField.setLayoutData( fdGroupField );

    // Group time
    //
    wlGroupTime = new Label( wInputComposite, SWT.RIGHT );
    props.setLook( wlGroupTime );
    wlGroupTime.setText( BaseMessages.getString( PKG, "JobExecutorDialog.GroupTime.Label" ) );
    FormData fdlGroupTime = new FormData();
    fdlGroupTime.top = new FormAttachment( wGroupField, 10 );
    fdlGroupTime.left = new FormAttachment( 0, 0 ); // First one in the left
    wlGroupTime.setLayoutData( fdlGroupTime );

    wGroupTime = new TextVar( transMeta, wInputComposite, SWT.SINGLE | SWT.LEFT | SWT.BORDER );
    props.setLook( wGroupTime );
    wGroupTime.addModifyListener( lsMod );
    FormData fdGroupTime = new FormData();
    fdGroupTime.width = 250;
    fdGroupTime.top = new FormAttachment( wlGroupTime, 5 );
    fdGroupTime.left = new FormAttachment( 0, 0 );
    wGroupTime.setLayoutData( fdGroupTime );

    wTab.setControl( wInputComposite );
    wTabFolder.setSelection( wTab );
  }
 
Example 9
Source File: UserDefinedJavaClassDialog.java    From pentaho-kettle with Apache License 2.0 4 votes vote down vote up
private void addParametersTab() {
  parametersTab = new CTabItem( wTabFolder, SWT.NONE );
  parametersTab.setText( BaseMessages.getString( PKG, "UserDefinedJavaClassDialog.Tabs.Parameters.Title" ) );
  parametersTab.setToolTipText( BaseMessages.getString(
    PKG, "UserDefinedJavaClassDialog.Tabs.Parameters.TooltipText" ) );

  Composite wBottom = new Composite( wTabFolder, SWT.NONE );
  props.setLook( wBottom );
  parametersTab.setControl( wBottom );
  FormLayout bottomLayout = new FormLayout();
  bottomLayout.marginWidth = Const.FORM_MARGIN;
  bottomLayout.marginHeight = Const.FORM_MARGIN;
  wBottom.setLayout( bottomLayout );

  Label wlFields = new Label( wBottom, SWT.NONE );
  wlFields.setText( BaseMessages.getString( PKG, "UserDefinedJavaClassDialog.Parameters.Label" ) );
  props.setLook( wlFields );
  FormData fdlFields = new FormData();
  fdlFields.left = new FormAttachment( 0, 0 );
  fdlFields.top = new FormAttachment( 0, 0 );
  wlFields.setLayoutData( fdlFields );

  final int nrRows = input.getUsageParameters().size();
  ColumnInfo[] colinf =
    new ColumnInfo[] {
      new ColumnInfo(
        BaseMessages.getString( PKG, "UserDefinedJavaClassDialog.ColumnInfo.ParameterTag" ),
        ColumnInfo.COLUMN_TYPE_TEXT, false ),
      new ColumnInfo(
        BaseMessages.getString( PKG, "UserDefinedJavaClassDialog.ColumnInfo.ParameterValue" ),
        ColumnInfo.COLUMN_TYPE_TEXT, false ),
      new ColumnInfo(
        BaseMessages.getString( PKG, "UserDefinedJavaClassDialog.ColumnInfo.ParameterDescription" ),
        ColumnInfo.COLUMN_TYPE_TEXT, false ), };
  colinf[1].setUsingVariables( true );

  wParameters =
    new TableView(
      transMeta, wBottom, SWT.BORDER | SWT.FULL_SELECTION | SWT.MULTI, colinf, nrRows, lsMod, props );

  FormData fdFields = new FormData();
  fdFields.left = new FormAttachment( 0, 0 );
  fdFields.top = new FormAttachment( wlFields, margin );
  fdFields.right = new FormAttachment( 100, 0 );
  fdFields.bottom = new FormAttachment( 100, 0 );
  wParameters.setLayoutData( fdFields );

  FormData fdBottom = new FormData();
  fdBottom.left = new FormAttachment( 0, 0 );
  fdBottom.top = new FormAttachment( 0, 0 );
  fdBottom.right = new FormAttachment( 100, 0 );
  fdBottom.bottom = new FormAttachment( 100, 0 );
  wBottom.setLayoutData( fdBottom );
}
 
Example 10
Source File: UserDefinedJavaClassDialog.java    From hop with Apache License 2.0 4 votes vote down vote up
private void addInfoTab() {
  infoTab = new CTabItem( wTabFolder, SWT.NONE );
  infoTab.setText( BaseMessages.getString( PKG, "UserDefinedJavaClassDialog.Tabs.Info.Title" ) );
  infoTab.setToolTipText( BaseMessages.getString( PKG, "UserDefinedJavaClassDialog.Tabs.Info.TooltipText" ) );

  Composite wBottom = new Composite( wTabFolder, SWT.NONE );
  props.setLook( wBottom );
  infoTab.setControl( wBottom );
  FormLayout bottomLayout = new FormLayout();
  bottomLayout.marginWidth = Const.FORM_MARGIN;
  bottomLayout.marginHeight = Const.FORM_MARGIN;
  wBottom.setLayout( bottomLayout );

  Label wlFields = new Label( wBottom, SWT.NONE );
  wlFields.setText( BaseMessages.getString( PKG, "UserDefinedJavaClassDialog.InfoTransforms.Label" ) );
  props.setLook( wlFields );
  FormData fdlFields = new FormData();
  fdlFields.left = new FormAttachment( 0, 0 );
  fdlFields.top = new FormAttachment( 0, 0 );
  wlFields.setLayoutData( fdlFields );

  final int nrRows = input.getInfoTransformDefinitions().size();
  ColumnInfo[] colinf =
    new ColumnInfo[] {
      new ColumnInfo(
        BaseMessages.getString( PKG, "UserDefinedJavaClassDialog.ColumnInfo.TransformTag" ),
        ColumnInfo.COLUMN_TYPE_TEXT, false ),
      new ColumnInfo(
        BaseMessages.getString( PKG, "UserDefinedJavaClassDialog.ColumnInfo.TransformName" ),
        ColumnInfo.COLUMN_TYPE_CCOMBO, prevTransformNames ),
      new ColumnInfo(
        BaseMessages.getString( PKG, "UserDefinedJavaClassDialog.ColumnInfo.TransformDescription" ),
        ColumnInfo.COLUMN_TYPE_TEXT, false ), };

  wInfoTransforms =
    new TableView(
      pipelineMeta, wBottom, SWT.BORDER | SWT.FULL_SELECTION | SWT.MULTI, colinf, nrRows, lsMod, props );

  FormData fdFields = new FormData();
  fdFields.left = new FormAttachment( 0, 0 );
  fdFields.top = new FormAttachment( wlFields, margin );
  fdFields.right = new FormAttachment( 100, 0 );
  fdFields.bottom = new FormAttachment( 100, 0 );
  wInfoTransforms.setLayoutData( fdFields );

  FormData fdBottom = new FormData();
  fdBottom.left = new FormAttachment( 0, 0 );
  fdBottom.top = new FormAttachment( 0, 0 );
  fdBottom.right = new FormAttachment( 100, 0 );
  fdBottom.bottom = new FormAttachment( 100, 0 );
  wBottom.setLayoutData( fdBottom );
}
 
Example 11
Source File: UserDefinedJavaClassDialog.java    From hop with Apache License 2.0 4 votes vote down vote up
private void addFieldsTab() {
  fieldsTab = new CTabItem( wTabFolder, SWT.NONE );
  fieldsTab.setText( BaseMessages.getString( PKG, "UserDefinedJavaClassDialog.Tabs.Fields.Title" ) );
  fieldsTab.setToolTipText( BaseMessages.getString( PKG, "UserDefinedJavaClassDialog.Tabs.Fields.TooltipText" ) );

  Composite wBottom = new Composite( wTabFolder, SWT.NONE );
  props.setLook( wBottom );
  fieldsTab.setControl( wBottom );
  FormLayout bottomLayout = new FormLayout();
  bottomLayout.marginWidth = Const.FORM_MARGIN;
  bottomLayout.marginHeight = Const.FORM_MARGIN;
  wBottom.setLayout( bottomLayout );

  Label wlFields = new Label( wBottom, SWT.NONE );
  wlFields.setText( BaseMessages.getString( PKG, "UserDefinedJavaClassDialog.Fields.Label" ) );
  props.setLook( wlFields );
  FormData fdlFields = new FormData();
  fdlFields.left = new FormAttachment( 0, 0 );
  fdlFields.top = new FormAttachment( 0, 0 );
  wlFields.setLayoutData( fdlFields );

  wClearResultFields = new Button( wBottom, SWT.CHECK );
  wClearResultFields
    .setText( BaseMessages.getString( PKG, "UserDefinedJavaClassDialog.ClearResultFields.Label" ) );
  props.setLook( wClearResultFields );
  FormData fdClearResultFields = new FormData();
  fdClearResultFields.right = new FormAttachment( 100, 0 );
  fdClearResultFields.top = new FormAttachment( 0, 0 );
  wClearResultFields.setLayoutData( fdClearResultFields );

  final int fieldsRows = input.getFieldInfo().size();

  ColumnInfo[] colinf =
    new ColumnInfo[] {
      new ColumnInfo(
        BaseMessages.getString( PKG, "UserDefinedJavaClassDialog.ColumnInfo.Filename" ),
        ColumnInfo.COLUMN_TYPE_TEXT, false ),
      new ColumnInfo(
        BaseMessages.getString( PKG, "UserDefinedJavaClassDialog.ColumnInfo.Type" ),
        ColumnInfo.COLUMN_TYPE_CCOMBO, ValueMetaFactory.getValueMetaNames() ),
      new ColumnInfo(
        BaseMessages.getString( PKG, "UserDefinedJavaClassDialog.ColumnInfo.Length" ),
        ColumnInfo.COLUMN_TYPE_TEXT, false ),
      new ColumnInfo(
        BaseMessages.getString( PKG, "UserDefinedJavaClassDialog.ColumnInfo.Precision" ),
        ColumnInfo.COLUMN_TYPE_TEXT, false ), };

  wFields =
    new TableView(
      pipelineMeta, wBottom, SWT.BORDER | SWT.FULL_SELECTION | SWT.MULTI, colinf, fieldsRows, lsMod, props );

  FormData fdFields = new FormData();
  fdFields.left = new FormAttachment( 0, 0 );
  fdFields.top = new FormAttachment( wlFields, margin );
  fdFields.right = new FormAttachment( 100, 0 );
  fdFields.bottom = new FormAttachment( 100, 0 );
  wFields.setLayoutData( fdFields );

  FormData fdBottom = new FormData();
  fdBottom.left = new FormAttachment( 0, 0 );
  fdBottom.top = new FormAttachment( 0, 0 );
  fdBottom.right = new FormAttachment( 100, 0 );
  fdBottom.bottom = new FormAttachment( 100, 0 );
  wBottom.setLayoutData( fdBottom );

}
 
Example 12
Source File: JobExecutorDialog.java    From pentaho-kettle with Apache License 2.0 4 votes vote down vote up
private void addParametersTab() {
  CTabItem wParametersTab = new CTabItem( wTabFolder, SWT.NONE );
  wParametersTab.setText( BaseMessages.getString( PKG, "JobExecutorDialog.Parameters.Title" ) );
  wParametersTab.setToolTipText( BaseMessages.getString( PKG, "JobExecutorDialog.Parameters.Tooltip" ) );

  Composite wParametersComposite = new Composite( wTabFolder, SWT.NONE );
  props.setLook( wParametersComposite );

  FormLayout parameterTabLayout = new FormLayout();
  parameterTabLayout.marginWidth = 15;
  parameterTabLayout.marginHeight = 15;
  wParametersComposite.setLayout( parameterTabLayout );

  // Add a button: get parameters
  //
  wGetParameters = new Button( wParametersComposite, SWT.PUSH );
  wGetParameters.setText( BaseMessages.getString( PKG, "JobExecutorDialog.Parameters.GetParameters" ) );
  props.setLook( wGetParameters );
  FormData fdGetParameters = new FormData();
  fdGetParameters.bottom = new FormAttachment( 100, 0 );
  fdGetParameters.right = new FormAttachment( 100, 0 );
  wGetParameters.setLayoutData( fdGetParameters );
  wGetParameters.setSelection( jobExecutorMeta.getParameters().isInheritingAllVariables() );
  wGetParameters.addSelectionListener( new SelectionAdapter() {
    public void widgetSelected( SelectionEvent e ) {
      getParametersFromJob( null ); // null : reload file
    }
  } );

  // Now add a table view with the 3 columns to specify: variable name, input field & optional static input
  //
  parameterColumns =
    new ColumnInfo[] {
      new ColumnInfo(
        BaseMessages.getString( PKG, "JobExecutorDialog.Parameters.column.Variable" ),
        ColumnInfo.COLUMN_TYPE_TEXT, false, false ),
      new ColumnInfo(
        BaseMessages.getString( PKG, "JobExecutorDialog.Parameters.column.Field" ),
        ColumnInfo.COLUMN_TYPE_CCOMBO, new String[] {}, false ),
      new ColumnInfo(
        BaseMessages.getString( PKG, "JobExecutorDialog.Parameters.column.Input" ),
        ColumnInfo.COLUMN_TYPE_TEXT, false, false ), };
  parameterColumns[ 1 ].setUsingVariables( true );

  JobExecutorParameters parameters = jobExecutorMeta.getParameters();
  wJobExecutorParameters =
    new TableView(
      transMeta, wParametersComposite, SWT.FULL_SELECTION | SWT.SINGLE | SWT.BORDER, parameterColumns,
      parameters.getVariable().length, lsModParams, props );
  props.setLook( wJobExecutorParameters );
  FormData fdJobExecutors = new FormData();
  fdJobExecutors.left = new FormAttachment( 0, 0 );
  fdJobExecutors.right = new FormAttachment( 100, 0 );
  fdJobExecutors.top = new FormAttachment( 0, 0 );
  fdJobExecutors.bottom = new FormAttachment( wGetParameters, -10 );
  wJobExecutorParameters.setLayoutData( fdJobExecutors );
  wJobExecutorParameters.getTable().addListener( SWT.Resize, new ColumnsResizer( 0, 33, 33, 33 ) );

  parameterTableHelper.setParameterTableView( wJobExecutorParameters );
  parameterTableHelper.setUpDisabledListeners();
  // Add disabled listeners to columns
  parameterColumns[0].setDisabledListener( parameterTableHelper.getVarDisabledListener() );
  parameterColumns[1].setDisabledListener( parameterTableHelper.getFieldDisabledListener() );
  parameterColumns[2].setDisabledListener( parameterTableHelper.getInputDisabledListener() );

  for ( int i = 0; i < parameters.getVariable().length; i++ ) {
    TableItem tableItem = wJobExecutorParameters.table.getItem( i );
    tableItem.setText( 1, Const.NVL( parameters.getVariable()[ i ], "" ) );
    tableItem.setText( 2, Const.NVL( parameters.getField()[ i ], "" ) );
    tableItem.setText( 3, Const.NVL( parameters.getInput()[ i ], "" ) );
    // Check disable listeners to shade fields gray
    parameterTableHelper.checkTableOnOpen( tableItem, i );
  }
  wJobExecutorParameters.setRowNums();
  wJobExecutorParameters.optWidth( true );

  // Add a checkbox: inherit all variables...
  //
  wInheritAll = new Button( wParametersComposite, SWT.CHECK );
  wInheritAll.setText( BaseMessages.getString( PKG, "JobExecutorDialog.Parameters.InheritAll" ) );
  props.setLook( wInheritAll );
  FormData fdInheritAll = new FormData();
  fdInheritAll.left = new FormAttachment( 0, 0 );
  fdInheritAll.top = new FormAttachment( wJobExecutorParameters, 15 );
  wInheritAll.setLayoutData( fdInheritAll );
  wInheritAll.setSelection( jobExecutorMeta.getParameters().isInheritingAllVariables() );

  FormData fdParametersComposite = new FormData();
  fdParametersComposite.left = new FormAttachment( 0, 0 );
  fdParametersComposite.top = new FormAttachment( 0, 0 );
  fdParametersComposite.right = new FormAttachment( 100, 0 );
  fdParametersComposite.bottom = new FormAttachment( 100, 0 );
  wParametersComposite.setLayoutData( fdParametersComposite );

  wParametersComposite.layout();
  wParametersTab.setControl( wParametersComposite );
}
 
Example 13
Source File: WorkflowExecutorDialog.java    From hop with Apache License 2.0 4 votes vote down vote up
private void addResultRowsTab() {

    final CTabItem wTab = new CTabItem( wTabFolder, SWT.NONE );
    wTab.setText( BaseMessages.getString( PKG, "JobExecutorDialog.ResultRows.Title" ) );
    wTab.setToolTipText( BaseMessages.getString( PKG, "JobExecutorDialog.ResultRows.Tooltip" ) );

    ScrolledComposite scrolledComposite = new ScrolledComposite( wTabFolder, SWT.V_SCROLL | SWT.H_SCROLL );
    scrolledComposite.setLayout( new FillLayout() );

    Composite wInputComposite = new Composite( scrolledComposite, SWT.NONE );
    props.setLook( wInputComposite );

    FormLayout tabLayout = new FormLayout();
    tabLayout.marginWidth = 15;
    tabLayout.marginHeight = 15;
    wInputComposite.setLayout( tabLayout );

    wlResultRowsTarget = new Label( wInputComposite, SWT.RIGHT );
    props.setLook( wlResultRowsTarget );
    wlResultRowsTarget.setText( BaseMessages.getString( PKG, "JobExecutorDialog.ResultRowsTarget.Label" ) );
    FormData fdlResultRowsTarget = new FormData();
    fdlResultRowsTarget.top = new FormAttachment( 0, 0 );
    fdlResultRowsTarget.left = new FormAttachment( 0, 0 ); // First one in the left
    wlResultRowsTarget.setLayoutData( fdlResultRowsTarget );

    wResultRowsTarget = new CCombo( wInputComposite, SWT.SINGLE | SWT.LEFT | SWT.BORDER );
    props.setLook( wResultRowsTarget );
    wResultRowsTarget.addModifyListener( lsMod );
    FormData fdResultRowsTarget = new FormData();
    fdResultRowsTarget.width = 250;
    fdResultRowsTarget.top = new FormAttachment( wlResultRowsTarget, 5 );
    fdResultRowsTarget.left = new FormAttachment( 0, 0 ); // To the right
    wResultRowsTarget.setLayoutData( fdResultRowsTarget );

    wlResultFields = new Label( wInputComposite, SWT.NONE );
    wlResultFields.setText( BaseMessages.getString( PKG, "JobExecutorDialog.ResultFields.Label" ) );
    props.setLook( wlResultFields );
    FormData fdlResultFields = new FormData();
    fdlResultFields.left = new FormAttachment( 0, 0 );
    fdlResultFields.top = new FormAttachment( wResultRowsTarget, 10 );
    wlResultFields.setLayoutData( fdlResultFields );

    int nrRows = ( workflowExecutorMeta.getResultRowsField() != null ? workflowExecutorMeta.getResultRowsField().length : 1 );

    ColumnInfo[] ciResultFields =
      new ColumnInfo[] {
        new ColumnInfo( BaseMessages.getString( PKG, "JobExecutorDialog.ColumnInfo.Field" ),
          ColumnInfo.COLUMN_TYPE_TEXT, false, false ),
        new ColumnInfo( BaseMessages.getString( PKG, "JobExecutorDialog.ColumnInfo.Type" ),
          ColumnInfo.COLUMN_TYPE_CCOMBO, ValueMetaFactory.getValueMetaNames() ),
        new ColumnInfo( BaseMessages.getString( PKG, "JobExecutorDialog.ColumnInfo.Length" ),
          ColumnInfo.COLUMN_TYPE_TEXT, false ),
        new ColumnInfo( BaseMessages.getString( PKG, "JobExecutorDialog.ColumnInfo.Precision" ),
          ColumnInfo.COLUMN_TYPE_TEXT, false ), };

    wResultRowsFields =
      new TableView( pipelineMeta, wInputComposite, SWT.BORDER | SWT.FULL_SELECTION | SWT.MULTI | SWT.V_SCROLL
        | SWT.H_SCROLL, ciResultFields, nrRows, false, lsMod, props, false );

    FormData fdResultFields = new FormData();
    fdResultFields.left = new FormAttachment( 0, 0 );
    fdResultFields.top = new FormAttachment( wlResultFields, 5 );
    fdResultFields.right = new FormAttachment( 100, 0 );
    fdResultFields.bottom = new FormAttachment( 100, 0 );
    wResultRowsFields.setLayoutData( fdResultFields );
    wResultRowsFields.getTable().addListener( SWT.Resize, new ColumnsResizer( 0, 25, 25, 25, 25 ) );

    wInputComposite.pack();
    Rectangle bounds = wInputComposite.getBounds();

    scrolledComposite.setContent( wInputComposite );
    scrolledComposite.setExpandHorizontal( true );
    scrolledComposite.setExpandVertical( true );
    scrolledComposite.setMinWidth( bounds.width );
    scrolledComposite.setMinHeight( bounds.height );

    wTab.setControl( scrolledComposite );
    wTabFolder.setSelection( wTab );
  }
 
Example 14
Source File: WorkflowExecutorDialog.java    From hop with Apache License 2.0 4 votes vote down vote up
private void addResultFilesTab() {
  final CTabItem wTab = new CTabItem( wTabFolder, SWT.NONE );
  wTab.setText( BaseMessages.getString( PKG, "JobExecutorDialog.ResultFiles.Title" ) );
  wTab.setToolTipText( BaseMessages.getString( PKG, "JobExecutorDialog.ResultFiles.Tooltip" ) );

  ScrolledComposite scrolledComposite = new ScrolledComposite( wTabFolder, SWT.V_SCROLL | SWT.H_SCROLL );
  scrolledComposite.setLayout( new FillLayout() );

  Composite wInputComposite = new Composite( scrolledComposite, SWT.NONE );
  props.setLook( wInputComposite );

  FormLayout tabLayout = new FormLayout();
  tabLayout.marginWidth = 15;
  tabLayout.marginHeight = 15;
  wInputComposite.setLayout( tabLayout );

  wlResultFilesTarget = new Label( wInputComposite, SWT.RIGHT );
  props.setLook( wlResultFilesTarget );
  wlResultFilesTarget.setText( BaseMessages.getString( PKG, "JobExecutorDialog.ResultFilesTarget.Label" ) );
  FormData fdlResultFilesTarget = new FormData();
  fdlResultFilesTarget.top = new FormAttachment( 0, 0 );
  fdlResultFilesTarget.left = new FormAttachment( 0, 0 ); // First one in the left
  wlResultFilesTarget.setLayoutData( fdlResultFilesTarget );

  wResultFilesTarget = new CCombo( wInputComposite, SWT.SINGLE | SWT.LEFT | SWT.BORDER );
  props.setLook( wResultFilesTarget );
  wResultFilesTarget.addModifyListener( lsMod );
  FormData fdResultFilesTarget = new FormData();
  fdResultFilesTarget.width = 250;
  fdResultFilesTarget.top = new FormAttachment( wlResultFilesTarget, 5 );
  fdResultFilesTarget.left = new FormAttachment( 0, 0 ); // To the right
  wResultFilesTarget.setLayoutData( fdResultFilesTarget );

  // ResultFileNameField
  //
  wlResultFileNameField = new Label( wInputComposite, SWT.RIGHT );
  props.setLook( wlResultFileNameField );
  wlResultFileNameField.setText( BaseMessages.getString( PKG, "JobExecutorDialog.ResultFileNameField.Label" ) );
  FormData fdlResultFileNameField = new FormData();
  fdlResultFileNameField.top = new FormAttachment( wResultFilesTarget, 10 );
  fdlResultFileNameField.left = new FormAttachment( 0, 0 ); // First one in the left
  wlResultFileNameField.setLayoutData( fdlResultFileNameField );

  wResultFileNameField = new TextVar( pipelineMeta, wInputComposite, SWT.SINGLE | SWT.LEFT | SWT.BORDER );
  props.setLook( wResultFileNameField );
  wResultFileNameField.addModifyListener( lsMod );
  FormData fdResultFileNameField = new FormData();
  fdResultFileNameField.width = 250;
  fdResultFileNameField.top = new FormAttachment( wlResultFileNameField, 5 );
  fdResultFileNameField.left = new FormAttachment( 0, 0 ); // To the right
  wResultFileNameField.setLayoutData( fdResultFileNameField );

  wInputComposite.pack();
  Rectangle bounds = wInputComposite.getBounds();

  scrolledComposite.setContent( wInputComposite );
  scrolledComposite.setExpandHorizontal( true );
  scrolledComposite.setExpandVertical( true );
  scrolledComposite.setMinWidth( bounds.width );
  scrolledComposite.setMinHeight( bounds.height );

  wTab.setControl( scrolledComposite );
  wTabFolder.setSelection( wTab );
}
 
Example 15
Source File: TransExecutorDialog.java    From pentaho-kettle with Apache License 2.0 4 votes vote down vote up
private void addResultFilesTab() {

    final CTabItem wTab = new CTabItem( wTabFolder, SWT.NONE );
    wTab.setText( BaseMessages.getString( PKG, "TransExecutorDialog.ResultFiles.Title" ) );
    wTab.setToolTipText( BaseMessages.getString( PKG, "TransExecutorDialog.ResultFiles.Tooltip" ) );

    ScrolledComposite scrolledComposite = new ScrolledComposite( wTabFolder, SWT.V_SCROLL | SWT.H_SCROLL );
    scrolledComposite.setLayout( new FillLayout() );

    Composite wInputComposite = new Composite( scrolledComposite, SWT.NONE );
    props.setLook( wInputComposite );

    FormLayout tabLayout = new FormLayout();
    tabLayout.marginWidth = 15;
    tabLayout.marginHeight = 15;
    wInputComposite.setLayout( tabLayout );

    wlResultFilesTarget = new Label( wInputComposite, SWT.RIGHT );
    props.setLook( wlResultFilesTarget );
    wlResultFilesTarget.setText( BaseMessages.getString( PKG, "TransExecutorDialog.ResultFilesTarget.Label" ) );
    FormData fdlResultFilesTarget = new FormData();
    fdlResultFilesTarget.top = new FormAttachment( 0, 0 );
    fdlResultFilesTarget.left = new FormAttachment( 0, 0 ); // First one in the left
    wlResultFilesTarget.setLayoutData( fdlResultFilesTarget );

    wResultFilesTarget = new CCombo( wInputComposite, SWT.SINGLE | SWT.LEFT | SWT.BORDER );
    props.setLook( wResultFilesTarget );
    wResultFilesTarget.addModifyListener( lsMod );
    FormData fdResultFilesTarget = new FormData();
    fdResultFilesTarget.width = 250;
    fdResultFilesTarget.top = new FormAttachment( wlResultFilesTarget, 5 );
    fdResultFilesTarget.left = new FormAttachment( 0, 0 ); // To the right
    wResultFilesTarget.setLayoutData( fdResultFilesTarget );

    // ResultFileNameField
    //
    wlResultFileNameField = new Label( wInputComposite, SWT.RIGHT );
    props.setLook( wlResultFileNameField );
    wlResultFileNameField.setText( BaseMessages.getString( PKG, "TransExecutorDialog.ResultFileNameField.Label" ) );
    FormData fdlResultFileNameField = new FormData();
    fdlResultFileNameField.top = new FormAttachment( wResultFilesTarget, 10 );
    fdlResultFileNameField.left = new FormAttachment( 0, 0 ); // First one in the left
    wlResultFileNameField.setLayoutData( fdlResultFileNameField );

    wResultFileNameField = new TextVar( transMeta, wInputComposite, SWT.SINGLE | SWT.LEFT | SWT.BORDER );
    props.setLook( wResultFileNameField );
    wResultFileNameField.addModifyListener( lsMod );
    FormData fdResultFileNameField = new FormData();
    fdResultFileNameField.width = 250;
    fdResultFileNameField.top = new FormAttachment( wlResultFileNameField, 5 );
    fdResultFileNameField.left = new FormAttachment( 0, 0 ); // To the right
    wResultFileNameField.setLayoutData( fdResultFileNameField );

    wInputComposite.pack();
    Rectangle bounds = wInputComposite.getBounds();

    scrolledComposite.setContent( wInputComposite );
    scrolledComposite.setExpandHorizontal( true );
    scrolledComposite.setExpandVertical( true );
    scrolledComposite.setMinWidth( bounds.width );
    scrolledComposite.setMinHeight( bounds.height );

    wTab.setControl( scrolledComposite );
    wTabFolder.setSelection( wTab );
  }
 
Example 16
Source File: WorkflowExecutorDialog.java    From hop with Apache License 2.0 4 votes vote down vote up
private void addParametersTab() {
  CTabItem wParametersTab = new CTabItem( wTabFolder, SWT.NONE );
  wParametersTab.setText( BaseMessages.getString( PKG, "JobExecutorDialog.Parameters.Title" ) );
  wParametersTab.setToolTipText( BaseMessages.getString( PKG, "JobExecutorDialog.Parameters.Tooltip" ) );

  Composite wParametersComposite = new Composite( wTabFolder, SWT.NONE );
  props.setLook( wParametersComposite );

  FormLayout parameterTabLayout = new FormLayout();
  parameterTabLayout.marginWidth = 15;
  parameterTabLayout.marginHeight = 15;
  wParametersComposite.setLayout( parameterTabLayout );

  // Add a button: get parameters
  //
  wGetParameters = new Button( wParametersComposite, SWT.PUSH );
  wGetParameters.setText( BaseMessages.getString( PKG, "JobExecutorDialog.Parameters.GetParameters" ) );
  props.setLook( wGetParameters );
  FormData fdGetParameters = new FormData();
  fdGetParameters.bottom = new FormAttachment( 100, 0 );
  fdGetParameters.right = new FormAttachment( 100, 0 );
  wGetParameters.setLayoutData( fdGetParameters );
  wGetParameters.setSelection( workflowExecutorMeta.getParameters().isInheritingAllVariables() );
  wGetParameters.addSelectionListener( new SelectionAdapter() {
    public void widgetSelected( SelectionEvent e ) {
      getParametersFromWorkflow( null ); // null : reload file
    }
  } );

  // Now add a table view with the 3 columns to specify: variable name, input field & optional static input
  //
  parameterColumns =
    new ColumnInfo[] {
      new ColumnInfo(
        BaseMessages.getString( PKG, "JobExecutorDialog.Parameters.column.Variable" ),
        ColumnInfo.COLUMN_TYPE_TEXT, false, false ),
      new ColumnInfo(
        BaseMessages.getString( PKG, "JobExecutorDialog.Parameters.column.Field" ),
        ColumnInfo.COLUMN_TYPE_CCOMBO, new String[] {}, false ),
      new ColumnInfo(
        BaseMessages.getString( PKG, "JobExecutorDialog.Parameters.column.Input" ),
        ColumnInfo.COLUMN_TYPE_TEXT, false, false ), };
  parameterColumns[ 1 ].setUsingVariables( true );

  WorkflowExecutorParameters parameters = workflowExecutorMeta.getParameters();
  wWorkflowExecutorParameters =
    new TableView(
      pipelineMeta, wParametersComposite, SWT.FULL_SELECTION | SWT.SINGLE | SWT.BORDER, parameterColumns,
      parameters.getVariable().length, lsMod, props );
  props.setLook( wWorkflowExecutorParameters );
  FormData fdJobExecutors = new FormData();
  fdJobExecutors.left = new FormAttachment( 0, 0 );
  fdJobExecutors.right = new FormAttachment( 100, 0 );
  fdJobExecutors.top = new FormAttachment( 0, 0 );
  fdJobExecutors.bottom = new FormAttachment( wGetParameters, -10 );
  wWorkflowExecutorParameters.setLayoutData( fdJobExecutors );
  wWorkflowExecutorParameters.getTable().addListener( SWT.Resize, new ColumnsResizer( 0, 33, 33, 33 ) );

  for ( int i = 0; i < parameters.getVariable().length; i++ ) {
    TableItem tableItem = wWorkflowExecutorParameters.table.getItem( i );
    tableItem.setText( 1, Const.NVL( parameters.getVariable()[ i ], "" ) );
    tableItem.setText( 2, Const.NVL( parameters.getField()[ i ], "" ) );
    tableItem.setText( 3, Const.NVL( parameters.getInput()[ i ], "" ) );
  }
  wWorkflowExecutorParameters.setRowNums();
  wWorkflowExecutorParameters.optWidth( true );

  // Add a checkbox: inherit all variables...
  //
  wInheritAll = new Button( wParametersComposite, SWT.CHECK );
  wInheritAll.setText( BaseMessages.getString( PKG, "JobExecutorDialog.Parameters.InheritAll" ) );
  props.setLook( wInheritAll );
  FormData fdInheritAll = new FormData();
  fdInheritAll.left = new FormAttachment( 0, 0 );
  fdInheritAll.top = new FormAttachment( wWorkflowExecutorParameters, 15 );
  wInheritAll.setLayoutData( fdInheritAll );
  wInheritAll.setSelection( workflowExecutorMeta.getParameters().isInheritingAllVariables() );

  FormData fdParametersComposite = new FormData();
  fdParametersComposite.left = new FormAttachment( 0, 0 );
  fdParametersComposite.top = new FormAttachment( 0, 0 );
  fdParametersComposite.right = new FormAttachment( 100, 0 );
  fdParametersComposite.bottom = new FormAttachment( 100, 0 );
  wParametersComposite.setLayoutData( fdParametersComposite );

  wParametersComposite.layout();
  wParametersTab.setControl( wParametersComposite );
}
 
Example 17
Source File: SimpleMappingDialog.java    From pentaho-kettle with Apache License 2.0 4 votes vote down vote up
private void addParametersTab( final MappingParameters parameters ) {

    CTabItem wParametersTab = new CTabItem( wTabFolder, SWT.NONE );
    wParametersTab.setText( BaseMessages.getString( PKG, "SimpleMappingDialog.Parameters.Title" ) );
    wParametersTab.setToolTipText( BaseMessages.getString( PKG, "SimpleMappingDialog.Parameters.Tooltip" ) );

    Composite wParametersComposite = new Composite( wTabFolder, SWT.NONE );
    props.setLook( wParametersComposite );

    FormLayout parameterTabLayout = new FormLayout();
    parameterTabLayout.marginWidth = 15;
    parameterTabLayout.marginHeight = 15;
    wParametersComposite.setLayout( parameterTabLayout );

    // Add a checkbox: inherit all variables...
    //
    Button wInheritAll = new Button( wParametersComposite, SWT.CHECK );
    wInheritAll.setText( BaseMessages.getString( PKG, "SimpleMappingDialog.Parameters.InheritAll" ) );
    props.setLook( wInheritAll );
    FormData fdInheritAll = new FormData();
    fdInheritAll.bottom = new FormAttachment( 100, 0 );
    fdInheritAll.left = new FormAttachment( 0, 0 );
    fdInheritAll.right = new FormAttachment( 100, -30 );
    wInheritAll.setLayoutData( fdInheritAll );
    wInheritAll.setSelection( parameters.isInheritingAllVariables() );

    // Now add a tableview with the 2 columns to specify: input and output
    // fields for the source and target steps.
    //
    ColumnInfo[] colinfo =
      new ColumnInfo[] {
        new ColumnInfo(
          BaseMessages.getString( PKG, "SimpleMappingDialog.Parameters.column.Variable" ),
          ColumnInfo.COLUMN_TYPE_TEXT, false, false ),
        new ColumnInfo(
          BaseMessages.getString( PKG, "SimpleMappingDialog.Parameters.column.ValueOrField" ),
          ColumnInfo.COLUMN_TYPE_TEXT, false, false ), };
    colinfo[ 1 ].setUsingVariables( true );

    final TableView wMappingParameters =
      new TableView(
        transMeta, wParametersComposite, SWT.FULL_SELECTION | SWT.SINGLE | SWT.BORDER, colinfo, parameters
        .getVariable().length, false, lsMod, props, false
      );
    props.setLook( wMappingParameters );
    FormData fdMappings = new FormData();
    fdMappings.left = new FormAttachment( 0, 0 );
    fdMappings.right = new FormAttachment( 100, 0 );
    fdMappings.top = new FormAttachment( 0, 0 );
    fdMappings.bottom = new FormAttachment( wInheritAll, -10 );
    wMappingParameters.setLayoutData( fdMappings );
    wMappingParameters.getTable().addListener( SWT.Resize, new ColumnsResizer( 0, 50, 50 ) );

    for ( int i = 0; i < parameters.getVariable().length; i++ ) {
      TableItem tableItem = wMappingParameters.table.getItem( i );
      tableItem.setText( 1, parameters.getVariable()[ i ] );
      tableItem.setText( 2, parameters.getInputField()[ i ] );
    }
    wMappingParameters.setRowNums();
    wMappingParameters.optWidth( true );

    FormData fdParametersComposite = new FormData();
    fdParametersComposite.left = new FormAttachment( 0, 0 );
    fdParametersComposite.top = new FormAttachment( 0, 0 );
    fdParametersComposite.right = new FormAttachment( 100, 0 );
    fdParametersComposite.bottom = new FormAttachment( 100, 0 );
    wParametersComposite.setLayoutData( fdParametersComposite );

    wParametersComposite.layout();
    wParametersTab.setControl( wParametersComposite );

    changeList.add( new MappingParametersTab( wMappingParameters, wInheritAll, parameters ) );
  }
 
Example 18
Source File: PipelineExecutorDialog.java    From hop with Apache License 2.0 4 votes vote down vote up
private void addResultFilesTab() {

    final CTabItem wTab = new CTabItem( wTabFolder, SWT.NONE );
    wTab.setText( BaseMessages.getString( PKG, "PipelineExecutorDialog.ResultFiles.Title" ) );
    wTab.setToolTipText( BaseMessages.getString( PKG, "PipelineExecutorDialog.ResultFiles.Tooltip" ) );

    ScrolledComposite scrolledComposite = new ScrolledComposite( wTabFolder, SWT.V_SCROLL | SWT.H_SCROLL );
    scrolledComposite.setLayout( new FillLayout() );

    Composite wInputComposite = new Composite( scrolledComposite, SWT.NONE );
    props.setLook( wInputComposite );

    FormLayout tabLayout = new FormLayout();
    tabLayout.marginWidth = 15;
    tabLayout.marginHeight = 15;
    wInputComposite.setLayout( tabLayout );

    wlResultFilesTarget = new Label( wInputComposite, SWT.RIGHT );
    props.setLook( wlResultFilesTarget );
    wlResultFilesTarget.setText( BaseMessages.getString( PKG, "PipelineExecutorDialog.ResultFilesTarget.Label" ) );
    FormData fdlResultFilesTarget = new FormData();
    fdlResultFilesTarget.top = new FormAttachment( 0, 0 );
    fdlResultFilesTarget.left = new FormAttachment( 0, 0 ); // First one in the left
    wlResultFilesTarget.setLayoutData( fdlResultFilesTarget );

    wResultFilesTarget = new CCombo( wInputComposite, SWT.SINGLE | SWT.LEFT | SWT.BORDER );
    props.setLook( wResultFilesTarget );
    wResultFilesTarget.addModifyListener( lsMod );
    FormData fdResultFilesTarget = new FormData();
    fdResultFilesTarget.width = 250;
    fdResultFilesTarget.top = new FormAttachment( wlResultFilesTarget, 5 );
    fdResultFilesTarget.left = new FormAttachment( 0, 0 ); // To the right
    wResultFilesTarget.setLayoutData( fdResultFilesTarget );

    // ResultFileNameField
    //
    wlResultFileNameField = new Label( wInputComposite, SWT.RIGHT );
    props.setLook( wlResultFileNameField );
    wlResultFileNameField.setText( BaseMessages.getString( PKG, "PipelineExecutorDialog.ResultFileNameField.Label" ) );
    FormData fdlResultFileNameField = new FormData();
    fdlResultFileNameField.top = new FormAttachment( wResultFilesTarget, 10 );
    fdlResultFileNameField.left = new FormAttachment( 0, 0 ); // First one in the left
    wlResultFileNameField.setLayoutData( fdlResultFileNameField );

    wResultFileNameField = new TextVar( pipelineMeta, wInputComposite, SWT.SINGLE | SWT.LEFT | SWT.BORDER );
    props.setLook( wResultFileNameField );
    wResultFileNameField.addModifyListener( lsMod );
    FormData fdResultFileNameField = new FormData();
    fdResultFileNameField.width = 250;
    fdResultFileNameField.top = new FormAttachment( wlResultFileNameField, 5 );
    fdResultFileNameField.left = new FormAttachment( 0, 0 ); // To the right
    wResultFileNameField.setLayoutData( fdResultFileNameField );

    wInputComposite.pack();
    Rectangle bounds = wInputComposite.getBounds();

    scrolledComposite.setContent( wInputComposite );
    scrolledComposite.setExpandHorizontal( true );
    scrolledComposite.setExpandVertical( true );
    scrolledComposite.setMinWidth( bounds.width );
    scrolledComposite.setMinHeight( bounds.height );

    wTab.setControl( scrolledComposite );
    wTabFolder.setSelection( wTab );
  }
 
Example 19
Source File: UserDefinedJavaClassDialog.java    From pentaho-kettle with Apache License 2.0 4 votes vote down vote up
private void addFieldsTab() {
  fieldsTab = new CTabItem( wTabFolder, SWT.NONE );
  fieldsTab.setText( BaseMessages.getString( PKG, "UserDefinedJavaClassDialog.Tabs.Fields.Title" ) );
  fieldsTab.setToolTipText( BaseMessages.getString( PKG, "UserDefinedJavaClassDialog.Tabs.Fields.TooltipText" ) );

  Composite wBottom = new Composite( wTabFolder, SWT.NONE );
  props.setLook( wBottom );
  fieldsTab.setControl( wBottom );
  FormLayout bottomLayout = new FormLayout();
  bottomLayout.marginWidth = Const.FORM_MARGIN;
  bottomLayout.marginHeight = Const.FORM_MARGIN;
  wBottom.setLayout( bottomLayout );

  Label wlFields = new Label( wBottom, SWT.NONE );
  wlFields.setText( BaseMessages.getString( PKG, "UserDefinedJavaClassDialog.Fields.Label" ) );
  props.setLook( wlFields );
  FormData fdlFields = new FormData();
  fdlFields.left = new FormAttachment( 0, 0 );
  fdlFields.top = new FormAttachment( 0, 0 );
  wlFields.setLayoutData( fdlFields );

  wClearResultFields = new Button( wBottom, SWT.CHECK );
  wClearResultFields
    .setText( BaseMessages.getString( PKG, "UserDefinedJavaClassDialog.ClearResultFields.Label" ) );
  props.setLook( wClearResultFields );
  FormData fdClearResultFields = new FormData();
  fdClearResultFields.right = new FormAttachment( 100, 0 );
  fdClearResultFields.top = new FormAttachment( 0, 0 );
  wClearResultFields.setLayoutData( fdClearResultFields );

  final int fieldsRows = input.getFieldInfo().size();

  ColumnInfo[] colinf =
    new ColumnInfo[] {
      new ColumnInfo(
        BaseMessages.getString( PKG, "UserDefinedJavaClassDialog.ColumnInfo.Filename" ),
        ColumnInfo.COLUMN_TYPE_TEXT, false ),
      new ColumnInfo(
        BaseMessages.getString( PKG, "UserDefinedJavaClassDialog.ColumnInfo.Type" ),
        ColumnInfo.COLUMN_TYPE_CCOMBO, ValueMetaFactory.getValueMetaNames() ),
      new ColumnInfo(
        BaseMessages.getString( PKG, "UserDefinedJavaClassDialog.ColumnInfo.Length" ),
        ColumnInfo.COLUMN_TYPE_TEXT, false ),
      new ColumnInfo(
        BaseMessages.getString( PKG, "UserDefinedJavaClassDialog.ColumnInfo.Precision" ),
        ColumnInfo.COLUMN_TYPE_TEXT, false ), };

  wFields =
    new TableView(
      transMeta, wBottom, SWT.BORDER | SWT.FULL_SELECTION | SWT.MULTI, colinf, fieldsRows, lsMod, props );

  FormData fdFields = new FormData();
  fdFields.left = new FormAttachment( 0, 0 );
  fdFields.top = new FormAttachment( wlFields, margin );
  fdFields.right = new FormAttachment( 100, 0 );
  fdFields.bottom = new FormAttachment( 100, 0 );
  wFields.setLayoutData( fdFields );

  FormData fdBottom = new FormData();
  fdBottom.left = new FormAttachment( 0, 0 );
  fdBottom.top = new FormAttachment( 0, 0 );
  fdBottom.right = new FormAttachment( 100, 0 );
  fdBottom.bottom = new FormAttachment( 100, 0 );
  wBottom.setLayoutData( fdBottom );

}
 
Example 20
Source File: PipelineExecutorDialog.java    From hop with Apache License 2.0 4 votes vote down vote up
private void addParametersTab() {
  CTabItem wParametersTab = new CTabItem( wTabFolder, SWT.NONE );
  wParametersTab.setText( BaseMessages.getString( PKG, "PipelineExecutorDialog.Parameters.Title" ) );
  wParametersTab.setToolTipText( BaseMessages.getString( PKG, "PipelineExecutorDialog.Parameters.Tooltip" ) );

  Composite wParametersComposite = new Composite( wTabFolder, SWT.NONE );
  props.setLook( wParametersComposite );

  FormLayout parameterTabLayout = new FormLayout();
  parameterTabLayout.marginWidth = 15;
  parameterTabLayout.marginHeight = 15;
  wParametersComposite.setLayout( parameterTabLayout );

  // Add a button: get parameters
  //
  wGetParameters = new Button( wParametersComposite, SWT.PUSH );
  wGetParameters.setText( BaseMessages.getString( PKG, "PipelineExecutorDialog.Parameters.GetParameters" ) );
  props.setLook( wGetParameters );
  FormData fdGetParameters = new FormData();
  fdGetParameters.bottom = new FormAttachment( 100, 0 );
  fdGetParameters.right = new FormAttachment( 100, 0 );
  wGetParameters.setLayoutData( fdGetParameters );
  wGetParameters.setSelection( pipelineExecutorMeta.getParameters().isInheritingAllVariables() );
  wGetParameters.addSelectionListener( new SelectionAdapter() {
    public void widgetSelected( SelectionEvent e ) {
      getParametersFromPipeline( null ); // null = force reload of data on disk
    }
  } );

  // Now add a table view with the 3 columns to specify: variable name, input field & optional static input
  //
  parameterColumns =
    new ColumnInfo[] {
      new ColumnInfo( BaseMessages.getString( PKG, "PipelineExecutorDialog.Parameters.column.Variable" ),
        ColumnInfo.COLUMN_TYPE_TEXT, false, false ),
      new ColumnInfo( BaseMessages.getString( PKG, "PipelineExecutorDialog.Parameters.column.Field" ),
        ColumnInfo.COLUMN_TYPE_CCOMBO, new String[] {}, false ),
      new ColumnInfo( BaseMessages.getString( PKG, "PipelineExecutorDialog.Parameters.column.Input" ),
        ColumnInfo.COLUMN_TYPE_TEXT, false, false ), };
  parameterColumns[ 1 ].setUsingVariables( true );

  PipelineExecutorParameters parameters = pipelineExecutorMeta.getParameters();
  wPipelineExecutorParameters =
    new TableView( pipelineMeta, wParametersComposite, SWT.FULL_SELECTION | SWT.SINGLE | SWT.BORDER, parameterColumns,
      parameters.getVariable().length, false, lsMod, props, false );
  props.setLook( wPipelineExecutorParameters );
  FormData fdPipelineExecutors = new FormData();
  fdPipelineExecutors.left = new FormAttachment( 0, 0 );
  fdPipelineExecutors.right = new FormAttachment( 100, 0 );
  fdPipelineExecutors.top = new FormAttachment( 0, 0 );
  fdPipelineExecutors.bottom = new FormAttachment( wGetParameters, -10 );
  wPipelineExecutorParameters.setLayoutData( fdPipelineExecutors );
  wPipelineExecutorParameters.getTable().addListener( SWT.Resize, new ColumnsResizer( 0, 33, 33, 33 ) );

  for ( int i = 0; i < parameters.getVariable().length; i++ ) {
    TableItem tableItem = wPipelineExecutorParameters.table.getItem( i );
    tableItem.setText( 1, Const.NVL( parameters.getVariable()[ i ], "" ) );
    tableItem.setText( 2, Const.NVL( parameters.getField()[ i ], "" ) );
    tableItem.setText( 3, Const.NVL( parameters.getInput()[ i ], "" ) );
  }
  wPipelineExecutorParameters.setRowNums();
  wPipelineExecutorParameters.optWidth( true );

  // Add a checkbox: inherit all variables...
  //
  wInheritAll = new Button( wParametersComposite, SWT.CHECK );
  wInheritAll.setText( BaseMessages.getString( PKG, "PipelineExecutorDialog.Parameters.InheritAll" ) );
  props.setLook( wInheritAll );
  FormData fdInheritAll = new FormData();
  fdInheritAll.top = new FormAttachment( wPipelineExecutorParameters, 15 );
  fdInheritAll.left = new FormAttachment( 0, 0 );
  wInheritAll.setLayoutData( fdInheritAll );
  wInheritAll.setSelection( pipelineExecutorMeta.getParameters().isInheritingAllVariables() );

  FormData fdParametersComposite = new FormData();
  fdParametersComposite.left = new FormAttachment( 0, 0 );
  fdParametersComposite.top = new FormAttachment( 0, 0 );
  fdParametersComposite.right = new FormAttachment( 100, 0 );
  fdParametersComposite.bottom = new FormAttachment( 100, 0 );
  wParametersComposite.setLayoutData( fdParametersComposite );

  wParametersComposite.layout();
  wParametersTab.setControl( wParametersComposite );
}