Ignore:
Timestamp:
12/20/13 10:03:18 (10 years ago)
Author:
keeloo
Message:

Finished the upgrade. The web application still needs to be tested.

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  
    44import eu.clarin.cmdi.vlo.Resources;
    55import eu.clarin.cmdi.vlo.StringUtils;
     6import eu.clarin.cmdi.vlo.VloPageParameters;
    67import eu.clarin.cmdi.vlo.VloWebApplication;
    78import eu.clarin.cmdi.vlo.VloSession;
     
    3233import org.apache.wicket.RequestCycle;
    3334import org.apache.wicket.behavior.AbstractBehavior;
     35import org.apache.wicket.behavior.Behavior;
    3436import org.apache.wicket.extensions.ajax.markup.html.AjaxLazyLoadPanel;
    3537import org.apache.wicket.extensions.markup.html.basic.SmartLinkMultiLineLabel;
     
    7476       
    7577        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());
    7780        SolrDocument solrDocument = DaoLocator.getSearchResultsDao().getSolrDocument(docId);
    7881        if (solrDocument != null) {
    7982            final SearchPageQuery query = new SearchPageQuery(currentParam);
    8083           
    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());
    8987           
    9088            BookmarkablePageLink<String> backLink = new BookmarkablePageLink<String>("backLink", FacetedSearchPage.class, newParam);
     
    180178     * Create one column for the attributes and one column for their values.
    181179     *
    182      * @param
     180     * @newParam
    183181     */
    184     private IColumn[] createAttributesColumns() {
    185         IColumn[] columns = new IColumn[2];
     182    private List<IColumn> createAttributesColumns() {
     183        List<IColumn> columns = null;
    186184
    187185        // 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") {
    189188
    190189            @Override
     
    193192            }
    194193        };
     194        columns.add (column);
    195195
    196196        // create the column for the values of the attributes
    197         columns[1] = new AbstractColumn<DocumentAttribute>(new ResourceModel(Resources.VALUE)) {
     197        column = new AbstractColumn<DocumentAttribute, String>(new ResourceModel(Resources.VALUE)) {
    198198            @Override
    199199            public void populateItem(Item<ICellPopulator<DocumentAttribute>> cellItem,
     
    214214                    cellItem.add(new SmartLinkMultiLineLabel(componentId, attribute.getValue()) {
    215215                        @Override
    216                         protected void onComponentTagBody(MarkupStream markupStream, ComponentTag openTag) {
     216                        public void onComponentTagBody(MarkupStream markupStream, ComponentTag openTag) {
    217217                            setEscapeModelStrings(false);
    218218                            CharSequence body = getDefaultModelObjectAsString();
     
    223223                    cellItem.add(new SmartLinkMultiLineLabel(componentId, attribute.getValue()) {
    224224                        @Override
    225                         protected void onComponentTagBody(MarkupStream markupStream, ComponentTag openTag) {
     225                        public void onComponentTagBody(MarkupStream markupStream, ComponentTag openTag) {
    226226                            setEscapeModelStrings(false);
    227227                            CharSequence body = getDefaultModelObjectAsString();
     
    232232                    cellItem.add(new SmartLinkMultiLineLabel(componentId, attribute.getValue()) {
    233233                        @Override
    234                         protected void onComponentTagBody(MarkupStream markupStream, ComponentTag openTag) {
     234                        public void onComponentTagBody(MarkupStream markupStream, ComponentTag openTag) {
    235235                            CharSequence body = StringUtils.toMultiLineHtml(getDefaultModelObjectAsString());
    236236                            replaceComponentTagBody(markupStream, openTag, getSmartLink(body));
     
    245245            }
    246246        };
     247        columns.add (column);
    247248
    248249        return columns;
     
    252253     * Add landing page links to the result page.
    253254     *
    254      * @param solrDocument the document to get the links from
     255     * @newParam solrDocument the document to get the links from
    255256     */
    256257    private void addLandingPageLinks(SolrDocument solrDocument) {
     
    322323     * Add search page links to the result page.
    323324     *
    324      * @param solrDocument the document to get the links from
     325     * @newParam solrDocument the document to get the links from
    325326     */
    326327    private void addSearchPageLinks(SolrDocument solrDocument) {
     
    393394     * page.
    394395     *
    395      * @param solrDocument the document to get the links from
     396     * @newParam solrDocument the document to get the links from
    396397     */
    397398    private void addResourceLinks(SolrDocument solrDocument) {
     
    423424   
    424425    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);
    426431        try {
    427432            thisURL = URLEncoder.encode(thisURL,"UTF-8");
     
    442447    }
    443448
    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));
    451455
    452456        BookmarkablePageLink<ShowResultPage> docLink = new BookmarkablePageLink<ShowResultPage>(linkId, ShowResultPage.class,
    453                 pageParameters);
     457                newParam);
    454458        return docLink;
    455459    }
     
    457461        /**
    458462         * Add contentSearch form (FCS)
    459          * @param solrDocument
     463         * @newParam solrDocument
    460464         */
    461465        private void addSearchServiceForm(final SolrDocument solrDocument) {
     
    483487        /**
    484488         * Add complete CMDI view
    485          * @param solrDocument
     489         * @newParam solrDocument
    486490         */
    487491        private void addCompleteCmdiView(final SolrDocument solrDocument) {
     
    515519               
    516520                // remove complete CMDI view on page load
    517                 add(new AbstractBehavior() {
     521                add(new Behavior() {
    518522                        private static final long serialVersionUID = 1865219352602175954L;
    519523
    520                         @Override
    521524                        public void renderHead(IHeaderResponse response) {
    522                                 super.renderHead(response);
     525
    523526                                response.renderOnLoadJavascript("toogleDiv('completeCmdi', 'toogleLink')");
    524527                        }
Note: See TracChangeset for help on using the changeset viewer.