net.sf.jzeno.echo
Interface Layout

All Known Implementing Classes:
AbstractLayout, DHLLayout, MockLayout, ZenoLayout

public interface Layout

All layout classes should implement this interface and have a default constructor. A layout implementation has certain duties, such as :

A convenient way of creating you own Layout implementation is to subclass the AbstractLayout class.


Method Summary
 void addCssFile(java.lang.String file)
           Add a css file to this layout
 void addOnLoadScriptOnce(java.lang.String javaScriptExecutedOnceOnWindowLoad)
           Often it is handy to send some javascript to the client browser for execution on the onLoad event of the page.
 void clearScrollPosition()
           Reset the scroll position of the current screen.
 Component getContent()
           Retrieves the current content component last set by setContent().
 java.util.List getCssFiles()
           Return the list of css files used in this layout
 void loadPersistentState(java.lang.Object[] state)
           Gives you an oportunity to load some state such as the scroll position.
 void resetScheduledDowntime()
          Remove any downtime messages set previously by setScheduledDowntime(String, Date, Integer).
 java.lang.Object[] savePersistentState()
           Gives you an oportunity to save some state such as the scroll position.
 void setContent(Component content)
           When navigating from one screen to another, the application calls EchoSupport.setScreen() (EchoSupport#setScreen(Component)) and this triggers among other things this method on your Layout component.
 void setErrors(java.util.List errorsAfterTranslation)
           Sets the current list of errors.
 void setMessages(java.util.List messagesAfterTranslation)
           Sets the current list of messages.
 void setScheduledDowntime(java.lang.String msg, java.util.Date startTime, java.lang.Integer duration)
           One of the duties of a Layout component is to visualize downtime messages.
 void setWarnings(java.util.List warningsAfterTranslation)
           Sets the current list of warnings.
 

Method Detail

setContent

void setContent(Component content)

When navigating from one screen to another, the application calls EchoSupport.setScreen() (EchoSupport#setScreen(Component)) and this triggers among other things this method on your Layout component. The typical implementation would be to replace a sub component of your Layout with the new content component .

It is important to realize that this new content component is actually the screen that the user code is currently setting with setScreen, so it will typically be an instance of a subclass of the AbstractScreen class.


getContent

Component getContent()

Retrieves the current content component last set by setContent(). Basically retrieves the Screen that was assigned as current screen to your Layout component.


setScheduledDowntime

void setScheduledDowntime(java.lang.String msg,
                          java.util.Date startTime,
                          java.lang.Integer duration)

One of the duties of a Layout component is to visualize downtime messages. Typically this is a messages that is put up on the screen some time before the system (e.g. the application server we're running on,..) is taken down for maintenance/upgrading etc...

The application code can trigger a new downtime messages by calling EchoSupport.setScheduledDowntime(String, Date, Integer).

A convenient way to satisfy this requirement is to include an instance of the ErrorMessagesComponentin your layout class.


resetScheduledDowntime

void resetScheduledDowntime()
Remove any downtime messages set previously by setScheduledDowntime(String, Date, Integer).


addOnLoadScriptOnce

void addOnLoadScriptOnce(java.lang.String javaScriptExecutedOnceOnWindowLoad)

Often it is handy to send some javascript to the client browser for execution on the onLoad event of the page. Examples of this include opening a popup that visualizes a URL outside of the application.

It is important to realize that the script(s) set via the method must only execute in the next rendering of the screen, and not in subsequent renderings.

A convenient way of satisfying this operation is adding an instance of OnLoadScriptOnceComponent.


clearScrollPosition

void clearScrollPosition()

Reset the scroll position of the current screen. Typically called when navigating from one screen to another. We don't want to have the scroll position of the first screen on the second.


savePersistentState

java.lang.Object[] savePersistentState()

Gives you an oportunity to save some state such as the scroll position. If you're deriving from AbstractLayout, this operation is allready implemented. (see AbstractLayout).


loadPersistentState

void loadPersistentState(java.lang.Object[] state)

Gives you an oportunity to load some state such as the scroll position. State passed in is what you returned from the previous call to savePersistentSate.


setErrors

void setErrors(java.util.List errorsAfterTranslation)

Sets the current list of errors. It is your duty to visualize all of the strings in this List to the users. Any i18n translation, parametrization and removing of duplicate messages will have been done for you.


setMessages

void setMessages(java.util.List messagesAfterTranslation)

Sets the current list of messages. It is your duty to visualize all of the strings in this List to the users. Any i18n translation, parametrization and removing of duplicate messages will have been done for you.


setWarnings

void setWarnings(java.util.List warningsAfterTranslation)

Sets the current list of warnings. It is your duty to visualize all of the strings in this List to the users. Any i18n translation, parametrization and removing of duplicate messages will have been done for you.


getCssFiles

java.util.List getCssFiles()

Return the list of css files used in this layout


addCssFile

void addCssFile(java.lang.String file)

Add a css file to this layout