Package org.activiti.bpmn.model

Examples of org.activiti.bpmn.model.Lane


    model.getBpmnModel().getPools().add(newPool);
    model.getBpmnModel().addProcess(newProcess);

    PictogramElement poolElement = addGraphicalRepresentation(context, newPool);

    Lane lane = new Lane();
    lane.setId(getNextId(lane, "lane"));
    lane.setParentProcess(newProcess);
    newProcess.getLanes().add(lane);

    AddContext laneContext = new AddContext(new AreaContext(), lane);
    IAddFeature addFeature = getFeatureProvider().getAddFeature(laneContext);
    laneContext.setNewObject(lane);
View Full Code Here


  }

  protected void deleteBusinessObject(Object bo) {
    if (bo instanceof Lane) {
      Bpmn2MemoryModel model = ModelHandler.getModel(EcoreUtil.getURI(getDiagram()));
      Lane lane = (Lane) bo;
     
      Pool parentPool = null;
      for (Pool pool : model.getBpmnModel().getPools()) {
        if(pool.getProcessRef().equalsIgnoreCase(lane.getParentProcess().getId())) {
          parentPool = pool;
          break;
        }
      }
     
      Process laneProcess = model.getBpmnModel().getProcess(parentPool.getId());
     
      if (parentPool == null || laneProcess == null) return;
     
      if(laneProcess.getLanes().size() == 1) {
        Process process = model.getBpmnModel().getProcess(parentPool.getId());
        model.getBpmnModel().getProcesses().remove(process);
        model.getBpmnModel().getPools().remove(parentPool);
        PictogramElement poolElement = getFeatureProvider().getPictogramElementForBusinessObject(parentPool);
        IRemoveContext poolRc = new RemoveContext(poolElement);
        IRemoveFeature poolRemoveFeature = getFeatureProvider().getRemoveFeature(poolRc);
        if (poolRemoveFeature != null) {
          poolRemoveFeature.remove(poolRc);
        }
       
      } else {
        Shape poolShape = (Shape) getFeatureProvider().getPictogramElementForBusinessObject(parentPool);
        ResizeShapeContext resizeContext = new ResizeShapeContext(poolShape);
        resizeContext.setSize(poolShape.getGraphicsAlgorithm().getWidth(), poolShape.getGraphicsAlgorithm().getHeight() - laneHeight);
        resizeContext.setLocation(poolShape.getGraphicsAlgorithm().getX(), poolShape.getGraphicsAlgorithm().getY());
        resizeContext.setDirection(ResizeShapeContext.DIRECTION_NORTH);
        resizeContext.putProperty("org.activiti.designer.lane.create", true);
        getFeatureProvider().getResizeShapeFeature(resizeContext).execute(resizeContext);
      }
     
      for (Lane otherLane : lane.getParentProcess().getLanes()) {
        if(otherLane.equals(lane)) continue;
       
        Shape otherLaneShape = (Shape) getFeatureProvider().getPictogramElementForBusinessObject(otherLane);
        if(otherLaneShape.getGraphicsAlgorithm().getY() > laneY) {
          otherLaneShape.getGraphicsAlgorithm().setY(otherLaneShape.getGraphicsAlgorithm().getY() - laneHeight);
        }
      }
     
      List<FlowElement> toDeleteElements = new ArrayList<FlowElement>();
      for (String flowRef : lane.getFlowReferences()) {
        for (FlowElement flowElement : lane.getParentProcess().getFlowElements()) {
          if(flowRef.equalsIgnoreCase(flowElement.getId())) {
            toDeleteElements.add(flowElement);
          }
        }
      }
      for (FlowElement subFlowElement : toDeleteElements) {
        if(subFlowElement instanceof FlowNode) {
          deleteSequenceFlows((FlowNode) subFlowElement);
        }
        removeElement(subFlowElement);
      }
      lane.getParentProcess().getLanes().remove(lane);
    }
  }
