Java Code Examples for org.eclipse.swt.widgets.TabItem#setText()

The following examples show how to use org.eclipse.swt.widgets.TabItem#setText() . 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: TabDialog.java    From birt with Eclipse Public License 1.0 6 votes vote down vote up
/**
 * Creates and returns the contents of the upper part of this dialog (above
 * the button bar).
 * <p>
 * The <code>TabDialog</code> overrides this framework method to create and
 * return a new <code>Composite</code> with an empty tab folder.
 * </p>
 * 
 * @param parent
 *            the parent composite to contain the dialog area
 * @return the dialog area control
 */
protected Control createDialogArea( Composite parent )
{
	Composite composite = (Composite) super.createDialogArea( parent );
	TabFolder tabFolder = new TabFolder( composite, SWT.TOP );
	tabFolder.setLayoutData( new GridData( GridData.FILL_BOTH ) );
	addTabPages( ); // add pages
	for ( Iterator<TabPage> iterator = tabList.iterator( ); iterator.hasNext( ); )
	{
		TabPage page = iterator.next( );
		TabItem tabItem = new TabItem( tabFolder, SWT.NONE );
		tabItem.setControl( page.createControl( tabFolder ) );
		tabItem.setText( page.getName( ) );
	}
	return composite;
}
 
Example 2
Source File: SettingsDialog.java    From slr-toolkit with Eclipse Public License 1.0 6 votes vote down vote up
private void buildBarSettings() {
	
	TabFolder folderBarChart = new TabFolder(pageBarChart, SWT.NONE);
	
	TabItem itemFolderBarChart_1 = new TabItem(folderBarChart, SWT.NONE);
	TabItem itemFolderBarChart_2 = new TabItem(folderBarChart, SWT.NONE);
	TabItem itemFolderBarChart_3 = new TabItem(folderBarChart, SWT.NONE);
	TabItem itemFolderBarChart_4 = new TabItem(folderBarChart, SWT.NONE);
	
	
	generalPageBar = new GeneralPageBar(folderBarChart, SWT.NONE);
	itemFolderBarChart_1.setControl(generalPageBar);
	itemFolderBarChart_1.setText("General Settings");
	
	legendPageBar = new LegendPageBar(folderBarChart, SWT.NONE);
	itemFolderBarChart_2.setControl(legendPageBar);
	itemFolderBarChart_2.setText("Legend Settings");
	
	seriesPageBar = new SeriesPageBar(folderBarChart, SWT.NONE);
	itemFolderBarChart_3.setControl(seriesPageBar);
	itemFolderBarChart_3.setText("Series Settings");
	
	axisPageBar = new AxisPageBar(folderBarChart, SWT.NONE);
	itemFolderBarChart_4.setControl(axisPageBar);
	itemFolderBarChart_4.setText("Axis Settings");
}
 
Example 3
Source File: SettingsDialog.java    From slr-toolkit with Eclipse Public License 1.0 6 votes vote down vote up
private void buildBubbleSettings() {
	pageBubbleChart.setLayout(new FillLayout());
	TabFolder folderBubbleChart = new TabFolder(pageBubbleChart, SWT.NONE);
	
	TabItem itemFolderBubbleChart_1 = new TabItem(folderBubbleChart, SWT.NONE);
	TabItem itemFolderBubbleChart_2 = new TabItem(folderBubbleChart, SWT.NONE);
	TabItem itemFolderBubbleChart_3 = new TabItem(folderBubbleChart, SWT.NONE);
	
	gerneralPageBubble = new GeneralPageBubble(folderBubbleChart, SWT.NONE);
	seriesPageBubble = new SeriesPageBubble(folderBubbleChart, SWT.NONE);
	axisPageBubble = new AxisPageBubble(folderBubbleChart, SWT.NONE);
	
	itemFolderBubbleChart_1.setControl(gerneralPageBubble);
	itemFolderBubbleChart_2.setControl(seriesPageBubble);
	itemFolderBubbleChart_3.setControl(axisPageBubble);
	
	itemFolderBubbleChart_1.setText("General Settings");
	itemFolderBubbleChart_2.setText("Series Settings");
	itemFolderBubbleChart_3.setText("Axis Settings");
}
 
