Search in sources :

Example 1 with QualifierSource

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

the class ChartSourceSelectPanel method changeSourceForTable.

private void changeSourceForTable() {
    Engine engine = framework.getEngine();
    QualifierSource source = chartSource.getQualifierSources().get(0);
    FilterSource source2 = source.getFilterSources().get(0);
    Element element = engine.getElement(Long.parseLong(source2.getValue()));
    source.setQualifier(engine.getQualifier(element.getQualifierId()));
    source.getElementSources().clear();
    ElementSource source3 = chartSource.createElementSource();
    source3.setElement(element);
    source.getElementSources().add(source3);
    source.getFilterSources().clear();
}
Also used : QualifierSource(com.ramussoft.chart.QualifierSource) FilterSource(com.ramussoft.chart.FilterSource) Element(com.ramussoft.common.Element) ElementSource(com.ramussoft.chart.ElementSource) Engine(com.ramussoft.common.Engine)

Example 2 with QualifierSource

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

the class ChartSourceSelectPanel method createRightPanel.

private void createRightPanel() {
    if (qualifierView == null)
        return;
    Qualifier qualifier = qualifierView.getSelectedQualifier();
    boolean b = qualifier != null;
    if (b) {
        framework.setOpenDynamikViewEvent(new ActionEvent(QualifierPlugin.OPEN_QUALIFIER, qualifier));
        QualifierSource qualifierSource = null;
        for (QualifierSource s : chartSource.getQualifierSources()) {
            if (s.getQualifier().equals(qualifier)) {
                qualifierSource = s;
                break;
            }
        }
        if (qualifierSource == null) {
            qualifierSource = chartSource.createQualifierSource();
            qualifierSource.setQualifier(qualifier);
            chartSource.getQualifierSources().add(qualifierSource);
        }
        qualifierSelectPanel = new QualifierSourceSelectPanel(framework, qualifier, qualifierSource, (sourceType.getSelectedItem().equals(sourceTypeElements)) ? SelectType.CHECK : SelectType.RADIO);
        int dl = pane.getDividerLocation();
        pane.setRightComponent(qualifierSelectPanel);
        pane.revalidate();
        pane.repaint();
        pane.setDividerLocation(dl);
    }
}
Also used : QualifierSource(com.ramussoft.chart.QualifierSource) ActionEvent(com.ramussoft.gui.common.event.ActionEvent) Qualifier(com.ramussoft.common.Qualifier)

Example 3 with QualifierSource

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

the class ChartSourceSelectPanel method saveSelectedElements.

private void saveSelectedElements() {
    qualifierSelectPanel.save();
    QualifierSource source = qualifierSelectPanel.getQualifierSource();
    if (sourceType.getSelectedItem().equals(sourceTypeTable)) {
        if (source.getElementSources().size() > 0) {
            chartSource.getQualifierSources().clear();
            chartSource.getQualifierSources().add(source);
        }
    }
}
Also used : QualifierSource(com.ramussoft.chart.QualifierSource)

Example 4 with QualifierSource

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

the class ChartSourceSelectPanel method addTableAttributes.

private void addTableAttributes() {
    Attribute select = null;
    List<QualifierSource> sources = chartSource.getQualifierSources();
    if (sources.size() > 0) {
        QualifierSource source = sources.get(0);
        if (source.getQualifier().isSystem())
            select = StandardAttributesPlugin.getAttributeForTable(framework.getEngine(), source.getQualifier());
    }
    for (Attribute attribute : framework.getEngine().getAttributes()) {
        if (attribute.getAttributeType().toString().equals("Core.Table")) {
            tableAttribute.addItem(attribute);
            if (attribute.equals(select))
                tableAttribute.setSelectedItem(attribute);
        }
    }
}
Also used : QualifierSource(com.ramussoft.chart.QualifierSource) Attribute(com.ramussoft.common.Attribute)

Example 5 with QualifierSource

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

the class ChartSourceSelectPanel method save.

public void save() {
    if (qualifierSelectPanel != null)
        saveSelectedElements();
    chartSource.setProperty(SOURCE_TYPE, (sourceType.getSelectedItem().equals(sourceTypeElements)) ? SOURCE_TYPE_ELEMENTS : SOURCE_TYPE_TABLE);
    if (sourceType.getSelectedItem().equals(sourceTypeTable)) {
        if (chartSource.getQualifierSources().size() > 0) {
            QualifierSource source = chartSource.getQualifierSources().get(0);
            if (source.getElementSources().size() > 0) {
                ElementSource source2 = source.getElementSources().get(0);
                source.getFilterSources().clear();
                FilterSource filterSource = chartSource.createFilterSource();
                Attribute selectedItem = (Attribute) tableAttribute.getSelectedItem();
                if (selectedItem != null) {
                    filterSource.setAttribute(StandardAttributesPlugin.getTableElementIdAttribute(framework.getEngine()));
                    filterSource.setValue(Long.toString(source2.getElement().getId()));
                    source.getFilterSources().add(filterSource);
                    source.setQualifier(StandardAttributesPlugin.getTableQualifierForAttribute(framework.getEngine(), selectedItem));
                    source.setElementsLoadType(QualifierSource.ELEMENTS_LOAD_TYPE_ALL);
                }
            }
        }
    } else {
        for (QualifierSource source : chartSource.getQualifierSources()) source.setElementsLoadType(QualifierSource.ELEMENTS_LOAD_TYPE_SELECTED);
    }
}
Also used : QualifierSource(com.ramussoft.chart.QualifierSource) FilterSource(com.ramussoft.chart.FilterSource) Attribute(com.ramussoft.common.Attribute) ElementSource(com.ramussoft.chart.ElementSource)

Aggregations

QualifierSource (com.ramussoft.chart.QualifierSource)6 ElementSource (com.ramussoft.chart.ElementSource)3 FilterSource (com.ramussoft.chart.FilterSource)3 Attribute (com.ramussoft.common.Attribute)2 Element (com.ramussoft.common.Element)2 Qualifier (com.ramussoft.common.Qualifier)2 ChartDataFramework (com.ramussoft.chart.ChartDataFramework)1 ChartDataPlugin (com.ramussoft.chart.ChartDataPlugin)1 ChartSource (com.ramussoft.chart.ChartSource)1 TableChartPersistent (com.ramussoft.chart.core.TableChartPersistent)1 Engine (com.ramussoft.common.Engine)1 AbstractAttributeEditor (com.ramussoft.gui.common.AbstractAttributeEditor)1 ActionEvent (com.ramussoft.gui.common.event.ActionEvent)1 ArrayList (java.util.ArrayList)1 ChartPanel (org.jfree.chart.ChartPanel)1 JFreeChart (org.jfree.chart.JFreeChart)1