/**
  * Removes the active tab from display if it exists. Note active tab must be removed from
  * netControllers before the petri net is removed from the manager because the manager will fire a
  * message which causes the active tab to be swapped to the new open tab
  */
 public void removeActiveTab() {
   if (activeTab != null) {
     PetriNetController controller = netControllers.get(activeTab);
     netControllers.remove(activeTab);
     PetriNet petriNet = controller.getPetriNet();
     manager.remove(petriNet);
   }
 }
 /** @return the names of the petri nets that have changed */
 public Set<String> getNetsChanged() {
   Set<String> changed = new HashSet<>();
   for (PetriNetController controller : netControllers.values()) {
     if (controller.hasChanged()) {
       changed.add(controller.getPetriNet().getNameValue());
     }
   }
   return changed;
 }
  /**
   * Save the currently displayed petri net to the specified file
   *
   * @param outFile location to save the Petri net
   * @throws ParserConfigurationException
   * @throws TransformerException
   * @throws IllegalAccessException
   * @throws NoSuchMethodException
   * @throws InvocationTargetException
   */
  public void saveAsCurrentPetriNet(File outFile)
      throws ParserConfigurationException, TransformerException, IllegalAccessException,
          NoSuchMethodException, InvocationTargetException {
    PetriNetController petriNetController = getActivePetriNetController();
    PetriNet petriNet = petriNetController.getPetriNet();

    try {
      manager.savePetriNet(petriNet, outFile);
    } catch (JAXBException e) {
      throw new RuntimeException("Failed to write!", e);
    }
    petriNetController.save();
  }
Example #4
0
  @Override
  public void actionPerformed(ActionEvent event) {
    PetriNetController petriNetController = applicationController.getActivePetriNetController();
    boolean animated = petriNetController.toggleAnimation();

    applicationModel.setInAnimationMode(animated);

    noopAction.actionPerformed(null);

    GUIAnimator animator = petriNetController.getAnimator();
    if (animated) {
      animator.startAnimation();
    } else {
      animator.finish();
    }
  }
 /** @return true if the current petri net has changed */
 public boolean hasCurrentPetriNetChanged() {
   PetriNetController activeController = getActivePetriNetController();
   return activeController != null && activeController.hasChanged();
 }