View Full Code Here

          subProcess.removeFlowElement(event.getId());
          for (SequenceFlow flow : event.getOutgoingFlows()) {
            subProcess.removeFlowElement(flow.getId());
          }
        } else if (containerBo instanceof Lane) {
          Lane lane = (Lane) containerBo;
          lane.getFlowReferences().remove(event.getId());
          lane.getParentProcess().removeFlowElement(event.getId());
          for (SequenceFlow flow : event.getOutgoingFlows()) {
            lane.getParentProcess().removeFlowElement(flow.getId());
          }
        }
      } else {
        model.getBpmnModel().getMainProcess().removeFlowElement(event.getId());
        for (SequenceFlow flow : event.getOutgoingFlows()) {
          model.getBpmnModel().getMainProcess().removeFlowElement(flow.getId());
        }
      }
     
      if (context.getTargetContainer() instanceof Diagram == false) {
        Object containerBo = getFeatureProvider().getBusinessObjectForPictogramElement(context.getTargetContainer());
        if (containerBo instanceof SubProcess) {
          SubProcess subProcess = (SubProcess) containerBo;
          subProcess.addFlowElement(event);
          for (SequenceFlow flow : event.getOutgoingFlows()) {
            subProcess.addFlowElement(flow);
          }
        } else if (containerBo instanceof Lane) {
          Lane lane = (Lane) containerBo;
          lane.getFlowReferences().add(event.getId());
          lane.getParentProcess().addFlowElement(event);
          for (SequenceFlow flow : event.getOutgoingFlows()) {
            lane.getParentProcess().addFlowElement(flow);
          }
        }
      } else {
        model.getBpmnModel().getMainProcess().addFlowElement(event);
        for (SequenceFlow flow : event.getOutgoingFlows()) {
View Full Code Here

  }

  @Override
  public PictogramElement add(IAddContext context) {

    final Lane addedLane = (Lane) context.getNewObject();
    final ContainerShape parent = context.getTargetContainer();

    // CONTAINER SHAPE WITH ROUNDED RECTANGLE
    final IPeCreateService peCreateService = Graphiti.getPeCreateService();
    final ContainerShape containerShape = peCreateService.createContainerShape(parent, true);

    int x = context.getX();
    int y = context.getY();
    int width = context.getWidth();
    int height = context.getHeight();

    final IGaService gaService = Graphiti.getGaService();
    {
      // create invisible outer rectangle expanded by
      // the width needed for the anchor
      final Rectangle invisibleRectangle = gaService.createInvisibleRectangle(containerShape);
      gaService.setLocationAndSize(invisibleRectangle, x, y, width, height);

      // create and set visible rectangle inside invisible rectangle
      Rectangle rectangle = gaService.createRectangle(invisibleRectangle);
      rectangle.setParentGraphicsAlgorithm(invisibleRectangle);
      rectangle.setStyle(StyleUtil.getStyleForPool(getDiagram()));
      gaService.setLocationAndSize(rectangle, 0, 0, width, height);

      // create link and wire it
      link(containerShape, addedLane);
    }

    // SHAPE WITH TEXT
    {
      // create shape for text
      final Shape shape = peCreateService.createShape(containerShape, false);

      // create and set text graphics algorithm
      final Text text = gaService.createDefaultText(getDiagram(), shape, addedLane.getName());
      text.setStyle(StyleUtil.getStyleForEvent(getDiagram()));
      text.setHorizontalAlignment(Orientation.ALIGNMENT_CENTER);
      gaService.setLocationAndSize(text, 0, 0, 20, height);
      text.setAngle(-90);
      Font font = null;
View Full Code Here

            model.getProcesses().add(process);
            activeProcess = process; 
          }
         
        } else if ("lane".equalsIgnoreCase(xtr.getLocalName())) {
          Lane lane = new Lane();
          lane.setId(xtr.getAttributeValue(null, ATTRIBUTE_ID));
          lane.setName(xtr.getAttributeValue(null, ATTRIBUTE_NAME));
          lane.setParentProcess(activeProcess);
          activeProcess.getLanes().add(lane);
         
          while (xtr.hasNext()) {
            xtr.next();
            if (xtr.isStartElement() && "flowNodeRef".equalsIgnoreCase(xtr.getLocalName())) {
              lane.getFlowReferences().add(xtr.getElementText());
            } else if(xtr.isEndElement() && "lane".equalsIgnoreCase(xtr.getLocalName())) {
              break;
            }
          }
         
View Full Code Here

        } else {
          addFlowNodeOrArtifact(baseElement, (SubProcess) parent);
        }
       
      } else if (parent instanceof Lane) {
        final Lane lane = (Lane) parent;
       
        // for flow elements, the lane gets informed about the flow elements Id
        if (baseElement instanceof FlowElement)
        {
          final FlowElement flowElement = (FlowElement) baseElement;
          lane.getFlowReferences().add(flowElement.getId());
        }
 
        addFlowNodeOrArtifact(baseElement, lane.getParentProcess());
       
      } else if (parent instanceof Activity) {
        ContainerShape parentContainer = targetContainer.getContainer();
        addBaseElementToContainer(parentContainer, baseElement);
      }
