Package org.eclipse.graphiti.mm.pictograms

Examples of org.eclipse.graphiti.mm.pictograms.ContainerShape


  public static ModelHandler getModelHanderInstance(Diagram diagram) throws IOException {
    return ModelHandlerLocator.getModelHandler(diagram.eResource());
  }

  public static void redraw(ContainerShape container) {
    ContainerShape root = getRootContainer(container);
    resizeRecursively(root);
    postResizeFixLenghts(root);
    updateDI(root);
  }
View Full Code Here


        .getInstanceClass();
    DIUtils.updateDIShape(root);
  }

  private static ContainerShape getRootContainer(ContainerShape container) {
    ContainerShape parent = container.getContainer();
    EObject bo = BusinessObjectUtil.getFirstElementOfType(parent, BaseElement.class);
    if (bo != null && (bo instanceof Lane || bo instanceof Participant)) {
      return getRootContainer(parent);
    }
    return container;
View Full Code Here

  public static String getShapeValue(IPictogramElementContext context) {
    String value = null;

    PictogramElement pe = context.getPictogramElement();
    if (pe instanceof ContainerShape) {
      ContainerShape cs = (ContainerShape) pe;
      for (Shape shape : cs.getChildren()) {
        if (shape.getGraphicsAlgorithm() instanceof AbstractText) {
          AbstractText text = (AbstractText) shape.getGraphicsAlgorithm();
          value = text.getValue();
        }
      }
View Full Code Here

  public boolean update(IUpdateContext context) {
    // TODO here it should get an updated picture from the element controller

    PictogramElement pe = context.getPictogramElement();
    if (pe instanceof ContainerShape) {
      ContainerShape cs = (ContainerShape) pe;
      for (Shape shape : cs.getChildren()) {
        if (shape.getGraphicsAlgorithm() instanceof AbstractText) {
          AbstractText text = (AbstractText) shape.getGraphicsAlgorithm();
          text.setValue(FeatureSupport.getBusinessValue(context));
          return true;
        }
View Full Code Here

      Activator.logError(e);
    }
  }

  private static void updateEdge(BPMNEdge edge, Diagram diagram) {
    ContainerShape source = (ContainerShape) Graphiti.getLinkService()
        .getPictogramElements(diagram, edge.getSourceElement()).get(0);
    ContainerShape target = (ContainerShape) Graphiti.getLinkService()
        .getPictogramElements(diagram, edge.getTargetElement()).get(0);
    Connection connection = (Connection) Graphiti.getLinkService().getPictogramElements(diagram, edge).get(0);
    Tuple<FixPointAnchor, FixPointAnchor> anchors = getSourceAndTargetBoundaryAnchors(source, target, connection);

    ILocation loc = peService.getLocationRelativeToDiagram(anchors.getFirst());
View Full Code Here

  public PictogramElement add(IAddContext context) {
    BoundaryEvent event = (BoundaryEvent) context.getNewObject();

    Object prop = context.getProperty(DIImport.IMPORT_PROPERTY);
    boolean importing = prop != null && (Boolean) prop;
    ContainerShape target = importing ? context.getTargetContainer() : (ContainerShape) context
            .getTargetContainer().eContainer();

    ContainerShape containerShape = peService.createContainerShape(target, true);
    Ellipse ellipse = gaService.createEllipse(containerShape);
    StyleUtil.applyBGStyle(ellipse, this);

    if (importing) { // if loading from DI then place according to context
      gaService.setLocationAndSize(ellipse, context.getX(), context.getY(), EVENT_SIZE, EVENT_SIZE);
    } else { // otherwise place it in the center of shape for user to adjust it
      GraphicsAlgorithm ga = context.getTargetContainer().getGraphicsAlgorithm();
      int x = ga.getX() + context.getX() - (EVENT_SIZE / 2);
      int y = ga.getY() + context.getY() - (EVENT_SIZE / 2);
      gaService.setLocationAndSize(ellipse, x, y, EVENT_SIZE, EVENT_SIZE);
    }

    Ellipse circle = GraphicsUtil.createIntermediateEventCircle(ellipse);
    circle.setStyle(StyleUtil.getStyleForClass(getDiagram()));
    createDIShape(containerShape, event);

    ChopboxAnchor anchor = peService.createChopboxAnchor(containerShape);
    anchor.setReferencedGraphicsAlgorithm(ellipse);
    AnchorUtil.addFixedPointAnchors(containerShape, ellipse);

    Activity activity = event.getAttachedToRef();
    PictogramElement foundElem = BusinessObjectUtil.getFirstBaseElementFromDiagram(getDiagram(), activity);
    if (foundElem != null && foundElem instanceof ContainerShape) {
      ContainerShape activityContainer = (ContainerShape) foundElem;
      PositionOnLine pos = BoundaryEventPositionHelper.getPositionOnLineUsingBPMNShape(containerShape,
              activityContainer);
      BoundaryEventPositionHelper.assignPositionOnLineProperty(containerShape, pos);
    }
View Full Code Here

    Object importProp = context.getProperty(DIImport.IMPORT_PROPERTY);
    if (importProp != null && (Boolean) importProp) {
      connection.setStart(addConContext.getSourceAnchor());
      connection.setEnd(addConContext.getTargetAnchor());
    } else {
      ContainerShape sourceContainer = (ContainerShape) addConContext.getSourceAnchor().eContainer();
      ContainerShape targetContainer = (ContainerShape) addConContext.getTargetAnchor().eContainer();
      Tuple<FixPointAnchor, FixPointAnchor> anchors = AnchorUtil.getSourceAndTargetBoundaryAnchors(
          sourceContainer, targetContainer, connection);

      connection.setStart(anchors.getFirst());
      connection.setEnd(anchors.getSecond());
View Full Code Here

      y += loc.getY();
    }

    BoundaryEvent event = BusinessObjectUtil.getFirstElementOfType(context.getShape(), BoundaryEvent.class);
    GraphicsAlgorithm eventGa = context.getShape().getGraphicsAlgorithm();
    ContainerShape activityContainer = (ContainerShape) BusinessObjectUtil.getFirstBaseElementFromDiagram(diagram,
            event.getAttachedToRef());
    GraphicsAlgorithm activityGa = activityContainer.getGraphicsAlgorithm();
    ILocation activityLoc = peService.getLocationRelativeToDiagram(activityContainer);

    if (!(activityContainer.equals(context.getTargetContainer()) || activityContainer.eContainer().equals(
            context.getTargetContainer()))) {
      return false;
    }

    PositionOnLine pos = getPositionOnLine(x, y, eventGa.getWidth(), eventGa.getHeight(), activityLoc.getX(),
View Full Code Here

    }

    @Override
    public boolean update(IUpdateContext context) {
      IPeService peService = Graphiti.getPeService();
      ContainerShape container = (ContainerShape) context.getPictogramElement();
      StartEvent event = (StartEvent) getBusinessObjectForPictogramElement(container);

      Ellipse ellipse = (Ellipse) peService.getAllContainedShapes(container).iterator().next()
          .getGraphicsAlgorithm();
      LineStyle style = event.isIsInterrupting() ? LineStyle.SOLID : LineStyle.DASH;
View Full Code Here

    super(fp);
  }

  @Override
  protected void preMoveShape(IMoveShapeContext context) {
    ContainerShape targetContainer = context.getTargetContainer();
    Activity activity = BusinessObjectUtil.getFirstElementOfType(targetContainer, Activity.class);
    Object property = context.getProperty(ActivityMoveFeature.ACTIVITY_MOVE_PROPERTY);
    if (activity != null && property == null) {
      ContainerShape taskContainer = context.getTargetContainer();
      ContainerShape parentContainer = (ContainerShape) context.getPictogramElement().eContainer();

      IPeService peService = Graphiti.getPeService();

      ILocation loc = peService.getLocationRelativeToDiagram(taskContainer);
      MoveShapeContext c = (MoveShapeContext) context;
View Full Code Here

TOP

Related Classes of org.eclipse.graphiti.mm.pictograms.ContainerShape

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.