Package it.unito.di.artifact.examples.cnpCommits

Examples of it.unito.di.artifact.examples.cnpCommits.CNPArtifactTimer$Participant


        ChoreographyActivity.class);

    boolean hasInitiatingParticipant = choreography.getInitiatingParticipantRef() != null;

    for (ContainerShape band : ChoreographyUtil.getParticipantBandContainerShapes(container)) {
      Participant participant = BusinessObjectUtil.getFirstElementOfType(band, Participant.class);
      boolean isInitiating = hasInitiatingParticipant
          && participant.equals(choreography.getInitiatingParticipantRef());
      Color color = manageColor(isInitiating ? IColorConstant.WHITE : IColorConstant.LIGHT_GRAY);
      band.getGraphicsAlgorithm().setBackground(color);
      BPMNShape bpmnShape = BusinessObjectUtil.getFirstElementOfType(band, BPMNShape.class);
      bpmnShape.setParticipantBandKind(getParticipantBandKind(isInitiating, bpmnShape.getParticipantBandKind()));
    }

    Participant initiatingParticipant = choreography.getInitiatingParticipantRef();
    String id = initiatingParticipant == null ? "null" : initiatingParticipant.getId();
    peService.setPropertyValue(context.getPictogramElement(), INITIATING_PARTICIPANT_REF, id);

    return true;
  }
View Full Code Here


  protected void postMoveShape(final IMoveShapeContext context) {
    super.postMoveShape(context);
    IPeService peService = Graphiti.getPeService();
    Collection<Shape> shapes = peService.getAllContainedShapes((ContainerShape) context.getShape());
    for (Shape s : shapes) {
      Participant participant = BusinessObjectUtil.getFirstElementOfType(s, Participant.class);
      if (participant != null) {
        ContainerShape container = (ContainerShape) s;
        GraphicsAlgorithm ga = container.getGraphicsAlgorithm();

        BPMNShape bpmnShape = BusinessObjectUtil.getFirstElementOfType(s, BPMNShape.class);
View Full Code Here

    for (BPMNShape bpmnShape : filteredShapes) {
      ParticipantBandKind bandKind = bpmnShape.getParticipantBandKind();
      ContainerShape createdShape = ChoreographyUtil.createParticipantBandContainerShape(bandKind,
          choreographyContainer, bpmnShape, isShowNames());
      createDIShape(createdShape, bpmnShape.getBpmnElement(), bpmnShape);
      Participant p = (Participant) bpmnShape.getBpmnElement();
      if (p.getParticipantMultiplicity() != null && p.getParticipantMultiplicity().getMaximum() > 1) {
        drawMultiplicityMarkers(createdShape);
      }
    }

    peService.setPropertyValue(choreographyContainer, PARTICIPANT_REF_IDS,
        ChoreographyUtil.getParticipantRefIds(choreography));
    Participant initiatingParticipant = choreography.getInitiatingParticipantRef();
    String id = initiatingParticipant == null ? "null" : initiatingParticipant.getId();
    peService.setPropertyValue(choreographyContainer, INITIATING_PARTICIPANT_REF, id);
  }
View Full Code Here

    }

  @Override
    public String getInitialValue(IDirectEditingContext context) {
    PictogramElement pe = context.getPictogramElement();
    Participant participant = (Participant) getBusinessObjectForPictogramElement(pe);
    return participant.getName();
    }
View Full Code Here

    }

  @Override
    public void setValue(String value, IDirectEditingContext context) {
    PictogramElement pe = context.getPictogramElement();
    Participant participant = (Participant) getBusinessObjectForPictogramElement(pe);
    participant.setName(value);
    updatePictogramElement(((Shape) pe).getContainer());
    }
