Changeset 4991
- Timestamp:
- 04/16/14 13:20:32 (10 years ago)
- Location:
- vlo/branches/vlo-3.0/vlo-web-app/src/main
- Files:
-
- 4 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
r4880 r4991 38 38 </a> 39 39 </li> 40 <wicket:enclosure child="more"> 41 <li class="moreresources"> 42 <a wicket:id="more"><wicket:container wicket:id="moreLabel">99 more resources...</wicket:container></a> 43 </li> 44 </wicket:enclosure> 40 45 </ul> 41 46 </wicket:container> -
vlo/branches/vlo-3.0/vlo-web-app/src/main/java/eu/clarin/cmdi/vlo/wicket/panels/search/SearchResultItemExpandedPanel.java
r4982 r4991 32 32 import java.util.List; 33 33 import org.apache.solr.common.SolrDocument; 34 import org.apache.wicket.Component;35 34 import org.apache.wicket.ajax.AjaxRequestTarget; 36 35 import org.apache.wicket.behavior.AttributeAppender; … … 39 38 import org.apache.wicket.markup.html.link.ExternalLink; 40 39 import org.apache.wicket.markup.html.list.ListItem; 41 import org.apache.wicket.markup.html.list. ListView;40 import org.apache.wicket.markup.html.list.PageableListView; 42 41 import org.apache.wicket.markup.html.panel.GenericPanel; 42 import org.apache.wicket.model.AbstractReadOnlyModel; 43 43 import org.apache.wicket.model.IModel; 44 44 import org.apache.wicket.model.PropertyModel; … … 52 52 public class SearchResultItemExpandedPanel extends GenericPanel<SolrDocument> { 53 53 54 private static final int MAX_RESOURCES_TO_SHOW = 10; 55 54 56 @SpringBean(name = "searchResultPropertiesFilter") 55 57 private FieldFilter propertiesFilter; … … 59 61 ResourceStringConverter resolvingResourceStringConverter; 60 62 61 public SearchResultItemExpandedPanel(String id, IModel<SolrDocument> documentModel,IModel<SearchContext> selectionModel) {63 public SearchResultItemExpandedPanel(String id, final IModel<SolrDocument> documentModel, final IModel<SearchContext> selectionModel) { 62 64 super(id, documentModel); 63 65 … … 69 71 add(new FieldsTablePanel("documentProperties", new DocumentFieldsProvider(documentModel, propertiesFilter))); 70 72 73 // add a container for the resources (only visible if there are actual resources) 74 add(createResourcesView("resources", documentModel, selectionModel)); 75 } 76 77 private WebMarkupContainer createResourcesView(String id, final IModel<SolrDocument> documentModel, final IModel<SearchContext> selectionModel) { 71 78 final SolrFieldModel<String> resourceModel = new SolrFieldModel<String>(getModel(), FacetConstants.FIELD_RESOURCE); 72 73 // add a container for the resources (only visible if there are actual resources) 74 add(new WebMarkupContainer("resources") { 75 { 76 add(createResourcesList("resource", resourceModel)); 77 } 78 79 // create a container for the list view that is only visible if there actually are resources 80 final WebMarkupContainer container = new WebMarkupContainer(id) { 79 81 @Override 80 82 protected void onConfigure() { … … 83 85 } 84 86 85 }); 87 }; 88 89 final PageableListView resourcesView = createResourcesList("resource", resourceModel); 90 container.add(resourcesView); 91 92 // create a link to the record page that is only visible when there are more resources than shown 93 final RecordPageLink moreLink = new RecordPageLink("more", documentModel, selectionModel) { 94 95 @Override 96 protected void onConfigure() { 97 super.onConfigure(); 98 setVisible(resourcesView.getPageCount() > 1); 99 } 100 101 }; 102 // add a record page link that shows the number of resources not shown 103 moreLink.add(new Label("moreLabel", new StringResourceModel("resources.more", new AbstractReadOnlyModel<Integer>() { 104 105 @Override 106 public Integer getObject() { 107 return resourceModel.getObject().size() - MAX_RESOURCES_TO_SHOW; 108 } 109 110 }, "more..."))); 111 container.add(moreLink); 112 113 return container; 86 114 } 87 115 88 private ComponentcreateResourcesList(String id, SolrFieldModel<String> resourceModel) {116 private PageableListView createResourcesList(String id, SolrFieldModel<String> resourceModel) { 89 117 // list of resources in this record 90 // TODO: limit number of resources shown here?91 118 final IModel<List<String>> resourceListModel = new CollectionListModel<String>(resourceModel); 92 return new ListView<String>(id, resourceListModel) { 119 // use a a pageable view so that the number of resources actually shown is limited 120 return new PageableListView<String>(id, resourceListModel, MAX_RESOURCES_TO_SHOW) { 93 121 94 122 @Override -
vlo/branches/vlo-3.0/vlo-web-app/src/main/java/eu/clarin/cmdi/vlo/wicket/panels/search/SearchResultItemExpandedPanel.properties
r4881 r4991 14 14 # along with this program. If not, see <http://www.gnu.org/licenses/>. 15 15 16 # ${} = number of additional resources 17 resources.more=${} more resources... 16 18 # {0} = resource type, {1} = mime type 17 19 resource.tooltip={0} ({1}) -
vlo/branches/vlo-3.0/vlo-web-app/src/main/resources/eu/clarin/cmdi/vlo/wicket/pages/vlo-search.css
r4937 r4991 175 175 } 176 176 177 .searchresultresources li.moreresources { 178 /* 'N more resources' link (has no icon) */ 179 padding-left: .5em; 180 } 181 177 182 .searchresultresources li.writtenresource { 178 183 background-image: url('document-256.png'); /* icon from icons8.com */
Note: See TracChangeset
for help on using the changeset viewer.