*/
private int createInputsAndOutputs(ContainerShape containerShape,
ProcessingElementInstance pei) {
IPeCreateService peCreateService = Graphiti.getPeCreateService();
IGaService gaService = Graphiti.getGaService();
int inputs = 0;
int outputs = 0;
int x = 0;
int y = 0;
for (ProcessingElementParameter p :
pei.getProcessingElementParameters()) {
Shape shape = peCreateService.createShape(containerShape, true);
Rectangle r = gaService.createRectangle(shape);
r.setStyle(StyleUtil.getStyleForPEPort(getDiagram()));
Text text = gaService.createDefaultText(getDiagram(), r,
p.getName());
text.setStyle(StyleUtil.getStyleForText(getDiagram()));
text.setVerticalAlignment(Orientation.ALIGNMENT_CENTER);
//Put inputs on the left and outputs on the right
if (p instanceof Output) {
x = BOX_WIDTH/2 + 2;
y = PORT_TOP_MARGIN + ((PORT_HEIGHT + 1) * outputs);
outputs ++;
text.setHorizontalAlignment(Orientation.ALIGNMENT_RIGHT);
} else {
y = PORT_TOP_MARGIN + ((PORT_HEIGHT + 1) * inputs);
inputs ++;
text.setHorizontalAlignment(Orientation.ALIGNMENT_LEFT);
}
gaService.setLocationAndSize(r, x, y, (BOX_WIDTH/2) - 2 ,
PORT_HEIGHT);
link(shape, p);
gaService.setLocationAndSize(text, 3, 0, ((BOX_WIDTH/2) -2) - 6,
PORT_TEXT_HEIGHT);
peCreateService.createChopboxAnchor(shape);
}