Search in sources :

Example 1 with ExpandableComposite

use of org.eclipse.ui.forms.widgets.ExpandableComposite in project tdi-studio-se by Talend.

the class InfoPage method createSnapshotSection.

/**
     * Creates the snapshot section.
     * 
     * @param parent The parent composite
     * @param toolkit The toolkit
     */
private void createSnapshotSection(Composite parent, FormToolkit toolkit) {
    ExpandableComposite section = toolkit.createSection(parent, ExpandableComposite.TITLE_BAR);
    section.setText(Messages.snapshotSectionLabel);
    section.setLayoutData(new GridData(GridData.FILL_BOTH));
    Composite composite = toolkit.createComposite(section);
    section.setClient(composite);
    composite.setLayout(new GridLayout(2, false));
    dateText = createText(composite, toolkit, Messages.dateLabel);
    commentsText = createEditableText(composite, toolkit, Messages.commentsLabel);
    commentsText.addModifyListener(new ModifyListener() {

        @Override
        public void modifyText(ModifyEvent e) {
            editor.firePropertyChange(IEditorPart.PROP_DIRTY);
        }
    });
}
Also used : GridLayout(org.eclipse.swt.layout.GridLayout) ModifyEvent(org.eclipse.swt.events.ModifyEvent) Composite(org.eclipse.swt.widgets.Composite) ExpandableComposite(org.eclipse.ui.forms.widgets.ExpandableComposite) ModifyListener(org.eclipse.swt.events.ModifyListener) GridData(org.eclipse.swt.layout.GridData) ExpandableComposite(org.eclipse.ui.forms.widgets.ExpandableComposite)

Example 2 with ExpandableComposite

use of org.eclipse.ui.forms.widgets.ExpandableComposite in project tdi-studio-se by Talend.

the class RuntimeGraphcsComposite method createSection.

private void createSection(Composite parent, IMonitoredMXBeanGroup group) {
    if (parent.isDisposed()) {
        return;
    }
    FormToolkit tookit = new FormToolkit(Display.getDefault());
    ExpandableComposite section = tookit.createSection(parent, ExpandableComposite.NO_TITLE);
    section.setText(group.getName());
    FormLayout sectionLayout = new FormLayout();
    sectionLayout.marginWidth = 0;
    sectionLayout.marginHeight = 0;
    section.setLayout(sectionLayout);
    FormData sectionData = new FormData();
    if (group.getName().equals(MonitorAttributeName.HEAP_MEMORY)) {
        sectionData.left = new FormAttachment(0, 0);
        sectionData.right = new FormAttachment(65, 0);
        sectionData.top = new FormAttachment(0, 6);
        sectionData.bottom = new FormAttachment(53, -5);
    } else if (group.getName().equals(MonitorAttributeName.THREAD_COUNT)) {
        sectionData.left = new FormAttachment(50, 5);
        sectionData.right = new FormAttachment(100, -5);
        sectionData.top = new FormAttachment(50, 2);
        sectionData.bottom = new FormAttachment(100, 0);
    } else if (group.getName().equals(MonitorAttributeName.CPU_USE)) {
        sectionData.left = new FormAttachment(0, 0);
        sectionData.right = new FormAttachment(65, 0);
        sectionData.top = new FormAttachment(53, 0);
        sectionData.bottom = new FormAttachment(100, -6);
    }
    section.setLayoutData(sectionData);
    Composite flatFormComposite = createFlatFormComposite(section, tookit);
    FormLayout formLayout = new FormLayout();
    formLayout.marginHeight = 0;
    formLayout.marginWidth = 0;
    flatFormComposite.setLayout(formLayout);
    TimelineChart chart = new TimelineChart(flatFormComposite, section, group, SWT.NONE, toString() + getJvm().getPid());
    charts.add(chart);
    FormData data;
    data = new FormData();
    data.left = new FormAttachment(0, 0);
    data.right = new FormAttachment(100, 0);
    data.top = new FormAttachment(0, 0);
    data.bottom = new FormAttachment(100, 0);
    chart.setLayoutData(data);
    section.setClient(flatFormComposite);
    ArrayList<Action> list = new ArrayList<Action>();
    list.add(garbageCollectorAction);
    if (group.getName().equals(MonitorAttributeName.HEAP_MEMORY)) {
        addSectionActions(section, list);
    }
}
Also used : FormLayout(org.eclipse.swt.layout.FormLayout) FormData(org.eclipse.swt.layout.FormData) LoadChartAction(org.talend.designer.runtime.visualization.internal.ui.properties.timeline.LoadChartAction) GarbageAction(org.talend.designer.runtime.visualization.internal.ui.properties.memory.GarbageAction) Action(org.eclipse.jface.action.Action) FormToolkit(org.eclipse.ui.forms.widgets.FormToolkit) Composite(org.eclipse.swt.widgets.Composite) ExpandableComposite(org.eclipse.ui.forms.widgets.ExpandableComposite) ScrolledComposite(org.eclipse.swt.custom.ScrolledComposite) ArrayList(java.util.ArrayList) TimelineChart(org.talend.designer.runtime.visualization.internal.ui.properties.timeline.TimelineChart) ExpandableComposite(org.eclipse.ui.forms.widgets.ExpandableComposite) FormAttachment(org.eclipse.swt.layout.FormAttachment)

