Java Code Examples for org.eclipse.ui.forms.widgets.Section#setLayout()

The following examples show how to use org.eclipse.ui.forms.widgets.Section#setLayout() . 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: 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 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: 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 4
Source File: BusinessObjectEditionControl.java    From bonita-studio with GNU General Public License v2.0 6 votes vote down vote up
private void buildDescriptionSection(Composite parent, BusinessDataModelFormPage formPage, DataBindingContext ctx) {
    IObservableValue<String> descriptionObservable = EMFObservables.observeDetailValue(Realm.getDefault(),
            boSelectedObservable, BusinessDataModelPackage.Literals.BUSINESS_OBJECT__DESCRIPTION);

    Section descriptionSection = formPage.getToolkit().createSection(parent, Section.EXPANDED);
    descriptionSection.setLayoutData(GridDataFactory.fillDefaults().create());
    descriptionSection.setLayout(GridLayoutFactory.fillDefaults().create());
    descriptionSection.setText(Messages.description);

    Composite client = formPage.getToolkit().createComposite(descriptionSection);
    client.setLayoutData(GridDataFactory.fillDefaults().create());
    client.setLayout(GridLayoutFactory.fillDefaults().extendedMargins(10, 0, 10, 0).create());

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

    descriptionSection.setClient(client);
}
 
Example 5
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 6
Source File: QueryDetailsControl.java    From bonita-studio with GNU General Public License v2.0 6 votes vote down vote up
private void createContentSection() {
    Section section = formPage.getToolkit().createSection(this, Section.EXPANDED);
    section.setLayoutData(GridDataFactory.fillDefaults().grab(true, true).create());
    section.setLayout(GridLayoutFactory.fillDefaults().create());
    section.setText(Messages.queryContent);

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

    createLink(client);
    createQueryTextArea(client);
    createParametersComposite(client);
    createReturnTypeComposite(client);

    section.setClient(client);
}
 
Example 7
Source File: ConstraintEditionControl.java    From bonita-studio with GNU General Public License v2.0 6 votes vote down vote up
private void createConstraintEditionSection(Composite parent) {
    Section section = formPage.getToolkit().createSection(parent, Section.EXPANDED);
    section.setLayoutData(GridDataFactory.fillDefaults().grab(true, true).create());
    section.setLayout(GridLayoutFactory.fillDefaults().create());
    section.setText(Messages.attributes);

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

    formPage.getToolkit()
            .createLabel(client, Messages.selectUniqueConstraintFieldsMessage, SWT.WRAP)
            .setLayoutData(GridDataFactory.fillDefaults().grab(true, false).create());
    formPage.getToolkit()
            .createLabel(client, Messages.warningTextConstraint, SWT.WRAP)
            .setLayoutData(GridDataFactory.fillDefaults().grab(true, false).create());

    createValidationLabel(client);
    createConstraintEditionViewer(client);

    section.setClient(client);
}
 
Example 8
Source File: ConstraintEditionControl.java    From bonita-studio with GNU General Public License v2.0 6 votes vote down vote up
private void createConstraintDescriptionSection(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(),
            selectedConstraintObservable, BusinessDataModelPackage.Literals.UNIQUE_CONSTRAINT__DESCRIPTION);

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

    section.setClient(client);
}
 
Example 9
Source File: EssentialsPage.java    From thym with Eclipse Public License 1.0 6 votes vote down vote up
private void createPluginsSection(Composite parent) {
	Section sctnPlugins = createSection(parent, "Plug-ins");
	sctnPlugins.setLayout(FormUtils.createClearTableWrapLayout(false, 1));
	TableWrapData data = new TableWrapData(TableWrapData.FILL_GRAB);
	sctnPlugins.setLayoutData(data);

	FormText text = formToolkit.createFormText(sctnPlugins, true);
	ImageDescriptor idesc = HybridUI.getImageDescriptor(HybridUI.PLUGIN_ID, "/icons/etool16/cordovaplug_wiz.png");
	text.setImage("plugin", idesc.createImage());

	text.setText(PLUGINS_SECTION_CONTENT, true, false);

	sctnPlugins.setClient(text);
	text.addHyperlinkListener(this);

}
 
Example 10
Source File: AttributeEditionControl.java    From bonita-studio with GNU General Public License v2.0 5 votes vote down vote up
private void createDetailsSection() {
    Section detailsSection = formPage.getToolkit().createSection(this, Section.EXPANDED);
    detailsSection.setLayout(GridLayoutFactory.fillDefaults().create());
    detailsSection.setLayoutData(GridDataFactory.fillDefaults().grab(true, true).create());
    detailsSection.setText(Messages.details);
    fieldDetailsControl = new FieldDetailsControl(detailsSection, formPage, selectedFieldObservable, ctx);
    detailsSection.setClient(fieldDetailsControl);
    ctx.bindValue(WidgetProperties.visible().observe(detailsSection), new ComputedValueBuilder<Boolean>()
            .withSupplier(() -> selectedFieldObservable.getValue() != null)
            .build());
}
 
