Package org.woped.core.model.petrinet

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


                        } else
                            if (toDelete[i] instanceof GroupModel) {
                                allPorts.add(toDelete[i]);
                            } else
                                if (toDelete[i] instanceof AbstractPetriNetElementModel) {
                                    AbstractPetriNetElementModel element = (AbstractPetriNetElementModel) toDelete[i];
                                    // if there are trigger, delete their jgraph model
                                    if (toDelete[i] instanceof TransitionModel) {
                                        if (((TransitionModel) toDelete[i]).getToolSpecific().getTrigger() != null) {
                                            DefaultGraphCell cell = ((TransitionModel) editor.getModelProcessor()
                                                    .getElementContainer().getElementById(element.getId()))
                                                    .getToolSpecific().getTrigger();
                                            if (cell != null) {
                                                deleteCells(new Object[] { cell });
                                            }
                                        }
                                    }
                                    allPorts.add(element.getPort());
                                    allPorts.add(toDelete[i]);
                                    editor.getModelProcessor().getElementContainer().removeOnlyElement(element.getId());

                                }
        }
        Vector<Object> allDeletedObjects = new Vector<Object>();
        allDeletedObjects.addAll(allPorts);
View Full Code Here


                if (points.get(i) instanceof IntPair) {
                    pointArray[i] = new Point2D.Double(((IntPair) points.get(i)).getX1(), ((IntPair) points.get(i))
                            .getX2());
                }
        }
        AbstractPetriNetElementModel source = editor.getModelProcessor().getElementContainer().getElementById(sourceId);
        source = source != null ? source : tStar;
        AbstractPetriNetElementModel target = editor.getModelProcessor().getElementContainer().getElementById(targetId);
        target = target != null ? target : tStar;
        if (editor.getGraph().isValidConnection(source, target)) {
            if (!editor.getModelProcessor().getElementContainer().hasReference(sourceId, targetId)) {

                String id = map.getArcId();
                // if the id isn't set or the id set already belongs to an
                // existing arc then fetch a new one
                if (id == null | editor.getModelProcessor().getElementContainer().getArcById(id) != null) {
                    id = editor.getModelProcessor().getNexArcId();
                }
                // if aalst source or target -> update Model
                arc = ModelElementFactory.createArcModel(id, (DefaultPort) source.getChildAt(0), (DefaultPort) target
                        .getChildAt(0));
                arc.setPoints(pointArray);
                GraphConstants.setSelectable(arc.getAttributes(), false);
                GraphConstants.setLineColor(arc.getAttributes(), T_STAR_COLOR);

                OperatorTransitionModel operatorModel;
                if (source.getType() == AbstractPetriNetElementModel.TRANS_OPERATOR_TYPE) {
                    operatorModel = (OperatorTransitionModel) source;
                    operatorModel.addElement(target);
                    operatorModel.registerOutgoingConnection((PetriNetModelProcessor) editor.getModelProcessor(),
                            target);
                } else
                    if (target.getType() == AbstractPetriNetElementModel.TRANS_OPERATOR_TYPE) {
                        operatorModel = (OperatorTransitionModel) target;
                        operatorModel.addElement(source);
                        operatorModel.registerIncomingConnection((PetriNetModelProcessor) editor.getModelProcessor(),
                                source);
View Full Code Here

      while (handleClusterIter.hasNext()){
        // get current FlowNode element
        ClusterElement element = handleClusterIter.next();
        // refer from current FlowNode element to its parent PetriNet element
        // if the actual element cannot be found in the current focus window
        AbstractPetriNetElementModel highlightElement = element.m_element;
        AbstractPetriNetElementModel owningElement = null;
        if  ((!mediatorReference.getUIReference().getEditorFocus().getModelProcessor().getElementContainer().containsElement(element.m_element.getId())&&
            ((owningElement=element.m_element.getRootOwningContainer().getOwningElement()) != null)))           
          highlightElement = owningElement;
       
        //If algorithm mode is set to 2 (plain petri net with handle correction) highlight
View Full Code Here

      // or 1 Xor-Join operator in the preset.
      if (postset.size() == 2) {
                   
          Iterator<AbstractPetriNetElementModel> postsetIter = postset.iterator();
       
        AbstractPetriNetElementModel postsetCheck1, postsetCheck2;
         
        postsetCheck1 = postsetIter.next();
        postsetCheck2 = postsetIter.next();
       
        // If both elements in the postset are of the type PetriNetModelElement.TRANS_OPERATOR_TYPE
        // get the van der Aalst operator from the owning container and set it as highlightElement.
        postsetCheck1 =  (postsetCheck1.getRootOwningContainer().getOwningElement() != null)
        ? postsetCheck1.getRootOwningContainer().getOwningElement()
        : postsetCheck1;
         
        postsetCheck2 =  (postsetCheck2.getRootOwningContainer().getOwningElement() != null)
        ? postsetCheck2.getRootOwningContainer().getOwningElement()
        : postsetCheck2;
         
        if (postsetCheck1.equals(postsetCheck2) && postsetCheck1.getType() == AbstractPetriNetElementModel.TRANS_OPERATOR_TYPE) {
           
          tempOpTransModel = (OperatorTransitionModel) postsetCheck1;
           
          if (tempOpTransModel.getOperatorType() == OperatorTransitionModel.XOR_SPLIT_TYPE) {           
            // activate coloring of this element
            highlightElement = tempOpTransModel;
          }
        }
      }
     
      // The correction is only done if 2 elements are in the postset and the preset,
      // respectively. This corresponds to exact 1 Xor-Split operator in the postset
      // or 1 Xor-Join operator in the preset.
      else{
        if (preset.size() == 2) {
                     
            Iterator<AbstractPetriNetElementModel> presetIter = preset.iterator();
         
            AbstractPetriNetElementModel presetCheck1, presetCheck2;
           
            presetCheck1 = presetIter.next();
            presetCheck2 = presetIter.next();
                     
            // If both elements in the preset are of the type PetriNetModelElement.TRANS_OPERATOR_TYPE
            // get the van der Aalst operator from the owning container and set it as highlightElement.
            presetCheck1 =  (presetCheck1.getRootOwningContainer().getOwningElement() != null)
            ? presetCheck1.getRootOwningContainer().getOwningElement()
            : presetCheck1;
           
            presetCheck2 =  (presetCheck2.getRootOwningContainer().getOwningElement() != null)
            ? presetCheck2.getRootOwningContainer().getOwningElement()
            : presetCheck2;
         
            if (presetCheck1.equals(presetCheck2) && presetCheck1.getType() == AbstractPetriNetElementModel.TRANS_OPERATOR_TYPE) {
             
              tempOpTransModel = (OperatorTransitionModel) presetCheck1;
             
              if (tempOpTransModel.getOperatorType() == OperatorTransitionModel.XOR_JOIN_TYPE) {
                // activate coloring of this element
View Full Code Here

  }
 
  //! Reset all understandability coloring Information in the current petri net 
  private void resetColoringInformation() {
    Iterator<AbstractPetriNetElementModel> elementIter = qualanService.getPlaces().iterator();
    AbstractPetriNetElementModel currentElement = null;
   
    //reset all places
    while (elementIter.hasNext()){
      currentElement = elementIter.next();
      currentElement.setUnderstandColoringActive(false);
      currentElement.ResetUnderstandabilityColor();
    }
     
    //reset all transitions
    elementIter = qualanService.getTransitions().iterator();
    while (elementIter.hasNext()){
      currentElement = elementIter.next();
      currentElement.setUnderstandColoringActive(false);
      currentElement.ResetUnderstandabilityColor();
    }
   
    //reset all operators
    elementIter = qualanService.getOperators().iterator();
    while (elementIter.hasNext()){
      currentElement = elementIter.next();
      currentElement.setUnderstandColoringActive(false);
      currentElement.ResetUnderstandabilityColor();
    }
  }
View Full Code Here

    AbstractGraph currentGraph = m_currentEditor.getGraph();

    // Finally, select all elements selected in the tree view
    ArrayList<AbstractPetriNetElementModel> newSelection = new ArrayList<AbstractPetriNetElementModel>();
    for (Iterator<Object> i = processedSelection.iterator(); i.hasNext();) {
      AbstractPetriNetElementModel currentObject = (AbstractPetriNetElementModel) i.next();
      // Comparing only the IDs is too risky because we may crash in this
      // case if by
      // accident an id name is not unique.
      // Rather, look up by ID and see if the references match. This if
      // proof
      // that we're actually talking about the same element
      if (m_currentEditor.getModelProcessor().getElementContainer().getElementById(((currentObject).getId())) == currentObject)
        // The selected element is part of the currently edited net
        newSelection.add(currentObject);
      else {
        // The selected element is not part of the currently edited net
        // We will try to open a corresponding sub-net and
        // see if we can select it there
        AbstractPetriNetElementModel parent = currentObject.getRootOwningContainer().getOwningElement();
        if (parent instanceof SubProcessModel) {
          IEditor newEditor = m_mediator.createSubprocessEditor(true, m_currentEditor, (SubProcessModel) parent);
          // Select in the new editor
          newEditor.getGraph().addSelectionCell(currentObject);
        }
View Full Code Here

      Object currentCell = cells[i];
      // Ignore everything but group model selections
      if (currentCell instanceof GroupModel)
        currentCell = ((GroupModel) currentCell).getMainElement();
      if (currentCell instanceof AbstractPetriNetElementModel) {
        AbstractPetriNetElementModel current = (AbstractPetriNetElementModel) currentCell;
        NodeNetInfo correspondingTreeItem = treeItemMap.get(current);
        if (correspondingTreeItem != null) {
          // We found a corresponding tree item
          // Build a selection tree
          selectionPath[1] = correspondingTreeItem;
View Full Code Here

  public void highlightElements(Iterator<AbstractPetriNetElementModel> j) {
    // First, de-highlight all elements
    Iterator<AbstractPetriNetElementModel> i = m_currentEditor.getModelProcessor().getElementContainer().getRootElements().iterator();
    while (i.hasNext()) {
      AbstractPetriNetElementModel current = (AbstractPetriNetElementModel) i.next();
      current.setHighlighted(false);
    }
    // Then, highlight the selected one
    while (j.hasNext()) {
      AbstractPetriNetElementModel currentHigh = j.next();
      currentHigh.setHighlighted(true);
    }
    m_currentEditor.repaint();
  }
View Full Code Here

                    m_editor.getGraph().connect(((ArcModel) elements[i]), false);
                      m_editor.getModelProcessor().getElementContainer().addReference((ArcModel) elements[i]);
                      ((PetriNetModelProcessor)m_editor.getModelProcessor()).insertArc(((ArcModel) elements[i]), true);
                  } else if (elements[i] instanceof GroupModel)
                  {
                      AbstractPetriNetElementModel mainModel = ((GroupModel)elements[i]).getMainElement();
                      if (!Arrays.asList(elements).contains(mainModel))
                          m_editor.getModelProcessor().getElementContainer().addElement(mainModel);
                  } else if (elements[i] instanceof TriggerModel)
                  {
                      TriggerModel trigger = (TriggerModel) elements[i];
View Full Code Here

        }
    }

    private void importArcs(Arc[] arcs, int editorIndex) throws Exception
    {
        AbstractPetriNetElementModel currentSourceModel = null;
        AbstractPetriNetElementModel currentTargetModel = null;
        ArcModel arc = null;
        CreationMap map;
        for (int i = 0; i < arcs.length; i++)
        {
            currentSourceModel = (AbstractPetriNetElementModel) getEditor()[editorIndex].getModelProcessor().getElementContainer().getElementById(arcs[i].getSource());
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.