Search in sources :

Example 26 with Row

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

the class DataStore method paint.

@Override
public void paint(Graphics2D g) {
    final Stroke tmp = g.getStroke();
    try {
        DataPlugin dp = ((NFunction) function).getDataPlugin();
        Row row = dp.findRowByGlobalId(function.getLink());
        final class PolygonD extends Polygon {

            /**
             */
            private static final long serialVersionUID = 1L;

            public void addPoint(final double x, final double y) {
                super.addPoint((int) x, (int) y);
            }
        }
        ;
        g.setColor(function.getBackground());
        final Rectangle2D rect = movingArea.getBounds(getBounds());
        Rectangle2D r2d = null;
        if (row != null) {
            String string = row.getKod();
            r2d = function.getFont().getStringBounds(string, g.getFontRenderContext());
            left = movingArea.getIDoubleOrdinate(r2d.getWidth()) + 1;
        } else {
            left = EMPTY_LEFT;
        }
        g.fill(rect);
        g.setFont(function.getFont());
        paintText(g);
        if (row != null) {
            String string = row.getKod();
            movingArea.paintText(g, string, new FRectangle(myBounds.getX() + 0.5, myBounds.getY(), left - 0.5, myBounds.getHeight()), Line.LEFT_ALIGN, 1, true);
        }
        g.draw(new Line2D.Double(rect.getX() + left, rect.getMaxY(), rect.getX() + left, rect.getY()));
        paintBorder(g);
        g.draw(new Line2D.Double(rect.getX(), rect.getY(), rect.getMaxX(), rect.getY()));
        g.draw(new Line2D.Double(rect.getX(), rect.getMaxY(), rect.getX(), rect.getY()));
        g.draw(new Line2D.Double(rect.getMaxX(), rect.getMaxY(), rect.getX(), rect.getMaxY()));
        g.setStroke(new BasicStroke(2));
        /*
             * g.draw(new Line2D.Double(rect.getX() + rect.getWidth() - 1,
			 * rect.getY() + 1, rect.getX() + rect.getWidth() - 1, rect.getY() +
			 * rect.getHeight() - 1)); g.draw(new Line2D.Double(rect.getX() + 1,
			 * rect.getY() + rect.getHeight() - 1, rect.getX() + rect.getWidth()
			 * - 1, rect .getY() + rect.getHeight() - 1));
			 */
        final String string = getIDEF0Kod();
        g.setFont(function.getFont());
        double h = MovingArea.getWidth(0) + MovingArea.getWidth((int) function.getFont().getStringBounds(string, g.getFontRenderContext()).getHeight());
        h = h * 0.7;
        if (paintTriangle >= 0) {
            final PolygonD p = new PolygonD();
            p.addPoint(rect.getX() + rect.getWidth() / 2, rect.getY() + rect.getHeight() / 2);
            int standoff2 = -1;
            switch(paintTriangle) {
                case Point.TOP:
                    {
                        p.addPoint(rect.getX() + standoff2, rect.getY() + standoff2);
                        p.addPoint(rect.getX() + rect.getWidth() - standoff2, rect.getY() + standoff2);
                    }
                    break;
                case Point.LEFT:
                    {
                        p.addPoint(rect.getX() + standoff2, rect.getY() + standoff2);
                        p.addPoint(rect.getX() + standoff2, rect.getY() + rect.getHeight() - standoff2);
                    }
                    break;
                case Point.RIGHT:
                    {
                        p.addPoint(rect.getX() + rect.getWidth() - standoff2, rect.getY() + standoff2);
                        p.addPoint(rect.getX() + rect.getWidth() - standoff2, rect.getY() + rect.getHeight() - standoff2);
                    }
                    break;
                case Point.BOTTOM:
                    {
                        p.addPoint(rect.getX() + standoff2, rect.getY() + rect.getHeight() - standoff2);
                        p.addPoint(rect.getX() + rect.getWidth() - standoff2, rect.getY() + rect.getHeight() - standoff2);
                    }
                    break;
            }
            if (p.npoints > 1)
                g.fillPolygon(p);
        }
    } catch (NullPointerException e) {
    }
    g.setStroke(tmp);
}
Also used : BasicStroke(java.awt.BasicStroke) Stroke(java.awt.Stroke) BasicStroke(java.awt.BasicStroke) NFunction(com.ramussoft.pb.data.negine.NFunction) Rectangle2D(java.awt.geom.Rectangle2D) Line2D(java.awt.geom.Line2D) Point(com.ramussoft.pb.idef.elements.Point) FRectangle(com.dsoft.pb.types.FRectangle) Row(com.ramussoft.pb.Row) DataPlugin(com.ramussoft.pb.DataPlugin) Polygon(java.awt.Polygon)

Example 27 with Row

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

the class RowClipboard method pasteFromClipboard.

