Java Code Examples for org.eclipse.swt.widgets.Composite#layout()

The following examples show how to use org.eclipse.swt.widgets.Composite#layout() . 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: LamiViewerControl.java    From tracecompass with Eclipse Public License 2.0 6 votes vote down vote up
/**
 * Build a new control for a Lami table viewer.
 *
 * @param parent
 *            The parent composite
 * @param page
 *            The {@link LamiReportViewTabPage} page parent
 */
public LamiViewerControl(Composite parent, LamiReportViewTabPage page) {
    fToggleAction = new Action() {
        @Override
        public void run() {
            TmfViewer viewer = fViewer;
            if (viewer == null) {
                fViewer = LamiTableViewer.createLamiTable(parent, page);
            } else {
                viewer.dispose();
                fViewer = null;
            }
            parent.layout();
        }
    };
    fToggleAction.setText(Messages.LamiReportView_ActivateTableAction_ButtonName);
    fToggleAction.setToolTipText(Messages.LamiReportView_ActivateTableAction_ButtonTooltip);
    fToggleAction.setImageDescriptor(Activator.getDefault().getImageDescripterFromPath("icons/table.gif")); //$NON-NLS-1$
}
 
Example 2
Source File: DataSetBindingSelectorPage.java    From birt with Eclipse Public License 1.0 6 votes vote down vote up
public void createControl( Composite parent )
{
	Composite pageComp = new Composite( parent, SWT.NONE );
	GridLayout pageCompLayout = new GridLayout( );
	pageCompLayout.marginWidth = 0;
	pageCompLayout.marginHeight = 0;
	pageComp.setLayout( pageCompLayout );
	pageComp.setLayoutData( new GridData( GridData.VERTICAL_ALIGN_FILL
			| GridData.GRAB_VERTICAL
			| GridData.HORIZONTAL_ALIGN_FILL
			| GridData.GRAB_HORIZONTAL ) );

	UIUtil.bindHelp( pageComp,
			IHelpContextIds.SELECT_DATASET_BINDING_COLUMN );

	pageComp.layout( );

	selector = new DataSetBindingSelector( UIUtil.getDefaultShell( ),
			Messages.getString( "DataSetBindingSelectorPage.Title" ) ); //$NON-NLS-1$
	Control control = selector.createDialogArea( pageComp );
	control.setLayoutData( new GridData( GridData.FILL_BOTH ) );
	setControl( pageComp );
}
 
Example 3
Source File: ViewFilterDialog.java    From tracecompass with Eclipse Public License 2.0 6 votes vote down vote up
private void createCLabels(Composite parent, Composite labels, String currentRegex) {
    CLabel filter = new CLabel(labels, SWT.BORDER);
    filter.setText(currentRegex);
    filter.setImage(PlatformUI.getWorkbench().getSharedImages().getImage(ISharedImages.IMG_TOOL_DELETE));
    filter.setBackground(fColorScheme.getColor(TimeGraphColorScheme.TOOL_BACKGROUND));
    filter.addMouseListener(new MouseAdapter() {
        @Override
        public void mouseDown(MouseEvent e2) {
            deleteCLabel(parent, filter, e2);
        }
    });

    parent.layout();
    Rectangle bounds = parent.getShell().getBounds();
    Point size = parent.computeSize(SWT.DEFAULT, SWT.DEFAULT);
    Rectangle trim = parent.getShell().computeTrim(0, 0, size.x, size.y);
    parent.getShell().setBounds(bounds.x + bounds.width - trim.width, bounds.y + bounds.height - trim.height, trim.width, trim.height);
}
 
Example 4
Source File: XLFEditor.java    From tmxeditor8 with GNU General Public License v2.0 6 votes vote down vote up
@Override
public void createPartControl(Composite parent) {
	initColors(parent);

	GridLayout glParent = new GridLayout(1, false);
	glParent.horizontalSpacing = 0;
	glParent.verticalSpacing = 0;
	glParent.marginHeight = 0;
	glParent.marginWidth = 0;
	parent.setLayout(glParent);
	GridData gdParent = new GridData(GridData.FILL_BOTH);
	gdParent.grabExcessVerticalSpace = true;
	gdParent.grabExcessHorizontalSpace = true;
	parent.setLayoutData(gdParent);

	createFilterPart(parent);
	createEditorPart(parent);
	parent.layout();
}
 
