org.eclipse.ui.forms.widgets.Section Java Examples

The following examples show how to use org.eclipse.ui.forms.widgets.Section. 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: ApplicationOverviewEditorPart.java    From codewind-eclipse with Eclipse Public License 2.0 7 votes vote down vote up
public ProjectInfoSection(Composite parent, FormToolkit toolkit, int hSpan, int vSpan) {
	Section section = toolkit.createSection(parent, ExpandableComposite.TWISTIE | ExpandableComposite.TITLE_BAR);
       section.setText(Messages.AppOverviewEditorProjectInfoSection);
       section.setLayoutData(new GridData(SWT.FILL,SWT.FILL, true, false, hSpan, vSpan));
       section.setExpanded(true);

       Composite composite = toolkit.createComposite(section);
       GridLayout layout = new GridLayout();
       layout.numColumns = 2;
       layout.marginHeight = 5;
       layout.marginWidth = 10;
       layout.verticalSpacing = 5;
       layout.horizontalSpacing = 10;
       composite.setLayout(layout);
       composite.setLayoutData(new GridData(GridData.FILL_HORIZONTAL | GridData.VERTICAL_ALIGN_FILL));
       toolkit.paintBordersFor(composite);
       section.setClient(composite);
       
       typeEntry = new StringEntry(composite, Messages.AppOverviewEditorTypeEntry);
       languageEntry = new StringEntry(composite, Messages.AppOverviewEditorLanguageEntry);
       projectIdEntry = new StringEntry(composite, Messages.AppOverviewEditorProjectIdEntry);
       locationEntry = new StringEntry(composite, Messages.AppOverviewEditorLocationEntry);
}
 
Example #2
Source File: ContractPropertySection.java    From bonita-studio with GNU General Public License v2.0 6 votes vote down vote up
private void createBdmTipsSection(Composite parent) {
    final Section bdmTipsSection = getWidgetFactory().createSection(parent, Section.NO_TITLE);
    bdmTipsSection.setLayout(GridLayoutFactory.fillDefaults().create());
    bdmTipsSection.setLayoutData(GridDataFactory.fillDefaults().span(2, 1).grab(true, false).create());

    CreateBusinessDataProposalListener createBusinessDataProposalListener = new CreateBusinessDataProposalListener();
    DocumentProposalListener documentProposalListener = new DocumentProposalListener();

    Link tips = new Link(bdmTipsSection, SWT.None);
    tips.setText(getBdmTipsMessage());
    getWidgetFactory().adapt(tips, true, true);
    tips.addListener(SWT.Selection, e -> {
        if (Objects.equals(e.text, "documents")) {
            documentProposalListener.handleEvent((EObject) poolSelectionProvider.getAdapter(EObject.class),
                    "");
        } else {
            createBusinessDataProposalListener.handleEvent((EObject) poolSelectionProvider.getAdapter(EObject.class),
                    "");
        }
    });
    selectionProvider.addSelectionChangedListener(e -> tips.setText(getBdmTipsMessage()));

    bdmTipsSection.setClient(tips);
}
 
Example #3
Source File: QueryEditionControl.java    From bonita-studio with GNU General Public License v2.0 6 votes vote down vote up
private void createDefinitionSection(Composite parent) {
    this.section = formPage.getToolkit().createSection(parent, Section.EXPANDED);
    section.setLayoutData(GridDataFactory.fillDefaults().create());
    section.setLayout(GridLayoutFactory.fillDefaults().create());

    Composite client = formPage.getToolkit().createComposite(section);
    client.setLayout(
            GridLayoutFactory.fillDefaults().create());
    client.setLayoutData(GridDataFactory.fillDefaults().grab(false, true).create());

    Composite definitionComposite = formPage.getToolkit().createComposite(client);
    definitionComposite.setLayoutData(GridDataFactory.fillDefaults().grab(false, true).create());
    definitionComposite.setLayout(
            GridLayoutFactory.fillDefaults().numColumns(2).spacing(LayoutConstants.getSpacing().x, 1)
                    .margins(10, 10).create());

    createToolbar(definitionComposite);
    createSearchField(definitionComposite);
    createViewer(definitionComposite);

    section.setClient(client);
}
 
Example #4
Source File: ParameterRedefTable.java    From olca-app with Mozilla Public License 2.0 6 votes vote down vote up
public void bindActions(Section section) {
	Action add = Actions.onAdd(this::add);
	Action remove = Actions.onRemove(this::remove);
	Action copy = TableClipboard.onCopy(table);
	Action paste = TableClipboard.onPaste(table, this::onPaste);
	Action usage = Actions.create(M.Usage, Icon.LINK.descriptor(), () -> {
		ParameterRedef redef = Viewers.getFirstSelected(table);
		if (redef != null) {
			ParameterUsagePage.show(redef.name);
		}
	});
	CommentAction.bindTo(section, "parameterRedefs",
			editor.getComments(), add, remove);
	Actions.bind(table, add, remove, copy, paste, usage);
	Tables.onDeletePressed(table, (e) -> remove());
	Tables.onDoubleClick(table, (event) -> {
		TableItem item = Tables.getItem(table, event);
		if (item == null)
			add();
	});
}
 
