Author: andrei_exadel
Date: 2009-03-25 06:38:35 -0400 (Wed, 25 Mar 2009)
New Revision: 13169
Modified:
trunk/test-applications/realworld2/web/src/main/java/org/richfaces/realworld/ui/ImageSizeHelper.java
trunk/test-applications/realworld2/web/src/main/webapp/includes/image/imageInfo.xhtml
trunk/test-applications/realworld2/web/src/main/webapp/includes/image/imageList.xhtml
trunk/test-applications/realworld2/web/src/main/webapp/includes/misc/inputNumberSlider.xhtml
trunk/test-applications/realworld2/web/src/main/webapp/includes/search/result/imageResult.xhtml
Log:
RF-6483
Modified:
trunk/test-applications/realworld2/web/src/main/java/org/richfaces/realworld/ui/ImageSizeHelper.java
===================================================================
---
trunk/test-applications/realworld2/web/src/main/java/org/richfaces/realworld/ui/ImageSizeHelper.java 2009-03-25
01:42:58 UTC (rev 13168)
+++
trunk/test-applications/realworld2/web/src/main/java/org/richfaces/realworld/ui/ImageSizeHelper.java 2009-03-25
10:38:35 UTC (rev 13169)
@@ -9,58 +9,69 @@
/**
* @author Andrey Markavtsov
- *
+ *
*/
@Name("imageSizeHelper")
@Scope(ScopeType.CONVERSATION)
public class ImageSizeHelper {
-
- int value = 1;
- final static String CSS_CLASS = "preview_box_album_";
-
- final static String FILE_POSTFIX = "_small";
-
+ static final int DEFAULT_VALUE = 120;
+
+ int value = DEFAULT_VALUE;
+
public static enum ImageDimension {
+
+ SIZE_80(80), SIZE_120(120), SIZE_160(160), SIZE_200(200);
+
+ final static String CSS_CLASS = "preview_box_photo_";
+ final static String FILE_POSTFIX = "_small";
+ final static String IMAGE_BG = "/img/shell/frame_photo_%1$d.png";
- SIZE1 (80, 60),
- SIZE2 (120, 80),
- SIZE3 (160, 100),
- SIZE4 (160, 100);
-
int x;
- int y;
-
- private ImageDimension(int x, int y) {
+ String cssClass;
+ String imageBgSrc;
+ String filePostfix;
+
+ private ImageDimension(int x) {
this.x = x;
- this.y = y;
+ cssClass = CSS_CLASS + x;
+ imageBgSrc = String.format(IMAGE_BG, x);
+ filePostfix = FILE_POSTFIX + x;
}
+
public int getX() {
return x;
}
- public int getY() {
- return y;
- }
-
public String getCssClass() {
- return CSS_CLASS + x;
+ return cssClass;
}
-
+
+ public String getImageBg() {
+ return imageBgSrc;
+ }
+
public String getFilePostfix() {
- return FILE_POSTFIX + x;
+ return filePostfix;
}
+
+ public static ImageDimension getInstance(int x) {
+ ImageDimension [] all = values();
+ for (int i=0; i<all.length; i++) {
+ if (all[i].x == x) {
+ return all[i];
+ }
+ }
+
+ return values()[DEFAULT_VALUE];
+ }
};
- static ImageDimension [] dimensions = new ImageDimension []
- {
- ImageDimension.SIZE1, ImageDimension.SIZE2,
- ImageDimension.SIZE3, ImageDimension.SIZE4
- };
+ ImageDimension currentDimension = ImageDimension.getInstance(DEFAULT_VALUE);
public ImageDimension getCurrentDimension() {
- return dimensions[value];
+ return currentDimension;
}
public int getValue() {
@@ -68,8 +79,8 @@
}
public void setValue(int value) {
- this.value = value;
+ currentDimension = ImageDimension.getInstance(value);
+ this.value = currentDimension.x;
}
-
-
+
}
Modified:
trunk/test-applications/realworld2/web/src/main/webapp/includes/image/imageInfo.xhtml
===================================================================
(Binary files differ)
Modified:
trunk/test-applications/realworld2/web/src/main/webapp/includes/image/imageList.xhtml
===================================================================
(Binary files differ)
Modified:
trunk/test-applications/realworld2/web/src/main/webapp/includes/misc/inputNumberSlider.xhtml
===================================================================
---
trunk/test-applications/realworld2/web/src/main/webapp/includes/misc/inputNumberSlider.xhtml 2009-03-25
01:42:58 UTC (rev 13168)
+++
trunk/test-applications/realworld2/web/src/main/webapp/includes/misc/inputNumberSlider.xhtml 2009-03-25
10:38:35 UTC (rev 13169)
@@ -5,64 +5,16 @@
xmlns:a4j="http://richfaces.org/a4j"
xmlns:rich="http://richfaces.org/rich"
xmlns:richx="http://richfaces.org/richx">
- <style>
- .inputSlider {
- height: auto;
- margin-right: -7px;
- margin-left: -3px;
- position: relative;
- }
- .sliderBorder {
- width: 100%;
- border-left: 1px solid #636363;
- height: 4px;
- }
- </style>
- <div>Input number slider will be here
- <ui:remove>
- <table border="0" cellpadding="0"
cellspacing="0">
- <tr style="height: 20px; padding-botton: 3px">
- <td>
- <div class="font-size: 9px">80-60</div>
- </td>
- <td>
- <div style="font-size: 9px">120-80</div>
- </td>
- <td>
- <div style="font-size: 9px">160-120</div>
- </td>
- <td>
- <div style="font-size: 9px">500-375</div>
- </td>
- </tr>
- <tr style="height: 4px">
- <td style="width: 25%">
- <div class="sliderBorder" style="height:
4px"></div>
- </td>
- <td style="width: 25%">
- <div class="sliderBorder" style="height:
4px"></div>
- </td>
- <td style="width: 25%">
- <div class="sliderBorder" style="border-right: 1px solid
#636363;"></div>
- </td>
- <td style="width: 25%">
- <div></div>
- </td>
- </tr>
- <tr><td colspan="3" style="overflow: visible">
+ <div>
<rich:inputNumberSlider enableManualInput="false"
value="#{imageSizeHelper.value}"
- minValue="0"
- maxValue="3"
- style="height: auto"
- styleClass="inputSlider"
+ minValue="80"
+ maxValue="200"
showArrows="false"
- showBoundaryValues="false"
+ showBoundaryValues="true"
showInput="false"
- step="1">
- <a4j:support event="onchange"
reRender="userAlbumImages"></a4j:support>
- </rich:inputNumberSlider>
- </td><td></td></tr></table>
- </ui:remove>
+ step="40">
+ <a4j:support event="onchange"
reRender="#{reRenderArea}"></a4j:support>
+ </rich:inputNumberSlider>
</div>
</ui:composition>
\ No newline at end of file
Modified:
trunk/test-applications/realworld2/web/src/main/webapp/includes/search/result/imageResult.xhtml
===================================================================
---
trunk/test-applications/realworld2/web/src/main/webapp/includes/search/result/imageResult.xhtml 2009-03-25
01:42:58 UTC (rev 13168)
+++
trunk/test-applications/realworld2/web/src/main/webapp/includes/search/result/imageResult.xhtml 2009-03-25
10:38:35 UTC (rev 13169)
@@ -4,9 +4,15 @@
xmlns:f="http://java.sun.com/jsf/core"
xmlns:a4j="http://richfaces.org/a4j"
xmlns:rich="http://richfaces.org/rich">
- <a4j:repeat rendered="#{result.size() > 0}" value="#{result}"
var="image">
- <h:panelGroup layout="block"
styleClass="preview_box_photo_120">
- <h:graphicImage styleClass="pr_photo_bg"
value="/img/shell/frame_photo_200.png" />
+ <a4j:outputPanel rendered="#{result.size() > 0}"
id="imagesList">
+
+ <ui:include src="/includes/misc/inputNumberSlider.xhtml">
+ <ui:param name="reRenderArea" value="imagesList" />
+ </ui:include>
+ <br/><br/>
+ <a4j:repeat value="#{result}" var="image">
+ <h:panelGroup layout="block"
styleClass="#{imageSizeHelper.currentDimension.cssClass}">
+ <h:graphicImage styleClass="pr_photo_bg"
value="#{imageSizeHelper.currentDimension.imageBg}" />
<h:panelGrid cellpadding="0">
<h:panelGroup>
<a4j:commandLink
@@ -33,5 +39,6 @@
</h:panelGroup>
</h:panelGroup>
</a4j:repeat>
+ </a4j:outputPanel>
<h:outputText rendered="#{result.size() == 0}" value="No results
found" />
</ui:composition>
\ No newline at end of file