Changeset 4554
- Timestamp:
- 02/25/14 11:10:04 (10 years ago)
- Location:
- vlo/branches/vlo-3.0/vlo-web-app/src/main/java/eu/clarin/cmdi/vlo/wicket/components
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
vlo/branches/vlo-3.0/vlo-web-app/src/main/java/eu/clarin/cmdi/vlo/wicket/components/SearchResultsPanel.html
r4553 r4554 115 115 <wicket:container wicket:id="pagingBottom">[PAGING]</wicket:container> 116 116 117 <form id="resultpagesizeform">117 <form wicket:id="resultPageSizeForm" id="resultpagesizeform"> 118 118 <label for="resultpagesize">Results per page:</label> 119 <select id="resultpagesize">119 <select wicket:id="resultPageSize" id="resultpagesize"> 120 120 <option>5</option> 121 121 <option>10</option> -
vlo/branches/vlo-3.0/vlo-web-app/src/main/java/eu/clarin/cmdi/vlo/wicket/components/SearchResultsPanel.java
r4553 r4554 23 23 import eu.clarin.cmdi.vlo.wicket.model.SolrFieldModel; 24 24 import eu.clarin.cmdi.vlo.wicket.provider.SolrDocumentProvider; 25 import java.util.Arrays; 26 import java.util.List; 25 27 import org.apache.solr.common.SolrDocument; 28 import org.apache.wicket.ajax.AjaxRequestTarget; 29 import org.apache.wicket.ajax.form.AjaxFormComponentUpdatingBehavior; 26 30 import org.apache.wicket.ajax.markup.html.navigation.paging.AjaxPagingNavigator; 27 31 import org.apache.wicket.markup.html.basic.Label; 32 import org.apache.wicket.markup.html.form.DropDownChoice; 33 import org.apache.wicket.markup.html.form.Form; 28 34 import org.apache.wicket.markup.html.navigation.paging.IPageableItems; 29 35 import org.apache.wicket.markup.html.panel.Panel; … … 33 39 import org.apache.wicket.model.AbstractReadOnlyModel; 34 40 import org.apache.wicket.model.IModel; 41 import org.apache.wicket.model.PropertyModel; 35 42 import org.apache.wicket.spring.injection.annot.SpringBean; 36 43 … … 41 48 */ 42 49 public class SearchResultsPanel extends Panel { 50 51 public static final List<Long> ITEMS_PER_PAGE_OPTIONS = Arrays.asList(5L, 10L, 25L, 50L, 100L); 43 52 44 53 @SpringBean … … 64 73 add(createResultPageIndicator("resultPageIndicator", resultsView)); 65 74 75 // form to select number of results per page 76 add(createResultPageSizeForm("resultPageSizeForm", resultsView)); 77 66 78 //For Ajax updating of search results 67 79 setOutputMarkupId(true); … … 84 96 private Label createResultCount(String id) { 85 97 final IModel<String> resultCountModel = new AbstractReadOnlyModel<String>() { 86 98 87 99 @Override 88 100 public String getObject() { … … 106 118 } 107 119 120 private Form createResultPageSizeForm(String id, final IPageableItems resultsView) { 121 final Form resultPageSizeForm = new Form(id); 122 123 final DropDownChoice<Long> pageSizeDropDown 124 = new DropDownChoice<Long>("resultPageSize", 125 // bind to items per page property of pageable 126 new PropertyModel<Long>(resultsView, "itemsPerPage"), 127 ITEMS_PER_PAGE_OPTIONS); 128 pageSizeDropDown.add(new AjaxFormComponentUpdatingBehavior("onchange") { 129 130 @Override 131 protected void onUpdate(AjaxRequestTarget target) { 132 target.add(SearchResultsPanel.this); 133 } 134 }); 135 resultPageSizeForm.add(pageSizeDropDown); 136 137 return resultPageSizeForm; 138 } 139 108 140 public static class SolrFieldLabel extends Label { 109 141
Note: See TracChangeset
for help on using the changeset viewer.