Search in sources :

Example 11 with TextNote

use of com.centurylink.mdw.designer.display.TextNote in project mdw-designer by CenturyLinkCloud.

the class CanvasCommon method paintDraggingAndSelection.

protected void paintDraggingAndSelection(Graphics g) {
    if (dragging && drag_to_create_link) {
        if (selected_obj instanceof Node) {
            g.setColor(Color.GREEN);
            g.drawLine(((Node) selected_obj).x + delta_x, ((Node) selected_obj).y + delta_y, drag_x, drag_y);
        }
    } else if (selected_obj != null) {
        if (selected_obj instanceof Node) {
            drawSelectionBox(g, (Node) selected_obj);
        } else if (selected_obj instanceof Link) {
            drawSelectionBox(g, (Link) selected_obj);
        } else if (selected_obj instanceof SubGraph) {
            drawSelectionBox(g, (SubGraph) selected_obj);
        } else if (selected_obj instanceof Graph) {
            drawSelectionBox(g, (Graph) selected_obj);
        } else if (selected_obj instanceof GraphFragment) {
            drawSelectionBox(g, (GraphFragment) selected_obj);
        } else if (selected_obj instanceof TextNote) {
            drawSelectionBox(g, (TextNote) selected_obj);
        }
    }
    if (useLabelEditor && selected_obj != null) /*&& at_anchor==-2 */
    {
        if (labelEditor.isVisible()) {
            Rectangle rect = labelEditor.getBounds();
            g.drawRect(rect.x - 1, rect.y - 1, rect.width + 2, rect.height + 2);
        } else {
            Label label;
            int lx, ly;
            if (selected_obj instanceof Node) {
            // label = ((Node)selected_obj).label;
            // lx = ((Node)selected_obj).lx;
            // ly = ((Node)selected_obj).ly;
            // g.drawRect(lx-1, ly-1, label.width+2, label.height+2);
            } else if (selected_obj instanceof Link) {
                label = ((Link) selected_obj).label;
                if (label != null) {
                    lx = ((Link) selected_obj).lx;
                    ly = ((Link) selected_obj).ly;
                    g.drawRect(lx - 1, ly - 1, label.width + 2, label.height + 2);
                }
            } else if (selected_obj instanceof TextNote) {
                JTextArea textarea = ((TextNote) selected_obj).textarea;
                lx = ((TextNote) selected_obj).x;
                ly = ((TextNote) selected_obj).y;
                g.drawRect(lx - 1, ly - 1, textarea.getWidth() + 2, textarea.getHeight() + 2);
            }
        // else GraphSegment
        }
    }
}
Also used : Graph(com.centurylink.mdw.designer.display.Graph) SubGraph(com.centurylink.mdw.designer.display.SubGraph) JTextArea(javax.swing.JTextArea) Node(com.centurylink.mdw.designer.display.Node) GraphFragment(com.centurylink.mdw.designer.display.GraphFragment) Rectangle(java.awt.Rectangle) Label(com.centurylink.mdw.designer.display.Label) TextNote(com.centurylink.mdw.designer.display.TextNote) SubGraph(com.centurylink.mdw.designer.display.SubGraph) Link(com.centurylink.mdw.designer.display.Link)

Example 12 with TextNote

use of com.centurylink.mdw.designer.display.TextNote in project mdw-designer by CenturyLinkCloud.

the class CanvasCommon method resizeTextNote.

private void resizeTextNote(int x, int y, Graph main_graph) {
    TextNote selected_note = (TextNote) selected_obj;
    Rectangle rect = new Rectangle(selected_note.x, selected_note.y, selected_note.w, selected_note.h);
    resizeRectangle(rect, x, y, 4);
    selected_note.x = rect.x;
    selected_note.y = rect.y;
    selected_note.w = rect.width;
    selected_note.h = rect.height;
    selected_note.textarea.setBounds(rect.x + 1, rect.y + 1, rect.width - 2, rect.height - 2);
    if (!main_graph.isReadonly())
        main_graph.setDirtyLevel(Graph.GEOCHANGE);
}
Also used : Rectangle(java.awt.Rectangle) TextNote(com.centurylink.mdw.designer.display.TextNote)

Example 13 with TextNote

use of com.centurylink.mdw.designer.display.TextNote in project mdw-designer by CenturyLinkCloud.

the class CanvasCommon method moveTextNote.

protected void moveTextNote(int ex, int ey) {
    TextNote selected_note = (TextNote) selected_obj;
    Graph graph = selected_note.graph;
    int x = selected_note.x;
    int y = selected_note.y;
    int w = selected_note.w;
    int h = selected_note.h;
    x = ex - delta_x;
    y = ey - delta_y;
    if (x < graph.x)
        x = graph.x;
    else if (x + w > graph.x + graph.w)
        x = graph.x + graph.w - w;
    if (y < graph.y)
        y = graph.y;
    else if (y + h > graph.y + graph.h)
        y = graph.y + graph.h - h;
    selected_note.x = x;
    selected_note.y = y;
    if (!graph.isReadonly())
        graph.setDirtyLevel(Graph.GEOCHANGE);
}
Also used : Graph(com.centurylink.mdw.designer.display.Graph) SubGraph(com.centurylink.mdw.designer.display.SubGraph) TextNote(com.centurylink.mdw.designer.display.TextNote)

Aggregations

TextNote (com.centurylink.mdw.designer.display.TextNote)13 SubGraph (com.centurylink.mdw.designer.display.SubGraph)9 Link (com.centurylink.mdw.designer.display.Link)8 Node (com.centurylink.mdw.designer.display.Node)8 Graph (com.centurylink.mdw.designer.display.Graph)5 GraphFragment (com.centurylink.mdw.designer.display.GraphFragment)5 Rectangle (java.awt.Rectangle)3 Label (com.centurylink.mdw.designer.display.Label)1 ProcessInstanceVO (com.centurylink.mdw.model.value.process.ProcessInstanceVO)1 ActivityInstanceVO (com.centurylink.mdw.model.value.work.ActivityInstanceVO)1 Activity (com.centurylink.mdw.plugin.designer.model.Activity)1 ActivityImpl (com.centurylink.mdw.plugin.designer.model.ActivityImpl)1 EmbeddedSubProcess (com.centurylink.mdw.plugin.designer.model.EmbeddedSubProcess)1 Note (com.centurylink.mdw.plugin.designer.model.Note)1 Transition (com.centurylink.mdw.plugin.designer.model.Transition)1 BasicStroke (java.awt.BasicStroke)1 Dimension (java.awt.Dimension)1 Graphics2D (java.awt.Graphics2D)1 Point (java.awt.Point)1 ImageIcon (javax.swing.ImageIcon)1