Package java.util.concurrent

Examples of java.util.concurrent.Exchanger$Participant


    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

    }

    @Override
    public boolean isMoveAllowed(Object source, Object target) {
      try {
        Participant p = (Participant) target;
        if (p.equals(ModelHandler.getInstance(getDiagram()).getInternalParticipant())) {
          return true;
        }
        if (p.getProcessRef() == null) {
          return true;
        }
        if (p.getProcessRef().getLaneSets().isEmpty()) {
          return true;
        }
      } catch (Exception e) {
        Activator.logError(e);
      }
View Full Code Here

  public boolean canMoveShape(IMoveShapeContext context) {
    if (getMovedLane(context).getFlowNodeRefs().isEmpty()) {
      return true;
    }

    Participant p = (Participant) getBusinessObjectForPictogramElement(context.getTargetContainer());

    if (p.getProcessRef() == null) {
      return true;
    }

    if (!p.getProcessRef().getLaneSets().isEmpty()) {
      return true;
    }

    return false;
  }
View Full Code Here

      return e.getName();
    } else if (o instanceof TextAnnotation) {
      TextAnnotation a = (TextAnnotation) o;
      return a.getText();
    } else if (o instanceof Participant) {
      Participant p = (Participant) o;
      return p.getName();
    } else if (o instanceof Lane) {
      Lane l = (Lane) o;
      return l.getName();
    }
    return null;
View Full Code Here

//        definitions.setId(EcoreUtil.generateUUID());
        ModelUtil.setID(definitions,resource);
        Collaboration collaboration = FACTORY.createCollaboration();
//        collaboration.setId(EcoreUtil.generateUUID());
        ModelUtil.setID(collaboration,resource);
        Participant participant = FACTORY.createParticipant();
//        participant.setId(EcoreUtil.generateUUID());
        ModelUtil.setID(participant,resource);
        participant.setName("Internal");
        collaboration.getParticipants().add(participant);
        definitions.getRootElements().add(collaboration);

        domain.getCommandStack().execute(new RecordingCommand(domain) {
          @Override
View Full Code Here

    }
  }

  public Participant addParticipant() {
    Collaboration collaboration = getOrCreateCollaboration();
    Participant participant = FACTORY.createParticipant();
//    participant.setId(EcoreUtil.generateUUID());
    ModelUtil.setID(participant,resource);
    collaboration.getParticipants().add(participant);
    return participant;
  }
View Full Code Here

TOP

Related Classes of java.util.concurrent.Exchanger$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.