Skip to content

Commit 1ce4b49

Browse files
committed
impl
Issue #77
1 parent f864042 commit 1ce4b49

2 files changed

Lines changed: 147 additions & 131 deletions

File tree

open-bpmn.glsp-server/src/main/java/org/openbpmn/glsp/elements/pool/PoolNodeBuilder.java

Lines changed: 32 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717

1818
import java.util.HashMap;
1919
import java.util.Map;
20+
import java.util.logging.Logger;
2021

2122
import org.eclipse.glsp.graph.GCompartment;
2223
import org.eclipse.glsp.graph.GLabel;
@@ -25,31 +26,57 @@
2526
import org.eclipse.glsp.graph.builder.impl.GLabelBuilder;
2627
import org.eclipse.glsp.graph.builder.impl.GLayoutOptions;
2728
import org.eclipse.glsp.graph.util.GConstants;
29+
import org.eclipse.glsp.graph.util.GraphUtil;
2830
import org.openbpmn.bpmn.BPMNTypes;
31+
import org.openbpmn.bpmn.elements.BPMNBounds;
2932
import org.openbpmn.bpmn.elements.BPMNParticipant;
33+
import org.openbpmn.bpmn.exceptions.BPMNMissingElementException;
3034
import org.openbpmn.glsp.bpmn.BpmnFactory;
3135
import org.openbpmn.glsp.bpmn.Pool;
3236
import org.openbpmn.glsp.utils.ModelTypes;
37+
import org.openbpmn.model.BPMNGModelFactory;
3338

3439
/**
3540
* BPMN 2.0 Pool Element.
3641
* <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.
3945
*
4046
* @author rsoika
4147
*/
4248
public class PoolNodeBuilder extends AbstractGNodeBuilder<Pool, PoolNodeBuilder> {
49+
50+
private static Logger logger = Logger.getLogger(BPMNGModelFactory.class.getName());
51+
4352
private String name;
4453

4554
private static final String V_GRAB = "vGrab";
4655
private static final String H_GRAB = "hGrab";
4756
private static final String H_ALIGN = "hAlign";
4857

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) {
5066
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
5380
this.addCssClass(type);
5481
}
5582

0 commit comments

Comments
 (0)