Search in sources :

Example 71 with Row

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

the class TableView method tableSelectedValueChanged.

protected void tableSelectedValueChanged() {
    int column = table.getSelectedColumn();
    TreeTableNode node = table.getSelectedNode();
    if ((column < 0) && (node != null)) {
        column = table.getHierarchicalColumn();
    }
    if ((column >= 0) && (node != null)) {
        Row row = node.getRow();
        column = table.convertColumnIndexToModel(column);
        if (row != null) {
            long id = row.getElementId();
            Attribute attribute = component.getRowSet().getAttributes()[column];
            elementAttribute.setFindAction(component.getTable().isFindSelectionChanged());
            if ((elementAttribute.element == null) || (elementAttribute.element.getId() != id)) {
                framework.propertyChanged(ACTIVATE_ELEMENT, row.getElement());
                this.activeElement = row.getElement();
            }
            elementAttribute = new AttributeEditorView.ElementAttribute(row.getElement(), attribute);
            elementAttribute.setFindAction(component.getTable().isFindSelectionChanged());
            framework.propertyChanged(ACTIVATE_ATTRIBUTE, elementAttribute);
            activeAttribute = elementAttribute;
        } else {
            activeAttribute = null;
            elementAttribute = new AttributeEditorView.ElementAttribute();
            this.activeElement = null;
            if ((table.getSelectedRow() >= 0) && (table.getSelectedColumn() >= 0)) {
                framework.propertyChanged(ACTIVATE_ELEMENT, null);
                framework.propertyChanged(ACTIVATE_ATTRIBUTE, null);
            }
        }
    }
}
Also used : AttributeEditorView(com.ramussoft.gui.attribute.AttributeEditorView) Attribute(com.ramussoft.common.Attribute) Row(com.ramussoft.database.common.Row)

Example 72 with Row

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

the class QualifierView method setChildTable.

private void setChildTable(Row sRow, StringBuffer sb) {
    for (Row row : sRow.getChildren()) {
        sb.append("<tr>");
        sb.append("<td>");
        sb.append(row.getCode());
        sb.append("</td>");
        sb.append("<td>");
        sb.append(row.getName());
        sb.append("</td>");
        sb.append("</tr>");
        setChildTable(row, sb);
    }
}
Also used : Row(com.ramussoft.database.common.Row) RootRow(com.ramussoft.database.common.RowSet.RootRow)

Example 73 with Row

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

the class QualifierView method createInnerComponent.

@Override
protected void createInnerComponent() {
    super.createInnerComponent();
    ((AbstractTableModel) component.getTable().getModel()).fireTableStructureChanged();
    component.getTable().setLeafIcon(new ImageIcon(getClass().getResource("/com/ramussoft/gui/table/qualifier.png")));
    getComponent().getRowSet().addRowChildListener(new RowChildAdapter() {

        @Override
        public void added(Row parent, Row row, int index) {
            if (parent.getParent() == null)
                return;
            framework.propertyChanged("CloseQualifier", StandardAttributesPlugin.getQualifierId(engine, parent.getElementId()));
        }
    });
}
Also used : ImageIcon(javax.swing.ImageIcon) RowChildAdapter(com.ramussoft.database.common.RowChildAdapter) AbstractTableModel(javax.swing.table.AbstractTableModel) Row(com.ramussoft.database.common.Row) RootRow(com.ramussoft.database.common.RowSet.RootRow)

Example 74 with Row

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

the class QualifierView method convertToElements.

public void convertToElements(Row sRow) {
    Qualifier dest = StandardAttributesPlugin.getQualifier(engine, sRow.getElement());
    Attribute nameAttribute = null;
    for (Row row : toArray(sRow.getChildren())) {
        nameAttribute = addArrributes(dest.getAttributes(), row, nameAttribute);
    }
    if (nameAttribute == null) {
        for (Attribute attribute : dest.getAttributes()) if (attribute.getAttributeType().toString().equals("Core.Text"))
            nameAttribute = attribute;
    }
    if (nameAttribute != null)
        dest.setAttributeForName(nameAttribute.getId());
    engine.updateQualifier(dest);
    long prevId = -1l;
    for (Row row : sRow.getChildren().toArray(new Row[sRow.getChildren().size()])) {
        moveElements(row, -1l, prevId, dest);
        prevId = row.getElementId();
    }
}
Also used : Attribute(com.ramussoft.common.Attribute) Qualifier(com.ramussoft.common.Qualifier) Row(com.ramussoft.database.common.Row) RootRow(com.ramussoft.database.common.RowSet.RootRow)

Example 75 with Row

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

the class SelectableTableView method componentRefresh.

@Override
protected void componentRefresh() {
    List<Row> list = getSelectedRows();
    super.componentRefresh();
    for (Row row : list) {
        component.getModel().setSelectedRow(row, true);
    }
    setSelectType(selectType);
}
Also used : 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