Java Code Examples for org.pentaho.di.core.Const#MARGIN

The following examples show how to use org.pentaho.di.core.Const#MARGIN . 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: MailInputDialog.java    From pentaho-kettle with Apache License 2.0 6 votes vote down vote up
private Group createGroup( Composite parentTab, Control top, String label ) {
  Group group = new Group( parentTab, SWT.SHADOW_NONE );
  props.setLook( group );
  group.setText( label );

  FormLayout groupLayout = new FormLayout();
  groupLayout.marginWidth = 10;
  groupLayout.marginHeight = 10;
  group.setLayout( groupLayout );

  FormData fdGroup = new FormData();
  fdGroup.left = new FormAttachment( 0, Const.MARGIN );
  fdGroup.top = new FormAttachment( top, Const.MARGIN );
  fdGroup.right = new FormAttachment( 100, -Const.MARGIN );
  group.setLayoutData( fdGroup );

  return group;
}
 
Example 2
Source File: InfobrightLoaderDialog.java    From pentaho-kettle with Apache License 2.0 6 votes vote down vote up
private FormData standardSpacing( Control control, boolean isLabel ) {
  FormData fd = new FormData();

  if ( isLabel ) {
    fd.left = new FormAttachment( 0, 0 );
  } else {
    fd.left = new FormAttachment( middle, 0 );
  }

  if ( isLabel ) {
    fd.right = new FormAttachment( middle, -Const.MARGIN );
  } else {
    fd.right = new FormAttachment( 100, 0 );
  }

  if ( control != null ) {
    fd.top = new FormAttachment( control, Const.MARGIN + verticalPadding );
  } else {
    fd.top = new FormAttachment( 0, Const.MARGIN + verticalPadding );
  }

  verticalPadding = 0;
  return fd;
}
 
Example 3
Source File: ShowMessageDialog.java    From pentaho-kettle with Apache License 2.0 6 votes vote down vote up
/**
 * Handles any variances in the UI from the default.
 */
private void setLayoutAccordingToType() {
  int margin = Const.MARGIN;
  switch ( type ) {
    case Const.SHOW_MESSAGE_DIALOG_DB_TEST_SUCCESS:
      formLayout.marginWidth = 15;
      formLayout.marginHeight = 15;
      setFdlDesc( margin * 3, 0, 0, margin );
      BaseStepDialog.positionBottomButtons( shell, buttons.toArray( new Button[buttons.size()] ), 0,
        BaseStepDialog.BUTTON_ALIGNMENT_RIGHT, wlDesc );
      break;
    case Const.SHOW_FATAL_ERROR:
      formLayout.marginWidth = 15;
      formLayout.marginHeight = 15;
      setFdlDesc( margin * 3, 0, 0, margin );
      BaseStepDialog.positionBottomButtons( shell, buttons.toArray( new Button[buttons.size()] ), Const.FORM_MARGIN,
        BaseStepDialog.BUTTON_ALIGNMENT_RIGHT, wlDesc );
      break;
    default:
      formLayout.marginWidth = Const.FORM_MARGIN;
      formLayout.marginHeight = Const.FORM_MARGIN;
      setFdlDesc( margin * 2, margin, 0, margin );
      BaseStepDialog.positionBottomButtons( shell, buttons.toArray( new Button[buttons.size()] ), margin, wlDesc );
      break;
  }
}
 
Example 4
Source File: ElasticSearchBulkDialog.java    From pentaho-kettle with Apache License 2.0 5 votes vote down vote up
/**
 */
private void addGeneralTab() {
  wGeneralTab = new CTabItem( wTabFolder, SWT.NONE );
  wGeneralTab.setText( BaseMessages.getString( PKG, "ElasticSearchBulkDialog.General.Tab" ) );

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

  FormLayout generalLayout = new FormLayout();
  generalLayout.marginWidth = 3;
  generalLayout.marginHeight = 3;
  wGeneralComp.setLayout( generalLayout );

  // Index GROUP
  fillIndexGroup( wGeneralComp );

  // Options GROUP
  fillOptionsGroup( wGeneralComp );

  fdGeneralComp = new FormData();
  fdGeneralComp.left = new FormAttachment( 0, 0 );
  fdGeneralComp.top = new FormAttachment( wStepname, Const.MARGIN );
  fdGeneralComp.right = new FormAttachment( 100, 0 );
  fdGeneralComp.bottom = new FormAttachment( 100, 0 );
  wGeneralComp.setLayoutData( fdGeneralComp );

  wGeneralComp.layout();
  wGeneralTab.setControl( wGeneralComp );
}
 