Example 4
Source File: AggregationDialog.java    From birt with Eclipse Public License 1.0 6 votes vote down vote up
private TabFolder createTabFolder( Composite parent )
{
	tabFolder = new TabFolder( parent, SWT.NONE );
	// Should not set layout for TabFolder.
	// GridData gd = new GridData( GridData.FILL_BOTH );
	// tabFolder.setLayoutData( gd );
	// GridLayout layout = new GridLayout( );
	// tabFolder.setLayout( layout );

	rowArea = new TabItem( tabFolder, SWT.NONE );
	rowArea.setText( Messages.getString( "AggregationDialog.TabItem.Title.RowArea" ) ); //$NON-NLS-1$
	rowArea.setImage( CrosstabUIHelper.getImage( CrosstabUIHelper.ROWS_AREA_IMAGE ) );

	columnArea = new TabItem( tabFolder, SWT.NONE );
	columnArea.setText( Messages.getString( "AggregationDialog.TabItem.Title.ColumnArea" ) ); //$NON-NLS-1$
	columnArea.setImage( CrosstabUIHelper.getImage( CrosstabUIHelper.COLUMNS_AREA_IMAGE ) );

	return tabFolder;
}
 
Example 5
Source File: UpdaterDialog.java    From developer-studio with Apache License 2.0 6 votes vote down vote up
private void createFeatureListTab(TabFolder tabFolder, ActiveTab type) {
	TabItem tabItem = new TabItem(tabFolder, SWT.NULL);
	if (type == ActiveTab.ALL_FEATURES) {
		tabItem.setText(ALL_FEATURES_TAB_TITLE);
	} else {
		tabItem.setText(UPDATES_TAB_TITLE);
	}
	ScrolledComposite scroll = new ScrolledComposite(tabFolder, SWT.V_SCROLL | SWT.H_SCROLL);
	scroll.setLayout(new GridLayout());
	scroll.setLayoutData(new GridData());

	Group group = new Group(scroll, SWT.NONE);
	group.setLayout(new GridLayout());
	group.setLayoutData(new GridData());
	listFeatures(group, type);
	scroll.setContent(group);
	scroll.setExpandHorizontal(true);
	scroll.setExpandVertical(true);
	scroll.setMinSize(group.computeSize(SWT.DEFAULT, SWT.DEFAULT));
	tabItem.setControl(scroll);
}
 
Example 6
Source File: PropertyTableSnippet.java    From nebula with Eclipse Public License 2.0 5 votes vote down vote up
/**
 * @param args
 */
public static void main(final String[] args) {

	Locale.setDefault(Locale.ENGLISH);

	final Display display = new Display();
	final Shell shell = new Shell(display);
	shell.setText("PropertyTable snippet");
	shell.setLayout(new FillLayout(SWT.VERTICAL));

	final TabFolder tabFolder = new TabFolder(shell, SWT.BORDER);

	final TabItem item1 = new TabItem(tabFolder, SWT.NONE);
	item1.setText("First");
	item1.setControl(buildPropertyTable(tabFolder, true, true, true));

	final TabItem item2 = new TabItem(tabFolder, SWT.NONE);
	item2.setText("Second");
	item2.setControl(buildPropertyTable(tabFolder, false, true, false));

	final TabItem item3 = new TabItem(tabFolder, SWT.NONE);
	item3.setText("Third");
	item3.setControl(buildPropertyTable(tabFolder, true, false, true));

	final TabItem item4 = new TabItem(tabFolder, SWT.NONE);
	item4.setText("Forth");
	item4.setControl(buildPropertyTable(tabFolder, true, false, false));

	shell.setSize(800, 600);
	shell.open();
	SWTGraphicUtil.centerShell(shell);

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

	display.dispose();
}
 
Example 7
Source File: EventHistorySearchDialog.java    From neoscada with Eclipse Public License 1.0 5 votes vote down vote up
@Override
protected Control createDialogArea ( final Composite parent )
{
    // initialize header area
    setTitle ( Messages.search_for_events );
    setMessage ( Messages.search_for_events_description );
    // setHelpAvailable ( true );

    // initialize content
    final Composite rootComposite = (Composite)super.createDialogArea ( parent );

    String filterString = ""; //$NON-NLS-1$
    if ( this.initialFilter != null && this.initialFilter.second != null )
    {
        filterString = this.initialFilter.second;
    }

    final TabFolder tabFolder = new TabFolder ( rootComposite, SWT.NONE );

    // create tabs
    for ( final FilterTab tab : getFilterTabs () )
    {
        final TabItem tabItem = new TabItem ( tabFolder, SWT.NONE );
        tabItem.setText ( tab.getName () );
        tabItem.setControl ( tab.createControl ( tabFolder, this, SWT.NONE, filterString ) );
    }

    final GridData layoutData = new GridData ();
    layoutData.horizontalAlignment = GridData.FILL;
    layoutData.grabExcessHorizontalSpace = true;
    layoutData.verticalAlignment = GridData.FILL;
    layoutData.grabExcessVerticalSpace = true;
    tabFolder.setLayoutData ( layoutData );

    selectInitialFilterPage ( tabFolder );

    return rootComposite;
}
 
