Search in sources :

Example 31 with TableWrapData

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

the class NetworkDiscoveryConfigurator method createFilterSection.

/**
 * Create "Filter" section
 */
private void createFilterSection() {
    Section section = toolkit.createSection(form.getBody(), Section.DESCRIPTION | Section.TITLE_BAR);
    section.setText(Messages.get().NetworkDiscoveryConfigurator_SectionFilter);
    section.setDescription(Messages.get().NetworkDiscoveryConfigurator_SectionFilterDescr);
    TableWrapData td = new TableWrapData();
    td.align = TableWrapData.FILL;
    td.grabHorizontal = true;
    section.setLayoutData(td);
    Composite clientArea = toolkit.createComposite(section);
    GridLayout layout = new GridLayout();
    clientArea.setLayout(layout);
    section.setClient(clientArea);
    final SelectionListener radioButtonListener = new SelectionListener() {

        @Override
        public void widgetSelected(SelectionEvent e) {
            updateElementEnablement();
            setModified();
            if (radioFilterOff.getSelection()) {
                config.setFilter(NetworkDiscovery.FILTER_NONE);
            } else if (radioFilterAuto.getSelection()) {
                config.setFilter(NetworkDiscovery.FILTER_AUTO);
            } else {
                config.setFilter(filterScript.getScriptName());
            }
        }

        @Override
        public void widgetDefaultSelected(SelectionEvent e) {
            widgetSelected(e);
        }
    };
    final SelectionListener checkBoxListener = new SelectionListener() {

        @Override
        public void widgetSelected(SelectionEvent e) {
            setModified();
            int flags = 0;
            if (checkAgentOnly.getSelection())
                flags |= NetworkDiscovery.FILTER_ALLOW_AGENT;
            if (checkSnmpOnly.getSelection())
                flags |= NetworkDiscovery.FILTER_ALLOW_SNMP;
            if (checkRangeOnly.getSelection())
                flags |= NetworkDiscovery.FILTER_LIMIT_BY_RANGE;
            config.setFilterFlags(flags);
        }

        @Override
        public void widgetDefaultSelected(SelectionEvent e) {
            widgetSelected(e);
        }
    };
    radioFilterOff = toolkit.createButton(clientArea, Messages.get().NetworkDiscoveryConfigurator_NoFiltering, SWT.RADIO);
    radioFilterOff.addSelectionListener(radioButtonListener);
    radioFilterCustom = toolkit.createButton(clientArea, Messages.get().NetworkDiscoveryConfigurator_CustomScript, SWT.RADIO);
    radioFilterCustom.addSelectionListener(radioButtonListener);
    filterScript = new ScriptSelector(clientArea, SWT.NONE, true, false);
    toolkit.adapt(filterScript);
    filterScript.getTextControl().setBackground(clientArea.getBackground());
    GridData gd = new GridData();
    gd.horizontalAlignment = SWT.FILL;
    gd.grabExcessHorizontalSpace = true;
    gd.horizontalIndent = 20;
    filterScript.setLayoutData(gd);
    filterScript.addModifyListener(new ModifyListener() {

        @Override
        public void modifyText(ModifyEvent e) {
            if (radioFilterCustom.getSelection()) {
                setModified();
                config.setFilter(filterScript.getScriptName());
            }
        }
    });
    radioFilterAuto = toolkit.createButton(clientArea, Messages.get().NetworkDiscoveryConfigurator_AutoScript, SWT.RADIO);
    radioFilterAuto.addSelectionListener(radioButtonListener);
    checkAgentOnly = toolkit.createButton(clientArea, Messages.get().NetworkDiscoveryConfigurator_AcceptAgent, SWT.CHECK);
    checkAgentOnly.addSelectionListener(checkBoxListener);
    gd = new GridData();
    gd.horizontalIndent = 20;
    checkAgentOnly.setLayoutData(gd);
    checkSnmpOnly = toolkit.createButton(clientArea, Messages.get().NetworkDiscoveryConfigurator_AcceptSNMP, SWT.CHECK);
    checkSnmpOnly.addSelectionListener(checkBoxListener);
    gd = new GridData();
    gd.horizontalIndent = 20;
    checkSnmpOnly.setLayoutData(gd);
    checkRangeOnly = toolkit.createButton(clientArea, Messages.get().NetworkDiscoveryConfigurator_AcceptRange, SWT.CHECK);
    checkRangeOnly.addSelectionListener(checkBoxListener);
    gd = new GridData();
    gd.horizontalIndent = 20;
    checkRangeOnly.setLayoutData(gd);
}
Also used : TableWrapData(org.eclipse.ui.forms.widgets.TableWrapData) GridLayout(org.eclipse.swt.layout.GridLayout) ModifyEvent(org.eclipse.swt.events.ModifyEvent) Composite(org.eclipse.swt.widgets.Composite) ModifyListener(org.eclipse.swt.events.ModifyListener) SelectionEvent(org.eclipse.swt.events.SelectionEvent) GridData(org.eclipse.swt.layout.GridData) ScriptSelector(org.netxms.ui.eclipse.nxsl.widgets.ScriptSelector) Section(org.eclipse.ui.forms.widgets.Section) SelectionListener(org.eclipse.swt.events.SelectionListener)