Example 5
Source File: ExpandableItemsView.java    From gama with GNU General Public License v3.0 5 votes vote down vote up
protected ParameterExpandItem createItem(final Composite parent, final String name, final T data,
		final Composite control, final ParameterExpandBar bar, final boolean expanded, final GamaUIColor color) {
	final ParameterExpandItem i = buildConcreteItem(bar, data, color);
	if (name != null) {
		i.setText(name);
	}
	control.pack(true);
	control.layout();
	control.setBackground(bar.getBackground());
	i.setControl(control);
	i.setHeight(control.computeSize(SWT.DEFAULT, SWT.DEFAULT).y);
	i.setExpanded(expanded);
	parent.layout(true, true);
	return i;
}
 
Example 6
Source File: WSO2UIToolkit.java    From developer-studio with Apache License 2.0 5 votes vote down vote up
public static void layout(final Composite container) {
	Composite parentLayout = container;
	while (parentLayout != null) {
		parentLayout.layout();
		parentLayout = parentLayout.getParent();
	}
}
 
Example 7
Source File: WidgetMessageDecorator.java    From bonita-studio with GNU General Public License v2.0 5 votes vote down vote up
protected void updateExpandState() {
    Composite parent = composite.getParent().getParent();
    ExpandableComposite expandableComposite = (ExpandableComposite) composite;
    if (messageLabel.getText() != null && !messageLabel.getText().isEmpty()) {
        expandableComposite.setClient(messageLabel);
        expandableComposite.setExpanded(true);
        expandableComposite.pack();
    } else {
        expandableComposite.setExpanded(false);
    }
    parent.layout();
}
 
Example 8
Source File: LanguageConfigurationPreferencePage.java    From tm4e with Eclipse Public License 1.0 5 votes vote down vote up
@Override
protected Control createContents(Composite ancestor) {
	Composite parent = new Composite(ancestor, SWT.NONE);
	GridLayout layout = new GridLayout();
	layout.numColumns = 2;
	layout.marginHeight = 0;
	layout.marginWidth = 0;
	parent.setLayout(layout);

	Composite innerParent = new Composite(parent, SWT.NONE);
	GridLayout innerLayout = new GridLayout();
	innerLayout.numColumns = 2;
	innerLayout.marginHeight = 0;
	innerLayout.marginWidth = 0;
	innerParent.setLayout(innerLayout);
	GridData gd = new GridData(GridData.FILL_BOTH);
	gd.horizontalSpan = 2;
	innerParent.setLayoutData(gd);

	createDefinitionsListContent(parent);

	definitionViewer.setInput(manager);

	infoWidget = new LanguageConfigurationPreferencesWidget(parent, SWT.NONE);
	GridData data = new GridData(GridData.FILL_HORIZONTAL);
	data.horizontalSpan = 2;
	infoWidget.setLayoutData(data);

	Dialog.applyDialogFont(parent);
	innerParent.layout();

	return parent;

}
 
Example 9
Source File: SDView.java    From tracecompass with Eclipse Public License 2.0 5 votes vote down vote up
@Override
public void createPartControl(Composite c) {
    Composite parent = new Composite(c, SWT.NONE);
    GridLayout parentLayout = new GridLayout();
    parentLayout.numColumns = 2;
    parentLayout.marginWidth = 0;
    parentLayout.marginHeight = 0;
    parent.setLayout(parentLayout);

    GridData timeLayoutdata = new GridData(GridData.GRAB_VERTICAL | GridData.VERTICAL_ALIGN_FILL);
    timeLayoutdata.widthHint = 10;
    GridData seqDiagLayoutData = new GridData(GridData.HORIZONTAL_ALIGN_FILL | GridData.GRAB_HORIZONTAL | GridData.GRAB_VERTICAL | GridData.VERTICAL_ALIGN_FILL);
    fTimeCompressionBar = new TimeCompressionBar(parent, SWT.NONE);
    fTimeCompressionBar.setLayoutData(timeLayoutdata);
    fSdWidget = new SDWidget(parent, SWT.NONE);
    fSdWidget.setLayoutData(seqDiagLayoutData);
    fSdWidget.setSite(this);
    fSdWidget.setTimeBar(fTimeCompressionBar);

    // Add this view to the key bindings manager
    KeyBindingsManager.getInstance().add(this.getSite().getId());

    createCoolbarContent();

    hookContextMenu();

    fTimeCompressionBar.setVisible(false);
    parent.layout(true);

    fPrintActionHandler = new ActionHandler(new Print(this));
    getSite().getPage().addPartListener(this);

    fNeedInit = restoreLoader();
}
 
