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
}
}
}
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);
}
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);
}
Aggregations