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

Commit

Permalink
Pool, lane and sub process resize and move fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
tijsrademakers committed Aug 9, 2015
1 parent 80486ba commit ff0e37b
Show file tree
Hide file tree
Showing 11 changed files with 363 additions and 89 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -520,7 +520,7 @@ protected void doExecute() {

for (Process process : model.getBpmnModel().getProcesses()) {
drawFlowElements(process.getFlowElements(), model.getBpmnModel().getLocationMap(), diagram, process);
drawArtifacts(process.getArtifacts(), model.getBpmnModel().getLocationMap(), diagram, process);
drawArtifacts(process, model.getBpmnModel().getLocationMap(), diagram, process);
}
drawAllFlows(model);
drawMessageFlows(model.getBpmnModel().getMessageFlows().values(), model);
Expand Down Expand Up @@ -561,6 +561,7 @@ private PictogramElement addContainerElement(BaseElement element, BpmnMemoryMode
return pictElement;
}

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

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

private void drawMessageFlows(final Collection<MessageFlow> messageFlows, final BpmnMemoryModel model) {
protected void drawMessageFlows(final Collection<MessageFlow> messageFlows, final BpmnMemoryModel model) {

for (final MessageFlow messageFlow : messageFlows) {

Expand Down Expand Up @@ -833,13 +834,13 @@ private void drawMessageFlows(final Collection<MessageFlow> messageFlows, final
}
}

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

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

final List<Artifact> artifactsWithoutDI = new ArrayList<Artifact>();
for (final Artifact artifact : artifacts) {
for (final Artifact artifact : container.getArtifacts()) {

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

ContainerShape parentContainer = null;
if (parent instanceof Diagram) {
parentContainer = getParentContainer(artifact.getId(), process, (Diagram) parent);
FlowElement connectingElement = null;
for (final Artifact associationArtifact : container.getArtifacts()) {
if (associationArtifact instanceof Association) {
Association association = (Association) associationArtifact;

if (association.getSourceRef().equals(artifact.getId())) {
connectingElement = container.getFlowElement(association.getTargetRef());

} else if (association.getTargetRef().equals(artifact.getId())) {
connectingElement = container.getFlowElement(association.getSourceRef());
}
}
}

if (connectingElement != null) {
parentContainer = getParentContainer(connectingElement.getId(), process, (Diagram) parent);
} else {
parentContainer = parent;
}
} else {
parentContainer = parent;
}
Expand All @@ -884,11 +903,18 @@ private void drawArtifacts(final Collection<Artifact> artifacts, final Map<Strin
}

for (final Artifact artifact : artifactsWithoutDI) {
artifacts.remove(artifact);
container.getArtifacts().remove(artifact);
}

for (FlowElement flowElement : container.getFlowElements()) {
if (flowElement instanceof SubProcess) {
ContainerShape subProcessShape = (ContainerShape) featureProvider.getPictogramElementForBusinessObject(flowElement);
drawArtifacts((SubProcess) flowElement, locationMap, subProcessShape, process);
}
}
}

private void drawAllFlows(BpmnMemoryModel model) {
protected void drawAllFlows(BpmnMemoryModel model) {
BpmnModel bpmnModel = model.getBpmnModel();

for (Process process : bpmnModel.getProcesses()) {
Expand All @@ -897,7 +923,7 @@ private void drawAllFlows(BpmnMemoryModel model) {
}
}

private void drawSequenceFlowsInList(Collection<FlowElement> flowList, BpmnMemoryModel model) {
protected void drawSequenceFlowsInList(Collection<FlowElement> flowList, BpmnMemoryModel model) {
for (FlowElement flowElement : flowList) {

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

private void drawSequenceFlow(SequenceFlow sequenceFlow, BpmnMemoryModel model) {
protected void drawSequenceFlow(SequenceFlow sequenceFlow, BpmnMemoryModel model) {
Anchor sourceAnchor = null;
Anchor targetAnchor = null;
ContainerShape sourceShape = (ContainerShape) getDiagramTypeProvider().getFeatureProvider().getPictogramElementForBusinessObject(
Expand Down Expand Up @@ -964,7 +990,7 @@ private void drawSequenceFlow(SequenceFlow sequenceFlow, BpmnMemoryModel model)
getDiagramTypeProvider().getFeatureProvider().addIfPossible(addContext);
}

private void drawAssociationsInList(Collection<Artifact> artifactList, BpmnMemoryModel model) {
protected void drawAssociationsInList(Collection<Artifact> artifactList, BpmnMemoryModel model) {
for (Artifact artifact : artifactList) {

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

private void drawAssociation(Association association, BpmnMemoryModel model) {

protected void drawAssociation(Association association, BpmnMemoryModel model) {
Anchor sourceAnchor = null;
Anchor targetAnchor = null;
BaseElement sourceElement = model.getFlowElement(association.getSourceRef());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -134,8 +134,8 @@ public PictogramElement createShape(Object businessObject, ContainerShape layout
if(bendpointList != null && bendpointList.size() >= 0) {
for (GraphicInfo graphicInfo : bendpointList) {
Point bendPoint = StylesFactory.eINSTANCE.createPoint();
bendPoint.setX((int)graphicInfo.getX());
bendPoint.setY((int)graphicInfo.getY());
bendPoint.setX((int) graphicInfo.getX());
bendPoint.setY((int) graphicInfo.getY());
connection.getBendpoints().add(bendPoint);
}

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

boolean subProcessWithBendPoint = false;
if(sourceElement instanceof SubProcess) {
if (sourceElement instanceof SubProcess) {
int middleSub = sourceGraphics.getY() + (sourceGraphics.getHeight() / 2);
if((middleSub + 20) < targetGraphics.getY() || (middleSub - 20) > targetGraphics.getY()) {
if ((middleSub + 20) < targetGraphics.getY() || (middleSub - 20) > targetGraphics.getY()) {
subProcessWithBendPoint = true;
}
}

if(sourceElement instanceof SubProcess == false || subProcessWithBendPoint == true) {
if (sourceElement instanceof SubProcess == false || subProcessWithBendPoint == true) {
Point bendPoint = StylesFactory.eINSTANCE.createPoint();
bendPoint.setX(targetX + 20);
bendPoint.setY(sourceY + (sourceGraphics.getHeight() / 2));
Expand Down
Loading

0 comments on commit ff0e37b

Please sign in to comment.