@Override public void tryToCreateRelationshipAt(ERelationshipKind relationKind, int screenX, int screenY) throws Exception { for (IAsmElementUmlInteractive<ClassFull<ClassUml>, DRI, SD, PRI> asmClassUml : asmListAsmClassesFull.getListElementsUml()) { if (asmClassUml.isContainsScreenPoint(screenX, screenY)) { double realX = UtilsGraphMath.toRealX(getHolderApp().getSettingsGraphicUml(), screenX); double realY = UtilsGraphMath.toRealY(getHolderApp().getSettingsGraphicUml(), screenY); IAsmElementUmlInteractive< RelationshipBinary< RectangleRelationship<ClassFull<ClassUml>, ClassUml>, ClassFull<ClassUml>, ClassUml>, DRI, SD, PRI> asmRelUml = factoryAsmRelationshipBinaryClass.createAsmElementUml(); asmRelUml.getElementUml().setKind(relationKind); asmRelUml.getElementUml().getShapeRelationshipStart().setEndType(ERelationshipEndType.END); asmRelUml .getElementUml() .getShapeRelationshipStart() .setShapeFull(asmClassUml.getElementUml()); UtilsRectangleRelationship.setPointJointAt( asmRelUml.getElementUml().getShapeRelationshipStart(), getGuiApp().getSettingsGraphicUml(), screenX, screenY); asmRelUml .getElementUml() .getShapeRelationshipEnd() .getPointJoint() .setX(realX + getHolderApp().getSettingsGraphicUml().fromInchToCurrentMeasure(1)); asmRelUml.getElementUml().getShapeRelationshipEnd().getPointJoint().setY(realY); asmClassUml .getElementUml() .getRelationshipsBinary() .add( new ClassRelationFull<ClassUml>( asmRelUml.getElementUml().getShapeRelationshipStart(), asmRelUml.getElementUml())); makeElementSelected(asmRelUml); tryToAddIntoContainer(asmRelUml, screenX, screenY); asmListAsmRelationshipsBinaryClass.addElementUml(asmRelUml); setIsChanged(true); getDiagramUml().setIsAbleToChangeByDoclet(false); refreshGui(); break; } } }
@Override public void createClassAt(EClassKind classKind, int screenX, int screenY) throws Exception { IAsmElementUmlInteractive<ClassFull<ClassUml>, DRI, SD, PRI> asmClassUml = factoryAsmClassFull.createAsmElementUml(); asmClassUml.getElementUml().getShape().setClassKind(classKind); asmClassUml .getElementUml() .getShape() .setPointStart( new Point2D( UtilsGraphMath.toRealX(getHolderApp().getSettingsGraphicUml(), screenX), UtilsGraphMath.toRealY(getHolderApp().getSettingsGraphicUml(), screenY))); makeElementSelected(asmClassUml); tryToAddIntoContainer(asmClassUml, screenX, screenY); asmListAsmClassesFull.addElementUml(asmClassUml); getDiagramUml().setIsAbleToChangeByDoclet(false); asmClassUml.startEdit(); setIsChanged(true); refreshGui(); }