Example #5
Source File: XSPGenPage.java    From XPagesExtensionLibrary with Apache License 2.0 6 votes vote down vote up
private void createBrowserOptions(Composite parent) {
    Section rtSection = XSPEditorUtil.createSection(toolkit, parent, "Rich Text Options", 1, 1); // $NLX-XSPGenPage.RichTextOptions-1$
    Composite rtDCP = XSPEditorUtil.createSectionChild(rtSection, 2);
    rtDCP.setLayoutData(new GridData(SWT.BEGINNING, SWT.FILL, false, false, 1, 1));
    Label lfLabel = XSPEditorUtil.createLabel(rtDCP, "Save links in:", 1); // $NLX-XSPGenPage.Savelinksin-1$
    lfLabel.setToolTipText("Defines how links should be saved in a Domino document"); // $NLX-XSPGenPage.DefineshowlinksshouldbesavedinaDo-1$
    Composite buttonHolder = new Composite(rtDCP, SWT.NONE);
    buttonHolder.setBackground(getDisplay().getSystemColor(SWT.COLOR_LIST_BACKGROUND));
    GridLayout gl = SWTLayoutUtils.createLayoutNoMarginDefaultSpacing(2);
    buttonHolder.setLayout(gl);
    buttonHolder.setLayoutData(new GridData(SWT.BEGINNING, SWT.FILL, false, false, 1, 1));
    XSPEditorUtil.createRadio(buttonHolder, LINK_SAVE_PROP, "Notes format", XSP_SAVE_USE_NOTES, "notesLinks", 1); //  $NON-NLS-2$ $NLX-XSPGenPage.Notesformat-1$
    XSPEditorUtil.createRadio(buttonHolder, LINK_SAVE_PROP, "Web format", XSP_SAVE_USE_WEB, "webLinks", 1); //  $NON-NLS-2$ $NLX-XSPGenPage.Webformat-1$

    rtSection.setClient(rtDCP);   
}
 
Example #6
Source File: ImportWorkspaceControlSupplier.java    From bonita-studio with GNU General Public License v2.0 6 votes vote down vote up
private void doCreateWorkspaceTips(Composite mainComposite) {
    Label workspaceTips = new Label(mainComposite, SWT.NONE);
    workspaceTips.setLayoutData(GridDataFactory.fillDefaults().create());
    workspaceTips.setText(Messages.workspaceTips);

    final Section section = new Section(mainComposite, Section.TREE_NODE | Section.CLIENT_INDENT);
    section.setLayout(GridLayoutFactory.fillDefaults().margins(0, 0).create());
    section.setLayoutData(
            GridDataFactory.swtDefaults().align(SWT.FILL, SWT.TOP).hint(200, SWT.DEFAULT)
                    .grab(true, false).create());
    section.setText(Messages.moreInfo);
    Label label = new Label(section, SWT.WRAP);
    label.setLayoutData(GridDataFactory.swtDefaults().create());
    label.setText(Messages.importWorkspaceOverwriteBehavior);
    section.setClient(label);
    section.setExpanded(false);
    section.addExpansionListener(new UpdateLayoutListener(mainComposite));
}
 
