Search in sources :

Example 6 with Element

use of com.ramussoft.common.Element in project ramus by Vitaliy-Yakovchuk.

the class QualifierHistoryPlugin method showHistory.

@SuppressWarnings("unchecked")
protected void showHistory(TableTabView tableView, Element element, Attribute attribute) {
    GUIFramework framework = tableView.getFramework();
    Hashtable<Element, Hashtable<Attribute, HistoryDialog>> h = (Hashtable<Element, Hashtable<Attribute, HistoryDialog>>) framework.get("HistoryDialogs");
    if (h == null) {
        h = new Hashtable<Element, Hashtable<Attribute, HistoryDialog>>();
        framework.put("HistoryDialogs", h);
    }
    Hashtable<Attribute, HistoryDialog> h1 = h.get(element);
    if (h1 == null) {
        h1 = new Hashtable<Attribute, HistoryDialog>();
        h.put(element, h1);
    }
    HistoryDialog hd = h1.get(attribute);
    if (hd == null) {
        hd = new HistoryDialog(framework, this, element, attribute);
        h1.put(attribute, hd);
    }
    hd.setVisible(true);
}
Also used : Attribute(com.ramussoft.common.Attribute) GUIFramework(com.ramussoft.gui.common.GUIFramework) Hashtable(java.util.Hashtable) Element(com.ramussoft.common.Element)

Example 7 with Element

use of com.ramussoft.common.Element in project ramus by Vitaliy-Yakovchuk.

the class RowTreeTableModel method setValueAt.

@Override
public void setValueAt(Object value, Object node, int column) {
    if (!saveValues[column])
        return;
    TreeTableNode row = (TreeTableNode) node;
    if (row.getRow() == null)
        return;
    Attribute a = row.getRow().getRowAttributes()[column + 1];
    Engine engine = row.getRow().getRowSet().getEngine();
    Qualifier q = engine.getQualifier(row.getRow().getElement().getQualifierId());
    if ((q.getAttributeForName() == a.getId()) && (value instanceof String)) {
        List<Element> list = engine.findElements(q.getId(), a, value);
        for (Element element : list) {
            if (element.getId() != row.getRow().getElementId()) {
                if (JOptionPane.showConfirmDialog(table, GlobalResourcesManager.getString("Warning.ElementsExists"), GlobalResourcesManager.getString("ConfirmMessage.Title"), JOptionPane.YES_NO_OPTION) != JOptionPane.YES_OPTION)
                    return;
                break;
            }
        }
    }
    row.getRow().startUserTransaction();
    row.getRow().setAttribute(column, value);
    row.getRow().endUserTransaction();
}
Also used : Attribute(com.ramussoft.common.Attribute) Element(com.ramussoft.common.Element) Qualifier(com.ramussoft.common.Qualifier) Engine(com.ramussoft.common.Engine)

Example 8 with Element

use of com.ramussoft.common.Element in project ramus by Vitaliy-Yakovchuk.

the class Data method getBaseRowByQualifier.

public Row getBaseRowByQualifier(String baseQualifierName) {
    if (baseRows == null) {
        baseRows = getRows(baseQualifierName);
        if (query != null) {
            List<Element> elements = query.getElements();
            if (elements != null) {
                for (int i = baseRows.size() - 1; i >= 0; i--) {
                    Row row = baseRows.get(i);
                    if (elements.indexOf(row.getElement()) < 0)
                        baseRows.remove(i);
                }
            }
        }
        if (baseRows.size() == 0)
            throw new NoRowsException();
        baseRows.next();
    } else {
        if (!baseQualifierName.equals(baseRows.getQualifierName())) {
            throw new DataException("Error.differentBaseQualifiers", "Report contains diffetents base qualifiers in queries", baseQualifierName, baseRows.getQualifierName());
        }
    }
    return baseRows.getCurrent();
}
Also used : Element(com.ramussoft.common.Element) NoRowsException(com.ramussoft.report.xml.NoRowsException)

Example 9 with Element

use of com.ramussoft.common.Element in project ramus by Vitaliy-Yakovchuk.

the class Data method getReport.

public Source getReport(String name, Query query) {
    Element element = engine.getElement(name, ReportPlugin.getReportsQualifier(engine).getId());
    if (element == null)
        throw new DataException("Error.reportNotFound", "Report " + name + " not found", name);
    HashMap<String, Object> map = new HashMap<String, Object>();
    if (query != null)
        map.put("query", query);
    String htmlReport = reportQuery.getHTMLReport(element, map);
    Source source = new Source(htmlReport);
    source.fullSequentialParse();
    return source;
}
Also used : HashMap(java.util.HashMap) Element(com.ramussoft.common.Element) Source(net.htmlparser.jericho.Source)

Example 10 with Element

use of com.ramussoft.common.Element 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;
}
Also used : Element(com.ramussoft.common.Element) RowSet(com.ramussoft.database.common.RowSet) ArrayList(java.util.ArrayList) Row(com.ramussoft.database.common.Row)

Aggregations

Element (com.ramussoft.common.Element)142 Attribute (com.ramussoft.common.Attribute)70 Qualifier (com.ramussoft.common.Qualifier)59 ArrayList (java.util.ArrayList)48 Engine (com.ramussoft.common.Engine)27 SQLException (java.sql.SQLException)14 List (java.util.List)14 Hashtable (java.util.Hashtable)13 Row (com.ramussoft.database.common.Row)12 ElementEvent (com.ramussoft.common.event.ElementEvent)11 HierarchicalPersistent (com.ramussoft.core.attribute.simple.HierarchicalPersistent)11 Eval (com.ramussoft.eval.Eval)9 AttributeEvent (com.ramussoft.common.event.AttributeEvent)8 ElementListPersistent (com.ramussoft.core.attribute.simple.ElementListPersistent)8 Row (com.ramussoft.pb.Row)8 Journaled (com.ramussoft.common.journal.Journaled)7 FunctionPersistent (com.ramussoft.eval.FunctionPersistent)7 Util (com.ramussoft.eval.Util)7 EObject (com.ramussoft.eval.EObject)6 IOException (java.io.IOException)6