Example 3 with ExpandableComposite

use of org.eclipse.ui.forms.widgets.ExpandableComposite in project tdi-studio-se by Talend.

the class TimelineSection method createSection.

/**
     * Creates the section.
     * 
     * @param parent The parent composite
     * @param group The attribute group
     */
private void createSection(Composite parent, IMonitoredMXBeanGroup group) {
    if (parent.isDisposed()) {
        return;
    }
    ExpandableComposite section = getWidgetFactory().createSection(parent, ExpandableComposite.TITLE_BAR);
    section.setText(group.getName());
    section.setLayoutData(new GridData(GridData.FILL_BOTH));
    Composite flatFormComposite = getWidgetFactory().createFlatFormComposite(section);
    FormLayout formLayout = new FormLayout();
    formLayout.marginHeight = 0;
    formLayout.marginWidth = 0;
    flatFormComposite.setLayout(formLayout);
    TimelineChart chart = new TimelineChart(flatFormComposite, section, group, SWT.NONE, toString() + getJvm().getPid());
    charts.add(chart);
    FormData data;
    data = new FormData();
    data.left = new FormAttachment(0, 0);
    data.right = new FormAttachment(100, 0);
    data.top = new FormAttachment(0, 0);
    data.bottom = new FormAttachment(100, 0);
    chart.setLayoutData(data);
    section.setClient(flatFormComposite);
    List<Action> actions = new ArrayList<Action>();
    for (IMonitoredMXBeanAttribute attribute : group.getAttributes()) {
        if (attribute.getAttributeName().startsWith("HeapMemoryUsage")) {
            //$NON-NLS-1$
            actions.add(garbageCollectorAction);
            break;
        }
    }
    actions.add(new ConfigureChartAction(chart, this));
    addSectionActions(section, actions);
}
Also used : FormLayout(org.eclipse.swt.layout.FormLayout) FormData(org.eclipse.swt.layout.FormData) GarbageCollectorAction(org.talend.designer.runtime.visualization.internal.ui.properties.memory.GarbageCollectorAction) Action(org.eclipse.jface.action.Action) RefreshAction(org.talend.designer.runtime.visualization.internal.actions.RefreshAction) Composite(org.eclipse.swt.widgets.Composite) ExpandableComposite(org.eclipse.ui.forms.widgets.ExpandableComposite) GridData(org.eclipse.swt.layout.GridData) ArrayList(java.util.ArrayList) IMonitoredMXBeanAttribute(org.talend.designer.runtime.visualization.MBean.IMonitoredMXBeanAttribute) ExpandableComposite(org.eclipse.ui.forms.widgets.ExpandableComposite) FormAttachment(org.eclipse.swt.layout.FormAttachment)

