Changeset 4982
- Timestamp:
- 04/15/14 14:01:30 (10 years ago)
- Location:
- vlo/branches/vlo-3.0/vlo-web-app/src
- 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/record/ResourceLinksPanel.java
r4978 r4982 22 22 import eu.clarin.cmdi.vlo.wicket.model.HandleLinkModel; 23 23 import eu.clarin.cmdi.vlo.wicket.model.ResourceInfoModel; 24 import eu.clarin.cmdi.vlo.wicket.panels.search.LazyResourceInfoUpdateBehavior; 24 25 import java.util.Collection; 25 26 import java.util.List; 26 import org.apache.wicket. Component;27 import org.apache.wicket.ajax.AjaxRequestTarget; 27 28 import org.apache.wicket.markup.html.basic.Label; 28 29 import org.apache.wicket.markup.html.link.ExternalLink; … … 44 45 @SpringBean(name = "resourceStringConverter") 45 46 private ResourceStringConverter resourceStringConverter; 47 @SpringBean(name = "resolvingResourceStringConverter") 48 private ResourceStringConverter resolvingResourceStringConverter; 46 49 47 50 /** … … 66 69 protected void populateItem(ListItem<String> item) { 67 70 final ResourceInfoModel resourceInfoModel = new ResourceInfoModel(resourceStringConverter, item.getModel()); 71 68 72 // add a link that will show the resource details panel when clicked 69 item.add(createLink(resourceInfoModel)); 70 } 71 72 private Component createLink(final ResourceInfoModel resourceInfoModel) { 73 73 74 // wrap href in model that transforms handle links 74 75 final IModel<String> linkModel = new HandleLinkModel(new PropertyModel(resourceInfoModel, "href")); … … 83 84 link.add(new ResourceTypeCssBehaviour(resourceInfoModel)); 84 85 85 return link; 86 // make the link update via AJAX with resolved location (in case of handle) 87 link.add(new LazyResourceInfoUpdateBehavior(resolvingResourceStringConverter, item.getModel(), resourceInfoModel) { 88 89 @Override 90 protected void onUpdate(AjaxRequestTarget target) { 91 target.add(link); 92 } 93 }); 94 95 link.setOutputMarkupId(true); 96 item.add(link); 86 97 } 87 98 } -
vlo/branches/vlo-3.0/vlo-web-app/src/main/java/eu/clarin/cmdi/vlo/wicket/panels/search/SearchResultItemExpandedPanel.java
r4981 r4982 18 18 19 19 import eu.clarin.cmdi.vlo.FacetConstants; 20 import eu.clarin.cmdi.vlo.pojo.ResourceInfo;21 20 import eu.clarin.cmdi.vlo.pojo.SearchContext; 22 21 import eu.clarin.cmdi.vlo.service.FieldFilter; … … 34 33 import org.apache.solr.common.SolrDocument; 35 34 import org.apache.wicket.Component; 36 import org.apache.wicket.ajax.AbstractAjaxTimerBehavior;37 35 import org.apache.wicket.ajax.AjaxRequestTarget; 38 36 import org.apache.wicket.behavior.AttributeAppender; … … 47 45 import org.apache.wicket.model.StringResourceModel; 48 46 import org.apache.wicket.spring.injection.annot.SpringBean; 49 import org.apache.wicket.util.time.Duration;50 47 51 48 /** … … 107 104 // once loaded, make Ajax request to resolve handles and update 108 105 // resource link 109 resourceLink.add(new AbstractAjaxTimerBehavior(Duration.ONE_SECOND) {106 resourceLink.add(new LazyResourceInfoUpdateBehavior(resolvingResourceStringConverter, item.getModel(), resourceInfoModel) { 110 107 111 108 @Override 112 protected void onTimer(AjaxRequestTarget target) { 113 this.stop(target); 114 // this time get resource info from the resolving converter 115 // which will take the file name from the resolved location 116 final ResourceInfo newResourceInfo = resolvingResourceStringConverter.getResourceInfo(item.getModelObject()); 117 resourceInfoModel.setObject(newResourceInfo); 109 protected void onUpdate(AjaxRequestTarget target) { 118 110 // update resource link 119 111 target.add(resourceLink); 120 112 } 121 122 113 }); 123 114 -
vlo/branches/vlo-3.0/vlo-web-app/src/test/java/eu/clarin/cmdi/vlo/service/impl/HandleClientRunner.java
r4980 r4982 33 33 */ 34 34 public static void main(String[] args) { 35 final HandleClient client = new HandleClientImpl( "http://hdl.handle.net/api/handle/");35 final HandleClient client = new HandleClientImpl(); 36 36 37 37 System.out.println("Requesting handle...");
Note: See TracChangeset
for help on using the changeset viewer.