Skip to content
This repository was archived by the owner on Jan 13, 2021. It is now read-only.

Commit ff0e37b

Browse files
Pool, lane and sub process resize and move fixes
1 parent 80486ba commit ff0e37b

File tree

11 files changed

+363
-89
lines changed

11 files changed

+363
-89
lines changed

org.activiti.designer.eclipse/src/main/java/org/activiti/designer/eclipse/editor/ActivitiDiagramEditor.java

Lines changed: 38 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -520,7 +520,7 @@ protected void doExecute() {
520520

521521
for (Process process : model.getBpmnModel().getProcesses()) {
522522
drawFlowElements(process.getFlowElements(), model.getBpmnModel().getLocationMap(), diagram, process);
523-
drawArtifacts(process.getArtifacts(), model.getBpmnModel().getLocationMap(), diagram, process);
523+
drawArtifacts(process, model.getBpmnModel().getLocationMap(), diagram, process);
524524
}
525525
drawAllFlows(model);
526526
drawMessageFlows(model.getBpmnModel().getMessageFlows().values(), model);
@@ -561,6 +561,7 @@ private PictogramElement addContainerElement(BaseElement element, BpmnMemoryMode
561561
return pictElement;
562562
}
563563

564+
@SuppressWarnings({ "rawtypes", "unchecked" })
564565
protected void drawFlowElements(Collection<FlowElement> elementList, Map<String, GraphicInfo> locationMap, ContainerShape parentShape, Process process) {
565566

566567
final IFeatureProvider featureProvider = getDiagramTypeProvider().getFeatureProvider();
@@ -778,7 +779,7 @@ protected Point getLocation(ContainerShape containerShape) {
778779
return new Point(location.x + containerShape.getGraphicsAlgorithm().getX(), location.y + containerShape.getGraphicsAlgorithm().getY());
779780
}
780781

781-
private void drawMessageFlows(final Collection<MessageFlow> messageFlows, final BpmnMemoryModel model) {
782+
protected void drawMessageFlows(final Collection<MessageFlow> messageFlows, final BpmnMemoryModel model) {
782783

783784
for (final MessageFlow messageFlow : messageFlows) {
784785

@@ -833,13 +834,13 @@ private void drawMessageFlows(final Collection<MessageFlow> messageFlows, final
833834
}
834835
}
835836

836-
private void drawArtifacts(final Collection<Artifact> artifacts, final Map<String, GraphicInfo> locationMap, final ContainerShape parent,
837-
final Process process) {
837+
protected void drawArtifacts(final FlowElementsContainer container, final Map<String, GraphicInfo> locationMap,
838+
final ContainerShape parent, final Process process) {
838839

839840
final IFeatureProvider featureProvider = getDiagramTypeProvider().getFeatureProvider();
840841

841842
final List<Artifact> artifactsWithoutDI = new ArrayList<Artifact>();
842-
for (final Artifact artifact : artifacts) {
843+
for (final Artifact artifact : container.getArtifacts()) {
843844

844845
if (artifact instanceof Association) {
845846
continue;
@@ -862,7 +863,25 @@ private void drawArtifacts(final Collection<Artifact> artifacts, final Map<Strin
862863

863864
ContainerShape parentContainer = null;
864865
if (parent instanceof Diagram) {
865-
parentContainer = getParentContainer(artifact.getId(), process, (Diagram) parent);
866+
FlowElement connectingElement = null;
867+
for (final Artifact associationArtifact : container.getArtifacts()) {
868+
if (associationArtifact instanceof Association) {
869+
Association association = (Association) associationArtifact;
870+
871+
if (association.getSourceRef().equals(artifact.getId())) {
872+
connectingElement = container.getFlowElement(association.getTargetRef());
873+
874+
} else if (association.getTargetRef().equals(artifact.getId())) {
875+
connectingElement = container.getFlowElement(association.getSourceRef());
876+
}
877+
}
878+
}
879+
880+
if (connectingElement != null) {
881+
parentContainer = getParentContainer(connectingElement.getId(), process, (Diagram) parent);
882+
} else {
883+
parentContainer = parent;
884+
}
866885
} else {
867886
parentContainer = parent;
868887
}
@@ -884,11 +903,18 @@ private void drawArtifacts(final Collection<Artifact> artifacts, final Map<Strin
884903
}
885904

886905
for (final Artifact artifact : artifactsWithoutDI) {
887-
artifacts.remove(artifact);
906+
container.getArtifacts().remove(artifact);
907+
}
908+
909+
for (FlowElement flowElement : container.getFlowElements()) {
910+
if (flowElement instanceof SubProcess) {
911+
ContainerShape subProcessShape = (ContainerShape) featureProvider.getPictogramElementForBusinessObject(flowElement);
912+
drawArtifacts((SubProcess) flowElement, locationMap, subProcessShape, process);
913+
}
888914
}
889915
}
890916

891-
private void drawAllFlows(BpmnMemoryModel model) {
917+
protected void drawAllFlows(BpmnMemoryModel model) {
892918
BpmnModel bpmnModel = model.getBpmnModel();
893919

894920
for (Process process : bpmnModel.getProcesses()) {
@@ -897,7 +923,7 @@ private void drawAllFlows(BpmnMemoryModel model) {
897923
}
898924
}
899925

900-
private void drawSequenceFlowsInList(Collection<FlowElement> flowList, BpmnMemoryModel model) {
926+
protected void drawSequenceFlowsInList(Collection<FlowElement> flowList, BpmnMemoryModel model) {
901927
for (FlowElement flowElement : flowList) {
902928

903929
if (flowElement instanceof SubProcess) {
@@ -913,7 +939,7 @@ private void drawSequenceFlowsInList(Collection<FlowElement> flowList, BpmnMemor
913939
}
914940
}
915941

916-
private void drawSequenceFlow(SequenceFlow sequenceFlow, BpmnMemoryModel model) {
942+
protected void drawSequenceFlow(SequenceFlow sequenceFlow, BpmnMemoryModel model) {
917943
Anchor sourceAnchor = null;
918944
Anchor targetAnchor = null;
919945
ContainerShape sourceShape = (ContainerShape) getDiagramTypeProvider().getFeatureProvider().getPictogramElementForBusinessObject(
@@ -964,7 +990,7 @@ private void drawSequenceFlow(SequenceFlow sequenceFlow, BpmnMemoryModel model)
964990
getDiagramTypeProvider().getFeatureProvider().addIfPossible(addContext);
965991
}
966992

967-
private void drawAssociationsInList(Collection<Artifact> artifactList, BpmnMemoryModel model) {
993+
protected void drawAssociationsInList(Collection<Artifact> artifactList, BpmnMemoryModel model) {
968994
for (Artifact artifact : artifactList) {
969995

970996
if (artifact instanceof Association == false) {
@@ -976,8 +1002,7 @@ private void drawAssociationsInList(Collection<Artifact> artifactList, BpmnMemor
9761002
}
9771003
}
9781004

979-
private void drawAssociation(Association association, BpmnMemoryModel model) {
980-
1005+
protected void drawAssociation(Association association, BpmnMemoryModel model) {
9811006
Anchor sourceAnchor = null;
9821007
Anchor targetAnchor = null;
9831008
BaseElement sourceElement = model.getFlowElement(association.getSourceRef());

org.activiti.designer.gui/src/main/java/org/activiti/designer/controller/AssociationShapeController.java

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -134,8 +134,8 @@ public PictogramElement createShape(Object businessObject, ContainerShape layout
134134
if(bendpointList != null && bendpointList.size() >= 0) {
135135
for (GraphicInfo graphicInfo : bendpointList) {
136136
Point bendPoint = StylesFactory.eINSTANCE.createPoint();
137-
bendPoint.setX((int)graphicInfo.getX());
138-
bendPoint.setY((int)graphicInfo.getY());
137+
bendPoint.setX((int) graphicInfo.getX());
138+
bendPoint.setY((int) graphicInfo.getY());
139139
connection.getBendpoints().add(bendPoint);
140140
}
141141

@@ -177,14 +177,14 @@ public PictogramElement createShape(Object businessObject, ContainerShape layout
177177
(sourceGraphics.getX() + sourceGraphics.getWidth()) < targetGraphics.getX()) {
178178

179179
boolean subProcessWithBendPoint = false;
180-
if(sourceElement instanceof SubProcess) {
180+
if (sourceElement instanceof SubProcess) {
181181
int middleSub = sourceGraphics.getY() + (sourceGraphics.getHeight() / 2);
182-
if((middleSub + 20) < targetGraphics.getY() || (middleSub - 20) > targetGraphics.getY()) {
182+
if ((middleSub + 20) < targetGraphics.getY() || (middleSub - 20) > targetGraphics.getY()) {
183183
subProcessWithBendPoint = true;
184184
}
185185
}
186186

187-
if(sourceElement instanceof SubProcess == false || subProcessWithBendPoint == true) {
187+
if (sourceElement instanceof SubProcess == false || subProcessWithBendPoint == true) {
188188
Point bendPoint = StylesFactory.eINSTANCE.createPoint();
189189
bendPoint.setX(targetX + 20);
190190
bendPoint.setY(sourceY + (sourceGraphics.getHeight() / 2));

0 commit comments

Comments
 (0)