Changeset 4632


Ignore:
Timestamp:
03/06/14 14:56:48 (10 years ago)
Author:
Twan Goosen
Message:

added field table for record by means of a data provider (of the new DocumentField? pojo interface, plus hybrid model/implementation) with filtering capabilities and a dataview that produces a table

Location:
vlo/branches/vlo-3.0/vlo-web-app/src/main
Files:
6 added
4 edited

Legend:

Unmodified
Added
Removed
  • vlo/branches/vlo-3.0/vlo-web-app/src/main/java/eu/clarin/cmdi/vlo/wicket/model/SolrFieldModel.java

    r4614 r4632  
    2323import org.apache.wicket.model.AbstractReadOnlyModel;
    2424import org.apache.wicket.model.IModel;
     25import org.apache.wicket.model.Model;
    2526
    2627/**
     
    3536
    3637    private final IModel<SolrDocument> documentModel;
    37     private final String fieldName;
     38    private final IModel<String> fieldNameModel;
    3839
    3940    /**
     
    4344     */
    4445    public SolrFieldModel(IModel<SolrDocument> documentModel, String fieldName) {
     46        this(documentModel, Model.of(fieldName));
     47    }
     48   
     49    /**
     50     *
     51     * @param documentModel model of document that holds the field values
     52     * @param fieldNameModel model that provides the field name
     53     */
     54    public SolrFieldModel(IModel<SolrDocument> documentModel, IModel<String> fieldNameModel) {
    4555        this.documentModel = documentModel;
    46         this.fieldName = fieldName;
     56        this.fieldNameModel = fieldNameModel;
    4757    }
    4858
    4959    @Override
    5060    public Collection<T> getObject() {
    51         final Collection<Object> fieldValues = documentModel.getObject().getFieldValues(fieldName);
     61        final Collection<Object> fieldValues = documentModel.getObject().getFieldValues(fieldNameModel.getObject());
    5262        if (fieldValues == null) {
    5363            return null;
  • vlo/branches/vlo-3.0/vlo-web-app/src/main/java/eu/clarin/cmdi/vlo/wicket/pages/RecordPage.html

    r4625 r4632  
    7979                <div id="recorddetails">
    8080                    <a wicket:id="landingPageLink" id="recordlandingpage">Show this record in its original context</a>
    81                     <table class="recorddetailstable">
    82                         <tbody class="attributesTbody">
    83                             <tr>
    84                                 <td class="attribute">
    85                                     <div>Name</div>
    86                                 </td><td class="attributeValue">
    87                                     <div>&quot;Chinese Democratie en de Transformatie&quot;</div>
    88                                 </td>
    89                             </tr><tr>
    90                                 <td class="attribute">
    91                                     <div>Description</div>
    92                                 </td><td class="attributeValue">
    93                                     <div>In China (and specifically in Beijing) of the late seventies, the call for a democracy movement was growing ever stronger, before finally being silenced by the new regime under Deng Xiaoping. This paper exmaines both the historical sources and the eventual outcome of this movement during the anxious years of &#039;78-&#039;79.</div>
    94                                 </td>
    95                             </tr><tr>
    96                                 <td class="attribute">
    97                                     <div>Collection</div>
    98                                 </td><td class="attributeValue">
    99                                     <div>UBU Clarin Set <a class="recordfacetselect" title="Search for similar" href="index2.html"><span>[search for similar]</span></a></div>
    100                                 </td>
    101                             </tr><tr>
    102                                 <td class="attribute">
    103                                     <div>Genre</div>
    104                                 </td><td class="attributeValue">
    105                                     <div>info:eu-repo/semantics/bachelorthesis <a class="recordfacetselect" title="Search for similar" href="index2.html"><span>[search for similar]</span></a></div>
    106                                 </td>
    107                             </tr><tr>
    108                                 <td class="attribute">
    109                                     <div>Languages</div>
    110                                 </td><td class="attributeValue">
    111                                     <div>Dutch <a class="recordattributeinfo" href="http://infra.clarin.eu/service/language/info.php?code=nld"><span>[info]</span></a> <a class="recordfacetselect" title="Search for similar" href="index3.html"><span>[search for similar]</span></a></div>
    112                                 </td>
    113                             </tr><tr>
    114                                 <td class="attribute">
    115                                     <div>National project</div>
    116                                 </td><td class="attributeValue">
    117                                     <div>CLARIN-NL <a class="recordfacetselect" title="Search for similar" href="index2.html"><span>[search for similar]</span></a></div>
    118                                 </td>
    119                             </tr><tr>
    120                                 <td class="attribute">
    121                                     <div>Resource type</div>
    122                                 </td><td class="attributeValue">
    123                                     <div>text <a class="recordfacetselect" title="Search for similar" href="index2.html"><span>[search for similar]</span></a></div>
    124                                 </td>
    125                             </tr>
    126                         </tbody>
    127                     </table>
     81                    <wicket:container wicket:id="documentProperties">[PROPERTIES TABLE]</wicket:container>
    12882                </div>
    12983
  • vlo/branches/vlo-3.0/vlo-web-app/src/main/java/eu/clarin/cmdi/vlo/wicket/pages/RecordPage.java

    r4625 r4632  
    1919import eu.clarin.cmdi.vlo.FacetConstants;
    2020import eu.clarin.cmdi.vlo.pojo.QueryFacetsSelection;
     21import eu.clarin.cmdi.vlo.service.FieldFilter;
     22import eu.clarin.cmdi.vlo.wicket.components.FieldsTablePanel;
    2123import eu.clarin.cmdi.vlo.wicket.components.SolrFieldLabel;
    2224import eu.clarin.cmdi.vlo.wicket.model.SolrFieldStringModel;
     25import eu.clarin.cmdi.vlo.wicket.provider.DocumentFieldsProvider;
     26import java.io.Serializable;
    2327import org.apache.solr.common.SolrDocument;
    2428import org.apache.wicket.markup.html.WebPage;
     
    3236public class RecordPage extends WebPage {
    3337
    34 //    private final IModel<SolrDocument> documentModel;
    3538    private final IModel<QueryFacetsSelection> contextModel;
    3639
    3740    public RecordPage(IModel<SolrDocument> documentModel, IModel<QueryFacetsSelection> contextModel) {
    3841        super(documentModel);
    39 //        this.documentModel = documentModel;
    4042        this.contextModel = contextModel;
    4143
    4244        add(new SolrFieldLabel("name", documentModel, FacetConstants.FIELD_NAME, "Unnamed record"));
    4345        add(createLandingPageLink("landingPageLink", documentModel));
     46        add(new FieldsTablePanel("documentProperties", new DocumentFieldsProvider(documentModel, new BasicPropertiesFieldFilter())));
    4447    }
    4548
     
    6669    }
    6770
     71    private class BasicPropertiesFieldFilter implements FieldFilter, Serializable {
     72
     73        @Override
     74        public boolean allowField(String fieldName) {
     75            return !fieldName.startsWith("_");
     76            //TODO: Exclude excluded fields and technical fields
     77        }
     78    }
     79
    6880}
  • vlo/branches/vlo-3.0/vlo-web-app/src/main/webapp/style/vlo-record.css

    r4466 r4632  
    9797    vertical-align: top;
    9898}
     99
     100ul.attributeValues {
     101    margin: 0px;
     102}
     103
     104ul.attributeValues li {
     105    display: block;
     106    list-style-type: none;
     107    margin: 0px;
     108}
     109
    99110
    100111a.recordfacetselect span, a.recordattributeinfo span {
Note: See TracChangeset for help on using the changeset viewer.