}
}
}
private List<String> marshallLanes(Lane lane, BPMNPlane plane, JsonGenerator generator, int xOffset, int yOffset, String preProcessingData, Definitions def) throws JsonGenerationException, IOException {
Bounds bounds = ((BPMNShape) findDiagramElement(plane, lane)).getBounds();
List<String> nodeRefIds = new ArrayList<String>();
if(bounds != null) {
generator.writeStartObject();
generator.writeObjectField("resourceId", lane.getId());
Map<String, Object> laneProperties = new LinkedHashMap<String, Object>();
if(lane.getName() != null) {
laneProperties.put("name", unescapeXML(lane.getName()));
} else {
laneProperties.put("name", "");
}
Iterator<FeatureMap.Entry> iter = lane.getAnyAttribute().iterator();
boolean foundBgColor = false;
boolean foundBrColor = false;
boolean foundFontColor = false;
boolean foundSelectable = false;
while(iter.hasNext()) {
FeatureMap.Entry entry = iter.next();
if(entry.getEStructuralFeature().getName().equals("background-color")) {
laneProperties.put("bgcolor", entry.getValue());
foundBgColor = true;
}
if(entry.getEStructuralFeature().getName().equals("border-color")) {
laneProperties.put("bordercolor", entry.getValue());
foundBrColor = true;
}
if(entry.getEStructuralFeature().getName().equals("fontsize")) {
laneProperties.put("fontsize", entry.getValue());
foundBrColor = true;
}
if(entry.getEStructuralFeature().getName().equals("color")) {
laneProperties.put("fontcolor", entry.getValue());
foundFontColor = true;
}
if(entry.getEStructuralFeature().getName().equals("selectable")) {
laneProperties.put("isselectable", entry.getValue());
foundSelectable = true;
}
}
if(!foundBgColor) {
laneProperties.put("bgcolor", defaultBgColor_Swimlanes);
}
if(!foundBrColor) {
laneProperties.put("bordercolor", defaultBrColor);
}
if(!foundFontColor) {
laneProperties.put("fontcolor", defaultFontColor);
}
if(!foundSelectable) {
laneProperties.put("isselectable", "true");
}
marshallProperties(laneProperties, generator);
generator.writeObjectFieldStart("stencil");
generator.writeObjectField("id", "Lane");
generator.writeEndObject();
generator.writeArrayFieldStart("childShapes");
for (FlowElement flowElement: lane.getFlowNodeRefs()) {
nodeRefIds.add(flowElement.getId());
// we dont want an offset here!
marshallFlowElement(flowElement, plane, generator, 0, 0, preProcessingData, def);
}
generator.writeEndArray();
generator.writeArrayFieldStart("outgoing");
generator.writeEndArray();
generator.writeObjectFieldStart("bounds");
generator.writeObjectFieldStart("lowerRight");
generator.writeObjectField("x", bounds.getX() + bounds.getWidth() - xOffset);
generator.writeObjectField("y", bounds.getY() + bounds.getHeight() - yOffset);
generator.writeEndObject();
generator.writeObjectFieldStart("upperLeft");
generator.writeObjectField("x", bounds.getX() - xOffset);
generator.writeObjectField("y", bounds.getY() - yOffset);
generator.writeEndObject();
generator.writeEndObject();
generator.writeEndObject();
} else {
// dont marshall the lane unless it has BPMNDI info (eclipse editor does not generate it for lanes currently.