Example 8
Source File: SubscriptionWizard.java    From BiglyBT with GNU General Public License v2.0 5 votes vote down vote up
private Composite createCreateComposite(Composite parent) {
	Composite composite = new Composite(parent,SWT.NONE);

	FillLayout layout = new FillLayout();
	layout.marginHeight = 8;
	layout.marginWidth  = 8;

	composite.setLayout(layout);

	createTabFolder = new TabFolder(composite,SWT.NONE);
	createTabFolder.setFont(subTitleFont);

	createSearchTabItem = new TabItem(createTabFolder,SWT.NONE);
	createSearchTabItem.setText(MessageText.getString("Wizard.Subscription.create.search"));
	createSearchTabItem.setControl(createCreateSearchComposite(createTabFolder));

	createRSSTabItem = new TabItem(createTabFolder,SWT.NONE);
	createRSSTabItem.setText("  " + MessageText.getString("Wizard.Subscription.create.rss"));
	createRSSTabItem.setControl(createCreateRSSComposite(createTabFolder));

	createTabFolder.addListener(SWT.Selection, new Listener() {
		@Override
		public void handleEvent(Event event) {
			TabItem[] selectedItems = createTabFolder.getSelection();
			if(selectedItems.length != 1) {
				return;
			}
			TabItem selectedItem = selectedItems[0];
			if(selectedItem == createRSSTabItem) {
				setMode(MODE_CREATE_RSS);
			} else {
				setMode(MODE_CREATE_SEARCH);
			}
		}
	});

	return composite;
}
 
Example 9
Source File: GrammarPreferencePage.java    From tm4e with Eclipse Public License 1.0 5 votes vote down vote up
/**
 * Create "Content type" tab
 * 
 * @param folder
 */
private void createContentTypeTab(TabFolder folder) {
	TabItem tab = new TabItem(folder, SWT.NONE);
	tab.setText(TMUIMessages.GrammarPreferencePage_tab_contentType_text);

	Composite parent = new Composite(folder, SWT.NONE);
	parent.setLayout(new GridLayout());
	parent.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));

	contentTypesWidget = new ContentTypesBindingWidget(parent, SWT.NONE);
	contentTypesWidget.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));

	tab.setControl(parent);
}
 
Example 10
Source File: TmxEditor.java    From tmxeditor8 with GNU General Public License v2.0 5 votes vote down vote up
public void createContent(TmxEditorViewer viewPart, Composite container) {
	this.parentComposite = container;
	this.viewPart = viewPart;
	GridLayout containerGdLt = new GridLayout(1, true);
	containerGdLt.marginWidth = 0;
	containerGdLt.marginHeight = 0;
	containerGdLt.verticalSpacing = 5;
	containerGdLt.marginTop = 0;
	containerGdLt.marginLeft = 0;
	containerGdLt.marginRight = 0;
	container.setLayout(containerGdLt);

	// tab 设置,分为数据查询以及品质检查
	TabFolder tab = new TabFolder(container, SWT.NONE);
	tab.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
	TabItem editorItm = new TabItem(tab, SWT.NONE);
	editorItm.setText(Messages.getString("tmxeditor.filter.editor"));

	TabItem qaItm = new TabItem(tab, SWT.NONE);
	qaItm.setText(Messages.getString("tmxeditor.filter.qa"));

	Composite editorCmp = new Composite(tab, SWT.NONE);
	GridDataFactory.fillDefaults().grab(true, true).applyTo(editorCmp);
	GridLayoutFactory.fillDefaults().numColumns(2).applyTo(editorCmp);
	createEditorArea(editorCmp);
	editorItm.setControl(editorCmp);

	Composite qaCmp = new Composite(tab, SWT.NONE);
	GridDataFactory.fillDefaults().grab(true, true).applyTo(qaCmp);
	GridLayoutFactory.fillDefaults().numColumns(2).applyTo(qaCmp);
	createQaArea(qaCmp);
	qaItm.setControl(qaCmp);

	// create nattable composite
	Composite nattableComposite = new Composite(container, SWT.NONE);
	nattableComposite.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 2, 1));
	createNattable(nattableComposite, srcLangCode, tgtLangCode);
}
 
