Search in sources :

Example 1 with TableWrapData

use of org.eclipse.ui.forms.widgets.TableWrapData in project jbosstools-hibernate by jbosstools.

the class FormTextEntry method fillIntoGrid.

private void fillIntoGrid(Composite parent, int indent) {
    Layout layout = parent.getLayout();
    if (layout instanceof GridLayout) {
        GridData gd;
        int span = ((GridLayout) layout).numColumns;
        gd = new GridData(GridData.VERTICAL_ALIGN_CENTER);
        gd.horizontalIndent = indent;
        label.setLayoutData(gd);
        int tspan = browse != null ? span - 2 : span - 1;
        gd = new GridData(GridData.HORIZONTAL_ALIGN_FILL);
        gd.horizontalSpan = tspan;
        gd.grabExcessHorizontalSpace = (tspan == 1);
        gd.widthHint = 10;
        text.setLayoutData(gd);
        if (browse != null) {
            gd = new GridData(GridData.VERTICAL_ALIGN_CENTER);
            browse.setLayoutData(gd);
        }
    } else if (layout instanceof TableWrapLayout) {
        TableWrapData td;
        int span = ((TableWrapLayout) layout).numColumns;
        td = new TableWrapData();
        td.valign = TableWrapData.MIDDLE;
        td.indent = indent;
        label.setLayoutData(td);
        int tspan = browse != null ? span - 2 : span - 1;
        td = new TableWrapData(TableWrapData.FILL);
        td.colspan = tspan;
        td.grabHorizontal = (tspan == 1);
        td.valign = TableWrapData.MIDDLE;
        text.setLayoutData(td);
        if (browse != null) {
            td = new TableWrapData();
            td.valign = TableWrapData.MIDDLE;
            browse.setLayoutData(td);
        }
    }
}
Also used : TableWrapData(org.eclipse.ui.forms.widgets.TableWrapData) GridLayout(org.eclipse.swt.layout.GridLayout) Layout(org.eclipse.swt.widgets.Layout) TableWrapLayout(org.eclipse.ui.forms.widgets.TableWrapLayout) GridLayout(org.eclipse.swt.layout.GridLayout) TableWrapLayout(org.eclipse.ui.forms.widgets.TableWrapLayout) GridData(org.eclipse.swt.layout.GridData) Point(org.eclipse.swt.graphics.Point)

Example 2 with TableWrapData

use of org.eclipse.ui.forms.widgets.TableWrapData in project jbosstools-hibernate by jbosstools.

the class RevEngDetailsPage method createContents.

public final void createContents(Composite parent) {
    TableWrapLayout layout = new TableWrapLayout();
    layout.topMargin = 5;
    layout.leftMargin = 5;
    layout.rightMargin = 2;
    layout.bottomMargin = 2;
    parent.setLayout(layout);
    FormToolkit toolkit = mform.getToolkit();
    Section section = toolkit.createSection(parent, Section.DESCRIPTION);
    section.marginWidth = 10;
    TableWrapData td = new TableWrapData(TableWrapData.FILL, TableWrapData.TOP);
    td.grabHorizontal = true;
    section.setLayoutData(td);
    toolkit.createCompositeSeparator(section);
    Composite client = toolkit.createComposite(section);
    GridLayout glayout = new GridLayout();
    glayout.marginWidth = glayout.marginHeight = 2;
    glayout.numColumns = 2;
    client.setLayout(glayout);
    // client.setBackground(client.getDisplay().getSystemColor(SWT.COLOR_CYAN));
    toolkit.paintBordersFor(section);
    toolkit.paintBordersFor(client);
    buildContents(toolkit, section, client);
    section.setClient(client);
}
Also used : TableWrapData(org.eclipse.ui.forms.widgets.TableWrapData) GridLayout(org.eclipse.swt.layout.GridLayout) FormToolkit(org.eclipse.ui.forms.widgets.FormToolkit) Composite(org.eclipse.swt.widgets.Composite) TableWrapLayout(org.eclipse.ui.forms.widgets.TableWrapLayout) Section(org.eclipse.ui.forms.widgets.Section)

Example 3 with TableWrapData

use of org.eclipse.ui.forms.widgets.TableWrapData in project titan.EclipsePlug-ins by eclipse.

the class StatisticalView method createSection.