Example #7
Source File: ManifestHybridEditorPage.java    From XPagesExtensionLibrary with Apache License 2.0 6 votes vote down vote up
private void createDaArea(Composite parent) {
    Section section = XSPEditorUtil.createSection(_toolkit, parent, "Directory Assistance", 1, 1); // $NLX-ManifestHybridEditorPage.DirectoryAssistance-1$
    Composite container = XSPEditorUtil.createSectionChild(section, 2);

    _daEnabledCheckbox = XSPEditorUtil.createCheckboxTF(container, "Enable directory assistance for authentication", "appDaEnabled", 2);  // $NON-NLS-2$ $NLX-ManifestHybridEditorPage.Enabledirectoryassistanceforauthe-1$ 
    _daEnabledCheckbox.setToolTipText(StringUtil.format("Enable to allow the runtime application server to use a Domino user directory on the remote server as follows:{0}to authenticate Internet users against the credentials in the directory,{0}to resolve users during NAMELookup calls,{0}to resolve members of groups when authorizing database access.", "\n")); // $NON-NLS-2$ $NLX-ManifestHybridEditorPage.Enabletoallowtheruntimeapplicatio-1$ 
    _daEnabledCheckbox.addSelectionListener(new SelectionAdapter() {
        public void widgetSelected(SelectionEvent arg0) {
            refreshDaControlState();
        }
    });
    
    _domainNameLabel = XSPEditorUtil.createLabel(container, "Domain name:", 1); // $NLX-ManifestHybridEditorPage.Domainname-1$
    _domainNameLabel.setToolTipText("The domain name of a Domino directory on the remote server"); // $NLX-ManifestHybridEditorPage.ThedomainnameofaDominodirectoryon-1$
    _domainNameText = XSPEditorUtil.createText(container, "appDaDomain", 1, 0, 40); // $NON-NLS-1$

    _dominoDirLabel = XSPEditorUtil.createLabel(container, "Domino directory:", 1); // $NLX-ManifestHybridEditorPage.Dominodirectory-1$
    _dominoDirLabel.setToolTipText("The file name of a Domino directory on the remote server"); // $NLX-ManifestHybridEditorPage.ThefilenameofaDominodirectoryonth-1$
    _dominoDirText = XSPEditorUtil.createText(container, "appDaAddressBook", 1, 0, 1); // $NON-NLS-1$

    section.setClient(container);        
}
 
Example #8
Source File: FormHelper.java    From tlaplus with MIT License 6 votes vote down vote up
/**
 * Constructs a section and returns a section client composite
 * 
 * the section layout is TableWrapLayout
 * 
 * 
 * @param parent parent container for the section
 * @param title title of the section
 * @param description description of the section
 * @param toolkit toolkit to create the composite
 * @param sectionFlags parameters of the section
 * @param expansionListener 
 * @return a section client (the content container of the section)
 */
public static Section createSectionComposite(Composite parent, String title, String description,
        FormToolkit toolkit, int sectionFlags, IExpansionListener expansionListener)
{
    final Section section = toolkit.createSection(parent, sectionFlags);

    section.setData(SECTION_IS_NOT_SPACE_GRABBING, new Object());
    section.setText(title);
    section.setDescription(description);

    if (expansionListener != null)
    {
        section.addExpansionListener(expansionListener);
    }

    // create section client
    Composite sectionClient = toolkit.createComposite(section);
    TableWrapLayout layout = new TableWrapLayout();
    layout.numColumns = 1;
    sectionClient.setLayout(layout);
    section.setClient(sectionClient);

    // draw flat borders
    toolkit.paintBordersFor(sectionClient);
    return section;
}
 
Example #9
Source File: PinBoard.java    From olca-app with Mozilla Public License 2.0 6 votes vote down vote up
void create(FormToolkit tk, Composite body) {
	Section section = UI.section(body, tk, "Pinned contributions");
	section.setExpanded(false);
	Composite comp = UI.sectionClient(section, tk);
	UI.gridLayout(comp, 1);

	Composite filterComp = tk.createComposite(comp);
	UI.gridLayout(filterComp, 2, 10, 0);
	UI.gridData(filterComp, true, false);
	filter = UI.formText(filterComp, tk, M.Filter);
	filter.addModifyListener(e -> table.setInput(selectInput()));

	table = Tables.createViewer(comp,
			"Pin / Unpin",
			"Process / Sub-System",
			M.Product,
			"Display in chart");
	Tables.bindColumnWidths(table, 0.15, 0.35, 0.35, 0.15);
	Label label = new Label();
	table.setLabelProvider(label);
	Viewers.sortByLabels(table, label, 0, 1);
	table.setInput(selectInput());
	bindActions();
}
 
Example #10
Source File: ParameterRedefDialog.java    From olca-app with Mozilla Public License 2.0 6 votes vote down vote up
@Override
protected void createFormContent(IManagedForm mform) {
	FormToolkit toolkit = mform.getToolkit();
	UI.formHeader(mform, M.SearchParameters);
	Composite body = UI.formBody(mform.getForm(), mform.getToolkit());
	UI.gridLayout(body, 1);
	Label filterLabel = UI.formLabel(body, toolkit, M.Filter);
	filterLabel.setFont(UI.boldFont());
	filterText = UI.formText(body, SWT.SEARCH);
	filterText.addModifyListener(e -> viewer.refresh());

	Section section = UI.section(body, toolkit, M.Parameters);
	UI.gridData(section, true, true);
	Composite composite = UI.sectionClient(section, toolkit, 1);
	createViewer(composite);
}
 