Example 11
Source File: FormatterModifyDialog.java    From xtext-xtend with Eclipse Public License 2.0 5 votes vote down vote up
private final void addTabPageNewAPI(String title, IModifyDialogTabPage tabPage) {
	final TabItem tabItem = new TabItem(fTabFolder, SWT.NONE);
	applyDialogFont(tabItem.getControl());
	tabItem.setText(title);
	tabItem.setData(tabPage);
	tabItem.setControl(tabPage.createContents(fTabFolder));
	fTabPages.add(tabPage);
}
 
Example 12
Source File: ModifyDialog.java    From xds-ide with Eclipse Public License 1.0 5 votes vote down vote up
protected final void addTabPage(String title, IModifyDialogTabPage tabPage) {
    final TabItem tabItem= new TabItem(fTabFolder, SWT.NONE);
    applyDialogFont(tabItem.getControl());
    tabItem.setText(title);
    tabItem.setData(tabPage);
    tabItem.setControl(tabPage.createContents(fTabFolder));
    fTabPages.add(tabPage);
}
 
Example 13
Source File: HadoopLocationWizard.java    From hadoop-gpu with Apache License 2.0 5 votes vote down vote up
TabAdvanced(TabMediator mediator) {
  this.mediator = mediator;
  TabItem tab = new TabItem(mediator.folder, SWT.NONE);
  tab.setText("Advanced parameters");
  tab.setToolTipText("Access to advanced Hadoop parameters");
  tab.setImage(circle);
  tab.setControl(createControl(mediator.folder));

}
 
Example 14
Source File: SearchDialog.java    From ermasterr with Apache License 2.0 4 votes vote down vote up
private void createResultGroup(final TabFolder tabFolder) {
    final TabItem tabItem = new TabItem(tabFolder, SWT.NONE);
    tabItem.setText(ResourceString.getResourceString("label.search.result"));

    final GridData gridData = new GridData();
    gridData.grabExcessVerticalSpace = true;
    gridData.verticalAlignment = SWT.FILL;
    gridData.grabExcessHorizontalSpace = true;
    gridData.horizontalAlignment = SWT.FILL;

    resultTable = new Table(tabFolder, SWT.NONE | SWT.FULL_SELECTION | SWT.MULTI);
    resultTable.setHeaderVisible(true);
    resultTable.setLayoutData(gridData);
    resultTable.setLinesVisible(true);

    resultTable.addSelectionListener(new SelectionAdapter() {

        /**
         * {@inheritDoc}
         */
        @Override
        public void widgetSelected(final SelectionEvent e) {
            final int index = resultTable.getSelectionIndex();

            if (index == -1) {
                replaceButton.setEnabled(false);
                replaceCombo.setEnabled(false);

            } else {
                replaceButton.setEnabled(true);
                replaceCombo.setEnabled(true);

                final SearchResultRow searchResultRow = searchResult.getRows().get(index);

                final Object object = searchResultRow.getTargetNode();

                if (object != null) {
                    focus(object);
                }
            }
        }
    });

    final TableColumn tableColumn0 = new TableColumn(resultTable, SWT.LEFT);
    tableColumn0.setWidth(250);
    tableColumn0.setText(ResourceString.getResourceString("label.search.result.table.path"));
    tableColumn0.addSelectionListener(new SearchResultSortListener(SearchResult.SORT_TYPE_PATH));

    final TableColumn tableColumn1 = new TableColumn(resultTable, SWT.LEFT);
    tableColumn1.setWidth(100);
    tableColumn1.setText(ResourceString.getResourceString("label.search.result.table.type"));
    tableColumn1.addSelectionListener(new SearchResultSortListener(SearchResult.SORT_TYPE_TYPE));

    final TableColumn tableColumn2 = new TableColumn(resultTable, SWT.LEFT);
    tableColumn2.setWidth(200);
    tableColumn2.setText(ResourceString.getResourceString("label.search.result.table.name"));
    tableColumn2.addSelectionListener(new SearchResultSortListener(SearchResult.SORT_TYPE_NAME));

    final TableColumn tableColumn3 = new TableColumn(resultTable, SWT.LEFT);
    tableColumn3.setWidth(200);
    tableColumn3.setText(ResourceString.getResourceString("label.search.result.table.value"));
    tableColumn3.addSelectionListener(new SearchResultSortListener(SearchResult.SORT_TYPE_VALUE));

    tabItem.setControl(resultTable);
}
 
