Changeset 4786
- Timestamp:
- 03/20/14 08:56:58 (11 years ago)
- Location:
- vlo/branches/vlo-3.0/vlo-web-app/src/main
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
vlo/branches/vlo-3.0/vlo-web-app/src/main/java/eu/clarin/cmdi/vlo/wicket/panels/FacetsPanel.html
r4661 r4786 34 34 <div wicket:id="facet">[facet]</div> 35 35 </wicket:container> 36 <div id="expandcollapseall"> 37 <a wicket:id="expandAll" href="">Expand all</a> 38 <a wicket:id="collapseAll" href="">Collapse all</a> 39 </div> 36 40 <!-- rounded corners - bottom **** --> 37 41 <div class="rbottom"><div class="r4"></div><div class="r3"></div><div class="r2"></div><div class="r1"></div></div> -
vlo/branches/vlo-3.0/vlo-web-app/src/main/java/eu/clarin/cmdi/vlo/wicket/panels/FacetsPanel.java
r4782 r4786 28 28 import org.apache.solr.client.solrj.response.FacetField; 29 29 import org.apache.wicket.ajax.AjaxRequestTarget; 30 import org.apache.wicket.ajax.markup.html.AjaxFallbackLink; 30 31 import org.apache.wicket.markup.html.list.ListItem; 31 32 import org.apache.wicket.markup.html.list.ListView; 32 import org.apache.wicket.markup.html.panel. Panel;33 import org.apache.wicket.markup.html.panel.GenericPanel; 33 34 import org.apache.wicket.model.IModel; 34 35 import org.apache.wicket.model.util.MapModel; … … 43 44 * @author twagoo 44 45 */ 45 public abstract class FacetsPanel extends Panel{46 public abstract class FacetsPanel extends GenericPanel<List<FacetField>> { 46 47 47 48 @SpringBean 48 49 private FacetFieldsService facetFieldsService; 50 51 private MapModel<String, ExpansionState> expansionModel; 49 52 50 53 /** … … 57 60 */ 58 61 public FacetsPanel(final String id, final IModel<List<FacetField>> facetsModel, final IModel<QueryFacetsSelection> selectionModel) { 59 super(id );62 super(id, facetsModel); 60 63 61 64 final Map<String, ExpansionState> expansionStateMap = new HashMap<String, ExpansionState>(); 62 final MapModel<String, ExpansionState>expansionModel = new MapModel<String, ExpansionState>(expansionStateMap);65 expansionModel = new MapModel<String, ExpansionState>(expansionStateMap); 63 66 64 67 final ListView<FacetField> facetsView = new ListView<FacetField>("facets", facetsModel) { … … 86 89 facetsView.setReuseItems(true); 87 90 add(facetsView); 91 92 add(new AjaxFallbackLink("expandAll") { 93 94 @Override 95 public void onClick(AjaxRequestTarget target) { 96 setAllFacetsExpansionState(ExpansionState.EXPANDED); 97 selectionChanged(target); 98 } 99 }); 100 add(new AjaxFallbackLink("collapseAll") { 101 102 @Override 103 public void onClick(AjaxRequestTarget target) { 104 setAllFacetsExpansionState(ExpansionState.COLLAPSED); 105 selectionChanged(target); 106 } 107 }); 108 } 109 110 private void setAllFacetsExpansionState(final ExpansionState state) { 111 final Map<String, ExpansionState> expansionMap = expansionModel.getObject(); 112 for (FacetField facet : getModelObject()) { 113 expansionMap.put(facet.getName(), state); 114 } 115 } 116 117 @Override 118 public void detachModels() { 119 super.detachModels(); 120 expansionModel.detach(); 88 121 } 89 122 -
vlo/branches/vlo-3.0/vlo-web-app/src/main/webapp/style/vlo-facets.css
r4785 r4786 213 213 margin: 0em 1em; 214 214 } 215 216 div#expandcollapseall { 217 text-align: right; 218 } 219 220 div#expandcollapseall a { 221 display: block; 222 font-size: smaller; 223 padding-right: 1em; 224 }
Note: See TracChangeset
for help on using the changeset viewer.