use of com.ramussoft.database.common.Row in project ramus by Vitaliy-Yakovchuk.
the class StreamsTabView method createComponent.
@Override
public JComponent createComponent() {
for (Row row : streams.getAllRows()) if (filterAdd(row))
data.add(row);
Collections.sort(data, new Comparator<Row>() {
@Override
public int compare(Row o1, Row o2) {
return StringCollator.compare(o1.getName(), o2.getName());
}
});
table = new JXTable(model = new AbstractTableModel() {
@Override
public Object getValueAt(int rowIndex, int columnIndex) {
return data.get(rowIndex).getName();
}
@Override
public int getRowCount() {
return data.size();
}
@Override
public int getColumnCount() {
return 1;
}
@Override
public boolean isCellEditable(int rowIndex, int columnIndex) {
return true;
}
@Override
public void setValueAt(Object aValue, int rowIndex, int columnIndex) {
data.get(rowIndex).setName(String.valueOf(aValue));
}
});
table.setTableHeader(null);
table.getSelectionModel().addListSelectionListener(new ListSelectionListener() {
@Override
public void valueChanged(ListSelectionEvent e) {
deleteElementAction.setEnabled(table.getSelectedRow() >= 0);
}
});
table.setComponentPopupMenu(createPopupMenu());
JScrollPane jScrollPane = new JScrollPane(table);
return jScrollPane;
}
use of com.ramussoft.database.common.Row in project ramus by Vitaliy-Yakovchuk.
the class AttributePullView method setupAttribute.
private void setupAttribute() {
AttributePreferenciesDialog dialog = new AttributePreferenciesDialogWithQualifierSet(framework);
TreeTableNode node = table.getSelectedNode();
if (node == null)
return;
Row row = node.getRow();
Attribute attribute = engine.getAttribute((Long) row.getAttribute(attributeId));
dialog.setAttribute(attribute);
dialog.getOKButton().setEnabled(rules.canUpdateAttribute(attribute.getId()));
dialog.setVisible(true);
}
use of com.ramussoft.database.common.Row in project ramus by Vitaliy-Yakovchuk.
the class AttributePullView method refreshActions.
private void refreshActions() {
createAttributeAction.setEnabled(rules.canCreateAttribute());
if (table.getTreeSelectionModel().getSelectionPath() == null) {
deleteAttributeAction.setEnabled(false);
attributePreferencesAction.setEnabled(false);
} else {
boolean e = true;
boolean e1 = true;
TreePath[] paths = table.getTreeSelectionModel().getSelectionPaths();
for (TreePath path : paths) {
Row row = ((TreeTableNode) path.getLastPathComponent()).getRow();
if (row == null) {
e = false;
e1 = 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;
}
if (!rules.canUpdateAttribute(attrId)) {
e1 = false;
break;
}
}
deleteAttributeAction.setEnabled(e);
attributePreferencesAction.setEnabled(e1);
}
}
use of com.ramussoft.database.common.Row in project ramus by Vitaliy-Yakovchuk.
the class ElementListAttributeEditor method setValue.
@SuppressWarnings("unchecked")
@Override
public Object setValue(Object value) {
component.getModel().clearSelection();
List<ElementListPersistent> list = (List<ElementListPersistent>) value;
RowSet rowSet = component.getRowSet();
Row row = null;
for (ElementListPersistent p : list) {
long id = (left) ? p.getElement1Id() : p.getElement2Id();
row = rowSet.findRow(id);
if (row != null)
component.getModel().setSelectedRow(row, true);
}
if (row != null)
component.getTable().scrollRowToVisible(component.getTable().indexOfRow(row));
Collections.sort(list);
return value;
}
use of com.ramussoft.database.common.Row in project ramus by Vitaliy-Yakovchuk.
the class ReportsView method openReport.
protected void openReport() {
table.setEditable(false);
TreeTableNode node = table.getSelectedNode();
if (node != null) {
Row row = node.getRow();
if (row != null) {
openReport(row);
}
}
table.setEditable(true);
}
Aggregations