Search in sources :

Example 76 with FormAttachment

use of org.eclipse.swt.layout.FormAttachment in project tdi-studio-se by Talend.

the class RuntimeGraphcsComposite method reconstructCharts.

void reconstructCharts(IActiveJvm activeJvm, boolean connected) {
    if (chartsPage.isDisposed()) {
        return;
    }
    if (connected) {
        try {
            loadOverviewChartSet(activeJvm);
        } catch (JvmCoreException e) {
            Activator.log(Messages.configureMonitoredAttributesFailedMsg, e);
        }
    }
    List<IMonitoredMXBeanGroup> groups = activeJvm.getMBeanServer().getMonitoredAttributeGroups();
    if (groups.size() == 0) {
        return;
    }
    for (TimelineChart chart : charts) {
        chart.dispose();
    }
    charts.clear();
    if (chartComposite != null && !chartComposite.isDisposed()) {
        chartComposite.dispose();
    }
    chartComposite = new Composite(chartsPage, SWT.NONE);
    FormLayout chartLayout = new FormLayout();
    chartLayout.marginHeight = 0;
    chartLayout.marginWidth = 0;
    chartComposite.setLayout(chartLayout);
    FormData chartComData = new FormData();
    chartComData.top = new FormAttachment(0, 0);
    chartComData.bottom = new FormAttachment(100, 0);
    chartComData.left = new FormAttachment(0, 0);
    chartComData.right = new FormAttachment(100, 0);
    chartComposite.setLayoutData(chartComData);
    for (IMonitoredMXBeanGroup group : groups) {
        createSection(chartComposite, group);
    }
    createReportField(chartComposite);
    //      createInfoField(chartComposite);
    chartsPage.layout();
    chartsPage.setVisible(true);
    refresh();
}
Also used : FormLayout(org.eclipse.swt.layout.FormLayout) FormData(org.eclipse.swt.layout.FormData) IMonitoredMXBeanGroup(org.talend.designer.runtime.visualization.MBean.IMonitoredMXBeanGroup) Composite(org.eclipse.swt.widgets.Composite) ExpandableComposite(org.eclipse.ui.forms.widgets.ExpandableComposite) ScrolledComposite(org.eclipse.swt.custom.ScrolledComposite) TimelineChart(org.talend.designer.runtime.visualization.internal.ui.properties.timeline.TimelineChart) FormAttachment(org.eclipse.swt.layout.FormAttachment) JvmCoreException(org.talend.designer.runtime.visualization.JvmCoreException)

Example 77 with FormAttachment

use of org.eclipse.swt.layout.FormAttachment 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 78 with FormAttachment

use of org.eclipse.swt.layout.FormAttachment 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 79 with FormAttachment

use of org.eclipse.swt.layout.FormAttachment in project tdi-studio-se by Talend.

the class AbstractRuntimeGraphcsComposite method initGraphcs.

private void initGraphcs() {
    // messagePage = createMessagePage(parent);
    contentPage = new Composite(this, SWT.NULL);
    FormLayout formLayout = new FormLayout();
    formLayout.marginWidth = 0;
    formLayout.marginHeight = 0;
    contentPage.setLayout(formLayout);
    FormData pageData = new FormData();
    pageData.top = new FormAttachment(0, 0);
    pageData.bottom = new FormAttachment(100, 0);
    pageData.left = new FormAttachment(0, 0);
    pageData.right = new FormAttachment(100, 0);
    contentPage.setLayoutData(pageData);
    createControls(contentPage);
    contentPage.layout();
    contentPage.setVisible(true);
    JvmModel.getInstance().addJvmModelChangeListener(this);
    suspendRefresh = false;
}
Also used : FormLayout(org.eclipse.swt.layout.FormLayout) FormData(org.eclipse.swt.layout.FormData) Composite(org.eclipse.swt.widgets.Composite) FormAttachment(org.eclipse.swt.layout.FormAttachment)

Example 80 with FormAttachment

use of org.eclipse.swt.layout.FormAttachment in project tdi-studio-se by Talend.

the class LoginAgreementPage method createControl.

