Search in sources :

Example 1 with TreeTableNode

use of com.ramussoft.gui.qualifier.table.TreeTableNode in project ramus by Vitaliy-Yakovchuk.

the class QualifierPreferencesPanel method refreshActions.

protected void refreshActions() {
    RowTreeTable table = attributeEditor.getRowTreeTableComponent().getTable();
    createAttributeAction.setEnabled(rules.canCreateAttribute());
    if (table.getTreeSelectionModel().getSelectionPath() == null) {
        deleteAttributeAction.setEnabled(false);
    } else {
        boolean e = true;
        TreePath[] paths = table.getTreeSelectionModel().getSelectionPaths();
        for (TreePath path : paths) {
            Row row = ((TreeTableNode) path.getLastPathComponent()).getRow();
            if (row == null) {
                e = false;
                break;
            }
            if (row.getChildCount() > 0) {
                e = false;
                break;
            }
            Long long1 = (Long) row.getAttribute(attributeId);
            if (long1 == null)
                break;
            long attrId = long1;
            if (!rules.canDeleteAttribute(attrId)) {
                e = false;
                break;
            }
        }
        deleteAttributeAction.setEnabled(e);
    }
}
Also used : TreePath(javax.swing.tree.TreePath) TreeTableNode(com.ramussoft.gui.qualifier.table.TreeTableNode) Row(com.ramussoft.database.common.Row) RowTreeTable(com.ramussoft.gui.qualifier.table.RowTreeTable)

Example 2 with TreeTableNode

use of com.ramussoft.gui.qualifier.table.TreeTableNode in project ramus by Vitaliy-Yakovchuk.

the class QualifierView method openQualifier.

protected void openQualifier() {
    for (int i : table.getSelectedRows()) {
        if (i >= 0) {
            TreePath path = table.getPathForRow(i);
            if (path != null) {
                TreeTableNode node = (TreeTableNode) path.getLastPathComponent();
                if (node != null) {
                    Row row = node.getRow();
                    if (row != null) {
                        if (row.getChildCount() == 0) {
                            table.setEditable(false);
                            openQualifier(row);
                            table.setEditable(true);
                        }
                    }
                }
            }
        }
    }
}
Also used : TreePath(javax.swing.tree.TreePath) TreeTableNode(com.ramussoft.gui.qualifier.table.TreeTableNode) Row(com.ramussoft.database.common.Row) RootRow(com.ramussoft.database.common.RowSet.RootRow)

Example 3 with TreeTableNode

use of com.ramussoft.gui.qualifier.table.TreeTableNode 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 4 with TreeTableNode

use of com.ramussoft.gui.qualifier.table.TreeTableNode 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 5 with TreeTableNode

use of com.ramussoft.gui.qualifier.table.TreeTableNode in project ramus by Vitaliy-Yakovchuk.

the class ModelsPanel method canOpen.

public boolean canOpen() {
    RowTreeTable table = tree.getTable();
    final List<OpenDiagram> models = new ArrayList<OpenDiagram>();
    Qualifier modelTree = IDEF0Plugin.getModelTree(engine);
    for (int i : table.getSelectedRows()) {
        if (i >= 0) {
            TreePath path = table.getPathForRow(i);
            if (path != null) {
                TreeTableNode node = (TreeTableNode) path.getLastPathComponent();
                if (node != null) {
                    Row row = node.getRow();
                    if (row != null) {
                        if (row.getElement().getQualifierId() == modelTree.getId()) {
                            Long id = (Long) row.getAttribute(StandardAttributesPlugin.getAttributeQualifierId(engine));
                            if (id != null) {
                                Qualifier model = engine.getQualifier(id);
                                if (model != null) {
                                    OpenDiagram openDiagram = new OpenDiagram(model, -1l);
                                    models.add(openDiagram);
                                }
                            }
                        } else {
                            if (row.getChildCount() <= 0)
                                row = row.getParent();
                            OpenDiagram openDiagram = new OpenDiagram(row.getRowSet().getQualifier(), row.getElementId());
                            models.add(openDiagram);
                        }
                    }
                }
            }
        }
    }
    return models.size() > 0;
}
Also used : TreePath(javax.swing.tree.TreePath) TreeTableNode(com.ramussoft.gui.qualifier.table.TreeTableNode) ArrayList(java.util.ArrayList) Qualifier(com.ramussoft.common.Qualifier) Row(com.ramussoft.database.common.Row) RootRow(com.ramussoft.database.common.RowSet.RootRow) RowTreeTable(com.ramussoft.gui.qualifier.table.RowTreeTable)

Aggregations

TreeTableNode (com.ramussoft.gui.qualifier.table.TreeTableNode)22 Row (com.ramussoft.database.common.Row)20 TreePath (javax.swing.tree.TreePath)10 Engine (com.ramussoft.common.Engine)7 Attribute (com.ramussoft.common.Attribute)6 ArrayList (java.util.ArrayList)6 RootRow (com.ramussoft.database.common.RowSet.RootRow)5 RowTreeTable (com.ramussoft.gui.qualifier.table.RowTreeTable)5 AccessRules (com.ramussoft.common.AccessRules)4 Qualifier (com.ramussoft.common.Qualifier)3 Journaled (com.ramussoft.common.journal.Journaled)3 RowRootCreater (com.ramussoft.gui.qualifier.table.RowRootCreater)3 RowTreeTableComponent (com.ramussoft.gui.qualifier.table.RowTreeTableComponent)3 SelectionEvent (com.ramussoft.gui.qualifier.table.event.SelectionEvent)3 ActionEvent (java.awt.event.ActionEvent)3 MouseAdapter (java.awt.event.MouseAdapter)3 MouseEvent (java.awt.event.MouseEvent)3 AbstractAction (javax.swing.AbstractAction)3 RowNode (com.ramussoft.gui.qualifier.table.RowNode)2 RowTreeTableModel (com.ramussoft.gui.qualifier.table.RowTreeTableModel)2