Example 15
Source File: OptionsShell.java    From RepDev with GNU General Public License v3.0 4 votes vote down vote up
private void createDevOptions() {
	developerOptions = new Composite(tabs, SWT.NONE);
	TabItem devOptionsTab = new TabItem(tabs, SWT.NONE);
	devOptionsTab.setText("Developer");
	devOptionsTab.setControl(developerOptions);
	
	Group devGroup = new Group(developerOptions, SWT.NONE);
	devGroup.setText("Developer Options");
	FormLayout layout = new FormLayout();
	layout.marginTop = 5;
	layout.marginBottom = 5;
	layout.marginLeft = 5;
	layout.marginRight = 5;
	layout.spacing = 5;
	devGroup.setLayout(layout);
	developerOptions.setLayout(layout);
	
	Label devNotice = new Label(devGroup, SWT.NONE);
	devNotice.setText("Developer mode enabled");
			
	devForgetBox = new Button(devGroup, SWT.CHECK);
	devForgetBox.setText("Forget Passwords on exit");
	devForgetBox.setSelection(RepDevMain.FORGET_PASS_ON_EXIT);
	
	Group devBackup = new Group(developerOptions, SWT.NONE);
	devBackup.setText("Backup Options");
	devBackup.setLayout(new GridLayout(2, false));
	
	backupEnable = new Button(devBackup, SWT.CHECK);
	backupEnable.setText("Enable project file backup");
	backupEnable.setSelection(Config.getBackupProjectFiles());
			
	FormData data = new FormData();
	data.left = new FormAttachment(0);
	data.right = new FormAttachment(100);
	data.top = new FormAttachment(0);
	devGroup.setLayoutData(data);
	
	data = new FormData();
	data.left = new FormAttachment(0);
	data.top = new FormAttachment(0);
	devNotice.setLayoutData(data);
			
	data = new FormData();
	data.left = new FormAttachment(0);
	data.top = new FormAttachment(devNotice);
	devForgetBox.setLayoutData(data);
	
	// Backup options under normal dev options
	data = new FormData();
	data.left = new FormAttachment(0);
	data.right = new FormAttachment(100);
	data.top = new FormAttachment(devGroup);
	devBackup.setLayoutData(data);
}
 
Example 16
Source File: SWTPlotEditor.java    From ccu-historian with GNU General Public License v3.0 4 votes vote down vote up
/**
 * Creates a new editor for the specified plot.
 *
 * @param parent  the parent.
 * @param style  the style.
 * @param plot  the plot.
 */
public SWTPlotEditor(Composite parent, int style, Plot plot) {
    super(parent, style);
    FillLayout layout = new FillLayout();
    layout.marginHeight = layout.marginWidth = 4;
    setLayout(layout);

    Group plotType = new Group(this, SWT.NONE);
    FillLayout plotTypeLayout = new FillLayout();
    plotTypeLayout.marginHeight = plotTypeLayout.marginWidth = 4;
    plotType.setLayout(plotTypeLayout);
    plotType.setText(plot.getPlotType() + localizationResources.getString(
            ":"));

    TabFolder tabs = new TabFolder(plotType, SWT.NONE);

    //deal with domain axis
    TabItem item1 = new TabItem(tabs, SWT.NONE);
    item1.setText(localizationResources.getString("Domain_Axis"));
    Axis domainAxis = null;
    if (plot instanceof CategoryPlot) {
        domainAxis = ((CategoryPlot) plot).getDomainAxis();
    }
    else if (plot instanceof XYPlot) {
        domainAxis = ((XYPlot) plot).getDomainAxis();
    }
    this.domainAxisPropertyPanel = SWTAxisEditor.getInstance(tabs,
            SWT.NONE, domainAxis);
    item1.setControl(this.domainAxisPropertyPanel);

    //deal with range axis
    TabItem item2 = new TabItem(tabs, SWT.NONE);
    item2.setText(localizationResources.getString("Range_Axis"));
    Axis rangeAxis = null;
    if (plot instanceof CategoryPlot) {
        rangeAxis = ((CategoryPlot) plot).getRangeAxis();
    }
    else if (plot instanceof XYPlot) {
        rangeAxis = ((XYPlot) plot).getRangeAxis();
    }
    this.rangeAxisPropertyPanel = SWTAxisEditor.getInstance(tabs, SWT.NONE,
            rangeAxis);
    item2.setControl(this.rangeAxisPropertyPanel);

    //deal with plot appearance
    TabItem item3 = new TabItem(tabs, SWT.NONE);
    item3.setText(localizationResources.getString("Appearance"));
    this.plotAppearance = new SWTPlotAppearanceEditor(tabs, SWT.NONE, plot);
    item3.setControl(this.plotAppearance);
}
 
