Search in sources :

Example 66 with Row

use of com.ramussoft.pb.Row in project ramus by Vitaliy-Yakovchuk.

the class HTTPParser method outFunctionModel.

private void outFunctionModel(final int format) throws IOException {
    Row row = loadRowById();
    if (row == null || !(row instanceof Function))
        return;
    row = replaceIDEF0Row(row);
    final Function f = (Function) row;
    int imageWidth = IMAGE_WIDTH;
    String s = (String) params.get("w");
    if (s != null) {
        try {
            imageWidth = new Integer(s).intValue();
            if (imageWidth > 2000)
                imageWidth = 2000;
        } catch (final Exception e) {
        }
    }
    int imageHeight = IMAGE_HEIGHT;
    s = (String) params.get("h");
    if (s != null) {
        try {
            imageHeight = new Integer(s).intValue();
            if (imageHeight > 1600)
                imageHeight = 1600;
        } catch (final Exception e) {
        }
    }
    final PIDEF0painter painter = new PIDEF0painter(f, new Dimension(imageWidth, imageHeight), dataPlugin);
    painter.writeToStream(stream, format);
}
Also used : Function(com.ramussoft.pb.Function) MovingFunction(com.ramussoft.pb.idef.visual.MovingFunction) PIDEF0painter(com.ramussoft.pb.print.PIDEF0painter) Row(com.ramussoft.pb.Row) NRow(com.ramussoft.pb.data.negine.NRow) Dimension(java.awt.Dimension) DataException(com.ramussoft.report.data.DataException) UnsupportedEncodingException(java.io.UnsupportedEncodingException) SQLException(java.sql.SQLException) IOException(java.io.IOException)

Example 67 with Row

use of com.ramussoft.pb.Row in project ramus by Vitaliy-Yakovchuk.

the class HTTPParser method printFunctionArrows.

private void printFunctionArrows(final Vector left, final String string) throws IOException {
    final Vector<Row> v = new Vector<Row>();
    for (int i = 0; i < left.size(); i++) {
        final Stream stream = (Stream) left.get(i);
        final Row[] rs = stream.getAdded();
        for (final Row row : rs) {
            if (v.indexOf(row) < 0)
                v.add(row);
        }
    }
    final Row[] rows = new Row[v.size()];
    for (int i = 0; i < rows.length; i++) rows[i] = v.get(i);
    if (rows.length == 0)
        return;
    RowFactory.sortByName(rows);
    htmlStream.println("<p>");
    htmlStream.println("<table border=1 width=100%>");
    printMainTableTitle(string, 3);
    htmlStream.print("<tr>");
    htmlStream.print("<td><b>");
    htmlStream.print(RES.getString("kod"));
    htmlStream.print("</b></td>");
    htmlStream.print("<td><b>");
    htmlStream.print(RES.getString("element"));
    htmlStream.print("</b></td>");
    htmlStream.print("<td><b>");
    htmlStream.print(RES.getString("clasificator"));
    htmlStream.print("</b></td>");
    htmlStream.println("</tr>");
    for (final Row row : rows) {
        htmlStream.print("<tr>");
        htmlStream.print("<td>");
        printStartATeg("rows/index.html?id=" + row.getGlobalId().toString());
        htmlStream.print(row.getKod());
        printEndATeg();
        htmlStream.print("</td>");
        htmlStream.print("<td width=100%>");
        printStartATeg("rows/index.html?id=" + row.getGlobalId().toString());
        htmlStream.print(row.getName());
        printEndATeg();
        htmlStream.print("</td>");
        Qualifier q = dataPlugin.getEngine().getQualifier(row.getElement().getQualifierId());
        Element element = StandardAttributesPlugin.getElement(dataPlugin.getEngine(), q.getId());
        htmlStream.print("<td>");
        String name = q.getName();
        if (element != null) {
            printStartATeg("rows/index.html?id=" + element.getId());
        } else {
            if (name.equals(StandardAttributesPlugin.QUALIFIERS_QUALIFIER))
                name = RES.getString("clasificator");
        }
        htmlStream.print(name);
        if (element != null) {
            printEndATeg();
        }
        htmlStream.print("</td>");
        htmlStream.println("</tr>");
    }
    htmlStream.println("</table>");
    htmlStream.println("</p>");
}
Also used : Element(com.ramussoft.common.Element) ByteArrayOutputStream(java.io.ByteArrayOutputStream) OutputStream(java.io.OutputStream) Stream(com.ramussoft.pb.Stream) InputStream(java.io.InputStream) Qualifier(com.ramussoft.common.Qualifier) Row(com.ramussoft.pb.Row) NRow(com.ramussoft.pb.data.negine.NRow) Vector(java.util.Vector)

