JBoss Rich Faces SVN: r7910 - trunk/framework/test/src/test/java/org/richfaces/skin.
by richfaces-svn-commits@lists.jboss.org
Author: nbelaevski
Date: 2008-04-17 18:39:09 -0400 (Thu, 17 Apr 2008)
New Revision: 7910
Modified:
trunk/framework/test/src/test/java/org/richfaces/skin/SkinTestCase.java
Log:
Fixed test failure
Modified: trunk/framework/test/src/test/java/org/richfaces/skin/SkinTestCase.java
===================================================================
--- trunk/framework/test/src/test/java/org/richfaces/skin/SkinTestCase.java 2008-04-17 21:03:40 UTC (rev 7909)
+++ trunk/framework/test/src/test/java/org/richfaces/skin/SkinTestCase.java 2008-04-17 22:39:09 UTC (rev 7910)
@@ -36,10 +36,6 @@
import org.easymock.MockControl;
import org.easymock.classextension.MockClassControl;
-import org.richfaces.skin.Skin;
-import org.richfaces.skin.SkinFactory;
-import org.richfaces.skin.SkinFactoryImpl;
-import org.richfaces.skin.SkinImpl;
/**
* Test for Skin/skin factory methods.
@@ -296,7 +292,7 @@
assertNotNull("Null skin!",skin);
// test properties
int hash = skin.hashCode(mockContext);
- assertTrue(params.containsKey(SkinImpl.REQUEST_HASH_CODE_PARAMETER));
+ assertTrue(params.containsKey(SkinImpl.REQUEST_HASH_CODES_MAP_PARAMETER));
assertEquals(hash,skin.hashCode(mockContext));
params.clear();
assertEquals(hash,skin.hashCode(mockContext));
16 years, 9 months
JBoss Rich Faces SVN: r7909 - in trunk/framework/impl/src/main: java/org/richfaces/renderkit/html and 3 other directories.
by richfaces-svn-commits@lists.jboss.org
Author: nbelaevski
Date: 2008-04-17 17:03:40 -0400 (Thu, 17 Apr 2008)
New Revision: 7909
Modified:
trunk/framework/impl/src/main/java/org/ajax4jsf/resource/TemplateCSSRenderer.java
trunk/framework/impl/src/main/java/org/richfaces/renderkit/html/BaseGradient.java
trunk/framework/impl/src/main/java/org/richfaces/renderkit/html/images/BaseControlBackgroundImage.java
trunk/framework/impl/src/main/java/org/richfaces/renderkit/html/images/OneColorBasedResource.java
trunk/framework/impl/src/main/java/org/richfaces/skin/SkinImpl.java
trunk/framework/impl/src/main/resources/META-INF/skins/emeraldTown.skin.properties
trunk/framework/impl/src/main/resources/META-INF/skins/ruby.skin.properties
Log:
Fixed dynamic change of BASE_SKIN
Fixed several NPEs on plain skin
Gradient types reverted back to plain
Modified: trunk/framework/impl/src/main/java/org/ajax4jsf/resource/TemplateCSSRenderer.java
===================================================================
--- trunk/framework/impl/src/main/java/org/ajax4jsf/resource/TemplateCSSRenderer.java 2008-04-17 19:32:43 UTC (rev 7908)
+++ trunk/framework/impl/src/main/java/org/ajax4jsf/resource/TemplateCSSRenderer.java 2008-04-17 21:03:40 UTC (rev 7909)
@@ -157,8 +157,10 @@
TemplateContext templateContext = new TemplateContext(null,context,component);
Object value = template.getValue(templateContext);
if(null == value){
- int hashCode = SkinFactory.getInstance().getSkin(context).hashCode(context);
- value = ByteBuffer.allocate(4).putInt(hashCode).array();
+ SkinFactory skinFactory = SkinFactory.getInstance();
+ int hashCode = skinFactory.getSkin(context).hashCode(context);
+ int baseHashCode = skinFactory.getBaseSkin(context).hashCode(context);
+ value = ByteBuffer.allocate(4*2).putInt(hashCode).putInt(baseHashCode).array();
}
return value;
}
Modified: trunk/framework/impl/src/main/java/org/richfaces/renderkit/html/BaseGradient.java
===================================================================
--- trunk/framework/impl/src/main/java/org/richfaces/renderkit/html/BaseGradient.java 2008-04-17 19:32:43 UTC (rev 7908)
+++ trunk/framework/impl/src/main/java/org/richfaces/renderkit/html/BaseGradient.java 2008-04-17 21:03:40 UTC (rev 7909)
@@ -183,9 +183,11 @@
}
protected void restoreData(Data data, Zipper2 zipper2) {
- data.headerBackgroundColor = new Integer(zipper2.nextIntColor());
- data.headerGradientColor = new Integer(zipper2.nextIntColor());
- data.gradientType = GradientType.values()[zipper2.nextByte()];
+ if (zipper2.hasMore()) {
+ data.headerBackgroundColor = new Integer(zipper2.nextIntColor());
+ data.headerGradientColor = new Integer(zipper2.nextIntColor());
+ data.gradientType = GradientType.values()[zipper2.nextByte()];
+ }
}
protected Object deserializeData(byte[] objectArray) {
Modified: trunk/framework/impl/src/main/java/org/richfaces/renderkit/html/images/BaseControlBackgroundImage.java
===================================================================
--- trunk/framework/impl/src/main/java/org/richfaces/renderkit/html/images/BaseControlBackgroundImage.java 2008-04-17 19:32:43 UTC (rev 7908)
+++ trunk/framework/impl/src/main/java/org/richfaces/renderkit/html/images/BaseControlBackgroundImage.java 2008-04-17 21:03:40 UTC (rev 7909)
@@ -93,8 +93,10 @@
}
protected void restoreData(org.richfaces.renderkit.html.BaseGradient.Data data, Zipper2 zipper2) {
- ((Data) data).height = zipper2.nextInt();
- super.restoreData(data, zipper2);
+ if (zipper2.hasMore()) {
+ ((Data) data).height = zipper2.nextInt();
+ super.restoreData(data, zipper2);
+ }
}
protected static class Data extends BaseGradient.Data {
@@ -109,7 +111,7 @@
@Override
public byte[] toByteArray() {
byte[] bs = super.toByteArray();
- byte[] result = new byte[bs.length + 4];
+ byte[] result = new byte[(bs != null ? bs.length : 0) + 4];
new Zipper2(result).addInt(height).addBytes(bs);
return result;
Modified: trunk/framework/impl/src/main/java/org/richfaces/renderkit/html/images/OneColorBasedResource.java
===================================================================
--- trunk/framework/impl/src/main/java/org/richfaces/renderkit/html/images/OneColorBasedResource.java 2008-04-17 19:32:43 UTC (rev 7908)
+++ trunk/framework/impl/src/main/java/org/richfaces/renderkit/html/images/OneColorBasedResource.java 2008-04-17 21:03:40 UTC (rev 7909)
@@ -28,6 +28,7 @@
import javax.faces.context.FacesContext;
import org.ajax4jsf.resource.GifRenderer;
+import org.ajax4jsf.resource.InternetResourceBase;
import org.ajax4jsf.resource.InternetResourceBuilder;
import org.ajax4jsf.resource.Java2Dresource;
import org.ajax4jsf.resource.ResourceContext;
@@ -88,10 +89,14 @@
basicColor = getColorValueParameter(context, basicColorParamName);
}
- retVal = new byte[3 * 1];
- new Zipper2(retVal).addColor(basicColor);
+ if (basicColor != null) {
+ retVal = new byte[3 * 1];
+ new Zipper2(retVal).addColor(basicColor);
- return retVal;
+ return retVal;
+ } else {
+ return null;
+ }
}
/**
Modified: trunk/framework/impl/src/main/java/org/richfaces/skin/SkinImpl.java
===================================================================
--- trunk/framework/impl/src/main/java/org/richfaces/skin/SkinImpl.java 2008-04-17 19:32:43 UTC (rev 7908)
+++ trunk/framework/impl/src/main/java/org/richfaces/skin/SkinImpl.java 2008-04-17 21:03:40 UTC (rev 7909)
@@ -24,7 +24,10 @@
import java.util.HashMap;
import java.util.Iterator;
import java.util.Map;
+import java.util.concurrent.ConcurrentHashMap;
+import java.util.concurrent.ConcurrentMap;
+import javax.faces.context.ExternalContext;
import javax.faces.context.FacesContext;
import javax.faces.el.ValueBinding;
@@ -40,8 +43,11 @@
public static final String RENDER_KIT_PARAMETER = "render.kit";
+
+ @Deprecated
+ public static final String REQUEST_HASH_CODE_PARAMETER = "org.ajax4jsf.skin.HASH_CODE";
- public static final String REQUEST_HASH_CODE_PARAMETER = "org.ajax4jsf.skin.HASH_CODE";
+ public static final String REQUEST_HASH_CODES_MAP_PARAMETER = "org.ajax4jsf.skin.HASH_CODES_MAP";
private Map skinParams = new HashMap();
@@ -116,19 +122,31 @@
* @see org.richfaces.skin.Skin#hashCode(javax.faces.context.FacesContext)
*/
public int hashCode(FacesContext context) {
- Integer requestCode = (Integer) context.getExternalContext().getRequestMap().get(REQUEST_HASH_CODE_PARAMETER);
- if(null == requestCode){
- int hash = 0;
- for (Iterator iter = skinParams.keySet().iterator(); iter.hasNext();) {
- String key = (String) iter.next();
- Object parameter = getParameter(context,key);
- hash = 31*hash + (parameter != null ? parameter.hashCode() : 0);
- }
- requestCode = new Integer(hash);
- // store hash for this skin as request-skope parameter - not calculate on next calls for same request
- context.getExternalContext().getRequestMap().put(REQUEST_HASH_CODE_PARAMETER,requestCode);
+ ExternalContext externalContext = context.getExternalContext();
+ Map<String, Object> requestMap = externalContext.getRequestMap();
+ ConcurrentMap<Skin, Integer> map;
+ synchronized (requestMap) {
+ map = (ConcurrentMap<Skin, Integer>) requestMap.get(REQUEST_HASH_CODES_MAP_PARAMETER);
+ if (map == null) {
+ map = new ConcurrentHashMap<Skin, Integer>();
+ requestMap.put(REQUEST_HASH_CODES_MAP_PARAMETER, map);
}
- return requestCode.intValue();
+ }
+
+ Integer requestCode = (Integer) map.get(this);
+ if(null == requestCode){
+ int hash = 0;
+ for (Iterator iter = skinParams.keySet().iterator(); iter.hasNext();) {
+ String key = (String) iter.next();
+ Object parameter = getParameter(context,key);
+ hash = 31*hash + key.hashCode();
+ hash = 31*hash + (parameter != null ? parameter.hashCode() : 0);
+ }
+ requestCode = new Integer(hash);
+ // store hash for this skin as request-skope parameter - not calculate on next calls for same request
+ map.putIfAbsent(this, requestCode);
+ }
+ return requestCode.intValue();
}
Modified: trunk/framework/impl/src/main/resources/META-INF/skins/emeraldTown.skin.properties
===================================================================
--- trunk/framework/impl/src/main/resources/META-INF/skins/emeraldTown.skin.properties 2008-04-17 19:32:43 UTC (rev 7908)
+++ trunk/framework/impl/src/main/resources/META-INF/skins/emeraldTown.skin.properties 2008-04-17 21:03:40 UTC (rev 7909)
@@ -70,4 +70,4 @@
editBackgroundColor=#FEFFDA
#Gradients
-gradientType=glass
+gradientType=plain
Modified: trunk/framework/impl/src/main/resources/META-INF/skins/ruby.skin.properties
===================================================================
--- trunk/framework/impl/src/main/resources/META-INF/skins/ruby.skin.properties 2008-04-17 19:32:43 UTC (rev 7908)
+++ trunk/framework/impl/src/main/resources/META-INF/skins/ruby.skin.properties 2008-04-17 21:03:40 UTC (rev 7909)
@@ -71,4 +71,4 @@
editBackgroundColor=#FEFFDA
#Gradients
-gradientType=plastic
+gradientType=plain
16 years, 9 months
JBoss Rich Faces SVN: r7908 - in trunk/framework/impl/src: main/java/org/richfaces/renderkit/html and 4 other directories.
by richfaces-svn-commits@lists.jboss.org
Author: nbelaevski
Date: 2008-04-17 15:32:43 -0400 (Thu, 17 Apr 2008)
New Revision: 7908
Added:
trunk/framework/impl/src/main/java/org/richfaces/renderkit/html/images/GradientType.java
Modified:
trunk/framework/impl/src/main/java/org/ajax4jsf/util/Zipper2.java
trunk/framework/impl/src/main/java/org/richfaces/renderkit/html/BaseGradient.java
trunk/framework/impl/src/main/java/org/richfaces/renderkit/html/images/BaseControlBackgroundImage.java
trunk/framework/impl/src/main/java/org/richfaces/skin/SkinImpl.java
trunk/framework/impl/src/main/resources/META-INF/skins/DEFAULT.skin.properties
trunk/framework/impl/src/main/resources/META-INF/skins/NULL.skin.properties
trunk/framework/impl/src/main/resources/META-INF/skins/blueSky.skin.properties
trunk/framework/impl/src/main/resources/META-INF/skins/classic.skin.properties
trunk/framework/impl/src/main/resources/META-INF/skins/deepMarine.skin.properties
trunk/framework/impl/src/main/resources/META-INF/skins/emeraldTown.skin.properties
trunk/framework/impl/src/main/resources/META-INF/skins/japanCherry.skin.properties
trunk/framework/impl/src/main/resources/META-INF/skins/ruby.skin.properties
trunk/framework/impl/src/main/resources/META-INF/skins/wine.skin.properties
trunk/framework/impl/src/test/java/org/ajax4jsf/util/Zipper2Test.java
Log:
Support for gradient types added
Modified: trunk/framework/impl/src/main/java/org/ajax4jsf/util/Zipper2.java
===================================================================
--- trunk/framework/impl/src/main/java/org/ajax4jsf/util/Zipper2.java 2008-04-17 19:31:04 UTC (rev 7907)
+++ trunk/framework/impl/src/main/java/org/ajax4jsf/util/Zipper2.java 2008-04-17 19:32:43 UTC (rev 7908)
@@ -43,6 +43,12 @@
this.buffer = buffer;
}
+ public Zipper2(byte[] buffer, int offest) {
+ super();
+ this.buffer = buffer;
+ this.offset = offest;
+ }
+
public Zipper2 addByte(byte b) {
buffer[offset++] = b;
return this;
@@ -73,6 +79,14 @@
return this;
}
+ public Zipper2 addBytes(byte[] bs) {
+ if (bs != null) {
+ System.arraycopy(bs, 0, buffer, offset, bs.length);
+ }
+
+ return this;
+ }
+
public byte nextByte() {
return buffer[offset++];
}
@@ -102,6 +116,14 @@
return i;
}
+ public byte[] nextBytes() {
+ byte[] bs = new byte[buffer.length - offset];
+ System.arraycopy(buffer, offset, bs, 0, buffer.length - offset);
+ offset = buffer.length;
+
+ return bs;
+ }
+
public boolean hasMore() {
return offset < buffer.length;
}
Modified: trunk/framework/impl/src/main/java/org/richfaces/renderkit/html/BaseGradient.java
===================================================================
--- trunk/framework/impl/src/main/java/org/richfaces/renderkit/html/BaseGradient.java 2008-04-17 19:31:04 UTC (rev 7907)
+++ trunk/framework/impl/src/main/java/org/richfaces/renderkit/html/BaseGradient.java 2008-04-17 19:32:43 UTC (rev 7908)
@@ -32,12 +32,14 @@
import javax.faces.context.FacesContext;
-import org.ajax4jsf.resource.GifRenderer;
import org.ajax4jsf.resource.InternetResourceBuilder;
import org.ajax4jsf.resource.Java2Dresource;
+import org.ajax4jsf.resource.PngRenderer;
import org.ajax4jsf.resource.ResourceContext;
import org.ajax4jsf.util.HtmlColor;
import org.ajax4jsf.util.Zipper2;
+import org.richfaces.renderkit.html.images.GradientType;
+import org.richfaces.renderkit.html.images.GradientType.BiColor;
import org.richfaces.skin.Skin;
import org.richfaces.skin.SkinFactory;
@@ -61,7 +63,7 @@
this.height = height;
this.gradientHeight = gradientHeight;
- setRenderer(new GifRenderer());
+ setRenderer(new PngRenderer());
setLastModified(new Date(InternetResourceBuilder.getInstance().getStartTime()));
}
@@ -134,95 +136,141 @@
protected Dimension getDimensions(ResourceContext resourceContext) {
return getDimensions(null, restoreData(resourceContext));
}
+
+ private void drawGradient(Graphics2D g2d, Rectangle2D rectangle, BiColor colors, int height, boolean horizontal) {
+ if (colors != null) {
+ GradientPaint gragient;
+ if (horizontal) {
+ gragient = new GradientPaint(0, 0, colors.getTopColor(), height, 0, colors.getBottomColor());
+ } else {
+ gragient = new GradientPaint(0, 0, colors.getTopColor(), 0, height, colors.getBottomColor());
+ }
+ g2d.setPaint(gragient);
+ g2d.fill(rectangle);
+ }
+ }
+
protected void paint(ResourceContext resourceContext, Graphics2D g2d) {
- g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
- g2d.setRenderingHint(RenderingHints.KEY_DITHERING, RenderingHints.VALUE_DITHER_ENABLE);
- g2d.setRenderingHint(RenderingHints.KEY_COLOR_RENDERING, RenderingHints.VALUE_COLOR_RENDER_QUALITY);
- Data dataToStore = (Data) restoreData(resourceContext);
- if (dataToStore != null && dataToStore.headerBackgroundColor!=null && dataToStore.headerGradientColor!=null) {
- Color baseColor = new Color(dataToStore.headerBackgroundColor.intValue());
- Dimension dim =getDimensions(resourceContext);
- Rectangle2D rect =
- new Rectangle2D.Float(
- 0,
- 0,
- dim.width,
- dim.height);
- int gradStart = 0;
- int gradEnd = gradientHeight;
- Color alternateColor = new Color(dataToStore.headerGradientColor.intValue());
- GradientPaint gragient;
- if (horizontal) {
- gragient = new GradientPaint(gradStart, 0, baseColor, gradEnd, 0, alternateColor);
- } else {
- gragient = new GradientPaint(0, gradStart, baseColor, 0, gradEnd, alternateColor);
- }
- g2d.setPaint(gragient);
- g2d.fill(rect);
- }
+ g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
+ g2d.setRenderingHint(RenderingHints.KEY_DITHERING, RenderingHints.VALUE_DITHER_ENABLE);
+
+ g2d.setRenderingHint(RenderingHints.KEY_ALPHA_INTERPOLATION, RenderingHints.VALUE_ALPHA_INTERPOLATION_QUALITY);
+ g2d.setRenderingHint(RenderingHints.KEY_COLOR_RENDERING, RenderingHints.VALUE_COLOR_RENDER_QUALITY);
+ g2d.setRenderingHint(RenderingHints.KEY_RENDERING, RenderingHints.VALUE_RENDER_QUALITY);
+
+ Data dataToStore = (Data) restoreData(resourceContext);
+ if (dataToStore != null && dataToStore.headerBackgroundColor!=null && dataToStore.headerGradientColor!=null) {
+ Color baseColor = new Color(dataToStore.headerBackgroundColor.intValue());
+ Color alternateColor = new Color(dataToStore.headerGradientColor.intValue());
+ BiColor biColor = new GradientType.BiColor(baseColor, alternateColor);
+
+ GradientType type = dataToStore.gradientType;
+ BiColor firstLayer = type.getFirstLayerColors(biColor);
+ BiColor secondLayer = type.getSecondLayerColors(biColor);
+
+ Dimension dim = getDimensions(resourceContext);
+ Rectangle2D rect =
+ new Rectangle2D.Float(
+ 0,
+ 0,
+ dim.width,
+ dim.height);
+
+ drawGradient(g2d, rect, firstLayer, gradientHeight, horizontal);
+ drawGradient(g2d, rect, secondLayer, gradientHeight / 2, horizontal);
+ }
}
+ protected void restoreData(Data data, Zipper2 zipper2) {
+ data.headerBackgroundColor = new Integer(zipper2.nextIntColor());
+ data.headerGradientColor = new Integer(zipper2.nextIntColor());
+ data.gradientType = GradientType.values()[zipper2.nextByte()];
+ }
+
protected Object deserializeData(byte[] objectArray) {
- Data data = new Data();
- if (objectArray != null) {
- Zipper2 zipper2 = new Zipper2(objectArray);
- data.headerBackgroundColor = new Integer(zipper2.nextIntColor());
- data.headerGradientColor = new Integer(zipper2.nextIntColor());
+ Data data = createData();
+ if (objectArray != null) {
+ Zipper2 zipper2 = new Zipper2(objectArray);
+ restoreData(data, zipper2);
+ }
+
+ return data;
+ }
+
+ protected Data createData() {
+ return new Data();
+ }
+
+ private void saveData(FacesContext context, Data data, String baseColor, String gradientColor) {
+ data.headerBackgroundColor = getColorValueParameter(context, baseColor, false);
+ data.headerGradientColor = getColorValueParameter(context, gradientColor, false);
+
+ if (!(data.headerBackgroundColor == null && data.headerGradientColor == null)) {
+ if (data.headerBackgroundColor == null) {
+ data.headerBackgroundColor = getColorValueParameter(context, baseColor, true);
}
- return data;
+ if (data.headerGradientColor == null) {
+ data.headerGradientColor = getColorValueParameter(context, gradientColor, true);
+ }
+ }
+
+ data.gradientType = GradientType.getBySkinParameter(getValueParameter(context, Skin.gradientType));
}
+ protected void saveData(FacesContext context, Data data) {
+ if (baseColor == null) {
+ saveData(context, data, Skin.headerBackgroundColor, "headerGradientColor");
+ } else {
+ saveData(context, data, baseColor, gradientColor);
+ }
+ }
+
protected Object getDataToStore(FacesContext context, Object data) {
- if (baseColor == null) {
- return new Data(context).toByteArray();
- } else {
- return new Data(context, baseColor, gradientColor).toByteArray();
- }
+ Data dataObject = createData();
+ saveData(context, dataObject);
+
+ return dataObject.toByteArray();
}
public boolean isCacheable() {
return true;
}
- protected static class Data implements Serializable {
- public Data() {
- }
- protected Data(FacesContext context) {
- this(context, Skin.headerBackgroundColor, "headerGradientColor");
- }
+ protected String getValueParameter(FacesContext context, String name) {
+ SkinFactory skinFactory = SkinFactory.getInstance();
- protected Data(FacesContext context, String baseColor, String gradientColor) {
- this.headerBackgroundColor = getColorValueParameter(context, baseColor, false);
- this.headerGradientColor = getColorValueParameter(context, gradientColor, false);
+ Skin skin = skinFactory.getSkin(context);
+ String value = (String) skin.getParameter(context, name);
+
+ if (value == null || value.length() == 0) {
+ skin = skinFactory.getDefaultSkin(context);
+ value = (String) skin.getParameter(context, name);
+ }
+
+ return value;
+ }
- if (!(this.headerBackgroundColor == null && this.headerGradientColor == null)) {
- if (this.headerBackgroundColor == null) {
- this.headerBackgroundColor = getColorValueParameter(context, baseColor, true);
- }
-
- if (this.headerGradientColor == null) {
- this.headerGradientColor = getColorValueParameter(context, gradientColor, true);
- }
- }
+ protected Integer getColorValueParameter(FacesContext context, String name, boolean useDefault) {
+ Skin skin;
+ if (useDefault) {
+ skin = SkinFactory.getInstance().getDefaultSkin(context);
+ } else {
+ skin = SkinFactory.getInstance().getSkin(context);
}
+
+ String tmp = (String) skin.getParameter(context,name);
+ if (tmp!=null && tmp.length() != 0) {
+ return new Integer(HtmlColor.decode(tmp).getRGB());
+ } else {
+ return null;
+ }
+ }
- private Integer getColorValueParameter(FacesContext context, String name, boolean useDefault) {
- Skin skin;
- if (useDefault) {
- skin = SkinFactory.getInstance().getDefaultSkin(context);
- } else {
- skin = SkinFactory.getInstance().getSkin(context);
- }
-
- String tmp = (String) skin.getParameter(context,name);
- if (tmp!=null && tmp.length() != 0) {
- return new Integer(HtmlColor.decode(tmp).getRGB());
- } else {
- return null;
- }
+ protected static class Data implements Serializable {
+ public Data() {
}
/**
@@ -231,10 +279,13 @@
private static final long serialVersionUID = 1732700513743861250L;
protected Integer headerBackgroundColor;
protected Integer headerGradientColor;
+ protected GradientType gradientType;
+
public byte[] toByteArray() {
- if (headerBackgroundColor != null && headerGradientColor != null) {
- byte[] ret = new byte[6];
- new Zipper2(ret).addColor(headerBackgroundColor.intValue()).addColor(headerGradientColor.intValue());
+ if (headerBackgroundColor != null && headerGradientColor != null && gradientType != null) {
+ byte[] ret = new byte[7];
+ new Zipper2(ret).addColor(headerBackgroundColor.intValue()).addColor(headerGradientColor.intValue()).
+ addByte((byte) gradientType.ordinal());
return ret;
} else {
return null;
Modified: trunk/framework/impl/src/main/java/org/richfaces/renderkit/html/images/BaseControlBackgroundImage.java
===================================================================
--- trunk/framework/impl/src/main/java/org/richfaces/renderkit/html/images/BaseControlBackgroundImage.java 2008-04-17 19:31:04 UTC (rev 7907)
+++ trunk/framework/impl/src/main/java/org/richfaces/renderkit/html/images/BaseControlBackgroundImage.java 2008-04-17 19:32:43 UTC (rev 7908)
@@ -21,24 +21,13 @@
package org.richfaces.renderkit.html.images;
-import java.awt.Color;
import java.awt.Dimension;
-import java.awt.GradientPaint;
-import java.awt.Graphics2D;
-import java.awt.RenderingHints;
-import java.awt.geom.Rectangle2D;
-import java.io.Serializable;
-import java.util.Date;
import javax.faces.context.FacesContext;
-import org.ajax4jsf.resource.GifRenderer;
-import org.ajax4jsf.resource.InternetResourceBuilder;
-import org.ajax4jsf.resource.Java2Dresource;
-import org.ajax4jsf.resource.ResourceContext;
-import org.ajax4jsf.util.HtmlColor;
import org.ajax4jsf.util.HtmlDimensions;
import org.ajax4jsf.util.Zipper2;
+import org.richfaces.renderkit.html.BaseGradient;
import org.richfaces.skin.Skin;
import org.richfaces.skin.SkinFactory;
@@ -49,56 +38,23 @@
* @since 3.2
*/
-public class BaseControlBackgroundImage extends Java2Dresource {
+public class BaseControlBackgroundImage extends BaseGradient {
private static final Dimension DIMENSION = new Dimension(1, 1);
- private String baseColor;
-
- private String gradientColor;
-
- private int width;
-
public BaseControlBackgroundImage(String baseColor, String gradientColor, int width) {
- super();
-
- this.baseColor = baseColor;
- this.gradientColor = gradientColor;
- this.width = width;
-
- setRenderer(new GifRenderer());
- setLastModified(new Date(InternetResourceBuilder.getInstance().getStartTime()));
+ super(width, 1, baseColor, gradientColor);
}
public Dimension getDimensions(FacesContext facesContext, Object data) {
- Data d = (Data) data;
- if (d != null) {
- return new Dimension(width, d.height.intValue());
+ Data data2 = (Data) data;
+ if (data != null) {
+ return new Dimension(super.getDimensions(facesContext, data).width, data2.height);
} else {
return DIMENSION;
}
}
- protected Dimension getDimensions(ResourceContext resourceContext) {
- return getDimensions(null, restoreData(resourceContext));
- }
-
- protected void paint(ResourceContext resourceContext, Graphics2D g2d) {
- g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
- g2d.setRenderingHint(RenderingHints.KEY_DITHERING, RenderingHints.VALUE_DITHER_ENABLE);
- g2d.setRenderingHint(RenderingHints.KEY_COLOR_RENDERING, RenderingHints.VALUE_COLOR_RENDER_QUALITY);
- Data dataToStore = (Data) restoreData(resourceContext);
- if (dataToStore != null && dataToStore.headerBackgroundColor != null && dataToStore.headerGradientColor != null) {
- Color baseColor = new Color(dataToStore.headerBackgroundColor.intValue());
- Dimension dim = getDimensions(resourceContext);
- Rectangle2D rect = new Rectangle2D.Float(0, 0, dim.width, dim.height);
- Color alternateColor = new Color(dataToStore.headerGradientColor.intValue());
- GradientPaint gragient = new GradientPaint(0, 0, baseColor, 0, dim.height, alternateColor);
- g2d.setPaint(gragient);
- g2d.fill(rect);
- }
- }
-
protected final Integer getHeight(FacesContext context, String heightParamName) {
SkinFactory skinFactory = SkinFactory.getInstance();
Skin skin = skinFactory.getSkin(context);
@@ -120,92 +76,43 @@
return getHeight(context, Skin.generalSizeFont);
}
- protected Object deserializeData(byte[] objectArray) {
- Data data = new Data();
- if (objectArray != null) {
- Zipper2 zipper2 = new Zipper2(objectArray);
- data.headerBackgroundColor = new Integer(zipper2.nextIntColor());
- data.headerGradientColor = new Integer(zipper2.nextIntColor());
- data.height = new Integer(zipper2.nextInt());
- }
- return data;
+ public boolean isCacheable() {
+ return true;
}
-
- protected Object getDataToStore(FacesContext context, Object data) {
- Integer h = getHeight(context);
- if (baseColor == null) {
- return new Data(context, h).toByteArray();
- } else {
- return new Data(context, baseColor, gradientColor, h).toByteArray();
- }
+
+ @Override
+ protected org.richfaces.renderkit.html.BaseGradient.Data createData() {
+ return new Data();
}
+
+ @Override
+ protected void saveData(FacesContext context, org.richfaces.renderkit.html.BaseGradient.Data data) {
+ super.saveData(context, data);
+ ((Data) data).height = getHeight(context);
+ }
- public boolean isCacheable() {
- return true;
+ protected void restoreData(org.richfaces.renderkit.html.BaseGradient.Data data, Zipper2 zipper2) {
+ ((Data) data).height = zipper2.nextInt();
+ super.restoreData(data, zipper2);
}
+
+ protected static class Data extends BaseGradient.Data {
- protected static class Data implements Serializable {
- public Data() {
- }
+ /**
+ *
+ */
+ private static final long serialVersionUID = -1499766195614003931L;
- protected Data(FacesContext context, Integer height) {
- this(context, Skin.headerBackgroundColor, "headerGradientColor", height);
- }
+ protected Integer height;
+
+ @Override
+ public byte[] toByteArray() {
+ byte[] bs = super.toByteArray();
+ byte[] result = new byte[bs.length + 4];
+ new Zipper2(result).addInt(height).addBytes(bs);
- protected Data(FacesContext context, String baseColor, String gradientColor, Integer height) {
- this.headerBackgroundColor = getColorValueParameter(context, baseColor, false);
- this.headerGradientColor = getColorValueParameter(context, gradientColor, false);
- this.height = height;
-
- if (!(this.headerBackgroundColor == null && this.headerGradientColor == null)) {
- if (this.headerBackgroundColor == null) {
- this.headerBackgroundColor = getColorValueParameter(context, baseColor, true);
- }
-
- if (this.headerGradientColor == null) {
- this.headerGradientColor = getColorValueParameter(context, gradientColor, true);
- }
- }
- }
-
- private Integer getColorValueParameter(FacesContext context, String name, boolean useDefault) {
- Skin skin;
- if (useDefault) {
- skin = SkinFactory.getInstance().getDefaultSkin(context);
- } else {
- skin = SkinFactory.getInstance().getSkin(context);
- }
-
- String tmp = (String) skin.getParameter(context, name);
- if (tmp != null && tmp.length() != 0) {
- return new Integer(HtmlColor.decode(tmp).getRGB());
- } else {
- return null;
- }
- }
-
- /**
- *
- */
- private static final long serialVersionUID = 1732700513743861250L;
-
- protected Integer headerBackgroundColor;
-
- protected Integer headerGradientColor;
-
- protected Integer height;
-
- public byte[] toByteArray() {
- if (headerBackgroundColor != null && headerGradientColor != null) {
- byte[] ret = new byte[10];
- new Zipper2(ret).addColor(headerBackgroundColor.intValue()).addColor(headerGradientColor.intValue())
- .addInt(height);
- return ret;
- } else {
- return null;
- }
- }
- }
-
+ return result;
+ }
+ };
}
Added: trunk/framework/impl/src/main/java/org/richfaces/renderkit/html/images/GradientType.java
===================================================================
--- trunk/framework/impl/src/main/java/org/richfaces/renderkit/html/images/GradientType.java (rev 0)
+++ trunk/framework/impl/src/main/java/org/richfaces/renderkit/html/images/GradientType.java 2008-04-17 19:32:43 UTC (rev 7908)
@@ -0,0 +1,130 @@
+/**
+ *
+ */
+package org.richfaces.renderkit.html.images;
+
+import java.awt.Color;
+
+/**
+ * @author Nick Belaevski
+ * mailto:nbelaevski@exadel.com
+ * created 16.04.2008
+ *
+ */
+public enum GradientType {
+
+ GLASS {
+
+ @Override
+ public BiColor getFirstLayerColors(BiColor biColor) {
+// Color topColor = biColor.getTopColor();
+//
+// float[] hsb = Color.RGBtoHSB(topColor.getRed(), topColor.getGreen(), topColor.getBlue(), null);
+//
+// hsb[2] = 0.2f * hsb[2] + 80; //(hsb[2] * 2) / 10 + 80;
+// hsb[1] = 0.5f * hsb[1];
+//
+// Color bottomColor = new Color(Color.HSBtoRGB(hsb[0], hsb[1], hsb[2]));
+//
+// return new BiColor(topColor, bottomColor);
+
+ Color bottomColor = biColor.getBottomColor();
+
+ float[] hsb = Color.RGBtoHSB(bottomColor.getRed(), bottomColor.getGreen(), bottomColor.getBlue(), null);
+
+ hsb[2] = 0.2f * hsb[2] + 0.80f; //(hsb[2] * 2) / 10 + 80;
+ hsb[1] = 0.5f * hsb[1];
+
+ Color topColor = new Color(Color.HSBtoRGB(hsb[0], hsb[1], hsb[2]));
+
+ return new BiColor(bottomColor, topColor);
+ }
+
+ @Override
+ public BiColor getSecondLayerColors(BiColor biColor) {
+ return WHITE;
+ }
+
+ },
+
+ PLASTIC {
+
+ @Override
+ public BiColor getFirstLayerColors(BiColor biColor) {
+ Color bottomColor = biColor.getBottomColor();
+
+ float[] hsb = Color.RGBtoHSB(bottomColor.getRed(), bottomColor.getGreen(), bottomColor.getBlue(), null);
+
+ hsb[2] = 0.25f * hsb[2] + 0.75f; //(100 - hsb[2]) * 0.75f + hsb[2];
+ hsb[1] = 0.75f * hsb[1];
+
+ Color topColor = new Color(Color.HSBtoRGB(hsb[0], hsb[1], hsb[2]));
+
+ return new BiColor(topColor, bottomColor);
+ }
+
+ @Override
+ public BiColor getSecondLayerColors(BiColor biColor) {
+ return WHITE;
+ }
+
+ },
+
+ PLAIN {
+
+ @Override
+ public BiColor getFirstLayerColors(BiColor biColor) {
+ return biColor;
+ }
+
+ @Override
+ public BiColor getSecondLayerColors(BiColor biColor) {
+ return null;
+ }
+
+ };
+
+ public static final GradientType getBySkinParameter(String string) {
+ if (string == null || string.length() == 0) {
+ return PLAIN;
+ }
+
+ return GradientType.valueOf(string.toUpperCase());
+ }
+
+ public abstract BiColor getFirstLayerColors(BiColor biColor);
+ public abstract BiColor getSecondLayerColors(BiColor biColor);
+
+ private static final BiColor WHITE = new BiColor(new Color(0xff, 0xff, 0xff, (int) (0.65f * 0xff)),
+ new Color(0xff, 0xff, 0xff, (int) (0.20f * 0xff)));
+
+ public static class BiColor {
+ private Color topColor;
+ private Color bottomColor;
+
+ public BiColor(Color topColor, Color bottomColor) {
+ super();
+
+ if (topColor == null || bottomColor == null) {
+ throw new NullPointerException("Color is null!");
+ }
+
+ this.topColor = topColor;
+ this.bottomColor = bottomColor;
+ }
+
+ public Color getTopColor() {
+ return topColor;
+ }
+
+ public Color getBottomColor() {
+ return bottomColor;
+ }
+
+ @Override
+ public String toString() {
+ return "BiColor: [" + topColor + " -> " + bottomColor + "]";
+ }
+ };
+
+}
Modified: trunk/framework/impl/src/main/java/org/richfaces/skin/SkinImpl.java
===================================================================
--- trunk/framework/impl/src/main/java/org/richfaces/skin/SkinImpl.java 2008-04-17 19:31:04 UTC (rev 7907)
+++ trunk/framework/impl/src/main/java/org/richfaces/skin/SkinImpl.java 2008-04-17 19:32:43 UTC (rev 7908)
@@ -28,8 +28,6 @@
import javax.faces.context.FacesContext;
import javax.faces.el.ValueBinding;
-import org.richfaces.skin.Skin;
-
/**
* Singleton ( in respect as collection of different skins ) for produce
* instances properties for all used skins.
Modified: trunk/framework/impl/src/main/resources/META-INF/skins/DEFAULT.skin.properties
===================================================================
--- trunk/framework/impl/src/main/resources/META-INF/skins/DEFAULT.skin.properties 2008-04-17 19:31:04 UTC (rev 7907)
+++ trunk/framework/impl/src/main/resources/META-INF/skins/DEFAULT.skin.properties 2008-04-17 19:32:43 UTC (rev 7908)
@@ -68,4 +68,7 @@
warningBackgroundColor=#FF0000
editorBackgroundColor=#F1F1F1
-editBackgroundColor=#FEFFDA
\ No newline at end of file
+editBackgroundColor=#FEFFDA
+
+#Gradients
+gradientType=plain
Modified: trunk/framework/impl/src/main/resources/META-INF/skins/NULL.skin.properties
===================================================================
--- trunk/framework/impl/src/main/resources/META-INF/skins/NULL.skin.properties 2008-04-17 19:31:04 UTC (rev 7907)
+++ trunk/framework/impl/src/main/resources/META-INF/skins/NULL.skin.properties 2008-04-17 19:32:43 UTC (rev 7908)
@@ -69,4 +69,7 @@
warningBackgroundColor=#FF0000
editorBackgroundColor=#F1F1F1
-editBackgroundColor=#FEFFDA
\ No newline at end of file
+editBackgroundColor=#FEFFDA
+
+#Gradients
+gradientType=plain
Modified: trunk/framework/impl/src/main/resources/META-INF/skins/blueSky.skin.properties
===================================================================
--- trunk/framework/impl/src/main/resources/META-INF/skins/blueSky.skin.properties 2008-04-17 19:31:04 UTC (rev 7907)
+++ trunk/framework/impl/src/main/resources/META-INF/skins/blueSky.skin.properties 2008-04-17 19:32:43 UTC (rev 7908)
@@ -69,4 +69,7 @@
warningBackgroundColor=#FF0000
editorBackgroundColor=#F1F1F1
-editBackgroundColor=#FEFFDA
\ No newline at end of file
+editBackgroundColor=#FEFFDA
+
+#Gradients
+gradientType=plain
Modified: trunk/framework/impl/src/main/resources/META-INF/skins/classic.skin.properties
===================================================================
--- trunk/framework/impl/src/main/resources/META-INF/skins/classic.skin.properties 2008-04-17 19:31:04 UTC (rev 7907)
+++ trunk/framework/impl/src/main/resources/META-INF/skins/classic.skin.properties 2008-04-17 19:32:43 UTC (rev 7908)
@@ -68,4 +68,7 @@
warningBackgroundColor=#FF0000
editorBackgroundColor=#F1F1F1
-editBackgroundColor=#FEFFDA
\ No newline at end of file
+editBackgroundColor=#FEFFDA
+
+#Gradients
+gradientType=plain
Modified: trunk/framework/impl/src/main/resources/META-INF/skins/deepMarine.skin.properties
===================================================================
--- trunk/framework/impl/src/main/resources/META-INF/skins/deepMarine.skin.properties 2008-04-17 19:31:04 UTC (rev 7907)
+++ trunk/framework/impl/src/main/resources/META-INF/skins/deepMarine.skin.properties 2008-04-17 19:32:43 UTC (rev 7908)
@@ -68,3 +68,6 @@
editorBackgroundColor=#F1F1F1
editBackgroundColor=#FEFFDA
+
+#Gradients
+gradientType=plain
Modified: trunk/framework/impl/src/main/resources/META-INF/skins/emeraldTown.skin.properties
===================================================================
--- trunk/framework/impl/src/main/resources/META-INF/skins/emeraldTown.skin.properties 2008-04-17 19:31:04 UTC (rev 7907)
+++ trunk/framework/impl/src/main/resources/META-INF/skins/emeraldTown.skin.properties 2008-04-17 19:32:43 UTC (rev 7908)
@@ -68,3 +68,6 @@
editorBackgroundColor=#F1F1F1
editBackgroundColor=#FEFFDA
+
+#Gradients
+gradientType=glass
Modified: trunk/framework/impl/src/main/resources/META-INF/skins/japanCherry.skin.properties
===================================================================
--- trunk/framework/impl/src/main/resources/META-INF/skins/japanCherry.skin.properties 2008-04-17 19:31:04 UTC (rev 7907)
+++ trunk/framework/impl/src/main/resources/META-INF/skins/japanCherry.skin.properties 2008-04-17 19:32:43 UTC (rev 7908)
@@ -69,3 +69,7 @@
editorBackgroundColor=#F1F1F1
editBackgroundColor=#FEFFDA
+
+#Gradients
+gradientType=plain
+
Modified: trunk/framework/impl/src/main/resources/META-INF/skins/ruby.skin.properties
===================================================================
--- trunk/framework/impl/src/main/resources/META-INF/skins/ruby.skin.properties 2008-04-17 19:31:04 UTC (rev 7907)
+++ trunk/framework/impl/src/main/resources/META-INF/skins/ruby.skin.properties 2008-04-17 19:32:43 UTC (rev 7908)
@@ -69,3 +69,6 @@
editorBackgroundColor=#F1F1F1
editBackgroundColor=#FEFFDA
+
+#Gradients
+gradientType=plastic
Modified: trunk/framework/impl/src/main/resources/META-INF/skins/wine.skin.properties
===================================================================
--- trunk/framework/impl/src/main/resources/META-INF/skins/wine.skin.properties 2008-04-17 19:31:04 UTC (rev 7907)
+++ trunk/framework/impl/src/main/resources/META-INF/skins/wine.skin.properties 2008-04-17 19:32:43 UTC (rev 7908)
@@ -70,3 +70,5 @@
editorBackgroundColor=#F1F1F1
editBackgroundColor=#FEFFDA
+#Gradients
+gradientType=plain
Modified: trunk/framework/impl/src/test/java/org/ajax4jsf/util/Zipper2Test.java
===================================================================
--- trunk/framework/impl/src/test/java/org/ajax4jsf/util/Zipper2Test.java 2008-04-17 19:31:04 UTC (rev 7907)
+++ trunk/framework/impl/src/test/java/org/ajax4jsf/util/Zipper2Test.java 2008-04-17 19:32:43 UTC (rev 7908)
@@ -22,6 +22,7 @@
package org.ajax4jsf.util;
import java.awt.Color;
+import java.util.Arrays;
import junit.framework.TestCase;
@@ -86,4 +87,12 @@
assertEquals(0xBD4812F9, zipper2.nextInt());
}
+ public void testBytes() throws Exception {
+ byte[] b = new byte[6];
+ byte[] bs = new byte[] {(byte) 0x98, (byte) 0x63};
+ new Zipper2(b).addInt(0x08FECDB6).addBytes(bs);
+ Zipper2 zipper2 = new Zipper2(b);
+ assertEquals(0x08FECDB6, zipper2.nextInt());
+ assertTrue(Arrays.equals(bs, zipper2.nextBytes()));
+ }
}
16 years, 9 months
JBoss Rich Faces SVN: r7907 - trunk/framework/api/src/main/java/org/richfaces/skin.
by richfaces-svn-commits@lists.jboss.org
Author: nbelaevski
Date: 2008-04-17 15:31:04 -0400 (Thu, 17 Apr 2008)
New Revision: 7907
Modified:
trunk/framework/api/src/main/java/org/richfaces/skin/Skin.java
Log:
gradientType constant added
Modified: trunk/framework/api/src/main/java/org/richfaces/skin/Skin.java
===================================================================
--- trunk/framework/api/src/main/java/org/richfaces/skin/Skin.java 2008-04-17 18:10:44 UTC (rev 7906)
+++ trunk/framework/api/src/main/java/org/richfaces/skin/Skin.java 2008-04-17 19:31:04 UTC (rev 7907)
@@ -250,6 +250,8 @@
public static final String generalSizeFont = "generalSizeFont";
public static final String loadStyleSheets = "loadStyleSheets";
+
+ public static final String gradientType = "gradientType";
// Preferable parameters
/**
16 years, 9 months
JBoss Rich Faces SVN: r7906 - in trunk/test-applications/seleniumTest/src: main/webapp/WEB-INF and 4 other directories.
by richfaces-svn-commits@lists.jboss.org
Author: sergeyhalipov
Date: 2008-04-17 14:10:44 -0400 (Thu, 17 Apr 2008)
New Revision: 7906
Added:
trunk/test-applications/seleniumTest/src/main/java/org/ajax4jsf/TabPanelTestBean.java
trunk/test-applications/seleniumTest/src/main/webapp/pages/tabPanel/
trunk/test-applications/seleniumTest/src/main/webapp/pages/tabPanel/tabPanelDescription.xhtml
trunk/test-applications/seleniumTest/src/main/webapp/pages/tabPanel/tabPanelTest.xhtml
trunk/test-applications/seleniumTest/src/test/java/org/richfaces/TabPanelTest.java
Modified:
trunk/test-applications/seleniumTest/src/main/webapp/WEB-INF/faces-config.xml
trunk/test-applications/seleniumTest/src/test/java/org/ajax4jsf/test/base/SeleniumTestBase.java
Log:
Selenium tests for tab panel.
Added: trunk/test-applications/seleniumTest/src/main/java/org/ajax4jsf/TabPanelTestBean.java
===================================================================
--- trunk/test-applications/seleniumTest/src/main/java/org/ajax4jsf/TabPanelTestBean.java (rev 0)
+++ trunk/test-applications/seleniumTest/src/main/java/org/ajax4jsf/TabPanelTestBean.java 2008-04-17 18:10:44 UTC (rev 7906)
@@ -0,0 +1,44 @@
+package org.ajax4jsf;
+
+import javax.faces.event.ActionEvent;
+
+public class TabPanelTestBean {
+ private String value;
+ private String value2;
+
+ public TabPanelTestBean() {
+ value = "";
+ value2 = "";
+ }
+
+ public String getValue() {
+ return value;
+ }
+
+ public void setValue(String value) {
+ this.value = value;
+ }
+
+ public void actionListener(ActionEvent event) {
+ this.value = event.getComponent().getId();
+ }
+
+ public String action1() {
+ this.value2 = "1";
+ return null;
+ }
+
+ public String action2() {
+ this.value2 = "2";
+ return null;
+ }
+
+ public String getValue2() {
+ return value2;
+ }
+
+ public void setValue2(String value2) {
+ this.value2 = value2;
+ }
+
+}
Modified: trunk/test-applications/seleniumTest/src/main/webapp/WEB-INF/faces-config.xml
===================================================================
--- trunk/test-applications/seleniumTest/src/main/webapp/WEB-INF/faces-config.xml 2008-04-17 17:02:40 UTC (rev 7905)
+++ trunk/test-applications/seleniumTest/src/main/webapp/WEB-INF/faces-config.xml 2008-04-17 18:10:44 UTC (rev 7906)
@@ -26,5 +26,10 @@
<managed-bean-class>org.ajax4jsf.A4JCommandTestBean</managed-bean-class>
<managed-bean-scope>request</managed-bean-scope>
</managed-bean>
+ <managed-bean>
+ <managed-bean-name>tabPanelBean</managed-bean-name>
+ <managed-bean-class>org.ajax4jsf.TabPanelTestBean</managed-bean-class>
+ <managed-bean-scope>request</managed-bean-scope>
+ </managed-bean>
</faces-config>
\ No newline at end of file
Added: trunk/test-applications/seleniumTest/src/main/webapp/pages/tabPanel/tabPanelDescription.xhtml
===================================================================
--- trunk/test-applications/seleniumTest/src/main/webapp/pages/tabPanel/tabPanelDescription.xhtml (rev 0)
+++ trunk/test-applications/seleniumTest/src/main/webapp/pages/tabPanel/tabPanelDescription.xhtml 2008-04-17 18:10:44 UTC (rev 7906)
@@ -0,0 +1,5 @@
+<html>
+<table border="1" style="border-color: #F1EEE9" cellpadding="5" cellspacing="0">
+
+</table>
+</html>
\ No newline at end of file
Added: trunk/test-applications/seleniumTest/src/main/webapp/pages/tabPanel/tabPanelTest.xhtml
===================================================================
--- trunk/test-applications/seleniumTest/src/main/webapp/pages/tabPanel/tabPanelTest.xhtml (rev 0)
+++ trunk/test-applications/seleniumTest/src/main/webapp/pages/tabPanel/tabPanelTest.xhtml 2008-04-17 18:10:44 UTC (rev 7906)
@@ -0,0 +1,50 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml"
+ xmlns:a4j="http://richfaces.org/a4j"
+ xmlns:rich="http://richfaces.org/rich"
+ xmlns:h="http://java.sun.com/jsf/html"
+ xmlns:f="http://java.sun.com/jsf/core"
+ xmlns:ui="http://java.sun.com/jsf/facelets">
+
+<ui:composition template="../../layout/template.xhtml">
+ <ui:define name="style">
+ .link {margin: 0px 5px}
+ </ui:define>
+ <ui:define name="component">
+ <rich:tabPanel id="panel1" switchType="ajax" >
+ <rich:tab label="tab1"
+ id="tab1"
+ action="#{tabPanelBean.action1}"
+ actionListener="#{tabPanelBean.actionListener}"
+ switchType="server"
+ >
+ </rich:tab>
+ <rich:tab label="tab2"
+ id="tab2"
+ action="#{tabPanelBean.action2}"
+ actionListener="#{tabPanelBean.actionListener}"
+ reRender="_value,_value2"
+ >
+ </rich:tab>
+ <rich:tab label="tab3"
+ id="tab3"
+ disabled="true"
+ >
+ </rich:tab>
+ <rich:tab label="tab4"
+ id="tab4"
+ switchType="client"
+ >
+ </rich:tab>
+ </rich:tabPanel>
+
+ <br/>
+ <h:inputText value="#{tabPanelBean.value}" id="_value"></h:inputText>
+ <h:outputText value="#{tabPanelBean.value2}" id="_value2"></h:outputText>
+ <br/>
+ </ui:define>
+ <ui:define name="description">
+ <ui:include src="tabPanelDescription.xhtml" />
+ </ui:define>
+</ui:composition>
+</html>
\ No newline at end of file
Modified: trunk/test-applications/seleniumTest/src/test/java/org/ajax4jsf/test/base/SeleniumTestBase.java
===================================================================
--- trunk/test-applications/seleniumTest/src/test/java/org/ajax4jsf/test/base/SeleniumTestBase.java 2008-04-17 17:02:40 UTC (rev 7905)
+++ trunk/test-applications/seleniumTest/src/test/java/org/ajax4jsf/test/base/SeleniumTestBase.java 2008-04-17 18:10:44 UTC (rev 7906)
@@ -154,12 +154,28 @@
/**
* Waits while AJAX request will be completed
*
- * @param miliseconds -
- * time to wait
*/
public void waitForAjaxCompletion() {
selenium.waitForCondition("selenium.browserbot.getCurrentWindow().done==true", String.valueOf(ajaxCompletionTime));
}
+
+ /**
+ * Waits while simple request will be completed
+ *
+ * @param miliseconds -
+ * time to wait
+ */
+ public void waitForPageToLoad(int miliseconds) {
+ selenium.waitForPageToLoad(String.valueOf(miliseconds));
+ }
+
+ /**
+ * Waits while simple request will be completed
+ *
+ */
+ public void waitForPageToLoad() {
+ selenium.waitForPageToLoad(String.valueOf(pageRenderTime));
+ }
/**
* Asserts DOM node value equals to value defined
Added: trunk/test-applications/seleniumTest/src/test/java/org/richfaces/TabPanelTest.java
===================================================================
--- trunk/test-applications/seleniumTest/src/test/java/org/richfaces/TabPanelTest.java (rev 0)
+++ trunk/test-applications/seleniumTest/src/test/java/org/richfaces/TabPanelTest.java 2008-04-17 18:10:44 UTC (rev 7906)
@@ -0,0 +1,79 @@
+package org.richfaces;
+
+import org.ajax4jsf.test.base.RichSeleniumTest;
+import org.ajax4jsf.test.base.SeleniumTestBase;
+import org.testng.Assert;
+import org.testng.annotations.AfterTest;
+import org.testng.annotations.BeforeTest;
+import org.testng.annotations.Parameters;
+import org.testng.annotations.Test;
+
+public class TabPanelTest extends SeleniumTestBase implements RichSeleniumTest {
+
+ public TabPanelTest() {
+ super("http", "localhost", "8080");
+ }
+
+ public TabPanelTest(String protocol, String host, String port) {
+ super(protocol, host, port);
+ // TODO Auto-generated constructor stub
+ }
+
+ /**
+ * This method are invoking before selenium tests started
+ */
+ @BeforeTest
+ @Parameters( { "browser" })
+ public void startSelenium(String browser) {
+ super.startSelenium(browser);
+ }
+
+ /**
+ * This method are invoking after selenium tests completed
+ */
+ @AfterTest
+ public void stopSelenium() {
+ super.stopSelenium();
+ }
+
+ @Test
+ public void testTabPanelComponent() throws Exception {
+ renderPage("/faces/pages/tabPanel/tabPanelTest.xhtml");
+
+ _testRichTabPanelComponent(COMPONENT_PREFIX_INSIDE_PANEL);
+ _testRichTabPanelComponent(COMPONENT_PREFIX_INSIDE_TABLE);
+ }
+
+ private void _testRichTabPanelComponent(String parentId) {
+ String linkId = parentId + "tab2_lbl";
+ String tabId1 = parentId + "tab1";
+ String tabId2 = parentId + "tab2";
+ String tabId4 = parentId + "tab4";
+ String inputId = parentId + "_value";
+ String outputId = parentId + "_value2";
+
+ clickById(linkId);
+ waitForAjaxCompletion();
+ AssertValueEquals(inputId, "tab2");
+ Assert.assertTrue(isVisibleById(tabId2));
+ AssertTextEquals(outputId, "2");
+
+
+ linkId = parentId + "tab1_lbl";
+ clickById(linkId);
+ waitForPageToLoad();
+ AssertValueEquals(inputId, "tab1");
+ Assert.assertTrue(isVisibleById(tabId1));
+ AssertTextEquals(outputId, "1");
+
+ linkId = parentId + "tab3_lbl";
+ clickById(linkId);
+ AssertValueEquals(inputId, "tab1");
+ Assert.assertTrue(isVisibleById(tabId1));
+
+ linkId = parentId + "tab4_lbl";
+ clickById(linkId);
+ Assert.assertTrue(isVisibleById(tabId4));
+ }
+
+}
16 years, 9 months
JBoss Rich Faces SVN: r7905 - branches/3.1.x/test-applications/jsp/src/main/webapp/InputNumberSpinner.
by richfaces-svn-commits@lists.jboss.org
Author: mvitenkov
Date: 2008-04-17 13:02:40 -0400 (Thu, 17 Apr 2008)
New Revision: 7905
Modified:
branches/3.1.x/test-applications/jsp/src/main/webapp/InputNumberSpinner/InputNumberSpinner.jsp
Log:
change event from on* to oninput*
Modified: branches/3.1.x/test-applications/jsp/src/main/webapp/InputNumberSpinner/InputNumberSpinner.jsp
===================================================================
--- branches/3.1.x/test-applications/jsp/src/main/webapp/InputNumberSpinner/InputNumberSpinner.jsp 2008-04-17 16:42:11 UTC (rev 7904)
+++ branches/3.1.x/test-applications/jsp/src/main/webapp/InputNumberSpinner/InputNumberSpinner.jsp 2008-04-17 17:02:40 UTC (rev 7905)
@@ -11,14 +11,14 @@
step="#{inputNumberSpinner.step}" rendered="#{inputNumberSpinner.rendered}" value="#{inputNumberSpinner.value}"
inputClass="#{inputNumberSpinner.inputStyle}" styleClass="#{inputNumberSpinner.style}"
enableManualInput="#{inputNumberSpinner.manualInput}" inputSize="#{inputNumberSpinner.inputSize}"
- onmousedown="showEvent('onmousedownInputID', 'onmousedown work!')" onblur="showEvent('onblurInputID', 'onblur work!')"
+ oninputmousedown="showEvent('onmousedownInputID', 'onmousedown work!')" onblur="showEvent('onblurInputID', 'onblur work!')"
onchange="showEvent('onchangeInputID', 'onchange work!')" onclick="showEvent('onclickInputID', 'onclick work!')"
ondblclick="showEvent('ondblclickInputID', 'ondblclick work!')" onerror="showEvent('ondblclickInputID', 'ondblclick work!')"
onfocus="showEvent('onfocusInputID', 'onfocus work!')" onselect="showEvent('onselectInputID', 'onselect work!')"
- onkeydown="showEvent('onkeydownInputID', 'onkeydown work!')" onkeypress="showEvent('onkeypressInputID', 'onkeypress work!')"
- onkeyup="showEvent('onkeyupInputID', 'onkeyup work!')" onmousemove="showEvent('onmousemoveInputID', 'onmousemove work!')"
- onmouseout="showEvent('onmouseoutInputID', 'onmouseout work!')" onmouseover="showEvent('onmouseoverInputID', 'onmouseover work!')"
- onmouseup="showEvent('onmouseupInputID', 'onmouseup work!')" ondownclick="showEvent('ondownclickInputID', 'ondownclick work!')"
+ oninputkeydown="showEvent('onkeydownInputID', 'onkeydown work!')" oninputkeypress="showEvent('onkeypressInputID', 'onkeypress work!')"
+ oninputkeyup="showEvent('onkeyupInputID', 'onkeyup work!')" oninputmousemove="showEvent('onmousemoveInputID', 'onmousemove work!')"
+ oninputmouseout="showEvent('onmouseoutInputID', 'onmouseout work!')" oninputmouseover="showEvent('onmouseoverInputID', 'onmouseover work!')"
+ oninputmouseup="showEvent('onmouseupInputID', 'onmouseup work!')" ondownclick="showEvent('ondownclickInputID', 'ondownclick work!')"
onupclick="showEvent('onupclickInputID', 'onupclick work!')"></rich:inputNumberSpinner>
<rich:spacer height="20px"></rich:spacer>
</f:subview>
16 years, 9 months
JBoss Rich Faces SVN: r7904 - branches/3.1.x/test-applications/jsp/src/main/webapp/InputNumberSlider.
by richfaces-svn-commits@lists.jboss.org
Author: mvitenkov
Date: 2008-04-17 12:42:11 -0400 (Thu, 17 Apr 2008)
New Revision: 7904
Modified:
branches/3.1.x/test-applications/jsp/src/main/webapp/InputNumberSlider/InputNumberSlider.jsp
branches/3.1.x/test-applications/jsp/src/main/webapp/InputNumberSlider/InputNumberSliderProperty.jsp
Log:
Modified: branches/3.1.x/test-applications/jsp/src/main/webapp/InputNumberSlider/InputNumberSlider.jsp
===================================================================
--- branches/3.1.x/test-applications/jsp/src/main/webapp/InputNumberSlider/InputNumberSlider.jsp 2008-04-17 16:41:29 UTC (rev 7903)
+++ branches/3.1.x/test-applications/jsp/src/main/webapp/InputNumberSlider/InputNumberSlider.jsp 2008-04-17 16:42:11 UTC (rev 7904)
@@ -15,7 +15,8 @@
step="#{inputNumberSlider.step}" showInput="#{inputNumberSlider.showInput}" width="#{inputNumberSlider.width}"
barClass="#{inputNumberSlider.barStyle}" tipClass="#{inputNumberSlider.tipStyle}" inputClass="#{inputNumberSlider.inputStyle}"
handleClass="#{inputNumberSlider.handleStyle}" styleClass="#{inputNumberSlider.tipStyle}"
- maxlength="#{inputNumberSlider.maxlength}" onmousedown="showEvent('onmousedownInputID', 'onmousedown work!')" >
+ maxlength="#{inputNumberSlider.maxlength}" onmousedown="showEvent('onmousedownInputID', 'onmousedown work!')"
+ accesskey="y" binding="#{inputNumberSlider.myInputSlider}">
</rich:inputNumberSlider>
<h:panelGroup>
<a4j:commandButton value="valueChangeListener (show)" reRender="valueCLID" />
Modified: branches/3.1.x/test-applications/jsp/src/main/webapp/InputNumberSlider/InputNumberSliderProperty.jsp
===================================================================
--- branches/3.1.x/test-applications/jsp/src/main/webapp/InputNumberSlider/InputNumberSliderProperty.jsp 2008-04-17 16:41:29 UTC (rev 7903)
+++ branches/3.1.x/test-applications/jsp/src/main/webapp/InputNumberSlider/InputNumberSliderProperty.jsp 2008-04-17 16:42:11 UTC (rev 7904)
@@ -4,101 +4,109 @@
<%@ taglib uri="http://richfaces.org/rich" prefix="rich"%>
<f:subview id="inputNumberSliderPropertySubviewID">
- <h:panelGrid columns="2" cellspacing="10px" border="1">
- <h:outputText value="value" />
- <h:inputText value="#{inputNumberSlider.value}">
- <a4j:support event="onchange" reRender="SliderId"></a4j:support>
- </h:inputText>
+ <h:panelGrid columns="2" cellspacing="10px" border="1">
+ <h:outputText value="value" />
+ <h:inputText value="#{inputNumberSlider.value}">
+ <a4j:support event="onchange" reRender="SliderId"></a4j:support>
+ </h:inputText>
- <h:outputText value="inputPosition"></h:outputText>
- <h:selectOneRadio value="#{inputNumberSlider.inputPosition}">
- <f:selectItem itemLabel="right" itemValue="right" />
- <f:selectItem itemLabel="left" itemValue="left" />
- <a4j:support event="onchange" reRender="SliderId"></a4j:support>
- </h:selectOneRadio>
+ <h:outputText value="inputPosition"></h:outputText>
+ <h:selectOneRadio value="#{inputNumberSlider.inputPosition}">
+ <f:selectItem itemLabel="right" itemValue="right" />
+ <f:selectItem itemLabel="left" itemValue="left" />
+ <a4j:support event="onchange" reRender="SliderId"></a4j:support>
+ </h:selectOneRadio>
- <h:outputText value="Width:"></h:outputText>
- <h:inputText value="#{inputNumberSlider.width}">
- <a4j:support event="onchange" reRender="SliderId"></a4j:support>
- </h:inputText>
+ <h:outputText value="Width:"></h:outputText>
+ <h:inputText value="#{inputNumberSlider.width}">
+ <a4j:support event="onchange" reRender="SliderId"></a4j:support>
+ </h:inputText>
- <h:outputText value="Max Value:"></h:outputText>
- <h:inputText value="#{inputNumberSlider.maxValue}">
- <a4j:support event="onchange" reRender="SliderId"></a4j:support>
- </h:inputText>
+ <h:outputText value="Max Value:"></h:outputText>
+ <h:inputText value="#{inputNumberSlider.maxValue}">
+ <a4j:support event="onchange" reRender="SliderId"></a4j:support>
+ </h:inputText>
- <h:outputText value="Min Value:"></h:outputText>
- <h:inputText value="#{inputNumberSlider.minValue}">
- <a4j:support event="onchange" reRender="SliderId"></a4j:support>
- </h:inputText>
+ <h:outputText value="Min Value:"></h:outputText>
+ <h:inputText value="#{inputNumberSlider.minValue}">
+ <a4j:support event="onchange" reRender="SliderId"></a4j:support>
+ </h:inputText>
- <h:outputText value="Input Size:"></h:outputText>
- <h:inputText value="#{inputNumberSlider.inputSize}">
- <a4j:support event="onchange" reRender="SliderId"></a4j:support>
- </h:inputText>
+ <h:outputText value="Input Size:"></h:outputText>
+ <h:inputText value="#{inputNumberSlider.inputSize}">
+ <a4j:support event="onchange" reRender="SliderId"></a4j:support>
+ </h:inputText>
- <h:outputText value="Input MaxLength:"></h:outputText>
- <h:inputText value="#{inputNumberSlider.maxlength}">
- <a4j:support event="onchange" reRender="SliderId"></a4j:support>
- </h:inputText>
+ <h:outputText value="Input MaxLength:"></h:outputText>
+ <h:inputText value="#{inputNumberSlider.maxlength}">
+ <a4j:support event="onchange" reRender="SliderId"></a4j:support>
+ </h:inputText>
- <h:outputText value="Step:"></h:outputText>
- <h:inputText value="#{inputNumberSlider.step}">
- <a4j:support event="onchange" reRender="SliderId"></a4j:support>
- </h:inputText>
+ <h:outputText value="Step:"></h:outputText>
+ <h:inputText value="#{inputNumberSlider.step}">
+ <a4j:support event="onchange" reRender="SliderId"></a4j:support>
+ </h:inputText>
- <h:outputText value="tabindex" />
- <h:inputText value="#{inputNumberSlider.tabindex}">
- <a4j:support event="onchange" reRender="SliderId"></a4j:support>
- </h:inputText>
+ <h:outputText value="tabindex" />
+ <h:inputText value="#{inputNumberSlider.tabindex}">
+ <a4j:support event="onchange" reRender="SliderId"></a4j:support>
+ </h:inputText>
- <h:outputText value="Disabled:"></h:outputText>
- <h:selectBooleanCheckbox value="#{inputNumberSlider.disabled}">
- <a4j:support event="onchange" reRender="SliderId"></a4j:support>
- </h:selectBooleanCheckbox>
+ <h:outputText value="Disabled:"></h:outputText>
+ <h:selectBooleanCheckbox value="#{inputNumberSlider.disabled}">
+ <a4j:support event="onchange" reRender="SliderId"></a4j:support>
+ </h:selectBooleanCheckbox>
- <h:outputText value="Rendered:"></h:outputText>
- <h:selectBooleanCheckbox value="#{inputNumberSlider.rendered}" onclick="submit()">
- </h:selectBooleanCheckbox>
+ <h:outputText value="Rendered:"></h:outputText>
+ <h:selectBooleanCheckbox value="#{inputNumberSlider.rendered}"
+ onclick="submit()">
+ </h:selectBooleanCheckbox>
- <h:outputText value="Manual Input:"></h:outputText>
- <h:selectBooleanCheckbox value="#{inputNumberSlider.enableManualInput}">
- <a4j:support event="onchange" reRender="SliderId"></a4j:support>
- </h:selectBooleanCheckbox>
+ <h:outputText value="Manual Input:"></h:outputText>
+ <h:selectBooleanCheckbox
+ value="#{inputNumberSlider.enableManualInput}">
+ <a4j:support event="onchange" reRender="SliderId"></a4j:support>
+ </h:selectBooleanCheckbox>
- <h:outputText value="Boundary Values:"></h:outputText>
- <h:selectBooleanCheckbox value="#{inputNumberSlider.showBoundaryValues}">
- <a4j:support event="onchange" reRender="SliderId"></a4j:support>
- </h:selectBooleanCheckbox>
+ <h:outputText value="Boundary Values:"></h:outputText>
+ <h:selectBooleanCheckbox
+ value="#{inputNumberSlider.showBoundaryValues}">
+ <a4j:support event="onchange" reRender="SliderId"></a4j:support>
+ </h:selectBooleanCheckbox>
- <h:outputText value="Show Input:"></h:outputText>
- <h:selectBooleanCheckbox value="#{inputNumberSlider.showInput}">
- <a4j:support event="onchange" reRender="SliderId"></a4j:support>
- </h:selectBooleanCheckbox>
+ <h:outputText value="Show Input:"></h:outputText>
+ <h:selectBooleanCheckbox value="#{inputNumberSlider.showInput}">
+ <a4j:support event="onchange" reRender="SliderId"></a4j:support>
+ </h:selectBooleanCheckbox>
- <h:outputText value="showToolTip" />
- <h:selectBooleanCheckbox value="#{inputNumberSlider.showToolTip}">
- <a4j:support event="onchange" reRender="SliderId"></a4j:support>
- </h:selectBooleanCheckbox>
+ <h:outputText value="showToolTip" />
+ <h:selectBooleanCheckbox value="#{inputNumberSlider.showToolTip}">
+ <a4j:support event="onchange" reRender="SliderId"></a4j:support>
+ </h:selectBooleanCheckbox>
- <h:outputText value="required" />
- <h:selectBooleanCheckbox value="#{inputNumberSlider.required}">
- <a4j:support event="onchange" reRender="SliderId"></a4j:support>
- </h:selectBooleanCheckbox>
+ <h:outputText value="required" />
+ <h:selectBooleanCheckbox value="#{inputNumberSlider.required}">
+ <a4j:support event="onchange" reRender="SliderId"></a4j:support>
+ </h:selectBooleanCheckbox>
- <h:outputText value="requiredMessage" />
- <h:inputText value="#{inputNumberSlider.requiredMessage}">
- <a4j:support event="onchange" reRender="SliderId"></a4j:support>
- </h:inputText>
+ <h:outputText value="requiredMessage" />
+ <h:inputText value="#{inputNumberSlider.requiredMessage}">
+ <a4j:support event="onchange" reRender="SliderId"></a4j:support>
+ </h:inputText>
- <h:outputText value="immediate" />
- <h:selectBooleanCheckbox value="#{inputNumberSlider.immediate}">
- <a4j:support event="onchange" reRender="SliderId"></a4j:support>
- </h:selectBooleanCheckbox>
+ <h:outputText value="immediate" />
+ <h:selectBooleanCheckbox value="#{inputNumberSlider.immediate}">
+ <a4j:support event="onchange" reRender="SliderId"></a4j:support>
+ </h:selectBooleanCheckbox>
- <h:outputText value="Switch Styles" />
- <a4j:commandButton id="slBtn" value="#{inputNumberSlider.btnLabel}" action="#{inputNumberSlider.doStyles}"
- reRender="SliderId,slBtn">
- </a4j:commandButton>
- </h:panelGrid>
+ <h:outputText value="Switch Styles" />
+ <a4j:commandButton id="slBtn" value="#{inputNumberSlider.btnLabel}"
+ action="#{inputNumberSlider.doStyles}" reRender="SliderId,slBtn"
+ accesskey="i">
+ </a4j:commandButton>
+
+ <h:commandButton actionListener="#{inputNumberSlider.checkBinding}"
+ value="Binding" />
+ <h:outputText value="#{inputNumberSlider.bindLabel}" />
+ </h:panelGrid>
</f:subview>
\ No newline at end of file
16 years, 9 months
JBoss Rich Faces SVN: r7903 - branches/3.1.x/test-applications/jsp/src/main/java/inputNumberSlider.
by richfaces-svn-commits@lists.jboss.org
Author: mvitenkov
Date: 2008-04-17 12:41:29 -0400 (Thu, 17 Apr 2008)
New Revision: 7903
Modified:
branches/3.1.x/test-applications/jsp/src/main/java/inputNumberSlider/InputNumberSlider.java
Log:
+binding
+accessKey
Modified: branches/3.1.x/test-applications/jsp/src/main/java/inputNumberSlider/InputNumberSlider.java
===================================================================
--- branches/3.1.x/test-applications/jsp/src/main/java/inputNumberSlider/InputNumberSlider.java 2008-04-17 16:24:09 UTC (rev 7902)
+++ branches/3.1.x/test-applications/jsp/src/main/java/inputNumberSlider/InputNumberSlider.java 2008-04-17 16:41:29 UTC (rev 7903)
@@ -1,6 +1,9 @@
package inputNumberSlider;
import javax.faces.event.ValueChangeEvent;
+import org.richfaces.component.html.HtmlInputNumberSlider;
+import javax.faces.context.FacesContext;
+import javax.faces.event.ActionEvent;
public class InputNumberSlider {
@@ -20,6 +23,7 @@
private String tipStyle;
private String handleStyle;
private String valueChangeListener;
+ private String bindLabel;
private boolean immediate;
private boolean required;
private boolean showToolTip;
@@ -28,7 +32,29 @@
private boolean rendered;
private boolean enableManualInput;
private boolean showBoundaryValues;
+ private HtmlInputNumberSlider myInputSlider;
+ public String getBindLabel() {
+ return bindLabel;
+ }
+
+ public void setBindLabel(String bindLabel) {
+ this.bindLabel = bindLabel;
+ }
+
+ public HtmlInputNumberSlider getMyInputSlider() {
+ return myInputSlider;
+ }
+
+ public void setMyInputSlider(HtmlInputNumberSlider myInputSlider) {
+ this.myInputSlider = myInputSlider;
+ }
+
+ public void checkBinding(ActionEvent actionEvent){
+ FacesContext context = FacesContext.getCurrentInstance();
+ bindLabel = myInputSlider.getClientId(context).toString();
+ }
+
public InputNumberSlider() {
immediate = false;
rendered = false;
@@ -44,6 +70,7 @@
maxValue="100";
step="5";
btnLabel="On";
+ bindLabel = "default";
barStyle=null;
inputStyle=null;
tipStyle=null;
@@ -53,6 +80,7 @@
rendered=true;
enableManualInput = true;
showBoundaryValues=true;
+ myInputSlider = new HtmlInputNumberSlider();
}
public void changeListener(ValueChangeEvent event) {
16 years, 9 months
JBoss Rich Faces SVN: r7902 - trunk/ui/progressBAR/src/main/resources/org/richfaces/renderkit/html/js.
by richfaces-svn-commits@lists.jboss.org
Author: andrei_exadel
Date: 2008-04-17 12:24:09 -0400 (Thu, 17 Apr 2008)
New Revision: 7902
Modified:
trunk/ui/progressBAR/src/main/resources/org/richfaces/renderkit/html/js/progressBar.js
Log:
RF-3124
Modified: trunk/ui/progressBAR/src/main/resources/org/richfaces/renderkit/html/js/progressBar.js
===================================================================
--- trunk/ui/progressBAR/src/main/resources/org/richfaces/renderkit/html/js/progressBar.js 2008-04-17 15:55:00 UTC (rev 7901)
+++ trunk/ui/progressBAR/src/main/resources/org/richfaces/renderkit/html/js/progressBar.js 2008-04-17 16:24:09 UTC (rev 7902)
@@ -54,7 +54,7 @@
this.renderLabel(data['markup'], data['context']);
} else if (this.state == "initialState" && this.value > this.getMinValue()) {
this.state = "progressState";
- this.forceState("progressState", function () { this.poll() }.bind(this));
+ this.forceState("progressState", function () { $(this.id).component.enable(); }.bind(this));
return;
}
this.poll();
16 years, 9 months
JBoss Rich Faces SVN: r7901 - branches/3.1.x/test-applications/jsp/src/main/webapp/DropDownMenu.
by richfaces-svn-commits@lists.jboss.org
Author: mvitenkov
Date: 2008-04-17 11:55:00 -0400 (Thu, 17 Apr 2008)
New Revision: 7901
Modified:
branches/3.1.x/test-applications/jsp/src/main/webapp/DropDownMenu/DropDownMenu.jsp
branches/3.1.x/test-applications/jsp/src/main/webapp/DropDownMenu/DropDownMenuProperty.jsp
Log:
+binding
+disabled
Modified: branches/3.1.x/test-applications/jsp/src/main/webapp/DropDownMenu/DropDownMenu.jsp
===================================================================
--- branches/3.1.x/test-applications/jsp/src/main/webapp/DropDownMenu/DropDownMenu.jsp 2008-04-17 15:48:07 UTC (rev 7900)
+++ branches/3.1.x/test-applications/jsp/src/main/webapp/DropDownMenu/DropDownMenu.jsp 2008-04-17 15:55:00 UTC (rev 7901)
@@ -11,14 +11,15 @@
direction="#{dDMenu.direction}" horizontalOffset="#{dDMenu.horizontalOffset}" jointPoint="#{dDMenu.jointPoint}"
popupWidth="#{dDMenu.popupWidth}" showDelay="#{dDMenu.showDelay}" rendered="#{dDMenu.rendered}"
verticalOffset="#{dDMenu.verticalOffset}" styleClass="panelpos" event="#{dDMenu.event}"
+ disabled="#{dDMenu.disabled}"
oncollapse="showEvent('oncollapseInputID', 'oncollapse work!')" onexpand="showEvent('onexpandInputID', 'onexpand work!')"
ongroupactivate="showEvent('ongroupactivateInputID', 'ongroupactivate work!')"
onitemselect="showEvent('onitemselectInputID', 'onitemselect work!')"
onmousemove="showEvent('onmousemoveInputID', 'onmousemove work!')" onmouseout="showEvent('onmouseoutInputID', 'onmouseout work!')"
- onmouseover="showEvent('onmouseoverInputID', 'onmouseover work!')">
+ onmouseover="showEvent('onmouseoverInputID', 'onmouseover work!')" binding="#{dDMenu.mydDMenu}" >
<rich:menuItem icon="#{dDMenu.icon}" onclick="showEvent('onclickInputID', 'onclick work (item)!')"
oncomplete="showEvent('oncompleteInputID', 'oncomplete work (item)!')" onmousedown="showEvent('onmousedownInputID', 'onmousedown work (item)!')"
- onmousemove="showEvent('onmousemoveInputID', ' work (item)!')" onmouseout="showEvent('onmouseoutInputID', 'onmouseout work (item)!')"
+ onmousemove="showEvent('onmousemoveInputID', ' work (item)!')" onmouseout="alert('Hi!');"
onmouseover="showEvent('onmouseoverInputID', 'onmouseover work (item)!')" onmouseup="showEvent('onmouseupInputID', 'onmouseup work (item)!')"
onselect="showEvent('onselectInputID', 'onselect work (item)!')">
<h:outputText value="Item1(test events)" />
Modified: branches/3.1.x/test-applications/jsp/src/main/webapp/DropDownMenu/DropDownMenuProperty.jsp
===================================================================
--- branches/3.1.x/test-applications/jsp/src/main/webapp/DropDownMenu/DropDownMenuProperty.jsp 2008-04-17 15:48:07 UTC (rev 7900)
+++ branches/3.1.x/test-applications/jsp/src/main/webapp/DropDownMenu/DropDownMenuProperty.jsp 2008-04-17 15:55:00 UTC (rev 7901)
@@ -4,86 +4,95 @@
<%@ taglib uri="http://richfaces.org/rich" prefix="rich"%>
<f:subview id="dropDownMenuPropertySubviewID">
- <h:panelGrid columns="2">
- <h:outputText value="HideDelay (ms):" />
- <h:inputText value="#{dDMenu.hideDelay}">
- <a4j:support event="onchange" reRender="ddmId" />
- </h:inputText>
+ <h:panelGrid columns="2">
+ <h:outputText value="HideDelay (ms):" />
+ <h:inputText value="#{dDMenu.hideDelay}">
+ <a4j:support event="onchange" reRender="ddmId" />
+ </h:inputText>
- <h:outputText value="ShowDelay (ms):" />
- <h:inputText value="#{dDMenu.showDelay}">
- <a4j:support event="onchange" reRender="ddmId" />
- </h:inputText>
+ <h:outputText value="ShowDelay (ms):" />
+ <h:inputText value="#{dDMenu.showDelay}">
+ <a4j:support event="onchange" reRender="ddmId" />
+ </h:inputText>
- <h:outputText value="PopupWidth (px):" />
- <h:inputText value="#{dDMenu.popupWidth}">
- <a4j:support event="onchange" reRender="ddmId" />
- </h:inputText>
+ <h:outputText value="PopupWidth (px):" />
+ <h:inputText value="#{dDMenu.popupWidth}">
+ <a4j:support event="onchange" reRender="ddmId" />
+ </h:inputText>
- <h:outputText value="horizontalOffset (px):" />
- <h:inputText value="#{dDMenu.horizontalOffset}">
- <a4j:support event="onchange" reRender="ddmId" />
- </h:inputText>
+ <h:outputText value="horizontalOffset (px):" />
+ <h:inputText value="#{dDMenu.horizontalOffset}">
+ <a4j:support event="onchange" reRender="ddmId" />
+ </h:inputText>
- <h:outputText value="verticalOffset (px):" />
- <h:inputText value="#{dDMenu.verticalOffset}">
- <a4j:support event="onchange" reRender="ddmId" />
- </h:inputText>
+ <h:outputText value="verticalOffset (px):" />
+ <h:inputText value="#{dDMenu.verticalOffset}">
+ <a4j:support event="onchange" reRender="ddmId" />
+ </h:inputText>
- <h:outputText value="Mode:" />
- <h:selectOneRadio value="#{dDMenu.mode}">
- <f:selectItem itemLabel="none" itemValue="none" />
- <f:selectItem itemLabel="ajax" itemValue="ajax" />
- <f:selectItem itemLabel="server" itemValue="server" />
- <a4j:support event="onclick" reRender="ddmId" />
- </h:selectOneRadio>
+ <h:outputText value="Mode:" />
+ <h:selectOneRadio value="#{dDMenu.mode}">
+ <f:selectItem itemLabel="none" itemValue="none" />
+ <f:selectItem itemLabel="ajax" itemValue="ajax" />
+ <f:selectItem itemLabel="server" itemValue="server" />
+ <a4j:support event="onclick" reRender="ddmId" />
+ </h:selectOneRadio>
- <h:outputText value="Direction:" />
- <h:selectOneRadio value="#{dDMenu.direction}">
- <f:selectItem itemLabel="top-right" itemValue="top-right" />
- <f:selectItem itemLabel="top-left" itemValue="top-left" />
- <f:selectItem itemLabel="bottom-right" itemValue="bottom-right" />
- <f:selectItem itemLabel="bottom-left" itemValue="bottom-left" />
- <f:selectItem itemLabel="auto" itemValue="auto" />
- <a4j:support event="onclick" reRender="ddmId" />
- </h:selectOneRadio>
+ <h:outputText value="Direction:" />
+ <h:selectOneRadio value="#{dDMenu.direction}">
+ <f:selectItem itemLabel="top-right" itemValue="top-right" />
+ <f:selectItem itemLabel="top-left" itemValue="top-left" />
+ <f:selectItem itemLabel="bottom-right" itemValue="bottom-right" />
+ <f:selectItem itemLabel="bottom-left" itemValue="bottom-left" />
+ <f:selectItem itemLabel="auto" itemValue="auto" />
+ <a4j:support event="onclick" reRender="ddmId" />
+ </h:selectOneRadio>
- <h:outputText value="GroupDirection:" />
- <h:selectOneRadio value="#{dDMenu.groupDirection}">
- <f:selectItem itemLabel="top-up" itemValue="top-up" />
- <f:selectItem itemLabel="top-down" itemValue="top-down" />
- <f:selectItem itemLabel="bottom-up" itemValue="bottom-up" />
- <f:selectItem itemLabel="bottom-down" itemValue="bottom-down" />
- <f:selectItem itemLabel="auto" itemValue="auto" />
- <a4j:support event="onclick" reRender="ddmId" />
- </h:selectOneRadio>
+ <h:outputText value="GroupDirection:" />
+ <h:selectOneRadio value="#{dDMenu.groupDirection}">
+ <f:selectItem itemLabel="top-up" itemValue="top-up" />
+ <f:selectItem itemLabel="top-down" itemValue="top-down" />
+ <f:selectItem itemLabel="bottom-up" itemValue="bottom-up" />
+ <f:selectItem itemLabel="bottom-down" itemValue="bottom-down" />
+ <f:selectItem itemLabel="auto" itemValue="auto" />
+ <a4j:support event="onclick" reRender="ddmId" />
+ </h:selectOneRadio>
- <h:outputText value="JointPoint:" />
- <h:selectOneRadio value="#{dDMenu.jointPoint}">
- <f:selectItem itemLabel="top-right" itemValue="tr" />
- <f:selectItem itemLabel="top-left" itemValue="tl" />
- <f:selectItem itemLabel="bottom-right" itemValue="br" />
- <f:selectItem itemLabel="bottom-left" itemValue="bl" />
- <f:selectItem itemLabel="auto" itemValue="auto" />
- <a4j:support event="onclick" reRender="ddmId" />
- </h:selectOneRadio>
+ <h:outputText value="JointPoint:" />
+ <h:selectOneRadio value="#{dDMenu.jointPoint}">
+ <f:selectItem itemLabel="top-right" itemValue="tr" />
+ <f:selectItem itemLabel="top-left" itemValue="tl" />
+ <f:selectItem itemLabel="bottom-right" itemValue="br" />
+ <f:selectItem itemLabel="bottom-left" itemValue="bl" />
+ <f:selectItem itemLabel="auto" itemValue="auto" />
+ <a4j:support event="onclick" reRender="ddmId" />
+ </h:selectOneRadio>
- <h:outputText value="Menu appearance event:" />
- <h:selectOneRadio value="#{dDMenu.event}" onclick="submit()">
- <f:selectItem itemLabel="onclick" itemValue="onclick" />
- <f:selectItem itemLabel="onmouseover" itemValue="onmouseover" />
- <a4j:support event="onclick" reRender="ddmId" />
- </h:selectOneRadio>
+ <h:outputText value="Menu appearance event:" />
+ <h:selectOneRadio value="#{dDMenu.event}" onclick="submit()">
+ <f:selectItem itemLabel="onclick" itemValue="onclick" />
+ <f:selectItem itemLabel="onmouseover" itemValue="onmouseover" />
+ <a4j:support event="onclick" reRender="ddmId" />
+ </h:selectOneRadio>
- <h:outputText value="Rendered:" />
- <h:selectBooleanCheckbox value="#{dDMenu.rendered}" onclick="submit()">
+ <h:outputText value="Rendered:" />
+ <h:selectBooleanCheckbox value="#{dDMenu.rendered}" onclick="submit()">
- </h:selectBooleanCheckbox>
+ </h:selectBooleanCheckbox>
- <h:outputText value="Disable some items:" />
- <h:selectBooleanCheckbox value="#{dDMenu.disabled}">
- <a4j:support reRender="ddmId" event="onclick" />
- </h:selectBooleanCheckbox>
- <h:commandButton action="#{dDMenu.changeIcons}" value="ChangeIcons" />
- </h:panelGrid>
+ <h:outputText value="Disable some items:" />
+ <h:selectBooleanCheckbox value="#{dDMenu.disabled}">
+ <a4j:support reRender="ddmId" event="onclick" />
+ </h:selectBooleanCheckbox>
+
+ <h:commandButton actionListener="#{dDMenu.checkBinding}"
+ value="Binding" />
+ <h:outputText value="#{dDMenu.bindLabel}" />
+
+ <h:outputText value="disabled"/>
+ <h:selectBooleanCheckbox value="#{dDMenu.disabled}" onclick="submit();">
+ </h:selectBooleanCheckbox>
+
+ <h:commandButton action="#{dDMenu.changeIcons}" value="ChangeIcons" />
+ </h:panelGrid>
</f:subview>
\ No newline at end of file
16 years, 9 months