View Full Code Here

    }
    return result;
  }

  private ContainerShape getParentContainer(String flowElementId, Process process, Diagram diagram) {
    Lane foundLane = null;
    for (Lane lane : process.getLanes()) {
      if (lane.getFlowReferences().contains(flowElementId)) {
        foundLane = lane;
        break;
      }
View Full Code Here

          subProcess.removeFlowElement(gateway.getId());
          for (SequenceFlow flow : gateway.getOutgoingFlows()) {
            subProcess.removeFlowElement(flow.getId());
          }
        } else if (containerBo instanceof Lane) {
          Lane lane = (Lane) containerBo;
          lane.getFlowReferences().remove(gateway.getId());
          lane.getParentProcess().removeFlowElement(gateway.getId());
          for (SequenceFlow flow : gateway.getOutgoingFlows()) {
            lane.getParentProcess().removeFlowElement(flow.getId());
          }
        }
      } else {
        model.getBpmnModel().getMainProcess().removeFlowElement(gateway.getId());
        for (SequenceFlow flow : gateway.getOutgoingFlows()) {
          model.getBpmnModel().getMainProcess().removeFlowElement(flow.getId());
        }
      }
     
      if (context.getTargetContainer() instanceof Diagram == false) {
        Object containerBo = getFeatureProvider().getBusinessObjectForPictogramElement(context.getTargetContainer());
        if (containerBo instanceof SubProcess) {
          SubProcess subProcess = (SubProcess) containerBo;
          subProcess.addFlowElement(gateway);
          for (SequenceFlow flow : gateway.getOutgoingFlows()) {
            subProcess.addFlowElement(flow);
          }
        } else if (containerBo instanceof Lane) {
          Lane lane = (Lane) containerBo;
          lane.getFlowReferences().add(gateway.getId());
          lane.getParentProcess().addFlowElement(gateway);
          for (SequenceFlow flow : gateway.getOutgoingFlows()) {
            lane.getParentProcess().addFlowElement(flow);
          }
        }
      } else {
        model.getBpmnModel().getMainProcess().addFlowElement(gateway);
        for (SequenceFlow flow : gateway.getOutgoingFlows()) {
View Full Code Here

    Object parentObject = getBusinessObjectForPictogramElement(context.getTargetContainer());
    if (parentObject instanceof SubProcess) {
      ((SubProcess) parentObject).addFlowElement(newUserTask);
     
    } else if (parentObject instanceof Lane) {
      final Lane lane = (Lane) parentObject;
      lane.getFlowReferences().add(newUserTask.getId());
      lane.getParentProcess().addFlowElement(newUserTask);
     
    } else {
      Bpmn2MemoryModel model = ModelHandler.getModel(EcoreUtil.getURI(getDiagram()));
      if (model.getBpmnModel().getMainProcess() == null) {
        model.addMainProcess();
View Full Code Here

    Object parentObject = getBusinessObjectForPictogramElement(context.getTargetContainer());
    if (parentObject instanceof SubProcess) {
      ((SubProcess) parentObject).addFlowElement(startEvent);
     
    } else if (parentObject instanceof Lane) {
      final Lane lane = (Lane) parentObject;
      lane.getFlowReferences().add(startEvent.getId());
      lane.getParentProcess().addFlowElement(startEvent);
     
    } else {
      Bpmn2MemoryModel model = ModelHandler.getModel(EcoreUtil.getURI(getDiagram()));
      if (model.getBpmnModel().getMainProcess() == null) {
        model.addMainProcess();
View Full Code Here

TOP

Related Classes of org.activiti.bpmn.model.Lane

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.