Example #11
Source File: ManifestEnvEditorPage.java    From XPagesExtensionLibrary with Apache License 2.0 6 votes vote down vote up
private void createDebugArea(Composite parent) {
    Section section = XSPEditorUtil.createSection(_toolkit, parent, "Debug Environment Variables", 1, 1); // $NLX-ManifestEnvEditorPage.DebugEnvironmentVariables-1$
    Composite container = XSPEditorUtil.createSectionChild(section, 3);
    
    Button btn = XSPEditorUtil.createCheckboxTF(container, "Include XPages Toolbox", "appIncludeXPagesToolbox", 3); // $NON-NLS-2$ $NLX-ManifestEnvEditorPage.IncludeXPagesToolbox-1$
    btn.setToolTipText("APP_INCLUDE_XPAGES_TOOLBOX\nWhen enabled, the XPages Toolbox will be pushed along with your application to facilitate debugging.\nDisabled by default.");  // $NLX-ManifestEnvEditorPage.APP_INCLUDE_XPAGES_TOOLBOXnWhenen-1$

    btn = XSPEditorUtil.createCheckboxTF(container, "Verbose staging", "appVerboseStaging", 3); // $NON-NLS-2$ $NLX-ManifestEnvEditorPage.Verbosestaging-1$
    btn.setToolTipText("APP_VERBOSE_STAGING\nWhen enabled, the command-line interface (CLI) will show full logging details when staging your application.\nDisabled by default."); // $NLX-ManifestEnvEditorPage.APP_VERBOSE_STAGINGnWhenenabledth-1$
    
    btn = XSPEditorUtil.createCheckboxTF(container, "Debug staging", "appDebugStaging", 3); // $NON-NLS-2$ $NLX-ManifestEnvEditorPage.Debugstaging-1$ 
    btn.setToolTipText("APP_DEBUG_STAGING\nWhen enabled, detailed debug information generated during application staging will be collected into\nthe console log file in the IBM_TECHNICAL_SUPPORT directory.\nDisabled by default."); // $NLX-ManifestEnvEditorPage.APP_DEBUG_STAGINGnWhenenableddeta-1$

    btn = XSPEditorUtil.createCheckboxTF(container, "Debug threads", "appDebugThreads", 3); // $NON-NLS-2$ $NLX-ManifestEnvEditorPage.Debugthreads-1$ 
    btn.setToolTipText("APP_DEBUG_THREADS\nWhen enabled, detailed thread request and response information will be collected into separate thread\nlog files in the IBM_TECHNICAL_SUPPORT directory.\nDisabled by default."); // $NLX-ManifestEnvEditorPage.APP_DEBUG_THREADSnWhenenableddeta-1$

    btn = XSPEditorUtil.createCheckboxTF(container, "Debug directory assistance", "appDebugDa", 3); // $NON-NLS-2$ $NLX-ManifestEnvEditorPage.Debugdirectoryassistance-1$ 
    btn.setToolTipText("APP_DEBUG_DIRECTORY_ASSISTANCE\nWhen enabled, detailed directory assistance debug information will be collected into\nthe console log file in the IBM_TECHNICAL_SUPPORT directory.\nDisabled by default."); // $NLX-ManifestEnvEditorPage.APP_DEBUG_DIRECTORY_ASSISTANCEnWh-1$

    btn = XSPEditorUtil.createCheckboxTF(container, "Debug name lookup", "appDebugNameLookup", 3); // $NON-NLS-2$ $NLX-ManifestEnvEditorPage.Debugnamelookup-1$ 
    btn.setToolTipText("APP_DEBUG_NAMELOOKUP\nWhen enabled, detailed name lookup information will be collected into the console log file in\nthe IBM_TECHNICAL_SUPPORT directory.\nDisabled by default."); // $NLX-ManifestEnvEditorPage.APP_DEBUG_NAMELOOKUPnWhenenabledd-1$
    
    section.setClient(container);        
}
 
Example #12
Source File: ProjectSetupPage.java    From olca-app with Mozilla Public License 2.0 6 votes vote down vote up
@Override
protected void createFormContent(IManagedForm managedForm) {
	form = UI.formHeader(this);
	toolkit = managedForm.getToolkit();
	Composite body = UI.formBody(form, toolkit);
	InfoSection infoSection = new InfoSection(getEditor());
	infoSection.render(body, toolkit);
	createButton(infoSection.getContainer());
	new ImpactSection(editor).render(body, toolkit);
	createVariantsSection(body);
	Section section = UI.section(body, toolkit, M.Parameters);
	parameterTable = new ProjectParameterTable(editor);
	parameterTable.render(section, toolkit);
	initialInput();
	new ProcessContributionSection(editor).create(body, toolkit);
	body.setFocus();
	form.reflow(true);
}
 
