Search in sources :

Example 1 with RuntimeGraphcsComposite

use of org.talend.designer.runtime.visualization.views.RuntimeGraphcsComposite in project tdi-studio-se by Talend.

the class MemoryRuntimeComposite method initRuntimeGraphs.

private void initRuntimeGraphs(final Composite parent) {
    ISelection processContextSelection = viewPart.getSite().getSelectionProvider() == null ? null : viewPart.getSelection();
    setExpandHorizontal(true);
    setExpandVertical(true);
    FormData layouData = new FormData();
    layouData.left = new FormAttachment(0, 0);
    layouData.right = new FormAttachment(100, 0);
    layouData.top = new FormAttachment(0, 0);
    layouData.bottom = new FormAttachment(100, 0);
    this.setBackground(parent.getBackground());
    this.setLayout(new FormLayout());
    setLayoutData(layouData);
    monitorComposite = new Composite(this, SWT.NULL);
    FormData baseData = new FormData();
    baseData.left = new FormAttachment(0, 0);
    baseData.right = new FormAttachment(100, 0);
    baseData.top = new FormAttachment(0, 0);
    baseData.bottom = new FormAttachment(100, 0);
    monitorComposite.setLayout(new FormLayout());
    monitorComposite.setLayoutData(layouData);
    setContent(monitorComposite);
    Group topGroup = createTopGroup(monitorComposite);
    runtimeButton = new Button(topGroup, SWT.PUSH);
    if (processContext != null) {
        setRuntimeButtonByStatus(!processContext.isMonitoring());
    } else {
        setRuntimeButtonByStatus(true);
    }
    runtimeButton.setEnabled(true);
    GridData runButtonData = new GridData();
    Point execSize = null;
    execSize = computeSize(runtimeButton.getText());
    runButtonData.widthHint = execSize.x + 70;
    runtimeButton.setLayoutData(runButtonData);
    gcCheckButton = new Button(topGroup, SWT.CHECK);
    GridData gcCheckButtonData = new GridData();
    gcCheckButtonData.grabExcessHorizontalSpace = false;
    gcCheckButton.setLayoutData(gcCheckButtonData);
    gcCheckButton.setEnabled(true);
    gcCheckButton.setSelection(isGCSelected);
    Label periodLabel = new Label(topGroup, SWT.NULL);
    //$NON-NLS-1$
    periodLabel.setText(Messages.getString("ProcessView.moniorPeriod"));
    periodLabel.setBackground(getBackground());
    GridData periodLabelData = new GridData();
    execSize = computeSize(periodLabel.getText());
    periodLabelData.widthHint = execSize.x;
    periodLabelData.grabExcessHorizontalSpace = false;
    periodLabelData.horizontalAlignment = GridData.BEGINNING;
    periodLabel.setLayoutData(periodLabelData);
    periodCombo = new Combo(topGroup, SWT.READ_ONLY);
    GridData periodData = new GridData();
    execSize = computeSize("Select");
    periodData.widthHint = execSize.x;
    periodData.grabExcessHorizontalSpace = false;
    periodData.horizontalAlignment = GridData.BEGINNING;
    periodData.minimumWidth = execSize.x;
    periodCombo.setLayoutData(periodData);
    periodCombo.setItems(new String[] { "Select", "30 sec", "60 sec", //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
    "120 sec" });
    periodCombo.setEnabled(isGCSelected);
    if (isGCSelected) {
        periodCombo.select(periodComboSelectionIndex);
    } else {
        periodCombo.select(0);
        periodComboSelectionIndex = 0;
    }
    contextCombo = new ComboViewer(topGroup, SWT.BORDER | SWT.READ_ONLY);
    contextCombo.getCombo().setLayout(new FormLayout());
    GridData contextComboData = new GridData();
    contextComboData.grabExcessHorizontalSpace = true;
    contextComboData.horizontalAlignment = GridData.END;
    //$NON-NLS-N$
    execSize = computeSize("Default");
    contextComboData.minimumWidth = execSize.x;
    contextCombo.getCombo().setLayoutData(contextComboData);
    contextCombo.setContentProvider(ArrayContentProvider.getInstance());
    contextCombo.setLabelProvider(new ContextNameLabelProvider());
    initContextInput();
    chartComposite = new RuntimeGraphcsComposite(monitorComposite, processContextSelection, SWT.NULL);
    FormLayout rgcLayout = new FormLayout();
    FormData charLayData = new FormData();
    charLayData.left = new FormAttachment(0, 10);
    charLayData.right = new FormAttachment(100, 0);
    charLayData.top = new FormAttachment(topGroup, 60, SWT.BOTTOM);
    charLayData.bottom = new FormAttachment(100, 0);
    chartComposite.setLayout(rgcLayout);
    chartComposite.setLayoutData(charLayData);
}
Also used : FormData(org.eclipse.swt.layout.FormData) FormLayout(org.eclipse.swt.layout.FormLayout) Group(org.eclipse.swt.widgets.Group) Composite(org.eclipse.swt.widgets.Composite) AbstractRuntimeGraphcsComposite(org.talend.designer.runtime.visualization.views.AbstractRuntimeGraphcsComposite) RuntimeGraphcsComposite(org.talend.designer.runtime.visualization.views.RuntimeGraphcsComposite) ScrolledComposite(org.eclipse.swt.custom.ScrolledComposite) Label(org.eclipse.swt.widgets.Label) Combo(org.eclipse.swt.widgets.Combo) Point(org.eclipse.swt.graphics.Point) Button(org.eclipse.swt.widgets.Button) ComboViewer(org.eclipse.jface.viewers.ComboViewer) AbstractRuntimeGraphcsComposite(org.talend.designer.runtime.visualization.views.AbstractRuntimeGraphcsComposite) RuntimeGraphcsComposite(org.talend.designer.runtime.visualization.views.RuntimeGraphcsComposite) ISelection(org.eclipse.jface.viewers.ISelection) GridData(org.eclipse.swt.layout.GridData) FormAttachment(org.eclipse.swt.layout.FormAttachment)

Aggregations

ComboViewer (org.eclipse.jface.viewers.ComboViewer)1 ISelection (org.eclipse.jface.viewers.ISelection)1 ScrolledComposite (org.eclipse.swt.custom.ScrolledComposite)1 Point (org.eclipse.swt.graphics.Point)1 FormAttachment (org.eclipse.swt.layout.FormAttachment)1 FormData (org.eclipse.swt.layout.FormData)1 FormLayout (org.eclipse.swt.layout.FormLayout)1 GridData (org.eclipse.swt.layout.GridData)1 Button (org.eclipse.swt.widgets.Button)1 Combo (org.eclipse.swt.widgets.Combo)1 Composite (org.eclipse.swt.widgets.Composite)1 Group (org.eclipse.swt.widgets.Group)1 Label (org.eclipse.swt.widgets.Label)1 AbstractRuntimeGraphcsComposite (org.talend.designer.runtime.visualization.views.AbstractRuntimeGraphcsComposite)1 RuntimeGraphcsComposite (org.talend.designer.runtime.visualization.views.RuntimeGraphcsComposite)1