Java Code Examples for org.eclipse.swt.custom.CTabFolder#setLayoutData()

The following examples show how to use org.eclipse.swt.custom.CTabFolder#setLayoutData() . 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: BrowserViewPart.java    From translationstudio8 with GNU General Public License v2.0 6 votes vote down vote up
private Composite createBrowserArea(Composite parent) {
	GridLayout gridLayout = new GridLayout(1, false);
	parent.setLayout(gridLayout);
	GridData gd_displayArea = new GridData(SWT.FILL, SWT.FILL, true, true, 1, 1);
	parent.setLayoutData(gd_displayArea);
	tabFolder = new CTabFolder(parent, SWT.TOP|SWT.MULTI|SWT.FLAT);
	tabFolder.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 1, 1));
	UIJob  job = new UIJob(Display.getDefault(),"refresh browser") {			
		@Override
		public IStatus runInUIThread(IProgressMonitor monitor) {
			refreshTabContent();
			return Status.OK_STATUS;
		}
		/** (non-Javadoc)
		 * @see org.eclipse.core.runtime.jobs.Job#shouldRun()
		 */
		@Override
		public boolean shouldRun() {			
			return !tabFolder.isDisposed();
		}
	};
	job.schedule();
	return parent;

}
 
Example 2
Source File: WidgetUtils.java    From pentaho-kettle with Apache License 2.0 6 votes vote down vote up
public static CTabFolder createTabFolder( Composite composite, FormData fd, String... titles ) {
  Composite container = new Composite( composite, SWT.NONE );
  WidgetUtils.setFormLayout( container, 0 );
  container.setLayoutData( fd );

  CTabFolder tabFolder = new CTabFolder( container, SWT.NONE );
  tabFolder.setLayoutData( new FormDataBuilder().fullSize().result() );

  for ( String title : titles ) {
    if ( title.length() < 8 ) {
      title = StringUtils.rightPad( title, 8 );
    }
    Composite tab = new Composite( tabFolder, SWT.NONE );
    WidgetUtils.setFormLayout( tab, ConstUI.MEDUIM_MARGIN );

    CTabItem tabItem = new CTabItem( tabFolder, SWT.NONE );
    tabItem.setText( title );
    tabItem.setControl( tab );
  }

  tabFolder.setSelection( 0 );
  return tabFolder;
}
 
Example 3
Source File: TransHistoryDelegate.java    From pentaho-kettle with Apache License 2.0 6 votes vote down vote up
private void addLogTableTabs() {
  // Create a nested tab folder in the tab item, on the history composite...
  //
  tabFolder = new CTabFolder( transHistoryComposite, SWT.MULTI );
  spoon.props.setLook( tabFolder, Props.WIDGET_STYLE_TAB );

  FormData fdTabFolder = new FormData();
  fdTabFolder.left = new FormAttachment( 0, 0 ); // First one in the left top corner
  fdTabFolder.top = new FormAttachment( (Control) toolbar.getManagedObject(), 0 );
  fdTabFolder.right = new FormAttachment( 100, 0 );
  fdTabFolder.bottom = new FormAttachment( 100, 0 );
  tabFolder.setLayoutData( fdTabFolder );

  models = new TransHistoryLogTab[transMeta.getLogTables().size()];
  for ( int i = 0; i < models.length; i++ ) {
    models[i] = new TransHistoryLogTab( tabFolder, transMeta.getLogTables().get( i ) );
  }
}
 
Example 4
Source File: JobHistoryDelegate.java    From pentaho-kettle with Apache License 2.0 6 votes vote down vote up
private void addLogTableTabs() {
  // Create a nested tab folder in the tab item, on the history composite...
  //
  tabFolder = new CTabFolder( jobHistoryComposite, SWT.MULTI );
  spoon.props.setLook( tabFolder, Props.WIDGET_STYLE_TAB );

  FormData fdTabFolder = new FormData();
  fdTabFolder.left = new FormAttachment( 0, 0 ); // First one in the left top corner
  fdTabFolder.top = new FormAttachment( (Control) toolbar.getManagedObject(), 0 );
  fdTabFolder.right = new FormAttachment( 100, 0 );
  fdTabFolder.bottom = new FormAttachment( 100, 0 );
  tabFolder.setLayoutData( fdTabFolder );

  models = new JobHistoryLogTab[jobMeta.getLogTables().size()];
  for ( int i = 0; i < models.length; i++ ) {
    models[i] = new JobHistoryLogTab( tabFolder, jobMeta.getLogTables().get( i ) );
  }
}
 
