source: vlo/branches/to-wicket-1.6/vlo_web_app/src/main/java/eu/clarin/cmdi/vlo/VloSession.java @ 4234

Last change on this file since 4234 was 4234, checked in by twagoo, 10 years ago

Refactored adding theme as session page parameter
Merging with session parameters in FacetLinkPanel? and in ShowResultPage?

File size: 1.8 KB
Line 
1package eu.clarin.cmdi.vlo;
2
3import org.apache.wicket.protocol.http.WebSession;
4import org.apache.wicket.request.Request;
5import org.apache.wicket.request.mapper.parameter.PageParameters;
6
7/**
8 * A web session containing a VLO theme and parameters that are considered to be
9 * persistent in a VLO session.
10 *
11 * Note that these parameters can include the specification of the theme.
12 *
13 * @author keeloo
14 */
15public class VloSession extends WebSession {
16
17    // remember the parameters that need to persist in URLs to VLO pages in this session
18    private PageParameters vloSessionPageParameters = new PageParameters();
19
20    // remember this session's theme
21    private Theme currentTheme = new Theme("defaultTheme");
22
23    /**
24     * Construct a session object with a request parameter
25     *
26     * @param request
27     */
28    public VloSession(Request request) {
29        // only the parameterless constructors are invoked implicitly
30        super(request);
31    }
32
33    /**
34     * Get the session's theme
35     *
36     * @return the session's theme
37     */
38    public Theme getCurrentTheme() {
39        return this.currentTheme;
40    }
41
42    /**
43     * Set the session's theme
44     *
45     * @param theme the session's theme
46     */
47    public void setCurrentTheme(Theme theme) {
48        this.currentTheme = theme;
49    }
50
51    /**
52     * Return the session's persistent parameters
53     *
54     * @return session parameters
55     */
56    public PageParameters getVloSessionPageParameters() {
57        return vloSessionPageParameters;
58    }
59
60    /**
61     * Add parameters to the session's persistent parameters
62     *
63     * @param parameters a page parameter map
64     *
65     */
66    public void addVloSessionPageParameters(PageParameters parameters) {
67
68        vloSessionPageParameters.mergeWith(parameters);
69    }
70}
Note: See TracBrowser for help on using the repository browser.