org.granite.client.tide.server
Class TrackingContext

java.lang.Object
  extended by org.granite.client.tide.server.TrackingContext

public class TrackingContext
extends Object

Author:
William DRAI

Nested Class Summary
static interface TrackingContext.UpdateFilter
           
 
Constructor Summary
TrackingContext()
           
 
Method Summary
 void addLastResult(String res)
           
 boolean addResult(String componentName, String componentClassName, String expr, Object instance)
           
 void addUpdate(String componentName, String componentClassName, String expr, Object value)
           
 void clear()
           
 void clearPendingUpdates()
          Resets the current pending updates
 void clearUpdates(boolean savePending)
          Resets the current updates and optionally saves them as pending
 void filterUpdates(TrackingContext.UpdateFilter filter)
          Filter the current updates with a function
 List<org.granite.tide.invocation.ContextResult> getResults()
           
 List<org.granite.tide.invocation.ContextUpdate> getUpdates()
           
protected  boolean internalAddResult(String componentName, String componentClassName, String expr, Object instance, ScopeType scope, SyncMode sync)
           
protected  void internalAddUpdate(String componentName, String componentClassName, String expr, Object value, ScopeType scope, SyncMode sync, boolean typed)
           
 boolean isEnabled()
           
 void removeResults(List<org.granite.tide.invocation.ContextUpdate> rmap)
           
 void restoreContext(Map<String,Object> trackingContext)
           
 Map<String,Object> saveAndResetContext()
           
 void setEnabled(boolean enabled)
           
 void traceContext()
          Trace the current tracking context
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

TrackingContext

public TrackingContext()
Method Detail

setEnabled

public void setEnabled(boolean enabled)
Parameters:
enabled - enable or disable tracking on the current context

isEnabled

public boolean isEnabled()
Returns:
true if tracking enabled

getUpdates

public List<org.granite.tide.invocation.ContextUpdate> getUpdates()
Returns:
current list of updates that will be sent to the server

getResults

public List<org.granite.tide.invocation.ContextResult> getResults()
Returns:
current list of results that will be requested from the server

clear

public void clear()

clearUpdates

public void clearUpdates(boolean savePending)
Resets the current updates and optionally saves them as pending

Parameters:
savePending - moves existing updates to pending before clearing

clearPendingUpdates

public void clearPendingUpdates()
Resets the current pending updates


filterUpdates

public void filterUpdates(TrackingContext.UpdateFilter filter)
Filter the current updates with a function


addUpdate

public void addUpdate(String componentName,
                      String componentClassName,
                      String expr,
                      Object value)
Parameters:
componentName - name of the component/context variable or null if typed component reference
componentClassName - class name of the component/context variable or null if untyped component name
expr - EL expression to evaluate
value - value to send to server
typed - component name represents a typed component instance

internalAddUpdate

protected void internalAddUpdate(String componentName,
                                 String componentClassName,
                                 String expr,
                                 Object value,
                                 ScopeType scope,
                                 SyncMode sync,
                                 boolean typed)
Parameters:
componentName - name of the component/context variable or null if typed component reference
componentClassName - class name of the component/context variable or null if untyped component name
expr - EL expression to evaluate
value - value to send to server
scope - scope of the result
sync - remote sync mode of the result
typed - component name represents a typed component instance

addResult

public boolean addResult(String componentName,
                         String componentClassName,
                         String expr,
                         Object instance)
Parameters:
componentName - name of the component/context variable
componentClassName - class name of the component/context variable
expr - EL expression to evaluate
instance - current instance of the component
Returns:
true if the result was not already present in the current context

internalAddResult

protected boolean internalAddResult(String componentName,
                                    String componentClassName,
                                    String expr,
                                    Object instance,
                                    ScopeType scope,
                                    SyncMode sync)
Parameters:
componentName - name of the component/context variable
componentClassName - class name of the component/context variable
expr - EL expression to evaluate
instance - current instance of the component
scope - scope of the update
sync - remote sync mode of the update
Returns:
true if the result was not already present in the current context

addLastResult

public void addLastResult(String res)

removeResults

public void removeResults(List<org.granite.tide.invocation.ContextUpdate> rmap)

traceContext

public void traceContext()
Trace the current tracking context


saveAndResetContext

public Map<String,Object> saveAndResetContext()
Returns:
saved tracking context

restoreContext

public void restoreContext(Map<String,Object> trackingContext)
Parameters:
trackingContext - object containing the current call context