source: vlo/trunk/vlo_web_app/src/main/java/eu/clarin/cmdi/vlo/pages/SearchPageLinkPanel.java @ 2832

Last change on this file since 2832 was 2832, checked in by keeloo, 11 years ago

Added the proper icon denoting a search page and update some texts; the state of the repository after this commit is reflected in the package intended for the 2.13 beta release on 26.04.2013.

File size: 1.8 KB
Line 
1
2package eu.clarin.cmdi.vlo.pages;
3
4import org.apache.wicket.behavior.SimpleAttributeModifier;
5import org.apache.wicket.markup.html.basic.Label;
6import org.apache.wicket.markup.html.image.Image;
7import org.apache.wicket.markup.html.link.ExternalLink;
8import org.apache.wicket.resource.ContextRelativeResource;
9
10/**
11 * Panel showing a search link.
12 *
13 * In the extension of the link panel class, this class adds a label text and
14 * an icon that is specific for search page links.
15 *
16 * @author keeloo
17 */
18public class SearchPageLinkPanel extends LinkPanel {
19
20    private final static ImageResource SEARCHPAGE_ICON =
21            new ImageResource(new ContextRelativeResource("Images/Crystal_Clear_action_filefind.png"),
22            "Search page");
23
24    /**
25     * Panel constructor.
26     *
27     * @param id Wicket mark up identifier
28     * @param resourceLink URL to pointing to the resource
29     */
30    public SearchPageLinkPanel(String id, String resourceLink) {
31        // ...
32        super(id);
33       
34        // add the icon image
35        ImageResource imageResource = SEARCHPAGE_ICON;
36        Image resourceImg = new Image("searchPageImage", imageResource.getResource());
37       
38        // add the image's title
39        String title;
40        title = imageResource.getTitle();
41        resourceImg.add(new SimpleAttributeModifier("title", title));
42        resourceImg.add(new SimpleAttributeModifier("alt", title));
43
44        // ...
45        String href = getHref(resourceLink);
46
47        // get the name associated with the link
48        String name = getNameFromLink(resourceLink);
49       
50        // ... and add the link itself
51        ExternalLink link = new ExternalLink("searchPageLink", href);
52        link.add(resourceImg);
53        link.add(new Label("searchPageLabel", name));
54        add(link);
55    }
56}
Note: See TracBrowser for help on using the repository browser.