org.objectweb.telosys.screen.core
Class StandardScreenContext

java.lang.Object
  extended byorg.objectweb.telosys.common.TelosysObject
      extended byorg.objectweb.telosys.screen.core.StandardScreenContext
All Implemented Interfaces:
ScreenContext, java.io.Serializable

public class StandardScreenContext
extends TelosysObject
implements ScreenContext

The standard ScreenContext implementation.

See Also:
Serialized Form

Constructor Summary
StandardScreenContext(java.lang.String sScreenName, org.objectweb.telosys.screen.core.ScreenContextDefinition screenDefinition, ScreenSession screenSession, int iScreenId)
          StandardScreenContext constructor
 
Method Summary
 ScreenData beginAction()
          Notify the screen context that an action is about to alter the current screen data
The action needs the current ScreenData instance to work with
The screen context keep an image of the current ScreenData
to do a "cancel" if needed
 void cancelAction()
          Notify the screen context that the current action must be canceled
The screen context restore the original ScreenData (from the ScreenData image)
 void clearCurrentData()
          Remove the current ScreenData of the context
After this operation, getCurrentData() returns 'null'
 ScreenData createNewScreenData()
          Creates a new ScreenData instance and returns it.
 void eventCreate(ScreenSession screenSession, ScreenRequestParameters params)
          ScreenContext 'create' event
 void eventReuse(ScreenSession screenSession, ScreenRequestParameters params)
          ScreenContext 'reuse' event
 java.lang.Object getAttribute(java.lang.String name)
          Gets an object (attribute) from the 'screen context storage space' with the given name
If name is null : return null
 ScreenData getCurrentData()
          Returns the current ScreenData of the context (can be null)
 ScreenData getDataForLoad()
          Creates and returns a new ScreenData instance for 'load' operations
 javax.servlet.http.HttpSession getHttpSession()
          Returns the standard HttpSession to which the ScreenContext belongs
 ScreenData getOrCreateCurrentData()
          Returns the current ScreenData of the context if it's not null,
if the current ScreenData is null : it is created, set as current and returned
 ScreenActions getOrCreateScreenActions()
          Returns the current ScreenActions if not null,
if null the current ScreenActions is created, set as current and returned
 ScreenActions getScreenActions()
          Returns the specific ScreenActions associated with the ScreenContext
 ScreenApplication getScreenApplication()
          Returns the ScreenApplication instance
 int getScreenId()
          Returns the ID of the screen context
 ScreenManager getScreenManager()
          Returns the ScreenManager associated with the ScreenContext
This method replaces the "getScreenDataAccessor" method,
 java.lang.String getScreenName()
          Returns the symbolic screen context name
 ScreenSession getScreenSession()
          Returns the ScreenSession to which the ScreenContext belongs
 ScreenData getTempData()
          Returns a temporary ScreenData instance for the operations which are
working without modifying the current screen data
 boolean hasBeenReused()
          Returns the state of the "reused" flag
 java.lang.Object removeAttribute(java.lang.String name)
          Removes an object (attribute) from the 'screen context storage space'
If name is null : do nothing and return null
 java.lang.Object setAttribute(java.lang.String name, java.lang.Object value)
          Sets an object (attribute) in the 'screen context storage space', associated with a unique name
If name is null : do nothing
If value is null : remove the attribute associated with the given name
 void setCurrentData(ScreenData data)
          Sets the given ScreenData as the new current ScreenData of the context
 java.lang.String toString()
           
 
Methods inherited from class org.objectweb.telosys.common.TelosysObject
error, error, error, getFlagTrace, info, setFlagTrace, trace, warn
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

StandardScreenContext

public StandardScreenContext(java.lang.String sScreenName,
                             org.objectweb.telosys.screen.core.ScreenContextDefinition screenDefinition,
                             ScreenSession screenSession,
                             int iScreenId)
StandardScreenContext constructor

Parameters:
sScreenName - the symbolic screen name
screenDefinition - the definition of the screen context
screenSession - the screen session
iScreenId - the screen ID ( 0 to N )
Method Detail

getScreenName

public java.lang.String getScreenName()
Description copied from interface: ScreenContext
Returns the symbolic screen context name

Specified by:
getScreenName in interface ScreenContext
Returns:
the screen context name

getScreenId

public int getScreenId()
Description copied from interface: ScreenContext
Returns the ID of the screen context

Specified by:
getScreenId in interface ScreenContext
Returns:
: screen context ID ( 0 to N )

getScreenApplication

public ScreenApplication getScreenApplication()
Description copied from interface: ScreenContext
Returns the ScreenApplication instance

Specified by:
getScreenApplication in interface ScreenContext
Returns:
the ScreenApplication

getScreenSession

public ScreenSession getScreenSession()
Description copied from interface: ScreenContext
Returns the ScreenSession to which the ScreenContext belongs

Specified by:
getScreenSession in interface ScreenContext
Returns:
the ScreenSession

getHttpSession

public javax.servlet.http.HttpSession getHttpSession()
Description copied from interface: ScreenContext
Returns the standard HttpSession to which the ScreenContext belongs

Specified by:
getHttpSession in interface ScreenContext
Returns:

hasBeenReused

public boolean hasBeenReused()
Description copied from interface: ScreenContext
Returns the state of the "reused" flag

