Search in sources :

Example 1 with AxisUnit

use of org.talend.designer.runtime.visualization.MBean.IMonitoredMXBeanGroup.AxisUnit in project tdi-studio-se by Talend.

the class ConfigChartAction method run.

/*
     * @see Action#run()
     */
@Override
public void run() {
    IActiveJvm jvm = runtimeComposite.getJvm();
    if (jvm == null) {
        return;
    }
    String title = chart.getSection().getText();
    IMonitoredMXBeanGroup group = chart.getAttributeGroup();
    AxisUnit unit = group.getAxisUnit();
    List<MBeanAttribute> attributes = getAttributes();
    ConfigureChartDialog dialog = new ConfigureChartDialog(chart.getShell(), title, unit, attributes, jvm, true);
    if (dialog.open() == Window.OK) {
        performConfiguration(dialog.getChartTitle(), dialog.getAxisUnit(), dialog.getAttributes(), dialog.getRemovedAttributes());
    }
}
Also used : IActiveJvm(org.talend.designer.runtime.visualization.IActiveJvm) IMonitoredMXBeanGroup(org.talend.designer.runtime.visualization.MBean.IMonitoredMXBeanGroup) AxisUnit(org.talend.designer.runtime.visualization.MBean.IMonitoredMXBeanGroup.AxisUnit)

Example 2 with AxisUnit

use of org.talend.designer.runtime.visualization.MBean.IMonitoredMXBeanGroup.AxisUnit in project tdi-studio-se by Talend.

the class ConfigureChartAction method run.

/*
     * @see Action#run()
     */
@Override
public void run() {
    IActiveJvm jvm = section.getJvm();
    if (jvm == null) {
        return;
    }
    String title = chart.getSection().getText();
    IMonitoredMXBeanGroup group = chart.getAttributeGroup();
    AxisUnit unit = group.getAxisUnit();
    List<MBeanAttribute> attributes = getAttributes();
    ConfigureChartDialog dialog = new ConfigureChartDialog(chart.getShell(), title, unit, attributes, jvm, true);
    if (dialog.open() == Window.OK) {
        performConfiguration(dialog.getChartTitle(), dialog.getAxisUnit(), dialog.getAttributes(), dialog.getRemovedAttributes());
    }
}
Also used : IActiveJvm(org.talend.designer.runtime.visualization.IActiveJvm) IMonitoredMXBeanGroup(org.talend.designer.runtime.visualization.MBean.IMonitoredMXBeanGroup) AxisUnit(org.talend.designer.runtime.visualization.MBean.IMonitoredMXBeanGroup.AxisUnit)

Example 3 with AxisUnit

use of org.talend.designer.runtime.visualization.MBean.IMonitoredMXBeanGroup.AxisUnit in project tdi-studio-se by Talend.

the class ConfigureChartDialog method createChartConfigControls.

/**
     * Creates the controls for chart configuration.
     * 
     * @param parent The parent composite
     */
private void createChartConfigControls(Composite parent) {
    Composite composite = new Composite(parent, SWT.NONE);
    GridLayout layout = new GridLayout(2, false);
    composite.setLayout(layout);
    composite.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
    new Label(composite, SWT.NONE).setText(Messages.chartTitleLabel);
    chartTitleText = new Text(composite, SWT.BORDER);
    chartTitleText.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
    chartTitleText.setText(chartTitle);
    chartTitleText.setSelection(0, chartTitle.length());
    chartTitleText.addModifyListener(new ModifyListener() {

        @Override
        public void modifyText(ModifyEvent e) {
            validate(chartTitleText.getText());
        }
    });
    new Label(composite, SWT.NONE).setText(Messages.yAxisUnitLabel);
    axisUnitCombo = new Combo(composite, SWT.READ_ONLY);
    List<String> items = new ArrayList<String>();
    int initialSelection = -1;
    AxisUnit[] values = AxisUnit.values();
    for (int i = 0; i < values.length; i++) {
        items.add(values[i].name());
        if (values[i] == unit) {
            initialSelection = i;
        }
    }
    axisUnitCombo.setItems(items.toArray(new String[items.size()]));
    if (initialSelection == -1) {
        initialSelection = items.size() - 1;
    }
    axisUnitCombo.select(initialSelection);
    axisUnitCombo.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
}
Also used : Composite(org.eclipse.swt.widgets.Composite) ModifyListener(org.eclipse.swt.events.ModifyListener) AxisUnit(org.talend.designer.runtime.visualization.MBean.IMonitoredMXBeanGroup.AxisUnit) Label(org.eclipse.swt.widgets.Label) ArrayList(java.util.ArrayList) Text(org.eclipse.swt.widgets.Text) Combo(org.eclipse.swt.widgets.Combo) GridLayout(org.eclipse.swt.layout.GridLayout) ModifyEvent(org.eclipse.swt.events.ModifyEvent) GridData(org.eclipse.swt.layout.GridData)

