HintStore (interface)

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

HintStore.java
interface HintStore {
  String get(final Bookmark bookmark, String hintKey)     (1)
  void set(final Bookmark bookmark, String hintKey, String value)     (2)
  void remove(final 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.

set(Bookmark, String, String)

Set the state of a hint for the domain object

remove(Bookmark, String)

Removes hint for the domain object.

removeAll(Bookmark)

Remotes all hints for the domain object.

findHintKeys(Bookmark)

The keys of all available hints for the domain object.

Implementation

The core framework provides a default implementation of this service (o.a.i.viewer.wicket.viewer.services.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