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

The following examples show how to use org.eclipse.swt.custom.CTabFolder#setSelection() . 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: 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 2
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 3
Source File: DiskWindow.java    From AppleCommander with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Setup the Disk window and display (open) it.
 */
public void open() {
	shell = new Shell(parentShell, SWT.SHELL_TRIM);
	shell.setLayout(new FillLayout());
	shell.setImage(imageManager.get(ImageManager.ICON_DISK));
	setStandardWindowTitle();
	shell.addDisposeListener(new DisposeListener() {
			public void widgetDisposed(DisposeEvent event) {
				dispose(event);
			}
		});
		
	CTabFolder tabFolder = new CTabFolder(shell, SWT.BOTTOM);
	new DiskExplorerTab(tabFolder, disks, imageManager, this);
	diskMapTabs = new DiskMapTab[disks.length];
	for (int i=0; i<disks.length; i++) {
		if (disks[i].supportsDiskMap()) {
			diskMapTabs[i] = new DiskMapTab(tabFolder, disks[i]);
		}
	}
	diskInfoTab = new DiskInfoTab(tabFolder, disks);
	tabFolder.setSelection(tabFolder.getItems()[0]);
	
	
	shell.open();
}
 
Example 4
Source File: CodeSelectorFactory.java    From elexis-3-core with Eclipse Public License 1.0 6 votes vote down vote up
public static void makeTabs(CTabFolder ctab, IViewSite site, String point){
	String settings = null;
	if (point.equals(ExtensionPointConstantsUi.VERRECHNUNGSCODE)) {
		settings = CoreHub.userCfg.get(Preferences.USR_SERVICES_DIAGNOSES_SRV, null);
	} else if (point.equals(ExtensionPointConstantsUi.DIAGNOSECODE)) {
		settings = CoreHub.userCfg.get(Preferences.USR_SERVICES_DIAGNOSES_DIAGNOSE, null);
	}
	
	java.util.List<IConfigurationElement> list = Extensions.getExtensions(point);
	if (settings == null) {
		addAllTabs(list, ctab, point);
	} else {
		addUserSpecifiedTabs(list, settings, ctab, point);
	}
	
	if (ctab.getItemCount() > 0) {
		ctab.setSelection(0);
	}
}
 
Example 5
Source File: TabbedEntry.java    From BiglyBT with GNU General Public License v2.0 6 votes vote down vote up
private void swt_show() {
	if (swtItem == null) {
		showonSWTItemSet = true;
		return;
	}
	showonSWTItemSet = false;
	if (!swt_build()) {
		return;
	}

	triggerOpenListeners();


	CTabFolder parent = swtItem.getParent();
	if (parent != null && parent.getSelection() != swtItem) {
		parent.setSelection(swtItem);
	}

	super.show();
}
 
Example 6
Source File: ComponentTitledBorder.java    From arx with Apache License 2.0 6 votes vote down vote up
/**
 * Creates a new instance.
 *
 * @param parent
 * @param controller
 * @param title
 * @param id
 */
public ComponentTitledBorder(Composite parent, Controller controller, String title, String id){

    folder = new CTabFolder(parent, SWT.TOP | SWT.BORDER | SWT.FLAT);
    folder.setUnselectedCloseVisible(false);
    folder.setSimple(false);
    
    // Create help button
    if (controller != null) SWTUtil.createHelpButton(controller, folder, id);

    // Prevent closing
    folder.addCTabFolder2Listener(new CTabFolder2Adapter() {
        @Override
        public void close(final CTabFolderEvent event) {
            event.doit = false;
        }
    });
    
    // Create general tab
    tab = new CTabItem(folder, SWT.NULL);
    tab.setText(title);
    tab.setShowClose(false);

    folder.setSelection(tab);
}
 
Example 7
Source File: LogAnalysis.java    From AndroidRobot with Apache License 2.0 6 votes vote down vote up
public void createLogDetail() {
    tabFolderLogDetail = new CTabFolder(sashFormLog, SWT.CLOSE | SWT.BORDER);
    tabFolderLogDetail.setTabHeight(0);
    tabFolderLogDetail.marginHeight = 0;
    tabFolderLogDetail.marginWidth = 0;
    tabFolderLogDetail.setMaximizeVisible(false);
    tabFolderLogDetail.setMinimizeVisible(false);
    //tabFolderLogDetail.setSelectionBackground(new Color(display, new RGB(153, 186, 243)));
    tabFolderLogDetail.setSimple(false);
    tabFolderLogDetail.setUnselectedCloseVisible(true);

    CTabItem tabItemLogList = new CTabItem(tabFolderLogDetail, SWT.NONE | SWT.MULTI
                                                               | SWT.V_SCROLL);
    tabFolderLogDetail.setSelection(tabItemLogList);

    //styledTextLog = new List(tabFolderLogDetail, SWT.BORDER);
    styledTextLog = new StyledText(tabFolderLogDetail, SWT.BORDER | SWT.MULTI | SWT.H_SCROLL
                                                       | SWT.V_SCROLL | SWT.READ_ONLY);
    styledTextLog.addLineStyleListener(new LogLineStyleListener(shell));
    tabItemLogList.setControl(styledTextLog);
    //sTextLog.setFont(new Font(display,"Courier New",10,SWT.NONE));

}
 