Example 5
Source File: SWTUtil.java    From APICloud-Studio with GNU General Public License v3.0 6 votes vote down vote up
/**
 * Creates the tab folder for displaying the composite fragments
 * 
 * @param parent
 */
public static CTabFolder createTabFolder(Composite parent)
{
	Display display = getStandardDisplay();
	Color c1 = display.getSystemColor(SWT.COLOR_TITLE_BACKGROUND), c2 = display
			.getSystemColor(SWT.COLOR_TITLE_BACKGROUND_GRADIENT);
	CTabFolder tabs = new CTabFolder(parent, SWT.NO_REDRAW_RESIZE | SWT.NO_TRIM | SWT.FLAT);
	GridData gd = new GridData(GridData.FILL_BOTH);
	gd.horizontalSpan = 2;
	tabs.setSelectionBackground(new Color[] { c1, c2 }, new int[] { 100 }, true);
	tabs.setSelectionForeground(getStandardDisplay().getSystemColor(SWT.COLOR_TITLE_FOREGROUND));
	tabs.setSimple(PlatformUI.getPreferenceStore().getBoolean(
			IWorkbenchPreferenceConstants.SHOW_TRADITIONAL_STYLE_TABS));
	tabs.setLayoutData(gd);
	tabs.setBorderVisible(true);
	tabs.setFont(parent.getFont());
	return tabs;
}
 
Example 6
Source File: GamaPreferencesView.java    From gama with GNU General Public License v3.0 6 votes vote down vote up
private void buildContents() {
	tabFolder = new CTabFolder(shell, SWT.TOP | SWT.NO_TRIM);
	tabFolder.setBorderVisible(true);
	tabFolder.setBackgroundMode(SWT.INHERIT_DEFAULT);
	tabFolder.setMRUVisible(true);
	tabFolder.setSimple(false); // rounded tabs
	tabFolder.setLayoutData(new GridData(GridData.FILL, GridData.FILL, true, true, 2, 1));
	final Map<String, Map<String, List<Pref>>> prefs = GamaPreferences.organizePrefs();
	for (final String tabName : prefs.keySet()) {
		final CTabItem item = new CTabItem(tabFolder, SWT.NONE);
		item.setFont(GamaFonts.getNavigHeaderFont());
		item.setText(tabName);
		item.setImage(prefs_images.get(tabName));
		item.setShowClose(false);
		buildContentsFor(item, prefs.get(tabName));
	}
	buildButtons();
	shell.layout();
}
 
Example 7
Source File: CommandTerminalDebugView.java    From typescript.java with MIT License 6 votes vote down vote up
@Override
public void createPartControl(Composite parent) {
	Composite p = new Composite(parent, SWT.NONE);
	p.setLayout(new GridLayout());
	p.setLayoutData(new GridData(GridData.FILL_BOTH));

	folder = new CTabFolder(p, SWT.NONE);
	folder.setFont(parent.getFont());
	folder.setLayout(new GridLayout());
	folder.setLayoutData(new GridData(GridData.FILL_BOTH));

	// Text tab
	terminalText = addTab(folder, "Text");
	// ANSI tab
	terminalANSI = addTab(folder, "ANSI");

}
 
Example 8
Source File: WidgetUtils.java    From hop with Apache License 2.0 6 votes vote down vote up
public static CTabFolder createTabFolder( Composite composite, FormData fd, String... titles ) {
  Composite container = new Composite( composite, SWT.NONE );
  WidgetUtils.setFormLayout( container, 0 );
  container.setLayoutData( fd );

  CTabFolder tabFolder = new CTabFolder( container, SWT.NONE );
  tabFolder.setLayoutData( new FormDataBuilder().fullSize().result() );

  for ( String title : titles ) {
    if ( title.length() < 8 ) {
      title = StringUtils.rightPad( title, 8 );
    }
    Composite tab = new Composite( tabFolder, SWT.NONE );
    WidgetUtils.setFormLayout( tab, ConstUi.MEDUIM_MARGIN );

    CTabItem tabItem = new CTabItem( tabFolder, SWT.NONE );
    tabItem.setText( title );
    tabItem.setControl( tab );
  }

  tabFolder.setSelection( 0 );
  return tabFolder;
}
 