Example 10
Source File: EigenartikelDetailDisplay.java    From elexis-3-core with Eclipse Public License 1.0 5 votes vote down vote up
/**
 * @wbp.parser.entryPoint
 */
@Override
public Composite createDisplay(Composite parent, IViewSite site){
	this.site = site;
	
	container = new Composite(parent, SWT.NONE);
	// 		parent.setLayoutData(new GridData(GridData.FILL_BOTH));
		layout = new StackLayout();
		container.setLayout(layout);
	
	compProduct = new Composite(container, SWT.None);		
	compProduct.setLayout(new GridLayout(1, false));
	
	ToolBar toolBar = new ToolBar(compProduct, SWT.BORDER | SWT.FLAT | SWT.RIGHT);
	toolBar.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1));
	final ToolBarManager manager = new ToolBarManager(toolBar);
	manager.add(createAction);
	if (LocalLockServiceHolder.get().getStatus() != Status.STANDALONE) {
		manager.add(toggleLockAction);
	}
	manager.add(deleteAction);
	manager.update(true);
	toolBar.pack();
	
	epc = new EigenartikelProductComposite(compProduct, SWT.None);
	epc.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 1, 1));
	epc.setUnlocked(LocalLockServiceHolder.get().getStatus() == Status.STANDALONE);
	
	compArticle = new Composite(container, SWT.None);		
	compArticle.setLayout(new GridLayout(1, false));
	
	ec = new EigenartikelComposite(compArticle, SWT.None, false, null);
	ec.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 1, 1));
	ec.setUnlocked(LocalLockServiceHolder.get().getStatus() == Status.STANDALONE);
	
	layout.topControl = compProduct;
	container.layout();
	
	return container;
}
 
Example 11
Source File: TermBaseSearchDialog.java    From translationstudio8 with GNU General Public License v2.0 4 votes vote down vote up
protected void createButtonsForButtonBar(Composite parent) {
	getShell().setDefaultButton(btnSearch);
	Composite content = parent.getParent();
	// parent.dispose();
	content.layout();
}
 
Example 12
Source File: NewDataflowProjectWizardLandingPage.java    From google-cloud-eclipse with Apache License 2.0 4 votes vote down vote up
@Override
public void createControl(Composite parent) {
  Composite formComposite = new Composite(parent, SWT.NULL);
  formComposite.setLayout(new GridLayout(3, false));
  setControl(formComposite);
  setHelp(formComposite);
  
  groupIdInput = addLabeledText(formComposite, Messages.getString("group.id")); //$NON-NLS-1$
  groupIdInput.setMessage(Messages.getString("example.group.id"));//$NON-NLS-1$
  groupIdInput.setToolTipText(Messages.getString("GROUP_ID_TOOLTIP")); //$NON-NLS-1$
  artifactIdInput = addLabeledText(formComposite, Messages.getString("artifact.id")); //$NON-NLS-1$
  artifactIdInput.setToolTipText(Messages.getString("ARTIFACT_ID_TOOLTIP")); //$NON-NLS-1$

  templateDropdown = addCombo(formComposite,
      Messages.getString("project.template"), true); //$NON-NLS-1$
  for (DataflowProjectArchetype template : DataflowProjectArchetype.values()) {
    templateDropdown.add(template.getLabel());
  }
  templateVersionDropdown = addCombo(formComposite,
      Messages.getString("dataflow.version"), false); //$NON-NLS-1$

  templateDropdown.select(0);
  updateAvailableVersions();

  packageInput = addLabeledText(formComposite, Messages.getString("package")); //$NON-NLS-1$
  packageInput.setToolTipText(Messages.getString("package.tooltip")); //$NON-NLS-1$
  packageInput.setMessage(Messages.getString("example.group.id"));//$NON-NLS-1$

  // Add a labeled text and button for the default location.
  Group locationGroup = new Group(formComposite, SWT.NULL);
  locationGroup.setLayoutData(gridSpan(GridData.FILL_HORIZONTAL, 3));
  locationGroup.setLayout(new GridLayout(3, false));

  useDefaultLocation = addCheckbox(locationGroup,
      Messages.getString("use.default.workspace.location"), true); //$NON-NLS-1$

  addLabel(locationGroup, Messages.getString("location")); //$NON-NLS-1$

  String defaultLocation = ResourcesPlugin.getWorkspace().getRoot().getLocation().toString();
  locationInput = new Text(locationGroup, SWT.SINGLE | SWT.BORDER);
  locationInput.setText(defaultLocation);
  locationInput.setEnabled(false);
  locationInput.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
  locationInput.setToolTipText(Messages.getString("location.tooltip")); //$NON-NLS-1$

  locationBrowse = ButtonFactory.newPushButton(locationGroup, Messages.getString("browse")); //$NON-NLS-1$
  locationBrowse.setEnabled(false);

  projectNameTemplate = addCombo(formComposite, Messages.getString("name.template"), false); //$NON-NLS-1$
  projectNameTemplate.setToolTipText(Messages.getString("name.template.tooltip")); //$NON-NLS-1$
  projectNameTemplate.add("[artifactId]"); //$NON-NLS-1$
  projectNameTemplate.add("[groupId]-[artifactId]"); //$NON-NLS-1$
  projectNameTemplate.setLayoutData(gridSpan(GridData.FILL_HORIZONTAL, 1));

  // Register all the listeners
  addListeners(defaultLocation);

  formComposite.layout();
  parent.layout();

  AnalyticsPingManager.getInstance().sendPingOnShell(parent.getShell(),
      AnalyticsEvents.DATAFLOW_NEW_PROJECT_WIZARD);
}
 
