Package org.woped.core.model.petrinet

Examples of org.woped.core.model.petrinet.GroupModel


        deleteCell(((TransitionModel) transition).getToolSpecific()
            .getTrigger(), true);
      }

      if (transition.getParent() instanceof GroupModel) {
        GroupModel group = (GroupModel) transition.getParent();
        TriggerModel triggerModel = ((PetriNetModelProcessor) getModelProcessor())
        .newTrigger(map);

        if (map.getTriggerPosition() != null) {
          triggerModel.setPosition(map.getTriggerPosition());
        } else {
          if (isRotateSelected()) {
            triggerModel.setPosition(map.getPosition().x - 25,
                map.getPosition().y + 10);
          } else {
            triggerModel.setPosition(map.getPosition().x + 10,
                map.getPosition().y - 20);
          }

        }
        ParentMap pm = new ParentMap();
        pm.addEntry(triggerModel, group);
        HashMap<GroupModel, AttributeMap> hm = new HashMap<GroupModel, AttributeMap>();
        hm.put(group, group.getAttributes());

        getGraph().getModel().insert(new Object[] { triggerModel },
            hm, null, pm, null);

        return triggerModel;
View Full Code Here


        deleteCell(((TransitionModel) transition).getToolSpecific()
            .getTrigger(), true);
      }

      if (transition.getParent() instanceof GroupModel) {
        GroupModel group = (GroupModel) transition.getParent();
        TriggerModel triggerModel = ((PetriNetModelProcessor) getModelProcessor())
            .newTrigger(map);

        if (map.getTriggerPosition() != null) {
          triggerModel.setPosition(map.getTriggerPosition());
        } else {
          if (isRotateSelected()) {
            triggerModel.setPosition(map.getPosition().x - 25,
                map.getPosition().y + 10);
          } else {
            triggerModel.setPosition(map.getPosition().x + 10,
                map.getPosition().y - 20);
          }

        }
        ParentMap pm = new ParentMap();
        pm.addEntry(triggerModel, group);
        HashMap<GroupModel, AttributeMap> hm = new HashMap<GroupModel, AttributeMap>();
        hm.put(group, group.getAttributes());

        getGraph().getModel().insert(new Object[] { triggerModel }, hm,
            null, pm, null);

        return triggerModel;
View Full Code Here

        deleteCell(((TransitionModel) transition).getToolSpecific()
            .getTransResource(), true);
      }

      if (transition.getParent() instanceof GroupModel) {
        GroupModel group = (GroupModel) transition.getParent();
        TransitionResourceModel transResourceModell = ((PetriNetModelProcessor) getModelProcessor())
            .newTransResource(map);

        transResourceModell.setPosition(map.getResourcePosition().x,
            map.getResourcePosition().y);
        ParentMap pm = new ParentMap();
        pm.addEntry(transResourceModell, group);
        HashMap<GroupModel, AttributeMap> hm = new HashMap<GroupModel, AttributeMap>();
        hm.put(group, group.getAttributes());

        getGraph().getModel().insert(
            new Object[] { transResourceModell }, hm, null, pm,
            null);
View Full Code Here

        if (map.getReadOnly() != null) {
          ((AbstractPetriNetElementModel) element).setReadOnly(map
              .getReadOnly());
        }
        // Grouping
        GroupModel group = getGraph().groupName(element,
            ((AbstractPetriNetElementModel) element).getNameModel());
        group.setUngroupable(false);
        // System.err.println("In createElement Method - the created elemetn"
        // + element.toString());
        group.add(element);
        group.add(element.getNameModel());
        if (insertIntoCache) {
          getGraph().getGraphLayoutCache().insert(group);
        }

        // edit
View Full Code Here

   
    while (!toBeProcessed.isEmpty()) {
      Object currentElement = toBeProcessed.poll();     
      if (currentElement instanceof GroupModel)
      {
        GroupModel tempGroup = (GroupModel) currentElement;
        if (!tempGroup.isUngroupable()) {
          Object cell = tempGroup;
          while (cell instanceof GroupModel) {
            cell = ((GroupModel) cell).getMainElement();
          }
          if (cell instanceof AbstractPetriNetElementModel
              && !((AbstractPetriNetElementModel) cell).isReadOnly()) {
            result.add(tempGroup);
            for (int j = 0; j < tempGroup.getChildCount(); j++) {
              result.add(tempGroup.getChildAt(j));
            }
          }
        } else {
          result.add(currentElement);
          for (int j = 0; j < tempGroup.getChildCount(); j++)
            toBeProcessed.offer(tempGroup.getChildAt(j));
        }   
      } else {
        result.add(currentElement);
      }
    }
View Full Code Here

    LinkedList<ArcModel> clipboardArcs = new LinkedList<ArcModel>();
   
    while (!toBeProcessed.isEmpty()) {
      Object currentElement = toBeProcessed.poll();
      if (currentElement instanceof GroupModel) {
        GroupModel tempGroup = (GroupModel)currentElement;
        if (tempGroup.isUngroupable()) {
          // Regular group of multiple elements, add
          // its elements instead of the group itself
          for (int j = 0; j < tempGroup.getChildCount(); j++)
            toBeProcessed.offer(tempGroup.getChildAt(j));
          // Do not process the group itself
          currentElement = null;
         } else {
           // The is just the usual group of main element, name label and other stuff.
           // We are only interested in the main model in this case
View Full Code Here

      tempMap.setEditOnCreation(false);
      tempMap.setReadOnly(false);
      // set ID to null, to get new ID
      tempMap.setId(null);
      // get tempGroupModel with new ID
      GroupModel tempGroupModel = (GroupModel) (create(tempMap));
      // get form the group an AbstractElementModel (extends GraphCell)

      tempElement = tempGroupModel.getMainElement();
      // check if tempElement TransitionModel (PetriNetModelElement)

      if (tempElement instanceof TransitionModel) {
        // GroupModel currentTrans = (GroupModel) (create(currentMap));
        // new element exactly transitionModel
View Full Code Here

    getEditorPanel().m_understandColoring = null;
  }

  public void checkSubprocessEditors(Vector<Object> selectedElement) {
    Iterator<Object> iterator = selectedElement.iterator();
    GroupModel element;
    ArcConfiguration arcConfig = new ArcConfiguration();
    IEditor subEditor;
    while (iterator.hasNext()) {
      try {
        element = (GroupModel) iterator.next();
        if (element.getMainElement().getType() == AbstractPetriNetElementModel.SUBP_TYPE) {
          SubProcessModel subprocess = (SubProcessModel) element
              .getMainElement();
          NetAlgorithms.getArcConfiguration(subprocess, arcConfig);
          IEditor editor = (EditorVC) getM_centralMediator().getUi()
              .getEditorFocus();
          if ((arcConfig.m_numIncoming != 0)
              || (arcConfig.m_numOutgoing != 0)) {
            subEditor = getM_centralMediator()
                .createSubprocessEditor(
                    true,
                    editor,
                    (SubProcessModel) element
                        .getMainElement());
            this.fireViewEvent(new ViewEvent(subEditor,
                AbstractViewEvent.VIEWEVENTTYPE_GUI,
                AbstractViewEvent.CLOSE, null));
          }
View Full Code Here

                sourceArcPoint = new Point(source.getPosition().x + source.getWidth() / 2, point.y + tStar.getHeight()
                        / 2);
                sinkArcPoint = new Point(sink.getPosition().x + sink.getWidth() / 2, point.y + tStar.getHeight() / 2);
            }
            tStar.setPosition(point);
            GroupModel group = editor.getGraph().groupName(tStar, (tStar).getNameModel());
            group.setUngroupable(false);
            group.add(tStar);
            group.add(tStar.getNameModel());
            tStarComponents[0] = group;
            editor.getGraph().getGraphLayoutCache().insert(group);

            CreationMap sinkTStarMap = CreationMap.createMap();
            sinkTStarMap.setArcSourceId(sink.getId());
View Full Code Here

    private void deleteCells(Object[] toDelete) {
        Vector<Object> result = new Vector<Object>();
        for (int i = 0; i < toDelete.length; i++) {
            if (toDelete[i] instanceof GroupModel && !((GroupModel) toDelete[i]).isUngroupable()) {
                GroupModel tempGroup = (GroupModel) toDelete[i];
                Object cell = tempGroup;
                while (cell instanceof GroupModel) {
                    cell = ((GroupModel) cell).getMainElement();
                }
                if (cell instanceof AbstractPetriNetElementModel && !((AbstractPetriNetElementModel) cell).isReadOnly()) {
                    result.add(tempGroup);
                    for (int j = 0; j < tempGroup.getChildCount(); j++) {
                        result.add(tempGroup.getChildAt(j));
                    }
                }
            } else {
                result.add(toDelete[i]);
            }
View Full Code Here

TOP

Related Classes of org.woped.core.model.petrinet.GroupModel

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.