Example 17
Source File: AccountTabFolder.java    From offspring with MIT License 4 votes vote down vote up
public AccountTabFolder(Composite parent, int style, final Long accountId,
    final INxtService nxt, final IStylingEngine engine,
    final IUserService userService, final UISynchronize sync,
    final IContactsService contactsService) {
  super(parent, style);
  this.accountId = accountId;
  this.userService = userService;
  this.contactsService = contactsService;
  this.nxt = nxt;
  this.engine = engine;
  this.sync = sync;
  setLayout(new FillLayout());
  tabFolder = new TabFolder(this, SWT.NONE);

  transactionsTab = new TabItem(tabFolder, SWT.NONE);
  transactionsTab.setText("Transactions");

  generatedBlocksTab = new TabItem(tabFolder, SWT.NONE);
  generatedBlocksTab.setText("Blocks");

  aliasesTab = new TabItem(tabFolder, SWT.NONE);
  aliasesTab.setText("Aliases");

  assetsTab = new TabItem(tabFolder, SWT.NONE);
  assetsTab.setText("Assets");

  messagesTab = new TabItem(tabFolder, SWT.NONE);
  messagesTab.setText("Messages");

  tabFolder.addSelectionListener(new SelectionAdapter() {

    @Override
    public void widgetSelected(SelectionEvent e) {
      TabItem[] items = tabFolder.getSelection();
      if (items != null && items.length > 0) {
        TabItem tab = items[0];
        if (selectedTab == null || !selectedTab.equals(tab)) {
          selectedTab = tab;
          refresh();
        }
      }
    }
  });
}
 
Example 18
Source File: CronEditor.java    From bonita-studio with GNU General Public License v2.0 4 votes vote down vote up
protected void createDailyTab(TabFolder tablFolder) {
    final TabItem item = new TabItem(tablFolder, SWT.NONE);
    item.setText(Messages.daily);

    final Composite dailyContent = new Composite(tablFolder, SWT.NONE);
    dailyContent.setLayoutData(GridDataFactory.fillDefaults().grab(true, true).create());
    dailyContent.setLayout(GridLayoutFactory.fillDefaults().numColumns(2).margins(15, 10).create());

    final Button everyRadio = new Button(dailyContent, SWT.RADIO);
    everyRadio.setLayoutData(GridDataFactory.fillDefaults().align(SWT.BEGINNING, SWT.CENTER).create());
    everyRadio.setText(Messages.every);

    context.bindValue(SWTObservables.observeSelection(everyRadio),
            PojoProperties.value("useEveryDayForDaily").observe(cronExpression));

    final Composite everyComposite = new Composite(dailyContent, SWT.NONE);
    everyComposite.setLayoutData(GridDataFactory.fillDefaults().grab(true, false).indent(-65, 0).create());
    everyComposite.setLayout(GridLayoutFactory.fillDefaults().numColumns(2).margins(0, 0).create());

    final Text dayText = new Text(everyComposite, SWT.BORDER | SWT.SINGLE);
    dayText.setLayoutData(GridDataFactory.fillDefaults().hint(70, SWT.DEFAULT).create());

    UpdateValueStrategy dayFrequencyStrategy = new UpdateValueStrategy();
    dayFrequencyStrategy.setAfterGetValidator(dotValidator);
    dayFrequencyStrategy.setConverter(StringToNumberConverter.toInteger(true));
    dayFrequencyStrategy.setBeforeSetValidator(new FrequencyValidator());
    context.bindValue(SWTObservables.observeText(dayText, SWT.Modify),
            PojoProperties.value("dayFrequencyForDaily").observe(cronExpression), dayFrequencyStrategy, null);

    final Label dayLabel = new Label(everyComposite, SWT.NONE);
    dayLabel.setLayoutData(GridDataFactory.fillDefaults().align(SWT.BEGINNING, SWT.CENTER).create());
    dayLabel.setText(Messages.dayLabel);

    final Button everyWeekDayRadio = new Button(dailyContent, SWT.RADIO);
    everyWeekDayRadio.setLayoutData(GridDataFactory.fillDefaults().align(SWT.BEGINNING, SWT.CENTER).create());
    everyWeekDayRadio.setText(Messages.everyWeekDay);

    final Label filler = new Label(dailyContent, SWT.NONE);
    filler.setLayoutData(GridDataFactory.fillDefaults().grab(true, false).create());

    final IObservableValue hourObservable = PojoProperties.value("atHourInDay").observe(cronExpression);
    final IObservableValue minuteObservable = PojoProperties.value("atMinuteInDay").observe(cronExpression);
    final IObservableValue secondObservable = PojoProperties.value("atSecondInDay").observe(cronExpression);
    createStartTimeComposite(dailyContent, hourObservable, minuteObservable, secondObservable);

    item.setControl(dailyContent);
}
 
