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;
}
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;
}
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);
}
}
}
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);
}
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;
}
Aggregations