Search in sources :

Example 1 with AttributesSelectPanel

use of com.ramussoft.gui.attribute.AttributesSelectPanel in project ramus by Vitaliy-Yakovchuk.

the class BarChartSetupEditor method createComponent.

@Override
public JComponent createComponent(GUIFramework framework, Element element) {
    JComponent component = super.createComponent(framework, element);
    initAttributes(framework.getEngine());
    ChartSource source = getChartSource();
    key.setSelectedItem(source.getAttributeProperty(BAR_ATTRIBUTE_KEY));
    double[][] size = { { 5, TableLayout.MINIMUM, TableLayout.FILL, TableLayout.MINIMUM, TableLayout.FILL, 5 }, { 5, TableLayout.FILL, TableLayout.FILL, 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("Label.categoryAxis")), "1,1");
    panel.add(categoryAxis, "2,1");
    panel.add(new JLabel(ChartResourceManager.getString("Label.valueAxis")), "3,1");
    panel.add(valueAxis, "4,1");
    panel.add(new JLabel(ChartResourceManager.getString("Chart.key")), "1,2");
    panel.add(key, "2,2");
    panel.add(new JLabel(ChartResourceManager.getString("Orientation")), "3,2");
    panel.add(orientation, "4,2");
    panel.add(new JLabel(ChartResourceManager.getString("Chart.values")), "1,3,3,3");
    attributesSelectPanel = new AttributesSelectPanel(framework, source.getPropertyAttributes(BAR_ATTRIBUTE_VALUE_PREFIX));
    attributesSelectPanel.setPreferredSize(new Dimension(300, 150));
    JPanel panel3 = new JPanel(new BorderLayout());
    panel3.add(panel, BorderLayout.CENTER);
    panel3.add(attributesSelectPanel, BorderLayout.SOUTH);
    categoryAxis.setText(source.getProperty(BAR_CATEGORY_AXIS_LABEL));
    valueAxis.setText(source.getProperty(BAR_VALUE_AXIS_LABEL));
    String o = source.getProperty(BAR_ORIENTATION);
    if (BAR_ORIENTATION_HORIZONTAL.equals(o))
        orientation.setSelectedIndex(1);
    JPanel panel2 = new JPanel(new BorderLayout());
    panel2.add(component, BorderLayout.CENTER);
    panel2.add(panel3, BorderLayout.SOUTH);
    return panel2;
}
Also used : JPanel(javax.swing.JPanel) BorderLayout(java.awt.BorderLayout) ChartSource(com.ramussoft.chart.ChartSource) AttributesSelectPanel(com.ramussoft.gui.attribute.AttributesSelectPanel) JComponent(javax.swing.JComponent) JLabel(javax.swing.JLabel) Dimension(java.awt.Dimension) TableLayout(info.clearthought.layout.TableLayout)

Aggregations

ChartSource (com.ramussoft.chart.ChartSource)1 AttributesSelectPanel (com.ramussoft.gui.attribute.AttributesSelectPanel)1 TableLayout (info.clearthought.layout.TableLayout)1 BorderLayout (java.awt.BorderLayout)1 Dimension (java.awt.Dimension)1 JComponent (javax.swing.JComponent)1 JLabel (javax.swing.JLabel)1 JPanel (javax.swing.JPanel)1