Package org.eclipse.graphiti.mm.pictograms

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


  @Override
  public PictogramElement add(IAddContext context) {
    Lane lane = (Lane) context.getNewObject();

    IPeCreateService peCreateService = Graphiti.getPeCreateService();
    ContainerShape containerShape = peCreateService.createContainerShape(context.getTargetContainer(), true);
    IGaService gaService = Graphiti.getGaService();

    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);

    if (FeatureSupport.isTargetLane(context) || FeatureSupport.isTargetParticipant(context)) {
      GraphicsAlgorithm ga = context.getTargetContainer().getGraphicsAlgorithm();

      if (getNumberOfLanes(context) == 1) {
        gaService.setLocationAndSize(rect, 15, 0, width - 15, height);
        for (Shape s : getFlowNodeShapes(context, lane)) {
          Graphiti.getPeService().sendToFront(s);
          s.setContainer(containerShape);
        }
      } else {
        if (context.getWidth() == -1 || context.getHeight() == -1) {
          gaService.setLocationAndSize(rect, 15, ga.getWidth() - 1, ga.getHeight() - 15, height);
          // gaService.setLocationAndSize(rect, context.getX(), context.getY(), width, height);
        } else {
          ILayoutService layoutService = Graphiti.getLayoutService();
          ILocation loc = layoutService.getLocationRelativeToDiagram(containerShape);
          int x = context.getX() - loc.getX();
          int y = context.getY() - loc.getY();
          gaService.setLocationAndSize(rect, x - 15, y, ga.getWidth() - 15, height);
        }
      }
      containerShape.setContainer(context.getTargetContainer());
    } else {
      gaService.setLocationAndSize(rect, context.getX(), context.getY(), width, height);
    }

    Shape textShape = peCreateService.createShape(containerShape, false);
View Full Code Here


    }
    return shapes;
  }

  private int getNumberOfLanes(ITargetContext context) {
    ContainerShape targetContainer = context.getTargetContainer();
    Object bo = getBusinessObjectForPictogramElement(targetContainer);
    if (bo instanceof Lane) {
      Lane lane = (Lane) bo;
      return lane.getChildLaneSet().getLanes().size();
    } else if (bo instanceof Participant) {
View Full Code Here

  @Override
  public boolean layout(ILayoutContext context) {
    boolean changed = false;

    ContainerShape containerShape = (ContainerShape) context.getPictogramElement();
    GraphicsAlgorithm ga = containerShape.getGraphicsAlgorithm();
    IGaService gaService = Graphiti.getGaService();

    if (ga.getWidth() < 100) {
      ga.setWidth(100);
      changed = true;
    }

    if (ga.getHeight() < 50) {
      ga.setHeight(50);
      changed = true;
    }

    int containerWidth = ga.getWidth();
    int containerHeight = ga.getHeight();

    DIUtils.updateDIShape(containerShape);

    Iterator<Shape> iterator = containerShape.getChildren().iterator();
    while (iterator.hasNext()) {
      Shape shape = iterator.next();
      GraphicsAlgorithm shapeGa = shape.getGraphicsAlgorithm();
      IDimension size = gaService.calculateSize(shapeGa);
      if (containerWidth != size.getWidth() && shapeGa instanceof MultiText) {
View Full Code Here

    }

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

    ContainerShape markerContainer = null;
    Iterator<Shape> iterator = peService.getAllContainedShapes(container).iterator();
    while (iterator.hasNext()) {
      Shape shape = (Shape) iterator.next();
      String property = peService.getPropertyValue(shape, GraphicsUtil.ACTIVITY_MARKER_CONTAINER);
      if(property != null && new Boolean(property)) {
View Full Code Here

    }
    return shapes;
  }

  private int getNumberOfLanes(ITargetContext context) {
    ContainerShape targetContainer = context.getTargetContainer();
    Lane lane = (Lane) getBusinessObjectForPictogramElement(targetContainer);
    return lane.getChildLaneSet().getLanes().size();
  }
View Full Code Here

    Lane lane = (Lane) getBusinessObjectForPictogramElement(targetContainer);
    return lane.getChildLaneSet().getLanes().size();
  }

  private Lane getTargetLane(IMoveShapeContext context) {
    ContainerShape targetContainer = context.getTargetContainer();
    return (Lane) getBusinessObjectForPictogramElement(targetContainer);
  }
View Full Code Here

    return bo != null && bo instanceof Activity;
  }

  @Override
  public boolean layout(ILayoutContext context) {
    ContainerShape containerShape = (ContainerShape) context.getPictogramElement();
    GraphicsAlgorithm parentGa = containerShape.getGraphicsAlgorithm();

    Iterator<Shape> iterator = Graphiti.getPeService().getAllContainedShapes(containerShape).iterator();
    while (iterator.hasNext()) {
      Shape shape = iterator.next();
      GraphicsAlgorithm ga = shape.getGraphicsAlgorithm();
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

    }
  }

  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();
View Full Code Here

    context.setLocation((int) shape.getBounds().getX(), (int) shape.getBounds().getY());

  }

  private void handleFlowNode(FlowNode node, AddContext context, BPMNShape shape) {
    ContainerShape target = diagram;
    int x = (int) shape.getBounds().getX();
    int y = (int) shape.getBounds().getY();

    // find a correct container element
    List<Lane> lanes = node.getLanes();
    if ((node.eContainer() instanceof SubProcess || (node.eContainer() instanceof Process || node.eContainer() instanceof SubChoreography)
        && lanes.isEmpty())) {
      ContainerShape containerShape = (ContainerShape) elements.get(node.eContainer());
      if (containerShape != null) {
        target = containerShape;
        ILocation loc = Graphiti.getPeLayoutService().getLocationRelativeToDiagram(target);
        x -= loc.getX();
        y -= loc.getY();
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.