Example 4 with AxisUnit

use of org.talend.designer.runtime.visualization.MBean.IMonitoredMXBeanGroup.AxisUnit in project tdi-studio-se by Talend.

the class TimelineChart method refreshChartWidget.

/**
     * Refreshes the chart widget.
     */
void refreshChartWidget() {
    if (isDisposed()) {
        return;
    }
    deleteMonitoredSeries();
    for (IMonitoredMXBeanAttribute attribute : attributeGroup.getAttributes()) {
        String seriesId = getSeriesId(attribute);
        ISeries series = getSeriesSet().getSeries(seriesId);
        if (series == null) {
            boolean enableArea = true;
            series = addMonitoredSeries(attribute, enableArea);
            if (series == null) {
                return;
            }
        }
        series.setXDateSeries(attribute.getDates().toArray(new Date[0]));
        series.setYSeries(getYSeries(attribute));
        setColor((ILineSeries) series, attribute.getRGB());
    }
    AxisUnit axisUnit = attributeGroup.getAxisUnit();
    if (axisUnit == AxisUnit.MBytes) {
        //$NON-NLS-1$
        getAxisSet().getYAxis(0).getTick().setFormat(new DecimalFormat("#####.#M"));
        getAxisSet().adjustRange();
    } else if (axisUnit == AxisUnit.Percent) {
        //$NON-NLS-1$
        getAxisSet().getYAxis(0).getTick().setFormat(new DecimalFormat("###%"));
        getAxisSet().getXAxis(0).adjustRange();
        int y = getSize().y;
        if (y > 0) {
            getAxisSet().getYAxis(0).setRange(new Range(0, (y + 10) / (double) y));
        }
    } else if (axisUnit == AxisUnit.Count) {
        getAxisSet().getYAxis(0).getTick().setFormat(NumberFormat.getIntegerInstance());
        getAxisSet().adjustRange();
    } else {
        getAxisSet().adjustRange();
    }
    section.setText(attributeGroup.getName());
    section.layout();
    marker.redraw();
    redraw();
}
Also used : AxisUnit(org.talend.designer.runtime.visualization.MBean.IMonitoredMXBeanGroup.AxisUnit) DecimalFormat(java.text.DecimalFormat) IMonitoredMXBeanAttribute(org.talend.designer.runtime.visualization.MBean.IMonitoredMXBeanAttribute) Range(org.swtchart.Range) ISeries(org.swtchart.ISeries) Date(java.util.Date)

Aggregations

AxisUnit (org.talend.designer.runtime.visualization.MBean.IMonitoredMXBeanGroup.AxisUnit)4 IActiveJvm (org.talend.designer.runtime.visualization.IActiveJvm)2 IMonitoredMXBeanGroup (org.talend.designer.runtime.visualization.MBean.IMonitoredMXBeanGroup)2 DecimalFormat (java.text.DecimalFormat)1 ArrayList (java.util.ArrayList)1 Date (java.util.Date)1 ModifyEvent (org.eclipse.swt.events.ModifyEvent)1 ModifyListener (org.eclipse.swt.events.ModifyListener)1 GridData (org.eclipse.swt.layout.GridData)1 GridLayout (org.eclipse.swt.layout.GridLayout)1 Combo (org.eclipse.swt.widgets.Combo)1 Composite (org.eclipse.swt.widgets.Composite)1 Label (org.eclipse.swt.widgets.Label)1 Text (org.eclipse.swt.widgets.Text)1 ISeries (org.swtchart.ISeries)1 Range (org.swtchart.Range)1 IMonitoredMXBeanAttribute (org.talend.designer.runtime.visualization.MBean.IMonitoredMXBeanAttribute)1