use of com.ramussoft.database.common.Row in project ramus by Vitaliy-Yakovchuk.
the class RowTreeTable method getCellRenderer.
@Override
public TableCellRenderer getCellRenderer(final int row, final int column) {
int aColumn = convertColumnIndexToModel(column);
final TableCellRenderer r = cellRenderers[aColumn];
if (aColumn == 0) {
JTree tree = (JTree) super.getCellRenderer(row, column);
DelegatingRenderer rend = ((DelegatingRenderer) tree.getCellRenderer());
TreePath pathForRow = tree.getPathForRow(convertRowIndexToModel(row));
if (pathForRow == null)
return super.getCellRenderer(row, column);
Object object = pathForRow.getLastPathComponent();
boolean setDefault = true;
Row row2 = null;
if (object instanceof TreeTableNode) {
row2 = ((TreeTableNode) object).getRow();
}
if (row2 != null) {
Hashtable<Long, ImageIcon> icons = IconFactory.getIcons(rowSet.getEngine());
Icon icon = getDefaultIcon(row2);
if (icon == null && row2.getHierarchicalPersistent() != null)
icon = icons.get(row2.getHierarchicalPersistent().getIconId());
setDefault = false;
if (icon != null) {
rend.setLeafIcon(icon);
rend.setOpenIcon(icon);
rend.setClosedIcon(icon);
} else {
ImageIcon l = IconFactory.getLeafIcons(rowSet.getEngine()).get(row2.getElement().getQualifierId());
ImageIcon o = IconFactory.getOpenIcons(rowSet.getEngine()).get(row2.getElement().getQualifierId());
ImageIcon c = IconFactory.getClosedIcons(rowSet.getEngine()).get(row2.getElement().getQualifierId());
rend.setLeafIcon((l == null) ? getLeafIcon() : l);
rend.setOpenIcon((o == null) ? getFolderIcon() : o);
rend.setClosedIcon((c == null) ? getFolderSheetIcon() : c);
}
}
if (setDefault) {
rend.setLeafIcon(getLeafIcon());
rend.setOpenIcon(getFolderIcon());
rend.setClosedIcon(getFolderSheetIcon());
}
}
if (aColumn == 0)
return super.getCellRenderer(row, column);
if ((r != null) && (aColumn == 0)) {
// DefaultTreeCellRenderer
JTree tree = (JTree) super.getCellRenderer(row, column);
if (x == null) {
x = new TreeCellRenderer() {
@Override
public Component getTreeCellRendererComponent(JTree tree, Object value, boolean selected, boolean expanded, boolean leaf, int aRow, boolean hasFocus) {
return r.getTableCellRendererComponent(RowTreeTable.this, getValueAt(aRow, column), selected, hasFocus, aRow, 0);
}
};
tree.setCellRenderer(x);
}
return (TableCellRenderer) tree;
}
return (r == null) ? super.getCellRenderer(row, column) : r;
}
use of com.ramussoft.database.common.Row in project ramus by Vitaliy-Yakovchuk.
the class RowTreeTable method getRowMover.
private RowMover getRowMover(final int[] sels) {
final Row[] group = getShownRows();
final RowMover mover = new RowMover(rowSet.getRoot(), group, sels, accessRules, rowSet);
return mover;
}
use of com.ramussoft.database.common.Row in project ramus by Vitaliy-Yakovchuk.
the class QualifierView method openQualifier.
protected void openQualifier() {
for (int i : table.getSelectedRows()) {
if (i >= 0) {
TreePath path = table.getPathForRow(i);
if (path != null) {
TreeTableNode node = (TreeTableNode) path.getLastPathComponent();
if (node != null) {
Row row = node.getRow();
if (row != null) {
if (row.getChildCount() == 0) {
table.setEditable(false);
openQualifier(row);
table.setEditable(true);
}
}
}
}
}
}
}
use of com.ramussoft.database.common.Row in project ramus by Vitaliy-Yakovchuk.
the class SelectRowPanel method createRightComponent.
private void createRightComponent() {
if (qualifierView == null)
return;
qualifier = qualifierView.getSelectedQualifier();
boolean b = qualifier != null;
if (b) {
framework.setOpenDynamikViewEvent(new ActionEvent(QualifierPlugin.OPEN_QUALIFIER, qualifier));
selectableTableView = new SelectableTableView(framework, dataPlugin.getEngine(), accessRules, qualifier) {
};
int dl = splitPane.getDividerLocation();
splitPane.setRightComponent(createComponent());
for (Row row : getSelectedRows(qualifier)) selectableTableView.getComponent().getModel().setSelectedRow(selectableTableView.getComponent().getRowSet().findRow(row.getElementId()), true);
splitPane.revalidate();
splitPane.repaint();
splitPane.setDividerLocation(dl);
selectableTableView.getComponent().getModel().addSelectionListener(selectionListener);
if (!getSelectType().equals(SelectType.CHECK))
selectableTableView.setSelectType(getSelectType());
}
}
use of com.ramussoft.database.common.Row in project ramus by Vitaliy-Yakovchuk.
the class SelectRowPanel method deleteRightPanel.
private void deleteRightPanel() {
if (selectableTableView != null) {
selectableTableView.getComponent().getModel().removeSelectionListener(selectionListener);
List<Row> list = selectableTableView.getComponent().getModel().getSelectedRows();
selectedRows.put(qualifier, list);
selectableTableView.close();
selectableTableView = null;
splitPane.setRightComponent(new JPanel());
}
}
Aggregations