Esempio n. 1
0
    public void lifeCycleStateChanged(LifeCycleTransition transition) {
      if (!disposed) {
        LifeCycleState actualCurrentState = lastTransition.getCurrentState();
        if (!transition.getCurrentState().equals(actualCurrentState)) {
          LifeCycleState expectedCurrentState = transition.getPreviousState();

          synchronized (parent) {
            if (!expectedCurrentState.equals(actualCurrentState)) {
              int expectedIndex = LifeCycleState.STATES.indexOf(expectedCurrentState);
              int actualIndex = LifeCycleState.STATES.indexOf(actualCurrentState);

              int increment = actualIndex < expectedIndex ? 1 : -1;

              do {
                int nextIndex = actualIndex + increment;

                LifeCycleTransition nextTransition =
                    new LifeCycleTransition(
                        (LifeCycleState) LifeCycleState.STATES.get(actualIndex),
                        (LifeCycleState) LifeCycleState.STATES.get(nextIndex));

                notifyLastTransition(nextTransition);

                actualIndex = nextIndex;
              } while (actualIndex != expectedIndex);
            }

            notifyLastTransition(transition);

            lastTransition = transition;
          }
        }
      }
    }
Esempio n. 2
0
        public synchronized void lifeCycleStateChanged(LifeCycleTransition transition) {

          if (!disposed) {
            LifeCycleState state = transition.getCurrentState();
            if (transition.equals(LifeCycleTransition.LOADED_DORMANT)) {

              disposed = true;
              disposeLifeCycleClient();

              if (getParent() != null) swapProxy(); // getParent().refreshChildren();
            } else if (state.equals(LifeCycleState.ABSENT)) {
              refreshVisual();
            } else if (transition.equals(LifeCycleTransition.DORMANT_LOADED)) {
              if (getParent() != null) getParent().refreshChildren();
            } else {
              updateVisual();
            }
          }
        }
Esempio n. 3
0
  private synchronized void doAddOutboundReference(
      Meem meem, Reference reference, boolean automaticRemove) {
    if (reference.getFacetIdentifier().equals("lifeCycleClient")) {
      addLifeCycleReference(reference, automaticRemove);
    } else if (meem != null) {
      meem.addOutboundReference(reference, automaticRemove);
    } else {
      ContentClient contentClient =
          MeemSystemWedge.getContentClientFromTarget(reference.getTarget());

      contentClient.contentFailed(
          "Cannot add reference to Meem in LifeCycleState of "
              + lastTransition.getCurrentState().getCurrentState());
    }
  }