Changeset 5461
- Timestamp:
- 07/08/14 13:58:24 (10 years ago)
- Location:
- vlo/branches/vlo-3.1-vcr/vlo-web-app/src/main/java/eu/clarin/cmdi/vlo/wicket/panels
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
vlo/branches/vlo-3.1-vcr/vlo-web-app/src/main/java/eu/clarin/cmdi/vlo/wicket/panels/VirtualCollectionFormPanel.html
r5432 r5461 32 32 --> 33 33 <wicket:panel> 34 <form id="contentSearchForm" wicket:id="vcrForm" method="post" name="vcrForm" target="_blank"action="[VCR endpoint]">34 <form id="contentSearchForm" wicket:id="vcrForm" method="post" name="vcrForm" action="[VCR endpoint]"> 35 35 <fieldset style="border:0px;"> 36 36 <input type="hidden" name="type" value="EXTENSIONAL" /> … … 40 40 </wicket:container> 41 41 </fieldset> 42 <input type="submit" value="Create virtual collection" class="nonjsfallback" /> 42 43 </form> 43 <a href="#" onclick="document.vcrForm.submit();">Create virtual collection from search results</a>44 44 </wicket:panel> 45 45 </body> -
vlo/branches/vlo-3.1-vcr/vlo-web-app/src/main/java/eu/clarin/cmdi/vlo/wicket/panels/VirtualCollectionFormPanel.java
r5432 r5461 19 19 import eu.clarin.cmdi.vlo.FacetConstants; 20 20 import eu.clarin.cmdi.vlo.pojo.QueryFacetsSelection; 21 import eu.clarin.cmdi.vlo.wicket.model.SolrFieldModel;22 21 import eu.clarin.cmdi.vlo.wicket.model.SolrFieldStringModel; 23 22 import eu.clarin.cmdi.vlo.wicket.provider.SolrDocumentProvider; … … 35 34 /** 36 35 * Panel that renders an HTML form with hidden fields to submits the results of 37 * a query selection to the Virtual Collection Registry in order to create a 38 * newcollection36 * a query selection to the Virtual Collection Registry in order to create a new 37 * collection 39 38 * 40 39 * @author twagoo … … 43 42 44 43 //TODO: make configurable 45 private final int RESULTSET_SIZE_LIMIT = 10; 46 //TODO: make configurable 47 private final String vcrSubmitEndpoint = "http://localhost:8080/VirtualCollectionRegistry/service/submit"; 48 private final IDataProvider<SolrDocument> documentProvider; 44 private final String vcrSubmitEndpoint = "http://catalog-clarin.esc.rzg.mpg.de/vcr/service/submit"; 49 45 46 /** 47 * Construct the panel with a new document provider based on the provided 48 * model 49 * 50 * @param id component id 51 * @param model model to use for form content and document provider 52 */ 50 53 public VirtualCollectionFormPanel(String id, IModel<QueryFacetsSelection> model) { 54 this(id, model, new SolrDocumentProvider(model)); 55 } 56 57 /** 58 * Constructs the panel with a shared document provider 59 * 60 * @param id component id 61 * @param model model to use for form content (collection title) 62 * @param documentProvider provider to use for gathering document ID's 63 * (assumed to be based on the same model as the one provided to this 64 * constructor) 65 */ 66 public VirtualCollectionFormPanel(String id, IModel<QueryFacetsSelection> model, IDataProvider<SolrDocument> documentProvider) { 51 67 super(id, model); 52 53 //TOOD: optionally get provider through constructor (so that it can be shared)54 documentProvider = new SolrDocumentProvider(model);55 68 56 69 final WebMarkupContainer form = new WebMarkupContainer("vcrForm"); … … 91 104 } 92 105 93 @Override94 protected void onConfigure() {95 super.onConfigure();96 setVisible(documentProvider.size() < RESULTSET_SIZE_LIMIT);97 }98 99 106 } -
vlo/branches/vlo-3.1-vcr/vlo-web-app/src/main/java/eu/clarin/cmdi/vlo/wicket/panels/search/AdvancedSearchOptionsPanel.html
r5432 r5461 34 34 <input type="submit" value="Apply" class="nonjsfallback" /> 35 35 </form> 36 <div wicket:id="vcrForm" id="vcrsubmit"> 37 [VCR submit form] 36 <div wicket:id="vcrSubmit" id="vcrsubmit"> 37 <a wicket:id="vcrSubmitTrigger">Create virtual collection from search results</a> 38 <div wicket:id="vcrForm"> 39 [VCR submit form] 40 </div> 38 41 </div> 39 42 </div> -
vlo/branches/vlo-3.1-vcr/vlo-web-app/src/main/java/eu/clarin/cmdi/vlo/wicket/panels/search/AdvancedSearchOptionsPanel.java
r5432 r5461 28 28 import org.apache.wicket.ajax.AjaxRequestTarget; 29 29 import org.apache.wicket.ajax.form.OnChangeAjaxBehavior; 30 import org.apache.wicket.ajax.markup.html.AjaxFallbackLink; 31 import org.apache.wicket.markup.html.WebMarkupContainer; 30 32 import org.apache.wicket.markup.html.basic.Label; 31 33 import org.apache.wicket.markup.html.form.CheckBox; … … 43 45 */ 44 46 public abstract class AdvancedSearchOptionsPanel extends ExpandablePanel<QueryFacetsSelection> { 45 47 46 48 public AdvancedSearchOptionsPanel(String id, IModel<QueryFacetsSelection> model) { 47 49 super(id, model); … … 51 53 // wrap in a toggle model that allows switching between a null selection and a 'not empty' selection 52 54 final ToggleModel<FacetSelection> toggleModel = new ToggleModel<FacetSelection>(fcsFacetModel, null, new FacetSelection(FacetSelectionType.NOT_EMPTY)); 53 55 54 56 final Form options = new Form("options"); 55 57 final CheckBox fcsCheck = new CheckBox("fcs", toggleModel); 56 58 fcsCheck.add(new OnChangeAjaxBehavior() { 57 59 58 60 @Override 59 61 protected void onUpdate(AjaxRequestTarget target) { … … 64 66 add(options); 65 67 66 //TODO: lazy rendering of form, it can be large. I.e. provide a link 67 //that makes form 'visible', and then tries to auto submit 68 add(new VirtualCollectionFormPanel("vcrForm", model)); 68 final WebMarkupContainer vcrSubmit = new WebMarkupContainer("vcrSubmit"); 69 vcrSubmit.setOutputMarkupId(true); 70 add(vcrSubmit); 71 72 final VirtualCollectionFormPanel vcrSubmitForm = new VirtualCollectionFormPanel("vcrForm", model); 73 vcrSubmitForm.setVisible(false); 74 vcrSubmit.add(vcrSubmitForm); 75 76 vcrSubmit.add(new AjaxFallbackLink("vcrSubmitTrigger") { 77 78 @Override 79 public void onClick(AjaxRequestTarget target) { 80 vcrSubmitForm.setVisible(true); 81 if (target != null) { 82 target.add(vcrSubmit); 83 // after update, submit the form to the VCR 84 target.appendJavaScript("document.vcrForm.submit();"); 85 } 86 } 87 }); 69 88 70 89 // should initially be epxanded if one of the options was selected … … 73 92 } 74 93 } 75 94 76 95 @Override 77 96 protected Label createTitleLabel(String id) { 78 97 return new Label(id, "Search options"); 79 98 } 80 99 81 100 protected abstract void selectionChanged(AjaxRequestTarget target); 82 101 83 102 }
Note: See TracChangeset
for help on using the changeset viewer.