Example 32 with TableWrapData

use of org.eclipse.ui.forms.widgets.TableWrapData in project liferay-ide by liferay.

the class FormEntry method _fillIntoGrid.

private void _fillIntoGrid(Composite parent, int indent, int tcolspan) {
    Layout layout = parent.getLayout();
    int tspan;
    if (layout instanceof GridLayout) {
        int span = ((GridLayout) layout).numColumns;
        if (tcolspan > 0) {
            tspan = tcolspan;
        } else {
            tspan = _fBrowse != null ? span - 2 : span - 1;
        }
        GridData gd;
        if (_fLabel != null) {
            gd = new GridData(GridData.VERTICAL_ALIGN_CENTER);
            gd.horizontalIndent = indent;
            _fLabel.setLayoutData(gd);
        }
        gd = new GridData(GridData.HORIZONTAL_ALIGN_FILL);
        gd.horizontalSpan = tspan;
        if (_fLabel != null) {
            gd.horizontalIndent = FormLayoutFactory.CONTROL_HORIZONTAL_INDENT;
        }
        gd.grabExcessHorizontalSpace = tspan == 1;
        gd.widthHint = 10;
        _fText.setLayoutData(gd);
        if (_fBrowse != null) {
            gd = new GridData(GridData.VERTICAL_ALIGN_CENTER);
            _fBrowse.setLayoutData(gd);
        }
    } else if (layout instanceof TableWrapLayout) {
        int span = ((TableWrapLayout) layout).numColumns;
        if (tcolspan > 0) {
            tspan = tcolspan;
        } else {
            tspan = _fBrowse != null ? span - 2 : span - 1;
        }
        TableWrapData td;
        if (_fLabel != null) {
            td = new TableWrapData();
            td.valign = TableWrapData.MIDDLE;
            td.indent = indent;
            _fLabel.setLayoutData(td);
        }
        td = new TableWrapData(TableWrapData.FILL);
        td.colspan = tspan;
        if (_fLabel != null) {
            td.indent = FormLayoutFactory.CONTROL_HORIZONTAL_INDENT;
        }
        td.grabHorizontal = tspan == 1;
        td.valign = TableWrapData.MIDDLE;
        _fText.setLayoutData(td);
        if (_fBrowse != null) {
            td = new TableWrapData(TableWrapData.FILL);
            td.valign = TableWrapData.MIDDLE;
            _fBrowse.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)

Example 33 with TableWrapData

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

the class StatisticalView method createPartControl.

/**
 * This is a callback that will allow us to create the viewer and
 * initialize it.
 */
@Override
public void createPartControl(final Composite parent) {
    List<StatisticalData> statisticalData = restoreState();
    createToolbar();
    createStatisticalViewContextMenuActions();
    toolkit = new FormToolkit(parent.getDisplay());
    form = toolkit.createScrolledForm(parent);
    // $NON-NLS-1$
    form.setText("Statistics");
    TableWrapLayout layout = new TableWrapLayout();
    form.getBody().setLayout(layout);
    TableWrapData td = new TableWrapData();
    td.colspan = 2;
    layout.numColumns = 2;
    toolkit.paintBordersFor(form.getBody());
    if (statisticalData != null) {
        setData(statisticalData);
    }
}
Also used : TableWrapData(org.eclipse.ui.forms.widgets.TableWrapData) StatisticalData(org.eclipse.titan.log.viewer.views.details.StatisticalData) FormToolkit(org.eclipse.ui.forms.widgets.FormToolkit) TableWrapLayout(org.eclipse.ui.forms.widgets.TableWrapLayout)

Example 34 with TableWrapData

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

the class RevEngOverviewPage method createContentsSection.

private void createContentsSection() {
    String sectionTitle;
    sectionTitle = MapperMessages.RevEngOverviewPage_contents;
    Section section = createStaticSection(getManagedForm().getToolkit(), getManagedForm().getForm().getBody(), sectionTitle);
    Composite container = getManagedForm().getToolkit().createComposite(section, SWT.NONE);
    TableWrapLayout layout = new TableWrapLayout();
    layout.leftMargin = layout.rightMargin = layout.topMargin = layout.bottomMargin = 0;
    container.setLayout(layout);
    container.setLayoutData(new TableWrapData(TableWrapData.FILL_GRAB));
    FormText text = createClient(container, MapperMessages.RevEngOverviewPage_the_content, getManagedForm().getToolkit());
    // text.setImage("page", EclipseImages.getImage(ImageConstants.)); //$NON-NLS-1$
    section.setClient(container);
// section.setLayoutData(new TableWrapData(TableWrapData.FILL_GRAB));
// section.setLayoutData(new GridData(GridData.FILL_HORIZONTAL,GridData.FILL_VERTICAL));
// getManagedForm().addPart(s);
}
Also used : TableWrapData(org.eclipse.ui.forms.widgets.TableWrapData) Composite(org.eclipse.swt.widgets.Composite) ExpandableComposite(org.eclipse.ui.forms.widgets.ExpandableComposite) TableWrapLayout(org.eclipse.ui.forms.widgets.TableWrapLayout) FormText(org.eclipse.ui.forms.widgets.FormText) Section(org.eclipse.ui.forms.widgets.Section)

Example 35 with TableWrapData

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

the class RevEngOverviewPage method createClient.

private FormText createClient(Composite section, String content, FormToolkit toolkit) {
    FormText text = toolkit.createFormText(section, true);
    try {
        text.setText(content, true, false);
    } catch (SWTException e) {
        text.setText(e.getMessage(), false, false);
    }
    section.setLayoutData(new TableWrapData(TableWrapData.FILL_GRAB));
    text.addHyperlinkListener(new IHyperlinkListener() {

        public void linkEntered(HyperlinkEvent e) {
        }

        public void linkExited(HyperlinkEvent e) {
        }

        public void linkActivated(HyperlinkEvent e) {
            String href = (String) e.getHref();
            getEditor().setActivePage(href);
        }
    });
    return text;
}
Also used : TableWrapData(org.eclipse.ui.forms.widgets.TableWrapData) SWTException(org.eclipse.swt.SWTException) HyperlinkEvent(org.eclipse.ui.forms.events.HyperlinkEvent) FormText(org.eclipse.ui.forms.widgets.FormText) IHyperlinkListener(org.eclipse.ui.forms.events.IHyperlinkListener)

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