Search in sources :

Example 1 with Attribute

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

the class ElementEventTableModel method getValueAt.

@Override
public Object getValueAt(int rowIndex, int columnIndex) {
    Event event = getEvent(rowIndex);
    switch(columnIndex) {
        case 0:
            return getType(event);
        case 1:
            Long id = (Long) event.getAttribute("attribute_id");
            if (id == null)
                return null;
            Engine engine = getEngine();
            Attribute attribute = engine.getAttribute(id);
            if (attribute == null)
                return null;
            return attribute.getName();
        case 2:
            return event.getOldValue();
        case 3:
            return event.getNewValue();
        case 4:
            return event.eventTime;
        case 5:
            return getUser(event);
        default:
            break;
    }
    return null;
}
Also used : Attribute(com.ramussoft.common.Attribute) Event(com.ramussoft.common.logger.Event) Engine(com.ramussoft.common.Engine)

Example 2 with Attribute

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

the class CachedEngine method loadQualifier.

private CachedQualifier loadQualifier(Long id) {
    CachedQualifier q = new CachedQualifier();
    q.qualifier = deligate.getQualifier(id);
    if (q.qualifier == null)
        return null;
    List<Attribute> attributes = q.buildAttributes();
    q.setAllAttributes(attributes.toArray(new Attribute[attributes.size()]));
    Hashtable<Element, Object[]> hashtable = deligate.getElements(q.qualifier, attributes);
    List<CachedElement> elements = q.elements;
    for (Entry<Element, Object[]> entry : hashtable.entrySet()) {
        Element key = entry.getKey();
        CachedElement e = new CachedElement(key, entry.getValue(), q);
        elements.add(e);
        this.elements.put(key.getId(), e);
    }
    return q;
}
Also used : Attribute(com.ramussoft.common.Attribute) Element(com.ramussoft.common.Element)

Example 3 with Attribute

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

the class CachedEngine method clearCache.

@Override
public void clearCache() {
    synchronized (loadLock) {
        if (cachedData != null) {
        // cachedData.removeCacheHolder(deligate.getActiveBranch());
        } else {
            elements.clear();
            qualifiers.clear();
            attributeData.clear();
            attributes.clear();
            systemAttributes.clear();
            systemQualifiers.clear();
            for (Attribute attribute : deligate.getAttributes()) attributes.put(attribute.getId(), attribute);
        }
    }
}
Also used : Attribute(com.ramussoft.common.Attribute)

Example 4 with Attribute

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

the class CachedEngine method getCacheFromHolder.

protected void getCacheFromHolder(CachedData.CacheHolder holder) {
    elements = holder.elements;
    qualifiers = holder.qualifiers;
    attributeData = holder.attributeData;
    systemQualifiers = holder.systemQualifiers;
    systemAttributes = holder.systemAttributes;
    attributes = holder.attributes;
    attributes.clear();
    for (Attribute attribute : deligate.getAttributes()) attributes.put(attribute.getId(), attribute);
}
Also used : Attribute(com.ramussoft.common.Attribute)

Example 5 with Attribute

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

the class ElistTableTabView method createComponent.

@Override
public JComponent createComponent() {
    pane = new JScrollPane();
    left = new ElistTablePanel(framework, q1);
    top = new ElistTablePanel(framework, q2);
    this.model = createModel();
    this.table = new ElistTable() {

        /**
         */
        private static final long serialVersionUID = 5056893447852539087L;

        @Override
        protected Engine getEngine() {
            return framework.getEngine();
        }

        @Override
        protected Attribute getAttribute() {
            return attribute;
        }
    };
    this.table.setModel(model);
    table.setAutoResizeMode(JTable.AUTO_RESIZE_OFF);
    tableHeader = new TopTablePanel(top, table);
    table.setTableHeader(tableHeader);
    table.setRowHeight(CELL_BORDER);
    table.setColumnSelectionAllowed(true);
    TableColumnModel columnModel = table.getColumnModel();
    for (int i = 0; i < columnModel.getColumnCount(); i++) {
        TableColumn column = columnModel.getColumn(i);
        column.setMaxWidth(CELL_BORDER);
        column.setMinWidth(CELL_BORDER);
    }
    table.getColumnModel().addColumnModelListener(new TableColumnModelListener() {

        @Override
        public void columnAdded(TableColumnModelEvent e) {
        }

        @Override
        public void columnMarginChanged(ChangeEvent e) {
        }

        @Override
        public void columnMoved(TableColumnModelEvent e) {
        }

        @Override
        public void columnRemoved(TableColumnModelEvent e) {
        }

        @Override
        public void columnSelectionChanged(ListSelectionEvent e) {
            int column = table.getSelectedColumn();
            if (column >= 0) {
                top.setSelectionRow(column);
                tableHeader.repaint();
            }
        }
    });
    table.getSelectionModel().addListSelectionListener(new ListSelectionListener() {

        @Override
        public void valueChanged(ListSelectionEvent e) {
            int row = table.getSelectedRow();
            if (row >= 0) {
                left.setSelectionRow(row);
            }
        }
    });
    pane.setViewportView(table);
    pane.setRowHeaderView(left);
    updateHeadders();
    pane.addComponentListener(new ComponentAdapter() {

        @Override
        public void componentResized(ComponentEvent e) {
            updateHeadders();
        }
    });
    return pane;
}
Also used : JScrollPane(javax.swing.JScrollPane) TableColumnModelEvent(javax.swing.event.TableColumnModelEvent) TableColumnModelListener(javax.swing.event.TableColumnModelListener) Attribute(com.ramussoft.common.Attribute) ListSelectionEvent(javax.swing.event.ListSelectionEvent) TableColumnModel(javax.swing.table.TableColumnModel) TableColumn(javax.swing.table.TableColumn) ListSelectionListener(javax.swing.event.ListSelectionListener) ChangeEvent(javax.swing.event.ChangeEvent) ComponentEvent(java.awt.event.ComponentEvent) Engine(com.ramussoft.common.Engine) ComponentAdapter(java.awt.event.ComponentAdapter)

Aggregations

Attribute (com.ramussoft.common.Attribute)203 Qualifier (com.ramussoft.common.Qualifier)72 Element (com.ramussoft.common.Element)70 ArrayList (java.util.ArrayList)53 Engine (com.ramussoft.common.Engine)32 List (java.util.List)20 Row (com.ramussoft.database.common.Row)19 Hashtable (java.util.Hashtable)19 SQLException (java.sql.SQLException)16 AttributeType (com.ramussoft.common.AttributeType)15 FindObject (com.ramussoft.common.attribute.FindObject)11 AttributeEvent (com.ramussoft.common.event.AttributeEvent)11 ResultSet (java.sql.ResultSet)11 AttributePlugin (com.ramussoft.gui.common.AttributePlugin)10 AccessRules (com.ramussoft.common.AccessRules)9 Transaction (com.ramussoft.common.persistent.Transaction)9 HierarchicalPersistent (com.ramussoft.core.attribute.simple.HierarchicalPersistent)9 RowMapper (com.ramussoft.jdbc.RowMapper)9 Row (com.ramussoft.pb.Row)9 ImageIcon (javax.swing.ImageIcon)9