Search in sources :

Example 36 with ExpansionEvent

use of org.eclipse.ui.forms.events.ExpansionEvent in project eclipse-integration-commons by spring-projects.

the class ExpandableSection method createContents.

@Override
public void createContents(final Composite page) {
    final ExpandableComposite comp = new ExpandableComposite(page, SWT.NONE);
    GridDataFactory.fillDefaults().grab(true, false).applyTo(comp);
    comp.setText(title);
    comp.setLayout(new FillLayout());
    comp.addExpansionListener(new IExpansionListener() {

        public void expansionStateChanging(ExpansionEvent e) {
        }

        @Override
        public void expansionStateChanged(ExpansionEvent e) {
            expansionState.setValue(comp.isExpanded());
            reflow(owner, comp);
        }
    });
    expansionState.addListener(new ValueListener<Boolean>() {

        public void gotValue(LiveExpression<Boolean> exp, Boolean value) {
            if (value != null && comp != null && !comp.isDisposed()) {
                boolean newState = value;
                boolean currentState = comp.isExpanded();
                if (currentState != newState) {
                    comp.setExpanded(newState);
                    reflow(owner, comp);
                }
            }
        }
    });
    visibleState.addListener(new ValueListener<Boolean>() {

        @Override
        public void gotValue(LiveExpression<Boolean> exp, Boolean value) {
            if (value != null && comp != null && !comp.isDisposed()) {
                boolean newState = value;
                comp.setVisible(newState);
                GridData data = (GridData) comp.getLayoutData();
                data.exclude = !newState;
                reflow(owner, comp);
            }
        }
    });
    Composite client = new Composite(comp, SWT.NONE);
    client.setLayout(new GridLayout());
    child.createContents(client);
    comp.setClient(client);
}
Also used : IExpansionListener(org.eclipse.ui.forms.events.IExpansionListener) GridLayout(org.eclipse.swt.layout.GridLayout) Composite(org.eclipse.swt.widgets.Composite) ExpandableComposite(org.eclipse.ui.forms.widgets.ExpandableComposite) GridData(org.eclipse.swt.layout.GridData) FillLayout(org.eclipse.swt.layout.FillLayout) ExpandableComposite(org.eclipse.ui.forms.widgets.ExpandableComposite) ExpansionEvent(org.eclipse.ui.forms.events.ExpansionEvent)

Example 37 with ExpansionEvent

use of org.eclipse.ui.forms.events.ExpansionEvent in project webtools.sourceediting by eclipse.

the class AbstractValidationSettingsPage method createStyleSectionWithContentComposite.

protected Composite createStyleSectionWithContentComposite(Composite parent, String label, int nColumns) {
    ExpandableComposite excomposite = new ExpandableComposite(parent, SWT.NONE, ExpandableComposite.TWISTIE | ExpandableComposite.CLIENT_INDENT);
    excomposite.setText(label);
    excomposite.setExpanded(false);
    excomposite.setFont(JFaceResources.getFontRegistry().getBold(JFaceResources.DIALOG_FONT));
    excomposite.setLayoutData(new GridData(GridData.FILL, GridData.FILL, true, false, nColumns, 1));
    excomposite.addExpansionListener(new ExpansionAdapter() {

        public void expansionStateChanged(ExpansionEvent e) {
            expandedStateChanged((ExpandableComposite) e.getSource());
        }
    });
    fExpandables.add(excomposite);
    makeScrollableCompositeAware(excomposite);
    Composite inner = new Composite(excomposite, SWT.NONE);
    inner.setFont(excomposite.getFont());
    inner.setLayout(new GridLayout(nColumns, false));
    excomposite.setClient(inner);
    return inner;
}
Also used : GridLayout(org.eclipse.swt.layout.GridLayout) Composite(org.eclipse.swt.widgets.Composite) ExpandableComposite(org.eclipse.ui.forms.widgets.ExpandableComposite) GridData(org.eclipse.swt.layout.GridData) ExpansionAdapter(org.eclipse.ui.forms.events.ExpansionAdapter) ExpandableComposite(org.eclipse.ui.forms.widgets.ExpandableComposite) ExpansionEvent(org.eclipse.ui.forms.events.ExpansionEvent)

Example 38 with ExpansionEvent

use of org.eclipse.ui.forms.events.ExpansionEvent in project webtools.sourceediting by eclipse.

the class AbstractValidationSettingsPage method createStyleSection.

