com.tonbeller.jpivot.tags
Class OlapModelProxy

java.lang.Object
  extended by com.tonbeller.jpivot.core.ExtensionSupport
      extended by com.tonbeller.jpivot.olap.model.OlapModelDecorator
          extended by com.tonbeller.jpivot.tags.OlapModelProxy
All Implemented Interfaces:
Extension, Model, OlapModel, com.tonbeller.wcf.bookmarks.Bookmarkable, java.util.EventListener, javax.servlet.http.HttpSessionBindingListener

public class OlapModelProxy
extends OlapModelDecorator
implements javax.servlet.http.HttpSessionBindingListener

proxy for OlapModel. There is one instance per session, the GUI components refer to this instance. When the underlying OlapModel (decoree) is exchanged, a structureChanged event is fired.

OlapModelProxy is responsible for calling initialize/destroy on its decoree(s).

When a new decoree is set, the previous one will be destroyed.


Nested Class Summary
 
Nested classes/interfaces inherited from interface com.tonbeller.jpivot.olap.model.OlapModel
OlapModel.EmptyCubeException, OlapModel.ResultTooLargeException
 
Field Summary
static java.lang.String DEFAULT_NAME
           
 
Fields inherited from class com.tonbeller.jpivot.olap.model.OlapModelDecorator
delegate
 
Fields inherited from interface com.tonbeller.wcf.bookmarks.Bookmarkable
EXTENSIONAL, INTENSIONAL
 
Method Summary
 void addModelChangeListener(ModelChangeListener l)
          adds a model change listener
 void destroy()
          OlapModelProxy is responsible for calling initialize/destroy
 void destroyAll()
           
 void destroyQuery(java.lang.String queryName)
           
 StateManager getStateManager()
          for Tests only
 void initialize()
          OlapModelProxy is responsible for calling initialize/destroy
 void initializeAndShow(OlapModel model)
          destroys the current model, if present.
 void initializeAndShow(java.lang.String queryName, OlapModel model)
          destroys the current model with the given queryName, if present.
static OlapModelProxy instance(java.lang.String id, javax.servlet.http.HttpSession session)
           
static OlapModelProxy instance(java.lang.String id, javax.servlet.http.HttpSession session, boolean stackMode)
          retrieves the instance from the session.
 void removeModelChangeListener(ModelChangeListener l)
          removes a model change listener
 void showByName(java.lang.String queryName)
          shows the query that was initialized with queryName.
 void valueBound(javax.servlet.http.HttpSessionBindingEvent ev)
           
 void valueUnbound(javax.servlet.http.HttpSessionBindingEvent ev)
           
 
Methods inherited from class com.tonbeller.jpivot.olap.model.OlapModelDecorator
addExtension, decorate, getBookmarkState, getDelegate, getDimensions, getExtension, getExtensions, getID, getMeasures, getResult, getRootModel, getTopDecorator, setBookmarkState, setDelegate, setID, setLocale, setServletContext
 
Methods inherited from class com.tonbeller.jpivot.core.ExtensionSupport
getId, getModel, modelInitialized, setId, setModel
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DEFAULT_NAME

public static final java.lang.String DEFAULT_NAME
See Also:
Constant Field Values
Method Detail

instance

public static OlapModelProxy instance(java.lang.String id,
                                      javax.servlet.http.HttpSession session)

instance

public static OlapModelProxy instance(java.lang.String id,
                                      javax.servlet.http.HttpSession session,
                                      boolean stackMode)
retrieves the instance from the session. If the instance does not exist, a new instance is created and stored as a session attribute

Parameters:
id - the name of the session attribute that will be created. Use this name to reference from other tags like pivot table, chart etc.
session - the current session, will contain the new created attribute
stackMode - if true, queries with different names are stacked, i.e. a StackStateManager will be used. Otherwise queries with different names will exist parallel, i.e. a PageStackManager is used. This attribute is evaluated only when the session attribute is created, i.e. when this method is called for the first time.

initializeAndShow

public void initializeAndShow(OlapModel model)
                       throws java.lang.Exception
destroys the current model, if present. Then the new model is initalized and shown.

Throws:
java.lang.Exception

initializeAndShow

public void initializeAndShow(java.lang.String queryName,
                              OlapModel model)
                       throws java.lang.Exception
destroys the current model with the given queryName, if present. Then the new model is initalized and shown. Depending on the StateManager type queries with other names may be popped off the stack and destroyed.

Throws:
java.lang.Exception
See Also:
showByName(String)

showByName

public void showByName(java.lang.String queryName)
                throws java.lang.Exception
shows the query that was initialized with queryName.

Throws:
java.lang.Exception
See Also:
initializeAndShow(String, OlapModel)

destroyAll

public void destroyAll()
                throws java.lang.Exception
Throws:
java.lang.Exception

destroyQuery

public void destroyQuery(java.lang.String queryName)
                  throws java.lang.Exception
Throws:
java.lang.Exception

addModelChangeListener

public void addModelChangeListener(ModelChangeListener l)
Description copied from interface: Model
adds a model change listener

Specified by:
addModelChangeListener in interface Model
Overrides:
addModelChangeListener in class OlapModelDecorator

removeModelChangeListener

public void removeModelChangeListener(ModelChangeListener l)
Description copied from interface: Model
removes a model change listener

Specified by:
removeModelChangeListener in interface Model
Overrides:
removeModelChangeListener in class OlapModelDecorator

valueBound

public void valueBound(javax.servlet.http.HttpSessionBindingEvent ev)
Specified by:
valueBound in interface javax.servlet.http.HttpSessionBindingListener

valueUnbound

public void valueUnbound(javax.servlet.http.HttpSessionBindingEvent ev)
Specified by:
valueUnbound in interface javax.servlet.http.HttpSessionBindingListener

destroy

public void destroy()
OlapModelProxy is responsible for calling initialize/destroy

Specified by:
destroy in interface OlapModel
Overrides:
destroy in class OlapModelDecorator
Throws:
RuntimeExecption - if called

initialize

public void initialize()
OlapModelProxy is responsible for calling initialize/destroy

Specified by:
initialize in interface OlapModel
Overrides:
initialize in class OlapModelDecorator
Throws:
RuntimeExecption - if called

getStateManager

public StateManager getStateManager()
for Tests only