Changeset 4208 for vlo/branches/to-wicket-1.6/vlo_web_app/src/main/java/eu/clarin/cmdi/vlo/pages/ShowResultPage.java
- Timestamp:
- 12/20/13 10:03:18 (10 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
vlo/branches/to-wicket-1.6/vlo_web_app/src/main/java/eu/clarin/cmdi/vlo/pages/ShowResultPage.java
r4199 r4208 4 4 import eu.clarin.cmdi.vlo.Resources; 5 5 import eu.clarin.cmdi.vlo.StringUtils; 6 import eu.clarin.cmdi.vlo.VloPageParameters; 6 7 import eu.clarin.cmdi.vlo.VloWebApplication; 7 8 import eu.clarin.cmdi.vlo.VloSession; … … 32 33 import org.apache.wicket.RequestCycle; 33 34 import org.apache.wicket.behavior.AbstractBehavior; 35 import org.apache.wicket.behavior.Behavior; 34 36 import org.apache.wicket.extensions.ajax.markup.html.AjaxLazyLoadPanel; 35 37 import org.apache.wicket.extensions.markup.html.basic.SmartLinkMultiLineLabel; … … 74 76 75 77 super(currentParam); 76 final String docId = WicketURLDecoder.QUERY_INSTANCE.decode(getPageParameters().getString(PARAM_DOC_ID, null)); 78 final String docId; 79 docId = WicketURLDecoder.QUERY_INSTANCE.decode(getPageParameters().get(PARAM_DOC_ID).toString()); 77 80 SolrDocument solrDocument = DaoLocator.getSearchResultsDao().getSolrDocument(docId); 78 81 if (solrDocument != null) { 79 82 final SearchPageQuery query = new SearchPageQuery(currentParam); 80 83 81 // now the persistent parameters are not in the query parameters 82 PageParameters newParam = new PageParameters (); 83 // add the new query parameters to this map 84 newParam.putAll(query.getPageParameters()); 85 // add the persistent parameters to this map 86 //newParam = webApp.reflectPersistentParameters(newParam); 87 88 newParam = ((VloWebApplication.ThemedSession)getSession()).reflectPersistentParameters(newParam); 84 // create parameters from the query, and merge them with session related parameters 85 VloPageParameters newParam; 86 newParam = new VloPageParameters (query.getPageParameters()); 89 87 90 88 BookmarkablePageLink<String> backLink = new BookmarkablePageLink<String>("backLink", FacetedSearchPage.class, newParam); … … 180 178 * Create one column for the attributes and one column for their values. 181 179 * 182 * @ param180 * @newParam 183 181 */ 184 private IColumn[]createAttributesColumns() {185 IColumn[] columns = new IColumn[2];182 private List<IColumn> createAttributesColumns() { 183 List<IColumn> columns = null; 186 184 187 185 // create the column for the attribute names 188 columns[0] = new PropertyColumn<Object>(new ResourceModel(Resources.FIELD), "field") { 186 IColumn column = null; 187 column = new PropertyColumn<Object,Object>(new ResourceModel(Resources.FIELD), "field") { 189 188 190 189 @Override … … 193 192 } 194 193 }; 194 columns.add (column); 195 195 196 196 // create the column for the values of the attributes 197 column s[1] = new AbstractColumn<DocumentAttribute>(new ResourceModel(Resources.VALUE)) {197 column = new AbstractColumn<DocumentAttribute, String>(new ResourceModel(Resources.VALUE)) { 198 198 @Override 199 199 public void populateItem(Item<ICellPopulator<DocumentAttribute>> cellItem, … … 214 214 cellItem.add(new SmartLinkMultiLineLabel(componentId, attribute.getValue()) { 215 215 @Override 216 p rotectedvoid onComponentTagBody(MarkupStream markupStream, ComponentTag openTag) {216 public void onComponentTagBody(MarkupStream markupStream, ComponentTag openTag) { 217 217 setEscapeModelStrings(false); 218 218 CharSequence body = getDefaultModelObjectAsString(); … … 223 223 cellItem.add(new SmartLinkMultiLineLabel(componentId, attribute.getValue()) { 224 224 @Override 225 p rotectedvoid onComponentTagBody(MarkupStream markupStream, ComponentTag openTag) {225 public void onComponentTagBody(MarkupStream markupStream, ComponentTag openTag) { 226 226 setEscapeModelStrings(false); 227 227 CharSequence body = getDefaultModelObjectAsString(); … … 232 232 cellItem.add(new SmartLinkMultiLineLabel(componentId, attribute.getValue()) { 233 233 @Override 234 p rotectedvoid onComponentTagBody(MarkupStream markupStream, ComponentTag openTag) {234 public void onComponentTagBody(MarkupStream markupStream, ComponentTag openTag) { 235 235 CharSequence body = StringUtils.toMultiLineHtml(getDefaultModelObjectAsString()); 236 236 replaceComponentTagBody(markupStream, openTag, getSmartLink(body)); … … 245 245 } 246 246 }; 247 columns.add (column); 247 248 248 249 return columns; … … 252 253 * Add landing page links to the result page. 253 254 * 254 * @ param solrDocument the document to get the links from255 * @newParam solrDocument the document to get the links from 255 256 */ 256 257 private void addLandingPageLinks(SolrDocument solrDocument) { … … 322 323 * Add search page links to the result page. 323 324 * 324 * @ param solrDocument the document to get the links from325 * @newParam solrDocument the document to get the links from 325 326 */ 326 327 private void addSearchPageLinks(SolrDocument solrDocument) { … … 393 394 * page. 394 395 * 395 * @ param solrDocument the document to get the links from396 * @newParam solrDocument the document to get the links from 396 397 */ 397 398 private void addResourceLinks(SolrDocument solrDocument) { … … 423 424 424 425 private void addFeedbackLink(final PageParameters parameters) { 425 String thisURL = RequestUtils.toAbsolutePath(RequestCycle.get().urlFor(ShowResultPage.class, parameters).toString()); 426 427 // create VloPageParameters in orde to be able to convert to old style parameters 428 VloPageParameters newParam = new VloPageParameters (parameters); 429 430 String thisURL = RequestUtils.toAbsolutePath(RequestCycle.get().urlFor(ShowResultPage.class, newParam.convert()).toString(),null); 426 431 try { 427 432 thisURL = URLEncoder.encode(thisURL,"UTF-8"); … … 442 447 } 443 448 444 public static BookmarkablePageLink<ShowResultPage> createBookMarkableLink(String linkId, SearchPageQuery query, String docId, VloSession session) { 445 PageParameters pageParameters = query.getPageParameters(); 446 pageParameters.put(ShowResultPage.PARAM_DOC_ID, WicketURLEncoder.QUERY_INSTANCE.encode(docId)); 447 448 // webApp.reflectPersistentParameters(pageParameters); 449 // instead of this: pass page parameters back to the session 450 session.reflectPersistentParameters(pageParameters); 449 public static BookmarkablePageLink<ShowResultPage> createBookMarkableLink(String linkId, SearchPageQuery query, String docId) { 450 451 // create new page parameters from the query parameters and the session related ones 452 VloPageParameters newParam; 453 newParam = new VloPageParameters(query.getPageParameters()); 454 newParam.add(ShowResultPage.PARAM_DOC_ID, WicketURLEncoder.QUERY_INSTANCE.encode(docId)); 451 455 452 456 BookmarkablePageLink<ShowResultPage> docLink = new BookmarkablePageLink<ShowResultPage>(linkId, ShowResultPage.class, 453 pageParameters);457 newParam); 454 458 return docLink; 455 459 } … … 457 461 /** 458 462 * Add contentSearch form (FCS) 459 * @ param solrDocument463 * @newParam solrDocument 460 464 */ 461 465 private void addSearchServiceForm(final SolrDocument solrDocument) { … … 483 487 /** 484 488 * Add complete CMDI view 485 * @ param solrDocument489 * @newParam solrDocument 486 490 */ 487 491 private void addCompleteCmdiView(final SolrDocument solrDocument) { … … 515 519 516 520 // remove complete CMDI view on page load 517 add(new AbstractBehavior() {521 add(new Behavior() { 518 522 private static final long serialVersionUID = 1865219352602175954L; 519 523 520 @Override521 524 public void renderHead(IHeaderResponse response) { 522 super.renderHead(response); 525 523 526 response.renderOnLoadJavascript("toogleDiv('completeCmdi', 'toogleLink')"); 524 527 }
Note: See TracChangeset
for help on using the changeset viewer.