Changeset 4961
- Timestamp:
- 04/14/14 07:29:20 (10 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
vlo/branches/vlo-3.0/vlo-web-app/src/main/java/eu/clarin/cmdi/vlo/wicket/panels/search/AllFacetValuesPanel.java
r4958 r4961 56 56 */ 57 57 public abstract class AllFacetValuesPanel extends GenericPanel<FacetField> { 58 58 59 59 private final FacetFieldValuesProvider valuesProvider; 60 60 private final WebMarkupContainer valuesContainer; … … 78 78 public AllFacetValuesPanel(String id, IModel<FacetField> model, IModel<FieldValuesFilter> filterModel) { 79 79 super(id, model); 80 80 81 81 if (filterModel != null) { 82 82 this.filterModel = filterModel; … … 87 87 // create a provider that shows all values and is sorted by name by default 88 88 valuesProvider = new FacetFieldValuesProvider(model, Integer.MAX_VALUE, FieldValueOrderSelector.NAME_SORT) { 89 89 90 90 @Override 91 91 protected IModel<FieldValuesFilter> getFilterModel() { … … 93 93 return AllFacetValuesPanel.this.filterModel; 94 94 } 95 95 96 96 }; 97 97 … … 110 110 add(optionsForm); 111 111 } 112 112 113 113 private DataView<FacetField.Count> createValuesView(String id) { 114 114 return new DataView<FacetField.Count>(id, valuesProvider) { 115 115 116 116 @Override 117 117 protected void populateItem(final Item<FacetField.Count> item) { … … 120 120 // link to select an individual facet value 121 121 final Link selectLink = new AjaxFallbackLink("facetSelect") { 122 122 123 123 @Override 124 124 public void onClick(AjaxRequestTarget target) { … … 141 141 }; 142 142 } 143 143 144 144 private Form createOptionsForm(String id) { 145 145 final Form options = new Form(id); 146 146 147 147 final DropDownChoice<SortParam<FieldValuesOrder>> sortSelect 148 148 = new FieldValueOrderSelector("sort", new PropertyModel<SortParam<FieldValuesOrder>>(valuesProvider, "sort")); 149 149 sortSelect.add(new UpdateOptionsFormBehavior(options)); 150 150 options.add(sortSelect); 151 151 152 152 final TextField filterField = new TextField<String>("filter", new PropertyModel(filterModel, "name")); 153 153 filterField.add(new AjaxFormComponentUpdatingBehavior("keyup") { 154 154 155 155 @Override 156 156 protected void onUpdate(AjaxRequestTarget target) { … … 159 159 }); 160 160 options.add(filterField); 161 161 162 162 addOccurenceOptions(options); 163 163 164 164 return options; 165 165 } … … 197 197 // Dropdown to select a value (which is applied to the filter if the 'bridge' is open) 198 198 final DropDownChoice<Integer> minOccurence = new DropDownChoice<Integer>("minOccurences", minOccurenceSelectModel, ImmutableList.of(2, 5, 10, 100, 1000)); 199 minOccurence.add(new UpdateOptionsFormBehavior(options)); 199 minOccurence.add(new UpdateOptionsFormBehavior(options) { 200 201 @Override 202 protected void onUpdate(AjaxRequestTarget target) { 203 super.onUpdate(target); 204 // on change, apply to inner model ('open bridge') 205 if (!minOccurenceCheckBoxModel.getObject()) { 206 minOccurenceCheckBoxModel.setObject(true); 207 } 208 } 209 210 }); 200 211 options.add(minOccurence); 201 212 } 202 213 203 214 private class UpdateOptionsFormBehavior extends OnChangeAjaxBehavior { 204 215 205 216 private final Form options; 206 217 207 218 public UpdateOptionsFormBehavior(Form options) { 208 219 this.options = options; 209 220 } 210 221 211 222 @Override 212 223 protected void onUpdate(AjaxRequestTarget target) { … … 214 225 target.add(valuesContainer); 215 226 } 216 217 } 218 227 228 } 229 219 230 @Override 220 231 public void detachModels() { … … 232 243 */ 233 244 protected abstract void onValuesSelected(String facet, Collection<String> values, AjaxRequestTarget target); 234 245 235 246 }
Note: See TracChangeset
for help on using the changeset viewer.