public static void beginDelayedTransition(ViewGroup sceneRoot, Transition transition) {
   if (!sPendingTransitions.contains(sceneRoot) && sceneRoot.isLaidOut()) {
     sPendingTransitions.add(sceneRoot);
     if (transition == null) {
       transition = sDefaultTransition;
     }
     Transition transitionClone = transition.clone();
     sceneChangeSetup(sceneRoot, transitionClone);
     Scene.setCurrentScene(sceneRoot, null);
     sceneChangeRunTransition(sceneRoot, transitionClone);
   }
 }
 private static void changeScene(Scene scene, Transition transition) {
   ViewGroup sceneRoot = scene.getSceneRoot();
   Transition transitionClone = null;
   if (transition != null) {
     transitionClone = transition.clone();
     transitionClone.setSceneRoot(sceneRoot);
   }
   Scene oldScene = Scene.getCurrentScene(sceneRoot);
   if (!(oldScene == null || transitionClone == null || !oldScene.isCreatedFromLayoutResource())) {
     transitionClone.setCanRemoveViews(true);
   }
   sceneChangeSetup(sceneRoot, transitionClone);
   scene.enter();
   sceneChangeRunTransition(sceneRoot, transitionClone);
 }
 /**
  * Convenience method to animate to a new scene defined by all changes within the given scene root
  * between calling this method and the next rendering frame. Calling this method causes
  * TransitionManager to capture current values in the scene root and then post a request to run a
  * transition on the next frame. At that time, the new values in the scene root will be captured
  * and changes will be animated. There is no need to create a Scene; it is implied by changes
  * which take place between calling this method and the next frame when the transition begins.
  *
  * <p>Calling this method several times before the next frame (for example, if unrelated code also
  * wants to make dynamic changes and run a transition on the same scene root), only the first call
  * will trigger capturing values and exiting the current scene. Subsequent calls to the method
  * with the same scene root during the same frame will be ignored.
  *
  * <p>Passing in <code>null</code> for the transition parameter will cause the TransitionManager
  * to use its default transition.
  *
  * @param sceneRoot The root of the View hierarchy to run the transition on.
  * @param transition The transition to use for this change. A value of null causes the
  *     TransitionManager to use the default transition.
  */
 public static void beginDelayedTransition(final ViewGroup sceneRoot, Transition transition) {
   if (!sPendingTransitions.contains(sceneRoot) && sceneRoot.isLaidOut()) {
     if (Transition.DBG) {
       Log.d(
           LOG_TAG, "beginDelayedTransition: root, transition = " + sceneRoot + ", " + transition);
     }
     sPendingTransitions.add(sceneRoot);
     if (transition == null) {
       transition = sDefaultTransition;
     }
     final Transition transitionClone = transition.clone();
     sceneChangeSetup(sceneRoot, transitionClone);
     Scene.setCurrentScene(sceneRoot, null);
     sceneChangeRunTransition(sceneRoot, transitionClone);
   }
 }
Exemple #4
0
  public PetriNet getSelection(Boolean delete) {
    PetriNet retVal = new PetriNet();

    Iterator<Place> placeIt = places.values().iterator();

    while (placeIt.hasNext()) {
      Place next = placeIt.next();

      if (next.selected) {
        retVal.addPlace((Place) next.clone());
      }
    }

    Iterator<Transition> transIt = transitions.values().iterator();

    while (transIt.hasNext()) {
      Transition next = transIt.next();

      if (next.selected) {
        retVal.addTransition((Transition) next.clone());
      }
    }

    Iterator<Edge> edgeIt = edges.iterator();

    while (edgeIt.hasNext()) {
      Edge next = edgeIt.next();

      if (next.isSelected()) {
        Edge e = new Edge(retVal);

        if (next.from instanceof Transition) {
          e.from = retVal.transitions.get(next.from.sign);
          e.to = retVal.places.get(next.to.sign);
        } else if (next.from instanceof Place) {
          e.from = retVal.places.get(next.from.sign);
          e.to = retVal.transitions.get(next.to.sign);
        }

        if (e.from != null && e.to != null) retVal.edges.add(e);
      }
    }

    if (delete) {
      for (int i = 0; i < edges.size(); ++i) {
        if (edges.get(i).isSelected()) {
          edges.remove(i);
          --i;
        }
      }

      transIt = retVal.transitions.values().iterator();

      while (transIt.hasNext()) {
        Transition next = transIt.next();
        transitions.remove(next.sign);
      }

      placeIt = retVal.places.values().iterator();

      while (placeIt.hasNext()) {
        Place next = placeIt.next();
        places.remove(next.sign);
      }
    }

    return retVal;
  }