Example 9
Source File: SymbolProviderConfigDialog.java    From tracecompass with Eclipse Public License 2.0 5 votes vote down vote up
@Override
protected Control createDialogArea(Composite parent) {
    getShell().setText(Messages.SymbolProviderConfigDialog_title);
    setTitle(Messages.SymbolProviderConfigDialog_title);
    setMessage(Messages.SymbolProviderConfigDialog_message);

    Composite composite = (Composite) super.createDialogArea(parent);
    composite.setLayout(new GridLayout());

    // if we have one single provider that we don't need a tab
    if (fPreferencePages.length == 1) {
        attachPreference(composite, fPreferencePages[0]);
        updateMessage(0);
    } else {
        fTabFolder = new CTabFolder(composite, SWT.NONE);
        fTabFolder.setLayoutData(new GridData(GridData.FILL_BOTH));
        fPageTabs = new CTabItem[fPreferencePages.length];
        for (int i = 0; i < fPreferencePages.length; i++) {
            ISymbolProviderPreferencePage page = fPreferencePages[i];
            fPageTabs[i] = new CTabItem(fTabFolder, SWT.NONE);
            fPageTabs[i].setText(page.getTitle());
            Composite child = new Composite(fTabFolder, SWT.NONE);
            child.setLayout(new GridLayout());
            child.setLayoutData(new GridData(SWT.LEFT, SWT.TOP, true, true));
            fPageTabs[i].setControl(child);
            attachPreference(child, page);
            updateMessage(i);
        }
        fTabFolder.addSelectionListener(new SelectionAdapter() {
            @Override
            public void widgetSelected(SelectionEvent e) {
                updateMessage(fTabFolder.indexOf((CTabItem) e.item));
            }
        });
    }
    return composite;
}
 
Example 10
Source File: MainPanel.java    From Rel with Apache License 2.0 5 votes vote down vote up
/**
 * Create the composite.
 * 
 * @param parent
 * @param style
 */
public MainPanel(Composite parent, int style) {
	super(parent, style);
	setLayout(new FormLayout());

	getShell().addListener(SWT.Close, e -> LogWin.remove());
	getShell().addListener(SWT.Move, e -> Preferences.setPreference(rectPrefName, getShell().getBounds()));
	getShell().addListener(SWT.Resize, e -> Preferences.setPreference(rectPrefName, getShell().getBounds()));

	// Install logging
	LogWin.install(parent);

	// Install platform logging and UI error trapping
	new CrashTrap(getShell(), Version.getVersion());
	
	Rectangle rect = Preferences.getPreferenceRectangle(rectPrefName);
	if (rect.height > 0 && rect.width > 0)
		getShell().setBounds(rect);

	tabFolder = new CTabFolder(this, SWT.None);
	FormData fd_tabFolder = new FormData();
	fd_tabFolder.top = new FormAttachment(0);
	fd_tabFolder.left = new FormAttachment(0);
	fd_tabFolder.right = new FormAttachment(100);
	tabFolder.setLayoutData(fd_tabFolder);
	tabFolder.setSelectionBackground(
			Display.getCurrent().getSystemColor(SWT.COLOR_TITLE_INACTIVE_BACKGROUND_GRADIENT));
	tabFolder.addListener(SWT.Selection, e -> setStatus(((DbTab) tabFolder.getSelection()).getStatus()));

	statusPanel = new StatusPanel(this, SWT.None);
	FormData fd_statusPanel = new FormData();
	fd_statusPanel.left = new FormAttachment(0);
	fd_statusPanel.right = new FormAttachment(100);
	fd_statusPanel.bottom = new FormAttachment(100);
	statusPanel.setLayoutData(fd_statusPanel);

	fd_tabFolder.bottom = new FormAttachment(statusPanel);
	
	layout();
}
 
Example 11
Source File: CTabFolderExample.java    From codeexamples-eclipse with Eclipse Public License 1.0 5 votes vote down vote up
public static void main(String[] args) {
    Display display = new Display();
    Shell shell = new Shell(display);

    shell.setLayout(new GridLayout());
    // SWT.BOTTOM to show at the bottom
    CTabFolder folder = new CTabFolder(shell, SWT.TOP);
    GridData data = new GridData(SWT.FILL, 
            SWT.FILL, true, true,
            2, 1);
    folder.setLayoutData(data);
    CTabItem cTabItem1 = new CTabItem(folder, SWT.NONE);
    cTabItem1.setText("Tab1");
    CTabItem cTabItem2 = new CTabItem(folder, SWT.NONE);
    cTabItem2.setText("Tab2");
    CTabItem cTabItem3 = new CTabItem(folder, SWT.NONE);
    cTabItem3.setText("Tab3");
    CTabItem cTabItem4 = new CTabItem(folder, SWT.NONE);
    cTabItem4.setText("Tab4");

    shell.pack();
    shell.open();
    while (!shell.isDisposed()) {
        if (!display.readAndDispatch()) {
            display.sleep();
        }
    }
}
 
