{ int offset = 0; Rectangle invisible = gaService.createInvisibleRectangle(containerShape); if(addedClass.isToBeDeveloped()){ offset = 20; } gaService.setLocationAndSize(invisible,context.getX(), context.getY(), width, height+offset); link(containerShape, addedClass); } { Shape shape = peCreateService.createShape(containerShape, false); // create and set graphics algorithm Rectangle rectangle = gaService.createRectangle(shape); rectangle.setForeground(manageColor(CLASS_FOREGROUND)); rectangle.setBackground(manageColor(CLASS_BACKGROUND)); rectangle.setLineWidth(2); gaService.setLocationAndSize(rectangle, 0,0,width,height); // create link and wire it link(shape, addedClass); } { if(addedClass.isToBeDeveloped()){ Shape shape = peCreateService.createShape(containerShape, false); int[] diamondXY = new int[] {10,0,20,10,10,20,0,10}; Polygon p = gaService.createPolygon(shape, diamondXY); p.setBackground(manageColor(UNDEV_BACKGROUND)); p.setForeground(manageColor(UNDEV_FOREGROUND)); p.setLineWidth(2); //gaService.setLocationAndSize(p, width/2, height, 10, 10); gaService.setLocation(p, (width/2-10), (height)); link(shape, addedClass); } }
.... for (Shape shape : containerShape.getChildren()){ GraphicsAlgorithm graphicsAlgorithm = shape.getGraphicsAlgorithm(); IGaService gaService = Graphiti.getGaService(); IDimension size = gaService.calculateSize(graphicsAlgorithm); if (containerWidth != size.getWidth()) { if (graphicsAlgorithm instanceof Polyline) { Polyline polyline = (Polyline) graphicsAlgorithm; Point secondPoint = polyline.getPoints().get(1); Point newSecondPoint = gaService.createPoint(containerWidth, secondPoint.getY()); polyline.getPoints().set(1, newSecondPoint); anythingChanged = true; }else if (graphicsAlgorithm instanceof MultiText) { MultiText mt = (MultiText) graphicsAlgorithm; mt.setHeight(containerHeight - DESCRIPTION_OFFSET); mt.setWidth(containerWidth); anythingChanged = true; } else if (graphicsAlgorithm instanceof Rectangle){ Rectangle rt = (Rectangle) graphicsAlgorithm; rt.setHeight(containerHeight - UNDEVELOPED_OFFSET ); rt.setWidth(containerWidth); } else if (graphicsAlgorithm instanceof Polygon){ Polygon pg = (Polygon) graphicsAlgorithm; pg.setX(containerWidth/2); pg.setY(containerHeight - UNDEVELOPED_OFFSET); }else { gaService.setWidth(graphicsAlgorithm, containerWidth); anythingChanged = true; } } } return anythingChanged;