Search in sources :

Example 11 with RowSet

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>");
    }
}
Also used : Attribute(com.ramussoft.common.Attribute) ReportQuery(com.ramussoft.report.ReportQuery) Element(com.ramussoft.common.Element) RowSet(com.ramussoft.database.common.RowSet) Qualifier(com.ramussoft.common.Qualifier) IEngine(com.ramussoft.common.IEngine) Engine(com.ramussoft.common.Engine)

Example 12 with RowSet

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);
}
Also used : RowSet(com.ramussoft.database.common.RowSet)

Example 13 with RowSet

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;
}
Also used : JScrollPane(javax.swing.JScrollPane) RowSet(com.ramussoft.database.common.RowSet) ListSelectionEvent(javax.swing.event.ListSelectionEvent) Qualifier(com.ramussoft.common.Qualifier) DefaultTreeModel(javax.swing.tree.DefaultTreeModel) JList(javax.swing.JList) Collator(java.text.Collator) ListSelectionListener(javax.swing.event.ListSelectionListener)

Example 14 with RowSet

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);
}
Also used : Attribute(com.ramussoft.common.Attribute) RowSet(com.ramussoft.database.common.RowSet) Qualifier(com.ramussoft.common.Qualifier) OtherElementPropertyPersistent(com.ramussoft.core.attribute.simple.OtherElementPropertyPersistent)

Example 15 with RowSet

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;
}
Also used : RowSet(com.ramussoft.database.common.RowSet) Row(com.ramussoft.database.common.Row)

Aggregations

RowSet (com.ramussoft.database.common.RowSet)18 Row (com.ramussoft.database.common.Row)9 Qualifier (com.ramussoft.common.Qualifier)8 Attribute (com.ramussoft.common.Attribute)7 Element (com.ramussoft.common.Element)5 ArrayList (java.util.ArrayList)5 Function (com.ramussoft.pb.Function)3 JScrollPane (javax.swing.JScrollPane)3 Engine (com.ramussoft.common.Engine)2 Row (com.ramussoft.pb.Row)2 Stream (com.ramussoft.pb.Stream)2 InputStream (java.io.InputStream)2 OutputStream (java.io.OutputStream)2 JList (javax.swing.JList)2 ListSelectionEvent (javax.swing.event.ListSelectionEvent)2 ListSelectionListener (javax.swing.event.ListSelectionListener)2 DefaultTreeModel (javax.swing.tree.DefaultTreeModel)2 ProjectOptions (com.dsoft.pb.idef.elements.ProjectOptions)1 IEngine (com.ramussoft.common.IEngine)1 ElementListPersistent (com.ramussoft.core.attribute.simple.ElementListPersistent)1