Example 68 with Row

use of com.ramussoft.pb.Row in project ramus by Vitaliy-Yakovchuk.

the class HTTPParser method printFullIDEF0Model.

private void printFullIDEF0Model() throws IOException {
    int imageWidth = IMAGE_WIDTH;
    String s = (String) params.get("w");
    if (s != null) {
        try {
            imageWidth = new Integer(s).intValue();
        } catch (final Exception e) {
        }
    }
    int imageHeight = IMAGE_HEIGHT;
    s = (String) params.get("h");
    if (s != null) {
        try {
            imageHeight = new Integer(s).intValue();
        } catch (final Exception e) {
        }
    }
    Row row = loadRowById();
    htmlTitle = replaceIDEF0Row(row).getName();
    printStartD();
    printIDEF0Image(row, imageWidth, imageHeight);
    printEndD();
}
Also used : Row(com.ramussoft.pb.Row) NRow(com.ramussoft.pb.data.negine.NRow) DataException(com.ramussoft.report.data.DataException) UnsupportedEncodingException(java.io.UnsupportedEncodingException) SQLException(java.sql.SQLException) IOException(java.io.IOException)

Example 69 with Row

use of com.ramussoft.pb.Row in project ramus by Vitaliy-Yakovchuk.

the class HTTPParser method printClasificatorsList.

protected void printClasificatorsList() throws IOException {
    printMainTableTitle(RES.getString("clasificatorsTitle"));
    final Vector v = dataPlugin.getRecChilds(null, false);
    for (int i = 0; i < v.size(); i++) {
        final Row row = (Row) v.get(i);
        final String href = "clasificators/index.html?id=" + row.getGlobalId();
        htmlStream.print("<tr><td valign=\"top\">");
        printStartATeg(href);
        printRowKod(row, false);
        printEndATeg();
        htmlStream.print("</td><td>");
        printStartATeg(href);
        printRowName(row, false);
        printEndATeg();
        htmlStream.println("</td></tr>");
    }
}
Also used : Row(com.ramussoft.pb.Row) NRow(com.ramussoft.pb.data.negine.NRow) Vector(java.util.Vector)

Example 70 with Row

use of com.ramussoft.pb.Row in project ramus by Vitaliy-Yakovchuk.

the class HTTPParser method printMatrixProjection.

