use of com.ramussoft.chart.ChartDataPlugin in project ramus by Vitaliy-Yakovchuk.
the class TableChartAttributePlugin method getAttributeEditor.
@Override
public AttributeEditor getAttributeEditor(final Engine engine, final AccessRules rules, final Element element, final Attribute attribute, AttributeEditor oldAttributeEditor) {
return new AbstractAttributeEditor() {
@Override
public Object setValue(Object value) {
return null;
}
@Override
public Object getValue() {
return null;
}
@Override
public JComponent getComponent() {
ChartDataFramework chartDataFramework = ChartDataFramework.getChartDataFramework(engine);
ChartSource source = new ChartSource(engine) {
@Override
public List<Element> getElements() {
List<Element> res = new ArrayList<Element>();
for (QualifierSource source : qualifierSources) {
if (QualifierSource.ELEMENTS_LOAD_TYPE_ALL.equals(source.getElementsLoadType())) {
FilterSource filterSource = source.getFilterSources().get(0);
Qualifier qualifier = source.getQualifier();
if (StandardAttributesPlugin.isTableQualifier(qualifier) && filterSource.getAttribute().equals(StandardAttributesPlugin.getTableElementIdAttribute(engine))) {
res.addAll(StandardAttributesPlugin.getOrderedTableElements(engine, StandardAttributesPlugin.getAttributeForTable(engine, qualifier), element));
} else
res.addAll(engine.findElements(qualifier.getId(), filterSource.getAttribute(), Long.parseLong(filterSource.getValue())));
} else
for (ElementSource elementSource : source.getElementSources()) res.add(elementSource.getElement());
}
return res;
}
};
TableChartPersistent tcp = (TableChartPersistent) engine.getAttribute(null, attribute);
Element chartElement = engine.getElement(tcp.getOtherElementId());
source.load(chartElement);
ChartDataPlugin chartDataPlugin = chartDataFramework.getChartDataPlugin(source.getChartType());
JFreeChart freeChart = chartDataPlugin.createChart(element, source);
return new ChartPanel(freeChart);
}
};
}
use of com.ramussoft.chart.ChartDataPlugin in project ramus by Vitaliy-Yakovchuk.
the class ChartView method createComponent.
@Override
public JComponent createComponent() {
ChartDataPlugin plugin = chartDataFramework.getChartDataPlugin(chartSource.getChartType());
try {
chartPanel = new ChartPanel(plugin.createChart(element));
chartPanel.setPopupMenu(null);
} catch (ChartNotSetupedException e) {
JOptionPane.showMessageDialog(framework.getMainFrame(), ChartResourceManager.getString("Error.chartNotSetuped"));
SwingUtilities.invokeLater(new Runnable() {
@Override
public void run() {
close();
}
});
return new JPanel();
}
return chartPanel;
}
use of com.ramussoft.chart.ChartDataPlugin in project ramus by Vitaliy-Yakovchuk.
the class ChartView method reload.
protected void reload() {
try {
ChartDataPlugin plugin = chartDataFramework.getChartDataPlugin(chartSource.getChartType());
chartPanel.setChart(plugin.createChart(element));
} catch (ChartNotSetupedException e) {
close();
JOptionPane.showMessageDialog(framework.getMainFrame(), ChartResourceManager.getString("Error.chartNotSetuped"));
}
}
Aggregations