Java Code Examples for org.eclipse.swt.custom.CCombo#addModifyListener()

The following examples show how to use org.eclipse.swt.custom.CCombo#addModifyListener() . 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: IngresVectorwiseLoaderDialog.java    From pentaho-kettle with Apache License 2.0 5 votes vote down vote up
protected CCombo addStandardSelect( String labelMessageKey, Control prevControl, String[] choices ) {
  int vertPad = verticalPadding;
  Label label = addStandardLabel( labelMessageKey, prevControl );
  verticalPadding = vertPad;
  CCombo combo = new CCombo( shell, SWT.BORDER );
  combo.setItems( choices );
  combo.addModifyListener( lsMod );
  combo.setLayoutData( standardInputSpacing( prevControl, label ) );
  return combo;
}
 
Example 2
Source File: NumberRangeDialog.java    From pentaho-kettle with Apache License 2.0 5 votes vote down vote up
private CCombo createLineCombo( ModifyListener lsMod, String lableText, Control prevControl ) {
  // Value line
  Label lable = new Label( shell, SWT.RIGHT );
  lable.setText( lableText );
  props.setLook( lable );
  FormData lableFormData = new FormData();
  lableFormData.left = new FormAttachment( 0, 0 );
  lableFormData.right = new FormAttachment( props.getMiddlePct(), -Const.MARGIN );
  // In case it is the first control
  if ( prevControl != null ) {
    lableFormData.top = new FormAttachment( prevControl, Const.MARGIN );
  } else {
    lableFormData.top = new FormAttachment( 0, Const.MARGIN );
  }
  lable.setLayoutData( lableFormData );

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

  return control;
}
 
Example 3
Source File: InfobrightLoaderDialog.java    From pentaho-kettle with Apache License 2.0 5 votes vote down vote up
protected CCombo addStandardSelect( String labelMessageKey, Control prevControl, String[] choices ) {
  int vertPad = verticalPadding;
  addStandardLabel( labelMessageKey, prevControl );
  verticalPadding = vertPad;
  CCombo combo = new CCombo( shell, SWT.BORDER );
  combo.setItems( choices );
  combo.addModifyListener( lsMod );
  combo.setLayoutData( standardInputSpacing( prevControl ) );
  return combo;
}
 
Example 4
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 5
Source File: NumberRangeDialog.java    From hop with Apache License 2.0 5 votes vote down vote up
private CCombo createLineCombo( ModifyListener lsMod, String lableText, Control prevControl ) {
  // Value line
  Label lable = new Label( shell, SWT.RIGHT );
  lable.setText( lableText );
  props.setLook( lable );
  FormData lableFormData = new FormData();
  lableFormData.left = new FormAttachment( 0, 0 );
  lableFormData.right = new FormAttachment( props.getMiddlePct(), -props.getMargin() );
  // In case it is the first control
  if ( prevControl != null ) {
    lableFormData.top = new FormAttachment( prevControl, props.getMargin() );
  } else {
    lableFormData.top = new FormAttachment( 0, props.getMargin() );
  }
  lable.setLayoutData( lableFormData );

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

  return control;
}
 
Example 6
Source File: InputURLDialog.java    From APICloud-Studio with GNU General Public License v3.0 5 votes vote down vote up
protected Control createDialogArea(Composite parent) {
      // create composite
      Composite composite = (Composite) super.createDialogArea(parent);
      // create message
      if (message != null) {
          Label label = new Label(composite, SWT.WRAP);
          label.setText(message);
          GridData data = new GridData(GridData.GRAB_HORIZONTAL
                  | GridData.GRAB_VERTICAL | GridData.HORIZONTAL_ALIGN_FILL
                  | GridData.VERTICAL_ALIGN_CENTER);
          data.widthHint = convertHorizontalDLUsToPixels(IDialogConstants.MINIMUM_MESSAGE_AREA_WIDTH);
          label.setLayoutData(data);
          label.setFont(parent.getFont());
      }
      combo = new CCombo(composite, getInputComboStyle());
      combo.setLayoutData(new GridData(GridData.GRAB_HORIZONTAL
              | GridData.HORIZONTAL_ALIGN_FILL));
      combo.addModifyListener(new ModifyListener() {
          public void modifyText(ModifyEvent e) {
              validateInput();
          }
      });
      errorMessageText = new Text(composite, SWT.READ_ONLY | SWT.WRAP);
      errorMessageText.setLayoutData(new GridData(GridData.GRAB_HORIZONTAL
              | GridData.HORIZONTAL_ALIGN_FILL));
      errorMessageText.setBackground(errorMessageText.getDisplay()
              .getSystemColor(SWT.COLOR_WIDGET_BACKGROUND));
errorMessageText.setForeground(errorMessageText.getDisplay()
		.getSystemColor(SWT.COLOR_RED));
      // Set the error message text
      // See https://bugs.eclipse.org/bugs/show_bug.cgi?id=66292
      setErrorMessage(errorMessage);

      applyDialogFont(composite);
      return composite;
  }
 
