/** * @param reversedMode * @param editpart */ private static void relocateNode(final Rectangle location, EditPart editpart) { GraphicalEditPart gEditpart = (GraphicalEditPart) editpart; if (editpart instanceof org.wso2.developerstudio.eclipse.gmf.esb.diagram.custom.AbstractMediator) { Rectangle rect = new Rectangle(new Point(), gEditpart.getFigure().getPreferredSize()).getCopy(); Rectangle rectCopy = rect.getCopy(); if (editpart instanceof complexFiguredAbstractMediator) { @SuppressWarnings("rawtypes") List children = gEditpart.getChildren(); int pointY = 50; for (Object child : children) { if (child instanceof AbstractOutputConnectorEditPart) { EsbConnector connector = (EsbConnector) ((Node) ((EditPart) child).getModel()).getElement(); Rectangle point = currentLocation.get(connector); if (point != null) { rectCopy.width = Math.max(rectCopy.width, point.x + 50); pointY += (point.y + point.height) + 20; rectCopy.height = Math.max(rectCopy.height, pointY); } if (((complexFiguredAbstractMediator) editpart).reversed) { rect.width += 50; // no effect on width } } } } rect.x = location.x; rect.y = location.y; SetBoundsCommand sbc = new SetBoundsCommand( gEditpart.getEditingDomain(), "change location", new EObjectAdapter((View) editpart.getModel()), rect); nodeBounds.put((EsbNode) ((View) editpart.getModel()).getElement(), rect.getCopy()); gEditpart.getDiagramEditDomain().getDiagramCommandStack().execute(new ICommandProxy(sbc)); location.x = location.x + rectCopy.width + 40; location.height = Math.max(location.height, rectCopy.height); } }
private static void relocateFlow(EsbConnector connector, LinkedList<EsbNode> nodeList) { if (!currentLocation.containsKey(connector)) { currentLocation.put(connector, new Rectangle(25, getInitialY(connector, nodeList), 0, 0)); } Rectangle point = currentLocation.get(connector); Iterator<EsbNode> iterator = getNodeIterator(nodeList); int count = 0; while (iterator.hasNext()) { EsbNode mediatornode = iterator.next(); EditPart editpart = getEditpart(mediatornode); if (++count == 1) { startNodes.add(editpart); } relocateNode(point, editpart); } EsbConnector pairConnector = pairMediatorFlowMap.get(connector); if (pairConnector != null) { currentLocation.put(pairConnector, new Rectangle(25, Math.max(200, point.height + 30), 0, 0)); } }