Example 12
Source File: RawSignalWindow.java    From ProtocolAnalyzer with GNU General Public License v3.0 5 votes vote down vote up
private CTabFolder createTabFolder(Shell shell1) {
    CTabFolder chartFolder = new CTabFolder(shell1, SWT.NONE);
    GridData folderGridData = new GridData(GridData.HORIZONTAL_ALIGN_FILL | GridData.VERTICAL_ALIGN_BEGINNING);
    folderGridData.grabExcessHorizontalSpace = true;
    folderGridData.grabExcessVerticalSpace = false;
    folderGridData.heightHint = 280;
    chartFolder.setLayoutData(folderGridData);
    return chartFolder;
}
 
Example 13
Source File: ContractPropertySection.java    From bonita-studio with GNU General Public License v2.0 5 votes vote down vote up
@Override
protected void createContent(final Composite parent) {
    final IObservableValue observeContractValue = CustomEMFEditObservables.observeDetailValue(Realm.getDefault(),
            ViewersObservables.observeSingleSelection(selectionProvider),
            ProcessPackage.Literals.CONTRACT_CONTAINER__CONTRACT);
    init(observeContractValue);

    final CTabFolder tabFolder = getWidgetFactory().createTabFolder(parent, SWT.TOP);
    tabFolder.setLayoutData(GridDataFactory.fillDefaults().grab(true, true).create());
    getWidgetFactory().adapt(tabFolder);

    final CTabItem inputTabItem = getWidgetFactory().createTabItem(tabFolder, SWT.NULL);
    inputTabItem.setText(Messages.inputTabLabel);
    final Composite inputComposite = getWidgetFactory().createComposite(tabFolder);
    inputComposite.setLayoutData(GridDataFactory.fillDefaults().grab(true, true).create());
    inputComposite.setLayout(GridLayoutFactory.fillDefaults().margins(15, 10).numColumns(2).extendedMargins(5, 0, 0, 5)
                    .spacing(LayoutConstants.getSpacing().x, 15).create());

    createInputTabContent(inputComposite, observeContractValue);

    inputTabItem.setControl(inputComposite);

    final Composite constraintComposite = getWidgetFactory().createComposite(tabFolder);
    constraintComposite.setLayoutData(GridDataFactory.fillDefaults().grab(true, true).create());
    constraintComposite.setLayout(GridLayoutFactory.fillDefaults().margins(15, 10).numColumns(2).extendedMargins(5, 0, 0, 5)
            .spacing(LayoutConstants.getSpacing().x, 15).create());

    createConstraintTabContent(constraintComposite, observeContractValue);

    final CTabItem constraintTabItem = getWidgetFactory().createTabItem(tabFolder, SWT.NULL);
    constraintTabItem.setText(Messages.constraintsTabLabel);
    constraintTabItem.setControl(constraintComposite);
    tabFolder.setSelection(0);
}
 
Example 14
Source File: GraphModelDialog.java    From knowbi-pentaho-pdi-neo4j-output with Apache License 2.0 4 votes vote down vote up
/**
 * @return true when OK is hit, false when CANCEL
 */
public boolean open() {

  Shell parent = getParent();
  Display display = parent.getDisplay();

  shell = new Shell( parent, SWT.RESIZE | SWT.MAX | SWT.MIN | SWT.DIALOG_TRIM );
  shell.setImage( GUIResource.getInstance().getImageSpoon() );
  props.setLook( shell );

  margin = Const.MARGIN + 2;
  middle = Const.MIDDLE_PCT;

  FormLayout formLayout = new FormLayout();

  shell.setLayout( formLayout );
  shell.setText( "Graph Model Editor" );

  Button wOK = new Button( shell, SWT.PUSH );
  wOK.setText( BaseMessages.getString( PKG, "System.Button.OK" ) );
  wOK.addListener( SWT.Selection, event -> ok() );
  Button wCancel = new Button( shell, SWT.PUSH );
  wCancel.setText( BaseMessages.getString( PKG, "System.Button.Cancel" ) );
  wCancel.addListener( SWT.Selection, event -> cancel() );

  BaseStepDialog.positionBottomButtons( shell, new Button[] { wOK, wCancel }, margin, null );

  // Add a tab folder
  //
  wTabs = new CTabFolder( shell, SWT.BORDER );
  FormData fdTabs = new FormData();
  fdTabs.left = new FormAttachment( 0, 0 );
  fdTabs.right = new FormAttachment( 100, 0 );
  fdTabs.top = new FormAttachment( 0, 0 );
  fdTabs.bottom = new FormAttachment( wOK, -margin * 2 );
  wTabs.setLayoutData( fdTabs );

  addModelTab();
  addNodesTab();
  addRelationshipsTab();
  addGraphTab();

  // Select the model tab
  //
  wTabs.setSelection( 0 );

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

  getData();

  shell.open();
  while ( !shell.isDisposed() ) {
    if ( !display.readAndDispatch() ) {
      display.sleep();
    }
  }

  return ok;
}
 
