use of com.ramussoft.database.common.RowSet in project ramus by Vitaliy-Yakovchuk.
the class HTTPParser method printReportsList.
/**
* Друкує список звітів з посиланнями на них.
*
* @throws IOException
*/
protected void printReportsList() throws IOException {
Engine engine = dataPlugin.getEngine();
Qualifier qualifier = ReportPlugin.getReportsQualifier(engine);
Attribute name = ReportPlugin.getReportNameAttribute(engine);
RowSet rowSet = new RowSet(engine, qualifier, new Attribute[] { name }, null, true);
List<Element> reports = ((ReportQuery) engine).getHTMLReports();
if (reports.size() == 0)
return;
printMainTableTitle(RES.getString("reportsTitle"));
for (com.ramussoft.database.common.Row element : rowSet.getAllRows()) {
htmlStream.println("<tr>");
htmlStream.println("<td colspan=2>");
printStartATeg("reportsq/index.html?num=" + element.getElementId());
htmlStream.println(element.getCode());
printEndATeg();
printStartATeg("reportsq/index.html?num=" + element.getElementId());
htmlStream.print(element.getName());
printEndATeg();
htmlStream.println("</td>");
htmlStream.println("</tr>");
}
}
use of com.ramussoft.database.common.RowSet in project ramus by Vitaliy-Yakovchuk.
the class NDataPlugin method close.
public void close() {
for (RowSet rs : rowSets.values()) rs.close();
rowSets.clear();
sectorsRowSet.clear();
crosspoints.clear();
qualifiers.close();
streamsRowSet.close();
engine.removeElementListener(sectors, listener);
engine.removeElementAttributeListener(sectors, crosspointsListener);
}
use of com.ramussoft.database.common.RowSet in project ramus by Vitaliy-Yakovchuk.
the class RSFViewer method createQualifiersList.
private Component createQualifiersList() {
// Get qualifiers
List<Qualifier> qualifiers = engine.getQualifiers();
// list
Collections.sort(qualifiers, new // Sort
Comparator<Qualifier>() {
// qualifiers
// list by
// name
private Collator collator = Collator.getInstance();
@Override
public int compare(Qualifier o1, Qualifier o2) {
return collator.compare(o1.getName(), o2.getName());
}
});
final JList list = new JList(qualifiers.toArray());
list.getSelectionModel().addListSelectionListener(new ListSelectionListener() {
RowSet rowSet = null;
@Override
public void valueChanged(ListSelectionEvent e) {
// Load elements of qualifier.
// We will load elements with RowSet class,
// you can also load elements with engne.getElements
// methods.
// Value is
Object value = list.getSelectedValue();
// object.
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;
}
Qualifier qualifier = (Qualifier) 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, qualifier, 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(list);
return pane;
}
use of com.ramussoft.database.common.RowSet in project ramus by Vitaliy-Yakovchuk.
the class OtherElementPlugin method getValueGetter.
@Override
public ValueGetter getValueGetter(Attribute attribute, Engine engine, GUIFramework framework, final Closeable model) {
OtherElementPropertyPersistent p = (OtherElementPropertyPersistent) engine.getAttribute(null, attribute);
final Qualifier q = engine.getQualifier(p.getQualifier());
final Attribute attr = engine.getAttribute(p.getQualifierAttribute());
final RowSet rowSet;
if ((q != null) && (attr != null)) {
RowSetValue value = sets.get(q);
if ((value != null) && (!value.attribute.equals(attr))) {
value.rowSet.close();
sets.remove(q);
value = null;
}
if (value == null) {
value = new RowSetValue(attr, new RowSet(engine, q, new Attribute[] { attr }));
sets.put(q, value);
}
rowSet = value.rowSet;
} else
rowSet = null;
return new OtherElementValueGetter(attr, rowSet, q);
}
use of com.ramussoft.database.common.RowSet in project ramus by Vitaliy-Yakovchuk.
the class OtherElementEditor method setValue.
@Override
public Object setValue(Object value) {
component.getModel().clearSelection();
if (value != null) {
long elementId = (Long) value;
if (elementId > -1l) {
RowSet rowSet = component.getRowSet();
Row row = rowSet.findRow(elementId);
if (row != null) {
component.getModel().setSelectedRow(row, true);
int indexOfRow = component.getTable().indexOfRow(row);
if (indexOfRow >= 0)
component.getTable().scrollRowToVisible(indexOfRow);
} else
return null;
} else
return null;
}
return value;
}
Aggregations