Example 13
Source File: JobDialog.java    From pentaho-kettle with Apache License 2.0 4 votes vote down vote up
private void addLogTab() {
  // ////////////////////////
  // START OF LOG TAB///
  // /
  wLogTab = new CTabItem( wTabFolder, SWT.NONE );
  wLogTab.setText( BaseMessages.getString( PKG, "JobDialog.LogTab.Label" ) );

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

  wLogComp = new Composite( wTabFolder, SWT.NONE );
  props.setLook( wLogComp );
  wLogComp.setLayout( LogLayout );

  // Add a log type List on the left hand side...
  //
  wLogTypeList = new List( wLogComp, SWT.SINGLE | SWT.V_SCROLL | SWT.H_SCROLL | SWT.BORDER );
  props.setLook( wLogTypeList );

  for ( LogTableInterface logTable : logTables ) {
    wLogTypeList.add( logTable.getLogTableType() );
  }

  FormData fdLogTypeList = new FormData();
  fdLogTypeList.left = new FormAttachment( 0, 0 );
  fdLogTypeList.top = new FormAttachment( 0, 0 );
  fdLogTypeList.right = new FormAttachment( middle / 2, 0 );
  fdLogTypeList.bottom = new FormAttachment( 100, 0 );
  wLogTypeList.setLayoutData( fdLogTypeList );

  wLogTypeList.addSelectionListener( new SelectionAdapter() {
    public void widgetSelected( SelectionEvent arg0 ) {
      showLogTypeOptions( wLogTypeList.getSelectionIndex() );
    }
  } );

  // On the right side we see a dynamic area : a composite...
  //
  wLogOptionsComposite = new Composite( wLogComp, SWT.BORDER );

  FormLayout logOptionsLayout = new FormLayout();
  logOptionsLayout.marginWidth = Const.MARGIN;
  logOptionsLayout.marginHeight = Const.MARGIN;
  wLogOptionsComposite.setLayout( logOptionsLayout );

  props.setLook( wLogOptionsComposite );
  FormData fdLogOptionsComposite = new FormData();
  fdLogOptionsComposite.left = new FormAttachment( wLogTypeList, margin );
  fdLogOptionsComposite.top = new FormAttachment( 0, 0 );
  fdLogOptionsComposite.right = new FormAttachment( 100, 0 );
  fdLogOptionsComposite.bottom = new FormAttachment( 100, 0 );
  wLogOptionsComposite.setLayoutData( fdLogOptionsComposite );

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

  wLogComp.layout();
  wLogTab.setControl( wLogComp );

  // ///////////////////////////////////////////////////////////
  // / END OF LOG TAB
  // ///////////////////////////////////////////////////////////
}
 
Example 14
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 );
}
 
