Search in sources :

Example 66 with Row

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

the class RowTreeTableModel method clearSelection.

public void clearSelection() {
    Set<Row> rows = selectedRows.keySet();
    SelectionEvent event = new SelectionEvent(rows.toArray(new Row[rows.size()]), false);
    selectedRows.clear();
    for (SelectionListener l : getSelectionListeners()) l.changeSelection(event);
}
Also used : SelectionEvent(com.ramussoft.gui.qualifier.table.event.SelectionEvent) Row(com.ramussoft.database.common.Row) SelectionListener(com.ramussoft.gui.qualifier.table.event.SelectionListener)

Example 67 with Row

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

the class QualifiersQualifierAttributesDialog method onOk.

@Override
protected void onOk() {
    Qualifier qualifier = StandardAttributesPlugin.getQualifiersQualifier(engine);
    qualifier.getAttributes().clear();
    for (Row row : view.getSelectedRows()) {
        qualifier.getAttributes().add(engine.getAttribute(StandardAttributesPlugin.getAttributeId(engine, row.getElement())));
    }
    ((Journaled) engine).startUserTransaction();
    engine.updateQualifier(qualifier);
    ((Journaled) engine).commitUserTransaction();
    super.onOk();
}
Also used : Journaled(com.ramussoft.common.journal.Journaled) Qualifier(com.ramussoft.common.Qualifier) Row(com.ramussoft.database.common.Row)

Example 68 with Row

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

the class AbstractTableView method createRow.

public Row createRow() {
    Row root = rowSet.getRoot();
    TreePath path = table.getTreeSelectionModel().getSelectionPath();
    if (path != null) {
        TreeTableNode node = (TreeTableNode) path.getLastPathComponent();
        if (node.getRow() != null) {
            if (node.getRow().getParent() != null)
                root = node.getRow().getParent();
        }
    }
    return rowSet.createRow(root);
}
Also used : TreePath(javax.swing.tree.TreePath) Row(com.ramussoft.database.common.Row)

Example 69 with Row

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

the class GroupRootCreater method createChildren.

private Vector<TreeTableNode> createChildren(int i, GroupNode parent) {
    List<Row> rows = parent.getRows();
    Vector<TreeTableNode> res = new Vector<TreeTableNode>();
    if (i >= attrs.length) {
        for (Row row : rows) {
            if (hierarchy.isShowBaseHierarchy()) {
                RowNode rowNode = new RowNode(createRowChildren(row), row);
                rowNode.setParent();
                res.add(rowNode);
            } else {
                RowNode rowNode = new RowNode(new Vector<TreeTableNode>(), row);
                rowNode.setParent();
                res.add(rowNode);
            }
        }
    } else {
        if (attrs[i].getAttributeType().toString().equals("Core.ElementList")) {
            Hashtable<Long, Element> hash = new Hashtable<Long, Element>();
            for (Row row : rows) {
                Engine engine = row.getEngine();
                long[] ids = ElementListPlugin.getElements(engine, attrs[i], row.getElement());
                if (ids.length == 0) {
                    Object value = null;
                    GroupNode groupNode = new GroupNode(this, attrs[i], value);
                    int index;
                    if ((index = res.indexOf(groupNode)) >= 0) {
                        ((GroupNode) res.get(index)).getRows().add(row);
                    } else {
                        groupNode.createRowsList();
                        groupNode.getRows().add(row);
                        res.add(groupNode);
                    }
                }
                for (long id : ids) {
                    Object value = getElement(hash, id, engine);
                    GroupNode groupNode = new GroupNode(this, attrs[i], value);
                    int index;
                    if ((index = res.indexOf(groupNode)) >= 0) {
                        ((GroupNode) res.get(index)).getRows().add(row);
                    } else {
                        groupNode.createRowsList();
                        groupNode.getRows().add(row);
                        res.add(groupNode);
                    }
                }
            }
        } else
            for (Row row : rows) {
                Object value = row.getAttribute(attrs[i]);
                GroupNode groupNode = new GroupNode(this, attrs[i], value);
                int index;
                if ((index = res.indexOf(groupNode)) >= 0) {
                    ((GroupNode) res.get(index)).getRows().add(row);
                } else {
                    groupNode.createRowsList();
                    groupNode.getRows().add(row);
                    res.add(groupNode);
                }
            }
        Object[] objects = res.toArray();
        Arrays.sort(objects);
        for (int j = 0; j < objects.length; j++) {
            res.set(j, (TreeTableNode) objects[j]);
        }
        for (TreeTableNode node : res) {
            GroupNode groupNode = (GroupNode) node;
            Vector<TreeTableNode> children = createChildren(i + 1, groupNode);
            groupNode.setChildren(children);
            groupNode.setParent();
        }
    }
    return res;
}
Also used : Hashtable(java.util.Hashtable) Element(com.ramussoft.common.Element) Row(com.ramussoft.database.common.Row) Vector(java.util.Vector) Engine(com.ramussoft.common.Engine)

Example 70 with Row

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

the class RowTreeTableModel method checkAll.

public void checkAll() {
    selectedRows.clear();
    for (Row row : getRowSet().getAllRows()) selectedRows.put(row, Boolean.TRUE);
    Set<Row> rows = selectedRows.keySet();
    SelectionEvent event = new SelectionEvent(rows.toArray(new Row[rows.size()]), true);
    for (SelectionListener l : getSelectionListeners()) {
        l.changeSelection(event);
    }
}
Also used : SelectionEvent(com.ramussoft.gui.qualifier.table.event.SelectionEvent) Row(com.ramussoft.database.common.Row) SelectionListener(com.ramussoft.gui.qualifier.table.event.SelectionListener)

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