source: vlo/branches/to-wicket-1.6/vlo_web_app/src/main/java/eu/clarin/cmdi/vlo/pages/BasePage.java @ 4208

Last change on this file since 4208 was 4208, checked in by keeloo, 10 years ago

Finished the upgrade. The web application still needs to be tested.

File size: 3.6 KB
Line 
1package eu.clarin.cmdi.vlo.pages;
2
3import eu.clarin.cmdi.vlo.VloWebApplication;
4import eu.clarin.cmdi.vlo.VloSession;
5import eu.clarin.cmdi.vlo.VloPageParameters;
6import org.apache.wicket.request.mapper.parameter.PageParameters;
7import org.apache.wicket.markup.html.IHeaderContributor;
8import org.apache.wicket.markup.html.IHeaderResponse;
9import org.apache.wicket.markup.html.WebPage;
10import org.apache.wicket.markup.html.basic.Label;
11import org.apache.wicket.markup.html.image.Image;
12import org.apache.wicket.markup.html.link.BookmarkablePageLink;
13import org.apache.wicket.request.resource.ContextRelativeResource;
14
15/**
16 * Properties common to all VLO web application's page objects
17 *
18 * @author keeloo
19 */
20public class BasePage extends WebPage implements IHeaderContributor{
21   
22    // reference to the web application object
23    static VloWebApplication webApp;
24
25    /**
26     * Make sure every web application object sends this message
27     *
28     * @param vloWebApplication reference to the web application object
29     */
30    public static void setWebApp(VloWebApplication vloWebApplication) {
31        webApp = vloWebApplication;
32    }
33   
34    /**
35     * Install a VLO theme<br><br>
36     *
37     * A VLO theme is determined by a page title, a CSS file, and a banner split
38     * in a left and right image.
39     *
40     * The left part of the banner serves as a link to the faceted search page,
41     * the application's start page. In the field below banner there is a link
42     * to the page the web application is launched from; the applications home
43     * page. This link page is defined in the VloConfig file.
44     *     
45     * @param parameters
46     */
47    public BasePage(PageParameters parameters) {
48
49        super(parameters);
50       
51        // set the page title
52       
53        Label pageTitle;
54        pageTitle = new Label ("pagetitle", ((VloSession)getSession()).getCurrentTheme().pageTitle);
55        add (pageTitle);
56       
57        // set the applications start page link to the faceted search page
58        VloPageParameters startPageParameters = new VloPageParameters ();
59
60        BookmarkablePageLink link = new BookmarkablePageLink("startpage",
61                FacetedSearchPage.class, startPageParameters);
62        add(link);
63                   
64        // refer to the the left part of the vlo banner as a resource
65        ContextRelativeResource leftImageRes;
66        leftImageRes = new ContextRelativeResource(((VloSession)getSession()).getCurrentTheme().topLeftImage);
67
68        // create the image
69        Image leftImage;
70        leftImage = new Image("leftimage", leftImageRes);
71 
72        // merge the image to the page
73        link.add(leftImage);
74
75        // refer to the right part of the vlo banner as a resource
76        ContextRelativeResource rightImageRes;
77        rightImageRes = new ContextRelativeResource(((VloSession)getSession()).getCurrentTheme().topRightImage);
78       
79        // create the image
80        Image rightImage;
81        rightImage = new Image("rightimage", rightImageRes);
82       
83        // merge it to the page
84        add (rightImage);
85       
86        // set the partnerlinks
87       
88        Label partnerLinkMap;
89        partnerLinkMap = new Label ("partnerlinkmap", ((VloSession)getSession()).getCurrentTheme().partnerLinkMap);
90        partnerLinkMap.setEscapeModelStrings(false);
91        add (partnerLinkMap);
92    }
93
94    /**
95     * Include the theme's CSS file in the HTML page<br><br>
96     *
97     * This method is invoked when Wicket renders a VLO page.
98     *
99     * @param response
100     */
101    public void renderHead(IHeaderResponse response) {
102
103        response.renderCSSReference(((VloSession) getSession()).getCurrentTheme().cssFile);
104    }
105   
106}
Note: See TracBrowser for help on using the repository browser.