Example 15
Source File: TextFileInputDialog.java    From hop with Apache License 2.0 4 votes vote down vote up
private void addFieldsTabs() {
  // Fields tab...
  //
  wFieldsTab = new CTabItem( wTabFolder, SWT.NONE );
  wFieldsTab.setText( BaseMessages.getString( PKG, "TextFileInputDialog.FieldsTab.TabTitle" ) );

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

  wFieldsComp = new Composite( wTabFolder, SWT.NONE );
  wFieldsComp.setLayout( fieldsLayout );
  props.setLook( wFieldsComp );

  wGet = new Button( wFieldsComp, SWT.PUSH );
  wGet.setText( BaseMessages.getString( PKG, "System.Button.GetFields" ) );
  fdGet = new FormData();
  fdGet.left = new FormAttachment( 50, 0 );
  fdGet.bottom = new FormAttachment( 100, 0 );
  wGet.setLayoutData( fdGet );

  wMinWidth = new Button( wFieldsComp, SWT.PUSH );
  wMinWidth.setText( BaseMessages.getString( PKG, "TextFileInputDialog.MinWidth.Button" ) );
  wMinWidth.setToolTipText( BaseMessages.getString( PKG, "TextFileInputDialog.MinWidth.Tooltip" ) );
  wMinWidth.addSelectionListener( new SelectionAdapter() {
    public void widgetSelected( SelectionEvent e ) {
      input.setChanged();
    }
  } );
  setButtonPositions( new Button[] { wGet, wMinWidth }, margin, null );

  final int FieldsRows = input.getInputFields().length;

  ColumnInfo[] colinf =
    new ColumnInfo[] {
      new ColumnInfo( BaseMessages.getString( PKG, "TextFileInputDialog.NameColumn.Column" ),
        ColumnInfo.COLUMN_TYPE_TEXT, false ),
      new ColumnInfo( BaseMessages.getString( PKG, "TextFileInputDialog.TypeColumn.Column" ),
        ColumnInfo.COLUMN_TYPE_CCOMBO, ValueMetaFactory.getValueMetaNames(), true ),
      new ColumnInfo( BaseMessages.getString( PKG, "TextFileInputDialog.FormatColumn.Column" ),
        ColumnInfo.COLUMN_TYPE_FORMAT, 2 ),
      new ColumnInfo( BaseMessages.getString( PKG, "TextFileInputDialog.PositionColumn.Column" ),
        ColumnInfo.COLUMN_TYPE_TEXT, false ),
      new ColumnInfo( BaseMessages.getString( PKG, "TextFileInputDialog.LengthColumn.Column" ),
        ColumnInfo.COLUMN_TYPE_TEXT, false ),
      new ColumnInfo( BaseMessages.getString( PKG, "TextFileInputDialog.PrecisionColumn.Column" ),
        ColumnInfo.COLUMN_TYPE_TEXT, false ),
      new ColumnInfo( BaseMessages.getString( PKG, "TextFileInputDialog.CurrencyColumn.Column" ),
        ColumnInfo.COLUMN_TYPE_TEXT, false ),
      new ColumnInfo( BaseMessages.getString( PKG, "TextFileInputDialog.DecimalColumn.Column" ),
        ColumnInfo.COLUMN_TYPE_TEXT, false ),
      new ColumnInfo( BaseMessages.getString( PKG, "TextFileInputDialog.GroupColumn.Column" ),
        ColumnInfo.COLUMN_TYPE_TEXT, false ),
      new ColumnInfo( BaseMessages.getString( PKG, "TextFileInputDialog.NullIfColumn.Column" ),
        ColumnInfo.COLUMN_TYPE_TEXT, false ),
      new ColumnInfo( BaseMessages.getString( PKG, "TextFileInputDialog.IfNullColumn.Column" ),
        ColumnInfo.COLUMN_TYPE_TEXT, false ),
      new ColumnInfo( BaseMessages.getString( PKG, "TextFileInputDialog.TrimTypeColumn.Column" ),
        ColumnInfo.COLUMN_TYPE_CCOMBO, ValueMetaString.trimTypeDesc, true ),
      new ColumnInfo( BaseMessages.getString( PKG, "TextFileInputDialog.RepeatColumn.Column" ),
        ColumnInfo.COLUMN_TYPE_CCOMBO, new String[] { BaseMessages.getString( PKG, "System.Combo.Yes" ),
        BaseMessages.getString( PKG, "System.Combo.No" ) }, true ) };

  colinf[ 12 ].setToolTip( BaseMessages.getString( PKG, "TextFileInputDialog.RepeatColumn.Tooltip" ) );

  wFields = new TableView( pipelineMeta, wFieldsComp, SWT.FULL_SELECTION | SWT.MULTI, colinf, FieldsRows, lsMod, props );

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

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

  wFieldsComp.layout();
  wFieldsTab.setControl( wFieldsComp );
}
 
