Search in sources :

Example 11 with Row

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

the class SelectRowPanel method selectRows.

public void selectRows(List<Row> rows) {
    selectedRows.clear();
    if (selectableTableView != null)
        selectableTableView.clearSelection();
    List<Long> ss = new ArrayList<Long>();
    for (Row row : rows) {
        Qualifier qualifier = row.getRowSet().getQualifier();
        List<Row> sels = getSelectedRows(qualifier);
        sels.add(row);
        if (this.qualifier != null && this.selectableTableView != null && this.qualifier.equals(qualifier))
            ss.add(row.getElementId());
    }
    if (selectableTableView != null)
        selectableTableView.selectRows(ss);
    repaint();
}
Also used : ArrayList(java.util.ArrayList) Qualifier(com.ramussoft.common.Qualifier) Row(com.ramussoft.database.common.Row)

Example 12 with Row

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

the class ReportQueryImpl method getHTMLReports.

@Override
public List<Element> getHTMLReports() {
    RowSet rowSet = new RowSet(engine, ReportPlugin.getReportsQualifier(engine), new Attribute[] {}, null, true);
    List<Row> rows = rowSet.getAllRows();
    List<Element> elements = new ArrayList<Element>(rows.size());
    for (Row row : rows) elements.add(row.getElement());
    return elements;
}
Also used : Element(com.ramussoft.common.Element) RowSet(com.ramussoft.database.common.RowSet) ArrayList(java.util.ArrayList) Row(com.ramussoft.database.common.Row)

Example 13 with Row

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

the class SelectRowDialog method createRightComponent.

private void createRightComponent() {
    if (qualifierView == null)
        return;
    qualifier = qualifierView.getSelectedQualifier();
    boolean b = qualifier != null;
    addQualifier = b;
    if (b) {
        framework.setOpenDynamikViewEvent(new ActionEvent(QualifierPlugin.OPEN_QUALIFIER, qualifier));
        selectableTableView = new SelectableTableView(framework, dataPlugin.getEngine(), accessRules, qualifier) {
        };
        int dl = splitPane.getDividerLocation();
        splitPane.setRightComponent(createComponent());
        for (Row row : getSelectedRows(qualifier)) selectableTableView.getComponent().getModel().setSelectedRow(row, true);
        splitPane.revalidate();
        splitPane.repaint();
        splitPane.setDividerLocation(dl);
        selectableTableView.getComponent().getModel().addSelectionListener(selectionListener);
        if (!getSelectType().equals(SelectType.CHECK))
            selectableTableView.setSelectType(getSelectType());
    }
}
Also used : ActionEvent(com.ramussoft.gui.common.event.ActionEvent) Row(com.ramussoft.database.common.Row) SelectableTableView(com.ramussoft.gui.qualifier.table.SelectableTableView)

Example 14 with Row

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

the class SelectRowDialog method showModal.

public List<com.ramussoft.pb.Row> showModal() {
    final Qualifier q1 = qualifier;
    selectedRows.clear();
    createComponents();
    if (q1 != null) {
        Options.saveOptions(this);
        SwingUtilities.invokeLater(new Runnable() {

            @Override
            public void run() {
                qualifierView.setSelectedQualifier(q1);
                Options.loadOptions(SelectRowDialog.this);
                addQualifier = false;
            }
        });
    }
    ok = false;
    setVisible(true);
    deleteComponents();
    List<com.ramussoft.pb.Row> result = new ArrayList<com.ramussoft.pb.Row>();
    if (ok) {
        for (List<Row> list : selectedRows.values()) {
            for (Row row : list) {
                com.ramussoft.pb.Row r = dataPlugin.findRowByGlobalId(row.getElementId());
                if (r != null)
                    result.add(r);
            }
        }
        if ((addQualifier) && (qualifier != null)) {
            Engine engine = dataPlugin.getEngine();
            Qualifier q = StandardAttributesPlugin.getQualifiersQualifier(engine);
            List<Element> list = engine.getElements(q.getId());
            for (Element element : list) {
                if (qualifier.equals(StandardAttributesPlugin.getQualifier(engine, element))) {
                    com.ramussoft.pb.Row r = dataPlugin.findRowByGlobalId(element.getId());
                    if (r != null) {
                        result.add(r);
                    } else {
                        System.err.println("WARNING: Can not find element for qualifier (" + qualifier.getName() + ")");
                    }
                }
            }
        }
    }
    Options.saveOptions(this);
    return result;
}
Also used : Element(com.ramussoft.common.Element) ArrayList(java.util.ArrayList) Qualifier(com.ramussoft.common.Qualifier) Row(com.ramussoft.database.common.Row) Engine(com.ramussoft.common.Engine)

Example 15 with Row

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

the class RSFViewer2 method createQualifiersList.

private Component createQualifiersList() {
    // Load tree with elements meta data standard system qualifier.
    RowSet rowSet = new RowSet(engine, StandardAttributesPlugin.getQualifiersQualifier(engine), new Attribute[] {});
    final JTree qualifiersTree = new JTree(new DefaultTreeModel(rowSet.getRoot()));
    qualifiersTree.setRootVisible(false);
    qualifiersTree.getSelectionModel().addTreeSelectionListener(new TreeSelectionListener() {

        RowSet rowSet = null;

        @Override
        public void valueChanged(TreeSelectionEvent e) {
            // Load elements of qualifier.
            // We will load elements with RowSet class,
            // you can also load elements with engne.getElements
            // methods.
            Object value = qualifiersTree.getSelectionPath().getLastPathComponent();
            // Value is really a Row element.
            if (value != null) {
                if (rowSet != null) {
                    // If rowSet is opened, we
                    // should close it and free
                    // all listeners.
                    rowSet.close();
                    // Just in case :)
                    rowSet = null;
                }
                Row qualifierRow = (Row) value;
                // Even you are not going to use any attribute,
                // use RowSet(Engine, Qualifier Attribute[])
                // constructor
                // instead of RowSet(Engine, Qualifier) constructor.
                rowSet = new RowSet(engine, StandardAttributesPlugin.getQualifier(engine, qualifierRow.getElement()), new Attribute[] {});
                // And just load tree component with elements
                // covered to Row objects.
                tree.setModel(new DefaultTreeModel(rowSet.getRoot()));
            }
        }
    });
    JScrollPane pane = new JScrollPane();
    pane.setViewportView(qualifiersTree);
    return pane;
}
Also used : JScrollPane(javax.swing.JScrollPane) JTree(javax.swing.JTree) RowSet(com.ramussoft.database.common.RowSet) TreeSelectionListener(javax.swing.event.TreeSelectionListener) DefaultTreeModel(javax.swing.tree.DefaultTreeModel) TreeSelectionEvent(javax.swing.event.TreeSelectionEvent) 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