Search in sources :

Example 1 with VariantPropertyPersistent

use of com.ramussoft.core.attribute.simple.VariantPropertyPersistent in project ramus by Vitaliy-Yakovchuk.

the class HTTPParser method printClasificator.

private void printClasificator() throws IOException {
    final Row row = loadRowById();
    if (row == null) {
        printError(RES.getString("cantLoatClasificator"));
        return;
    }
    if (row instanceof Function) {
        htmlTitle = MovingFunction.getIDEF0Kod((com.ramussoft.database.common.Row) row) + " " + row.getName();
    } else
        htmlTitle = row.getKod() + ". " + row.getName();
    printStartD();
    printRowBase(row);
    if (row instanceof Function) {
        boolean b = true;
        if (!row.isLeaf()) {
            b = false;
            htmlStream.println("<br>");
            printStartATeg("idef0/index.html?id=" + row.getGlobalId().toString());
            htmlStream.print(RES.getString("idef0Model"));
            printEndATeg();
        }
        if (row.isElement()) {
            if (b)
                htmlStream.println("<br>");
            else
                htmlStream.print(" ");
            printStartATeg("idef0/index.html?id=" + row.getParentRow().getGlobalId().toString());
            htmlStream.print(RES.getString("ParentIDEF0Model"));
            printEndATeg();
        }
        htmlStream.println("<br>");
    } else if (row instanceof Stream && !dataPlugin.getBaseStream().equals(row)) {
        printStreamsRows((Stream) row);
    }
    boolean haveTable = false;
    Vector<Row> v = dataPlugin.getChilds(row, row.isElement());
    if (v.size() > 0) {
        if (haveTable)
            htmlStream.println("<br>");
        printElements(RES.getString("childElements"), v.toArray(), row.isElement() ? "rows" : "clasificators");
        haveTable = true;
    }
    if (!row.isElement()) {
        if (haveTable)
            htmlStream.println("<br>");
        v = dataPlugin.getRecChilds(row, true);
        htmlStream.println("<hr>");
        String var = params.get("var");
        String attr = params.get("attr");
        if (var != null) {
            Engine engine = dataPlugin.getEngine();
            long attrId = Long.parseLong(attr);
            long varId = Long.parseLong(var);
            Attribute attribute = engine.getAttribute(attrId);
            List<VariantPropertyPersistent> list = (List<VariantPropertyPersistent>) engine.getAttribute(null, attribute);
            VariantPropertyPersistent vpp = null;
            for (VariantPropertyPersistent vp : list) if (vp.getVariantId() == varId) {
                vpp = vp;
                break;
            }
            if ((vpp != null) && (vpp.getValue() != null)) {
                String value = vpp.getValue();
                ArrayList list1 = new ArrayList();
                for (Row r : v) {
                    if (value.equals(((NRow) r).getAttribute(attribute)))
                        list1.add(r);
                }
                htmlStream.println("(" + value + ")");
                htmlStream.println("<br>");
                printElements(RES.getString("childElements"), list1.toArray(), row.isElement() ? "rows" : "clasificators");
            }
        } else
            printElements(RES.getString("clasificatorElements"), v.toArray());
    } else
        printRowAttributes(row);
    if (row instanceof Function && (row.isElement())) {
        printFunctionsArrows((Function) row);
    } else if (!(row instanceof Stream)) {
        printArrowFunctionss(row);
    }
    printEndD();
}
Also used : Attribute(com.ramussoft.common.Attribute) ArrayList(java.util.ArrayList) VariantPropertyPersistent(com.ramussoft.core.attribute.simple.VariantPropertyPersistent) Function(com.ramussoft.pb.Function) MovingFunction(com.ramussoft.pb.idef.visual.MovingFunction) ByteArrayOutputStream(java.io.ByteArrayOutputStream) OutputStream(java.io.OutputStream) Stream(com.ramussoft.pb.Stream) InputStream(java.io.InputStream) List(java.util.List) ArrayList(java.util.ArrayList) Row(com.ramussoft.pb.Row) NRow(com.ramussoft.pb.data.negine.NRow) IEngine(com.ramussoft.common.IEngine) Engine(com.ramussoft.common.Engine)

Example 2 with VariantPropertyPersistent

use of com.ramussoft.core.attribute.simple.VariantPropertyPersistent in project ramus by Vitaliy-Yakovchuk.

