use of com.ramussoft.database.common.Row in project ramus by Vitaliy-Yakovchuk.
the class SelectRowPanel method selectRows.
public void selectRows(List<Row> rows) {
selectedRows.clear();
if (selectableTableView != null)
selectableTableView.clearSelection();
List<Long> ss = new ArrayList<Long>();
for (Row row : rows) {
Qualifier qualifier = row.getRowSet().getQualifier();
List<Row> sels = getSelectedRows(qualifier);
sels.add(row);
if (this.qualifier != null && this.selectableTableView != null && this.qualifier.equals(qualifier))
ss.add(row.getElementId());
}
if (selectableTableView != null)
selectableTableView.selectRows(ss);
repaint();
}
use of com.ramussoft.database.common.Row in project ramus by Vitaliy-Yakovchuk.
the class ReportQueryImpl method getHTMLReports.
@Override
public List<Element> getHTMLReports() {
RowSet rowSet = new RowSet(engine, ReportPlugin.getReportsQualifier(engine), new Attribute[] {}, null, true);
List<Row> rows = rowSet.getAllRows();
List<Element> elements = new ArrayList<Element>(rows.size());
for (Row row : rows) elements.add(row.getElement());
return elements;
}
use of com.ramussoft.database.common.Row in project ramus by Vitaliy-Yakovchuk.
the class SelectRowDialog method createRightComponent.
private void createRightComponent() {
if (qualifierView == null)
return;
qualifier = qualifierView.getSelectedQualifier();
boolean b = qualifier != null;
addQualifier = b;
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(row, 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 SelectRowDialog method showModal.
public List<com.ramussoft.pb.Row> showModal() {
final Qualifier q1 = qualifier;
selectedRows.clear();
createComponents();
if (q1 != null) {
Options.saveOptions(this);
SwingUtilities.invokeLater(new Runnable() {
@Override
public void run() {
qualifierView.setSelectedQualifier(q1);
Options.loadOptions(SelectRowDialog.this);
addQualifier = false;
}
});
}
ok = false;
setVisible(true);
deleteComponents();
List<com.ramussoft.pb.Row> result = new ArrayList<com.ramussoft.pb.Row>();
if (ok) {
for (List<Row> list : selectedRows.values()) {
for (Row row : list) {
com.ramussoft.pb.Row r = dataPlugin.findRowByGlobalId(row.getElementId());
if (r != null)
result.add(r);
}
}
if ((addQualifier) && (qualifier != null)) {
Engine engine = dataPlugin.getEngine();
Qualifier q = StandardAttributesPlugin.getQualifiersQualifier(engine);
List<Element> list = engine.getElements(q.getId());
for (Element element : list) {
if (qualifier.equals(StandardAttributesPlugin.getQualifier(engine, element))) {
com.ramussoft.pb.Row r = dataPlugin.findRowByGlobalId(element.getId());
if (r != null) {
result.add(r);
} else {
System.err.println("WARNING: Can not find element for qualifier (" + qualifier.getName() + ")");
}
}
}
}
}
Options.saveOptions(this);
return result;
}
use of com.ramussoft.database.common.Row in project ramus by Vitaliy-Yakovchuk.
the class RSFViewer2 method createQualifiersList.
private Component createQualifiersList() {
// Load tree with elements meta data standard system qualifier.
RowSet rowSet = new RowSet(engine, StandardAttributesPlugin.getQualifiersQualifier(engine), new Attribute[] {});
final JTree qualifiersTree = new JTree(new DefaultTreeModel(rowSet.getRoot()));
qualifiersTree.setRootVisible(false);
qualifiersTree.getSelectionModel().addTreeSelectionListener(new TreeSelectionListener() {
RowSet rowSet = null;
@Override
public void valueChanged(TreeSelectionEvent e) {
// Load elements of qualifier.
// We will load elements with RowSet class,
// you can also load elements with engne.getElements
// methods.
Object value = qualifiersTree.getSelectionPath().getLastPathComponent();
// Value is really a Row element.
if (value != null) {
if (rowSet != null) {
// If rowSet is opened, we
// should close it and free
// all listeners.
rowSet.close();
// Just in case :)
rowSet = null;
}
Row qualifierRow = (Row) value;
// Even you are not going to use any attribute,
// use RowSet(Engine, Qualifier Attribute[])
// constructor
// instead of RowSet(Engine, Qualifier) constructor.
rowSet = new RowSet(engine, StandardAttributesPlugin.getQualifier(engine, qualifierRow.getElement()), new Attribute[] {});
// And just load tree component with elements
// covered to Row objects.
tree.setModel(new DefaultTreeModel(rowSet.getRoot()));
}
}
});
JScrollPane pane = new JScrollPane();
pane.setViewportView(qualifiersTree);
return pane;
}
Aggregations