Example 19
Source File: SWTPlotEditor.java    From astor with GNU General Public License v2.0 4 votes vote down vote up
/**
 * Creates a new editor for the specified plot.
 *
 * @param parent  the parent.
 * @param style  the style.
 * @param plot  the plot.
 */
public SWTPlotEditor(Composite parent, int style, Plot plot) {
    super(parent, style);
    FillLayout layout = new FillLayout();
    layout.marginHeight = layout.marginWidth = 4;
    this.setLayout(layout);

    Group plotType = new Group(this, SWT.NONE);
    FillLayout plotTypeLayout = new FillLayout();
    plotTypeLayout.marginHeight = plotTypeLayout.marginWidth = 4;
    plotType.setLayout(plotTypeLayout);
    plotType.setText(plot.getPlotType() + localizationResources.getString(
            ":"));

    TabFolder tabs = new TabFolder(plotType, SWT.NONE);

    //deal with domain axis
    TabItem item1 = new TabItem(tabs, SWT.NONE);
    item1.setText(localizationResources.getString("Domain_Axis"));
    Axis domainAxis = null;
    if (plot instanceof CategoryPlot) {
        domainAxis = ((CategoryPlot) plot).getDomainAxis();
    }
    else if (plot instanceof XYPlot) {
        domainAxis = ((XYPlot) plot).getDomainAxis();
    }
    this.domainAxisPropertyPanel = SWTAxisEditor.getInstance(tabs,
            SWT.NONE, domainAxis);
    item1.setControl(this.domainAxisPropertyPanel);

    //deal with range axis
    TabItem item2 = new TabItem(tabs, SWT.NONE);
    item2.setText(localizationResources.getString("Range_Axis"));
    Axis rangeAxis = null;
    if (plot instanceof CategoryPlot) {
        rangeAxis = ((CategoryPlot) plot).getRangeAxis();
    }
    else if (plot instanceof XYPlot) {
        rangeAxis = ((XYPlot) plot).getRangeAxis();
    }
    this.rangeAxisPropertyPanel = SWTAxisEditor.getInstance(tabs, SWT.NONE,
            rangeAxis);
    item2.setControl(this.rangeAxisPropertyPanel);

    //deal with plot appearance
    TabItem item3 = new TabItem(tabs, SWT.NONE);
    item3.setText(localizationResources.getString("Appearance"));
    this.plotAppearance = new SWTPlotAppearanceEditor(tabs, SWT.NONE, plot);
    item3.setControl(this.plotAppearance);
}
 
