return null;\r
}\r
\r
- protected void update() {\r
+ protected void fireElementUpdated() {\r
if(listener != null)\r
listener.elementUpdated(this);\r
}\r
if(listener != null)\r
listener.elementRemoved(this);\r
}\r
- \r
\r
}\r
@Override\r
protected void end(IDiagramEditor editor, DragEvent event) {\r
for(IElement element : selection)\r
- if(element instanceof Movable)\r
+ if(element instanceof Movable) {\r
+ System.out.println("move");\r
((Movable)element).move(deltaX, deltaY);\r
+ System.out.println("move ok");\r
+ }\r
selection = null;\r
editor.requestRepaint();\r
}\r
cloudNode.remove();\r
}\r
\r
- @Override\r
protected void update() {\r
//bounds.setFrame(posX-CLOUD_SIZE_X, posY-CLOUD_SIZE_Y, 2.0*CLOUD_SIZE_X, 2.0*CLOUD_SIZE_Y);\r
Path2D path = new Path2D.Double(); \r
}\r
cloudNode.setShape(path);\r
bounds = path.getBounds2D();\r
- super.update();\r
+ fireElementUpdated();\r
}\r
\r
public boolean isRotated() {\r
}\r
\r
protected void updateSceneGraph() {\r
+ System.out.println("update");\r
double x0 = tail.getOrigo().getX();\r
double y0 = tail.getOrigo().getY();\r
double x1 = head.getOrigo().getX();\r
r = Math.sqrt(dx0*dx0 + dy0*dy0);\r
Rectangle2D bounds = new Rectangle2D.Double();\r
tail.getBounds(bounds);\r
+ System.out.println("tail: " + bounds);\r
angle0 = Arcs.nextIntersectingAngle(cx, cy, r, \r
Math.atan2(-dy0, dx0), bounds, angle < 0.0);\r
head.getBounds(bounds);\r
+ System.out.println("head: " + bounds);\r
angle1 = Arcs.nextIntersectingAngle(cx, cy, r, \r
Math.atan2(-dy1, dx1), bounds, angle > 0.0);\r
double extent = angle1-angle0;\r
public void update() {\r
if(arcNode != null)\r
updateSceneGraph();\r
- super.update();\r
+ fireElementUpdated();\r
}\r
\r
@Override\r
public void update() {\r
if(lineNode1 != null)\r
updateSceneGraph();\r
- super.update();\r
+ fireElementUpdated();\r
}\r
\r
@Override\r
return bounds.intersects(x-tolerance, y-tolerance, 2.0*tolerance, 2.0*tolerance);\r
} \r
\r
+ protected abstract void update();\r
+ \r
@Override\r
public void move(double deltaX, double deltaY) {\r
posX += deltaX;\r
update();\r
}\r
\r
- @Override\r
- protected void update() {\r
- Rectangle2D textBounds = FONT.getStringBounds(label, FRC);\r
- textBounds.setFrame(\r
- textBounds.getX()*FONT_SCALE,\r
- textBounds.getY()*FONT_SCALE,\r
- textBounds.getWidth()*FONT_SCALE,\r
- textBounds.getHeight()*FONT_SCALE\r
- );\r
- \r
- textX = posX+getTextDeltaX()-textBounds.getCenterX();\r
- textY = posY+getTextDeltaY()-textBounds.getCenterY();\r
- bounds.setFrame(\r
- posX+getTextDeltaX()-textBounds.getWidth()*0.5-XPADDING,\r
- posY+getTextDeltaY()-textBounds.getHeight()*0.5-YPADDING,\r
- textBounds.getWidth()+XPADDING*2,\r
- textBounds.getHeight()+YPADDING*2\r
- ); \r
+ protected void updateText() {\r
+ Rectangle2D textBounds = FONT.getStringBounds(label, FRC);\r
+ textBounds.setFrame(\r
+ textBounds.getX()*FONT_SCALE,\r
+ textBounds.getY()*FONT_SCALE,\r
+ textBounds.getWidth()*FONT_SCALE,\r
+ textBounds.getHeight()*FONT_SCALE\r
+ );\r
+ \r
+ textX = posX+getTextDeltaX()-textBounds.getCenterX();\r
+ textY = posY+getTextDeltaY()-textBounds.getCenterY();\r
+ bounds.setFrame(\r
+ posX+getTextDeltaX()-textBounds.getWidth()*0.5-XPADDING,\r
+ posY+getTextDeltaY()-textBounds.getHeight()*0.5-YPADDING,\r
+ textBounds.getWidth()+XPADDING*2,\r
+ textBounds.getHeight()+YPADDING*2\r
+ ); \r
+ \r
+ if(textNode != null)\r
+ textNode.init(label, FONT, Color.BLACK, textX, textY, FONT_SCALE);\r
+ }\r
\r
- if(textNode != null)\r
- textNode.init(label, FONT, Color.BLACK, textX, textY, FONT_SCALE);\r
- \r
- super.update();\r
+ protected void update() {\r
+ updateText(); \r
+ fireElementUpdated();\r
}\r
\r
class TextEditingAction implements IAction, ITextListener {\r
path.lineTo(posX+VALVE_SIZE, posY+VALVE_SIZE);\r
path.closePath();\r
valveNode.setShape(path);\r
- super.update();\r
+ updateText();\r
bounds.setFrame(posX-VALVE_SIZE, posY-VALVE_SIZE, 2.0*VALVE_SIZE, 2.0*VALVE_SIZE);\r
+ fireElementUpdated();\r
}\r
\r
@Override\r
valveNode.remove();\r
}\r
\r
- @Override\r
protected void update() {\r
bounds.setFrame(posX-VALVE_SIZE, posY-VALVE_SIZE, 2.0*VALVE_SIZE, 2.0*VALVE_SIZE);\r
Path2D path = new Path2D.Double();\r
path.lineTo(posX+VALVE_SIZE, posY+VALVE_SIZE);\r
path.closePath();\r
valveNode.setShape(path);\r
- super.update();\r
+ fireElementUpdated();\r
}\r
\r
@Override\r