Package org.eclipse.graphiti.mm.pictograms

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


                while (it.hasNext()) {
                    Entry<?, ?> e = (Entry<?, ?>)it.next();
                    Object key = e.getKey();
                    EditPart value = (EditPart)e.getValue();
                    if (key instanceof ContainerShape) {
                        ContainerShape cs = (ContainerShape)key;
                        if (cs.getLink() != null &&
                            cs.getLink().getBusinessObjects() != null &&
                            cs.getLink().getBusinessObjects().size() > 0 &&
                            cs.getLink().getBusinessObjects().get(0) != null &&
                            cs.getLink().getBusinessObjects().get(0).equals(o)) {
                            // found the correct entry
                            return value;
                        }
                    }
                    continue;
View Full Code Here


                && bos[0] instanceof AbstractNode;
  }

  public boolean layout(ILayoutContext context) {
    boolean anythingChanged = false;
    ContainerShape containerShape = (ContainerShape) context.getPictogramElement();
    GraphicsAlgorithm containerGa = containerShape.getGraphicsAlgorithm();
    // the containerGa is the invisible rectangle
    // containing the visible rectangle as its (first and only) child
    GraphicsAlgorithm rectangle = containerGa.getGraphicsAlgorithmChildren().get(0);

    // height of invisible rectangle
    if (containerGa.getHeight() < MIN_HEIGHT) {
      containerGa.setHeight(MIN_HEIGHT);
      anythingChanged = true;
    }

    // height of visible rectangle (same as invisible rectangle)
    if (rectangle.getHeight() != containerGa.getHeight()) {
      rectangle.setHeight(containerGa.getHeight());
      anythingChanged = true;
    }

    // width of invisible rectangle
    if (containerGa.getWidth() < MIN_WIDTH) {
      containerGa.setWidth(MIN_WIDTH);
      anythingChanged = true;
    }

    // width of visible rectangle (smaller than invisible rectangle)
    int rectangleWidth = containerGa.getWidth() - AddNodeFeature.INVISIBLE_RIGHT_SPACE;
    if (rectangle.getWidth() != rectangleWidth) {
      rectangle.setWidth(rectangleWidth);
      anythingChanged = true;
    }

    // width of text and line (same as visible rectangle)
    for (Shape shape : containerShape.getChildren()) {
      GraphicsAlgorithm graphicsAlgorithm = shape.getGraphicsAlgorithm();
      IGaService gaService = Graphiti.getGaService();
      IDimension size = gaService.calculateSize(graphicsAlgorithm);
      if (rectangleWidth != size.getWidth()) {
        gaService.setWidth(graphicsAlgorithm, rectangleWidth);
View Full Code Here

   
    IGaService gaService = Graphiti.getGaService();
   
    try {
      if (pe instanceof ContainerShape) {
        ContainerShape cs = (ContainerShape) pe;
        if (highlight) {
          cs.getGraphicsAlgorithm().setLineVisible(true);
          cs.getGraphicsAlgorithm().setLineStyle(LineStyle.DASH);
          cs.getGraphicsAlgorithm().setLineWidth(cs.getGraphicsAlgorithm().getLineWidth() + 3);
          cs.getGraphicsAlgorithm().setForeground(gaService.manageColor(designEditor.getDiagram(), StyleUtil.getColorConstant("255,0,0")));
        } else {
          cs.getGraphicsAlgorithm().setLineVisible(false);
          cs.getGraphicsAlgorithm().setLineStyle(LineStyle.SOLID);
          cs.getGraphicsAlgorithm().setLineWidth(cs.getGraphicsAlgorithm().getLineWidth() - 3);
          cs.getGraphicsAlgorithm().setForeground(gaService.manageColor(designEditor.getDiagram(), StyleUtil.E_CLASS_FOREGROUND));
        }
       
        for (Shape shape : cs.getChildren()) {
          if (shape.getGraphicsAlgorithm() instanceof Text) {
            Text text = (Text) shape.getGraphicsAlgorithm();

            // now update node highlight
            if (highlight) {
View Full Code Here

    } else if (input instanceof AbstractEditPart) {
      AbstractEditPart editPart = (AbstractEditPart) input;
      Object model = editPart.getModel();
      answer = toAbstractNode(model);
    } else if (input instanceof ContainerShape) {
      ContainerShape shape = (ContainerShape) input;
      answer = (AbstractNode)Activator.getDiagramEditor().getFeatureProvider().getBusinessObjectForPictogramElement(shape);
    }
    if (input != null && answer == null) {
      answer = (AbstractNode) Platform.getAdapterManager().getAdapter(input, AbstractNode.class);
    }
View Full Code Here

  public IReason updateNeeded(IUpdateContext context) {
    // retrieve name from pictogram model
    String pictogramName = null;
    PictogramElement pictogramElement = context.getPictogramElement();
    if (pictogramElement instanceof ContainerShape) {
      ContainerShape cs = (ContainerShape) pictogramElement;
      for (Shape shape : cs.getChildren()) {
        if (shape.getGraphicsAlgorithm() instanceof Text) {
          Text text = (Text) shape.getGraphicsAlgorithm();
          pictogramName = text.getValue();
        }
      }
View Full Code Here

      businessName = DiagramUtils.filterFigureLabel(eClass.getDisplayText());
    }

    // Set name in pictogram model
    if (pictogramElement instanceof ContainerShape) {
      ContainerShape cs = (ContainerShape) pictogramElement;
      
      boolean finished_label = false;
      boolean finished_icon = false;
      // now also adapt the text label of the figure
      for (Shape shape : cs.getChildren()) {
        // special handling for the text shape as its the figures label
        if (shape.getGraphicsAlgorithm() instanceof Text) {
          Text text = (Text) shape.getGraphicsAlgorithm();
          // set the new figure label
          text.setValue(businessName);
View Full Code Here

    //    final EClass addedClass = (EClass) context.getNewObject();
    final Diagram targetDiagram = (Diagram) context.getTargetContainer();

    // CONTAINER SHAPE WITH ROUNDED RECTANGLE
    final IPeCreateService peCreateService = Graphiti.getPeCreateService();
    final ContainerShape containerShape = peCreateService.createContainerShape(targetDiagram, true);

    String label = DiagramUtils.filterFigureLabel(addedClass.getDisplayText());
   
    // check whether the context has a size (e.g. from a create feature)
    // otherwise define a default size for the shape
View Full Code Here

  @Override
  public boolean update(IUpdateContext context) {
    ChoreographyActivity choreography = BusinessObjectUtil.getFirstElementOfType(context.getPictogramElement(),
        ChoreographyActivity.class);
    ContainerShape containerShape = (ContainerShape) context.getPictogramElement();
    List<Participant> participants = choreography.getParticipantRefs();
    List<ContainerShape> bandContainerShapes = ChoreographyUtil
        .getParticipantBandContainerShapes((ContainerShape) context.getPictogramElement());

    ChoreographyUtil.updateParticipantReferences(containerShape, bandContainerShapes, participants,
View Full Code Here

        int width = 50;
        int height = 50;
        int textArea = 15;

        ContainerShape container = peService.createContainerShape(context.getTargetContainer(), true);
        Rectangle invisibleRect = gaService.createInvisibleRectangle(container);
        gaService.setLocationAndSize(invisibleRect, context.getX(), context.getY(), width, height + textArea);

        int whalf = width / 2;
View Full Code Here

    @Override
    public boolean canUpdate(IUpdateContext context) {
      IFeatureProvider featureProvider = getDiagramEditor().getDiagramTypeProvider().getFeatureProvider();

      ContainerShape gatewayShape = (ContainerShape) context.getPictogramElement();
      for (Anchor anchor : gatewayShape.getAnchors()) {
        for (Connection connection : anchor.getIncomingConnections() ) {
          IUpdateContext updateCtx = new UpdateContext(connection);
          IUpdateFeature updateFeature = featureProvider.getUpdateFeature(updateCtx);
          if (updateFeature != null) {
            boolean ret = updateFeature.canUpdate(updateCtx);
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.