Specified by:
hasBeenReused in interface ScreenContext
Returns:

getCurrentData

public ScreenData getCurrentData()
Description copied from interface: ScreenContext
Returns the current ScreenData of the context (can be null)

Specified by:
getCurrentData in interface ScreenContext
Returns:
: the current context data or null

getOrCreateCurrentData

public ScreenData getOrCreateCurrentData()
Description copied from interface: ScreenContext
Returns the current ScreenData of the context if it's not null,
if the current ScreenData is null : it is created, set as current and returned

Specified by:
getOrCreateCurrentData in interface ScreenContext
Returns:
: the current data (never null)

setCurrentData

public void setCurrentData(ScreenData data)
Description copied from interface: ScreenContext
Sets the given ScreenData as the new current ScreenData of the context

Specified by:
setCurrentData in interface ScreenContext
Parameters:
data - the new ScreenData to set

clearCurrentData

public void clearCurrentData()
Description copied from interface: ScreenContext
Remove the current ScreenData of the context
After this operation, getCurrentData() returns 'null'

Specified by:
clearCurrentData in interface ScreenContext

getScreenActions

public ScreenActions getScreenActions()
Description copied from interface: ScreenContext
Returns the specific ScreenActions associated with the ScreenContext

Specified by:
getScreenActions in interface ScreenContext
Returns:
: the ScreenActions (or null)

getOrCreateScreenActions

public ScreenActions getOrCreateScreenActions()
                                       throws TelosysException
Description copied from interface: ScreenContext
Returns the current ScreenActions if not null,
if null the current ScreenActions is created, set as current and returned

Specified by:
getOrCreateScreenActions in interface ScreenContext
Returns:
: the ScreenActions (never null)
Throws:
TelosysException - if the ScreenActions cannot be created

getScreenManager

public ScreenManager getScreenManager()
Description copied from interface: ScreenContext
Returns the ScreenManager associated with the ScreenContext
This method replaces the "getScreenDataAccessor" method,

Specified by:
getScreenManager in interface ScreenContext
Returns:

createNewScreenData

public ScreenData createNewScreenData()
Description copied from interface: ScreenContext
Creates a new ScreenData instance and returns it.
NB: the ScreenData created is not set as the current ScreenData of the context

Specified by:
createNewScreenData in interface ScreenContext
Returns:
: the new ScreenData created

beginAction

public ScreenData beginAction()
Description copied from interface: ScreenContext
Notify the screen context that an action is about to alter the current screen data
The action needs the current ScreenData instance to work with
The screen context keep an image of the current ScreenData
to do a "cancel" if needed

Specified by:
beginAction in interface ScreenContext
Returns:
the current screen data

cancelAction

public void cancelAction()
Description copied from interface: ScreenContext
Notify the screen context that the current action must be canceled
The screen context restore the original ScreenData (from the ScreenData image)

Specified by:
cancelAction in interface ScreenContext

getDataForLoad

public ScreenData getDataForLoad()
Description copied from interface: ScreenContext
Creates and returns a new ScreenData instance for 'load' operations

Specified by:
getDataForLoad in interface ScreenContext
Returns:
: ScreenData instance

getTempData

public ScreenData getTempData()
Description copied from interface: ScreenContext
Returns a temporary ScreenData instance for the operations which are
working without modifying the current screen data

Specified by:
getTempData in interface ScreenContext
Returns:
: a temporary ScreenData instance

setAttribute

public java.lang.Object setAttribute(java.lang.String name,
                                     java.lang.Object value)
Description copied from interface: ScreenContext
Sets an object (attribute) in the 'screen context storage space', associated with a unique name
If name is null : do nothing
If value is null : remove the attribute associated with the given name

Specified by:
setAttribute in interface ScreenContext
Parameters:
name - : a string specifying the name of the object
value - : the value
Returns:
: the previous value of the specified key in this hashtable, or null if it did not have one

getAttribute

public java.lang.Object getAttribute(java.lang.String name)
Description copied from interface: ScreenContext
Gets an object (attribute) from the 'screen context storage space' with the given name
If name is null : return null

Specified by:
getAttribute in interface ScreenContext
Parameters:
name - : a string specifying the name of the object
Returns:
: value instance ( or null if key is null or not found )

removeAttribute

public java.lang.Object removeAttribute(java.lang.String name)
Description copied from interface: ScreenContext
Removes an object (attribute) from the 'screen context storage space'
If name is null : do nothing and return null

Specified by:
removeAttribute in interface ScreenContext
Parameters:
name - : a string specifying the name of the object
Returns:
: the value removed, or null if not found

eventCreate

public void eventCreate(ScreenSession screenSession,
                        ScreenRequestParameters params)
                 throws TelosysException
Description copied from interface: ScreenContext
ScreenContext 'create' event

Specified by:
eventCreate in interface ScreenContext
Parameters:
params -
Throws:
TelosysException

eventReuse

public void eventReuse(ScreenSession screenSession,
                       ScreenRequestParameters params)
                throws TelosysException
Description copied from interface: ScreenContext
ScreenContext 'reuse' event

Specified by:
eventReuse in interface ScreenContext
Parameters:
params -
Throws:
TelosysException

toString

public java.lang.String toString()