Example 7
Source File: VfsFileChooserControls.java    From pentaho-kettle with Apache License 2.0 5 votes vote down vote up
protected void addFileWidgets() {
  Label wlLocation = new Label( this, SWT.RIGHT );
  wlLocation.setText( BaseMessages.getString( PKG, "VfsFileChooserControls.Location.Label" ) );
  wlLocation.setLayoutData( new FormDataBuilder( ).left( 0, 0 ).top( 0, 0 ).result() );
  wLocation = new CCombo( this, SWT.BORDER | SWT.READ_ONLY );
  List<VFSScheme> availableVFSSchemes = getAvailableVFSSchemes();
  availableVFSSchemes.forEach( scheme -> wLocation.add( scheme.schemeName ) );
  wLocation.addListener( SWT.Selection, event -> {
    this.selectedVFSScheme = availableVFSSchemes.get( wLocation.getSelectionIndex() );
    this.wPath.setText( "" );
  } );
  if ( !availableVFSSchemes.isEmpty() ) {
    wLocation.select( 0 );
    this.selectedVFSScheme = availableVFSSchemes.get( wLocation.getSelectionIndex() );
  }
  wLocation.addModifyListener( lsMod );
  wLocation.setLayoutData(
    new FormDataBuilder().left( 0, 0 ).top( wlLocation, FIELD_LABEL_SEP ).width( FIELD_SMALL ).result() );

  Label wlPath = new Label( this, SWT.RIGHT );
  wlPath.setText( BaseMessages.getString( PKG, "VfsFileChooserControls.Filename.Label" ) );
  wlPath.setLayoutData( new FormDataBuilder().left( 0, 0 ).top( wLocation, FIELDS_SEP ).result() );
  wPath = new TextVar( space, this, SWT.SINGLE | SWT.LEFT | SWT.BORDER );
  wPath.addModifyListener( lsMod );
  wPath.setLayoutData( new FormDataBuilder().left( 0, 0 ).top( wlPath, FIELD_LABEL_SEP ).width( FIELD_LARGE + VAR_EXTRA_WIDTH ).result() );

  wbBrowse = new Button( this, SWT.PUSH );
  wbBrowse.setText( BaseMessages.getString( PKG, "System.Button.Browse" ) );
  wbBrowse.addListener( SWT.Selection, event -> browseForFileInputPath() );
  int bOffset = ( wbBrowse.computeSize( SWT.DEFAULT, SWT.DEFAULT, false ).y
    - wPath.computeSize( SWT.DEFAULT, SWT.DEFAULT, false ).y ) / 2;
  wbBrowse.setLayoutData( new FormDataBuilder().left( wPath, FIELD_LABEL_SEP ).top( wlPath, FIELD_LABEL_SEP - bOffset ).result() );
}
 
Example 8
Source File: ComboVar.java    From pentaho-kettle with Apache License 2.0 4 votes vote down vote up
public ComboVar( VariableSpace space, Composite composite, int flags, String toolTipText,
                 GetCaretPositionInterface getCaretPositionInterface, InsertTextInterface insertTextInterface ) {
  super( composite, SWT.NONE );
  this.toolTipText = toolTipText;
  this.getCaretPositionInterface = getCaretPositionInterface;
  this.insertTextInterface = insertTextInterface;
  this.variables = space;

  // props.setLook(this);

  // int margin = Const.MARGIN;
  FormLayout formLayout = new FormLayout();
  formLayout.marginWidth = 0;
  formLayout.marginHeight = 0;
  formLayout.marginTop = 0;
  formLayout.marginBottom = 0;

  this.setLayout( formLayout );

  // add a text field on it...
  wCombo = new CCombo( this, flags );

  Image image = GUIResource.getInstance().getImageVariable();
  controlDecoration = new ControlDecoration( wCombo, SWT.CENTER | SWT.RIGHT, this );
  controlDecoration.setImage( image );
  controlDecoration.setDescriptionText( BaseMessages.getString( PKG, "TextVar.tooltip.InsertVariable" ) );

  // props.setLook(wText);
  modifyListenerTooltipText = getModifyListenerTooltipText( wCombo );
  wCombo.addModifyListener( modifyListenerTooltipText );

  // SelectionAdapter lsVar = null;
  // VariableButtonListenerFactory.getSelectionAdapter(this, wText, getCaretPositionInterface,
  // insertTextInterface, variables);
  // wText.addKeyListener(getControlSpaceKeyListener(variables, wText, lsVar, getCaretPositionInterface,
  // insertTextInterface));

  controlSpaceKeyAdapter =
    new ControlSpaceKeyAdapter( variables, wCombo, getCaretPositionInterface, insertTextInterface );
  wCombo.addKeyListener( controlSpaceKeyAdapter );

  FormData fdText = new FormData();
  fdText.top = new FormAttachment( 0, 0 );
  fdText.left = new FormAttachment( 0, 0 );
  fdText.right = new FormAttachment( 100, -image.getBounds().width );
  wCombo.setLayoutData( fdText );
}
 
