Changeset 4232
- Timestamp:
- 01/09/14 13:44:11 (10 years ago)
- Location:
- vlo/branches/to-wicket-1.6/vlo_web_app
- Files:
-
- 1 deleted
- 9 edited
Legend:
- Unmodified
- Added
- Removed
-
vlo/branches/to-wicket-1.6/vlo_web_app/pom.xml
r4229 r4232 51 51 <artifactId>vlo_importer</artifactId> 52 52 <version>2.18</version> 53 <type>jar</type> 54 </dependency> 55 <dependency> 56 <groupId>org.apache.wicket</groupId> 57 <artifactId>wicket-request</artifactId> 58 <version>6.12.0</version> 53 59 <type>jar</type> 54 60 </dependency> -
vlo/branches/to-wicket-1.6/vlo_web_app/src/main/java/eu/clarin/cmdi/vlo/VloSession.java
r4201 r4232 4 4 import org.apache.wicket.protocol.http.WebSession; 5 5 import org.apache.wicket.request.Request; 6 import org.apache.wicket.request.mapper.parameter.PageParameters; 6 7 7 8 /** 8 * Class associating VLO sessions with a VLO theme and VLO page parameters. 9 * A web session containing a VLO theme and parameters that are considered to 10 * be persistent in a VLO session. 9 11 * 10 * While it is never explicitly created, it is always part of a cast, the public 11 12 * field of objects of this class seems to hold the expected values. 13 * 12 * Note that these parameters can include the specification of the theme. 13 * 14 14 * @author keeloo 15 15 */ 16 16 public class VloSession extends WebSession { 17 17 18 /** 19 * Remember the parameters that should persist in URLs to VLO pages 20 * <br><br> 21 */ 22 public VloPageParameters vloSessionPageParameters = new VloPageParameters(); 18 // remember the parameters that need to persist in URLs to VLO pages in this session 19 public PageParameters vloSessionPageParameters = new PageParameters(); 23 20 24 /** 25 * 26 * @return 27 */ 28 public VloPageParameters getVloSessionPageParameters() { 29 return vloSessionPageParameters; 30 } 31 32 /** 33 * Add page parameters with the VLO session related ones 34 * 35 * @param parameters a page parameter map 36 * 37 */ 38 public void addVloSessionPageParameters(VloPageParameters parameters) { 39 40 vloSessionPageParameters.mergeWith(parameters); 41 } 42 /** 43 * Theme currently applied in the VLO web application 44 */ 21 // remember this session's theme 45 22 private Theme currentTheme = new Theme("defaultTheme"); 46 23 47 24 /** 48 * Construct or withrequest parameter25 * Construct a session object with a request parameter 49 26 * 50 27 * @param request … … 55 32 } 56 33 34 /** 35 * Get the session's theme 36 * 37 * @return the session's theme 38 */ 57 39 public Theme getCurrentTheme() { 58 return currentTheme;40 return this.currentTheme; 59 41 } 60 42 61 43 /** 44 * Set the session's theme 62 45 * 63 * @param currentTheme46 * @param theme the session's theme 64 47 */ 65 public void setCurrentTheme(Theme currentTheme) { 66 this.currentTheme = currentTheme; 48 public void setCurrentTheme(Theme theme) { 49 this.currentTheme = theme; 50 } 51 52 /** 53 * Return the session's persistent parameters 54 * 55 * @return session parameters 56 */ 57 public PageParameters getVloSessionPageParameters() { 58 return vloSessionPageParameters; 59 } 60 61 /** 62 * Add parameters to the session's persistent parameters 63 * 64 * @param parameters a page parameter map 65 * 66 */ 67 public void addVloSessionPageParameters(PageParameters parameters) { 68 69 vloSessionPageParameters.mergeWith(parameters); 67 70 } 68 71 } -
vlo/branches/to-wicket-1.6/vlo_web_app/src/main/java/eu/clarin/cmdi/vlo/VloWebApplication.java
r4228 r4232 49 49 50 50 // from these, get the parameters represented in the URL 51 // Map <String, String[]> map = this.getWebRequest().getParameterMap();51 // Map <String, String[]> map = this.getWebRequest().getParameterMap(); 52 52 // check if there is a theme parameter 53 53 StringValue object = reqParam.getParameterValue("theme"); … … 190 190 return new VloSession(request); 191 191 } 192 193 192 } -
vlo/branches/to-wicket-1.6/vlo_web_app/src/main/java/eu/clarin/cmdi/vlo/pages/BasePage.java
r4220 r4232 3 3 import eu.clarin.cmdi.vlo.VloWebApplication; 4 4 import eu.clarin.cmdi.vlo.VloSession; 5 import eu.clarin.cmdi.vlo.VloPageParameters;6 5 import org.apache.wicket.markup.head.CssHeaderItem; 7 6 import org.apache.wicket.markup.head.IHeaderResponse; … … 57 56 58 57 // set the applications start page link to the faceted search page 59 VloPageParameters startPageParameters = new VloPageParameters (); 58 PageParameters startPageParameters = new PageParameters (); 59 // add the session persistent parameters 60 startPageParameters.mergeWith(((VloSession)this.getSession()).getVloSessionPageParameters()); 60 61 61 62 BookmarkablePageLink link = new BookmarkablePageLink("startpage", … … 71 72 leftImage = new Image("leftimage", leftImageRes); 72 73 73 // mergethe image to the page74 // add the image to the page 74 75 link.add(leftImage); 75 76 … … 82 83 rightImage = new Image("rightimage", rightImageRes); 83 84 84 // mergeit to the page85 // add it to the page 85 86 add (rightImage); 86 87 -
vlo/branches/to-wicket-1.6/vlo_web_app/src/main/java/eu/clarin/cmdi/vlo/pages/FacetBoxPanel.java
r4229 r4232 1 1 package eu.clarin.cmdi.vlo.pages; 2 2 3 import eu.clarin.cmdi.vlo.VloPageParameters;4 3 import java.util.ArrayList; 5 4 import java.util.HashSet; … … 66 65 }; 67 66 add(facetList); 68 VloPageParameters facetParameters = new VloPageParameters ();67 PageParameters facetParameters = new PageParameters (); 69 68 70 69 PageParameters extraParameters = new PageParameters (); 71 extraParameters.add(ShowAllFacetValuesPage.SELECTED_FACET_PARAM, facetField.getName()); 72 extraParameters.add(ShowAllFacetValuesPage.FACET_MIN_OCCURS, "1"); 70 // kj; add the new values directly 71 // extraParameters.add(ShowAllFacetValuesPage.SELECTED_FACET_PARAM, facetField.getName()); 72 // extraParameters.add(ShowAllFacetValuesPage.FACET_MIN_OCCURS, "1"); 73 facetParameters.add(ShowAllFacetValuesPage.SELECTED_FACET_PARAM, facetField.getName()); 74 facetParameters.add(ShowAllFacetValuesPage.FACET_MIN_OCCURS, "1"); 73 75 //TODO: merge again once implemented 74 facetParameters.merge(extraParameters);76 // facetParameters.add(extraParameters); 75 77 76 78 add(new BookmarkablePageLink("showMore", ShowAllFacetValuesPage.class, extraParameters) { -
vlo/branches/to-wicket-1.6/vlo_web_app/src/main/java/eu/clarin/cmdi/vlo/pages/FacetHeaderPanel.java
r4220 r4232 1 1 package eu.clarin.cmdi.vlo.pages; 2 2 3 import eu.clarin.cmdi.vlo.VloPageParameters;4 3 import org.apache.wicket.markup.html.basic.Label; 5 4 import org.apache.wicket.markup.html.link.BookmarkablePageLink; -
vlo/branches/to-wicket-1.6/vlo_web_app/src/main/java/eu/clarin/cmdi/vlo/pages/FacetLinkPanel.java
r4220 r4232 1 1 package eu.clarin.cmdi.vlo.pages; 2 2 3 import eu.clarin.cmdi.vlo.VloPageParameters;4 3 import org.apache.solr.client.solrj.response.FacetField.Count; 5 4 import org.apache.wicket.markup.html.basic.Label; -
vlo/branches/to-wicket-1.6/vlo_web_app/src/main/java/eu/clarin/cmdi/vlo/pages/FacetedSearchPage.java
r4220 r4232 3 3 import eu.clarin.cmdi.vlo.FacetConstants; 4 4 import eu.clarin.cmdi.vlo.Resources; 5 import eu.clarin.cmdi.vlo.Vlo PageParameters;5 import eu.clarin.cmdi.vlo.VloSession; 6 6 import eu.clarin.cmdi.vlo.config.VloConfig; 7 7 import eu.clarin.cmdi.vlo.dao.AutoCompleteDao; … … 52 52 private final static Map<String, FacetConcept> facetNameMap = VLOMarshaller.getFacetConceptMapping(facetConceptsFile).getFacetConceptMap(); 53 53 54 public FacetedSearchPage(PageParameters params) {55 this(VloPageParameters.convert(params));56 }57 58 54 /** 59 55 * @param parameters Page parameters 60 56 * @throws SolrServerException 61 57 */ 62 public FacetedSearchPage(final VloPageParameters parameters) {58 public FacetedSearchPage(final PageParameters parameters) { 63 59 super(parameters); 64 60 query = new SearchPageQuery(parameters); … … 144 140 } 145 141 146 // finally, mergethe label to the form142 // finally, add the label to the form 147 143 this.add(facetOverview); 148 144 } … … 163 159 add(submit); 164 160 165 // mergelink to help menu page161 // add link to help menu page 166 162 String helpUrl = VloConfig.getHelpUrl(); 167 163 ExternalLink helpLink = new ExternalLink("helpLink", helpUrl, "help"); 168 164 add(helpLink); 169 165 170 VloPageParameters param; 171 param = new VloPageParameters(query.getPageParameters()); 166 PageParameters param; 167 param = new PageParameters(query.getPageParameters()); 168 // add the session persistent parameters 169 param.mergeWith(((VloSession)this.getSession()).getVloSessionPageParameters()); 172 170 173 171 final RequestCycle reqCycle = getRequestCycle(); 174 final Url reqUrl = Url.parse(reqCycle.urlFor(ShowResultPage.class, param.convert())); 172 // kj, the same here 173 final Url reqUrl = Url.parse(reqCycle.urlFor(ShowResultPage.class, param)); 175 174 String thisURL = reqCycle.getUrlRenderer().renderFullUrl(reqUrl); 176 175 … … 192 191 PageParameters param = query.getPageParameters(); 193 192 194 VloPageParameters newParam = new VloPageParameters(); 193 PageParameters newParam = new PageParameters(); 194 // add the session persistent parameters 195 newParam.mergeWith(((VloSession)this.getSession()).getVloSessionPageParameters()); 195 196 196 197 setResponsePage(FacetedSearchPage.class, newParam); … … 309 310 } 310 311 311 // mergeHTML form to container312 // add HTML form to container 312 313 String labelString; 313 314 if (totalResults == 1) { … … 321 322 contentSearchLabel.setEscapeModelStrings(false); 322 323 contentSearchContainer.add(contentSearchLabel); 323 // contentSearchContainer. merge(link);324 // contentSearchContainer.add(link); 324 325 } catch (UnsupportedEncodingException uee) { 325 326 contentSearchContainer.setVisible(false); -
vlo/branches/to-wicket-1.6/vlo_web_app/src/main/java/eu/clarin/cmdi/vlo/pages/ShowResultPage.java
r4223 r4232 4 4 import eu.clarin.cmdi.vlo.Resources; 5 5 import eu.clarin.cmdi.vlo.StringUtils; 6 import eu.clarin.cmdi.vlo.Vlo PageParameters;6 import eu.clarin.cmdi.vlo.VloSession; 7 7 import eu.clarin.cmdi.vlo.config.VloConfig; 8 8 import eu.clarin.cmdi.vlo.dao.DaoLocator; … … 82 82 final SearchPageQuery query = new SearchPageQuery(currentParam); 83 83 84 // create parameters from the query, and merge them with session related parameters 85 VloPageParameters newParam; 86 newParam = new VloPageParameters(query.getPageParameters()); 84 // create parameters from the query, and add them with session related parameters 85 PageParameters newParam; 86 newParam = new PageParameters(query.getPageParameters()); 87 // add the session persistent parameters 88 newParam.mergeWith(((VloSession)this.getSession()).getVloSessionPageParameters()); 87 89 88 90 BookmarkablePageLink<String> backLink = new BookmarkablePageLink<String>("backLink", FacetedSearchPage.class, newParam); … … 425 427 private void addFeedbackLink(final PageParameters parameters) { 426 428 427 // create VloPageParameters in orde to be able to convert to old style parameters 428 VloPageParameters newParam = new VloPageParameters(parameters); 429 PageParameters newParam = new PageParameters(parameters); 430 // add the session persistent paremeters 431 newParam.mergeWith(((VloSession)this.getSession()).getVloSessionPageParameters()); 429 432 430 433 final RequestCycle reqCycle = getRequestCycle(); 431 final Url reqUrl = Url.parse(reqCycle.urlFor(ShowResultPage.class, newParam.convert())); 434 // the following will not be necessary anymore 435 // final Url reqUrl = Url.parse(reqCycle.urlFor(ShowResultPage.class, newParam.convert())); 436 final Url reqUrl = Url.parse(reqCycle.urlFor(ShowResultPage.class, newParam)); 432 437 String thisURL = reqCycle.getUrlRenderer().renderFullUrl(reqUrl); 433 438 … … 453 458 454 459 // create new page parameters from the query parameters and the session related ones 455 VloPageParameters newParam; 456 newParam = new VloPageParameters(query.getPageParameters()); 460 PageParameters newParam; 461 newParam = new PageParameters(query.getPageParameters()); 462 // add the session persistent parameters 463 // newParam.add(((VloSession)this.getSession()).getVloSessionPageParameters()); 457 464 newParam.add(ShowResultPage.PARAM_DOC_ID, UrlEncoder.QUERY_INSTANCE.encode( 458 465 docId,
Note: See TracChangeset
for help on using the changeset viewer.