the class AttributeVariantPanel method moveDown.

private void moveDown(final int[] selectedRows) {
    for (int i = selectedRows.length - 1; i >= 0; i--) {
        final int r = selectedRows[i];
        if (r < data.size() - 1) {
            VariantPropertyPersistent attr = data.get(r);
            data.remove(r);
            data.add(r + 1, attr);
        }
    }
    model.fireTableDataChanged();
}
Also used : VariantPropertyPersistent(com.ramussoft.core.attribute.simple.VariantPropertyPersistent)

Example 3 with VariantPropertyPersistent

use of com.ramussoft.core.attribute.simple.VariantPropertyPersistent in project ramus by Vitaliy-Yakovchuk.

the class AttributeVariantPanel method moveUp.

private void moveUp(final int[] selectedRows) {
    for (final int r : selectedRows) {
        if (r > 0) {
            VariantPropertyPersistent attr = data.get(r);
            data.remove(r);
            data.add(r - 1, attr);
        }
    }
    model.fireTableDataChanged();
}
Also used : VariantPropertyPersistent(com.ramussoft.core.attribute.simple.VariantPropertyPersistent)

Example 4 with VariantPropertyPersistent

use of com.ramussoft.core.attribute.simple.VariantPropertyPersistent in project ramus by Vitaliy-Yakovchuk.

the class AttributeVariantPanel method add.

protected void add() {
    long max = -1;
    for (int i = 0; i < data.size(); i++) if (data.get(i).getVariantId() > max)
        max = data.get(i).getVariantId();
    VariantPropertyPersistent p = new VariantPropertyPersistent();
    p.setVariantId(max + 1);
    p.setValue("");
    data.add(p);
    model.fireTableRowsInserted(data.size() - 1, data.size() - 1);
}
Also used : VariantPropertyPersistent(com.ramussoft.core.attribute.simple.VariantPropertyPersistent)

Example 5 with VariantPropertyPersistent

use of com.ramussoft.core.attribute.simple.VariantPropertyPersistent in project ramus by Vitaliy-Yakovchuk.

the class VariantAttributeViewer method printAttribute.

@Override
public void printAttribute(PrintStream printStream, DataPlugin dataPlugin, Element element, Attribute attribute, HTTPParser parser, AttributeViewerCallback callback) throws IOException {
    Engine engine = dataPlugin.getEngine();
    String value = (String) engine.getAttribute(element, attribute);
    if (value != null) {
        List<VariantPropertyPersistent> list = (List<VariantPropertyPersistent>) engine.getAttribute(null, attribute);
        VariantPropertyPersistent vp = null;
        for (VariantPropertyPersistent persistent : list) {
            if (persistent.getValue().equals(value))
                vp = persistent;
        }
        if (vp != null) {
            long id = StandardAttributesPlugin.getElement(engine, element.getQualifierId()).getId();
            callback.beforePrint(printStream);
            parser.printStartATeg("rows/index.html?id=" + id + "&var=" + vp.getVariantId() + "&attr=" + attribute.getId());
            printStream.print(value);
            parser.printEndATeg();
            callback.afterPrint(printStream);
        }
    }
}
Also used : VariantPropertyPersistent(com.ramussoft.core.attribute.simple.VariantPropertyPersistent) List(java.util.List) Engine(com.ramussoft.common.Engine)

Aggregations

VariantPropertyPersistent (com.ramussoft.core.attribute.simple.VariantPropertyPersistent)6 List (java.util.List)3 Engine (com.ramussoft.common.Engine)2 ArrayList (java.util.ArrayList)2 Attribute (com.ramussoft.common.Attribute)1 IEngine (com.ramussoft.common.IEngine)1 Function (com.ramussoft.pb.Function)1 Row (com.ramussoft.pb.Row)1 Stream (com.ramussoft.pb.Stream)1 NRow (com.ramussoft.pb.data.negine.NRow)1 MovingFunction (com.ramussoft.pb.idef.visual.MovingFunction)1 ByteArrayOutputStream (java.io.ByteArrayOutputStream)1 InputStream (java.io.InputStream)1 OutputStream (java.io.OutputStream)1 DefaultCellEditor (javax.swing.DefaultCellEditor)1 JComboBox (javax.swing.JComboBox)1 PopupMenuEvent (javax.swing.event.PopupMenuEvent)1 PopupMenuListener (javax.swing.event.PopupMenuListener)1