protected ExpandableComposite createStyleSection(Composite parent, String label, int nColumns) {
    ExpandableComposite excomposite = new ExpandableComposite(parent, SWT.NONE, ExpandableComposite.TWISTIE | ExpandableComposite.CLIENT_INDENT);
    excomposite.setText(label);
    excomposite.setExpanded(false);
    excomposite.setFont(JFaceResources.getFontRegistry().getBold(JFaceResources.DIALOG_FONT));
    excomposite.setLayoutData(new GridData(GridData.FILL, GridData.FILL, true, false, nColumns, 1));
    excomposite.addExpansionListener(new ExpansionAdapter() {

        public void expansionStateChanged(ExpansionEvent e) {
            expandedStateChanged((ExpandableComposite) e.getSource());
        }
    });
    fExpandables.add(excomposite);
    makeScrollableCompositeAware(excomposite);
    return excomposite;
}
Also used : GridData(org.eclipse.swt.layout.GridData) ExpansionAdapter(org.eclipse.ui.forms.events.ExpansionAdapter) ExpandableComposite(org.eclipse.ui.forms.widgets.ExpandableComposite) ExpansionEvent(org.eclipse.ui.forms.events.ExpansionEvent)

Example 39 with ExpansionEvent

use of org.eclipse.ui.forms.events.ExpansionEvent in project webtools.sourceediting by eclipse.

the class XSLValidationPreferencePage method createTwistie.

protected ExpandableComposite createTwistie(Composite parent, String label, int nColumns) {
    ExpandableComposite excomposite = new ExpandableComposite(parent, SWT.NONE, ExpandableComposite.TWISTIE | ExpandableComposite.CLIENT_INDENT);
    excomposite.setText(label);
    excomposite.setExpanded(false);
    excomposite.setFont(JFaceResources.getFontRegistry().getBold(JFaceResources.DIALOG_FONT));
    excomposite.setLayoutData(new GridData(GridData.FILL, GridData.FILL, true, false, nColumns, 1));
    excomposite.addExpansionListener(new ExpansionAdapter() {

        @Override
        public void expansionStateChanged(ExpansionEvent e) {
            expandedStateChanged((ExpandableComposite) e.getSource());
        }
    });
    Expandables.add(excomposite);
    makeScrollableCompositeAware(excomposite);
    return excomposite;
}
Also used : GridData(org.eclipse.swt.layout.GridData) ExpansionAdapter(org.eclipse.ui.forms.events.ExpansionAdapter) ExpandableComposite(org.eclipse.ui.forms.widgets.ExpandableComposite) ExpansionEvent(org.eclipse.ui.forms.events.ExpansionEvent)

Example 40 with ExpansionEvent

use of org.eclipse.ui.forms.events.ExpansionEvent in project netxms by netxms.

the class AlarmDetails method createDataSection.

/**
 * Create data section
 */
private void createDataSection() {
    final Section section = toolkit.createSection(form.getBody(), Section.TITLE_BAR | Section.EXPANDED | Section.TWISTIE | Section.COMPACT);
    section.setText(Messages.get().AlarmDetails_LastValues);
    final GridData gd = new GridData();
    gd.horizontalAlignment = SWT.FILL;
    gd.grabExcessHorizontalSpace = true;
    gd.verticalAlignment = SWT.FILL;
    gd.grabExcessVerticalSpace = true;
    section.setLayoutData(gd);
    section.addExpansionListener(new IExpansionListener() {

        @Override
        public void expansionStateChanging(ExpansionEvent e) {
            gd.grabExcessVerticalSpace = e.getState();
        }

        @Override
        public void expansionStateChanged(ExpansionEvent e) {
        }
    });
    dataArea = toolkit.createComposite(section);
    section.setClient(dataArea);
    dataArea.setLayout(new FillLayout());
}
Also used : IExpansionListener(org.eclipse.ui.forms.events.IExpansionListener) GridData(org.eclipse.swt.layout.GridData) FillLayout(org.eclipse.swt.layout.FillLayout) Section(org.eclipse.ui.forms.widgets.Section) ExpansionEvent(org.eclipse.ui.forms.events.ExpansionEvent)

Aggregations

ExpansionEvent (org.eclipse.ui.forms.events.ExpansionEvent)58 ExpansionAdapter (org.eclipse.ui.forms.events.ExpansionAdapter)53 GridData (org.eclipse.swt.layout.GridData)46 Composite (org.eclipse.swt.widgets.Composite)46 ExpandableComposite (org.eclipse.ui.forms.widgets.ExpandableComposite)46 GridLayout (org.eclipse.swt.layout.GridLayout)38 Section (org.eclipse.ui.forms.widgets.Section)30 SelectionEvent (org.eclipse.swt.events.SelectionEvent)12 TableViewer (org.eclipse.jface.viewers.TableViewer)11 ArrayList (java.util.ArrayList)7 ICellModifier (org.eclipse.jface.viewers.ICellModifier)7 TextCellEditor (org.eclipse.jface.viewers.TextCellEditor)7 ScrolledComposite (org.eclipse.swt.custom.ScrolledComposite)7 SelectionListener (org.eclipse.swt.events.SelectionListener)7 Point (org.eclipse.swt.graphics.Point)7 Label (org.eclipse.swt.widgets.Label)7 TableColumn (org.eclipse.swt.widgets.TableColumn)7 TableItem (org.eclipse.swt.widgets.TableItem)7 ParseTree (org.antlr.v4.runtime.tree.ParseTree)6 AddedParseTree (org.eclipse.titan.common.parsers.AddedParseTree)6