Package org.eclipse.graphiti.mm.pictograms

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


    final DiagramEditor de = TestUtil.loadFile("addConnection.dispel");
   
    Diagram d = de.getDiagramTypeProvider().getDiagram();
    ILinkService ls = Graphiti.getLinkService();
   
    ContainerShape peShape = null;
    EObject linked = null;
   
    //Get Demo Echo PE
    for (Shape s : d.getChildren()) {
      linked = ls.getBusinessObjectForLinkedPictogramElement(s);
      if (linked instanceof LocalVariableStatement) {
        if (((LocalVariableStatement) linked).getVariable().getName(
            ).equals("DemoEcho")) {
          assertTrue(s instanceof ContainerShape);
          peShape = (ContainerShape) s;
          break;
        }
      }
    }
   
    assertNotNull(peShape);
    assertNotNull(linked.eContainer());
   
    //Find Literal
    Shape literalShape = null;
    for (Shape s : d.getChildren()) {
      linked = ls.getBusinessObjectForLinkedPictogramElement(s);
      if (linked instanceof ConnectionInitialization) {
        ConnectionInitialization ci = (ConnectionInitialization) linked;
        EObject e = Utility.getChildLiteral(ci);
        if (Utility.getLiteralValue(
            Utility.getChildLiteral(ci)).equals("\"Connection\"")) {
          literalShape = s;
          break;
        }
      }
    }
   
    assertNotNull(literalShape);
    assertNotNull(linked.eContainer());
    assertTrue(literalShape.getAnchors().size() > 0);
   
    ProcessingElementParameter param = null;
    Shape paramShape = null;
    for (Shape s :peShape.getChildren()) {
      linked = ls.getBusinessObjectForLinkedPictogramElement(s);
      if (linked instanceof ProcessingElementParameter) {
        ProcessingElementParameter paramTmp =
            (ProcessingElementParameter) linked;
        if (paramTmp.getName().equals("input")) {
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();
                    //text is "variable_name\nclass_name"
                    //we only want variable_name
View Full Code Here

            businessName = lvs.getVariable().getName();
        }

        // Set name in pictogram model
        if (pictogramElement instanceof ContainerShape) {
            ContainerShape cs = (ContainerShape) pictogramElement;
            for (Shape shape : cs.getChildren()) {
                if (shape.getGraphicsAlgorithm() instanceof Text) {
                    Text text = (Text) shape.getGraphicsAlgorithm();
                    String textString = text.getValue();
                    String className = textString.substring(
                        textString.indexOf('\n'), textString.length());
View Full Code Here

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

          businessValue = Utility.getLiteralValue((EObject) bo);
        }

        // Set name in pictogram model
        if (pictogramElement instanceof ContainerShape) {
            ContainerShape cs = (ContainerShape) pictogramElement;
            for (Shape shape : cs.getChildren()) {
                if (shape.getGraphicsAlgorithm() instanceof AbstractText) {
                  AbstractText text =
                      (AbstractText) shape.getGraphicsAlgorithm();
   
                    text.setValue(businessValue);
                 
                    //We can user the layoutservice to get the new size
                    //but it seems to be broken wrt new lines so we need
                    //to multiply up by number of lines.
                    IDimension dim = GraphitiUi.getUiLayoutService(
                        ).calculateTextSize(
                            businessValue, text.getFont());
                   
                    text.setHeight(2 + (dim.getHeight() *
                        businessValue.split("\n").length));
                    cs.getGraphicsAlgorithm().setHeight(text.getHeight());
                    if (cs.eContainer() instanceof ContainerShape) {
                      ((ContainerShape) cs.eContainer()
                          ).getGraphicsAlgorithm().setHeight(
                              text.getHeight() + 20);
                    }
                   
                    return true;
View Full Code Here

        (ProcessingElementInstance) lvs.getVariable().getValue();
    Diagram targetDiagram = (Diagram) context.getTargetContainer();

    // Container shape for everything
    IPeCreateService peCreateService = Graphiti.getPeCreateService();
    ContainerShape containerShape =
        peCreateService.createContainerShape(targetDiagram, true);
   
    //Don't think this should happen, but want to check
    if (lvs.eResource() == null) {
      Activator.logInfo("PE has no resource");
View Full Code Here

        (LocalVariableStatement) context.getNewObject();
    Diagram targetDiagram = (Diagram) context.getTargetContainer();

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

    // check whether the context has a size (e.g. from a create feature)
    // otherwise define a default size for the shape
    int width = context.getWidth() <= 0 ? 200 : context.getWidth();
View Full Code Here

    PictogramElement pe = context.getPictogramElement();

    eu.admire.dispel.containers.Package p =
        Utility.getPackage(getDiagram());
    if (pe instanceof ContainerShape) {
      ContainerShape cs = (ContainerShape) pe;

      //Walk through all child shapes; some will be inputs/outputs
      List<Connection> toBeDeleted = new ArrayList<Connection>();
      for (Shape s : cs.getChildren()) {
        for (Anchor a : s.getAnchors()) {
          for (Connection c : a.getIncomingConnections()) {
            //Need to save any ConnectionInitializations then
            //remove connection
            Object o = getBusinessObjectForPictogramElement(
View Full Code Here

     */
    public boolean layout(ILayoutContext context) {

        boolean anythingChanged = false;
       
        ContainerShape containerShape =
            (ContainerShape) context.getPictogramElement();
        GraphicsAlgorithm containerGa = containerShape.getGraphicsAlgorithm();

        int containerWidth = containerGa.getWidth();

        for (Shape shape : containerShape.getChildren()){

            GraphicsAlgorithm graphicsAlgorithm = shape.getGraphicsAlgorithm();
            IGaService gaService = Graphiti.getGaService();

            IDimension size =
View Full Code Here

    EObject addedObj = (EObject) context.getNewObject();
   
    // CONTAINER SHAPE WITH ROUNDED RECTANGLE
    IPeCreateService peCreateService = Graphiti.getPeCreateService();
    ContainerShape containerShape =
        peCreateService.createContainerShape(
            context.getTargetContainer(), true);

    peCreateService.createChopboxAnchor(containerShape);
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.