private Section createSection() {
    Section section = toolkit.createSection(form.getBody(), Section.DESCRIPTION | ExpandableComposite.TWISTIE | ExpandableComposite.TITLE_BAR | ExpandableComposite.EXPANDED);
    TableWrapData td = new TableWrapData(TableWrapData.FILL);
    td.colspan = 2;
    section.setLayoutData(td);
    section.addExpansionListener(new ExpansionAdapter() {

        @Override
        public void expansionStateChanged(final ExpansionEvent e) {
            form.reflow(true);
        }
    });
    File file = new File(this.logFileMetaData.getFilePath());
    Date date = new Date(file.lastModified());
    section.setText(file.getName());
    section.setData(this.logFileMetaData.getProjectRelativePath());
    // $NON-NLS-1$
    section.setDescription(this.logFileMetaData.getProjectRelativePath() + " " + date.toString());
    Composite sectionClient = toolkit.createComposite(section);
    sectionClient.setLayout(new GridLayout());
    createAmountTable(sectionClient);
    this.ecError = toolkit.createExpandableComposite(sectionClient, ExpandableComposite.TREE_NODE | ExpandableComposite.CLIENT_INDENT);
    // $NON-NLS-1$
    ecError.setText("Error test cases");
    this.errorTestCasesTable = createTestCaseTable(ecError);
    ecError.setClient(this.errorTestCasesTable);
    ecError.addExpansionListener(new ExpansionAdapter() {

        @Override
        public void expansionStateChanged(final ExpansionEvent e) {
            form.reflow(true);
        }
    });
    this.ecFail = toolkit.createExpandableComposite(sectionClient, ExpandableComposite.TREE_NODE | ExpandableComposite.CLIENT_INDENT);
    // $NON-NLS-1$
    ecFail.setText("Fail test cases");
    this.failTestCasesTable = createTestCaseTable(ecFail);
    ecFail.setClient(this.failTestCasesTable);
    ecFail.addExpansionListener(new ExpansionAdapter() {

        @Override
        public void expansionStateChanged(final ExpansionEvent e) {
            form.reflow(true);
        }
    });
    this.ecTestCases = toolkit.createExpandableComposite(sectionClient, ExpandableComposite.TREE_NODE | ExpandableComposite.CLIENT_INDENT);
    // $NON-NLS-1$
    ecTestCases.setText("Test cases");
    this.testCases = createTestCaseTable(ecTestCases);
    ecTestCases.setClient(this.testCases);
    ecTestCases.addExpansionListener(new ExpansionAdapter() {

        @Override
        public void expansionStateChanged(final ExpansionEvent e) {
            form.reflow(true);
        }
    });
    section.setClient(sectionClient);
    cachedSections.put(this.logFileMetaData.getProjectRelativePath(), section);
    return section;
}
Also used : TableWrapData(org.eclipse.ui.forms.widgets.TableWrapData) GridLayout(org.eclipse.swt.layout.GridLayout) Composite(org.eclipse.swt.widgets.Composite) ExpandableComposite(org.eclipse.ui.forms.widgets.ExpandableComposite) ExpansionAdapter(org.eclipse.ui.forms.events.ExpansionAdapter) Section(org.eclipse.ui.forms.widgets.Section) ExpansionEvent(org.eclipse.ui.forms.events.ExpansionEvent) IFile(org.eclipse.core.resources.IFile) File(java.io.File) Date(java.util.Date)

Example 4 with TableWrapData

use of org.eclipse.ui.forms.widgets.TableWrapData in project netxms by netxms.

the class AlarmComments method createAlarmDetailsSection.

/**
 * Create alarm details section
 */
private void createAlarmDetailsSection() {
    final Section details = toolkit.createSection(form.getBody(), Section.TITLE_BAR);
    details.setText(Messages.get().AlarmComments_Details);
    TableWrapData twd = new TableWrapData();
    twd.grabHorizontal = true;
    twd.align = TableWrapData.FILL;
    details.setLayoutData(twd);
    final Composite clientArea = toolkit.createComposite(details);
    GridLayout layout = new GridLayout();
    layout.numColumns = 2;
    layout.makeColumnsEqualWidth = true;
    clientArea.setLayout(layout);
    details.setClient(clientArea);
    alarmSeverity = new CLabel(clientArea, SWT.NONE);
    toolkit.adapt(alarmSeverity);
    GridData gd = new GridData();
    gd.horizontalAlignment = SWT.FILL;
    gd.grabExcessHorizontalSpace = true;
    alarmSeverity.setLayoutData(gd);
    alarmState = new CLabel(clientArea, SWT.NONE);
    toolkit.adapt(alarmState);
    gd = new GridData();
    gd.horizontalAlignment = SWT.FILL;
    gd.grabExcessHorizontalSpace = true;
    alarmState.setLayoutData(gd);
    alarmSource = new CLabel(clientArea, SWT.NONE);
    toolkit.adapt(alarmSource);
    gd = new GridData();
    gd.horizontalAlignment = SWT.FILL;
    gd.grabExcessHorizontalSpace = true;
    gd.horizontalSpan = 2;
    alarmSource.setLayoutData(gd);
    // $NON-NLS-1$
    alarmText = toolkit.createLabel(clientArea, "", SWT.WRAP);
    gd = new GridData();
    gd.horizontalAlignment = SWT.FILL;
    gd.grabExcessHorizontalSpace = true;
    gd.horizontalSpan = 2;
    alarmText.setLayoutData(gd);
}
Also used : CLabel(org.eclipse.swt.custom.CLabel) TableWrapData(org.eclipse.ui.forms.widgets.TableWrapData) GridLayout(org.eclipse.swt.layout.GridLayout) Composite(org.eclipse.swt.widgets.Composite) GridData(org.eclipse.swt.layout.GridData) Section(org.eclipse.ui.forms.widgets.Section)

Example 5 with TableWrapData

use of org.eclipse.ui.forms.widgets.TableWrapData in project netxms by netxms.

