/** Enable the observer, unless we are in search mode, where we want it disabled. */ public void enableObserver(SessionState state) { // get the observer ObservingCourier observer = (ObservingCourier) state.getAttribute(STATE_OBSERVER); if (observer != null) { // we leave it disabled if we are searching, or if the user has last selected to be manual if ((state.getAttribute(STATE_SEARCH) != null) || (state.getAttribute(STATE_MANUAL_REFRESH) != null)) { observer.disable(); } else { observer.enable(); } } } // enableObserver
/** Toggle auto-update */ public void doAuto(RunData data, Context context) { // access the portlet element id to find our state String peid = ((JetspeedRunData) data).getJs_peid(); SessionState state = ((JetspeedRunData) data).getPortletSessionState(peid); // get the observer ObservingCourier observer = (ObservingCourier) state.getAttribute(STATE_OBSERVER); if (observer != null) { boolean enabled = observer.getEnabled(); if (enabled) { observer.disable(); state.setAttribute(STATE_MANUAL_REFRESH, "manual"); } else { observer.enable(); state.removeAttribute(STATE_MANUAL_REFRESH); } } } // doAuto