Package org.eclipse.graphiti.features.context.impl

Examples of org.eclipse.graphiti.features.context.impl.AddContext


              instanceof Stream)) {
            if (getFeatureProvider(
                ).getPictogramElementForBusinessObject(lvs)
                == null) {
             
              AddContext addPEorCIContext = new AddContext(
                  new AreaContext(), lvs);
              addPEorCIContext.setTargetContainer(getDiagram());
              addGraphicalRepresentation(addPEorCIContext, lvs);
             
              ret = true;
            }
          }
View Full Code Here


    //Check for child literal
    Object lit = Utility.getChildLiteral(addedVar.getVariable(
        ).getInitialValue());
    if (lit != null) {
      AddContext addLiteralContext = new AddContext(
          new AreaContext(), lit);
      addLiteralContext.setTargetContainer(containerShape);
      addGraphicalRepresentation(addLiteralContext, lit);
    }
   
    // add a chopbox anchor to the shape
        peCreateService.createChopboxAnchor(containerShape);
View Full Code Here

    // get the EClasses from the clipboard without copying them
    // (only copy the pictogram element, not the business object)
    // then create new pictogram elements using the add feature
    Object[] objects = getFromClipboard();
    for (Object object : objects) {
      AddContext ac = new AddContext();
      ac.setLocation(0, 0); // for simplicity paste at (0, 0)
      ac.setTargetContainer(diagram);
      addGraphicalRepresentation(ac, object);
    }
  }
View Full Code Here

    }
  }

  private int addProcessor(AbstractNode route, AbstractNode node, int x, int y, List<AbstractNode> processedNodes) {
    // Create the context information
    AddContext addContext = new AddContext();
    addContext.setNewObject(node);
    addContext.setTargetContainer(diagram);
    addContext.setX(x);
    addContext.setY(y);
    y += 100;

    IAddFeature addFeature = featureProvider.getAddFeature(addContext);
    if (addFeature.canAdd(addContext)) {
      PictogramElement destState = null;
View Full Code Here

    // calculate the location where to add the new element to the diagram
    int x = context.getPictogramElements().length > 0 ? context.getPictogramElements()[0].getGraphicsAlgorithm().getX() + 150 : 150;
    int y = context.getPictogramElements().length > 0 ? context.getPictogramElements()[0].getGraphicsAlgorithm().getY() : 150;

    // create the add context
    AddContext addContext = new AddContext();
    addContext.setNewObject(node);
    addContext.setLocation(x, y);
    addContext.setTargetContainer(getDiagram());

    // execute the add to diagram action
    IAddFeature addFeature = getFeatureProvider().getAddFeature(addContext);
    PictogramElement newNode = null;
    if (addFeature.canAdd(addContext)) {
View Full Code Here

    @Override
    protected PictogramElement addGraphicalRepresentation(IAreaContext context, Object newObject) {

      // create a new AddContext and copy our ID into it.
      IAddContext addContext = new AddContext(context, newObject);
      setId(addContext, getId());
     
      // create the PE and copy our ID into its properties.
      PictogramElement pe = getFeatureProvider().addIfPossible(addContext);
      Graphiti.getPeService().setPropertyValue(pe,CUSTOM_TASK_ID,id);
View Full Code Here

  private void handleEvents(BaseElement bpmnElement, PictogramElement newContainer) {
    if (bpmnElement instanceof Event) {
      EList<EObject> contents = bpmnElement.eContents();
      for (EObject obj : contents) {

        AddContext context = new AddContext();
        context.setTargetContainer((ContainerShape) newContainer);
        context.setNewObject(obj);

        IAddFeature aFeat = featureProvider.getAddFeature(context);
        if (aFeat != null && aFeat.canAdd(context)) {
          aFeat.add(context);
        }
View Full Code Here

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

    context.putProperty("org.activiti.designer.lane.x", x);
    context.putProperty("org.activiti.designer.lane.y", y);
    context.putProperty("org.activiti.designer.lane.width", width);
    context.putProperty("org.activiti.designer.lane.height", height);

    AddContext addContext = new AddContext();
    addContext.setNewObject(newLane);
    addContext.setLocation(x, y);
    addContext.setSize(width, height);
    addContext.setTargetContainer(poolShape);
    getFeatureProvider().addIfPossible(addContext);

    // return newly created business object(s)
    return new Object[] { newLane };
  }
View Full Code Here

    Lane lane = new Lane();
    lane.setId(getNextId(lane, "lane"));
    lane.setParentProcess(newProcess);
    newProcess.getLanes().add(lane);

    AddContext laneContext = new AddContext(new AreaContext(), lane);
    IAddFeature addFeature = getFeatureProvider().getAddFeature(laneContext);
    laneContext.setNewObject(lane);
    laneContext.setSize(poolElement.getGraphicsAlgorithm().getWidth() - 20, poolElement.getGraphicsAlgorithm().getHeight());
    laneContext.setTargetContainer((ContainerShape) poolElement);
    laneContext.setLocation(20, 0);
    if (addFeature.canAdd(laneContext)) {
      PictogramElement laneContainer = addFeature.add(laneContext);
      getFeatureProvider().link(laneContainer, new Object[] { lane });
    }
View Full Code Here

TOP

Related Classes of org.eclipse.graphiti.features.context.impl.AddContext

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.