the class SnmpCredentials method createSnmpCommunitySection.

/**
 * Create "SNMP Communities" section
 */
private void createSnmpCommunitySection() {
    Section section = toolkit.createSection(form.getBody(), Section.DESCRIPTION | Section.TITLE_BAR);
    section.setText(Messages.get().SnmpConfigurator_SectionCommunities);
    section.setDescription(Messages.get().SnmpConfigurator_SectionCommunitiesDescr);
    TableWrapData td = new TableWrapData();
    td.align = TableWrapData.FILL;
    td.grabHorizontal = true;
    section.setLayoutData(td);
    Composite clientArea = toolkit.createComposite(section);
    GridLayout layout = new GridLayout();
    layout.numColumns = 2;
    clientArea.setLayout(layout);
    section.setClient(clientArea);
    snmpCommunityList = new TableViewer(clientArea, SWT.BORDER | SWT.MULTI | SWT.FULL_SELECTION);
    toolkit.adapt(snmpCommunityList.getTable());
    GridData gd = new GridData();
    gd.horizontalAlignment = SWT.FILL;
    gd.grabExcessHorizontalSpace = true;
    gd.verticalAlignment = SWT.FILL;
    gd.grabExcessVerticalSpace = true;
    gd.verticalSpan = 2;
    gd.heightHint = 150;
    snmpCommunityList.getTable().setLayoutData(gd);
    snmpCommunityList.getTable().setSortDirection(SWT.UP);
    snmpCommunityList.setContentProvider(new ArrayContentProvider());
    snmpCommunityList.setComparator(new StringComparator());
    final ImageHyperlink linkAdd = toolkit.createImageHyperlink(clientArea, SWT.NONE);
    linkAdd.setText(Messages.get().SnmpConfigurator_Add);
    linkAdd.setImage(SharedIcons.IMG_ADD_OBJECT);
    gd = new GridData();
    gd.verticalAlignment = SWT.TOP;
    linkAdd.setLayoutData(gd);
    linkAdd.addHyperlinkListener(new HyperlinkAdapter() {

        @Override
        public void linkActivated(HyperlinkEvent e) {
            addCommunity();
        }
    });
    final ImageHyperlink linkRemove = toolkit.createImageHyperlink(clientArea, SWT.NONE);
    linkRemove.setText(Messages.get().SnmpConfigurator_Remove);
    linkRemove.setImage(SharedIcons.IMG_DELETE_OBJECT);
    gd = new GridData();
    gd.verticalAlignment = SWT.TOP;
    linkRemove.setLayoutData(gd);
    linkRemove.addHyperlinkListener(new HyperlinkAdapter() {

        @Override
        public void linkActivated(HyperlinkEvent e) {
            removeCommunity();
        }
    });
}
Also used : TableWrapData(org.eclipse.ui.forms.widgets.TableWrapData) GridLayout(org.eclipse.swt.layout.GridLayout) HyperlinkEvent(org.eclipse.ui.forms.events.HyperlinkEvent) Composite(org.eclipse.swt.widgets.Composite) ImageHyperlink(org.eclipse.ui.forms.widgets.ImageHyperlink) GridData(org.eclipse.swt.layout.GridData) ArrayContentProvider(org.eclipse.jface.viewers.ArrayContentProvider) Section(org.eclipse.ui.forms.widgets.Section) TableViewer(org.eclipse.jface.viewers.TableViewer) StringComparator(org.netxms.ui.eclipse.tools.StringComparator) HyperlinkAdapter(org.eclipse.ui.forms.events.HyperlinkAdapter)

Aggregations

TableWrapData (org.eclipse.ui.forms.widgets.TableWrapData)38 GridLayout (org.eclipse.swt.layout.GridLayout)32 Composite (org.eclipse.swt.widgets.Composite)29 Section (org.eclipse.ui.forms.widgets.Section)29 GridData (org.eclipse.swt.layout.GridData)25 HyperlinkEvent (org.eclipse.ui.forms.events.HyperlinkEvent)20 HyperlinkAdapter (org.eclipse.ui.forms.events.HyperlinkAdapter)19 ImageHyperlink (org.eclipse.ui.forms.widgets.ImageHyperlink)16 ArrayContentProvider (org.eclipse.jface.viewers.ArrayContentProvider)14 TableViewer (org.eclipse.jface.viewers.TableViewer)14 TableWrapLayout (org.eclipse.ui.forms.widgets.TableWrapLayout)12 ExpandableComposite (org.eclipse.ui.forms.widgets.ExpandableComposite)5 FormText (org.eclipse.ui.forms.widgets.FormText)5 FormToolkit (org.eclipse.ui.forms.widgets.FormToolkit)5 ILabelProvider (org.eclipse.jface.viewers.ILabelProvider)3 SectionPart (org.eclipse.ui.forms.SectionPart)3 ExpansionAdapter (org.eclipse.ui.forms.events.ExpansionAdapter)3 ExpansionEvent (org.eclipse.ui.forms.events.ExpansionEvent)3 SyndEntry (com.sun.syndication.feed.synd.SyndEntry)2 Date (java.util.Date)2