Example 16
Source File: TextFileInputDialog.java    From hop with Apache License 2.0 4 votes vote down vote up
private void addFiltersTabs() {
  // Filters tab...
  //
  wFilterTab = new CTabItem( wTabFolder, SWT.NONE );
  wFilterTab.setText( BaseMessages.getString( PKG, "TextFileInputDialog.FilterTab.TabTitle" ) );

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

  wFilterComp = new Composite( wTabFolder, SWT.NONE );
  wFilterComp.setLayout( FilterLayout );
  props.setLook( wFilterComp );

  final int FilterRows = input.getFilter().length;

  ColumnInfo[] colinf =
    new ColumnInfo[] {
      new ColumnInfo( BaseMessages.getString( PKG, "TextFileInputDialog.FilterStringColumn.Column" ),
        ColumnInfo.COLUMN_TYPE_TEXT, false ),
      new ColumnInfo( BaseMessages.getString( PKG, "TextFileInputDialog.FilterPositionColumn.Column" ),
        ColumnInfo.COLUMN_TYPE_TEXT, false ),
      new ColumnInfo( BaseMessages.getString( PKG, "TextFileInputDialog.StopOnFilterColumn.Column" ),
        ColumnInfo.COLUMN_TYPE_CCOMBO, YES_NO_COMBO ),
      new ColumnInfo( BaseMessages.getString( PKG, "TextFileInputDialog.FilterPositiveColumn.Column" ),
        ColumnInfo.COLUMN_TYPE_CCOMBO, YES_NO_COMBO ) };

  colinf[ 2 ].setToolTip( BaseMessages.getString( PKG, "TextFileInputDialog.StopOnFilterColumn.Tooltip" ) );
  colinf[ 3 ].setToolTip( BaseMessages.getString( PKG, "TextFileInputDialog.FilterPositiveColumn.Tooltip" ) );

  wFilter = new TableView( pipelineMeta, wFilterComp, SWT.FULL_SELECTION | SWT.MULTI, colinf, FilterRows, lsMod, props );

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

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

  wFilterComp.layout();
  wFilterTab.setControl( wFilterComp );
}
 
Example 17
Source File: StarModelerPerspective.java    From pentaho-kettle with Apache License 2.0 4 votes vote down vote up
public void createTabForDomain(final StarDomain starDomain) throws Exception {
  SpoonPerspectiveManager.getInstance().activatePerspective(getClass());

  final XulTabAndPanel tabAndPanel = createTab();
  PropsUI props = PropsUI.getInstance();

  final Composite comp = (Composite) tabAndPanel.panel.getManagedObject();
  props.setLook(comp);
  comp.setLayout(new FillLayout());

  final ScrolledComposite scrolledComposite = new ScrolledComposite(comp, SWT.V_SCROLL | SWT.H_SCROLL);
  props.setLook(scrolledComposite);
  scrolledComposite.setLayout(new FillLayout());

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

  int margin = Const.MARGIN;

  FormLayout formLayout = new FormLayout();
  formLayout.marginLeft=10;
  formLayout.marginRight=10;
  formLayout.marginTop=10;
  formLayout.marginBottom=10;
  formLayout.spacing=margin;
  parentComposite.setLayout(formLayout);

  Control lastControl = addModelsGroupToDomainTab(starDomain, tabAndPanel, parentComposite);
  lastControl = addSharedDimensionsGroupToDomainTab(starDomain, tabAndPanel, parentComposite, lastControl);
  lastControl = addPhysicalGroupToDomainTab(starDomain, tabAndPanel, parentComposite, lastControl);

  parentComposite.layout(true);
  parentComposite.pack();

  // What's the size:
  Rectangle bounds = parentComposite.getBounds();

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

  models.add(starDomain);

  setNameForTab(tabAndPanel.tab, starDomain.getDomain().getName(defaultLocale));
  setMetaForTab(tabAndPanel.tab, starDomain);
  setSelectedMeta(starDomain);
  setActive(true);

  comp.layout();

  Spoon.getInstance().enableMenus();
}
 
Example 18
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 19
Source File: WorkflowDialog.java    From hop with Apache License 2.0 4 votes vote down vote up
private void addParamTab() {
  // ////////////////////////
  // START OF PARAM TAB
  // /
  CTabItem wParamTab = new CTabItem( wTabFolder, SWT.NONE );
  wParamTab.setText( BaseMessages.getString( PKG, "WorkflowDialog.ParamTab.Label" ) );

  FormLayout paramLayout = new FormLayout();
  paramLayout.marginWidth = props.getMargin();
  paramLayout.marginHeight = props.getMargin();

  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, "WorkflowDialog.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 = workflowMeta.listParameters().length;

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

  wParamFields =
    new TableView(
      workflowMeta, 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 20
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 );
}