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); }
private GridContext getContextByElement(BPMNElement el) { BPMNElement elParent = null; if (el != null) { elParent = (BPMNElement) el.getParent(); } GridContext result = parent2Context.get(elParent); if (result == null) { result = new GridContext(); result.grid = new Grid<BPMNElement>(); result.startCell = result.grid.getFirstRow().getFirstCell(); superGrid.add(result.grid); parent2Context.put(elParent, result); } return result; }