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

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

Merged twagoo branch of to-wicket-1.6 back to original, removed this branch

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