Example #13
Source File: MapSection.java    From olca-app with Mozilla Public License 2.0 6 votes vote down vote up
void render(Composite body, FormToolkit tk) {
	Section section = UI.section(body, tk, "Geographic data");
	UI.gridData(section, true, true);
	Composite comp = UI.sectionClient(section, tk);
	comp.setLayout(new FillLayout());
	UI.gridData(comp, true, true);

	map = new MapView(comp);
	map.addBaseLayers();
	feature = MsgPack.unpackgz(location().geodata);
	if (feature != null) {
		updateMap();
	}

	Action edit = Actions.onEdit(() -> {
		new GeoJSONDialog().open();
	});
	Actions.bind(section, edit);
}
 
Example #14
Source File: EssentialsPage.java    From thym with Eclipse Public License 1.0 6 votes vote down vote up
private void createAuthorSection(Composite parent) {
	Section sctnAuthor = createSection(parent, "Author");
	sctnAuthor.setLayoutData(new TableWrapData(TableWrapData.FILL_GRAB));

	Composite composite = formToolkit.createComposite(sctnAuthor, SWT.WRAP);
	formToolkit.paintBordersFor(composite);
	sctnAuthor.setClient(composite);
	composite.setLayout(FormUtils.createSectionClientGridLayout(false, 2));

	createFormFieldLabel(composite, "Name:");

	txtAuthorname = formToolkit.createText(composite, "", SWT.WRAP);
	txtAuthorname.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1));

	createFormFieldLabel(composite, "Email:");

	txtEmail = formToolkit.createText(composite, "", SWT.NONE);
	txtEmail.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1));

	createFormFieldLabel(composite, "URL:");

	txtUrl = formToolkit.createText(composite, "", SWT.NONE);
	txtUrl.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1));
}
 
Example #15
Source File: FlowUseSection.java    From olca-app with Mozilla Public License 2.0 6 votes vote down vote up
void render(Composite body, FormToolkit toolkit) {
	log.trace("render flow-use-section for flow {}", flow);
	FlowDao dao = new FlowDao(database);
	Set<Long> recipients = dao.getWhereInput(flow.id);
	Set<Long> providers = dao.getWhereOutput(flow.id);
	if (recipients.isEmpty() && providers.isEmpty())
		return;
	Section section = UI.section(body, toolkit, M.UsedInProcesses);
	section.setExpanded(false);
	parent = UI.sectionClient(section, toolkit);
	this.toolkit = toolkit;
	App.runInUI("Render usage links", () -> {
		renderLinks(M.ConsumedBy, recipients, Icon.INPUT.get());
		renderLinks(M.ProducedBy, providers, Icon.OUTPUT.get());
	});
}
 
Example #16
Source File: IndexControl.java    From bonita-studio with GNU General Public License v2.0 6 votes vote down vote up
private void createIndexDescriptionSection(Composite parent, DataBindingContext ctx) {
    Section section = formPage.getToolkit().createSection(parent, Section.EXPANDED);
    section.setLayoutData(GridDataFactory.fillDefaults().grab(true, false).create());
    section.setLayout(GridLayoutFactory.fillDefaults().create());
    section.setText(Messages.description);

    Composite client = formPage.getToolkit().createComposite(section);
    client.setLayoutData(GridDataFactory.fillDefaults().grab(true, false).create());
    client.setLayout(GridLayoutFactory.fillDefaults().margins(10, 10).create());

    IObservableValue descriptionObservable = EMFObservables.observeDetailValue(Realm.getDefault(),
            selectedIndexObservable, BusinessDataModelPackage.Literals.INDEX__DESCRIPTION);

    new TextAreaWidget.Builder()
            .widthHint(500)
            .heightHint(70)
            .bindTo(descriptionObservable)
            .inContext(ctx)
            .adapt(formPage.getToolkit())
            .createIn(client);

    section.setClient(client);
}
 
Example #17
Source File: SimulationPage.java    From olca-app with Mozilla Public License 2.0 6 votes vote down vote up
private void createResultSection(FormToolkit tk, Composite body) {
	if (result == null)
		return;
	Section section = UI.section(body, tk, M.Results);
	SimulationExportAction exportAction = new SimulationExportAction(
			result, editor.setup);
	Actions.bind(section, exportAction);
	Composite comp = UI.sectionClient(section, tk);
	initFlowCheckViewer(tk, comp);
	if (result.hasImpactResults()) {
		initImpactCheckViewer(tk, comp);
	}
	statisticsCanvas = new StatisticsCanvas(body);
	GridData gd = UI.gridData(statisticsCanvas, true, true);
	gd.verticalIndent = 10;
	gd.minimumHeight = 250;
}
 
