Ignore:
Timestamp:
03/11/14 16:39:52 (10 years ago)
Author:
Twan Goosen
Message:

Added CMDI view (obtained through XSLT transform) to record page

File:
1 edited

Legend:

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

    r4661 r4669  
    2727import eu.clarin.cmdi.vlo.wicket.model.SolrFieldModel;
    2828import eu.clarin.cmdi.vlo.wicket.model.SolrFieldStringModel;
     29import eu.clarin.cmdi.vlo.wicket.model.UrlFromStringModel;
     30import eu.clarin.cmdi.vlo.wicket.model.XsltModel;
    2931import eu.clarin.cmdi.vlo.wicket.provider.DocumentFieldsProvider;
    3032import org.apache.solr.common.SolrDocument;
     33import org.apache.wicket.markup.html.basic.Label;
    3134import org.apache.wicket.markup.html.link.ExternalLink;
    3235import org.apache.wicket.model.IModel;
     
    5255    public RecordPage(PageParameters params) {
    5356        super(params);
    54        
     57
    5558        final SolrDocumentModel documentModel = new SolrDocumentModel(params.get("docId").toString());
    5659        setModel(documentModel);
    57        
     60
    5861        final QueryFacetsSelection selection = selectionParametersConverter.fromParameters(params);
    5962        this.contextModel = Model.of(selection);
    60        
    61         addComponents(documentModel);
     63
     64        addComponents();
    6265    }
    6366
     
    6568        super(documentModel);
    6669        this.contextModel = contextModel;
    67         addComponents(documentModel);
     70        addComponents();
    6871    }
    6972
    70     private void addComponents(IModel<SolrDocument> documentModel) {
    71         add(new SolrFieldLabel("name", documentModel, FacetConstants.FIELD_NAME, "Unnamed record"));
    72         add(createLandingPageLink("landingPageLink", documentModel));
    73         add(new FieldsTablePanel("documentProperties", new DocumentFieldsProvider(documentModel, basicPropertiesFilter)));
    74         add(new ResourceLinksPanel("resources", new SolrFieldModel<String>(documentModel, FacetConstants.FIELD_RESOURCE)));
    75         add(new FieldsTablePanel("technicalProperties", new DocumentFieldsProvider(documentModel, technicalPropertiesFilter)));
     73    private void addComponents() {
     74        // General information section
     75        add(new SolrFieldLabel("name", getModel(), FacetConstants.FIELD_NAME, "Unnamed record"));
     76        add(createLandingPageLink("landingPageLink"));
     77        add(new FieldsTablePanel("documentProperties", new DocumentFieldsProvider(getModel(), basicPropertiesFilter)));
     78       
     79        // Resources section
     80        add(new ResourceLinksPanel("resources", new SolrFieldModel<String>(getModel(), FacetConstants.FIELD_RESOURCE)));
     81       
     82        // Technical section
     83        add(createCmdiContent("cmdi"));
     84        add(new FieldsTablePanel("technicalProperties", new DocumentFieldsProvider(getModel(), technicalPropertiesFilter)));
    7685    }
    7786
    78     private ExternalLink createLandingPageLink(String id, IModel<SolrDocument> documentModel) {
    79         final SolrFieldStringModel landingPageHrefModel = new SolrFieldStringModel(documentModel, FacetConstants.FIELD_LANDINGPAGE);
     87    private ExternalLink createLandingPageLink(String id) {
     88        final SolrFieldStringModel landingPageHrefModel = new SolrFieldStringModel(getModel(), FacetConstants.FIELD_LANDINGPAGE);
    8089        // add landing page link
    8190        final ExternalLink landingPageLink = new ExternalLink(id, landingPageHrefModel) {
     
    91100    }
    92101
     102    private Label createCmdiContent(String id) {
     103        final IModel<String> locationModel = new SolrFieldStringModel(getModel(), FacetConstants.FIELD_FILENAME);
     104        final UrlFromStringModel locationUrlModel = new UrlFromStringModel(locationModel);
     105        final Label cmdiContentLabel = new Label(id, new XsltModel(locationUrlModel));
     106        cmdiContentLabel.setEscapeModelStrings(false);
     107        return cmdiContentLabel;
     108    }
     109
    93110    @Override
    94111    public void detachModels() {
Note: See TracChangeset for help on using the changeset viewer.