@Override
public void createControl(Composite parentCtrl) {
    Composite container = new Composite(parentCtrl, SWT.NONE);
    container.setLayout(new FormLayout());
    Label titleLabel = new Label(container, SWT.WRAP);
    titleLabel.setFont(LoginDialogV2.fixedFont);
    //$NON-NLS-1$
    titleLabel.setText(Messages.getString("LoginAgreementPage.title"));
    FormData titleLabelFormData = new FormData();
    titleLabelFormData.left = new FormAttachment(0, 0);
    titleLabelFormData.top = new FormAttachment(0, 0);
    titleLabel.setLayoutData(titleLabelFormData);
    acceptButton = new Button(container, SWT.CENTER);
    acceptButton.setBackground(backgroundColor);
    acceptButton.setFont(LoginDialogV2.fixedFont);
    //$NON-NLS-1$
    acceptButton.setText(Messages.getString("LoginAgreementPage.accept"));
    FormData acceptButtonFormLayoutData = new FormData();
    acceptButtonFormLayoutData.bottom = new FormAttachment(100, 0);
    acceptButtonFormLayoutData.right = new FormAttachment(100, 0);
    acceptButtonFormLayoutData.left = new FormAttachment(100, -1 * LoginDialogV2.getNewButtonSize(acceptButton).x);
    acceptButton.setLayoutData(acceptButtonFormLayoutData);
    boolean haveHtmlDesc = false;
    FileInputStream licenseInputStream = null;
    String licenseFileBasePath = Platform.getInstallLocation().getURL().getPath();
    if (Boolean.parseBoolean(System.getProperty("USE_BROWSER"))) {
        //$NON-NLS-1$
        File htmlFile = new File(licenseFileBasePath + LICENSE_FILE_PATH_HTML);
        if (htmlFile.exists()) {
            try {
                licenseInputStream = new FileInputStream(htmlFile);
                if (licenseInputStream != null) {
                    haveHtmlDesc = true;
                }
            } catch (FileNotFoundException e) {
                CommonExceptionHandler.process(e);
            }
        }
    }
    if (licenseInputStream == null) {
        try {
            licenseInputStream = new FileInputStream(licenseFileBasePath + LICENSE_FILE_PATH);
        } catch (FileNotFoundException e) {
            CommonExceptionHandler.process(e);
        }
    }
    FormData clufLayoutData = new FormData();
    clufLayoutData.top = new FormAttachment(titleLabel, LoginDialogV2.TAB_VERTICAL_PADDING_LEVEL_1, SWT.BOTTOM);
    clufLayoutData.left = new FormAttachment(0, 0);
    clufLayoutData.right = new FormAttachment(100, 0);
    clufLayoutData.bottom = new FormAttachment(acceptButton, -1 * LoginDialogV2.TAB_VERTICAL_PADDING_LEVEL_1, SWT.TOP);
    if (haveHtmlDesc) {
        clufBrowser = new Browser(container, SWT.BORDER);
        clufBrowser.setText(getLicense(licenseInputStream));
        clufBrowser.setLayoutData(clufLayoutData);
    } else {
        clufText = new Text(container, SWT.MULTI | SWT.WRAP | SWT.V_SCROLL | SWT.H_SCROLL | SWT.LEFT | SWT.BORDER);
        clufText.setBackground(new Color(null, 255, 255, 255));
        //$NON-NLS-1$
        Font font = new Font(DisplayUtils.getDisplay(), "courier", 10, SWT.NONE);
        clufText.setFont(font);
        clufText.setEditable(false);
        clufText.setText(getLicense(licenseInputStream));
        clufText.setLayoutData(clufLayoutData);
    }
}
Also used : FormLayout(org.eclipse.swt.layout.FormLayout) FormData(org.eclipse.swt.layout.FormData) Composite(org.eclipse.swt.widgets.Composite) Color(org.eclipse.swt.graphics.Color) Label(org.eclipse.swt.widgets.Label) FileNotFoundException(java.io.FileNotFoundException) Text(org.eclipse.swt.widgets.Text) FileInputStream(java.io.FileInputStream) Font(org.eclipse.swt.graphics.Font) Button(org.eclipse.swt.widgets.Button) File(java.io.File) FormAttachment(org.eclipse.swt.layout.FormAttachment) Browser(org.eclipse.swt.browser.Browser)

Aggregations

FormAttachment (org.eclipse.swt.layout.FormAttachment)253 FormData (org.eclipse.swt.layout.FormData)245 Composite (org.eclipse.swt.widgets.Composite)97 Point (org.eclipse.swt.graphics.Point)96 Button (org.eclipse.swt.widgets.Button)95 FormLayout (org.eclipse.swt.layout.FormLayout)93 Control (org.eclipse.swt.widgets.Control)64 Label (org.eclipse.swt.widgets.Label)59 CLabel (org.eclipse.swt.custom.CLabel)56 SelectionEvent (org.eclipse.swt.events.SelectionEvent)55 Node (org.talend.designer.core.ui.editor.nodes.Node)49 Text (org.eclipse.swt.widgets.Text)48 GC (org.eclipse.swt.graphics.GC)46 SelectionListener (org.eclipse.swt.events.SelectionListener)37 DecoratedField (org.eclipse.jface.fieldassist.DecoratedField)36 GridData (org.eclipse.swt.layout.GridData)36 FieldDecoration (org.eclipse.jface.fieldassist.FieldDecoration)34 SelectionAdapter (org.eclipse.swt.events.SelectionAdapter)32 GridLayout (org.eclipse.swt.layout.GridLayout)32 Group (org.eclipse.swt.widgets.Group)29