Search in sources :

Example 6 with Status

use of com.dsoft.pb.idef.elements.Status in project ramus by Vitaliy-Yakovchuk.

the class IDLImporter method addBox.

private void addBox() {
    Function function = getFunction(box.reference);
    int i = box.name.indexOf('}');
    box.function = function;
    function.setName(box.name.substring(i + 1));
    StringTokenizer st = new StringTokenizer(box.name.substring(1, i), " ");
    if (st.hasMoreTokens())
        st.nextElement();
    if (st.hasMoreTokens()) {
        try {
            int font = Integer.parseInt(st.nextToken());
            function.setFont(uniqueFonts.get(font));
        } catch (Exception e) {
        }
    }
    if (st.hasMoreTokens())
        st.nextElement();
    Color bColor = null;
    Color fColor = null;
    if (st.hasMoreTokens()) {
        int tmp = Integer.parseInt(st.nextToken());
        if (tmp < COLORS.length) {
            fColor = COLORS[tmp];
        }
        tmp = Integer.parseInt(st.nextToken());
        if (tmp < COLORS.length) {
            bColor = COLORS[tmp];
        }
    }
    if (bColor != null)
        function.setBackground(bColor);
    if (fColor != null)
        function.setForeground(fColor);
    StringTokenizer tokenizer = new StringTokenizer(box.coordinates, " ()");
    FloatPoint p1 = toPoint(tokenizer.nextToken());
    FloatPoint p2 = toPoint(tokenizer.nextToken());
    FRectangle rectangle = new FRectangle(p1.getX(), p2.getY(), p2.getX() - p1.getX(), p1.getY() - p2.getY());
    function.setBounds(rectangle);
    Status status = new Status(Status.WORKING, "");
    function.setStatus(status);
}
Also used : Status(com.dsoft.pb.idef.elements.Status) Function(com.ramussoft.pb.Function) MovingFunction(com.ramussoft.pb.idef.visual.MovingFunction) StringTokenizer(java.util.StringTokenizer) FloatPoint(com.dsoft.pb.types.FloatPoint) FRectangle(com.dsoft.pb.types.FRectangle) Color(java.awt.Color) Crosspoint(com.ramussoft.pb.Crosspoint) Point(com.ramussoft.pb.idef.elements.Point) FloatPoint(com.dsoft.pb.types.FloatPoint) IOException(java.io.IOException)

Aggregations

Status (com.dsoft.pb.idef.elements.Status)6 FRectangle (com.dsoft.pb.types.FRectangle)2 Function (com.ramussoft.pb.Function)2 MovingFunction (com.ramussoft.pb.idef.visual.MovingFunction)2 IOException (java.io.IOException)2 FloatPoint (com.dsoft.pb.types.FloatPoint)1 Journaled (com.ramussoft.common.journal.Journaled)1 Persistent (com.ramussoft.common.persistent.Persistent)1 SimpleAttributeConverter (com.ramussoft.core.attribute.simple.SimpleAttributeConverter)1 Crosspoint (com.ramussoft.pb.Crosspoint)1 Row (com.ramussoft.pb.Row)1 Stream (com.ramussoft.pb.Stream)1 Point (com.ramussoft.pb.idef.elements.Point)1 Color (java.awt.Color)1 Font (java.awt.Font)1 InputStream (java.io.InputStream)1 InputStreamReader (java.io.InputStreamReader)1 StringTokenizer (java.util.StringTokenizer)1