Example 20
Source File: CronEditor.java    From bonita-studio with GNU General Public License v2.0 4 votes vote down vote up
protected void createHourlyTab(TabFolder tablFolder) {
    final TabItem item = new TabItem(tablFolder, SWT.NONE);
    item.setText(Messages.hourly);

    final Composite hourlyContent = new Composite(tablFolder, SWT.NONE);
    hourlyContent.setLayoutData(GridDataFactory.fillDefaults().grab(true, true).create());
    hourlyContent.setLayout(GridLayoutFactory.fillDefaults().numColumns(2).margins(15, 10).create());

    final Button everyRadio = new Button(hourlyContent, SWT.RADIO);
    everyRadio.setLayoutData(GridDataFactory.fillDefaults().align(SWT.BEGINNING, SWT.CENTER).create());
    everyRadio.setText(Messages.every);

    context.bindValue(SWTObservables.observeSelection(everyRadio),
            PojoProperties.value("useEveryHour").observe(cronExpression));

    final Composite everyComposite = new Composite(hourlyContent, SWT.NONE);
    everyComposite.setLayoutData(GridDataFactory.fillDefaults().grab(true, false).create());
    everyComposite.setLayout(GridLayoutFactory.fillDefaults().numColumns(2).margins(0, 0).create());

    final Text minuteText = new Text(everyComposite, SWT.BORDER | SWT.SINGLE);
    minuteText.setLayoutData(GridDataFactory.fillDefaults().hint(70, SWT.DEFAULT).create());

    UpdateValueStrategy hourFrequencyStrategy = new UpdateValueStrategy();
    hourFrequencyStrategy.setAfterGetValidator(dotValidator);
    hourFrequencyStrategy.setConverter(StringToNumberConverter.toInteger(true));
    hourFrequencyStrategy.setBeforeSetValidator(new FrequencyValidator());

    context.bindValue(SWTObservables.observeText(minuteText, SWT.Modify),
            PojoProperties.value("hourFrequencyForHourly").observe(cronExpression), hourFrequencyStrategy, null);

    final Label minuteLabel = new Label(everyComposite, SWT.NONE);
    minuteLabel.setLayoutData(GridDataFactory.fillDefaults().align(SWT.BEGINNING, SWT.CENTER).create());
    minuteLabel.setText(Messages.hourLabel);

    final Button atRadio = new Button(hourlyContent, SWT.RADIO);
    atRadio.setLayoutData(GridDataFactory.fillDefaults().align(SWT.BEGINNING, SWT.CENTER).create());
    atRadio.setText(Messages.at);

    final Composite atComposite = new Composite(hourlyContent, SWT.NONE);
    atComposite.setLayoutData(GridDataFactory.fillDefaults().grab(true, false).create());
    atComposite.setLayout(GridLayoutFactory.fillDefaults().numColumns(3).margins(0, 0).create());

    final Combo hourCombo = new Combo(atComposite, SWT.READ_ONLY | SWT.BORDER);
    hourCombo.setItems(HOURS_IN_DAY);

    UpdateValueStrategy hourStrategy = new UpdateValueStrategy();
    hourStrategy.setConverter(StringToNumberConverter.toInteger(true));
    UpdateValueStrategy hourStrategy2 = new UpdateValueStrategy();

    NumberFormat formatter = new DecimalFormat("#00");
    hourStrategy2.setConverter(NumberToStringConverter.fromInteger(formatter, true));
    context.bindValue(SWTObservables.observeText(hourCombo),
            PojoProperties.value("atHour").observe(cronExpression), hourStrategy, hourStrategy2);

    final Combo minuteCombo = new Combo(atComposite, SWT.READ_ONLY | SWT.BORDER);
    minuteCombo.setItems(MINUTES_IN_HOURS);

    UpdateValueStrategy minuteStrategy = new UpdateValueStrategy();
    minuteStrategy.setConverter(StringToNumberConverter.toInteger(true));
    UpdateValueStrategy minuteStrategy2 = new UpdateValueStrategy();
    minuteStrategy2.setConverter(NumberToStringConverter.fromInteger(formatter, true));
    context.bindValue(SWTObservables.observeText(minuteCombo),
            PojoProperties.value("atMinute").observe(cronExpression), minuteStrategy, minuteStrategy2);

    final Combo secondCombo = new Combo(atComposite, SWT.READ_ONLY | SWT.BORDER);
    secondCombo.setItems(MINUTES_IN_HOURS);

    final IObservableValue secondObservable = PojoProperties.value("atSecond").observe(cronExpression);
    UpdateValueStrategy secondStrategy = new UpdateValueStrategy();
    secondStrategy.setConverter(StringToNumberConverter.toInteger(true));
    UpdateValueStrategy secondStrategy2 = new UpdateValueStrategy();
    secondStrategy2.setConverter(NumberToStringConverter.fromInteger(formatter, true));
    context.bindValue(SWTObservables.observeText(secondCombo), secondObservable, secondStrategy, secondStrategy2);

    item.setControl(hourlyContent);
}