Search in sources :

Example 11 with TreeTableNode

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

the class ModelPropertiesDialog method setupAttribute.

public void setupAttribute() {
    TreeTableNode node = component.getTable().getSelectedNode();
    if (node == null)
        return;
    Row row = node.getRow();
    if (row == null)
        return;
    AttributePreferenciesDialog d = new AttributePreferenciesDialog(framework, this);
    Attribute attribute = engine.getAttribute((Long) row.getAttribute(attributeId));
    d.setAttribute(attribute);
    d.getOKButton().setEnabled(rules.canUpdateAttribute(attribute.getId()));
    d.setVisible(true);
}
Also used : TreeTableNode(com.ramussoft.gui.qualifier.table.TreeTableNode) Attribute(com.ramussoft.common.Attribute) AttributePreferenciesDialog(com.ramussoft.gui.attribute.AttributePreferenciesDialog) Row(com.ramussoft.database.common.Row)

Example 12 with TreeTableNode

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

the class ModelsNode method createR2Children.

public static Vector<TreeTableNode> createR2Children(Row root) {
    Vector<TreeTableNode> res = new Vector<TreeTableNode>();
    for (Row row : root.getChildren()) {
        RowNode node = new FunctionNode(createR2Children(row), row);
        node.setParent();
        res.add(node);
    }
    return res;
}
Also used : TreeTableNode(com.ramussoft.gui.qualifier.table.TreeTableNode) RowNode(com.ramussoft.gui.qualifier.table.RowNode) Row(com.ramussoft.database.common.Row) Vector(java.util.Vector)

Example 13 with TreeTableNode

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

the class ModelsPanel method openDiagram.

public void openDiagram() {
    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);
                        }
                    }
                }
            }
        }
    }
    if (models.size() > 0) {
        if (engine.getPluginProperty("IDEF0", "DataPlugin") == null) {
            framework.showAnimation(GlobalResourcesManager.getString("Wait.DataLoading"));
            Thread thread = new Thread() {

                @Override
                public void run() {
                    NDataPluginFactory.getDataPlugin(null, engine, framework.getAccessRules());
                    SwingUtilities.invokeLater(new Runnable() {

                        @Override
                        public void run() {
                            openDiagrams(models);
                            framework.hideAnimation();
                        }
                    });
                }
            };
            thread.start();
        } else
            openDiagrams(models);
    }
}
Also used : TreeTableNode(com.ramussoft.gui.qualifier.table.TreeTableNode) ArrayList(java.util.ArrayList) TreePath(javax.swing.tree.TreePath) 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)

Example 14 with TreeTableNode

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

the class AttributePullView method setupAttribute.

private void setupAttribute() {
    AttributePreferenciesDialog dialog = new AttributePreferenciesDialogWithQualifierSet(framework);
    TreeTableNode node = table.getSelectedNode();
    if (node == null)
        return;
    Row row = node.getRow();
    Attribute attribute = engine.getAttribute((Long) row.getAttribute(attributeId));
    dialog.setAttribute(attribute);
    dialog.getOKButton().setEnabled(rules.canUpdateAttribute(attribute.getId()));
    dialog.setVisible(true);
}
Also used : TreeTableNode(com.ramussoft.gui.qualifier.table.TreeTableNode) Attribute(com.ramussoft.common.Attribute) Row(com.ramussoft.database.common.Row)

Example 15 with TreeTableNode

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

the class AttributePullView method refreshActions.

private void refreshActions() {
    createAttributeAction.setEnabled(rules.canCreateAttribute());
    if (table.getTreeSelectionModel().getSelectionPath() == null) {
        deleteAttributeAction.setEnabled(false);
        attributePreferencesAction.setEnabled(false);
    } else {
        boolean e = true;
        boolean e1 = true;
        TreePath[] paths = table.getTreeSelectionModel().getSelectionPaths();
        for (TreePath path : paths) {
            Row row = ((TreeTableNode) path.getLastPathComponent()).getRow();
            if (row == null) {
                e = false;
                e1 = 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;
            }
            if (!rules.canUpdateAttribute(attrId)) {
                e1 = false;
                break;
            }
        }
        deleteAttributeAction.setEnabled(e);
        attributePreferencesAction.setEnabled(e1);
    }
}
Also used : TreePath(javax.swing.tree.TreePath) TreeTableNode(com.ramussoft.gui.qualifier.table.TreeTableNode) Row(com.ramussoft.database.common.Row)

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