Search in sources :

Example 6 with ChartSource

use of com.ramussoft.chart.ChartSource in project ramus by Vitaliy-Yakovchuk.

the class PieChartSetupEditor method createComponent.

@Override
public JComponent createComponent(GUIFramework framework, Element element) {
    JComponent component = super.createComponent(framework, element);
    final ChartSource source = getChartSource();
    initAttributes(framework.getEngine());
    key.setSelectedItem(source.getAttributeProperty(PIE_ATTRIBUTE_KEY));
    value.setSelectedItem(source.getAttributeProperty(PIE_ATTRIBUTE_VALUE));
    double[][] size = { { 5, TableLayout.MINIMUM, TableLayout.FILL, TableLayout.MINIMUM, TableLayout.FILL, 5 }, { 5, TableLayout.FILL, 5 } };
    TableLayout layout = new TableLayout(size);
    layout.setHGap(5);
    layout.setVGap(5);
    JPanel panel = new JPanel(layout);
    panel.add(new JLabel(ChartResourceManager.getString("Chart.key")), "1,1");
    panel.add(key, "2,1");
    panel.add(new JLabel(ChartResourceManager.getString("Chart.value")), "3,1");
    panel.add(value, "4,1");
    JPanel panel2 = new JPanel(new BorderLayout());
    panel2.add(component, BorderLayout.CENTER);
    panel2.add(panel, BorderLayout.SOUTH);
    return panel2;
}
Also used : JPanel(javax.swing.JPanel) BorderLayout(java.awt.BorderLayout) ChartSource(com.ramussoft.chart.ChartSource) JComponent(javax.swing.JComponent) JLabel(javax.swing.JLabel) TableLayout(info.clearthought.layout.TableLayout)

Example 7 with ChartSource

use of com.ramussoft.chart.ChartSource in project ramus by Vitaliy-Yakovchuk.

the class AbstractChartSetupEditor method save.

@Override
public void save(Element element) {
    component.save();
    ByteArrayOutputStream stream = new ByteArrayOutputStream();
    ChartSource chartSource = getChartSource();
    chartSource.setChartType(type);
    chartSource.save(stream);
    framework.getEngine().setUndoableStream(getPreferencesPath(element, StandardAttributesPlugin.getAttributeNameAttribute(framework.getEngine())), stream.toByteArray());
}
Also used : ChartSource(com.ramussoft.chart.ChartSource) ByteArrayOutputStream(java.io.ByteArrayOutputStream)

Aggregations

ChartSource (com.ramussoft.chart.ChartSource)7 Attribute (com.ramussoft.common.Attribute)2 TableLayout (info.clearthought.layout.TableLayout)2 BorderLayout (java.awt.BorderLayout)2 JComponent (javax.swing.JComponent)2 JLabel (javax.swing.JLabel)2 JPanel (javax.swing.JPanel)2 ChartDataFramework (com.ramussoft.chart.ChartDataFramework)1 ChartDataPlugin (com.ramussoft.chart.ChartDataPlugin)1 ElementSource (com.ramussoft.chart.ElementSource)1 FilterSource (com.ramussoft.chart.FilterSource)1 QualifierSource (com.ramussoft.chart.QualifierSource)1 TableChartPersistent (com.ramussoft.chart.core.TableChartPersistent)1 Element (com.ramussoft.common.Element)1 Engine (com.ramussoft.common.Engine)1 Qualifier (com.ramussoft.common.Qualifier)1 AttributesSelectPanel (com.ramussoft.gui.attribute.AttributesSelectPanel)1 AbstractAttributeEditor (com.ramussoft.gui.common.AbstractAttributeEditor)1 Dimension (java.awt.Dimension)1 ByteArrayOutputStream (java.io.ByteArrayOutputStream)1