1 | package eu.clarin.cmdi.virtualcollectionregistry.gui.pages; |
---|
2 | |
---|
3 | import org.apache.wicket.ajax.AjaxRequestTarget; |
---|
4 | import org.apache.wicket.ajax.markup.html.AjaxLink; |
---|
5 | import org.apache.wicket.markup.html.panel.Panel; |
---|
6 | import org.apache.wicket.model.IModel; |
---|
7 | |
---|
8 | import eu.clarin.cmdi.virtualcollectionregistry.gui.table.VirtualCollectionTable; |
---|
9 | import eu.clarin.cmdi.virtualcollectionregistry.model.VirtualCollection; |
---|
10 | |
---|
11 | @SuppressWarnings("serial") |
---|
12 | public class BrowsePublicCollectionsPage extends BasePage { |
---|
13 | private class ActionsPanel extends Panel { |
---|
14 | public ActionsPanel(String id, IModel<VirtualCollection> model) { |
---|
15 | super(id, model); |
---|
16 | setRenderBodyOnly(true); |
---|
17 | |
---|
18 | final AjaxLink<VirtualCollection> detailsLink = |
---|
19 | new AjaxLink<VirtualCollection>("details", model) { |
---|
20 | @Override |
---|
21 | public void onClick(AjaxRequestTarget target) { |
---|
22 | doDetails(target, getModel()); |
---|
23 | } |
---|
24 | }; |
---|
25 | add(detailsLink); |
---|
26 | } |
---|
27 | } // class BrowsePublicCollectionsPage.ActionsPanel |
---|
28 | |
---|
29 | public BrowsePublicCollectionsPage() { |
---|
30 | super(); |
---|
31 | final VirtualCollectionTable table = |
---|
32 | new VirtualCollectionTable("collectionsTable", false) { |
---|
33 | @Override |
---|
34 | protected Panel createActionColumn(String componentId, |
---|
35 | IModel<VirtualCollection> model) { |
---|
36 | return new ActionsPanel(componentId, model); |
---|
37 | } |
---|
38 | |
---|
39 | @Override |
---|
40 | protected Panel createActionPanel(String componentId, |
---|
41 | IModel<VirtualCollection> model) { |
---|
42 | return new ActionsPanel(componentId, model); |
---|
43 | } |
---|
44 | }; |
---|
45 | add(table); |
---|
46 | } |
---|
47 | |
---|
48 | private void doDetails(AjaxRequestTarget target, |
---|
49 | IModel<VirtualCollection> vc) { |
---|
50 | setResponsePage(new VirtualCollectionDetailsPage(vc, getPage())); |
---|
51 | } |
---|
52 | |
---|
53 | } // class BrowsePublicCollectionsPage |
---|