Example 15
Source File: BeamJobConfigDialog.java    From kettle-beam with Apache License 2.0 4 votes vote down vote up
private void addFormWidgets() {

    int middle = Const.MIDDLE_PCT;

    // The name of the Beam Job Configuration
    //
    Label wlName = new Label( shell, SWT.RIGHT );
    props.setLook( wlName );
    wlName.setText( BaseMessages.getString( PKG, "BeamJobConfigDialog.Name.Label" ) );
    FormData fdlName = new FormData();
    fdlName.top = new FormAttachment( 0, margin );
    fdlName.left = new FormAttachment( 0, -margin ); // First one in the left top corner
    fdlName.right = new FormAttachment( middle, -margin );
    wlName.setLayoutData( fdlName );
    wName = new Text( shell, SWT.SINGLE | SWT.LEFT | SWT.BORDER );
    props.setLook( wName );
    FormData fdName = new FormData();
    fdName.top = new FormAttachment( wlName, 0, SWT.CENTER );
    fdName.left = new FormAttachment( middle, 0 ); // To the right of the label
    fdName.right = new FormAttachment( 95, 0 );
    wName.setLayoutData( fdName );
    Control lastControl = wName;

    // The description
    //
    Label wlDescription = new Label( shell, SWT.RIGHT );
    props.setLook( wlDescription );
    wlDescription.setText( BaseMessages.getString( PKG, "BeamJobConfigDialog.Description.Label" ) );
    FormData fdlDescription = new FormData();
    fdlDescription.top = new FormAttachment( lastControl, margin );
    fdlDescription.left = new FormAttachment( 0, -margin ); // First one in the left top corner
    fdlDescription.right = new FormAttachment( middle, -margin );
    wlDescription.setLayoutData( fdlDescription );
    wDescription = new Text( shell, SWT.SINGLE | SWT.LEFT | SWT.BORDER );
    props.setLook( wDescription );
    FormData fdDescription = new FormData();
    fdDescription.top = new FormAttachment( wlDescription, 0, SWT.CENTER );
    fdDescription.left = new FormAttachment( middle, 0 ); // To the right of the label
    fdDescription.right = new FormAttachment( 95, 0 );
    wDescription.setLayoutData( fdDescription );
    lastControl = wDescription;

    // Runner
    //
    Label wlRunner = new Label( shell, SWT.RIGHT );
    props.setLook( wlRunner );
    wlRunner.setText( BaseMessages.getString( PKG, "BeamJobConfigDialog.Runner.Label" ) );
    FormData fdlRunner = new FormData();
    fdlRunner.top = new FormAttachment( lastControl, margin );
    fdlRunner.left = new FormAttachment( 0, -margin ); // First one in the left top corner
    fdlRunner.right = new FormAttachment( middle, -margin );
    wlRunner.setLayoutData( fdlRunner );
    wRunner = new ComboVar( space, shell, SWT.SINGLE | SWT.LEFT | SWT.BORDER );
    wRunner.setItems( RunnerType.getNames() );
    props.setLook( wRunner );
    FormData fdRunner = new FormData();
    fdRunner.top = new FormAttachment( wlRunner, 0, SWT.CENTER );
    fdRunner.left = new FormAttachment( middle, 0 ); // To the right of the label
    fdRunner.right = new FormAttachment( 95, 0 );
    wRunner.setLayoutData( fdRunner );
    lastControl = wRunner;


    wTabFolder = new CTabFolder( shell, SWT.BORDER );
    props.setLook( wTabFolder, Props.WIDGET_STYLE_TAB );
    wTabFolder.setSimple( false );
    FormData fdTabFolder = new FormData();
    fdTabFolder.left = new FormAttachment( 0, 0 );
    fdTabFolder.right = new FormAttachment( 100, 0 );
    fdTabFolder.top = new FormAttachment( lastControl, margin * 2 );
    fdTabFolder.bottom = new FormAttachment( wOK, -margin * 2 );
    wTabFolder.setLayoutData( fdTabFolder );

    addGeneralTab();
    addParametersTab();
    addDataflowTab();
    addSparkTab();
    addFlinkTab();

    wTabFolder.setSelection( 0 );

  }
 
