HintStore
Defines a mechanism for viewers to store arbitrary UI hints on a per-object basis.
This store is used by the Wicket viewer. For example, the viewer remembers which tabs are selected, and for collections which view is selected (eg table or hidden), which page of a table to render, or whether "show all" (rows) is toggled.
API
interface HintStore {
String get(Bookmark bookmark, String hintKey) (1)
void set(Bookmark bookmark, String hintKey, String value) (2)
void remove(Bookmark bookmark, String hintKey) (3)
void removeAll(Bookmark bookmark) (4)
Set<String> findHintKeys(Bookmark bookmark) (5)
}
1 | get(Bookmark, String)
Obtain a hint (eg which tab to open) for a particular object. |
2 | set(Bookmark, String, String)
Set the state of a hint for the domain object |
3 | remove(Bookmark, String)
Removes hint for the domain object. |
4 | removeAll(Bookmark)
Remotes all hints for the domain object. |
5 | findHintKeys(Bookmark)
The keys of all available hints for the domain object. |
Members
get(Bookmark, String)
Obtain a hint (eg which tab to open) for a particular object.
Object identity is represented by Bookmark so that alternative implementations can easily serialize this state to a string.
Implementation
The Wicket viewer provides a default implementation of this service, HintStoreUsingWicketSession.
The default implementation of this service uses the HTTP session. As the amount of data stored could potentially be quite large (for large numbers of users who use the app all day), it does in effect constitute a memory leak. An alternative implementation might be more sophisticated (eg implementing an MRU/LRU queue, or using a NoSQL database to store the hints, or simply to disable the functionality altogether). |
See Also
-
The Web UI (Wicket viewer) exposes the "clear hints" mixin action that is for use by end-users of the application to clear any UI hints that have accumulated for a domain object.
-
Mutable view models should implement the HintIdProvider in order for hints to work.