Changeset 4971
- Timestamp:
- 04/14/14 14:22:57 (10 years ago)
- Location:
- vlo/branches/vlo-3.0/vlo-web-app/src/main/java/eu/clarin/cmdi/vlo
- Files:
-
- 2 added
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
vlo/branches/vlo-3.0/vlo-web-app/src/main/java/eu/clarin/cmdi/vlo/pojo/FacetSelection.java
r4967 r4971 23 23 24 24 /** 25 * Represents the selection for a single facet 25 26 * 26 27 * @author twagoo … … 31 32 private final Collection<String> values; 32 33 34 /** 35 * Creates an {@link FacetSelectionType#AND} selection for the specified 36 * values 37 * 38 * @param values 39 */ 33 40 public FacetSelection(Collection<String> values) { 34 41 this(FacetSelectionType.AND, values); 35 42 } 36 43 44 /** 45 * Creates an empty selection with the specified type 46 * 47 * @param type 48 */ 37 49 public FacetSelection(FacetSelectionType type) { 38 50 this(type, Lists.<String>newArrayList()); … … 50 62 } 51 63 64 /** 65 * 66 * @return type of selection 67 */ 52 68 public FacetSelectionType getSelectionType() { 53 69 return selectionType; 54 70 } 55 71 72 /** 73 * 74 * @return values subject to selection type 75 */ 56 76 public Collection<String> getValues() { 57 77 return values; … … 62 82 } 63 83 84 @Override 85 public int hashCode() { 86 int hash = 3; 87 hash = 79 * hash + (this.selectionType != null ? this.selectionType.hashCode() : 0); 88 hash = 79 * hash + (this.values != null ? this.values.hashCode() : 0); 89 return hash; 90 } 91 92 @Override 93 public boolean equals(Object obj) { 94 if (obj == null) { 95 return false; 96 } 97 if (getClass() != obj.getClass()) { 98 return false; 99 } 100 final FacetSelection other = (FacetSelection) obj; 101 if (this.selectionType != other.selectionType) { 102 return false; 103 } 104 if (this.values != other.values && (this.values == null || !this.values.equals(other.values))) { 105 return false; 106 } 107 return true; 108 } 109 64 110 } -
vlo/branches/vlo-3.0/vlo-web-app/src/main/java/eu/clarin/cmdi/vlo/pojo/FacetSelectionType.java
r4963 r4971 23 23 public enum FacetSelectionType { 24 24 25 /** 26 * Specifies a selection of all documents with a non-empty value for this 27 * facet; values supplied in the selection should be ignored 28 */ 25 29 NOT_EMPTY, 30 /** 31 * Specifies a selection of all documents that match all values supplied in 32 * the selection 33 */ 26 34 AND, 35 /** 36 * Specifies a selection of all documents that match at least one of the 37 * values supplied in the selection 38 */ 27 39 OR, 40 /** 41 * Specifies a selection of all documents that match none of the values 42 * supplied in the selection 43 */ 28 44 NOT 29 45 -
vlo/branches/vlo-3.0/vlo-web-app/src/main/java/eu/clarin/cmdi/vlo/wicket/pages/FacetedSearchPage.html
r4937 r4971 66 66 <div class="sidebar"> 67 67 68 <div wicket:id="facets"></div> 69 70 <!-- <div class="sidebaritem facet collapsedfacet"> 71 rounded corners - top **** 72 <div class="rtop"><div class="r1"></div><div class="r2"></div><div class="r3"></div><div class="r4"></div></div> 73 <a href="#" class="expandfacet"><span>expand</span></a> 74 <a href="#" class="collapsefacet"><span>collapse</span></a> 75 <h1><a href="#">Search options</a></h1> 76 <div class="sbilinks facetvalues"> 77 <form id="advancedoptions" action=""> 78 <ul> 79 <li> 80 <input type="checkbox" id="onlyfcs"/> 81 <label for="onlyfcs">Only include resources that support content search</label> 82 </li> 83 <li> 84 <input type="checkbox" id="onlymdformat"/> 85 <label for="onlyfcs">Only include resources described with</label> 86 <select> 87 <option>CMDI</option> 88 <option>OLAC</option> 89 </select> 90 </li> 91 </ul> 92 <input type="submit" value="Apply" /> 93 </form> 94 </div> 95 rounded corners - bottom **** 96 <div class="rbottom"><div class="r4"></div><div class="r3"></div><div class="r2"></div><div class="r1"></div></div> 97 </div>--> 68 <div wicket:id="facets">[facets]</div> 69 <div wicket:id="options">[options]</div> 98 70 </div> 99 71 </wicket:extend> -
vlo/branches/vlo-3.0/vlo-web-app/src/main/java/eu/clarin/cmdi/vlo/wicket/pages/FacetedSearchPage.java
r4924 r4971 14 14 import eu.clarin.cmdi.vlo.wicket.panels.search.FacetValuesPanel; 15 15 import eu.clarin.cmdi.vlo.wicket.panels.TopLinksPanel; 16 import eu.clarin.cmdi.vlo.wicket.panels.search.AdvancedSearchOptionsPanel; 16 17 import java.util.List; 17 18 import org.apache.solr.client.solrj.response.FacetField; … … 84 85 add(facetsPanel); 85 86 87 Panel optionsPanel = createOptionsPanel("options"); 88 add(optionsPanel); 89 86 90 searchResultsPanel = new SearchResultsPanel("searchResults", getModel()); 87 91 add(searchResultsPanel); 92 } 93 94 public Panel createOptionsPanel(String id) { 95 final Panel optionsPanel = new AdvancedSearchOptionsPanel(id, getModel()) { 96 97 @Override 98 protected void selectionChanged(AjaxRequestTarget target) { 99 updateSelection(target); 100 } 101 }; 102 return optionsPanel; 88 103 } 89 104 -
vlo/branches/vlo-3.0/vlo-web-app/src/main/java/eu/clarin/cmdi/vlo/wicket/panels/search/AdvancedSearchOptionsPanel.html
r4963 r4971 24 24 <body> 25 25 <wicket:panel> 26 <div class="sidebaritem facet collapsedfacet">26 <div class="sidebaritem facet expandedfacet"> 27 27 <!--rounded corners - top ****--> 28 28 <div class="rtop"><div class="r1"></div><div class="r2"></div><div class="r3"></div><div class="r4"></div></div> … … 31 31 <h1><a href="#">Search options</a></h1> 32 32 <div class="sbilinks facetvalues"> 33 <form id="advancedoptions" action="">33 <form wicket:id="options" id="advancedoptions" action=""> 34 34 <ul> 35 35 <li> … … 46 46 </li> 47 47 </ul> 48 <input type="submit" value="Apply" />48 <input type="submit" value="Apply" class="nonjsfallback" /> 49 49 </form> 50 50 </div> -
vlo/branches/vlo-3.0/vlo-web-app/src/main/java/eu/clarin/cmdi/vlo/wicket/panels/search/AdvancedSearchOptionsPanel.java
r4963 r4971 15 15 * along with this program. If not, see <http://www.gnu.org/licenses/>. 16 16 */ 17 18 17 package eu.clarin.cmdi.vlo.wicket.panels.search; 19 18 19 import eu.clarin.cmdi.vlo.FacetConstants; 20 import eu.clarin.cmdi.vlo.pojo.FacetSelection; 21 import eu.clarin.cmdi.vlo.pojo.FacetSelectionType; 20 22 import eu.clarin.cmdi.vlo.pojo.QueryFacetsSelection; 23 import eu.clarin.cmdi.vlo.wicket.model.FacetSelectionModel; 24 import eu.clarin.cmdi.vlo.wicket.model.ToggleModel; 25 import org.apache.wicket.ajax.AjaxRequestTarget; 26 import org.apache.wicket.ajax.form.OnChangeAjaxBehavior; 27 import org.apache.wicket.markup.html.form.CheckBox; 28 import org.apache.wicket.markup.html.form.Form; 21 29 import org.apache.wicket.markup.html.panel.GenericPanel; 22 30 import org.apache.wicket.model.IModel; 23 31 24 32 /** 33 * A panel showing advanced search options: 34 * <ul> 35 * <li>selection of records that support FCS</li> 36 * <li>selection of records that are based on either CMDI or OLAC</li> 37 * </ul> 25 38 * 26 39 * @author twagoo 27 40 */ 28 public class AdvancedSearchOptionsPanel extends GenericPanel<QueryFacetsSelection> {41 public abstract class AdvancedSearchOptionsPanel extends GenericPanel<QueryFacetsSelection> { 29 42 30 43 public AdvancedSearchOptionsPanel(String id, IModel<QueryFacetsSelection> model) { 31 44 super(id, model); 45 46 // create a model for the selection state for the FCS facet 47 final IModel<FacetSelection> fcsFacetModel = new FacetSelectionModel(model, FacetConstants.FIELD_SEARCH_SERVICE); 48 // wrap in a toggle model that allows switching between a null selection and a 'not empty' selection 49 final ToggleModel<FacetSelection> toggleModel = new ToggleModel<FacetSelection>(fcsFacetModel, null, new FacetSelection(FacetSelectionType.NOT_EMPTY)); 50 51 final Form options = new Form("options"); 52 final CheckBox fcsCheck = new CheckBox("fcs", toggleModel); 53 fcsCheck.add(new OnChangeAjaxBehavior() { 54 55 @Override 56 protected void onUpdate(AjaxRequestTarget target) { 57 selectionChanged(target); 58 } 59 }); 60 options.add(fcsCheck); 61 add(options); 32 62 } 33 63 64 protected abstract void selectionChanged(AjaxRequestTarget target); 65 34 66 } -
vlo/branches/vlo-3.0/vlo-web-app/src/main/java/eu/clarin/cmdi/vlo/wicket/panels/search/FacetsPanel.java
r4963 r4971 18 18 19 19 import eu.clarin.cmdi.vlo.pojo.ExpansionState; 20 import eu.clarin.cmdi.vlo.pojo.FacetSelection;21 20 import eu.clarin.cmdi.vlo.pojo.QueryFacetsSelection; 22 21 import eu.clarin.cmdi.vlo.service.solr.FacetFieldsService; … … 24 23 import eu.clarin.cmdi.vlo.wicket.model.FacetFieldModel; 25 24 import eu.clarin.cmdi.vlo.wicket.model.FacetFieldSelectionModel; 26 import java.util.Collection;27 25 import java.util.HashMap; 28 26 import java.util.List;
Note: See TracChangeset
for help on using the changeset viewer.