Changeset 4877


Ignore:
Timestamp:
04/02/14 11:45:24 (10 years ago)
Author:
Twan Goosen
Message:

moved inner ResourceInfoModel? out of ResourceLinksPanel?

Location:
vlo/branches/vlo-3.0/vlo-web-app/src/main/java/eu/clarin/cmdi/vlo/wicket
Files:
1 added
1 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

    r4872 r4877  
    1717package eu.clarin.cmdi.vlo.wicket.panels.record;
    1818
    19 import eu.clarin.cmdi.vlo.pojo.ResourceInfo;
     19import eu.clarin.cmdi.vlo.wicket.model.ResourceInfoModel;
    2020import eu.clarin.cmdi.vlo.service.ResourceStringConverter;
    2121import eu.clarin.cmdi.vlo.wicket.model.CollectionListModel;
     
    3232import org.apache.wicket.markup.html.panel.Panel;
    3333import org.apache.wicket.model.IModel;
    34 import org.apache.wicket.model.LoadableDetachableModel;
    3534import org.apache.wicket.model.PropertyModel;
    3635import org.apache.wicket.model.StringResourceModel;
     
    7978        @Override
    8079        protected void populateItem(ListItem<String> item) {
    81             final ResourceInfoModel resourceInfoModel = new ResourceInfoModel(item.getModel());
     80            final ResourceInfoModel resourceInfoModel = new ResourceInfoModel(resourceStringConverter, item.getModel());
    8281            // add a link that will show the resource details panel when clicked
    8382            item.add(createLink(resourceInfoModel));
     
    112111    }
    113112
    114     /**
    115      * Model for {@link ResourceInfo} that dynamically instantiates its objects
    116      * from a resource string (as retrieved from the Solr index) using the
    117      * {@link ResourceStringConverter}
    118      */
    119     private class ResourceInfoModel extends LoadableDetachableModel<ResourceInfo> {
    120 
    121         private final IModel<String> resourceStringModel;
    122 
    123         public ResourceInfoModel(IModel<String> resourceStringModel) {
    124             this.resourceStringModel = resourceStringModel;
    125         }
    126 
    127         @Override
    128         protected ResourceInfo load() {
    129             return resourceStringConverter.getResourceInfo(resourceStringModel.getObject());
    130         }
    131 
    132         @Override
    133         public void detach() {
    134             super.detach();
    135             resourceStringModel.detach();
    136         }
    137 
    138     }
    139 
    140113}
Note: See TracChangeset for help on using the changeset viewer.