Put the viewstate in the internal cache

@param viewId The mosby internal View id of the {@link MvpView} which the presenter is
associated to.
@param viewState The Viewstate
977488
public void putViewState(@NonNull String viewId,
      @NonNull Object viewState) {

    if (viewId == null) {
      throw new NullPointerException("ViewId is null");
    }

    if (viewState == null) {
      throw new NullPointerException("ViewState is null");
    }

    PresenterHolder presenterHolder = presenterMap.get(viewId);
    if (presenterHolder == null) {
      presenterHolder = new PresenterHolder();
      presenterHolder.viewState = viewState;
      presenterMap.put(viewId, presenterHolder);
    } else {
      presenterHolder.viewState = viewState;
    }
  }
577556
public void setViewEnabled(boolean enable) {
        final NotificationRootView root = mWindow.mRoot;
        root.setViewEnabled(enable);
        if (enable && mView == null) {
            mView = root.getView();
            mView.initialize(this);
            mView.addStateListener(new ViewStateListener());
        }
    }
1038325
private P restorePresenterOrRecreateNewPresenterAfterProcessDeath() {

    P presenter;

    if (keepPresenterInstanceDuringScreenOrientationChanges) {

      if (mosbyViewId != null
          && (presenter = PresenterManager.getPresenter(getActivity(), mosbyViewId)) != null) {
        //
        // Presenter restored from cache
        //
        if (DEBUG) {
          Log.d(DEBUG_TAG,
              "Reused presenter " + presenter + " for view " + delegateCallback.getMvpView());
        }

        return presenter;
      } else {
        //
        // No presenter found in cache, most likely caused by process death
        //
        presenter = createViewIdAndPresenter();
        if (DEBUG) {
          Log.d(DEBUG_TAG, "No presenter found although view Id was here: "
              + mosbyViewId
              + ". Most likely this was caused by a process death. New Presenter created"
              + presenter
              + " for view "
              + delegateCallback.getMvpView());
        }

        return presenter;
      }
    } else {
      //
      // starting first time, so create a new presenter
      //
      presenter = createViewIdAndPresenter();
      if (DEBUG) {
        Log.d(DEBUG_TAG,
            "New presenter " + presenter + " for view " + delegateCallback.getMvpView());
      }
      return presenter;
    }
  }
1279434
public String getDeployedViewURI(String controllerName, String viewName) {
        FastStringWriter buf = new FastStringWriter(PATH_TO_VIEWS);
        return getViewURIInternal(controllerName, viewName, buf, true);
    }
1072531
public void remove(@NonNull String viewId) {

    if (viewId == null) {
      throw new NullPointerException("View Id is null");
    }

    presenterMap.remove(viewId);
  }
841283
public static void setImageResource(EfficientCacheView cacheView, int viewId,
            @DrawableRes int resId) {
        View view = cacheView.findViewByIdEfficient(viewId);
        if (view instanceof ImageView) {
            ((ImageView) view).setImageResource(resId);
        }
    }
1052217
public void updateDrawableState(int state, boolean flag) {
        final int oldState = mCombinedState;
        // Update the combined state flag
        if (flag) mCombinedState |= state;
        else mCombinedState &= ~state;

        // Set the combined state
        if (oldState != mCombinedState) {
            setState(VIEW_STATE_SETS[mCombinedState]);
        }
    }
395672
public static void setBackgroundResource(EfficientCacheView cacheView, int viewId,
            @DrawableRes int resid) {
        View view = cacheView.findViewByIdEfficient(viewId);
        if (view != null) {
            view.setBackgroundResource(resid);
        }
    }
874603
@SuppressWarnings("WeakerAccess")
	public void detachView(View view) {
		if (mViewState != null) {
			mViewState.detachView(view);
		} else {
			mViews.remove(view);
		}
	}
78481
public void render(ViewState viewState)
    {
        if (viewState.loadingData())
            mMainBinding.tvText.append("\nLoading...");
        else if (viewState.data() != null)
            mMainBinding.tvText.append("\n" + viewState.data());
    }
744148
public void setView(int which , boolean fixed , Se3_F64 worldToView ) {
		views[which].known = fixed;
		views[which].worldToView.set(worldToView);
	}
117267
@NonNull
    @Override
    public final RecyclerView.ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
        final LayoutInflater inflater = LayoutInflater.from(parent.getContext());
        if (headerContent != null) {
            if (viewType == headerContent.getViewtype()) {
                final PeasyHeaderViewHolder header = headerContent.onCreateViewHolder(inflater, parent, viewType);
                if (header != null) {
                    header.bindWith(this, viewType);
                    return header;
                }
            }
        }
        if (footerContent != null) {
            if (viewType == footerContent.getViewtype()) {
                final PeasyFooterViewHolder footer = footerContent.onCreateViewHolder(inflater, parent, viewType);
                if (footer != null) {
                    footer.bindWith(this, viewType);
                    return footer;
                }
            }
        }
        final PeasyViewHolder vh = onCreateViewHolder(inflater, parent, viewType);
        vh.bindWith(this, viewType);
        return vh;
    }
847892
@Deprecated
	public void setViewStates(@NonNull final SparseArray<ViewState> states) {
		mViewStates.clear();
		for (int i = 0; i < states.size(); i++) {
			final int key = states.keyAt(i);
			final ViewState value = states.get(key);
			mViewStates.put(key, value);
		}
	}
