Changeset 4727
- Timestamp:
- 03/17/14 10:57:22 (11 years ago)
- Location:
- vlo/branches/vlo-3.0/vlo-web-app/src/main/java/eu/clarin/cmdi/vlo/wicket
- Files:
-
- 1 edited
- 1 moved
Legend:
- Unmodified
- Added
- Removed
-
vlo/branches/vlo-3.0/vlo-web-app/src/main/java/eu/clarin/cmdi/vlo/wicket/model/CollectionMapEntryModel.java
r4725 r4727 17 17 package eu.clarin.cmdi.vlo.wicket.model; 18 18 19 import com.google.common.collect.Lists; 19 20 import com.google.common.collect.Maps; 20 21 import java.io.Serializable; 21 import java.util.AbstractMap; 22 import java.util.HashMap; 23 import java.util.Map; 22 import java.util.Collection; 24 23 import java.util.Map.Entry; 25 24 import org.apache.wicket.model.LoadableDetachableModel; … … 33 32 * @param <V> value type 34 33 */ 35 public class MapEntryModel<K extends Serializable, V extends Serializable> extends LoadableDetachableModel<Entry<K, V>> {34 public class CollectionMapEntryModel<K extends Serializable, V extends Serializable> extends LoadableDetachableModel<Entry<K, Collection<V>>> { 36 35 37 36 private final K key; 38 private final Vvalue;37 private final Collection<V> value; 39 38 40 public MapEntryModel(Entry<K, V> entry) {39 public CollectionMapEntryModel(Entry<K, Collection<V>> entry) { 41 40 super(entry); 42 41 key = entry.getKey(); 43 value = entry.getValue(); 42 43 final Collection<V> entryValue = entry.getValue(); 44 if (entryValue instanceof Serializable) { 45 value = entryValue; 46 } else { 47 // copy to a serialisable collection 48 value = Lists.newArrayList(entryValue); 49 } 44 50 } 45 51 46 52 @Override 47 protected Entry<K, V> load() {53 protected Entry<K, Collection<V>> load() { 48 54 return Maps.immutableEntry(key, value); 49 55 } -
vlo/branches/vlo-3.0/vlo-web-app/src/main/java/eu/clarin/cmdi/vlo/wicket/provider/FacetSelectionProvider.java
r4693 r4727 19 19 20 20 import eu.clarin.cmdi.vlo.pojo.QueryFacetsSelection; 21 import eu.clarin.cmdi.vlo.wicket.model. MapEntryModel;21 import eu.clarin.cmdi.vlo.wicket.model.CollectionMapEntryModel; 22 22 import java.util.Collection; 23 23 import java.util.Iterator; … … 49 49 @Override 50 50 public IModel<Map.Entry<String, Collection<String>>> model(Map.Entry<String, Collection<String>> object) { 51 return new MapEntryModel<String, Collection<String>>(object);51 return new CollectionMapEntryModel<String, String>(object); 52 52 } 53 53
Note: See TracChangeset
for help on using the changeset viewer.