View Full Code Here

    return isParticipant && addToDiagram;
  }

  @Override
  public PictogramElement add(IAddContext context) {
    Participant p = (Participant) context.getNewObject();
    IGaService gaService = Graphiti.getGaService();
    IPeService peService = Graphiti.getPeService();

    Diagram targetDiagram = (Diagram) context.getTargetContainer();
    IPeCreateService peCreateService = Graphiti.getPeCreateService();
    ContainerShape containerShape = peCreateService.createContainerShape(targetDiagram, true);

    int width = context.getWidth() > 0 ? context.getWidth() : 600;
    int height = context.getHeight() > 0 ? context.getHeight() : 100;

    Rectangle rect = gaService.createRectangle(containerShape);
    StyleUtil.applyBGStyle(rect, this);
    gaService.setLocationAndSize(rect, context.getX(), context.getY(), width, height);

    Shape lineShape = peCreateService.createShape(containerShape, false);
    Polyline line = gaService.createPolyline(lineShape, new int[] { 15, 0, 15, height });
    line.setForeground(manageColor(StyleUtil.CLASS_FOREGROUND));

    Shape textShape = peCreateService.createShape(containerShape, false);
    Text text = gaService.createText(textShape, p.getName());
    text.setStyle(StyleUtil.getStyleForText(getDiagram()));
    text.setVerticalAlignment(Orientation.ALIGNMENT_CENTER);
    text.setHorizontalAlignment(Orientation.ALIGNMENT_CENTER);
    text.setAngle(-90);
    gaService.setLocationAndSize(text, 0, 0, 15, height);
View Full Code Here

    }
    if (!(context.getPictogramElement() instanceof ContainerShape)) {
      return Reason.createFalseReason();
    }
    IPeService peService = Graphiti.getPeService();
    Participant participant = (Participant) BusinessObjectUtil.getFirstElementOfType(context.getPictogramElement(),
        Participant.class);
    ContainerShape containerShape = (ContainerShape) context.getPictogramElement();

    boolean multiplicityProperty = new Boolean(peService.getPropertyValue(containerShape,
        AddParticipantFeature.MULTIPLICITY));
    boolean hasMultiplicity = participant.getParticipantMultiplicity() != null;

    return multiplicityProperty != hasMultiplicity ? Reason.createTrueReason() : Reason.createFalseReason();
  }
View Full Code Here

  @Override
  public boolean update(IUpdateContext context) {
    IPeService peService = Graphiti.getPeService();
    IGaService gaService = Graphiti.getGaService();

    Participant participant = (Participant) BusinessObjectUtil.getFirstElementOfType(context.getPictogramElement(),
        Participant.class);
    ContainerShape containerShape = (ContainerShape) context.getPictogramElement();

    if (participant.getParticipantMultiplicity() != null) {
      Shape shape = peService.createShape(containerShape, false);
      peService.setPropertyValue(shape, MULTIPLICITY_MARKER, Boolean.toString(true));
      Rectangle invisibleRectangle = gaService.createInvisibleRectangle(shape);
      GraphicsAlgorithm parentGa = containerShape.getGraphicsAlgorithm();
      int x = (parentGa.getWidth() / 2) - 10;
      int y = parentGa.getHeight() - 20;
      gaService.setLocationAndSize(invisibleRectangle, x, y, 20, 20);

      Polyline line1 = gaService.createPolyline(invisibleRectangle, new int[] { 0, 0, 0, 20 });
      line1.setLineWidth(2);
      line1.setForeground(manageColor(StyleUtil.CLASS_FOREGROUND));
      Polyline line2 = gaService.createPolyline(invisibleRectangle, new int[] { 9, 0, 9, 20 });
      line2.setForeground(manageColor(StyleUtil.CLASS_FOREGROUND));
      line2.setLineWidth(2);
      Polyline line3 = gaService.createPolyline(invisibleRectangle, new int[] { 18, 0, 18, 20 });
      line3.setForeground(manageColor(StyleUtil.CLASS_FOREGROUND));
      line3.setLineWidth(2);
    } else {
      Shape shape = FeatureSupport.getShape(containerShape, MULTIPLICITY_MARKER, Boolean.toString(true));
      if (shape != null) {
        peService.deletePictogramElement(shape);
      }
    }

    peService.setPropertyValue(containerShape, AddParticipantFeature.MULTIPLICITY,
        participant.getParticipantMultiplicity() != null ? Boolean.toString(true) : Boolean.toString(false));
    return true;
  }
View Full Code Here

    for (MessageFlow message : choreography.getMessageFlowRef()) {
      sources.add(message.getSourceRef());
    }

    for (ContainerShape band : ChoreographyUtil.getParticipantBandContainerShapes(choreographyContainer)) {
      Participant participant = BusinessObjectUtil.getFirstElementOfType(band, Participant.class);
      BPMNShape bpmnShape = BusinessObjectUtil.getFirstElementOfType(band, BPMNShape.class);
      if (!sources.contains(participant) && bpmnShape.isIsMessageVisible()) {
        bpmnShape.setIsMessageVisible(false);
        peService.setPropertyValue(context.getPictogramElement(), MESSAGE_VISIBLE, Boolean.toString(false));
      } else if (sources.contains(participant) && !bpmnShape.isIsMessageVisible()) {
View Full Code Here

      ModelUtil.setID(createLaneSet);
    }

    try {
      ModelHandler handler = ModelHandler.getInstance(getDiagram());
      Participant sourceParticipant = handler.getParticipant(sourceLane);
      Participant targetParticipant = handler.getParticipant(targetLane);
      if (!sourceParticipant.equals(targetParticipant)) {
        handler.moveLane(movedLane, sourceParticipant, targetParticipant);
      }
    } catch (IOException e) {
      Activator.logError(e);
View Full Code Here

TOP

Related Classes of it.unito.di.artifact.examples.cnpCommits.CNPArtifactTimer$Participant

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.