|
17 | 17 |
|
18 | 18 | import java.util.HashMap; |
19 | 19 | import java.util.Map; |
| 20 | +import java.util.logging.Logger; |
20 | 21 |
|
21 | 22 | import org.eclipse.glsp.graph.GCompartment; |
22 | 23 | import org.eclipse.glsp.graph.GLabel; |
|
25 | 26 | import org.eclipse.glsp.graph.builder.impl.GLabelBuilder; |
26 | 27 | import org.eclipse.glsp.graph.builder.impl.GLayoutOptions; |
27 | 28 | import org.eclipse.glsp.graph.util.GConstants; |
| 29 | +import org.eclipse.glsp.graph.util.GraphUtil; |
28 | 30 | import org.openbpmn.bpmn.BPMNTypes; |
| 31 | +import org.openbpmn.bpmn.elements.BPMNBounds; |
29 | 32 | import org.openbpmn.bpmn.elements.BPMNParticipant; |
| 33 | +import org.openbpmn.bpmn.exceptions.BPMNMissingElementException; |
30 | 34 | import org.openbpmn.glsp.bpmn.BpmnFactory; |
31 | 35 | import org.openbpmn.glsp.bpmn.Pool; |
32 | 36 | import org.openbpmn.glsp.utils.ModelTypes; |
| 37 | +import org.openbpmn.model.BPMNGModelFactory; |
33 | 38 |
|
34 | 39 | /** |
35 | 40 | * BPMN 2.0 Pool Element. |
36 | 41 | * <p> |
37 | | - * The method builds a GNode from a BPMNParticipant element. The builder is |
38 | | - * called from the method createGModelFromProcess of the BPMNGModelFactory. |
| 42 | + * The method builds a GNode Pool element from a BPMNParticipant element. The |
| 43 | + * builder is called from the method createGModelFromProcess of the |
| 44 | + * BPMNGModelFactory. |
39 | 45 | * |
40 | 46 | * @author rsoika |
41 | 47 | */ |
42 | 48 | public class PoolNodeBuilder extends AbstractGNodeBuilder<Pool, PoolNodeBuilder> { |
| 49 | + |
| 50 | + private static Logger logger = Logger.getLogger(BPMNGModelFactory.class.getName()); |
| 51 | + |
43 | 52 | private String name; |
44 | 53 |
|
45 | 54 | private static final String V_GRAB = "vGrab"; |
46 | 55 | private static final String H_GRAB = "hGrab"; |
47 | 56 | private static final String H_ALIGN = "hAlign"; |
48 | 57 |
|
49 | | - public PoolNodeBuilder(final String name) { |
| 58 | +// public PoolNodeBuilder(final String name) { |
| 59 | +// super(BPMNTypes.POOL); |
| 60 | +// this.name = name; |
| 61 | +// this.addCssClass("pool"); |
| 62 | +// this.addCssClass(type); |
| 63 | +// } |
| 64 | + |
| 65 | + public PoolNodeBuilder(final BPMNParticipant participant) { |
50 | 66 | super(BPMNTypes.POOL); |
51 | | - this.name = name; |
52 | | - this.addCssClass("pool"); |
| 67 | + this.name = participant.getName(); |
| 68 | + this.id = participant.getId(); |
| 69 | + try { |
| 70 | + BPMNBounds bpmnPoolBounds = participant.getBounds(); |
| 71 | + this.position = GraphUtil.point(bpmnPoolBounds.getPosition().getX(), bpmnPoolBounds.getPosition().getY()); |
| 72 | + this.size = GraphUtil.dimension(bpmnPoolBounds.getDimension().getWidth(), |
| 73 | + bpmnPoolBounds.getDimension().getHeight()); |
| 74 | + } catch (BPMNMissingElementException e) { |
| 75 | + // should not happen |
| 76 | + logger.severe("BPMNParticipant does not support a BPMNBounds object!"); |
| 77 | + } |
| 78 | + |
| 79 | + // set css style |
53 | 80 | this.addCssClass(type); |
54 | 81 | } |
55 | 82 |
|
|
0 commit comments