Example #18
Source File: FilesPage.java    From typescript.java with MIT License 6 votes vote down vote up
private void createScopeSection(Composite parent) {
	FormToolkit toolkit = super.getToolkit();
	Section section = toolkit.createSection(parent, Section.DESCRIPTION | Section.TITLE_BAR);
	section.setDescription(TsconfigEditorMessages.FilesPage_ScopeSection_desc);
	section.setText(TsconfigEditorMessages.FilesPage_ScopeSection_title);
	TableWrapData data = new TableWrapData(TableWrapData.FILL_GRAB);
	section.setLayoutData(data);

	Composite client = toolkit.createComposite(section);
	section.setClient(client);
	GridLayout layout = new GridLayout();
	layout.numColumns = 1;
	layout.marginWidth = 2;
	layout.marginHeight = 2;
	client.setLayout(layout);

	Table table = toolkit.createTable(client, SWT.NONE);
	GridData gd = new GridData(GridData.FILL_BOTH);
	gd.heightHint = 200;
	gd.widthHint = 100;
	table.setLayoutData(gd);
}
 
Example #19
Source File: ParameterPage.java    From olca-app with Mozilla Public License 2.0 6 votes vote down vote up
private void bindGlobalParamActions(Section section, TableViewer table) {
	var copy = TableClipboard.onCopy(table);
	var refresh = Actions.create(M.Reload, Icon.REFRESH.descriptor(), () -> {
		setGlobalTableInput();
		support.evaluate();
		editor.setDirty(true);
	});
	var usage = Actions.create(M.Usage, Icon.LINK.descriptor(), () -> {
		Parameter p = Viewers.getFirstSelected(table);
		if (p != null) {
			ParameterUsagePage.show(p.name);
		}
	});
	Actions.bind(table, copy, refresh, usage);
	Actions.bind(section, refresh);
}
 
Example #20
Source File: CausalFactorTable.java    From olca-app with Mozilla Public License 2.0 6 votes vote down vote up
public void render(Section section, FormToolkit toolkit) {
	Composite composite = UI.sectionClient(section, toolkit, 1);
	String[] columnTitles = getColumnTitles();
	viewer = Tables.createViewer(composite, columnTitles);
	viewer.setLabelProvider(new FactorLabel());
	Action copy = TableClipboard.onCopy(viewer);
	Actions.bind(viewer, copy);
	Tables.bindColumnWidths(viewer, 0.2, 0.1, 0.1, 0.1);
	createModifySupport();
	Table table = viewer.getTable();
	for (int i = 0; i < table.getColumnCount(); i++) {
		if (i < 4)
			continue;
		TableColumn column = table.getColumn(i);
		if (!editor.hasAnyComment("allocationFactors") || i % 2 == 0) {
			column.setWidth(80);
			column.setToolTipText(columnTitles[i]);
		} else {
			column.setWidth(24);
		}
	}
	for (int i = 3; i < table.getColumnCount(); i++) {
		viewer.getTable().getColumns()[i].setAlignment(SWT.RIGHT);
	}
}
 
Example #21
Source File: OutputPage.java    From typescript.java with MIT License 6 votes vote down vote up
private void createDebuggingSection(Composite parent) {
	FormToolkit toolkit = super.getToolkit();
	Section section = toolkit.createSection(parent, Section.DESCRIPTION | Section.TITLE_BAR);
	section.setDescription(TsconfigEditorMessages.OutputPage_DebuggingSection_desc);
	section.setText(TsconfigEditorMessages.OutputPage_DebuggingSection_title);
	TableWrapData data = new TableWrapData(TableWrapData.FILL_GRAB);
	section.setLayoutData(data);
	Composite body = createBody(section);

	createCheckbox(body, TsconfigEditorMessages.OutputPage_sourceMap_label,
			new JSONPath("compilerOptions.sourceMap"));
	createTextAndBrowseButton(body, TsconfigEditorMessages.OutputPage_sourceRoot_label,
			new JSONPath("compilerOptions.sourceRoot"), false);
	createTextAndBrowseButton(body, TsconfigEditorMessages.OutputPage_mapRoot_label,
			new JSONPath("compilerOptions.mapRoot"), false);
	createCheckbox(body, TsconfigEditorMessages.OutputPage_inlineSourceMap_label,
			new JSONPath("compilerOptions.inlineSourceMap"));
	createCheckbox(body, TsconfigEditorMessages.OutputPage_inlineSources_label,
			new JSONPath("compilerOptions.inlineSources"));
}
 
Example #22
Source File: ParameterSection.java    From olca-app with Mozilla Public License 2.0 6 votes vote down vote up
private void createComponents(Composite body, FormToolkit toolkit) {
	String title = forInputParameters ? M.InputParameters : M.DependentParameters;
	Section section = UI.section(body, toolkit, title);
	UI.gridData(section, true, true);
	Composite parent = UI.sectionClient(section, toolkit, 1);
	table = Tables.createViewer(parent, columns());
	ParameterLabelProvider label = new ParameterLabelProvider();
	table.setLabelProvider(label);
	addSorters(table, label);
	bindActions(section);
	Tables.bindColumnWidths(table, 0.3, 0.3, 0.2, 0.17, 0.03);
	int col = forInputParameters ? 1 : 2;
	table.getTable().getColumns()[col].setAlignment(SWT.RIGHT);
	Tables.onDoubleClick(table, e -> {
		var item = Tables.getItem(table, e);
		if (item == null) {
			onAdd();
		}
	});
}
 
