Changeset 4973
- Timestamp:
- 04/14/14 15:09:07 (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/BreadCrumbPanel.java
r4963 r4973 17 17 package eu.clarin.cmdi.vlo.wicket.panels; 18 18 19 import eu.clarin.cmdi.vlo.FacetConstants; 19 20 import eu.clarin.cmdi.vlo.pojo.FacetSelection; 20 21 import eu.clarin.cmdi.vlo.pojo.QueryFacetsSelection; … … 94 95 95 96 @Override 96 protected void populateItem( Item<Map.Entry<String, FacetSelection>> item) {97 protected void populateItem(final Item<Map.Entry<String, FacetSelection>> item) { 97 98 final IModel<Map.Entry<String, FacetSelection>> selectionModel = item.getModel(); 98 99 // add a label for the selected facet value(s) … … 102 103 public <C> IConverter<C> getConverter(Class<C> type) { 103 104 // converter to render the value(s) nicely 104 return (IConverter<C>) selectionConverter;105 return (IConverter<C>) new SelectionConverter(item.getModelObject().getKey()); 105 106 } 106 107 … … 145 146 * collection (if singleton, show its value; if multiple, comma separated) 146 147 */ 147 private final static IConverter<FacetSelection> selectionConverter = new IConverter<FacetSelection>() { 148 private class SelectionConverter implements IConverter<FacetSelection> { 149 150 private final String facet; 151 152 public SelectionConverter(String facet) { 153 this.facet = facet; 154 } 148 155 149 156 @Override … … 154 161 @Override 155 162 public String convertToString(FacetSelection selection, Locale locale) { 163 switch (selection.getSelectionType()) { 164 case AND: 165 return getCollectionString(selection, " and "); 166 case OR: 167 return getCollectionString(selection, " or "); 168 case NOT: 169 return "not [" + getCollectionString(selection, " or ") + "]"; 170 case NOT_EMPTY: 171 return getAnyValueString(); 172 default: 173 return facet; 174 } 175 176 } 177 178 private String getAnyValueString() { 179 if (FacetConstants.FIELD_SEARCH_SERVICE.equals(facet)) { 180 return "Content searchable"; 181 } 182 return "any " + facet; 183 } 184 185 public String getCollectionString(FacetSelection selection, String valueSeparator) { 156 186 final Collection<String> value = selection.getValues(); 157 187 //TODO: include selection type … … 164 194 final StringBuilder sb = new StringBuilder(iterator.next()); 165 195 while (iterator.hasNext()) { 166 sb.append( ", ").append(iterator.next());196 sb.append(valueSeparator).append(iterator.next()); 167 197 } 168 198 return sb.toString();
Note: See TracChangeset
for help on using the changeset viewer.