use of com.ramussoft.database.common.Row in project ramus by Vitaliy-Yakovchuk.
the class RowTreeTableModel method clearSelection.
public void clearSelection() {
Set<Row> rows = selectedRows.keySet();
SelectionEvent event = new SelectionEvent(rows.toArray(new Row[rows.size()]), false);
selectedRows.clear();
for (SelectionListener l : getSelectionListeners()) l.changeSelection(event);
}
use of com.ramussoft.database.common.Row in project ramus by Vitaliy-Yakovchuk.
the class QualifiersQualifierAttributesDialog method onOk.
@Override
protected void onOk() {
Qualifier qualifier = StandardAttributesPlugin.getQualifiersQualifier(engine);
qualifier.getAttributes().clear();
for (Row row : view.getSelectedRows()) {
qualifier.getAttributes().add(engine.getAttribute(StandardAttributesPlugin.getAttributeId(engine, row.getElement())));
}
((Journaled) engine).startUserTransaction();
engine.updateQualifier(qualifier);
((Journaled) engine).commitUserTransaction();
super.onOk();
}
use of com.ramussoft.database.common.Row in project ramus by Vitaliy-Yakovchuk.
the class AbstractTableView method createRow.
public Row createRow() {
Row root = rowSet.getRoot();
TreePath path = table.getTreeSelectionModel().getSelectionPath();
if (path != null) {
TreeTableNode node = (TreeTableNode) path.getLastPathComponent();
if (node.getRow() != null) {
if (node.getRow().getParent() != null)
root = node.getRow().getParent();
}
}
return rowSet.createRow(root);
}
use of com.ramussoft.database.common.Row in project ramus by Vitaliy-Yakovchuk.
the class GroupRootCreater method createChildren.
private Vector<TreeTableNode> createChildren(int i, GroupNode parent) {
List<Row> rows = parent.getRows();
Vector<TreeTableNode> res = new Vector<TreeTableNode>();
if (i >= attrs.length) {
for (Row row : rows) {
if (hierarchy.isShowBaseHierarchy()) {
RowNode rowNode = new RowNode(createRowChildren(row), row);
rowNode.setParent();
res.add(rowNode);
} else {
RowNode rowNode = new RowNode(new Vector<TreeTableNode>(), row);
rowNode.setParent();
res.add(rowNode);
}
}
} else {
if (attrs[i].getAttributeType().toString().equals("Core.ElementList")) {
Hashtable<Long, Element> hash = new Hashtable<Long, Element>();
for (Row row : rows) {
Engine engine = row.getEngine();
long[] ids = ElementListPlugin.getElements(engine, attrs[i], row.getElement());
if (ids.length == 0) {
Object value = null;
GroupNode groupNode = new GroupNode(this, attrs[i], value);
int index;
if ((index = res.indexOf(groupNode)) >= 0) {
((GroupNode) res.get(index)).getRows().add(row);
} else {
groupNode.createRowsList();
groupNode.getRows().add(row);
res.add(groupNode);
}
}
for (long id : ids) {
Object value = getElement(hash, id, engine);
GroupNode groupNode = new GroupNode(this, attrs[i], value);
int index;
if ((index = res.indexOf(groupNode)) >= 0) {
((GroupNode) res.get(index)).getRows().add(row);
} else {
groupNode.createRowsList();
groupNode.getRows().add(row);
res.add(groupNode);
}
}
}
} else
for (Row row : rows) {
Object value = row.getAttribute(attrs[i]);
GroupNode groupNode = new GroupNode(this, attrs[i], value);
int index;
if ((index = res.indexOf(groupNode)) >= 0) {
((GroupNode) res.get(index)).getRows().add(row);
} else {
groupNode.createRowsList();
groupNode.getRows().add(row);
res.add(groupNode);
}
}
Object[] objects = res.toArray();
Arrays.sort(objects);
for (int j = 0; j < objects.length; j++) {
res.set(j, (TreeTableNode) objects[j]);
}
for (TreeTableNode node : res) {
GroupNode groupNode = (GroupNode) node;
Vector<TreeTableNode> children = createChildren(i + 1, groupNode);
groupNode.setChildren(children);
groupNode.setParent();
}
}
return res;
}
use of com.ramussoft.database.common.Row in project ramus by Vitaliy-Yakovchuk.
the class RowTreeTableModel method checkAll.
public void checkAll() {
selectedRows.clear();
for (Row row : getRowSet().getAllRows()) selectedRows.put(row, Boolean.TRUE);
Set<Row> rows = selectedRows.keySet();
SelectionEvent event = new SelectionEvent(rows.toArray(new Row[rows.size()]), true);
for (SelectionListener l : getSelectionListeners()) {
l.changeSelection(event);
}
}
Aggregations