Example 11
Source File: IndexControl.java    From bonita-studio with GNU General Public License v2.0 5 votes vote down vote up
private void createIndexEditionSection(Composite parent, DataBindingContext ctx) {
    Section section = formPage.getToolkit().createSection(parent, Section.EXPANDED);
    section.setLayoutData(GridDataFactory.fillDefaults().grab(true, true).create());
    section.setLayout(GridLayoutFactory.fillDefaults().create());
    section.setText(Messages.attributes);

    indexEditionControl = new IndexEditionControl(section, formPage, ctx, selectedIndexObservable,
            actualsFieldsObservable);

    section.setClient(indexEditionControl);
}
 
Example 12
Source File: BusinessObjectEditionControl.java    From bonita-studio with GNU General Public License v2.0 5 votes vote down vote up
private void buildEditionSection(Composite parent, BusinessDataModelFormPage formPage,
        DataBindingContext ctx) {
    Section editionSection = formPage.getToolkit().createSection(parent, Section.EXPANDED);
    editionSection.setLayoutData(GridDataFactory.fillDefaults().indent(0, 10).grab(true, true).create());
    editionSection.setLayout(GridLayoutFactory.fillDefaults().create());
    editionSection.setText(Messages.attributes);

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

    attributeEditionControl = new AttributeEditionControl(client, formPage, boSelectedObservable, ctx);

    editionSection.setClient(client);
}
 
Example 13
Source File: BusinessDataModelFormPart.java    From bonita-studio with GNU General Public License v2.0 5 votes vote down vote up
private void createMavenArtifactPropertiesGroup(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.mavenArtifactProperties);

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

    new TextWidget.Builder()
            .withLabel(Messages.groupId)
            .labelAbove()
            .fill()
            .withTootltip(Messages.mavenArtifactPropertiesHint)
            .grabHorizontalSpace()
            .bindTo(EMFObservables.observeDetailValue(Realm.getDefault(), formPage.observeWorkingCopy(),
                    BusinessDataModelPackage.Literals.BUSINESS_OBJECT_MODEL__GROUP_ID))
            .withTargetToModelStrategy(UpdateStrategyFactory.updateValueStrategy()
                    .withValidator(new GroupIdValidator(formPage.getRepositoryAccessor().getWorkspace()))
                    .create())
            .inContext(ctx)
            .adapt(formPage.getToolkit())
            .createIn(client);

    formPage.getToolkit().createLabel(client, "");

    section.setClient(client);
}
 
Example 14
Source File: ImportBosArchiveControlSupplier.java    From bonita-studio with GNU General Public License v2.0 5 votes vote down vote up
private void createTreeHeader(Composite parent, DataBindingContext ctx) {
    treeSection = new Section(parent, Section.TREE_NODE);
    treeSection.setLayout(GridLayoutFactory.fillDefaults().create());
    treeSection.setLayoutData(GridDataFactory.fillDefaults().grab(true, true).create());
    treeSection.setText(Messages.importDetails);
    treeSection.addExpansionListener(new UpdateLayoutListener(parent));
    treeSection.setExpanded(false);
    descriptionLabel = new Label(treeSection, SWT.WRAP);
    archiveStatusObservable = PojoProperties.value("archiveStatus").observe(this);

    ctx.bindValue(WidgetProperties.text().observe(descriptionLabel), archiveStatusObservable,
            neverUpdateValueStrategy().create(), updateValueStrategy().withValidator(this::archiveStatusValidator)
                    .withConverter(createArchiveStatusConverter()).create());
    treeSection.setDescriptionControl(descriptionLabel);
}
 
Example 15
Source File: EssentialsPage.java    From thym with Eclipse Public License 1.0 5 votes vote down vote up
private void createExportSection(Composite parent) {
	Section sctnExport = createSection(parent, "Export");
	sctnExport.setLayout(FormUtils.createClearTableWrapLayout(false, 1));
	TableWrapData data = new TableWrapData(TableWrapData.FILL_GRAB);
	sctnExport.setLayoutData(data);
	FormText text = formToolkit.createFormText(sctnExport, true);
	ImageDescriptor idesc = HybridUI.getImageDescriptor(HybridUI.PLUGIN_ID, "/icons/etool16/export_wiz.png");
	text.setImage("export", idesc.createImage());
	text.setText(EXPORT_SECTION_CONTENT, true, false);

	sctnExport.setClient(text);
	text.addHyperlinkListener(this);
}
 
Example 16
Source File: ImportWorkspaceControlSupplier.java    From bonita-studio with GNU General Public License v2.0 5 votes vote down vote up
private Section createStatusSection(Composite parent) {
    final Section section = new Section(parent, Section.TREE_NODE | Section.CLIENT_INDENT);
    section.setLayout(GridLayoutFactory.fillDefaults().create());
    section.setLayoutData(GridDataFactory.fillDefaults().grab(true, true).create());
    section.setText(Messages.importDetails);
    section.addExpansionListener(new UpdateLayoutListener(parent));
    section.setExpanded(false);
    return section;
}
 
