Search in sources :

Example 16 with Row

use of com.ramussoft.database.common.Row in project ramus by Vitaliy-Yakovchuk.

the class ChartsView method openDiagram.

private void openDiagram() {
    TreeTableNode selectedNode = table.getSelectedNode();
    if (selectedNode == null)
        return;
    Row row = selectedNode.getRow();
    if (row != null) {
        framework.propertyChanged(ChartGUIPlugin.OPEN_CHART, row.getElement());
    }
}
Also used : TreeTableNode(com.ramussoft.gui.qualifier.table.TreeTableNode) Row(com.ramussoft.database.common.Row)

Example 17 with Row

use of com.ramussoft.database.common.Row in project ramus by Vitaliy-Yakovchuk.

the class TableChartAttributePlugin method getAttributePreferenciesEditor.

@Override
public AttributePreferenciesEditor getAttributePreferenciesEditor() {
    return new AttributePreferenciesEditor() {

        private RowTreeTableComponent component;

        @Override
        public JComponent createComponent(Attribute attribute, Engine engine, AccessRules accessRules) {
            component = new RowTreeTableComponent(engine, ChartPlugin.getCharts(engine), accessRules, new RowRootCreater(), new Attribute[] { StandardAttributesPlugin.getAttributeNameAttribute(engine) }, framework);
            component.setSelectType(SelectType.RADIO);
            return component;
        }

        @Override
        public boolean canApply() {
            return component.getModel().getSelectedRows().size() > 0;
        }

        @Override
        public void apply(Attribute attribute, Engine engine, AccessRules accessRules) {
            Row row = component.getModel().getSelectedRows().get(0);
            TableChartPersistent tcp = new TableChartPersistent();
            tcp.setOtherElementId(row.getElementId());
            engine.setAttribute(null, attribute, tcp);
        }
    };
}
Also used : Attribute(com.ramussoft.common.Attribute) RowTreeTableComponent(com.ramussoft.gui.qualifier.table.RowTreeTableComponent) AccessRules(com.ramussoft.common.AccessRules) RowRootCreater(com.ramussoft.gui.qualifier.table.RowRootCreater) TableChartPersistent(com.ramussoft.chart.core.TableChartPersistent) Row(com.ramussoft.database.common.Row) AttributePreferenciesEditor(com.ramussoft.gui.common.AttributePreferenciesEditor) Engine(com.ramussoft.common.Engine)

Example 18 with Row

use of com.ramussoft.database.common.Row in project ramus by Vitaliy-Yakovchuk.

the class ChartSetsView method openChartSet.

protected void openChartSet() {
    TreeTableNode selectedNode = table.getSelectedNode();
    if (selectedNode == null)
        return;
    Row row = selectedNode.getRow();
    if (row != null) {
        framework.propertyChanged(ChartGUIPlugin.OPEN_CHART_SET, row.getElement());
    }
}
Also used : TreeTableNode(com.ramussoft.gui.qualifier.table.TreeTableNode) Row(com.ramussoft.database.common.Row)

Example 19 with Row

use of com.ramussoft.database.common.Row 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;
}
Also used : Element(com.ramussoft.common.Element) RowSet(com.ramussoft.database.common.RowSet) Qualifier(com.ramussoft.common.Qualifier) Row(com.ramussoft.database.common.Row)

Example 20 with Row

use of com.ramussoft.database.common.Row in project ramus by Vitaliy-Yakovchuk.

the class QualifierImporterImpl method findParent.

private Row findParent(RowSet rs, Row row) {
    if (row.getParent() == null)
        return rs.getRoot();
    Row parent = row.getParent();
    Row parent2 = findParent(rs, parent);
    if (parent2 != null) {
        for (Row row2 : parent2.getChildren()) if (row2.getName().equals(row.getName()))
            return row2;
    }
    return null;
}
Also used : Row(com.ramussoft.database.common.Row)

Aggregations

Row (com.ramussoft.database.common.Row)81 TreeTableNode (com.ramussoft.gui.qualifier.table.TreeTableNode)20 Attribute (com.ramussoft.common.Attribute)19 ArrayList (java.util.ArrayList)18 Qualifier (com.ramussoft.common.Qualifier)17 TreePath (javax.swing.tree.TreePath)15 Engine (com.ramussoft.common.Engine)13 Element (com.ramussoft.common.Element)12 RootRow (com.ramussoft.database.common.RowSet.RootRow)12 RowSet (com.ramussoft.database.common.RowSet)9 ActionEvent (java.awt.event.ActionEvent)8 AbstractAction (javax.swing.AbstractAction)8 RowTreeTable (com.ramussoft.gui.qualifier.table.RowTreeTable)6 MouseAdapter (java.awt.event.MouseAdapter)6 MouseEvent (java.awt.event.MouseEvent)6 JComponent (javax.swing.JComponent)6 JScrollPane (javax.swing.JScrollPane)6 AccessRules (com.ramussoft.common.AccessRules)5 Journaled (com.ramussoft.common.journal.Journaled)5 RowTreeTableComponent (com.ramussoft.gui.qualifier.table.RowTreeTableComponent)5