Example 9
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 10
Source File: JobExecutorDialog.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, "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( 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 11
Source File: TransExecutorDialog.java    From pentaho-kettle 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, "TransExecutorDialog.ResultRows.Title" ) );
    wTab.setToolTipText( BaseMessages.getString( PKG, "TransExecutorDialog.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, "TransExecutorDialog.OutputRowsSource.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 );

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

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

    int nrRows = ( transExecutorMeta.getOutputRowsField() != null ? transExecutorMeta.getOutputRowsField().length : 1 );

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

    wOutputFields =
      new TableView( transMeta, 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( wlOutputFields, 5 );
    fdResultFields.right = new FormAttachment( 100, 0 );
    fdResultFields.bottom = new FormAttachment( 100, 0 );
    wOutputFields.setLayoutData( fdResultFields );
    wOutputFields.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 12
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 13
Source File: TransExecutorDialog.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, "TransExecutorDialog.RowGroup.Title" ) );
    wTab.setToolTipText( BaseMessages.getString( PKG, "TransExecutorDialog.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, "TransExecutorDialog.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, "TransExecutorDialog.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, "TransExecutorDialog.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 14
Source File: FormatSpecifierComposite.java    From birt with Eclipse Public License 1.0 4 votes vote down vote up
private void placeComponents( )
{
	GridLayout glDateAdvanced = new GridLayout( );
	glDateAdvanced.verticalSpacing = 5;
	glDateAdvanced.numColumns = 2;
	glDateAdvanced.marginHeight = 2;
	glDateAdvanced.marginWidth = 2;

	GridData gdGRPDateAdvanced = new GridData( GridData.FILL_BOTH );
	this.setLayoutData( gdGRPDateAdvanced );
	this.setLayout( glDateAdvanced );

	lblDatePattern = new Label( this, SWT.NONE );
	GridData gdLBLDatePattern = new GridData( );
	lblDatePattern.setLayoutData( gdLBLDatePattern );
	lblDatePattern.setText( Messages.getString( "FormatSpecifierComposite.Lbl.DatePattern" ) ); //$NON-NLS-1$

	txtDatePattern = new CCombo( this, SWT.BORDER | SWT.SINGLE );
	GridData gdTXTDatePattern = new GridData( GridData.FILL_HORIZONTAL );
	txtDatePattern.setLayoutData( gdTXTDatePattern );
	txtDatePattern.addModifyListener( this );
	
	txtDatePattern.setItems( new String[]{
			"EEEE,MMMM dd,yyyy", //$NON-NLS-1$
			"MM/dd/yy", //$NON-NLS-1$
			"dd-MMM-yy", //$NON-NLS-1$
			"LLL,yyyy", //$NON-NLS-1$
			"hh:mm:ss,a", //$NON-NLS-1$
			"HH:mm:ss", //$NON-NLS-1$
			"D,yyyy", //$NON-NLS-1$
			"DDD,yyyy,QQQQ", //$NON-NLS-1$
			"EEE, MMM d, yyyy", //$NON-NLS-1$
			"yyyy.MMMM.dd GGG hh:mm aaa", //$NON-NLS-1$
			"yyyy.MM.dd G 'at' HH:mm:ss zzz", //$NON-NLS-1$
			"w,yyyy", //$NON-NLS-1$
			"W,LLL,yyyy" //$NON-NLS-1$
	} );
	txtDatePattern.setVisibleItemCount( txtDatePattern.getItemCount( ) );
	txtDatePattern.addSelectionListener( new SelectionAdapter( ) {

		@Override
		public void widgetSelected( SelectionEvent e )
		{
			bEnableEvents = false;

			if ( !( formatspecifier instanceof JavaDateFormatSpecifier ) )
			{
				formatspecifier = JavaDateFormatSpecifierImpl.create( "" ); //$NON-NLS-1$
			}
			( (JavaDateFormatSpecifier) formatspecifier ).setPattern( ChartUIUtil.getText( txtDatePattern ) );

			bEnableEvents = true;

			updatePreview( );
		}
	} );
}
 
Example 15
Source File: PipelineExecutorDialog.java    From hop 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, "PipelineExecutorDialog.RowGroup.Title" ) );
    wTab.setToolTipText( BaseMessages.getString( PKG, "PipelineExecutorDialog.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, "PipelineExecutorDialog.GroupSize.Label" ) );
    FormData fdlGroupSize = new FormData();
    fdlGroupSize.top = new FormAttachment( 0, 0 );
    fdlGroupSize.left = new FormAttachment( 0, 0 );
    wlGroupSize.setLayoutData( fdlGroupSize );

    wGroupSize = new TextVar( pipelineMeta, 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, "PipelineExecutorDialog.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, "PipelineExecutorDialog.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( pipelineMeta, 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 16
Source File: TableEditorEx.java    From SWET with MIT License 4 votes vote down vote up
private static void appendRowToTable(Table table, List<String> stepIds) {

		TableItem[] tableItems = table.getItems();
		int cnt = 0;
		for (String stepId : stepIds) {

			// get element data
			TableItem tableItem = tableItems[cnt];
			Map<String, String> elementData = testData.get(stepId);
			String selectorChoice = selectorFromSWD
					.get(elementData.get("ElementSelectedBy"));

			String selectorValue = elementData
					.get(elementData.get("ElementSelectedBy"));

			// Append row into the TableEditor
			tableItem.setText(new String[] { elementData.get("ElementStepNumber"),
					elementData.get("ElementCodeName"), String.format("Action %d", cnt),
					selectorChoice, selectorValue });
			// some columns need to be converted to selects

			TableEditor keywordChoiceEditor = new TableEditor(table);
			CCombo keywordChoiceCombo = new CCombo(table, SWT.NONE);
			keywordChoiceCombo.setText("Choose..");
			for (String keyword : keywordTable.keySet()) {
				keywordChoiceCombo.add(keyword);
			}
			// NOTE: none of options is initially selected
			keywordChoiceEditor.grabHorizontal = true;
			int keywordChoiceColumn = 2;
			keywordChoiceCombo.setData("column", keywordChoiceColumn);
			keywordChoiceCombo.setData("item", tableItem);
			keywordChoiceEditor.setEditor(keywordChoiceCombo, tableItem,
					keywordChoiceColumn);
			keywordChoiceCombo.addModifyListener(new keywordChoiceListener());

			TableEditor selectorChoiceEditor = new TableEditor(table);
			CCombo selectorChoiceCombo = new CCombo(table, SWT.NONE);
			for (String locator : selectorFromSWD.values()) {
				selectorChoiceCombo.add(locator);
			}
			// java.lang.ClassCastException: java.util.LinkedHashMap$LinkedValues
			// cannot be cast to java.util.List
			selectorChoiceCombo.select(new ArrayList<String>(selectorFromSWD.values())
					.indexOf(selectorFromSWD.get(elementData.get("ElementSelectedBy"))));
			selectorChoiceEditor.grabHorizontal = true;
			int selectorChoiceColumn = 3;
			selectorChoiceCombo.setData("item", tableItem);
			selectorChoiceCombo.setData("column", selectorChoiceColumn);
			selectorChoiceEditor.setEditor(selectorChoiceCombo, tableItem,
					selectorChoiceColumn);
			selectorChoiceCombo.addModifyListener(new selectorChoiceListener());
			cnt = cnt + 1;
		}
		return;
	}
 
Example 17
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 18
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 19
Source File: PipelineExecutorDialog.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, "PipelineExecutorDialog.ResultRows.Title" ) );
    wTab.setToolTipText( BaseMessages.getString( PKG, "PipelineExecutorDialog.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, "PipelineExecutorDialog.OutputRowsSource.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 );

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

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

    int nrRows = ( pipelineExecutorMeta.getOutputRowsField() != null ? pipelineExecutorMeta.getOutputRowsField().length : 1 );

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

    wOutputFields =
      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( wlOutputFields, 5 );
    fdResultFields.right = new FormAttachment( 100, 0 );
    fdResultFields.bottom = new FormAttachment( 100, 0 );
    wOutputFields.setLayoutData( fdResultFields );
    wOutputFields.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 20
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 );
  }