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