Changeset 4669 for vlo/branches/vlo-3.0/vlo-web-app/src/main/java/eu/clarin/cmdi/vlo/wicket/pages/RecordPage.java
- Timestamp:
- 03/11/14 16:39:52 (10 years ago)
- 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 27 27 import eu.clarin.cmdi.vlo.wicket.model.SolrFieldModel; 28 28 import eu.clarin.cmdi.vlo.wicket.model.SolrFieldStringModel; 29 import eu.clarin.cmdi.vlo.wicket.model.UrlFromStringModel; 30 import eu.clarin.cmdi.vlo.wicket.model.XsltModel; 29 31 import eu.clarin.cmdi.vlo.wicket.provider.DocumentFieldsProvider; 30 32 import org.apache.solr.common.SolrDocument; 33 import org.apache.wicket.markup.html.basic.Label; 31 34 import org.apache.wicket.markup.html.link.ExternalLink; 32 35 import org.apache.wicket.model.IModel; … … 52 55 public RecordPage(PageParameters params) { 53 56 super(params); 54 57 55 58 final SolrDocumentModel documentModel = new SolrDocumentModel(params.get("docId").toString()); 56 59 setModel(documentModel); 57 60 58 61 final QueryFacetsSelection selection = selectionParametersConverter.fromParameters(params); 59 62 this.contextModel = Model.of(selection); 60 61 addComponents( documentModel);63 64 addComponents(); 62 65 } 63 66 … … 65 68 super(documentModel); 66 69 this.contextModel = contextModel; 67 addComponents( documentModel);70 addComponents(); 68 71 } 69 72 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))); 76 85 } 77 86 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); 80 89 // add landing page link 81 90 final ExternalLink landingPageLink = new ExternalLink(id, landingPageHrefModel) { … … 91 100 } 92 101 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 93 110 @Override 94 111 public void detachModels() {
Note: See TracChangeset
for help on using the changeset viewer.