Search in sources :

Example 41 with Row

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

the class ChartsView method createChartElement.

public Element createChartElement(String name) {
    Row row = component.getRowSet().createRow(null);
    row.setName(name);
    return row.getElement();
}
Also used : Row(com.ramussoft.database.common.Row)

Example 42 with Row

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

the class ChartsView method deleteDiagram.

public void deleteDiagram() {
    List<Row> rows = new ArrayList<Row>();
    int[] sels = table.getSelectedRows();
    for (int i : sels) {
        TreePath path = table.getPathForRow(i);
        if (path != null) {
            TreeTableNode node = (TreeTableNode) path.getLastPathComponent();
            if (node != null) {
                Row row = node.getRow();
                if (row != null)
                    rows.add(row);
            }
        }
    }
    if (rows.size() > 0) {
        if (JOptionPane.showConfirmDialog(component, GlobalResourcesManager.getString("DeleteActiveElementsDialog.Warning"), GlobalResourcesManager.getString("ConfirmMessage.Title"), JOptionPane.YES_NO_OPTION) != JOptionPane.YES_OPTION)
            return;
        Engine engine = framework.getEngine();
        ((Journaled) engine).startUserTransaction();
        for (Row row : rows) ChartPlugin.deleteChart(engine, row.getElement());
        ((Journaled) engine).commitUserTransaction();
    }
}
Also used : Journaled(com.ramussoft.common.journal.Journaled) TreePath(javax.swing.tree.TreePath) TreeTableNode(com.ramussoft.gui.qualifier.table.TreeTableNode) ArrayList(java.util.ArrayList) Row(com.ramussoft.database.common.Row) Engine(com.ramussoft.common.Engine)

Example 43 with Row

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

the class QualifierSourceSelectPanel method save.

public void save() {
    List<ElementSource> elementSources = qualifierSource.getElementSources();
    elementSources.clear();
    for (Row row : view.getSelectedRows()) {
        ElementSource e = qualifierSource.getChartSource().createElementSource();
        e.setElement(row.getElement());
        elementSources.add(e);
    }
    qualifierSource.getChartSource().fireAttributeListChanged();
}
Also used : Row(com.ramussoft.database.common.Row) ElementSource(com.ramussoft.chart.ElementSource)

Example 44 with Row

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

the class ModelPropertiesDialog method refreshActions.

protected void refreshActions() {
    RowTreeTable table = component.getTable();
    createAttributeAction.setEnabled(rules.canCreateAttribute());
    if (table.getTreeSelectionModel().getSelectionPath() == null) {
        deleteAttributeAction.setEnabled(false);
        attributePreferencesAction.setEnabled(false);
    } else {
        attributePreferencesAction.setEnabled(true);
        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 45 with Row

use of com.ramussoft.database.common.Row 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)

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