Example 8
Source File: TabFolderReorder.java    From hop with Apache License 2.0 5 votes vote down vote up
private void moveTabs( CTabFolder folder, DropTargetEvent event ) {
  Point point = folder.toControl( folder.getDisplay().getCursorLocation() );
  CTabItem item = folder.getItem( new Point( point.x, point.y ) );
  if ( item != null && dragItem != null ) {
    Control dragControl = dragItem.getControl();
    String dragText = dragItem.getText();
    Image dragImage = dragItem.getImage();
    String dragToolTip = dragItem.getToolTipText();
    boolean dragShowClose = dragItem.getShowClose();
    Object dragData = dragItem.getData();

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

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

    folder.setSelection( item );
  }
}
 
Example 9
Source File: JframeApp.java    From jframe with Apache License 2.0 5 votes vote down vote up
/**
 * @param content
 */
private void createTabFolder(Composite content) {
    CTabFolder folder = new CTabFolder(content, SWT.BORDER | SWT.BOTTOM);
    // folder.setSimple(false);
    // folder.setUnselectedImageVisible(false);
    // folder.setUnselectedCloseVisible(false);
    // folder.setMinimizeVisible(true);
    // folder.setMaximizeVisible(true);
    // configuration
    CTabItem startTab = new CTabItem(folder, SWT.NONE);
    startTab.setText("TAB1");
    Composite config = createMonitorConfig(folder);
    startTab.setControl(config);

    // monitor info
    CTabItem item = new CTabItem(folder, SWT.NONE);
    item.setText("TAB2");
    Text text = new Text(folder, SWT.MULTI | SWT.BORDER | SWT.V_SCROLL | SWT.H_SCROLL);
    text.setEditable(false);
    showRecvMsg(text);
    item.setControl(text);

    folder.addCTabFolder2Listener(new CTabFolder2Adapter() {
        @Override
        public void close(CTabFolderEvent event) {
            // if (event.item.equals(specialItem)) {
            // event.doit = false;
            // }
        }
    });
    folder.setSelection(item);

}
 
Example 10
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 11
Source File: LogAnalysis.java    From AndroidRobot with Apache License 2.0 4 votes vote down vote up
public void createLogList() {
    tabFolderLogList = new CTabFolder(sashFormLog, SWT.NONE | SWT.BORDER);
    tabFolderLogList.setTabHeight(0);
    tabFolderLogList.marginHeight = 0;
    tabFolderLogList.marginWidth = 0;
    tabFolderLogList.setLayout(new FillLayout());
    tabFolderLogList.setBounds(5, 5, 200, 465);
    tabFolderLogList.setSimple(false);
    tabFolderLogList.setUnselectedCloseVisible(true);

    CTabItem tabItemLogList = new CTabItem(tabFolderLogList, SWT.NONE | SWT.MULTI
                                                             | SWT.V_SCROLL);
    tabFolderLogList.setSelection(tabItemLogList);
    tabItemLogList.setText("日志浏览");

    Composite composite = new Composite(tabFolderLogList, SWT.NONE);
    composite.setLayout(new GridLayout());
    treeLog = new Tree(composite, SWT.BORDER);
    colorBlack = display.getSystemColor(SWT.COLOR_BLACK);

    tabItemLogList.setControl(composite);
    treeLog.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));

    treeLog.addListener(SWT.MouseDoubleClick, new Listener() {
        public void handleEvent(Event event) {
            Point point = new Point(event.x, event.y);
            TreeItem item = treeLog.getItem(point);
            if (item != null) {
                String taskName = (String) item.getData("task");
                String loop = String.valueOf(item.getData("loop"));
                String caseName = (String) item.getData("case");
                int index = (Integer) item.getData("index");
                //System.out.println("task:"+taskName+" loop:"+loop+" caseName:"+caseName+" index:"+index);
                if (index != 0)
                    Log.loadLogs(styledTextLog, display, logFile, taskName, loop, caseName,
                        index);
            }
        }
    });

}
 