Example 17
Source File: IndexEditionControl.java    From bonita-studio with GNU General Public License v2.0 4 votes vote down vote up
private void createAvailableAttributesTableViewer(Composite parent) {
    Section section = formPage.getToolkit().createSection(parent, Section.EXPANDED);
    section.setLayout(GridLayoutFactory.fillDefaults().create());
    section.setLayoutData(GridDataFactory.fillDefaults().grab(true, true).create());
    section.setText(Messages.availableAttributes);

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

    availableAttributesTableViewer = new TableViewer(client,
            SWT.FULL_SELECTION | SWT.BORDER | SWT.V_SCROLL | SWT.H_SCROLL | SWT.MULTI);
    availableAttributesTableViewer.getTable().setLayoutData(GridDataFactory.fillDefaults().grab(true, true).create());
    availableAttributesTableViewer.getTable().setData(SWTBotConstants.SWTBOT_WIDGET_ID_KEY, AVAILABLE_FIELDS_VIEWER_ID);
    formPage.getToolkit().adapt(availableAttributesTableViewer.getTable());
    ColumnViewerToolTipSupport.enableFor(availableAttributesTableViewer);
    availableAttributesTableViewer.setUseHashlookup(true);
    availableAttributesTableViewer.getTable().setLinesVisible(true);
    availableAttributesTableViewer.setFilters(indexableFieldFilter, indexedFieldsFilter());

    TableLayout layout = new TableLayout();
    layout.addColumnData(new ColumnWeightData(1, true));
    availableAttributesTableViewer.getTable().setLayout(layout);

    createAttributesColumn(availableAttributesTableViewer);

    availableAttributesTableViewer.setContentProvider(new ObservableListContentProvider());
    availableAttributesTableViewer.setInput(actualsFieldsObservable);
    selectedAvailableAttributeObservable = ViewersObservables.observeMultiSelection(availableAttributesTableViewer);

    availableAttributesTableViewer.getTable().addMouseMoveListener(e -> updateCursor(e, availableAttributesTableViewer));
    availableAttributesTableViewer.addDragSupport(DND.DROP_MOVE, new Transfer[] { FieldTransfer.getInstance() },
            dragSourceAdapter(selectedAvailableAttributeObservable));
    availableAttributesTableViewer.addDropSupport(DND.DROP_MOVE,
            new Transfer[] { FieldTransfer.getInstance() },
            new DropTargetAdapter() {

                @Override
                public void drop(DropTargetEvent event) {
                    dragLeave(event);
                    indexedFieldsObservable.removeAll((Collection<?>) event.data);
                }
            });

    section.setClient(client);
}
 
Example 18
Source File: ListComponentSectionPage.java    From ice with Eclipse Public License 1.0 4 votes vote down vote up
@Override
protected void createFormContent(IManagedForm managedForm) {

	// Get the parent form and the toolkit
	final ScrolledForm scrolledForm = managedForm.getForm();
	final FormToolkit formToolkit = managedForm.getToolkit();

	// Set a GridLayout with a single column. Remove the default margins.
	GridLayout layout = new GridLayout(1, true);
	layout.marginWidth = 0;
	layout.marginHeight = 0;
	scrolledForm.getBody().setLayout(layout);

	// Only create something if there is valid input.
	if (list != null) {

		// Get the parent
		Composite parent = managedForm.getForm().getBody();

		shell = parent.getShell();
		// Create the section and set its layout info
		Section listSection = formToolkit.createSection(parent,
				ExpandableComposite.TITLE_BAR | Section.DESCRIPTION
						| ExpandableComposite.TWISTIE
						| ExpandableComposite.EXPANDED
						| ExpandableComposite.COMPACT);
		listSection.setLayout(new GridLayout(1, false));
		listSection.setLayoutData(
				new GridData(SWT.FILL, SWT.FILL, true, true, 1, 1));
		// Create the section client, which is the client area of the
		// section that will actually render data.
		sectionClient = new Composite(listSection, SWT.FLAT);
		sectionClient.setLayout(new GridLayout(2, false));
		sectionClient.setLayoutData(
				new GridData(SWT.FILL, SWT.FILL, true, true, 1, 1));
		// Fixes section header bug where label color is spammed
		sectionClient.setBackground(
				Display.getCurrent().getSystemColor(SWT.COLOR_WHITE));
		// Fixes background color bug for NatTable
		sectionClient.setBackgroundMode(SWT.INHERIT_FORCE);

		// Draws the table and sets that instance variable
		table = new ListComponentNattable(sectionClient, list, true);

		// Create the buttons for add, delete, up, and down
		createButtons();

		// Set the section client.
		listSection.setClient(sectionClient);
	}

	return;
}