206057
@Override public void onRestoreInstanceState(Parcelable state) {
    if (isInEditMode) return;

    if (!(state instanceof MosbyViewStateSavedState)) {
      delegateCallback.superOnRestoreInstanceState(state);
      return;
    }

    MosbyViewStateSavedState savedState = (MosbyViewStateSavedState) state;
    mosbyViewId = savedState.getMosbyViewId();
    restoreableParcelableViewState = (VS) savedState.getRestoreableViewState();
    delegateCallback.superOnRestoreInstanceState(savedState.getSuperState());
  }
906859
@Override
    public Object saveView(FacesContext facesContext)
    {
        UIViewRoot uiViewRoot = facesContext.getViewRoot();
        
        if (uiViewRoot.isTransient())
        {
            return null;
        }
        
        Object serializedView = null;
        ResponseStateManager responseStateManager = facesContext.getRenderKit().getResponseStateManager();
        
        String viewId = uiViewRoot.getViewId();
        ViewDeclarationLanguage vdl = facesContext.getApplication().
            getViewHandler().getViewDeclarationLanguage(facesContext,viewId);
        
        try
        {
            facesContext.getAttributes().put(StateManager.IS_SAVING_STATE, Boolean.TRUE);
            if (vdl != null)
            {
                StateManagementStrategy sms = vdl.getStateManagementStrategy(facesContext, viewId);
                
                if (sms != null)
                {
                    if (log.isLoggable(Level.FINEST))
                    {
                        log.finest("Calling saveView of StateManagementStrategy: " + sms.getClass().getName());
                    }
                    
                    serializedView = sms.saveView(facesContext);
                    
                    // If MyfacesResponseStateManager is used, give the option to do
                    // additional operations for save the state if is necessary.
                    if (StateCacheUtils.isMyFacesResponseStateManager(responseStateManager))
                    {
                        StateCacheUtils.getMyFacesResponseStateManager(responseStateManager).
                                saveState(facesContext, serializedView);
                    }
                    
                    return serializedView; 
                }
            }
    
            // In StateManagementStrategy.saveView there is a check for transient at
            // start, but the same applies for VDL without StateManagementStrategy,
            // so this should be checked before call parent (note that parent method
            // does not do this check).
            if (uiViewRoot.isTransient())
            {
                return null;
            }
    
            if (log.isLoggable(Level.FINEST))
            {
                log.finest("Entering saveSerializedView");
            }
    
            checkForDuplicateIds(facesContext, facesContext.getViewRoot(), new HashSet<String>());
    
            if (log.isLoggable(Level.FINEST))
            {
                log.finest("Processing saveSerializedView - Checked for duplicate Ids");
            }
    
            // SerializedView already created before within this request?
            serializedView = facesContext.getAttributes().get(SERIALIZED_VIEW_REQUEST_ATTR);
            if (serializedView == null)
            {
                if (log.isLoggable(Level.FINEST))
                {
                    log.finest("Processing saveSerializedView - create new serialized view");
                }
    
                // first call to saveSerializedView --> create SerializedView
                Object treeStruct = getTreeStructureToSave(facesContext);
                Object compStates = getComponentStateToSave(facesContext);
                Object rlcStates = !facesContext.getResourceLibraryContracts().isEmpty() ? 
                    UIComponentBase.saveAttachedState(facesContext, 
                                new ArrayList<String>(facesContext.getResourceLibraryContracts())) : null;
                serializedView = new Object[] {
                        new Object[]{treeStruct, rlcStates} ,
                        compStates};
                facesContext.getAttributes().put(SERIALIZED_VIEW_REQUEST_ATTR,
                                                    serializedView);
    
                if (log.isLoggable(Level.FINEST))
                {
                    log.finest("Processing saveSerializedView - new serialized view created");
                }
            }
            
            // If MyfacesResponseStateManager is used, give the option to do
            // additional operations for save the state if is necessary.
            if (StateCacheUtils.isMyFacesResponseStateManager(responseStateManager))
            {
                StateCacheUtils.getMyFacesResponseStateManager(responseStateManager).
                        saveState(facesContext, serializedView);
            }
    
            if (log.isLoggable(Level.FINEST))
            {
                log.finest("Exiting saveView");
            }
        }
        finally
        {
            facesContext.getAttributes().remove(StateManager.IS_SAVING_STATE);
        }

        return serializedView;
    }
1059156
private P createViewIdAndCreatePresenter() {

    P presenter = delegateCallback.createPresenter();
    if (presenter == null) {
      throw new NullPointerException(
          "Presenter returned from createPresenter() is null. Fragment is " + fragment);
    }
    if (keepPresenterDuringScreenOrientationChange || keepPresenterOnBackstack) {
      Activity activity = getActivity();
      mosbyViewId = UUID.randomUUID().toString();
      PresenterManager.putPresenter(activity, mosbyViewId, presenter);
    }
    return presenter;
  }
102903
public void viewChange(View view) {
        if(view == null)
            return;

        // SiteAddresses are not checked as they might be in a different cluster
        if(!(target instanceof SiteAddress) && !view.containsMember(target) && !isDone()) {
            completeExceptionally(new SuspectedException(target));
            corrDone();
        }
    }