Changeset 4542
- Timestamp:
- 02/20/14 16:29:00 (10 years ago)
- Location:
- vlo/branches/vlo-3.0/vlo-web-app/src/main/java/eu/clarin/cmdi/vlo
- Files:
-
- 2 edited
- 1 copied
Legend:
- Unmodified
- Added
- Removed
-
vlo/branches/vlo-3.0/vlo-web-app/src/main/java/eu/clarin/cmdi/vlo/pojo/FacetSelection.java
r4540 r4542 15 15 * along with this program. If not, see <http://www.gnu.org/licenses/>. 16 16 */ 17 17 18 package eu.clarin.cmdi.vlo.pojo; 18 19 19 import java.io.Serializable;20 20 import java.util.List; 21 import java.util.concurrent.CopyOnWriteArrayList;22 import org.apache.wicket.model.IModel;23 21 24 22 /** … … 26 24 * @author twagoo 27 25 */ 28 public class FacetSelection implements Serializable{26 public interface FacetSelection { 29 27 30 private final String facet; 31 private final IModel<QueryFacetsSelection> selectionModel; 28 String getFacet(); 32 29 33 public FacetSelection(String facet, IModel<QueryFacetsSelection> selectionModel) { 34 this.facet = facet; 35 this.selectionModel = selectionModel; 36 } 30 List<String> getFacetValues(); 37 31 38 public String getFacet() { 39 return facet; 40 } 41 42 public QueryFacetsSelection getSelection() { 43 return selectionModel.getObject(); 44 } 45 46 public List<String> getFacetValues() { 47 return new CopyOnWriteArrayList<String>(getSelection().getSelectionValues(facet)); 48 } 49 32 QueryFacetsSelection getSelection(); 33 50 34 } -
vlo/branches/vlo-3.0/vlo-web-app/src/main/java/eu/clarin/cmdi/vlo/wicket/components/FacetsPanel.java
r4540 r4542 17 17 package eu.clarin.cmdi.vlo.wicket.components; 18 18 19 import eu.clarin.cmdi.vlo. pojo.FacetSelection;19 import eu.clarin.cmdi.vlo.wicket.model.FacetSelectionModel; 20 20 import eu.clarin.cmdi.vlo.pojo.QueryFacetsSelection; 21 21 import eu.clarin.cmdi.vlo.service.FacetFieldsService; … … 29 29 import org.apache.wicket.markup.repeater.data.DataView; 30 30 import org.apache.wicket.model.IModel; 31 import org.apache.wicket.model.Model;32 31 import org.apache.wicket.spring.injection.annot.SpringBean; 33 32 … … 96 95 97 96 private SelectedFacetPanel createSelectedFacetPanel(String facetName) { 98 final FacetSelection selection = new FacetSelection(facetName, model); 99 return new SelectedFacetPanel("facet", new Model(selection)) { 97 return new SelectedFacetPanel("facet", new FacetSelectionModel(facetName, model)) { 100 98 101 99 @Override -
vlo/branches/vlo-3.0/vlo-web-app/src/main/java/eu/clarin/cmdi/vlo/wicket/model/FacetSelectionModel.java
r4540 r4542 15 15 * along with this program. If not, see <http://www.gnu.org/licenses/>. 16 16 */ 17 package eu.clarin.cmdi.vlo. pojo;17 package eu.clarin.cmdi.vlo.wicket.model; 18 18 19 import java.io.Serializable; 19 import eu.clarin.cmdi.vlo.pojo.FacetSelection; 20 import eu.clarin.cmdi.vlo.pojo.QueryFacetsSelection; 20 21 import java.util.List; 21 22 import java.util.concurrent.CopyOnWriteArrayList; 23 import org.apache.wicket.model.AbstractReadOnlyModel; 22 24 import org.apache.wicket.model.IModel; 23 25 24 26 /** 27 * Model for FacetSelection that simply wraps a QueryFacetsSelection model and 28 * 'filters' for the specified facet 25 29 * 26 30 * @author twagoo 27 31 */ 28 public class FacetSelection implements Serializable{32 public class FacetSelectionModel extends AbstractReadOnlyModel<FacetSelection> implements FacetSelection { 29 33 30 34 private final String facet; 31 35 private final IModel<QueryFacetsSelection> selectionModel; 32 36 33 public FacetSelection(String facet, IModel<QueryFacetsSelection> selectionModel) { 37 /** 38 * 39 * @param facet facet to represent selection for 40 * @param selectionModel broad (multi-facet) selection model 41 */ 42 public FacetSelectionModel(String facet, IModel<QueryFacetsSelection> selectionModel) { 34 43 this.facet = facet; 35 44 this.selectionModel = selectionModel; 36 45 } 37 46 47 @Override 38 48 public String getFacet() { 39 49 return facet; 40 50 } 41 51 52 @Override 53 public List<String> getFacetValues() { 54 return new CopyOnWriteArrayList<String>(getSelection().getSelectionValues(facet)); 55 } 56 57 @Override 42 58 public QueryFacetsSelection getSelection() { 43 59 return selectionModel.getObject(); 44 60 } 45 61 46 public List<String> getFacetValues() { 47 return new CopyOnWriteArrayList<String>(getSelection().getSelectionValues(facet)); 62 @Override 63 public FacetSelection getObject() { 64 return this; 65 } 66 67 @Override 68 public void detach() { 69 selectionModel.detach(); 48 70 } 49 71
Note: See TracChangeset
for help on using the changeset viewer.