Package org.eclipse.bpmn2

Examples of org.eclipse.bpmn2.BaseElement


  }

  @Override
  public boolean update(IUpdateContext context) {
    PictogramElement container = (PictogramElement) context.getPictogramElement();
    BaseElement element = (BaseElement) BusinessObjectUtil.getFirstElementOfType(context.getPictogramElement(),
            BaseElement.class);
    Shape textShape = getChildElementOfType(container, TEXT_ELEMENT, Boolean.toString(true), Shape.class);
    if (textShape!=null) {
      ((AbstractText) textShape.getGraphicsAlgorithm()).setValue(ModelUtil.getName(element));
      layoutPictogramElement(context.getPictogramElement());
View Full Code Here


  }

  private void relayoutLanes(List<DiagramElement> ownedElement) {
    for (DiagramElement diagramElement : ownedElement) {
      if (diagramElement instanceof BPMNShape && ((BPMNShape) diagramElement).getBpmnElement() instanceof Lane) {
        BaseElement lane = ((BPMNShape) diagramElement).getBpmnElement();
        ContainerShape shape = (ContainerShape) BusinessObjectUtil.getFirstBaseElementFromDiagram(diagram, lane);
        FeatureSupport.redraw(shape);
      }
    }
  }
View Full Code Here

   * Find a Graphiti feature for given shape and generate necessary diagram elements.
   *
   * @param shape
   */
  private void createShape(BPMNShape shape) {
    BaseElement bpmnElement = shape.getBpmnElement();
    if (shape.getChoreographyActivityShape() != null) {
      // FIXME: we currently generate participant bands automatically
      return;
    }
    IAddFeature addFeature = featureProvider.getAddFeature(new AddContext(new AreaContext(), bpmnElement));

    if (addFeature == null) {
      Activator.logStatus(new Status(IStatus.WARNING, Activator.PLUGIN_ID, "Element not supported: "
          + bpmnElement.eClass().getName()));
      return;
    }

    AddContext context = new AddContext();
    context.putProperty(IMPORT_PROPERTY, true);
    context.setNewObject(bpmnElement);
    context.setSize((int) shape.getBounds().getWidth(), (int) shape.getBounds().getHeight());

    if (bpmnElement instanceof Lane) {
      handleLane(bpmnElement, context, shape);
    } else if (bpmnElement instanceof FlowNode) {
      handleFlowNode((FlowNode) bpmnElement, context, shape);
    } else {
      context.setTargetContainer(diagram);
      context.setLocation((int) shape.getBounds().getX(), (int) shape.getBounds().getY());
    }

    if (addFeature.canAdd(context)) {
      PictogramElement newContainer = addFeature.add(context);
      featureProvider.link(newContainer, new Object[] { bpmnElement, shape });
      if (bpmnElement instanceof Participant) {
        elements.put(((Participant) bpmnElement).getProcessRef(), newContainer);
      }
      elements.put(bpmnElement, newContainer);
      handleEvents(bpmnElement, newContainer);
    }
   
    ModelUtil.addID(bpmnElement);
    String id = bpmnElement.getId();
    if (shape.getId() == null)
      shape.setId(id);
   
    if (!bpmnElement.eAdapters().contains(liveValidationContentAdapter)) {
      bpmnElement.eAdapters().add(liveValidationContentAdapter);
    }
  }
View Full Code Here

      }
    }
  }

  private void handleLane(BaseElement bpmnElement, AddContext context, BPMNShape shape) {
    BaseElement parent = (BaseElement) ((Lane) bpmnElement).eContainer().eContainer();
    ContainerShape cont = diagram;

    // find the process this lane belongs to
    for (BaseElement be : elements.keySet()) {
      if (be instanceof Participant) {
        Process processRef = ((Participant) be).getProcessRef();
        if (processRef != null && parent.getId().equals(processRef.getId())) {
          cont = (ContainerShape) elements.get(be);
          break;
        }
      } else if (be instanceof Process) {
        if (be.getId().equals(parent.getId())) {
          cont = (ContainerShape) elements.get(be);
          break;
        }
      } else if (be instanceof Lane) {
        if (be.getId().equals(parent.getId())) {
          cont = (ContainerShape) elements.get(be);
          break;
        }
      }
    }
View Full Code Here

  private BaseElement findElementById ( String id ) {
    if (elements.keySet().size() > 0) {
      Iterator<BaseElement> keys = elements.keySet().iterator();
      while (keys.hasNext()) {
        BaseElement key = keys.next();
        if (key != null && key.getId().equals(id))
          return key;
      }
    }
    return null;
  }
View Full Code Here

    }
    return null;
  }
 
  private Tuple<BaseElement, BaseElement> getSourceAndTargetByID String id ) {
    BaseElement source = null;
    BaseElement target = null;
    int indexOfDash = id.indexOf('-');
    if (indexOfDash > -1) {
      String srcRefFromId = id.substring(0, indexOfDash);
      String tgtRefFromId = id.substring(indexOfDash + 1, id.length());
      source = findElementById(srcRefFromId);
View Full Code Here

   * Find a Graphiti feature for given edge and generate necessary connections and bendpoints.
   *
   * @param shape
   */
  private void createEdge(BPMNEdge bpmnEdge) {
    BaseElement bpmnElement = bpmnEdge.getBpmnElement();
    EObject source = null;
    EObject target = null;
    PictogramElement se = null;
    PictogramElement te = null;

    String id = bpmnElement.getId();

    // for some reason connectors don't have a common interface
    if (bpmnElement instanceof MessageFlow) {
      source = ((MessageFlow) bpmnElement).getSourceRef();
      target = ((MessageFlow) bpmnElement).getTargetRef();
View Full Code Here

      return -1;
    } else if (!aIsPool && bIsPool) {
      return 1;
    }

    BaseElement aElem = a.getBpmnElement();
    BaseElement bElem = b.getBpmnElement();
    boolean aIsSecondTier = aElem instanceof Lane || aElem instanceof SubProcess
        || aElem instanceof SubChoreography;
    boolean bIsSecondTier = bElem instanceof Lane || bElem instanceof SubProcess
        || bElem instanceof SubChoreography;
View Full Code Here

    getOrCreateCollaboration().getConversationLinks().add(link);
    return link;
  }

  public Association createAssociation(BaseElement source, BaseElement target) {
    BaseElement e = null;
    if (getParticipant(source) != null) {
      e = source;
    } else if (getParticipant(target) != null) {
      e = target;
    } else {
View Full Code Here

      A source = getSourceBo(context);
      B target = getTargetBo(context);
      ModelHandler mh = ModelHandler.getInstance(getDiagram());
      AddConnectionContext addContext = new AddConnectionContext(context.getSourceAnchor(),
          context.getTargetAnchor());
      BaseElement flow = createFlow(mh, source, target);
//      flow.setId(EcoreUtil.generateUUID());
      addContext.setNewObject(flow);
      Connection connection = (Connection) getFeatureProvider().addIfPossible(addContext);
      ModelUtil.setID(flow);
      return connection;
View Full Code Here

TOP

Related Classes of org.eclipse.bpmn2.BaseElement

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.