コード例 #1
0
 /**
  * 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);
   }
 }
コード例 #2
0
 /** @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;
 }
コード例 #3
0
  /**
   * 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();
  }
コード例 #4
0
 /** @return true if the current petri net has changed */
 public boolean hasCurrentPetriNetChanged() {
   PetriNetController activeController = getActivePetriNetController();
   return activeController != null && activeController.hasChanged();
 }