private void prepareLanes(BPMNElement lane, int level) { maxLaneDepth = Math.max(maxLaneDepth, level); List<BPMNElement> childs = new ArrayList<BPMNElement>(); BPMNElement aChild = null; for (LayoutingElement c : diagram.getChildElementsOf(lane)) { BPMNElement child = (BPMNElement) c; if (BPMNType.isASwimlane(child.getType())) { prepareLanes(child, level + 1); childs.add(child); } aChild = child; } // Create Grid for lane (= // aChild.getParent()) if (aChild != null) { getContextByElement(aChild); } else { // create empty grid for empty lanes // to prevent nullpointer-exception GridContext result = new GridContext(); result.grid = new Grid<BPMNElement>(); result.startCell = result.grid.getFirstRow().getFirstCell(); superGrid.add(result.grid); parent2Context.put(lane, result); } lane2LaneChilds.put(lane, childs); }
/** * @param lane * @param absY * @param level */ private void correctLaneElements(BPMNElement lane, double absY, int level) { List<BPMNElement> childs = lane2LaneChilds.get(lane); double height = 0; for (BPMNElement child : childs) { correctLaneElements(child, absY + height, level + 1); height += child.getGeometry().getHeight(); } int xTrans = level * -LANE_HEAD_WIDTH; for (LayoutingElement content : diagram.getChildElementsOf(lane)) { if (!BPMNType.isASwimlane(content.getType())) { LayoutingBounds geom = content.getGeometry(); content.setGeometry( new LayoutingBoundsImpl( geom.getX() + xTrans, geom.getY() - absY, geom.getWidth(), geom.getHeight())); ((BPMNElement) content).updateDataModel(); } } }