Example 12
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 13
Source File: ArtikelView.java    From elexis-3-core with Eclipse Public License 1.0 4 votes vote down vote up
@Override
public void createPartControl(Composite parent){
	parent.setLayout(new FillLayout());
	ctab = new CTabFolder(parent, SWT.NONE);
	importers = new Hashtable<String, ImporterPage>();
	
	new FavoritenCTabItem(ctab, SWT.None);
	addPagesFor(ExtensionPointConstantsUi.VERRECHNUNGSCODE);
	
	if (ctab.getItemCount() > 0) {
		ctab.setSelection(0);
	}
	ctab.addSelectionListener(new SelectionAdapter() {
		@Override
		public void widgetSelected(SelectionEvent e){
			CTabItem selected = ctab.getSelection();
			
			if (selected instanceof FavoritenCTabItem)
				return;
			
			if (selected != null) {
				String t = selected.getText();
				
				MasterDetailsPage page = (MasterDetailsPage) selected.getControl();
				if (page == null) {
					try {
						IDetailDisplay det = (IDetailDisplay) selected.getData(KEY_DETAIL);
						IConfigurationElement ce =
							(IConfigurationElement) selected.getData(KEY_CE);
						CodeSelectorFactory cs =
							(CodeSelectorFactory) ce
								.createExecutableExtension(ExtensionPointConstantsUi.VERRECHNUNGSCODE_CSF);
						String a = ce.getAttribute(ExtensionPointConstantsUi.VERRECHNUNGSCODE_IMPC);
						ImporterPage ip = null;
						if (a != null) {
							ip = (ImporterPage) ce.createExecutableExtension(ExtensionPointConstantsUi.VERRECHNUNGSCODE_IMPC);
							if (ip != null) {
								importers.put(det.getTitle(), ip);
							}
						}
						
						page = new MasterDetailsPage(ctab, cs, det);
						selected.setControl(page);
						selected.setData(det);
					} catch (Exception ex) {
						LoggerFactory.getLogger(getClass()).error("Error creating pages", ex);
						return;
					}
				}
				importAction.setEnabled(importers.get(t) != null);
				ViewerConfigurer vc = page.cv.getConfigurer();
				vc.getControlFieldProvider().setFocus();
			}
		}
		
	});
	makeActions();
	viewmenus = new ViewMenus(getViewSite());
	viewmenus.createMenu(importAction /* ,deleteAction */);
	GlobalEventDispatcher.addActivationListener(this, this);
	
}
 
Example 14
Source File: CiviOutputDialog.java    From civicrm-data-integration with GNU General Public License v3.0 4 votes vote down vote up
private void addOutputTab() {
        wTabFolder = new CTabFolder(shell, SWT.BORDER);
        props.setLook(wTabFolder, Props.WIDGET_STYLE_TAB);

        /*************************************************
         * // CIVICRM OUTPUT TAB
         *************************************************/

        wOutputFieldsTab = new CTabItem(wTabFolder, SWT.NONE);
        wOutputFieldsTab.setText(BaseMessages.getString(PKG, "CiviCrmDialog.OutputFieldsGroup.Title")); //$NON-NLS-1$

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

        FormLayout outputFieldsCompLayout = new FormLayout();
        outputFieldsCompLayout.marginWidth = Const.FORM_MARGIN;
        outputFieldsCompLayout.marginHeight = Const.FORM_MARGIN;
        gOutputFields.setLayout(outputFieldsCompLayout);

        // -----------------------------------------------
        /*************************************************
         * // KEY / OUTPUT TABLE
         *************************************************/

        int outputKeyWidgetCols = 3;
        int outputKeyWidgetRows = (((CiviOutputMeta) input).getCiviCrmListingFields() != null ? ((CiviOutputMeta) input).getCiviCrmOutputMap().size()
                : 3);

        ColumnInfo[] ciFields = new ColumnInfo[outputKeyWidgetCols];
        streamFieldColumn = new ColumnInfo(BaseMessages.getString(PKG, "CiviCrmDialog.ColumnInfo.StreamField"), ColumnInfo.COLUMN_TYPE_CCOMBO,
                new String[]{}, false);
        outputFieldsColumn = new ColumnInfo(BaseMessages.getString(PKG, "CiviCrmDialog.ColumnInfo.EntityField"), ColumnInfo.COLUMN_TYPE_CCOMBO,
                new String[]{}, false);
        ciFields[0] = streamFieldColumn;
        ciFields[1] = outputFieldsColumn;
//        ciFields[2] = new ColumnInfo(BaseMessages.getString(PKG, "CiviCrmDialog.ColumnInfo.Source"), ColumnInfo.COLUMN_TYPE_NONE,false);
        ciFields[2] = new ColumnInfo(BaseMessages.getString(PKG, "CiviCrmDialog.ColumnInfo.TitleField"), ColumnInfo.COLUMN_TYPE_NONE,false);

        tOutputFields = new TableView(transMeta, gOutputFields, SWT.BORDER | SWT.FULL_SELECTION | SWT.MULTI | SWT.V_SCROLL | SWT.H_SCROLL,
                ciFields, outputKeyWidgetRows, lsMod, props);

        FormData fdOutputFields = new FormData();
        fdOutputFields.left = new FormAttachment(0, 0);
        fdOutputFields.top = new FormAttachment(0, margin);
        fdOutputFields.right = new FormAttachment(100, -margin);
        fdOutputFields.bottom = new FormAttachment(100, -margin);
        tOutputFields.setLayoutData(fdOutputFields);

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

        tOutputFields.setLayoutData(fdOutputFields);

        gOutputFields.layout();

        wOutputFieldsTab.setControl(gOutputFields);


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

        wTabFolder.setSelection(0);
    }
 
