Changeset 4665
- Timestamp:
- 03/10/14 14:35:18 (11 years ago)
- Location:
- vlo/branches/vlo-3.0/vlo-web-app/src/main/java/eu/clarin/cmdi/vlo/wicket
- Files:
-
- 2 added
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
vlo/branches/vlo-3.0/vlo-web-app/src/main/java/eu/clarin/cmdi/vlo/wicket/panels/AllFacetValuesPanel.html
r4663 r4665 25 25 <wicket:panel> 26 26 <p>All values in this facet</p> 27 <p>Sort by <select><option>name</option><option>count</option></select></p> 28 <div>Search: <input type="text" /></div> 29 <div class="sortedFacet"> 30 <!-- <div> 31 <div class="anchorpanel"><a href=""></a><span>A</span></div> 32 </div>--> 27 <form wicket:id="options"> 28 <p>Sort by <select wicket:id="sort"><option>name</option><option>count</option></select></p> 29 <div>Search: <input type="text" /></div> 30 </form> 31 <div wicket:id="facetValuesContainer" class="sortedFacet"> 32 <!-- 33 <div> 34 <div class="anchorpanel"><a href=""></a><span>A</span></div> 35 </div> 36 --> 33 37 <div wicket:id="facetValue"> 34 38 <div class="facetLinkPanel"><a wicket:id="facetSelect" href=""><span wicket:id="name">A Corpus</span></a> (<span wicket:id="count">1</span>)</div> -
vlo/branches/vlo-3.0/vlo-web-app/src/main/java/eu/clarin/cmdi/vlo/wicket/panels/AllFacetValuesPanel.java
r4663 r4665 17 17 package eu.clarin.cmdi.vlo.wicket.panels; 18 18 19 import eu.clarin.cmdi.vlo.wicket.components.FieldValueOrderSelector; 20 import eu.clarin.cmdi.vlo.pojo.FieldValuesOrder; 19 21 import eu.clarin.cmdi.vlo.wicket.provider.FacetFieldValuesProvider; 20 22 import java.util.Collection; … … 22 24 import org.apache.solr.client.solrj.response.FacetField; 23 25 import org.apache.wicket.ajax.AjaxRequestTarget; 26 import org.apache.wicket.ajax.form.AjaxFormComponentUpdatingBehavior; 24 27 import org.apache.wicket.ajax.markup.html.AjaxFallbackLink; 28 import org.apache.wicket.extensions.markup.html.repeater.util.SortParam; 29 import org.apache.wicket.markup.html.WebMarkupContainer; 25 30 import org.apache.wicket.markup.html.basic.Label; 31 import org.apache.wicket.markup.html.form.DropDownChoice; 32 import org.apache.wicket.markup.html.form.Form; 26 33 import org.apache.wicket.markup.html.link.Link; 27 34 import org.apache.wicket.markup.html.panel.GenericPanel; … … 30 37 import org.apache.wicket.model.CompoundPropertyModel; 31 38 import org.apache.wicket.model.IModel; 39 import org.apache.wicket.model.PropertyModel; 32 40 33 41 /** 42 * A panel that shows all available values for a selected facet. Supports two 43 * ordering modes (by name or result count) and dynamic filtering. 34 44 * 35 45 * @author twagoo … … 37 47 public abstract class AllFacetValuesPanel extends GenericPanel<FacetField> { 38 48 49 private final FacetFieldValuesProvider valuesProvider; 50 private final WebMarkupContainer valuesContainer; 51 39 52 public AllFacetValuesPanel(String id, IModel<FacetField> model) { 40 53 super(id, model); 54 valuesProvider = new FacetFieldValuesProvider(model); 41 55 42 // provider that extracts values and counts from FacetField 43 final FacetFieldValuesProvider valuesProvider = new FacetFieldValuesProvider(model); 44 add(new DataView<FacetField.Count>("facetValue", valuesProvider) { 56 valuesContainer = new WebMarkupContainer("facetValuesContainer"); 57 valuesContainer.setOutputMarkupId(true); 58 add(valuesContainer); 59 60 final DataView<FacetField.Count> valuesView = createValuesView("facetValue"); 61 valuesContainer.add(valuesView); 62 63 final Form optionsForm = createOptionsForm("options"); 64 optionsForm.setOutputMarkupId(true); 65 add(optionsForm); 66 } 67 68 private DataView<FacetField.Count> createValuesView(String id) { 69 return new DataView<FacetField.Count>(id, valuesProvider) { 45 70 46 71 @Override … … 69 94 item.add(new Label("count")); 70 95 } 96 }; 97 } 98 99 private Form createOptionsForm(String id) { 100 final Form options = new Form(id); 101 final DropDownChoice<SortParam<FieldValuesOrder>> sortSelect 102 = new FieldValueOrderSelector("sort", new PropertyModel<SortParam<FieldValuesOrder>>(valuesProvider, "sort")); 103 sortSelect.add(new AjaxFormComponentUpdatingBehavior("onchange") { 104 105 @Override 106 protected void onUpdate(AjaxRequestTarget target) { 107 target.add(options); 108 target.add(valuesContainer); 109 } 71 110 }); 111 options.add(sortSelect); 112 return options; 72 113 } 73 114 … … 81 122 */ 82 123 protected abstract void onValuesSelected(String facet, Collection<String> values, AjaxRequestTarget target); 83 84 124 }
Note: See TracChangeset
for help on using the changeset viewer.