Changeset 4879
- Timestamp:
- 04/02/14 13:05:57 (10 years ago)
- Location:
- vlo/branches/vlo-3.0/vlo-web-app/src/main
- Files:
-
- 1 added
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
vlo/branches/vlo-3.0/vlo-web-app/src/main/java/eu/clarin/cmdi/vlo/wicket/panels/search/SearchResultItemExpandedPanel.html
r4875 r4879 31 31 <p class="moredocumentproperties"><a wicket:id="recordLink">More</a></p> 32 32 <h3>Resources</h3> 33 <ul> 34 <li class="writtenresource"><a href="">http://dspace.library.uu.nl/bitstream/1874/235456/1/Bachelorscriptie+Rene+Witteveen+3375005.docx</a></li> 35 <li class="audioresource"><a 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</a></li> 36 <li class="annotationresource"><a 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</a></li> 33 <ul class="searchresultresources"> 34 <li wicket:id="resource"> 35 <a wicket:id="resourceLink" href=""> 36 <wicket:container wicket:id="resourceName"></wicket:container> 37 </a> 38 </li> 37 39 </ul> 38 40 </div> -
vlo/branches/vlo-3.0/vlo-web-app/src/main/java/eu/clarin/cmdi/vlo/wicket/panels/search/SearchResultItemExpandedPanel.java
r4875 r4879 20 20 import eu.clarin.cmdi.vlo.pojo.SearchContext; 21 21 import eu.clarin.cmdi.vlo.service.FieldFilter; 22 import eu.clarin.cmdi.vlo.service.ResourceStringConverter; 23 import eu.clarin.cmdi.vlo.wicket.ResourceTypeCssBehaviour; 22 24 import eu.clarin.cmdi.vlo.wicket.components.RecordPageLink; 23 25 import eu.clarin.cmdi.vlo.wicket.components.SolrFieldLabel; 26 import eu.clarin.cmdi.vlo.wicket.model.CollectionListModel; 27 import eu.clarin.cmdi.vlo.wicket.model.ResourceInfoModel; 28 import eu.clarin.cmdi.vlo.wicket.model.SolrFieldModel; 24 29 import eu.clarin.cmdi.vlo.wicket.panels.record.FieldsTablePanel; 25 30 import eu.clarin.cmdi.vlo.wicket.provider.DocumentFieldsProvider; 31 import java.util.List; 26 32 import org.apache.solr.common.SolrDocument; 33 import org.apache.wicket.behavior.AttributeAppender; 34 import org.apache.wicket.markup.html.basic.Label; 35 import org.apache.wicket.markup.html.link.ExternalLink; 36 import org.apache.wicket.markup.html.list.ListItem; 37 import org.apache.wicket.markup.html.list.ListView; 27 38 import org.apache.wicket.markup.html.panel.GenericPanel; 28 39 import org.apache.wicket.model.IModel; 40 import org.apache.wicket.model.PropertyModel; 41 import org.apache.wicket.model.StringResourceModel; 29 42 import org.apache.wicket.spring.injection.annot.SpringBean; 30 43 … … 37 50 @SpringBean(name = "basicPropertiesFilter") //TODO: make separate filter for properties in search result items 38 51 private FieldFilter basicPropertiesFilter; 39 private final IModel<SearchContext> selectionModel; 52 @SpringBean 53 ResourceStringConverter resourceStringConverter; 40 54 41 55 public SearchResultItemExpandedPanel(String id, IModel<SolrDocument> documentModel, IModel<SearchContext> selectionModel) { 42 56 super(id, documentModel); 43 this.selectionModel = selectionModel;44 57 45 58 // add untruncated description … … 47 60 add(new RecordPageLink("recordLink", documentModel, selectionModel)); 48 61 62 // table with some basic properties 49 63 add(new FieldsTablePanel("documentProperties", new DocumentFieldsProvider(documentModel, basicPropertiesFilter))); 50 51 //TODO: Add resource list 64 65 createResourcesList("resource"); 66 } 67 68 private void createResourcesList(String id) { 69 // list of resources in this record 70 // TODO: limit number of resources shown here? 71 final SolrFieldModel<String> resourceModel = new SolrFieldModel<String>(getModel(), FacetConstants.FIELD_RESOURCE); 72 final IModel<List<String>> resourceListModel = new CollectionListModel<String>(resourceModel); 73 add(new ListView<String>(id, resourceListModel) { 74 75 @Override 76 protected void populateItem(ListItem<String> item) { 77 // get resource string converted into a ResourceInfo model 78 final ResourceInfoModel resourceInfoModel = new ResourceInfoModel(resourceStringConverter, item.getModel()); 79 80 // add a link to the resource with the file name as its label 81 final ExternalLink resourceLink = new ExternalLink("resourceLink", new PropertyModel(resourceInfoModel, "href")); 82 resourceLink.add(new Label("resourceName", new PropertyModel(resourceInfoModel, "fileName"))); 83 84 // add a tooltip showing resource type and mime type 85 final StringResourceModel tooltipModel 86 = new StringResourceModel("resource.tooltip", SearchResultItemExpandedPanel.this, resourceModel, 87 new Object[]{ 88 new PropertyModel(resourceInfoModel, "resourceType"), 89 new PropertyModel(resourceInfoModel, "mimeType")}); 90 resourceLink.add(new AttributeAppender("title", tooltipModel)); 91 92 // sets the css class depending on the resource type 93 item.add(new ResourceTypeCssBehaviour(resourceInfoModel)); 94 95 // add to list 96 item.add(resourceLink); 97 } 98 }); 52 99 } 53 100 … … 55 102 public void detachModels() { 56 103 super.detachModels(); 57 // not passed to super58 selectionModel.detach();59 104 } 60 105 -
vlo/branches/vlo-3.0/vlo-web-app/src/main/webapp/style/vlo-search.css
r4618 r4879 154 154 font-weight: bold; 155 155 } 156 157 .searchresultresources li { 158 list-style: none; 159 background-repeat: no-repeat; 160 background-size: 1em; 161 padding-left: 1.5em; 162 } 163 164 .searchresultresources li.writtenresource { 165 background-image: url('document-256.png'); /* icon from icons8.com */ 166 } 167 168 .searchresultresources li.audioresource { 169 background-image: url('audio-file-3-256.png'); /* icon from icons8.com */ 170 } 171 172 .searchresultresources li.videoresource { 173 background-image: url('video-file-3-256.png'); /* icon from icons8.com */ 174 } 175 176 .searchresultresources li.imageresource { 177 background-image: url('image-file-256.png'); /* icon from icons8.com */ 178 } 179 180 .searchresultresources li.annotationresource { 181 background-image: url('document-256.png'); /* icon from icons8.com */ 182 }
Note: See TracChangeset
for help on using the changeset viewer.