Example 15
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 );
  }
 
Example 16
Source File: LamiReportView.java    From tracecompass with Eclipse Public License 2.0 4 votes vote down vote up
@Override
public void createPartControl(@Nullable Composite parent) {
    LamiAnalysisReport report = fReport;
    if (report == null || parent == null) {
        return;
    }

    setPartName(report.getName());

    fTabFolder = new CTabFolder(parent, SWT.NONE);
    fTabFolder.setSimple(false);

    for (LamiResultTable table : report.getTables()) {
        String name = table.getTableClass().getTableTitle();

        CTabItem tabItem = new CTabItem(fTabFolder, SWT.NULL);
        tabItem.setText(name);

        SashForm sf = new SashForm(fTabFolder, SWT.NONE);
        fTabPages.add(new LamiReportViewTabPage(sf, table));
        tabItem.setControl(sf);
    }

    /* Add toolbar buttons */
    Action toggleTableAction = new ToggleTableAction();
    toggleTableAction.setText(Messages.LamiReportView_ActivateTableAction_ButtonName);
    toggleTableAction.setToolTipText(Messages.LamiReportView_ActivateTableAction_ButtonTooltip);
    toggleTableAction.setImageDescriptor(Activator.getDefault().getImageDescripterFromPath("icons/table.gif")); //$NON-NLS-1$

    IActionBars actionBars = getViewSite().getActionBars();
    IToolBarManager toolbarMgr = actionBars.getToolBarManager();
    toolbarMgr.add(toggleTableAction);

    fNewChartAction.setText(Messages.LamiReportView_NewCustomChart);

    fClearCustomViewsAction.setText(Messages.LamiReportView_ClearAllCustomViews);
    IMenuManager menuMgr = actionBars.getMenuManager();
    menuMgr.setRemoveAllWhenShown(true);
    menuMgr.addMenuListener((@Nullable IMenuManager manager) -> {
        if (manager != null) {
            populateMenu(manager);
        }
    });
    populateMenu(menuMgr);

    /* Select the first tab initially */
    CTabFolder tf = checkNotNull(fTabFolder);
    if (tf.getItemCount() > 0) {
        tf.setSelection(0);
    }

}
 
Example 17
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 18
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 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: XferStatsView.java    From BiglyBT with GNU General Public License v2.0 2 votes vote down vote up
public void 
initialize(
	Composite _composite) 
{
	composite = _composite;
	
	CTabFolder tab_folder = new CTabFolder(composite, SWT.LEFT);

	CTabItem global_item = new CTabItem(tab_folder, SWT.NULL);

	global_item.setText( MessageText.getString( "label.global" ));

	Composite global_composite = new Composite( tab_folder, SWT.NULL );

	global_item.setControl( global_composite );

	global_composite.setLayout(new FillLayout());
	global_composite.setLayoutData( Utils.getFilledFormData());
				
	Composite global_panel = new Composite(global_composite,SWT.NULL);
	global_panel.setLayout(new FillLayout());
	
	global_stats = new XferStatsPanel( global_panel, true );
	global_stats.setAutoAlpha(autoAlpha);
	

	CTabItem local_item = new CTabItem(tab_folder, SWT.NULL);

	local_item.setText( MessageText.getString( "DHTView.db.local" ));

	Composite local_composite = new Composite( tab_folder, SWT.NULL );

	local_composite.setLayout(new FillLayout());
	local_composite.setLayoutData( Utils.getFilledFormData());

	local_item.setControl( local_composite );
	
	Composite local_panel = new Composite(local_composite,SWT.NULL);
	local_panel.setLayout(new FillLayout());

	local_stats = new XferStatsPanel( local_panel, false );
	local_stats.setAutoAlpha(autoAlpha);
	
	tab_folder.setSelection(  global_item );

	CoreFactory.addCoreRunningListener(new CoreRunningListener() {

		@Override
		public void coreRunning(Core core) {
			
			Utils.execSWTThread(
				new Runnable(){
					
					@Override
					public void run(){
						GlobalManagerStats stats = core.getGlobalManager().getStats();
						
						global_stats.init( stats.getAggregateRemoteStats());
						local_stats.init( stats.getAggregateLocalStats());
					} 
				});
		}
	});
}