Package org.activiti.designer.util.editor

Examples of org.activiti.designer.util.editor.Bpmn2MemoryModel


  }
 
  @Override
  public void refresh() {
    final Bpmn2MemoryModel model = ModelHandler.getModel(EcoreUtil.getURI(getDiagram()));
    if (model == null) {
      return;
    }
   
    Collection<Signal> signalList = model.getBpmnModel().getSignals();
   
    signalEditor.diagramEditor = getDiagramEditor();
    signalEditor.diagram = getDiagram();
    signalEditor.initialize(signalList);
  }
View Full Code Here


    connection.setStart(sourceAnchor);
    connection.setEnd(targetAnchor);
    sourceAnchor.getOutgoingConnections().add(connection);
    targetAnchor.getIncomingConnections().add(connection);

    Bpmn2MemoryModel model = ModelHandler.getModel(EcoreUtil.getURI(getDiagram()));
   
    FlowElement sourceElement = model.getFlowElement(addedSequenceFlow.getSourceRef());
    FlowElement targetElement = model.getFlowElement(addedSequenceFlow.getTargetRef());
   
    GraphicsAlgorithm sourceGraphics = getPictogramElement(sourceElement).getGraphicsAlgorithm();
    GraphicsAlgorithm targetGraphics = getPictogramElement(targetElement).getGraphicsAlgorithm();
   
    List<GraphicInfo> bendpointList = null;
View Full Code Here

  }
 
  @Override
  public void refresh() {
    final Bpmn2MemoryModel model = ModelHandler.getModel(EcoreUtil.getURI(getDiagram()));
    if (model == null) {
      return;
    }
   
    Collection<Message> messageList = model.getBpmnModel().getMessages();
   
    messageEditor.diagramEditor = getDiagramEditor();
    messageEditor.diagram = getDiagram();
    messageEditor.initialize(messageList);
   
View Full Code Here

        final SequenceFlow sequenceFlow = (SequenceFlow) boObject;
       
        getDiagram().getPictogramLinks().remove(pictogramElement.getLink());
        getDiagram().getConnections().remove(pictogramElement);
       
        Bpmn2MemoryModel model = ModelHandler.getModel(EcoreUtil.getURI(getDiagram()));
        FlowNode sourceNode = null;
        String sourceRef = sequenceFlow.getSourceRef();
        if (StringUtils.isNotEmpty(sourceRef)) {
          sourceNode = (FlowNode) model.getBpmnModel().getFlowElement(sourceRef);
        }
       
        FlowNode targetNode = null;
        String targetRef = sequenceFlow.getTargetRef();
        if (StringUtils.isNotEmpty(targetRef)) {
          targetNode = (FlowNode) model.getBpmnModel().getFlowElement(targetRef);
        }
       
        if (sourceNode != null) {
          sourceNode.getOutgoingFlows().remove(sequenceFlow);
        }
       
        if (targetNode != null) {
          targetNode.getIncomingFlows().remove(sequenceFlow);
        }
       
        List<Process> processes = model.getBpmnModel().getProcesses();
        for (Process process : processes) {
          process.removeFlowElement(sequenceFlow.getId());
          removeFlow(sequenceFlow, process);
        }
      }