Example 16
Source File: HopDataOrchestrationPerspective.java    From hop with Apache License 2.0 4 votes vote down vote up
@Override public void initialize( HopGui hopGui, Composite parent ) {
  this.hopGui = hopGui;
  this.parent = parent;

  PropsUi props = PropsUi.getInstance();

  composite = new Composite( parent, SWT.NONE );
  //composite.setBackground( GuiResource.getInstance().getColorBackground() );
  FormLayout layout = new FormLayout();
  //layout.marginLeft = props.getMargin();
  //layout.marginTop = props.getMargin();
  layout.marginRight = props.getMargin();
  layout.marginBottom = props.getMargin();
  composite.setLayout( layout );

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

  // A tab folder covers the complete area...
  //
  tabFolder = new CTabFolder( composite, SWT.MULTI | SWT.BORDER );
  props.setLook( tabFolder, Props.WIDGET_STYLE_TAB );
  FormData fdLabel = new FormData();
  fdLabel.left = new FormAttachment( 0, 0 );
  fdLabel.right = new FormAttachment( 100, 0 );
  fdLabel.top = new FormAttachment( 0, 0 );
  fdLabel.bottom = new FormAttachment( 100, 0 );
  tabFolder.setLayoutData( fdLabel );

  tabFolder.addCTabFolder2Listener( new CTabFolder2Adapter() {
    @Override public void close( CTabFolderEvent event ) {
      handleTabCloseEvent( event );
    }
  } );
  tabFolder.addListener( SWT.Selection, event -> handTabSelectionEvent( event ) );

  // Support reorder tab item
  new TabFolderReorder( tabFolder );

}
 