private void printMatrixProjection() throws IOException {
    final String sId = (String) params.get("matrixid");
    if (sId == null) {
        printMatrixError();
        return;
    }
    final Long id = Long.parseLong(sId);
    if (id == null) {
        printMatrixError();
        return;
    }
    Engine engine = dataPlugin.getEngine();
    Attribute mp = engine.getAttribute(id);
    if (mp == null) {
        printMatrixError();
        return;
    }
    htmlTitle = RES.getString("matrixProjection") + " " + mp.getName();
    printStartD();
    boolean rotate = "true".equals(params.get("rotate"));
    htmlStream.print("<center><h2 class=\"Ramus\">" + RES.getString("matrixProjection") + ": " + mp.getName() + "</h2></center>");
    htmlStream.println("<table width=100%>");
    htmlStream.println("<tr>");
    htmlStream.println("<td  valign=top align=center width=50%>");
    ElementListPropertyPersistent pp = (ElementListPropertyPersistent) engine.getAttribute(null, mp);
    Qualifier qualifier1 = engine.getQualifier(pp.getQualifier1());
    Qualifier qualifier2 = engine.getQualifier(pp.getQualifier2());
    if (rotate) {
        Qualifier tmp = qualifier1;
        qualifier1 = qualifier2;
        qualifier2 = tmp;
    }
    htmlStream.println("<table border=1 width=100%>");
    List<Row> rows = (List) dataPlugin.getRowSet(qualifier1.getId()).getAllRows();
    printMainTableTitle(qualifier1.getName());
    final Row leftRow = loadRowById();
    for (int i = 0; i < rows.size(); i++) {
        final Row row = (Row) rows.get(i);
        final boolean gray = i % 2 == 0;
        String sGray = "";
        String bs = "";
        String be = "";
        if (row.equals(leftRow)) {
            bs = "<i>";
            be = "</i>";
        }
        if (gray)
            sGray = " bgcolor=" + GRAY;
        String href = "matrixprojections/index.html?id=" + row.getGlobalId().toString() + "&matrixid=" + sId + (rotate ? "&rotate=true" : "");
        htmlStream.print("<tr>");
        htmlStream.print("<td" + sGray + ">");
        printStartATeg("rows/index.html?id=" + row.getElement().getId());
        htmlStream.print("^");
        printEndATeg();
        printStartATeg(href);
        htmlStream.print(bs);
        printRowKod(row, false, IDEF0Plugin.isFunction(qualifier1));
        htmlStream.print(be);
        if (href != null)
            printEndATeg();
        htmlStream.print("</td>");
        htmlStream.print("<td" + sGray + ">");
        printStartATeg(href);
        htmlStream.print(bs);
        printRowName(row, false);
        htmlStream.print(be);
        if (href != null)
            printEndATeg();
        htmlStream.print("</td>");
        htmlStream.println("</tr>");
    }
    htmlStream.println("</table>");
    htmlStream.println("</td>");
    htmlStream.println("<td valign=top align=center width=50%>");
    final String row2Name = qualifier2.getName() + " (" + RES.getString("addedElements") + (leftRow == null ? "" : " " + leftRow.getKod() + ". " + leftRow.getName()) + ")";
    if (leftRow != null) {
        List<ElementListPersistent> left = (List<ElementListPersistent>) engine.getAttribute(leftRow.getElement(), mp);
        final Vector v = new Vector();
        for (ElementListPersistent p : left) {
            if (rotate) {
                v.add(dataPlugin.findRowByGlobalId(p.getElement1Id()));
            } else {
                v.add(dataPlugin.findRowByGlobalId(p.getElement2Id()));
            }
        }
        printElements(row2Name, v.toArray(), null);
    } else {
        htmlStream.println("<table width=100%>");
        htmlStream.println("<caption>");
        printSmallTitle(row2Name);
        htmlStream.println("</caption>");
        htmlStream.println("</table>");
    }
    htmlStream.println("</td>");
    htmlStream.println("</tr>");
    htmlStream.println("</table>");
    String href = "matrixprojections/index.html?matrixid=" + sId;
    if (!rotate)
        href += "&rotate=" + "true";
    htmlStream.println("<p align=right>");
    printStartATeg(href);
    htmlStream.println(RES.getString("rotate"));
    printEndATeg();
    htmlStream.println("</p>");
    printEndD();
}
Also used : ElementListPersistent(com.ramussoft.core.attribute.simple.ElementListPersistent) Attribute(com.ramussoft.common.Attribute) ElementListPropertyPersistent(com.ramussoft.core.attribute.simple.ElementListPropertyPersistent) Qualifier(com.ramussoft.common.Qualifier) List(java.util.List) ArrayList(java.util.ArrayList) Row(com.ramussoft.pb.Row) NRow(com.ramussoft.pb.data.negine.NRow) Vector(java.util.Vector) IEngine(com.ramussoft.common.IEngine) Engine(com.ramussoft.common.Engine)

Aggregations

Row (com.ramussoft.pb.Row)93 Function (com.ramussoft.pb.Function)35 Stream (com.ramussoft.pb.Stream)30 Vector (java.util.Vector)28 NFunction (com.ramussoft.pb.data.negine.NFunction)19 Sector (com.ramussoft.pb.Sector)15 NRow (com.ramussoft.pb.data.negine.NRow)14 Qualifier (com.ramussoft.common.Qualifier)13 Crosspoint (com.ramussoft.pb.Crosspoint)13 NSector (com.ramussoft.pb.data.negine.NSector)13 PaintSector (com.ramussoft.pb.idef.elements.PaintSector)12 ByteArrayOutputStream (java.io.ByteArrayOutputStream)11 ArrayList (java.util.ArrayList)11 SectorRefactor (com.ramussoft.pb.idef.elements.SectorRefactor)10 Attribute (com.ramussoft.common.Attribute)9 MovingFunction (com.ramussoft.pb.idef.visual.MovingFunction)9 IOException (java.io.IOException)9 FloatPoint (com.dsoft.pb.types.FloatPoint)8 Point (com.ramussoft.pb.idef.elements.Point)8 Element (com.ramussoft.common.Element)7