Example #23
Source File: XSPEditorUtil.java    From XPagesExtensionLibrary with Apache License 2.0 6 votes vote down vote up
static public Section createSection(FormToolkit toolkit, Composite parent, String title, int hSpan, int vSpan) {

    	Section section = toolkit.createSection(parent, Section.SHORT_TITLE_BAR);
        GridData osectionGridData = new GridData(SWT.FILL, SWT.BEGINNING, false, false);
        osectionGridData.horizontalSpan = hSpan;
        osectionGridData.verticalSpan = vSpan;
        osectionGridData.horizontalIndent = 5;
        section.setLayoutData(osectionGridData);
        section.setText(title);
        
        GridLayout osectionGL = new GridLayout(1, true);
        osectionGL.marginHeight = 0;
        osectionGL.marginWidth = 0;
        section.setLayout(osectionGL);
        
        return section;
    }
 
Example #24
Source File: OverviewPage.java    From typescript.java with MIT License 6 votes vote down vote up
private void createGeneralInformationSection(Composite parent) {
	FormToolkit toolkit = super.getToolkit();
	Section section = toolkit.createSection(parent, Section.DESCRIPTION | Section.TITLE_BAR);
	section.setDescription(TsconfigEditorMessages.OverviewPage_GeneralInformationSection_desc);
	section.setText(TsconfigEditorMessages.OverviewPage_GeneralInformationSection_title);
	TableWrapData data = new TableWrapData(TableWrapData.FILL_GRAB);
	section.setLayoutData(data);

	Composite body = createBody(section);

	// Target/Module
	createCombo(body, TsconfigEditorMessages.OverviewPage_target_label, new JSONPath("compilerOptions.target"),
			TsconfigJson.getAvailableTargets(), TsconfigJson.getDefaultTarget());
	createCombo(body, TsconfigEditorMessages.OverviewPage_module_label, new JSONPath("compilerOptions.module"),
			TsconfigJson.getAvailableModules());
	createCombo(body, TsconfigEditorMessages.OverviewPage_moduleResolution_label,
			new JSONPath("compilerOptions.moduleResolution"), TsconfigJson.getAvailableModuleResolutions(),
			TsconfigJson.getDefaultModuleResolution());
	// Others....
	createCheckbox(body, TsconfigEditorMessages.OverviewPage_experimentalDecorators_label,
			new JSONPath("compilerOptions.experimentalDecorators"));

}
 
Example #25
Source File: BusinessObjectList.java    From bonita-studio with GNU General Public License v2.0 6 votes vote down vote up
public BusinessObjectList(
        Composite parent, AbstractBdmFormPage formPage,
        DataBindingContext ctx) {
    this.ctx = ctx;

    section = formPage.getToolkit().createSection(parent, Section.EXPANDED);
    section.setLayout(GridLayoutFactory.fillDefaults().create());
    section.setLayoutData(GridDataFactory.fillDefaults().grab(true, true).create());
    section.setText(Messages.listOfBusinessObjects);

    Composite boListComposite = createBusinessObjectListComposite(formPage);

    ctx.bindValue(businessObjectSelectionObservable, selectionObservable,
            UpdateStrategyFactory.updateValueStrategy().create(),
            UpdateStrategyFactory.updateValueStrategy()
                    .withConverter(ConverterBuilder.<Object, BusinessObject> newConverter()
                            .fromType(Object.class)
                            .toType(BusinessObject.class)
                            .withConvertFunction(o -> o instanceof BusinessObject ? (BusinessObject) o : null)
                            .create())
                    .create());
    ctx.bindValue(businessObjectSelectionObservable, formPage.observeBusinessObjectSelected());

    section.setClient(boListComposite);
}
 
Example #26
Source File: ConditionalRoutePropertiesEditionPartForm.java    From eip-designer with Apache License 2.0 5 votes vote down vote up
/**
 * 
 */
