use of com.ramussoft.common.Element in project ramus by Vitaliy-Yakovchuk.
the class CreateChartDialog method onOk.
@Override
protected void onOk() {
Engine engine = framework.getEngine();
try {
((Journaled) engine).startUserTransaction();
Element element = chartsView.createChartElement(name.getText());
editor.save(element);
((Journaled) engine).commitUserTransaction();
} catch (Exception e) {
((Journaled) engine).rollbackUserTransaction();
e.printStackTrace();
JOptionPane.showMessageDialog(framework.getMainFrame(), e.getLocalizedMessage());
}
super.onOk();
}
use of com.ramussoft.common.Element in project ramus by Vitaliy-Yakovchuk.
the class PieChartDataPlugin method createChart.
@Override
public JFreeChart createChart(Element element, ChartSource source) {
Attribute key = source.getAttributeProperty(PIE_ATTRIBUTE_KEY);
Attribute value = source.getAttributeProperty(PIE_ATTRIBUTE_VALUE);
if ((key == null) || (value == null))
throw new ChartNotSetupedException();
DefaultPieDataset dataset = new DefaultPieDataset();
for (Element element2 : source.getElements()) {
Object v1 = engine.getAttribute(element2, key);
Object v2 = engine.getAttribute(element2, value);
if ((v1 != null) && (v2 != null))
dataset.setValue(toString(v1), toDouble(v2));
}
return ChartFactory.createPieChart(element.getName(), dataset, true, true, false);
}
use of com.ramussoft.common.Element in project ramus by Vitaliy-Yakovchuk.
the class ChartPlugin method createChartLink.
public static Element createChartLink(Engine engine) {
ChartPlugin plugin = getChartPlugin(engine);
Element element = engine.createElement(plugin.chartLinks.getId());
return element;
}
use of com.ramussoft.common.Element in project ramus by Vitaliy-Yakovchuk.
the class ChartPlugin method getChartLink.
public static Element getChartLink(Engine engine, Element chartSet, Element chart) {
ChartPlugin plugin = getChartPlugin(engine);
Long id = chart.getId();
for (Element element : engine.findElements(plugin.chartLinks.getId(), plugin.chartSet, chartSet.getId())) {
if (id.equals(engine.getAttribute(element, plugin.chart))) {
return element;
}
}
return null;
}
use of com.ramussoft.common.Element in project ramus by Vitaliy-Yakovchuk.
the class QualifierImporterImpl method createQualifier.
private Qualifier createQualifier(Qualifier sourceQualifier, Row row) {
Qualifier res = engine.getQualifierByName(sourceQualifier.getName());
if (res == null) {
Qualifier q = StandardAttributesPlugin.getQualifiersQualifier(engine);
RowSet rs = new RowSet(engine, q, new Attribute[] {});
Row parent = findParent(rs, row.getParent());
if ((parent != null) && (parent.getElement() == null))
parent = null;
if ((parent != null) && (engine.getElements(StandardAttributesPlugin.getQualifier(engine, parent.getElement()).getId()).size() > 0))
parent = null;
Element element = rs.createRow(parent).getElement();
res = StandardAttributesPlugin.getQualifier(engine, element);
res.setName(sourceQualifier.getName());
engine.updateQualifier(res);
rs.close();
}
return res;
}
Aggregations