Example 5
Source File: MailInputDialog.java    From pentaho-kettle with Apache License 2.0 5 votes vote down vote up
private void addLabelBelow( Control label, Control widgetAbove ) {
  props.setLook( label );
  FormData fData = new FormData();
  fData.top = new FormAttachment( widgetAbove, Const.MARGIN );
  fData.right = new FormAttachment( Const.MIDDLE_PCT, -Const.MARGIN );
  label.setLayoutData( fData );
}
 
Example 6
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 7
Source File: NumberRangeDialog.java    From pentaho-kettle with Apache License 2.0 5 votes vote down vote up
private Text createLine( 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 );

  Text control = new Text( shell, SWT.SINGLE | SWT.LEFT | 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 8
Source File: IngresVectorwiseLoaderDialog.java    From pentaho-kettle with Apache License 2.0 5 votes vote down vote up
private FormData standardSpacing( Control control, Control centerControl, boolean isLabel ) {
  FormData fd = new FormData();

  if ( isLabel ) {
    fd.left = new FormAttachment( 0, 0 );
  } else {
    fd.left = new FormAttachment( middle, 0 );
  }

  if ( isLabel ) {
    fd.right = new FormAttachment( middle, -Const.MARGIN );
  } else {
    fd.right = new FormAttachment( 100, 0 );
  }

  if ( !isLabel && centerControl != null ) {
    fd.top = new FormAttachment( centerControl, 0, SWT.CENTER );
  } else {
    int extraSpace;
    if ( isLabel ) {
      extraSpace = Const.MARGIN + verticalPadding;
    } else {
      extraSpace = 0;
    }
    if ( control != null ) {
      fd.top = new FormAttachment( control, Const.MARGIN + verticalPadding + extraSpace );
    } else {
      fd.top = new FormAttachment( 0, Const.MARGIN + verticalPadding + extraSpace );
    }
  }

  verticalPadding = 0;
  return fd;
}
 
Example 9
Source File: ElasticSearchBulkDialog.java    From pentaho-kettle with Apache License 2.0 5 votes vote down vote up
private void addWidgetAfter( Control widget, Control widgetAbove, Control widgetLeft ) {
  props.setLook( widget );
  FormData fData = new FormData();
  fData.left = new FormAttachment( widgetLeft, Const.MARGIN );
  fData.top = new FormAttachment( widgetAbove, Const.MARGIN );
  fData.right = new FormAttachment( 100, -Const.MARGIN );
  widget.setLayoutData( fData );
}
 
Example 10
Source File: CreateDatabaseWizardPageInformix.java    From pentaho-kettle with Apache License 2.0 5 votes vote down vote up
public void createControl( Composite parent ) {
  int margin = Const.MARGIN;
  int middle = props.getMiddlePct();

  // create the composite to hold the widgets
  Composite composite = new Composite( parent, SWT.NONE );
  props.setLook( composite );

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

  wlServername = new Label( composite, SWT.RIGHT );
  wlServername.setText( BaseMessages.getString( PKG, "CreateDatabaseWizardPageInformix.Servername.Label" ) );
  props.setLook( wlServername );
  fdlServername = new FormData();
  fdlServername.top = new FormAttachment( 0, 0 );
  fdlServername.left = new FormAttachment( 0, 0 );
  fdlServername.right = new FormAttachment( middle, 0 );
  wlServername.setLayoutData( fdlServername );

  wServername = new Text( composite, SWT.SINGLE | SWT.BORDER );
  props.setLook( wServername );
  fdServername = new FormData();
  fdServername.top = new FormAttachment( 0, 0 );
  fdServername.left = new FormAttachment( middle, margin );
  fdServername.right = new FormAttachment( 100, 0 );
  wServername.setLayoutData( fdServername );
  wServername.addModifyListener( new ModifyListener() {
    public void modifyText( ModifyEvent arg0 ) {
      setPageComplete( false );
    }
  } );

  // set the composite as the control for this page
  setControl( composite );
}
 
Example 11
Source File: LabelTimeComposite.java    From pentaho-kettle with Apache License 2.0 4 votes vote down vote up
public LabelTimeComposite( Composite composite, String labelText, String toolTipText ) {
  super( composite, SWT.NONE );
  props.setLook( this );

  int middle = props.getMiddlePct();
  int threeQuarters = ( middle + 100 ) / 2;
  int margin = Const.MARGIN;

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

  this.setLayout( formLayout );

  wText = new Text( this, SWT.SINGLE | SWT.LEFT | SWT.BORDER );
  FormData fdText = new FormData();
  fdText.left = new FormAttachment( middle, margin );
  fdText.right = new FormAttachment( threeQuarters, 0 );
  wText.setLayoutData( fdText );
  wText.setToolTipText( toolTipText );

  wTimeUnit = new CCombo( this, SWT.SINGLE | SWT.DROP_DOWN | SWT.BORDER | SWT.LEFT );
  FormData fdCombo = new FormData();
  fdCombo.left = new FormAttachment( threeQuarters, margin );
  fdCombo.right = new FormAttachment( 100, 0 );
  wTimeUnit.setEditable( false );
  wTimeUnit.setLayoutData( fdCombo );
  wTimeUnit.setItems( getTimeUnits() );
  wTimeUnit.setToolTipText( toolTipText );

  wLabel = new Label( this, SWT.RIGHT );
  props.setLook( wLabel );
  wLabel.setText( labelText );
  FormData fdLabel = new FormData();
  fdLabel.left = new FormAttachment( 0, 0 );
  fdLabel.right = new FormAttachment( middle, 0 );
  fdLabel.top = new FormAttachment( wText, 0, SWT.CENTER );
  wLabel.setLayoutData( fdLabel );
  wLabel.setToolTipText( toolTipText );

  wText.addModifyListener( new ModifyListener() {
    public void modifyText( ModifyEvent e ) {
      if ( !StringUtils.isNumeric( wText.getText() ) ) {
        wText.setText( lastValidValue );
      } else {
        lastValidValue = wText.getText();
      }
    }
  } );
}
 
Example 12
Source File: LabelText.java    From pentaho-kettle with Apache License 2.0 4 votes vote down vote up
public LabelText( Composite composite, String labelText, String toolTipText ) {
  this(
    composite, SWT.SINGLE | SWT.LEFT | SWT.BORDER, labelText, toolTipText, props.getMiddlePct(), Const.MARGIN );
}
 
Example 13
Source File: TransDialog.java    From pentaho-kettle with Apache License 2.0 4 votes vote down vote up
private void addParamTab() {
  // ////////////////////////
  // START OF PARAM TAB
  // /
  wParamTab = new CTabItem( wTabFolder, SWT.NONE );
  wParamTab.setText( BaseMessages.getString( PKG, "TransDialog.ParamTab.Label" ) );

  FormLayout paramLayout = new FormLayout();
  paramLayout.marginWidth = Const.MARGIN;
  paramLayout.marginHeight = Const.MARGIN;

  Composite wParamComp = new Composite( wTabFolder, SWT.NONE );
  props.setLook( wParamComp );
  wParamComp.setLayout( paramLayout );

  Label wlFields = new Label( wParamComp, SWT.RIGHT );
  wlFields.setText( BaseMessages.getString( PKG, "TransDialog.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 FieldsCols = 3;
  final int FieldsRows = transMeta.listParameters().length;

  ColumnInfo[] colinf = new ColumnInfo[FieldsCols];
  colinf[0] =
    new ColumnInfo(
      BaseMessages.getString( PKG, "TransDialog.ColumnInfo.Parameter.Label" ), ColumnInfo.COLUMN_TYPE_TEXT,
      false );
  colinf[1] =
    new ColumnInfo(
      BaseMessages.getString( PKG, "TransDialog.ColumnInfo.Default.Label" ), ColumnInfo.COLUMN_TYPE_TEXT,
      false );
  colinf[2] =
    new ColumnInfo(
      BaseMessages.getString( PKG, "TransDialog.ColumnInfo.Description.Label" ),
      ColumnInfo.COLUMN_TYPE_TEXT, false );

  wParamFields =
    new TableView(
      transMeta, wParamComp, 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 );
  wParamFields.setLayoutData( fdFields );

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

  wParamComp.layout();
  wParamTab.setControl( wParamComp );

  // ///////////////////////////////////////////////////////////
  // / END OF PARAM TAB
  // ///////////////////////////////////////////////////////////
}
 
Example 14
Source File: TransDialog.java    From pentaho-kettle with Apache License 2.0 4 votes vote down vote up
private void addDepTab() {
  // ////////////////////////
  // START OF Dep TAB///
  // /
  wDepTab = new CTabItem( wTabFolder, SWT.NONE );
  wDepTab.setText( BaseMessages.getString( PKG, "TransDialog.DepTab.Label" ) );

  FormLayout DepLayout = new FormLayout();
  DepLayout.marginWidth = Const.MARGIN;
  DepLayout.marginHeight = Const.MARGIN;

  Composite wDepComp = new Composite( wTabFolder, SWT.NONE );
  props.setLook( wDepComp );
  wDepComp.setLayout( DepLayout );

  Label wlFields = new Label( wDepComp, SWT.RIGHT );
  wlFields.setText( BaseMessages.getString( PKG, "TransDialog.Fields.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 FieldsCols = 3;
  final int FieldsRows = transMeta.nrDependencies();

  ColumnInfo[] colinf = new ColumnInfo[FieldsCols];
  colinf[0] =
    new ColumnInfo(
      BaseMessages.getString( PKG, "TransDialog.ColumnInfo.Connection.Label" ),
      ColumnInfo.COLUMN_TYPE_CCOMBO, connectionNames );
  colinf[1] =
    new ColumnInfo(
      BaseMessages.getString( PKG, "TransDialog.ColumnInfo.Table.Label" ), ColumnInfo.COLUMN_TYPE_TEXT,
      false );
  colinf[2] =
    new ColumnInfo(
      BaseMessages.getString( PKG, "TransDialog.ColumnInfo.Field.Label" ), ColumnInfo.COLUMN_TYPE_TEXT,
      false );

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

  wGet = new Button( wDepComp, SWT.PUSH );
  wGet.setText( BaseMessages.getString( PKG, "TransDialog.GetDependenciesButton.Label" ) );

  fdGet = new FormData();
  fdGet.bottom = new FormAttachment( 100, 0 );
  fdGet.left = new FormAttachment( 50, 0 );
  wGet.setLayoutData( fdGet );

  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( wGet, 0 );
  wFields.setLayoutData( fdFields );

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

  wDepComp.layout();
  wDepTab.setControl( wDepComp );

  // ///////////////////////////////////////////////////////////
  // / END OF DEP TAB
  // ///////////////////////////////////////////////////////////
}
 
Example 15
Source File: CheckBoxVar.java    From pentaho-kettle with Apache License 2.0 4 votes vote down vote up
public CheckBoxVar( final VariableSpace space, final Composite composite, int flags, String variable ) {
  super( composite, SWT.NONE );

  props.setLook( this );

  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...
  wBox = new Button( this, flags );
  props.setLook( wBox );
  wText = new TextVar( space, this, flags | SWT.NO_BACKGROUND );
  wText.getTextWidget().setForeground( GUIResource.getInstance().getColorRed() ); // Put it in a red color to make it
                                                                                  // shine...
  wText.getTextWidget().setBackground( composite.getBackground() ); // make it blend in with the rest...

  setVariableOnCheckBox( variable );

  controlDecoration = new ControlDecoration( wBox, SWT.CENTER | SWT.LEFT );
  Image image = GUIResource.getInstance().getImageVariable();
  controlDecoration.setImage( image );
  controlDecoration.setDescriptionText( BaseMessages.getString( PKG, "CheckBoxVar.tooltip.InsertVariable" ) );
  controlDecoration.addSelectionListener( new SelectionAdapter() {

    @Override
    public void widgetSelected( SelectionEvent arg0 ) {
      String variableName = VariableButtonListenerFactory.getVariableName( composite.getShell(), space );
      if ( variableName != null ) {
        setVariableOnCheckBox( "${" + variableName + "}" );
      }
    }
  } );

  FormData fdBox = new FormData();
  fdBox.top = new FormAttachment( 0, 0 );
  fdBox.left = new FormAttachment( 0, image.getBounds().width );
  wBox.setLayoutData( fdBox );

  FormData fdText = new FormData();
  fdText.top = new FormAttachment( 0, 0 );
  fdText.left = new FormAttachment( wBox, Const.MARGIN );
  fdText.right = new FormAttachment( 100, 0 );
  wText.setLayoutData( fdText );
}
 
Example 16
Source File: LabelTextVar.java    From pentaho-kettle with Apache License 2.0 4 votes vote down vote up
public LabelTextVar( VariableSpace space, Composite composite, int flags, String labelText, String toolTipText,
    boolean passwordField ) {
  super( composite, SWT.NONE );
  props.setLook( this );

  int middle = props.getMiddlePct();
  int margin = Const.MARGIN;

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

  this.setLayout( formLayout );

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

  if ( passwordField ) {
    wText = new PasswordTextVar( space, this, textFlags, toolTipText );
  } else {
    wText = new TextVar( space, this, textFlags, toolTipText );
  }
  FormData fdText = new FormData();
  fdText.left = new FormAttachment( middle, margin );
  fdText.right = new FormAttachment( 100, 0 );
  wText.setLayoutData( fdText );
  wText.getTextWidget().setToolTipText( toolTipText );

  wLabel = new Label( this, SWT.RIGHT );
  props.setLook( wLabel );
  wLabel.setText( labelText );
  FormData fdLabel = new FormData();
  fdLabel.left = new FormAttachment( 0, 0 );
  fdLabel.right = new FormAttachment( middle, 0 );
  fdLabel.top = new FormAttachment( wText, 0, SWT.CENTER );
  wLabel.setLayoutData( fdLabel );
  wLabel.setToolTipText( toolTipText );
}
 
Example 17
Source File: CiviOutputDialog.java    From civicrm-data-integration with GNU General Public License v3.0 4 votes vote down vote up
public String open() {
    Shell parent = getParent();
    Display display = parent.getDisplay();

    shell = new Shell(parent, SWT.DIALOG_TRIM | SWT.RESIZE | SWT.MIN | SWT.MAX);
    props.setLook(shell);
    setShellImage(shell, (CiviOutputMeta) input);

    lsMod = new ModifyListener() {
        public void modifyText(ModifyEvent e) {
            ((CiviOutputMeta) input).setChanged();
        }
    };
    backupChanged = ((CiviOutputMeta) input).hasChanged();

    FormLayout formLayout = new FormLayout();
    formLayout.marginWidth = Const.FORM_MARGIN;
    formLayout.marginHeight = Const.FORM_MARGIN;

    shell.setLayout(formLayout);
    shell.setText(BaseMessages.getString(PKG, "CiviCrmDialog.Shell.Output.Title"));

    middle = props.getMiddlePct();
    margin = Const.MARGIN;

    /*************************************************
     * STEP NAME ENTRY
     *************************************************/

    // Stepname line
    wlStepname = new Label(shell, SWT.RIGHT);
    wlStepname.setText(BaseMessages.getString(PKG, "System.Label.StepName"));
    props.setLook(wlStepname);
    fdlStepname = new FormData();
    fdlStepname.left = new FormAttachment(0, 0);
    fdlStepname.right = new FormAttachment(middle, -margin);
    fdlStepname.top = new FormAttachment(0, margin);
    wlStepname.setLayoutData(fdlStepname);

    wStepname = new Text(shell, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
    wStepname.setText(stepname);
    props.setLook(wStepname);
    wStepname.addModifyListener(lsMod);
    fdStepname = new FormData();
    fdStepname.left = new FormAttachment(middle, 0);
    fdStepname.top = new FormAttachment(0, margin);
    fdStepname.right = new FormAttachment(100, 0);
    wStepname.setLayoutData(fdStepname);

    addOkCancelButtons();
    addConnectionTab();
    addEntityGroup();
    addOutputTab();

    // wGetInputFields.addListener(SWT.Selection, lsGetInputFields);
    /*************************************************
     * // DEFAULT ACTION LISTENERS
     *************************************************/

    lsDef = new SelectionAdapter() {
        public void widgetDefaultSelected(SelectionEvent e) {
            ok();
        }
    };
    // Detect X or ALT-F4 or something that kills this window...
    shell.addShellListener(new ShellAdapter() {
        public void shellClosed(ShellEvent e) {
            cancel();
        }
    });

    // Set the shell size, based upon previous time...
    setSize();

    /*************************************************
     * // POPULATE AND OPEN DIALOG
     *************************************************/

    getData();
    ((CiviOutputMeta) input).setChanged(backupChanged);

    shell.open();
    while (!shell.isDisposed()) {
        if (!display.readAndDispatch())
            display.sleep();
    }
    return stepname;
}
 
Example 18
Source File: CiviInputDialog.java    From civicrm-data-integration with GNU General Public License v3.0 4 votes vote down vote up
public String open() {
        Shell parent = getParent();
        Display display = parent.getDisplay();

        shell = new Shell(parent, SWT.DIALOG_TRIM | SWT.RESIZE | SWT.MIN | SWT.MAX);
        props.setLook(shell);
        setShellImage(shell, (StepMetaInterface) input);

        lsMod = new ModifyListener() {
            public void modifyText(ModifyEvent e) {
                ((CiviInputMeta) input).setChanged();
            }
        };
        backupChanged = ((CiviInputMeta) input).hasChanged();

        FormLayout formLayout = new FormLayout();
        formLayout.marginWidth = Const.FORM_MARGIN;
        formLayout.marginHeight = Const.FORM_MARGIN;

        shell.setLayout(formLayout);
        shell.setText(BaseMessages.getString(PKG, "CiviCrmDialog.Shell.Input.Title"));

        middle = props.getMiddlePct();
        margin = Const.MARGIN;

        /*************************************************
         * // STEP NAME ENTRY
         *************************************************/

        wlStepname = new Label(shell, SWT.RIGHT);
        wlStepname.setText(BaseMessages.getString(PKG, "System.Label.StepName"));
        props.setLook(wlStepname);
        fdlStepname = new FormData();
        fdlStepname.left = new FormAttachment(0, 0);
        fdlStepname.right = new FormAttachment(middle, -margin);
        fdlStepname.top = new FormAttachment(0, margin);
        wlStepname.setLayoutData(fdlStepname);

        wStepname = new Text(shell, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
        wStepname.setText(stepname);
        props.setLook(wStepname);
        wStepname.addModifyListener(lsMod);
        fdStepname = new FormData();
        fdStepname.left = new FormAttachment(middle, 0);
        fdStepname.top = new FormAttachment(0, margin);
        fdStepname.right = new FormAttachment(100, 0);
        wStepname.setLayoutData(fdStepname);

        addOKCancelButtons();
        addConnectionTab();
        addEntityGroup();
        addOutputTab();

//        wCiviCrmRestUrl.setText("${REST_URL}");
//        wCiviCrmSiteKey.setText("${SITE_KEY}");
//        wCiviCrmApiKey.setText("${API_KEY}");

        /*************************************************
         * // DEFAULT ACTION LISTENERS
         *************************************************/


        lsDef = new SelectionAdapter() {
            public void widgetDefaultSelected(SelectionEvent e) {
                ok();
            }
        };

        wStepname.addSelectionListener(lsDef);
        wCiviCrmRestUrl.addSelectionListener(lsDef);
        wCiviCrmRestUrl.addSelectionListener(lsDef);
        wCiviCrmSiteKey.addSelectionListener(lsDef);
        wCiviCrmEntity.addSelectionListener(lsDef);

        // Detect X or ALT-F4 or something that kills this window...
        shell.addShellListener(new ShellAdapter() {
            public void shellClosed(ShellEvent e) {
                cancel();
            }
        });

        // Set the shell size, based upon previous time...
        setSize();

        /*************************************************
         * // POPULATE AND OPEN DIALOG
         *************************************************/

        getData();
        // setComboValues();

        ((CiviInputMeta) input).setChanged(backupChanged);

        shell.open();
        while (!shell.isDisposed()) {
            if (!display.readAndDispatch())
                display.sleep();
        }
        return stepname;
    }
 
Example 19
Source File: DimensionTableDialog.java    From pentaho-kettle with Apache License 2.0 4 votes vote down vote up
private void addAttributesTab()
{
    wTablesTab=new CTabItem(wTabFolder, SWT.NONE);
    wTablesTab.setText(BaseMessages.getString(PKG, "DimensionTableDialog.AttributesTab.Label"));

    FormLayout paramLayout = new FormLayout ();
    paramLayout.marginWidth  = Const.MARGIN;
    paramLayout.marginHeight = Const.MARGIN;

    Composite wTablesComp = new Composite(wTabFolder, SWT.NONE);
    props.setLook(wTablesComp);
    wTablesComp.setLayout(paramLayout);

    Button wAddDefaultFields = new Button(wTablesComp, SWT.PUSH);
    wAddDefaultFields.setText(BaseMessages.getString(PKG, "DimensionTableDialog.AddDefaultFieldsButton.Label"));
    BaseStepDialog.positionBottomButtons(wTablesComp, new Button[] { wAddDefaultFields, }, margin, null);
    wAddDefaultFields.addSelectionListener(new SelectionAdapter() {  public void widgetSelected(SelectionEvent e) { addDefaultAttributes(); }});

    Label wlAtrributes = new Label(wTablesComp, SWT.RIGHT);
    wlAtrributes.setText(BaseMessages.getString(PKG, "DimensionTableDialog.Attributes.Label"));
    props.setLook(wlAtrributes);
    FormData fdlAttributes = new FormData();
    fdlAttributes.left = new FormAttachment(0, 0);
    fdlAttributes.top  = new FormAttachment(0, 0);
    wlAtrributes.setLayoutData(fdlAttributes);

    final int FieldsRows=logicalTable.getLogicalColumns().size();

    List<DatabaseMeta> sharedDatabases= SharedDatabaseUtil.loadSharedDatabases();
    String[] databaseNames = SharedDatabaseUtil.getSortedDatabaseNames(sharedDatabases);

    // data types
    //
    String[] dataTypes = new String[DataType.values().length];
    for (int i=0;i<dataTypes.length;i++) {
      dataTypes[i] = DataType.values()[i].name();
    }

    // field types
    //
    String[] attributeTypes = new String[AttributeType.values().length];
    for (int i=0;i<AttributeType.values().length;i++) {
      attributeTypes[i] = AttributeType.values()[i].name();
    }


    //  name, description, field type, physical column name, data type, length, precision, source db, source table, source column, conversion remarks
    //
    ColumnInfo[] colinf=new ColumnInfo[] {
        new ColumnInfo(BaseMessages.getString(PKG, "DimensionTableDialog.ColumnInfo.Name.Label"), ColumnInfo.COLUMN_TYPE_TEXT,   false),
        new ColumnInfo(BaseMessages.getString(PKG, "DimensionTableDialog.ColumnInfo.Description.Label"), ColumnInfo.COLUMN_TYPE_TEXT,   false),
        new ColumnInfo(BaseMessages.getString(PKG, "DimensionTableDialog.ColumnInfo.FieldType.Label"), ColumnInfo.COLUMN_TYPE_CCOMBO, attributeTypes),
        new ColumnInfo(BaseMessages.getString(PKG, "DimensionTableDialog.ColumnInfo.PhysicalName.Label"), ColumnInfo.COLUMN_TYPE_TEXT,   false),
        new ColumnInfo(BaseMessages.getString(PKG, "DimensionTableDialog.ColumnInfo.DataType.Label"), ColumnInfo.COLUMN_TYPE_CCOMBO, dataTypes),
        new ColumnInfo(BaseMessages.getString(PKG, "DimensionTableDialog.ColumnInfo.DataLength.Label"), ColumnInfo.COLUMN_TYPE_TEXT,   true),
        new ColumnInfo(BaseMessages.getString(PKG, "DimensionTableDialog.ColumnInfo.DataPrecision.Label"), ColumnInfo.COLUMN_TYPE_TEXT,   true),
        new ColumnInfo(BaseMessages.getString(PKG, "DimensionTableDialog.ColumnInfo.SourceDatabase.Label"), ColumnInfo.COLUMN_TYPE_CCOMBO, databaseNames),
        new ColumnInfo(BaseMessages.getString(PKG, "DimensionTableDialog.ColumnInfo.SourceTable.Label"), ColumnInfo.COLUMN_TYPE_TEXT,   false),
        new ColumnInfo(BaseMessages.getString(PKG, "DimensionTableDialog.ColumnInfo.SourceColumn.Label"), ColumnInfo.COLUMN_TYPE_TEXT,   false),
        new ColumnInfo(BaseMessages.getString(PKG, "DimensionTableDialog.ColumnInfo.ConversionLogicRemarks.Label"), ColumnInfo.COLUMN_TYPE_TEXT,   false),
    };

    wAttributes=new TableView(new Variables(), wTablesComp,
                          SWT.BORDER | SWT.FULL_SELECTION | SWT.MULTI,
                          colinf,
                          FieldsRows,
                          null,
                          props
                          );

    FormData fdTables = new FormData();
    fdTables.left  = new FormAttachment(0, 0);
    fdTables.top   = new FormAttachment(wlAtrributes, margin);
    fdTables.right = new FormAttachment(100, 0);
    fdTables.bottom= new FormAttachment(wAddDefaultFields, -margin*2);
    wAttributes.setLayoutData(fdTables);

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

    wTablesComp.layout();
    wTablesTab.setControl(wTablesComp);
}
 
Example 20
Source File: ElasticSearchBulkDialog.java    From pentaho-kettle with Apache License 2.0 4 votes vote down vote up
private void addServersTab() {
  wServersTab = new CTabItem( wTabFolder, SWT.NONE );
  wServersTab.setText( BaseMessages.getString( PKG, "ElasticSearchBulkDialog.ServersTab.TabTitle" ) );

  FormLayout serversLayout = new FormLayout();
  serversLayout.marginWidth = Const.FORM_MARGIN;
  serversLayout.marginHeight = Const.FORM_MARGIN;

  Composite wServersComp = new Composite( wTabFolder, SWT.NONE );
  wServersComp.setLayout( serversLayout );
  props.setLook( wServersComp );

  // Test button
  wTestCl = new Button( wServersComp, SWT.PUSH );
  wTestCl.setText( BaseMessages.getString( PKG, "ElasticSearchBulkDialog.TestCluster.Label" ) );
  wTestCl.setToolTipText( BaseMessages.getString( PKG, "ElasticSearchBulkDialog.TestCluster.Tooltip" ) );

  wTestCl.addListener( SWT.Selection, new Listener() {

    public void handleEvent( Event arg0 ) {
      test( TestType.CLUSTER );
    }
  } );

  setButtonPositions( new Button[]{wTestCl}, Const.MARGIN, null );

  ColumnInfo[] columnsMeta = new ColumnInfo[2];
  columnsMeta[0] =
          new ColumnInfo( BaseMessages.getString( PKG, "ElasticSearchBulkDialog.ServersTab.Address.Column" ),
                  ColumnInfo.COLUMN_TYPE_TEXT, false );
  columnsMeta[0].setUsingVariables( true );
  columnsMeta[1] =
          new ColumnInfo( BaseMessages.getString( PKG, "ElasticSearchBulkDialog.ServersTab.Port.Column" ),
                  ColumnInfo.COLUMN_TYPE_TEXT, true );

  wServers =
          new TableView( transMeta, wServersComp, SWT.BORDER | SWT.FULL_SELECTION | SWT.MULTI, columnsMeta, 1, lsMod,
                  props );
  FormData fdServers = new FormData();
  fdServers.left = new FormAttachment( 0, Const.MARGIN );
  fdServers.top = new FormAttachment( 0, Const.MARGIN );
  fdServers.right = new FormAttachment( 100, -Const.MARGIN );
  fdServers.bottom = new FormAttachment( wTestCl, -Const.MARGIN );
  wServers.setLayoutData( fdServers );

  FormData fdServersComp = new FormData();
  fdServersComp.left = new FormAttachment( 0, 0 );
  fdServersComp.top = new FormAttachment( 0, 0 );
  fdServersComp.right = new FormAttachment( 100, 0 );
  fdServersComp.bottom = new FormAttachment( 100, 0 );
  wServersComp.setLayoutData( fdServersComp );
  wServersComp.layout();
  wServersTab.setControl( wServersComp );
}