Changeset 4881
- Timestamp:
- 04/02/14 14:36:46 (11 years ago)
- Location:
- vlo/branches/vlo-3.0/vlo-web-app/src/main
- Files:
-
- 5 edited
- 1 moved
Legend:
- Unmodified
- Added
- Removed
-
vlo/branches/vlo-3.0/vlo-web-app/src/main/java/eu/clarin/cmdi/vlo/VloWicketApplication.java
r4878 r4881 58 58 // register the resource of field names (used by eu.clarin.cmdi.vlo.wicket.componentsSolrFieldNameLabel) 59 59 getResourceSettings().getStringResourceLoaders().add(new BundleStringResourceLoader("fieldNames")); 60 // register the resource of resource type class properties61 getResourceSettings().getStringResourceLoaders().add(new BundleStringResourceLoader("resourceType Classes"));60 // register the resource of resource type names and class properties 61 getResourceSettings().getStringResourceLoaders().add(new BundleStringResourceLoader("resourceTypes")); 62 62 // register the resource of application properties (version information filtered at build time) 63 63 getResourceSettings().getStringResourceLoaders().add(new BundleStringResourceLoader("application")); -
vlo/branches/vlo-3.0/vlo-web-app/src/main/java/eu/clarin/cmdi/vlo/wicket/ResourceTypeCssBehaviour.java
r4878 r4881 35 35 // to one of the properties in resourceTypeClass.properties file 36 36 // (defaults to "") 37 new StringResourceModel(" class.${resourceType}", resourceInfoModel, "", new Object[0]));37 new StringResourceModel("resourcetype.${resourceType}.class", resourceInfoModel, "", new Object[0])); 38 38 // separate CSS classes with a space 39 39 setSeparator(" "); -
vlo/branches/vlo-3.0/vlo-web-app/src/main/java/eu/clarin/cmdi/vlo/wicket/panels/search/SearchResultItemCollapsedPanel.java
r4880 r4881 17 17 package eu.clarin.cmdi.vlo.wicket.panels.search; 18 18 19 import eu.clarin.cmdi.vlo.wicket.provider.ResouceTypeCountDataProvider;20 19 import eu.clarin.cmdi.vlo.FacetConstants; 21 20 import eu.clarin.cmdi.vlo.pojo.ResourceTypeCount; … … 25 24 import eu.clarin.cmdi.vlo.wicket.components.SolrFieldLabel; 26 25 import eu.clarin.cmdi.vlo.wicket.model.SolrFieldModel; 26 import eu.clarin.cmdi.vlo.wicket.provider.ResouceTypeCountDataProvider; 27 27 import java.util.Locale; 28 28 import org.apache.solr.common.SolrDocument; … … 35 35 import org.apache.wicket.markup.repeater.data.IDataProvider; 36 36 import org.apache.wicket.model.IModel; 37 import org.apache.wicket.model.Model; 38 import org.apache.wicket.model.StringResourceModel; 37 39 import org.apache.wicket.spring.injection.annot.SpringBean; 38 40 import org.apache.wicket.util.convert.ConversionException; … … 45 47 public class SearchResultItemCollapsedPanel extends Panel { 46 48 47 private final staticResourceTypeCountConverter resourceTypeCountConverter = new ResourceTypeCountConverter();49 private final ResourceTypeCountConverter resourceTypeCountConverter = new ResourceTypeCountConverter(); 48 50 private static final int MAX_DESCRIPTION_LENGTH = 350; 49 51 private static final int LONG_DESCRIPTION_TRUNCATE_POINT = 320; … … 133 135 @Override 134 136 public String convertToString(ResourceTypeCount value, Locale locale) { 135 final String resourceTypeString; 136 if (value.getCount() == 1) { 137 resourceTypeString = getSingularResourceTypeString(value); 138 } else { 139 resourceTypeString = getPluralResourceTypeString(value); 140 } 137 final String resourceTypeString = getResourceTypeString(value); 141 138 return String.format("%d %s", value.getCount(), resourceTypeString); 142 139 } 143 140 144 private String getSingularResourceTypeString(ResourceTypeCount value) { 145 //TODO: read from resource bundle 146 switch (value.getResourceType()) { 147 case ANNOTATION: 148 return "annotation file"; 149 case AUDIO: 150 return "audio file"; 151 case VIDEO: 152 return "video file"; 153 case IMAGE: 154 return "image"; 155 case TEXT: 156 return "text document"; 157 case OTHER: 158 return "other"; 159 default: 160 return "unknown"; 161 } 162 } 163 164 private String getPluralResourceTypeString(ResourceTypeCount value) { 165 //TODO: read from resource bundle 166 switch (value.getResourceType()) { 167 case ANNOTATION: 168 return "annotation files"; 169 case AUDIO: 170 return "audio files"; 171 case VIDEO: 172 return "video files"; 173 case IMAGE: 174 return "images"; 175 case TEXT: 176 return "text documents"; 177 case OTHER: 178 return "other"; 179 default: 180 return "unknown"; 181 } 141 private String getResourceTypeString(ResourceTypeCount value) { 142 final String count = value.getCount() == 1 ? "singular" : "plural"; 143 final StringResourceModel resourceModel = new StringResourceModel("resourcetype.${resourceType}." + count, Model.of(value), "?"); 144 return resourceModel.getObject(); 182 145 } 183 146 -
vlo/branches/vlo-3.0/vlo-web-app/src/main/java/eu/clarin/cmdi/vlo/wicket/panels/search/SearchResultItemExpandedPanel.java
r4880 r4881 102 102 = new StringResourceModel("resource.tooltip", SearchResultItemExpandedPanel.this, null, 103 103 new Object[]{ 104 new PropertyModel(resourceInfoModel, "resourceType"),104 new StringResourceModel("resourcetype.${resourceType}.singular", resourceInfoModel, "?"), 105 105 new PropertyModel(resourceInfoModel, "mimeType")}); 106 106 resourceLink.add(new AttributeAppender("title", tooltipModel)); -
vlo/branches/vlo-3.0/vlo-web-app/src/main/java/eu/clarin/cmdi/vlo/wicket/panels/search/SearchResultItemExpandedPanel.properties
r4879 r4881 14 14 # along with this program. If not, see <http://www.gnu.org/licenses/>. 15 15 16 resource.tooltip={0}. Mime type: {1} 16 # {0} = resource type, {1} = mime type 17 resource.tooltip={0} ({1}) -
vlo/branches/vlo-3.0/vlo-web-app/src/main/resources/resourceTypes.properties
r4878 r4881 14 14 # along with this program. If not, see <http://www.gnu.org/licenses/>. 15 15 16 # This maps values of ResourceType to CSS classes16 # This maps values of ResourceType to plural and singular names and CSS classes 17 17 18 class.TEXT=writtenresource 19 class.AUDIO=audioresource 20 class.VIDEO=videoresource 21 class.IMAGE=imageresource 22 class.ANNOTATION=annotationresource 18 resourcetype.ANNOTATION.class=annotationresource 19 resourcetype.ANNOTATION.singular=annotation file 20 resourcetype.ANNOTATION.plural=annotation files 21 22 resourcetype.AUDIO.class=audioresource 23 resourcetype.AUDIO.singular=audio file 24 resourcetype.AUDIO.plural=audio files 25 26 resourcetype.IMAGE.class=imageresource 27 resourcetype.IMAGE.singular=image 28 resourcetype.IMAGE.plural=images 29 23 30 #make separate class for 'other' 24 class.OTHER=writtenresource 31 resourcetype.OTHER.class=writtenresource 32 resourcetype.OTHER.singular=other 33 resourcetype.OTHER.plural=other 34 35 resourcetype.TEXT.class=writtenresource 36 resourcetype.TEXT.singular=text document 37 resourcetype.TEXT.plural=text documents 38 39 resourcetype.VIDEO.class=videoresource 40 resourcetype.VIDEO.singular=video file 41 resourcetype.VIDEO.plural=video files
Note: See TracChangeset
for help on using the changeset viewer.