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());
}
}
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());
}
}
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));
}
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();
}
Aggregations