public static void pasteFromClipboard(final Row parent) {
    final String error = Main.dataPlugin.getRowPerrmision(parent);
    if (error != null) {
        JOptionPane.showMessageDialog(null, error, ResourceLoader.getString("no_permision"), JOptionPane.WARNING_MESSAGE);
        return;
    }
    if (parent != null && parent.getRowType() != Row.TYPE_ROW)
        return;
    int i = 0;
    final Clipboard clip = Toolkit.getDefaultToolkit().getSystemClipboard();
    final Transferable tr = clip.getContents(null);
    byte[] bs;
    try {
        bs = (byte[]) tr.getTransferData(dataFlavor);
        if (bs == null) {
            if (parent == null)
                return;
            final String t = (String) tr.getTransferData(DataFlavor.stringFlavor);
            if (t == null)
                return;
            boolean tag = false;
            Row old = parent;
            int oldLevel = 0;
            Row r = null;
            if (parent != null)
                tag = true;
            while (i < t.length()) {
                int level = 0;
                String name = "";
                while (i < t.length()) {
                    if (t.charAt(i) != '\r')
                        break;
                    i++;
                }
                while (i < t.length()) {
                    if (t.charAt(i) == '\t')
                        level++;
                    else
                        break;
                    i++;
                }
                while (i < t.length()) {
                    if (t.charAt(i) == ' ')
                        break;
                    i++;
                }
                while (i < t.length()) {
                    if (t.charAt(i) != '\n')
                        name += t.charAt(i);
                    else
                        break;
                    i++;
                }
                if (!name.equals("")) {
                    if (level > oldLevel && r != null) {
                        old = r;
                        oldLevel = level;
                    } else
                        while (level < oldLevel) {
                            old = old.getParentRow();
                            oldLevel--;
                        }
                    r = Main.dataPlugin.createRow(old, tag);
                    r.setName(name);
                }
                i++;
            }
        } else {
        }
    } catch (final Exception e) {
    }
}
Also used : Transferable(java.awt.datatransfer.Transferable) Clipboard(java.awt.datatransfer.Clipboard) Row(com.ramussoft.pb.Row)

Example 28 with Row

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

the class RowClipboard method copyToClipboard.

public static void copyToClipboard(final Row[] rows) {
    String copy = "";
    for (final Row r : rows) {
        for (int j = 0; j < getTagLevel(r); j++) copy += "\t";
        copy += r.getKod() + " " + r.getName() + "\n";
    }
    copyToClipboard(rows, copy);
}
Also used : Row(com.ramussoft.pb.Row)

Example 29 with Row

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

the class HTTPParser method printArrowFunctionss.

private void printArrowFunctionss(final Row row) throws IOException {
    final Vector funcs = new Vector<Row>();
    List<Qualifier> list = dataPlugin.getEngine().getQualifiers();
    for (Qualifier q : list) {
        if (IDEF0Plugin.isFunction(q)) {
            DataPlugin dp = NDataPluginFactory.getDataPlugin(q, dataPlugin.getEngine(), dataPlugin.getAccessRules());
            funcs.addAll(dp.getRecChilds(dp.getBaseFunction(), true));
        }
    }
    final Vector<UF> res = new Vector<UF>();
    for (int i = 0; i < funcs.size(); i++) {
        addFunction(row, (Function) funcs.get(i), res);
    }
    if (res.size() > 0) {
        htmlStream.println("<p><table width=100% border=1>");
        printMainTableTitle(RES.getString("UseInFunctions"), 3);
        htmlStream.print("<tr>");
        htmlStream.print("<td><b>");
        htmlStream.print(RES.getString("kod"));
        htmlStream.print("</b></td>");
        htmlStream.print("<td width=100%><b>");
        htmlStream.print(RES.getString("FunctionName"));
        htmlStream.print("</b></td>");
        htmlStream.print("<td><b>");
        htmlStream.print(RES.getString("Type"));
        htmlStream.print("</b></td>");
        htmlStream.println("</tr>");
        for (int i = 0; i < res.size(); i++) {
            final UF uf = res.get(i);
            htmlStream.println("<tr>");
            htmlStream.print("<td>");
            printStartATeg("rows/index.html?id=" + uf.function.getGlobalId().toString());
            htmlStream.print(MovingFunction.getIDEF0Kod((com.ramussoft.database.common.Row) uf.function));
            htmlStream.print("</td>");
            htmlStream.print("<td width=100%>");
            printStartATeg("rows/index.html?id=" + uf.function.getGlobalId().toString());
            htmlStream.print(uf.function.getName());
            htmlStream.print("</td>");
            htmlStream.print("<td>");
            switch(uf.type) {
                case MovingPanel.RIGHT:
                    htmlStream.print(RES.getString("RightElements"));
                    break;
                case MovingPanel.LEFT:
                    htmlStream.print(RES.getString("LeftElements"));
                    break;
                case MovingPanel.TOP:
                    htmlStream.print(RES.getString("TopElements"));
                    break;
                case MovingPanel.BOTTOM:
                    htmlStream.print(RES.getString("BottomElements"));
                    break;
            }
            htmlStream.print("</td>");
            htmlStream.println("</tr>");
        }
        htmlStream.println("</table></p>");
    }
}
Also used : Qualifier(com.ramussoft.common.Qualifier) Row(com.ramussoft.pb.Row) NRow(com.ramussoft.pb.data.negine.NRow) DataPlugin(com.ramussoft.pb.DataPlugin) AbstractDataPlugin(com.ramussoft.pb.data.AbstractDataPlugin) Vector(java.util.Vector)

Example 30 with Row

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

the class HTTPParser method getRecIDEF0Kod.

private static String getRecIDEF0Kod(final Row function) {
    final Row f = function.getParentRow();
    if (f == null || f.getParent() == null)
        return "";
    String id = Integer.toString(function.getId());
    if (id.length() > 1)
        id = "." + id + ".";
    return getRecIDEF0Kod(f) + id;
}
Also used : Row(com.ramussoft.pb.Row) NRow(com.ramussoft.pb.data.negine.NRow)

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