Example 4 with ExpandableComposite

use of org.eclipse.ui.forms.widgets.ExpandableComposite in project ow by vtst.

the class SWTFactory method createExpandibleComposite.

/**
   * Creates an ExpandibleComposite widget
   * @param parent the parent to add this widget to
   * @param style the style for ExpandibleComposite expanding handle, and layout
   * @param label the label for the widget
   * @param hspan how many columns to span in the parent
   * @param fill the fill style for the widget
   * Can be one of <code>GridData.FILL_HORIZONAL</code>, <code>GridData.FILL_BOTH</code> or <code>GridData.FILL_VERTICAL</code>
   * @return a new ExpandibleComposite widget
   */
public static ExpandableComposite createExpandibleComposite(Composite parent, int style, String label, int hspan, int fill) {
    ExpandableComposite ex = new ExpandableComposite(parent, SWT.NONE, style);
    ex.setText(label);
    ex.setFont(JFaceResources.getFontRegistry().getBold(JFaceResources.DIALOG_FONT));
    GridData gd = new GridData(fill);
    gd.horizontalSpan = hspan;
    ex.setLayoutData(gd);
    return ex;
}
Also used : GridData(org.eclipse.swt.layout.GridData) ExpandableComposite(org.eclipse.ui.forms.widgets.ExpandableComposite)

Example 5 with ExpandableComposite

use of org.eclipse.ui.forms.widgets.ExpandableComposite in project ow by vtst.

the class SWTFactory method createExpandibleComposite.

/**
   * Creates an ExpandibleComposite widget
   * @param parent the parent to add this widget to
   * @param style the style for ExpandibleComposite expanding handle, and layout
   * @param label the label for the widget
   * @param hspan how many columns to span in the parent
   * @param fill the fill style for the widget
   * Can be one of <code>GridData.FILL_HORIZONAL</code>, <code>GridData.FILL_BOTH</code> or <code>GridData.FILL_VERTICAL</code>
   * @return a new ExpandibleComposite widget
   */
public static ExpandableComposite createExpandibleComposite(Composite parent, int style, String label, int hspan, int fill) {
    ExpandableComposite ex = new ExpandableComposite(parent, SWT.NONE, style);
    ex.setText(label);
    ex.setFont(JFaceResources.getFontRegistry().getBold(JFaceResources.DIALOG_FONT));
    GridData gd = new GridData(fill);
    gd.horizontalSpan = hspan;
    ex.setLayoutData(gd);
    return ex;
}
Also used : GridData(org.eclipse.swt.layout.GridData) ExpandableComposite(org.eclipse.ui.forms.widgets.ExpandableComposite)

Aggregations

ExpandableComposite (org.eclipse.ui.forms.widgets.ExpandableComposite)7 GridData (org.eclipse.swt.layout.GridData)6 Composite (org.eclipse.swt.widgets.Composite)5 ArrayList (java.util.ArrayList)3 GridLayout (org.eclipse.swt.layout.GridLayout)3 Action (org.eclipse.jface.action.Action)2 SelectionEvent (org.eclipse.swt.events.SelectionEvent)2 SelectionListener (org.eclipse.swt.events.SelectionListener)2 FormAttachment (org.eclipse.swt.layout.FormAttachment)2 FormData (org.eclipse.swt.layout.FormData)2 FormLayout (org.eclipse.swt.layout.FormLayout)2 Combo (org.eclipse.swt.widgets.Combo)2 Label (org.eclipse.swt.widgets.Label)2 Text (org.eclipse.swt.widgets.Text)2 ExpansionAdapter (org.eclipse.ui.forms.events.ExpansionAdapter)2 ExpansionEvent (org.eclipse.ui.forms.events.ExpansionEvent)2 ScrolledComposite (org.eclipse.swt.custom.ScrolledComposite)1 ModifyEvent (org.eclipse.swt.events.ModifyEvent)1 ModifyListener (org.eclipse.swt.events.ModifyListener)1 FormToolkit (org.eclipse.ui.forms.widgets.FormToolkit)1