Changeset 4622


Ignore:
Timestamp:
03/05/14 16:25:29 (10 years ago)
Author:
Twan Goosen
Message:

created stub for record page and links to it from search result items

Location:
vlo/branches/vlo-3.0/vlo-web-app/src/main/java/eu/clarin/cmdi/vlo/wicket
Files:
2 added
3 edited
1 copied

Legend:

Unmodified
Added
Removed
  • vlo/branches/vlo-3.0/vlo-web-app/src/main/java/eu/clarin/cmdi/vlo/wicket/components/SearchResultItemPanel.html

    r4618 r4622  
    2525        <wicket:panel>
    2626            <h2>
    27                 <a wicket:id="title" href="record1.html">[TITLE]</a>
     27                <a wicket:id="recordLink" href="record1.html"><wicket:container wicket:id="title" >[TITLE]</wicket:container></a>
    2828            </h2>
    2929            <div class="searchresultitembrief">
  • vlo/branches/vlo-3.0/vlo-web-app/src/main/java/eu/clarin/cmdi/vlo/wicket/components/SearchResultItemPanel.java

    r4619 r4622  
    1919import eu.clarin.cmdi.vlo.wicket.provider.ResouceTypeCountDataProvider;
    2020import eu.clarin.cmdi.vlo.FacetConstants;
     21import eu.clarin.cmdi.vlo.pojo.QueryFacetsSelection;
    2122import eu.clarin.cmdi.vlo.pojo.ResourceTypeCount;
    2223import eu.clarin.cmdi.vlo.service.ResourceTypeCountingService;
     
    4344public class SearchResultItemPanel extends Panel {
    4445
     46    private final static ResourceTypeCountConverter resourceTypeCountConverter = new ResourceTypeCountConverter();
     47
    4548    @SpringBean
    4649    private ResourceTypeCountingService countingService;
     50    private final IModel<QueryFacetsSelection> selectionModel;
     51    private final IModel<SolrDocument> documentModel;
    4752
    48     public SearchResultItemPanel(String id, IModel<SolrDocument> model) {
    49         super(id, model);
    50         add(new SolrFieldLabel("title", model, FacetConstants.FIELD_NAME));
    51         add(new SolrFieldLabel("description", model, FacetConstants.FIELD_DESCRIPTION, "<no description>"));
     53    public SearchResultItemPanel(String id, IModel<SolrDocument> documentModel, IModel<QueryFacetsSelection> selectionModel) {
     54        super(id, documentModel);
     55        this.documentModel = documentModel;
     56        this.selectionModel = selectionModel;
     57
     58        final Link recordLink = new RecordPageLink("recordLink", documentModel, selectionModel);
     59        recordLink.add(new SolrFieldLabel("title", documentModel, FacetConstants.FIELD_NAME));
     60        add(recordLink);
     61
     62        add(new SolrFieldLabel("description", documentModel, FacetConstants.FIELD_DESCRIPTION, "<no description>"));
    5263
    5364        // get model for resources
    54         final SolrFieldModel<String> resourcesModel = new SolrFieldModel<String>(model, FacetConstants.FIELD_RESOURCE);
     65        final SolrFieldModel<String> resourcesModel = new SolrFieldModel<String>(documentModel, FacetConstants.FIELD_RESOURCE);
    5566        // wrap with a count provider
    5667        final ResouceTypeCountDataProvider countProvider = new ResouceTypeCountDataProvider(resourcesModel, countingService);
     
    5869        // TODO: hide if no resources
    5970        add(new ResourceCountDataView("resourceCount", countProvider));
     71    }
     72
     73    @Override
     74    public void detachModels() {
     75        super.detachModels();
     76        // not passed to super
     77        selectionModel.detach();
    6078    }
    6179
     
    82100     * {@link ResourceTypeCount}
    83101     */
    84     private static class ResourceCountDataView extends DataView<ResourceTypeCount> {
    85 
    86         private final static ResourceTypeCountConverter resourceTypeCountConverter
    87                 = new ResourceTypeCountConverter();
     102    private class ResourceCountDataView extends DataView<ResourceTypeCount> {
    88103
    89104        public ResourceCountDataView(String id, IDataProvider<ResourceTypeCount> dataProvider) {
     
    93108        @Override
    94109        protected void populateItem(Item<ResourceTypeCount> item) {
    95             final Link resourceLink = new Link("recordLink") {
    96 
    97                 @Override
    98                 public void onClick() {
    99                     throw new UnsupportedOperationException("Not supported yet.");
    100                 }
    101             };
     110            final Link resourceLink = new RecordPageLink("recordLink", documentModel, selectionModel);
    102111            final Label label = new Label("resourceCountLabel", item.getModel()) {
    103112
  • vlo/branches/vlo-3.0/vlo-web-app/src/main/java/eu/clarin/cmdi/vlo/wicket/components/SearchResultsPanel.java

    r4579 r4622  
    5353    private final DataView<SolrDocument> resultsView;
    5454
    55     public SearchResultsPanel(String id, IModel<QueryFacetsSelection> model) {
    56         super(id, model);
    57         solrDocumentProvider = new SolrDocumentProvider(documentService, model);
     55    public SearchResultsPanel(String id, final IModel<QueryFacetsSelection> selectionModel) {
     56        super(id, selectionModel);
     57        solrDocumentProvider = new SolrDocumentProvider(documentService, selectionModel);
    5858
    5959        // data view for search results
     
    6363            protected void populateItem(Item<SolrDocument> item) {
    6464                // single result item
    65                 item.add(new SearchResultItemPanel("resultItemDetails", item.getModel()));
     65                item.add(new SearchResultItemPanel("resultItemDetails", item.getModel(), selectionModel));
    6666            }
    6767        };
  • vlo/branches/vlo-3.0/vlo-web-app/src/main/java/eu/clarin/cmdi/vlo/wicket/pages/RecordPage.html

    r4617 r4622  
    5252            <div id="topnavigation">
    5353                <div id="breadcrumbs">
    54                     <a href="index.html">VLO</a>
    55                     &gt; <a href="index2.html">Search results: democratie</a>
    56                     &gt; <a href="index3.html">Language: Dutch </a>
    57                     &gt; &quot;Chinese Democratie en de Transformatie&quot;
     54                    <wicket:link>
     55                        <a href="FacetedSearchPage.html">VLO</a>
     56                    </wicket:link>
     57                    &gt; <a href="FacetedSearchPage.html">Search results: TODO</a>
     58
     59                    <!--                    &gt; <a href="index3.html">Language: Dutch </a>
     60                                        &gt; &quot;Chinese Democratie en de Transformatie&quot;-->
     61
    5862                </div>
    5963                <div id="topnavigationlinks">
     
    128132                    <a class="audioresource" href="http://corpus1.mpi.nl/qfs1/media-archive/dobes_data/Ache/Documentaci_n_-_Documentation/Comunidades_-_Communities/Cerro_Moroti/Media/002-djawu_klluu-2011-09-01.wav">002-djawu_klluu-2011-09-01.wav</a>
    129133                    <a class="annotationresource" href="http://corpus1.mpi.nl/qfs1/media-archive/dobes_data/Ache/Documentaci_n_-_Documentation/Comunidades_-_Communities/Cerro_Moroti/Annotations/002-djawu_klluu-2011-09-01.eaf">002-djawu_klluu-2011-09-01.eaf</a>
    130                    
     134
    131135                    <div class="recordresourcedetails">
    132136                        <h2>Bachelorscriptie+Rene+Witteveen+3375005.docx</h2>
     
    137141                        </ul>
    138142                    </div>
    139                    
     143
    140144                </div>
    141145
Note: See TracChangeset for help on using the changeset viewer.