View Full Code Here

    if (pe != null) {
      Object bo = getBusinessObject(pe);
      if (bo == null)
        return;
     
      final Bpmn2MemoryModel model = ModelHandler.getModel(EcoreUtil.getURI(getDiagram()));
      if (model == null) {
        return;
      }
     
      String messageRef = null;
      if(bo instanceof IntermediateCatchEvent) {
        IntermediateCatchEvent catchEvent = (IntermediateCatchEvent) bo;
        if(catchEvent.getEventDefinitions().get(0) != null) {
          MessageEventDefinition messageDefinition = (MessageEventDefinition) catchEvent.getEventDefinitions().get(0);
          if(StringUtils.isNotEmpty(messageDefinition.getMessageRef())) {
            messageRef = messageDefinition.getMessageRef();
          }
        }
      }
     
      String[] items = new String[model.getBpmnModel().getMessages().size() + 1];
      items[0] = "";
      int counter = 1;
      int selectedCounter = 0;
      for (Message message : model.getBpmnModel().getMessages()) {
        items[counter] = message.getId() + " / " + message.getName();
        if(message.getId().equals(messageRef)) {
          selectedCounter = counter;
        }
        counter++;
View Full Code Here

   
    final ContainerShape targetContainer = (ContainerShape) context.getSourcePictogramElement();
    final ContainerShape parentContainer = targetContainer.getContainer();
   
    if (parentContainer instanceof Diagram) {
      final Bpmn2MemoryModel model = ModelHandler.getModel(EcoreUtil.getURI(getDiagram()));
      if (model.getBpmnModel().getPools().size() > 0) {
        String poolRef = model.getBpmnModel().getPools().get(0).getId();
        model.getBpmnModel().getProcess(poolRef).addArtifact(association);
      } else {
        model.getBpmnModel().getMainProcess().addArtifact(association);
      }
    } else {
      final Object parentBo = getBusinessObjectForPictogramElement(parentContainer);
     
      if (parentBo instanceof SubProcess) {
View Full Code Here

    if (pe != null) {
      Object bo = getBusinessObject(pe);
      if (bo == null)
        return;
     
      final Bpmn2MemoryModel model = ModelHandler.getModel(EcoreUtil.getURI(getDiagram()));
      if (model == null) {
        return;
      }
     
      boolean cancelActivity = ((BoundaryEvent) bo).isCancelActivity();
      if(cancelActivity == false) {
        cancelActivityCombo.select(1);
      } else {
        cancelActivityCombo.select(0);
      }
     
     
      String signalRef = null;
      if(bo instanceof BoundaryEvent) {
        BoundaryEvent boundaryEvent = (BoundaryEvent) bo;
        if(boundaryEvent.getEventDefinitions().get(0) != null) {
          SignalEventDefinition signalDefinition = (SignalEventDefinition) boundaryEvent.getEventDefinitions().get(0);
          if(StringUtils.isNotEmpty(signalDefinition.getSignalRef())) {
            signalRef = signalDefinition.getSignalRef();
          }
        }
      }
     
      String[] items = new String[model.getBpmnModel().getSignals().size() + 1];
      items[0] = "";
      int counter = 1;
      int selectedCounter = 0;
      for (Signal signal : model.getBpmnModel().getSignals()) {
        items[counter] = signal.getId() + " / " + signal.getName();
        if(signal.getId().equals(signalRef)) {
          selectedCounter = counter;
        }
        counter++;
View Full Code Here

  }

  @Override
  public Object[] create(ICreateContext context) {

    Bpmn2MemoryModel model = ModelHandler.getModel(EcoreUtil.getURI(getDiagram()));
    Object parentBo = getFeatureProvider().getBusinessObjectForPictogramElement(context.getTargetContainer());
    Pool parentPool = null;
    if (parentBo instanceof Pool) {
      parentPool = (Pool) parentBo;
    } else {
      Lane lane = (Lane) parentBo;
      for (Pool pool : model.getBpmnModel().getPools()) {
        if (pool.getProcessRef().equals(lane.getParentProcess().getId())) {
          parentPool = pool;
          break;
        }
      }
    }

    if (parentPool == null)
      return null;

    ContainerShape poolShape = (ContainerShape) getFeatureProvider().getPictogramElementForBusinessObject(parentPool);
    Process poolProcess = model.getBpmnModel().getProcess(parentPool.getId());

    if (poolProcess == null)
      return null;

    List<Lane> lanes = poolProcess.getLanes();
View Full Code Here

    super(fp);
  }
 
  @Override
  public void postReconnect(IReconnectionContext context) {
    Bpmn2MemoryModel model = ModelHandler.getModel(EcoreUtil.getURI(getDiagram()));
    Object connectionObject = getFeatureProvider().getBusinessObjectForPictogramElement(context.getConnection());
    if(connectionObject instanceof SequenceFlow == false) return;
   
    SequenceFlow flow = (SequenceFlow) connectionObject;
   
    Object targetObject = getFeatureProvider().getBusinessObjectForPictogramElement(context.getTargetPictogramElement());
    if(targetObject instanceof FlowNode == false) return;
    FlowNode targetElement = (FlowNode) targetObject;
   
    if(ReconnectionContext.RECONNECT_TARGET.equalsIgnoreCase(context.getReconnectType())) {
      List<SequenceFlow> flowList = targetElement.getIncomingFlows();
      boolean found = false;
      for (SequenceFlow sequenceFlow : flowList) {
        if(sequenceFlow.getId().equals(flow.getId())) {
          found = true;
        }
      }
     
      if(found == false) {
       
        FlowNode targetFlowNode = (FlowNode) model.getBpmnModel().getFlowElement(flow.getTargetRef());
      
        if (targetFlowNode != null) {
          // remove old target
          targetFlowNode.getIncomingFlows().remove(flow);
        }
       
        targetElement.getIncomingFlows().add(flow);
        flow.setTargetRef(targetElement.getId());
      }
     
    } else if(ReconnectionContext.RECONNECT_SOURCE.equalsIgnoreCase(context.getReconnectType())) {
      // targetElement is the source side of the sequence flow
      List<SequenceFlow> flowList = targetElement.getOutgoingFlows();
      boolean found = false;
      for (SequenceFlow sequenceFlow : flowList) {
        if(sequenceFlow.equals(flow)) {
          found = true;
        }
      }
     
      if(found == false) {
       
        FlowNode sourceFlowNode = (FlowNode) model.getBpmnModel().getFlowElement(flow.getSourceRef());
        ContainerShape sourceElement = (ContainerShape) getFeatureProvider().getPictogramElementForBusinessObject(sourceFlowNode);
        ContainerShape oldParentContainer = sourceElement.getContainer();
        ContainerShape newParentContainer = ((ContainerShape) context.getTargetPictogramElement()).getContainer();
       
        if (oldParentContainer != newParentContainer) {
View Full Code Here

    newProcess.setId("process_" + newPool.getId());
    newProcess.setName(newProcess.getId());

    newPool.setProcessRef(newProcess.getId());

    Bpmn2MemoryModel model = ModelHandler.getModel(EcoreUtil.getURI(getDiagram()));
    model.getBpmnModel().getPools().add(newPool);
    model.getBpmnModel().addProcess(newProcess);

    PictogramElement poolElement = addGraphicalRepresentation(context, newPool);

    Lane lane = new Lane();
    lane.setId(getNextId(lane, "lane"));
View Full Code Here

TOP

Related Classes of org.activiti.designer.util.editor.Bpmn2MemoryModel

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.