16 Aug 2012 17:06
[35763] hippo-cms7/cms: CMS7-6285: When thumbnail size is altered the height/ width of the surrounding html should be changed.
abogaart <svn-logs <at> onehippo.org>
2012-08-16 15:06:20 GMT
2012-08-16 15:06:20 GMT
Revision: 35763
Author: abogaart
Date: 2012-08-16 17:06:18 +0200 (Thu, 16 Aug 2012)
Log Message:
-----------
CMS7-6285: When thumbnail size is altered the height/width of the surrounding html should be changed.
- If thumbnailSize differs from default (60px) a style attribute containing width&height info will be
added to the li, a and span elements.
Modified Paths:
--------------
hippo-cms7/cms/trunk/gallery/frontend/src/main/java/org/hippoecm/frontend/plugins/gallery/ImageGalleryPlugin.java
Modified: hippo-cms7/cms/trunk/gallery/frontend/src/main/java/org/hippoecm/frontend/plugins/gallery/ImageGalleryPlugin.java
===================================================================
---
hippo-cms7/cms/trunk/gallery/frontend/src/main/java/org/hippoecm/frontend/plugins/gallery/ImageGalleryPlugin.java 2012-08-16
13:42:54 UTC (rev 35762)
+++
hippo-cms7/cms/trunk/gallery/frontend/src/main/java/org/hippoecm/frontend/plugins/gallery/ImageGalleryPlugin.java 2012-08-16
15:06:18 UTC (rev 35763)
<at> <at> -1,12 +1,12 <at> <at>
/*
* Copyright 2008 Hippo.
- *
+ *
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
<at> <at> -23,6 +23,7 <at> <at>
import javax.jcr.Node;
import javax.jcr.RepositoryException;
+import org.apache.wicket.AttributeModifier;
import org.apache.wicket.Component;
import org.apache.wicket.ResourceReference;
import org.apache.wicket.ajax.AjaxRequestTarget;
<at> <at> -76,6 +77,8 <at> <at>
private static final String TOGGLE_THUMBNAIL_IMG = "toggle_thumb.png";
private static final String IMAGE_FOLDER_TYPE = "hippogallery:stdImageGallery";
+ private static final int DEFAULT_THUMBNAIL_SIZE = 60;
+ private static final int DEFAULT_THUMBNAIL_OFFSET = 40;
enum Mode {
LIST, THUMBNAILS
<at> <at> -255,9 +258,22 <at> <at>
itemLink.add(new ImageContainer("thumbnail", new JcrNodeModel((Node) primItem),
getPluginContext(), getPluginConfig()));
- itemLink.add(new LabelWithTitle("title", new NodeTranslator(new JcrNodeModel(node))
- .getNodeName()));
+ Label title = new LabelWithTitle("title", new NodeTranslator(new JcrNodeModel(node))
+ .getNodeName());
+ itemLink.add(title);
listItem.add(itemLink);
+
+ //check thumbnail size
+ int thumbnailSize = getPluginConfig().getAsInteger("gallery.thumbnail.size",
+ DEFAULT_THUMBNAIL_SIZE);
+ if (thumbnailSize != DEFAULT_THUMBNAIL_SIZE) {
+ int itemSize= thumbnailSize + DEFAULT_THUMBNAIL_OFFSET;
+ String w = "width: " + itemSize + "px;";
+ String h = "height: " + itemSize + "px;";
+ itemLink.add(new AttributeModifier("style", true, new Model<String>(w + h)));
+ listItem.add(new AttributeModifier("style", true, new Model<String>(w + h)));
+ title.add(new AttributeModifier("style", true, new Model<String>(w)));
+ }
} else {
log.warn("primary item of image set must be of type " + HippoNodeType.NT_RESOURCE);
}
RSS Feed