Package org.woped.core.model.petrinet

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


  public List<AbstractPetriNetElementModel> getRootElements() {

    List<AbstractPetriNetElementModel> rootElements = new ArrayList<AbstractPetriNetElementModel>();
    Iterator<String> allIter = getIdMap().keySet().iterator();
    while (allIter.hasNext()) {
      AbstractPetriNetElementModel element = getElementById(allIter.next());
      rootElements.add(element);
    }

    return rootElements;
View Full Code Here


  }

  public Map<String, AbstractPetriNetElementModel> getElementsByType(int type) {
    Map<String, AbstractPetriNetElementModel> elements = new HashMap<String, AbstractPetriNetElementModel>();
    Iterator<String> elementsIter = getIdMap().keySet().iterator();
    AbstractPetriNetElementModel element;
    // try {
    while (elementsIter.hasNext()) {
      element = getElementById(elementsIter.next());
      if (element != null && element.getType() == type) {
        elements.put(element.getId(), element);
      }
    }
    // } catch (Exception e) {
    // e.printStackTrace();
    // }
View Full Code Here

 
 
  private void clearHighlightingEditor(){
    Iterator<AbstractPetriNetElementModel> i = this.editor.getModelProcessor().getElementContainer().getRootElements().iterator();
    while (i.hasNext()) {
      AbstractPetriNetElementModel current = (AbstractPetriNetElementModel) i.next();
      current.setHighlighted(false);
     
      if (current.getType() == AbstractPetriNetElementModel.TRANS_OPERATOR_TYPE)
            {
              OperatorTransitionModel operatorModel = (OperatorTransitionModel) current;
                Iterator<AbstractPetriNetElementModel> simpleTransIter = operatorModel.getSimpleTransContainer().getElementsByType(AbstractPetriNetElementModel.TRANS_SIMPLE_TYPE).values().iterator();
                while (simpleTransIter.hasNext())
                {
                    AbstractPetriNetElementModel simpleTransModel = (AbstractPetriNetElementModel) simpleTransIter.next();
                    if (simpleTransModel != null
                            && operatorModel.getSimpleTransContainer().getElementById(simpleTransModel.getId()).getType() == AbstractPetriNetElementModel.TRANS_SIMPLE_TYPE)
                    {
                      simpleTransModel.setHighlighted(false);
                    }
                }   
            }
    }
    this.editor.repaint();
View Full Code Here

  private void saveModelElementContainer(NetType iNet, ModelElementContainer elementContainer){
 
    Iterator<AbstractPetriNetElementModel> root2Iter = elementContainer.getRootElements().iterator();
        while (root2Iter.hasNext())
        {
            AbstractPetriNetElementModel currentModel = (AbstractPetriNetElementModel) root2Iter.next();
           
           
              /* ##### PLACES ##### */
            if (currentModel.getType() == AbstractPetriNetElementModel.PLACE_TYPE)
            {
                initPlace(iNet.addNewPlace(), (PlaceModel) currentModel);
            }
            /* ##### NORMAL TRANSITION ##### */
            else if (currentModel.getType() == AbstractPetriNetElementModel.TRANS_SIMPLE_TYPE)
            {
                initTransition(iNet.addNewTransition(), (TransitionModel) currentModel, null);

            }
              /* ##### SUB TRANSITION ##### */
            else if (currentModel.getType() == AbstractPetriNetElementModel.SUBP_TYPE)
            {
                initTransition(iNet.addNewTransition(), (TransitionModel) currentModel, null);
            }
              /* ##### OPERATOR TRANSITION ##### */
            else if (currentModel.getType() == AbstractPetriNetElementModel.TRANS_OPERATOR_TYPE)
            {
              OperatorTransitionModel operatorModel = (OperatorTransitionModel) currentModel;
                Iterator<AbstractPetriNetElementModel> simpleTransIter = operatorModel.getSimpleTransContainer().getElementsByType(AbstractPetriNetElementModel.TRANS_SIMPLE_TYPE).values().iterator();
                while (simpleTransIter.hasNext())
                {
                    AbstractPetriNetElementModel simpleTransModel = (AbstractPetriNetElementModel) simpleTransIter.next();
                    if (simpleTransModel != null
                            && operatorModel.getSimpleTransContainer().getElementById(simpleTransModel.getId()).getType() == AbstractPetriNetElementModel.TRANS_SIMPLE_TYPE)
                    {
                        initTransition(iNet.addNewTransition(), (TransitionModel) operatorModel.getSimpleTransContainer().getElementById(simpleTransModel.getId()), operatorModel);
                    }

                }
                if (operatorModel.getCenterPlace() != null)
                {
                    initPlace(iNet.addNewPlace(), operatorModel.getCenterPlace());
                }
            }
        }

          /* ##### ARCS ##### */
        this.arcCounter = 0;
        Set<AbstractPetriNetElementModel> connectedTransitions = new HashSet<AbstractPetriNetElementModel>()
        Iterator<String> arcIter = elementContainer.getArcMap().keySet().iterator();
        while (arcIter.hasNext())
        {
            ArcModel currentArc = elementContainer.getArcById(arcIter.next());
            AbstractPetriNetElementModel currentTargetModel = (AbstractPetriNetElementModel) elementContainer.getElementById(currentArc.getTargetId());
            AbstractPetriNetElementModel currentSourceModel = (AbstractPetriNetElementModel) elementContainer.getElementById(currentArc.getSourceId());

            if (currentTargetModel.getType() == AbstractPetriNetElementModel.TRANS_OPERATOR_TYPE)
              connectedTransitions.add(currentTargetModel);
            else if (currentSourceModel.getType() == AbstractPetriNetElementModel.TRANS_OPERATOR_TYPE)
              connectedTransitions.add(currentSourceModel);
            else
            {
                initArc(iNet.addNewArc(), currentArc, null);
            }
View Full Code Here

     
      Object object = this.editor.getGraph().getFirstCellForLocation(e.getX(), e.getY());
      this.table.getSelectionModel().setSelectionMode(ListSelectionModel.MULTIPLE_INTERVAL_SELECTION);
     
      if(object instanceof GroupModel){
        AbstractPetriNetElementModel model = ((GroupModel)object).getMainElement();
       

        String selection= model.getId();   
       
        clearHighlightingEditor();
//        model.setHighlighted(true);

        this.table.clearSelection();

        if (model.getType() == AbstractPetriNetElementModel.TRANS_OPERATOR_TYPE)
              {
                OperatorTransitionModel operatorModel = (OperatorTransitionModel) model;
                  Iterator<AbstractPetriNetElementModel> simpleTransIter = operatorModel.getSimpleTransContainer().getElementsByType(AbstractPetriNetElementModel.TRANS_SIMPLE_TYPE).values().iterator();
                  while (simpleTransIter.hasNext())
                  {
                      AbstractPetriNetElementModel simpleTransModel = (AbstractPetriNetElementModel) simpleTransIter.next();
                      if (simpleTransModel != null
                              && operatorModel.getSimpleTransContainer().getElementById(simpleTransModel.getId()).getType() == AbstractPetriNetElementModel.TRANS_SIMPLE_TYPE)
                      {
                          if(highlightElementInTable(simpleTransModel.getId()) == true){
                            model.setHighlighted(true);
                          }
                      }

                  }
View Full Code Here

    String[] selection = ((String)this.table.getValueAt(row,0)).split(",");
       
    Iterator<AbstractPetriNetElementModel> i = this.editor.getModelProcessor().getElementContainer().getRootElements().iterator();
 
    while (i.hasNext()) {
      AbstractPetriNetElementModel current = (AbstractPetriNetElementModel) i.next();
      current.setHighlighted(false);
      if (current.getType() == AbstractPetriNetElementModel.TRANS_OPERATOR_TYPE)
            {
              OperatorTransitionModel operatorModel = (OperatorTransitionModel) current;
                Iterator<AbstractPetriNetElementModel> simpleTransIter = operatorModel.getSimpleTransContainer().getElementsByType(AbstractPetriNetElementModel.TRANS_SIMPLE_TYPE).values().iterator();
                while (simpleTransIter.hasNext())
                {
                    AbstractPetriNetElementModel simpleTransModel = (AbstractPetriNetElementModel) simpleTransIter.next();
                    if (simpleTransModel != null
                            && operatorModel.getSimpleTransContainer().getElementById(simpleTransModel.getId()).getType() == AbstractPetriNetElementModel.TRANS_SIMPLE_TYPE)
                    {
                      simpleTransModel.setHighlighted(false);
                      for(String id : selection){
                    if (simpleTransModel.getId().equals(id)){
                      current.setHighlighted(true);
                      simpleTransModel.setHighlighted(true);
                    }
                  }
                    }
                }   
            }
View Full Code Here

    qualanService = null;
    // clear the selection
    Iterator<AbstractPetriNetElementModel> i = editor.getModelProcessor()
        .getElementContainer().getRootElements().iterator();
    while (i.hasNext()) {
      AbstractPetriNetElementModel current = (AbstractPetriNetElementModel) i.next();
      current.setHighlighted(false);
    }
  }
View Full Code Here

      tStarCheckBox.setEnabled(false);
  }

  public void showTStarIfPossible() {
    if (tStarCheckBox.isSelected() && workflowStatus) {
      AbstractPetriNetElementModel source = getQualanalysisService()
          .getSourcePlaces().iterator().next();
      AbstractPetriNetElementModel sink = getQualanalysisService()
          .getSinkPlaces().iterator().next();
      if (tStar == null)
        tStar = new TStar(editor);
      tStar.updateTStar(source, sink);
    } else {
View Full Code Here

        // Find Cell at point (No scaling needed here)
        Object cell = getEditor().getGraph().getFirstCellForLocation(p.getX(), p.getY());

        // return port view of cell element.
        if (cell != null && cell instanceof GroupModel) {
            AbstractPetriNetElementModel aem = ((GroupModel) cell).getMainElement();
            Object result = getEditor().getGraph().getGraphLayoutCache().getMapping(aem.getPort(), false);

            if (result instanceof PortView && firstPort != result) {
                return (PortView) result;
            }
        }
View Full Code Here

     * @param target
     * @return
     */
    public boolean isValidConnection(Port source, Port target)
    {
        AbstractPetriNetElementModel sourceCell = (AbstractPetriNetElementModel) ((DefaultPort) source).getParent();
        AbstractPetriNetElementModel targetCell = (AbstractPetriNetElementModel) ((DefaultPort) target).getParent();
        return isValidConnection(sourceCell, targetCell);
    }
View Full Code Here

TOP

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

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.