Example 17
Source File: DialogAbout.java    From arx with Apache License 2.0 4 votes vote down vote up
@Override
protected Control createDialogArea(final Composite parent) {
    parent.setLayout(new GridLayout());

    // Text
    final Label label = new Label(parent, SWT.CENTER | SWT.NONE);
    label.setText(ABOUT);
    label.setLayoutData(SWTUtil.createFillHorizontallyGridData());
    
    // Folder
    CTabFolder folder = new CTabFolder(parent, SWT.BORDER);
    folder.setSimple(false);
    folder.setLayoutData(SWTUtil.createFillGridData());
    
    // License
    CTabItem item1 = new CTabItem(folder, SWT.NULL);
    item1.setText("License"); //$NON-NLS-1$
    final Text license = new Text(folder, SWT.NONE | SWT.MULTI | SWT.V_SCROLL | SWT.BORDER);
    license.setText(LICENSE);
    license.setEditable(false);
    license.setLayoutData(SWTUtil.createFillGridData());
    item1.setControl(license);
    
    // Contributors
    CTabItem item2 = new CTabItem(folder, SWT.NULL);
    item2.setText("Contributors"); //$NON-NLS-1$
    final Text contributors = new Text(folder, SWT.NONE | SWT.MULTI | SWT.V_SCROLL | SWT.BORDER);
    contributors.setText(CONTRIBUTORS);
    contributors.setEditable(false);
    contributors.setLayoutData(SWTUtil.createFillGridData());
    item2.setControl(contributors);
    
    // Information
    CTabItem item3 = new CTabItem(folder, SWT.NULL);
    item3.setText("Links"); //$NON-NLS-1$
    Composite composite3 = new Composite(folder, SWT.BORDER);
    composite3.setBackground(license.getBackground());
    item3.setControl(composite3);
    composite3.setLayout(SWTUtil.createGridLayout(1, false));
    createLink(composite3, "Website: <a>arx.deidentifier.org</a>", "Website", "http://arx.deidentifier.org"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
    createLink(composite3, "Manual: <a>arx.deidentifier.org/anonymization-tool</a>", "Manual", "http://arx.deidentifier.org/anonymization-tool/"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
    createLink(composite3, "API: <a>arx.deidentifier.org/api</a>", "API", "http://arx.deidentifier.org/api"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
    createLink(composite3, "Downloads: <a>arx.deidentifier.org/downloads</a>", "Downloads", "http://arx.deidentifier.org/downloads"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
    createLink(composite3, "Github: <a>github.com/arx-deidentifier</a>", "Github", "https://github.com/arx-deidentifier"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
    return parent;
}
 
Example 18
Source File: ElasticSearchBulkDialog.java    From pentaho-kettle with Apache License 2.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.MAX | SWT.MIN );
  props.setLook( shell );
  setShellImage( shell, model );

  lsMod = new ModifyListener() {

    public void modifyText( ModifyEvent e ) {
      model.setChanged();
    }
  };

  changed = model.hasChanged();

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

  shell.setLayout( formLayout );
  shell.setText( BaseMessages.getString( PKG, "ElasticSearchBulkDialog.DialogTitle" ) );

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

  // 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.top = new FormAttachment( 0, margin );
  fdlStepname.right = new FormAttachment( middle, -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 );

  wTabFolder = new CTabFolder( shell, SWT.BORDER );
  props.setLook( wTabFolder, Props.WIDGET_STYLE_TAB );

  // GENERAL TAB
  addGeneralTab();

  // Servers TAB
  addServersTab();

  // Fields TAB
  addFieldsTab();

  // Settings TAB
  addSettingsTab();

  // ////////////
  // BUTTONS //
  // //////////
  wOK = new Button( shell, SWT.PUSH );
  wOK.setText( BaseMessages.getString( PKG, "System.Button.OK" ) );
  wCancel = new Button( shell, SWT.PUSH );
  wCancel.setText( BaseMessages.getString( PKG, "System.Button.Cancel" ) );

  setButtonPositions( new Button[]{wOK, wCancel}, margin, null );

  fdTabFolder = new FormData();
  fdTabFolder.left = new FormAttachment( 0, 0 );
  fdTabFolder.top = new FormAttachment( wStepname, margin );
  fdTabFolder.right = new FormAttachment( 100, 0 );
  fdTabFolder.bottom = new FormAttachment( wOK, -margin );
  wTabFolder.setLayoutData( fdTabFolder );

  // //////////////////
  // Std Listeners //
  // ////////////////
  addStandardListeners();

  wTabFolder.setSelection( 0 );

  // Set the shell size, based upon previous time...
  setSize();
  getData( model );
  model.setChanged( changed );

  shell.open();
  while ( !shell.isDisposed() ) {
    if ( !display.readAndDispatch() ) {
      display.sleep();
    }
  }
  return stepname;
}
 
Example 19
Source File: DatabaseMetaDialog.java    From hop with Apache License 2.0 4 votes vote down vote up
public String open() {
  // Create a tabbed interface instead of the confusing left hand side options
  // This will make it more conforming the rest.
  //
  shell = new Shell( parent, SWT.DIALOG_TRIM | SWT.RESIZE | SWT.MAX | SWT.MIN );
  props.setLook( shell );
  shell.setImage( GuiResource.getInstance().getImageConnection() );

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

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

  shell.setText( BaseMessages.getString( PKG, "DatabaseDialog.Shell.title" ) );
  shell.setLayout( formLayout );

  // Add buttons at the bottom
  Button wOk = new Button( shell, SWT.PUSH );
  wOk.setText( BaseMessages.getString( PKG, "System.Button.OK" ) );
  wOk.addListener( SWT.Selection, this::ok );

  Button wCancel = new Button( shell, SWT.PUSH );
  wCancel.setText( BaseMessages.getString( PKG, "System.Button.Cancel" ) );
  wCancel.addListener( SWT.Selection, this::cancel );

  Button wTest = new Button( shell, SWT.PUSH );
  wTest.setText( BaseMessages.getString( PKG, "System.Button.Test" ) );
  wTest.addListener( SWT.Selection, this::test );

  Button[] buttons = new Button[] { wOk, wTest, wCancel };
  BaseTransformDialog.positionBottomButtons( shell, buttons, margin, null );

  // Now create the tabs above the buttons...

  wTabFolder = new CTabFolder( shell, SWT.BORDER );
  props.setLook( wTabFolder, Props.WIDGET_STYLE_TAB );

  addGeneralTab();
  addAdvancedTab();
  addOptionsTab();

  getData();

  wConnectionType.addModifyListener( e -> changeConnectionType() );

  // Select the general tab
  //
  wTabFolder.setSelection( 0 );
  FormData fdTabFolder = new FormData();
  fdTabFolder.left = new FormAttachment( 0, 0 );
  fdTabFolder.top = new FormAttachment( 0, 0 );
  fdTabFolder.right = new FormAttachment( 100, 0 );
  fdTabFolder.bottom = new FormAttachment( wOk, -margin * 3 );
  wTabFolder.setLayoutData( fdTabFolder );

  BaseTransformDialog.setSize( shell );

  shell.open();
  Display display = parent.getDisplay();
  while ( !shell.isDisposed() ) {
    if ( !display.readAndDispatch() ) {
      display.sleep();
    }
  }
  return returnValue;
}
 
Example 20
Source File: ConfigurationDialog.java    From hop with Apache License 2.0 4 votes vote down vote up
protected void parametersSectionLayout( Class<?> PKG, String prefix ) {

    tabFolder = new CTabFolder( shell, SWT.BORDER );
    props.setLook( tabFolder, Props.WIDGET_STYLE_TAB );
    fdTabFolder = new FormData();
    fdTabFolder.right = new FormAttachment( 100, -15 );
    fdTabFolder.left = new FormAttachment( 0, 15 );
    fdTabFolder.top = new FormAttachment( gDetails, 15 );
    fdTabFolder.bottom = new FormAttachment( alwaysShowOption, -15 );
    tabFolder.setLayoutData( fdTabFolder );

    // Parameters
    CTabItem tbtmParameters = new CTabItem( tabFolder, SWT.NONE );
    tbtmParameters.setText( BaseMessages.getString( PKG, prefix + ".Params.Label" ) );
    Composite parametersComposite = new Composite( tabFolder, SWT.NONE );
    props.setLook( parametersComposite );

    parametersComposite.setLayout( new FormLayout() );
    tbtmParameters.setControl( parametersComposite );

    ColumnInfo[] cParams = {
      new ColumnInfo( BaseMessages.getString( PKG, prefix + ".ParamsColumn.Argument" ),
        ColumnInfo.COLUMN_TYPE_TEXT, false, true), // TransformName
      new ColumnInfo( BaseMessages.getString( PKG, prefix + ".ParamsColumn.Default" ),
        ColumnInfo.COLUMN_TYPE_TEXT, false, true), // Preview size
      new ColumnInfo( BaseMessages.getString( PKG, prefix + ".ParamsColumn.Value" ),
        ColumnInfo.COLUMN_TYPE_TEXT, false, false), // Preview size
      new ColumnInfo( BaseMessages.getString( PKG, prefix + ".ParamsColumn.Description" ),
        ColumnInfo.COLUMN_TYPE_TEXT, false, true ), // Preview size
    };

    String[] namedParams = abstractMeta.listParameters();
    int nrParams = namedParams.length;
    wParams = new TableView( abstractMeta, parametersComposite, SWT.BORDER | SWT.FULL_SELECTION | SWT.MULTI, cParams,
        nrParams, false, null, props, false );
    FormData fdParams = new FormData();
    fdParams.top = new FormAttachment( 0, 10 );
    fdParams.right = new FormAttachment( 100, -10 );
    fdParams.bottom = new FormAttachment( 100, -45 );
    fdParams.left = new FormAttachment( 0, 10 );
    wParams.setLayoutData( fdParams );

    tabFolder.setSelection( 0 );

    // Variables
    CTabItem tbtmVariables = new CTabItem( tabFolder, SWT.NONE );
    tbtmVariables.setText( BaseMessages.getString( PKG, prefix + ".Variables.Label" ) );

    Composite variablesComposite = new Composite( tabFolder, SWT.NONE );
    props.setLook( variablesComposite );
    variablesComposite.setLayout( new FormLayout() );
    tbtmVariables.setControl( variablesComposite );

    ColumnInfo[] cVariables = {
      new ColumnInfo( BaseMessages.getString( PKG, prefix + ".VariablesColumn.Argument" ),
        ColumnInfo.COLUMN_TYPE_TEXT, false, false ), // TransformName
      new ColumnInfo( BaseMessages.getString( PKG, prefix + ".VariablesColumn.Value" ),
        ColumnInfo.COLUMN_TYPE_TEXT, false, false ), // Preview size
    };

    int nrVariables = configuration.getVariablesMap() != null ? configuration.getVariablesMap().size() : 0;
    wVariables = new TableView( abstractMeta, variablesComposite, SWT.BORDER | SWT.FULL_SELECTION | SWT.MULTI, cVariables,
        nrVariables, false, null, props, false );

    FormData fdVariables = new FormData();
    fdVariables.top = new FormAttachment( 0, 10 );
    fdVariables.right = new FormAttachment( 100, -10 );
    fdVariables.bottom = new FormAttachment( 100, -10 );
    fdVariables.left = new FormAttachment( 0, 10 );

    wVariables.setLayoutData( fdVariables );
  }