protected Composite createPropertiesGroup(FormToolkit widgetFactory, final Composite parent) {
	Section propertiesSection = widgetFactory.createSection(parent, Section.TITLE_BAR | Section.TWISTIE | Section.EXPANDED);
	propertiesSection.setText(EipMessages.ConditionalRoutePropertiesEditionPart_PropertiesGroupLabel);
	GridData propertiesSectionData = new GridData(GridData.FILL_HORIZONTAL);
	propertiesSectionData.horizontalSpan = 3;
	propertiesSection.setLayoutData(propertiesSectionData);
	Composite propertiesGroup = widgetFactory.createComposite(propertiesSection);
	GridLayout propertiesGroupLayout = new GridLayout();
	propertiesGroupLayout.numColumns = 3;
	propertiesGroup.setLayout(propertiesGroupLayout);
	propertiesSection.setClient(propertiesGroup);
	return propertiesGroup;
}
 
Example #27
Source File: ICETableComponentSectionPart.java    From ice with Eclipse Public License 1.0 5 votes vote down vote up
/**
 * <p>
 * This operation reads the TableComponent assigned to this SectionPart and
 * renders the view of that data for the user.
 * </p>
 * 
 */
public void renderSection() {
	// Local Declarations
	Section section = getSection();

	// Add the main description and title to the section
	section.setDescription(tableComponent.getDescription());
	section.setText(tableComponent.getName());

	// setup the composite given the IManagedForm (parentForm)
	// and the section of this sectionPart.
	sectionClient = parentForm.getToolkit().createComposite(section);

	// Set the layout to have three columns.
	// Sets the table to take up one column, and the
	// add and delete buttons take the next column.
	sectionClient.setLayout(new GridLayout(2, false));

	// Setup the tableComponentViewer and buttons
	this.setupTableViewer();
	this.setupButtons();

	// Set an expansion listener in order to control the
	// sectionPart's visibility to the user.
	section.addExpansionListener(new ExpansionAdapter() {
		@Override
		public void expansionStateChanged(ExpansionEvent e) {
			parentForm.reflow(true);
		}
	});

	// Add the sectionClient Composite to the sectionPart.
	section.setClient(sectionClient);

	return;
}
 
Example #28
Source File: TransformerPropertiesEditionPartForm.java    From eip-designer with Apache License 2.0 5 votes vote down vote up
/**
 * 
 */
protected Composite createPropertiesGroup(FormToolkit widgetFactory, final Composite parent) {
	Section propertiesSection = widgetFactory.createSection(parent, Section.TITLE_BAR | Section.TWISTIE | Section.EXPANDED);
	propertiesSection.setText(EipMessages.TransformerPropertiesEditionPart_PropertiesGroupLabel);
	GridData propertiesSectionData = new GridData(GridData.FILL_HORIZONTAL);
	propertiesSectionData.horizontalSpan = 3;
	propertiesSection.setLayoutData(propertiesSectionData);
	Composite propertiesGroup = widgetFactory.createComposite(propertiesSection);
	GridLayout propertiesGroupLayout = new GridLayout();
	propertiesGroupLayout.numColumns = 3;
	propertiesGroup.setLayout(propertiesGroupLayout);
	propertiesSection.setClient(propertiesGroup);
	return propertiesGroup;
}
 
Example #29
Source File: SocialAspectsPage.java    From olca-app with Mozilla Public License 2.0 5 votes vote down vote up
private void createEntrySection(FormToolkit tk, Composite body) {
	Section section = UI.section(body, tk, M.SocialAssessment);
	Composite comp = UI.sectionClient(section, tk, 1);
	UI.gridData(section, true, true);
	createTree(comp);
	Trees.onDoubleClick(tree, (e) -> editAspect());
	Action add = Actions.onAdd(this::addIndicator);
	Action edit = Actions.create(M.Edit, Icon.EDIT.descriptor(), this::editAspect);
	Action delete = Actions.onRemove(this::deleteAspect);
	CommentAction.bindTo(section, "socialAspects", editor.getComments(), add, edit, delete);
	Actions.bind(tree, add, edit, delete);
}
 
Example #30
Source File: EIPModelPropertiesEditionPartForm.java    From eip-designer with Apache License 2.0 5 votes vote down vote up
/**
 * 
 */
protected Composite createPropertiesGroup(FormToolkit widgetFactory, final Composite parent) {
	Section propertiesSection = widgetFactory.createSection(parent, Section.TITLE_BAR | Section.TWISTIE | Section.EXPANDED);
	propertiesSection.setText(EipMessages.EIPModelPropertiesEditionPart_PropertiesGroupLabel);
	GridData propertiesSectionData = new GridData(GridData.FILL_HORIZONTAL);
	propertiesSectionData.horizontalSpan = 3;
	propertiesSection.setLayoutData(propertiesSectionData);
	Composite propertiesGroup = widgetFactory.createComposite(propertiesSection);
	GridLayout propertiesGroupLayout = new GridLayout();
	propertiesGroupLayout.numColumns = 3;
	propertiesGroup.setLayout(propertiesGroupLayout);
	propertiesSection.setClient(propertiesGroup);
	return propertiesGroup;
}