JBoss Rich Faces SVN: r8121 - trunk/ui/core/src/main/templates/org/ajax4jsf/renderkit/html.
by richfaces-svn-commits@lists.jboss.org
Author: vbaranov
Date: 2008-04-24 09:20:52 -0400 (Thu, 24 Apr 2008)
New Revision: 8121
Modified:
trunk/ui/core/src/main/templates/org/ajax4jsf/renderkit/html/button.jspx
Log:
http://jira.jboss.com/jira/browse/RF-3202
Modified: trunk/ui/core/src/main/templates/org/ajax4jsf/renderkit/html/button.jspx
===================================================================
--- trunk/ui/core/src/main/templates/org/ajax4jsf/renderkit/html/button.jspx 2008-04-24 13:15:49 UTC (rev 8120)
+++ trunk/ui/core/src/main/templates/org/ajax4jsf/renderkit/html/button.jspx 2008-04-24 13:20:52 UTC (rev 8121)
@@ -40,7 +40,7 @@
name="#{clientId}"
value=""
x:value="#{this:getValue(component)}"
- x:passThruWithExclusions="value,name,onclick,type,id"
+ x:passThruWithExclusions="value,name,onclick,type,id,class"
onclick="#{this:getOnClick(context,component)}"
class="#{component.attributes['styleClass']}"
>
16 years, 8 months
JBoss Rich Faces SVN: r8120 - trunk/framework/impl/src/main/java/org/richfaces/renderkit/html/images.
by richfaces-svn-commits@lists.jboss.org
Author: nbelaevski
Date: 2008-04-24 09:15:49 -0400 (Thu, 24 Apr 2008)
New Revision: 8120
Modified:
trunk/framework/impl/src/main/java/org/richfaces/renderkit/html/images/GradientAlignment.java
Log:
GradientAlignment: CENTER renamed to MIDDLE
Modified: trunk/framework/impl/src/main/java/org/richfaces/renderkit/html/images/GradientAlignment.java
===================================================================
--- trunk/framework/impl/src/main/java/org/richfaces/renderkit/html/images/GradientAlignment.java 2008-04-24 13:08:04 UTC (rev 8119)
+++ trunk/framework/impl/src/main/java/org/richfaces/renderkit/html/images/GradientAlignment.java 2008-04-24 13:15:49 UTC (rev 8120)
@@ -43,7 +43,7 @@
}
},
- CENTER {
+ MIDDLE {
@Override
public int getBottomRectangleHeight(int imageHeight, int gradientHeight) {
return max((imageHeight - gradientHeight) / 2, 0);
16 years, 8 months
JBoss Rich Faces SVN: r8119 - in trunk/framework/impl/src/main/java/org/richfaces/renderkit/html: images and 1 other directory.
by richfaces-svn-commits@lists.jboss.org
Author: nbelaevski
Date: 2008-04-24 09:08:04 -0400 (Thu, 24 Apr 2008)
New Revision: 8119
Added:
trunk/framework/impl/src/main/java/org/richfaces/renderkit/html/CustomizeableGradient.java
Modified:
trunk/framework/impl/src/main/java/org/richfaces/renderkit/html/BaseGradient.java
trunk/framework/impl/src/main/java/org/richfaces/renderkit/html/images/GradientAlignment.java
trunk/framework/impl/src/main/java/org/richfaces/renderkit/html/images/GradientType.java
Log:
CustomizeableGradient added
Customization removed from BaseGradient
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-24 12:37:10 UTC (rev 8118)
+++ trunk/framework/impl/src/main/java/org/richfaces/renderkit/html/BaseGradient.java 2008-04-24 13:08:04 UTC (rev 8119)
@@ -21,7 +21,6 @@
package org.richfaces.renderkit.html;
-import java.awt.Color;
import java.awt.Dimension;
import java.awt.GradientPaint;
import java.awt.Graphics2D;
@@ -30,7 +29,6 @@
import java.awt.geom.Rectangle2D;
import java.io.Serializable;
import java.util.Date;
-import java.util.Map;
import javax.faces.context.FacesContext;
@@ -40,7 +38,6 @@
import org.ajax4jsf.resource.ResourceContext;
import org.ajax4jsf.util.HtmlColor;
import org.ajax4jsf.util.Zipper2;
-import org.richfaces.renderkit.html.images.GradientAlignment;
import org.richfaces.renderkit.html.images.GradientType;
import org.richfaces.renderkit.html.images.GradientType.BiColor;
import org.richfaces.skin.Skin;
@@ -60,20 +57,25 @@
private String gradientColor;
private boolean horizontal = false;
- public BaseGradient(int width, int height, int gradientHeight) {
+ public BaseGradient(int width, int height, int gradientHeight, String baseColor, String gradientColor, boolean horizontal) {
super();
this.width = width;
this.height = height;
this.gradientHeight = gradientHeight;
+ this.baseColor = baseColor != null ? baseColor : Skin.headerBackgroundColor;
+ this.gradientColor = gradientColor != null ? gradientColor : Skin.headerGradientColor;
+ this.horizontal = horizontal;
setRenderer(new PngRenderer());
setLastModified(new Date(InternetResourceBuilder.getInstance().getStartTime()));
}
+
+ public BaseGradient(int width, int height, int gradientHeight) {
+ this(width, height, gradientHeight, null, null, false);
+ }
public BaseGradient(int width, int height, int gradientHeight, String baseColor, String gradientColor) {
- this(width, height, gradientHeight);
- this.baseColor = baseColor;
- this.gradientColor = gradientColor;
+ this(width, height, gradientHeight, baseColor, gradientColor, false);
}
public BaseGradient(int width, int height) {
@@ -81,9 +83,7 @@
}
public BaseGradient(int width, int height, String baseColor, String gradientColor) {
- this(width, height, height);
- this.baseColor = baseColor;
- this.gradientColor = gradientColor;
+ this(width, height, height, baseColor, gradientColor);
}
public BaseGradient() {
@@ -91,45 +91,27 @@
}
public BaseGradient(String baseColor, String gradientColor) {
- this(30, 50, 20);
- this.baseColor = baseColor;
- this.gradientColor = gradientColor;
+ this(30, 50, 20, baseColor, gradientColor);
}
public BaseGradient(int width, int height, int gradientHeight, boolean horizontal) {
- this(width, height, gradientHeight);
- this.horizontal = horizontal;
+ this(width, height, gradientHeight, null, null, horizontal);
}
- public BaseGradient(int width, int height, int gradientHeight, String baseColor, String gradientColor, boolean horizontal) {
- this(width, height, gradientHeight);
- this.baseColor = baseColor;
- this.gradientColor = gradientColor;
- this.horizontal = horizontal;
- }
-
public BaseGradient(int width, int height, boolean horizontal) {
- this(width, height, horizontal?width:height);
- this.horizontal = horizontal;
+ this(width, height, horizontal ? width : height, null, null, horizontal);
}
public BaseGradient(int width, int height, String baseColor, String gradientColor, boolean horizontal) {
- this(width, height, horizontal?width:height);
- this.baseColor = baseColor;
- this.gradientColor = gradientColor;
- this.horizontal = horizontal;
+ this(width, height, horizontal ? width : height, baseColor, gradientColor, horizontal);
}
public BaseGradient(boolean horizontal) {
- this(30, 50, 20);
- this.horizontal = horizontal;
+ this(30, 50, 20, null, null, horizontal);
}
public BaseGradient(String baseColor, String gradientColor, boolean horizontal) {
- this(30, 50, 20);
- this.baseColor = baseColor;
- this.gradientColor = gradientColor;
- this.horizontal = horizontal;
+ this(30, 50, 20, baseColor, gradientColor, horizontal);
}
public Dimension getDimensions(FacesContext facesContext, Object data) {
@@ -140,14 +122,6 @@
return getDimensions(null, restoreData(resourceContext));
}
- private void drawRectangle(Graphics2D g2d, Rectangle2D rect, BiColor biColor, boolean useTop) {
- if (biColor != null) {
- Color color = useTop ? biColor.getTopColor() : biColor.getBottomColor();
- g2d.setColor(color);
- g2d.fill(rect);
- }
- }
-
private void drawGradient(Graphics2D g2d, Rectangle2D rectangle, BiColor colors, int height) {
if (colors != null) {
GradientPaint gragient = new GradientPaint(0, 0, colors.getTopColor(), 0, height, colors.getBottomColor());
@@ -170,9 +144,7 @@
Integer headerGradientColor = dataToStore.getHeaderGradientColor();
if (headerBackgroundColor != null && headerGradientColor != null) {
- Color baseColor = new Color(headerBackgroundColor.intValue());
- Color alternateColor = new Color(headerGradientColor.intValue());
- BiColor biColor = new GradientType.BiColor(baseColor, alternateColor);
+ BiColor biColor = new GradientType.BiColor(headerBackgroundColor, headerGradientColor);
GradientType type = dataToStore.getGradientType();
BiColor firstLayer = type.getFirstLayerColors(biColor);
@@ -186,43 +158,12 @@
dim.setSize(dim.height, dim.width);
}
- Rectangle2D rect =
- new Rectangle2D.Float(
- 0,
- 0,
- dim.width,
- dim.height);
-
- GradientAlignment gradientAlignment = dataToStore.getGradientAlignment();
- int topRectangleHeight = gradientAlignment.getTopRectangleHeight(dim.height, gradientHeight);
- int bottomRectangleHeight = gradientAlignment.getBottomRectangleHeight(dim.height, gradientHeight);
-
- rect = new Rectangle2D.Float(
+ Rectangle2D rect = new Rectangle2D.Float(
0,
0,
dim.width,
- topRectangleHeight);
-
- drawRectangle(g2d, rect, firstLayer, true);
- drawRectangle(g2d, rect, secondLayer, true);
-
- rect = new Rectangle2D.Float(
- 0,
- dim.height - bottomRectangleHeight,
- dim.width,
dim.height);
- drawRectangle(g2d, rect, firstLayer, false);
- drawRectangle(g2d, rect, secondLayer, false);
-
- g2d.transform(AffineTransform.getTranslateInstance(0, topRectangleHeight));
-
- rect = new Rectangle2D.Float(
- 0,
- 0,
- dim.width,
- dim.height);
-
drawGradient(g2d, rect, firstLayer, gradientHeight);
rect = new Rectangle2D.Float(
@@ -241,7 +182,6 @@
data.setHeaderBackgroundColor(Integer.valueOf(zipper2.nextIntColor()));
data.setHeaderGradientColor(Integer.valueOf(zipper2.nextIntColor()));
data.setGradientType(GradientType.values()[zipper2.nextByte()]);
- data.setGradientAlignment(GradientAlignment.values()[zipper2.nextByte()]);
}
}
@@ -267,21 +207,11 @@
}
}
- private void saveData(FacesContext context, Data data, String baseColor, String gradientColor, Object parameterData) {
+ protected void saveData(FacesContext context, Data data, Object parameterData) {
Integer baseIntColor = null;
Integer headerIntColor = null;
String gradientTypeString = null;
- String alignmentString = null;
- if (parameterData instanceof Map<?, ?>) {
- Map<?, ?> map = (Map<?, ?>) parameterData;
-
- gradientTypeString = (String) map.get(Skin.gradientType);
- alignmentString = (String) map.get("valign");
- baseIntColor = decodeColor((String) map.get("baseColor"));
- headerIntColor = decodeColor((String) map.get("gradientColor"));
- }
-
if (baseIntColor == null) {
baseIntColor = getColorValueParameter(context, baseColor, false);
}
@@ -308,17 +238,8 @@
}
data.setGradientType(GradientType.getBySkinParameter(gradientTypeString));
- data.setGradientAlignment(GradientAlignment.getByParameter(alignmentString));
}
- protected void saveData(FacesContext context, Data data, Object parameterData) {
- if (baseColor == null) {
- saveData(context, data, Skin.headerBackgroundColor, "headerGradientColor", parameterData);
- } else {
- saveData(context, data, baseColor, gradientColor, parameterData);
- }
- }
-
protected Object getDataToStore(FacesContext context, Object data) {
Data dataObject = createData();
saveData(context, dataObject, data);
@@ -367,13 +288,12 @@
private Integer headerBackgroundColor;
private Integer headerGradientColor;
private GradientType gradientType;
- private GradientAlignment gradientAlignment;
public byte[] toByteArray() {
if (headerBackgroundColor != null && headerGradientColor != null && gradientType != null) {
- byte[] ret = new byte[8];
+ byte[] ret = new byte[7];
new Zipper2(ret).addColor(headerBackgroundColor.intValue()).addColor(headerGradientColor.intValue()).
- addByte((byte) gradientType.ordinal()).addByte((byte) gradientAlignment.ordinal());
+ addByte((byte) gradientType.ordinal());
return ret;
} else {
return null;
@@ -404,14 +324,6 @@
this.gradientType = gradientType;
}
- public GradientAlignment getGradientAlignment() {
- return gradientAlignment;
- }
-
- public void setGradientAlignment(GradientAlignment gradientAlignment) {
- this.gradientAlignment = gradientAlignment;
- }
-
}
}
Added: trunk/framework/impl/src/main/java/org/richfaces/renderkit/html/CustomizeableGradient.java
===================================================================
--- trunk/framework/impl/src/main/java/org/richfaces/renderkit/html/CustomizeableGradient.java (rev 0)
+++ trunk/framework/impl/src/main/java/org/richfaces/renderkit/html/CustomizeableGradient.java 2008-04-24 13:08:04 UTC (rev 8119)
@@ -0,0 +1,327 @@
+/**
+ * License Agreement.
+ *
+ * JBoss RichFaces - Ajax4jsf Component Library
+ *
+ * Copyright (C) 2007 Exadel, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1 as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+package org.richfaces.renderkit.html;
+
+import java.awt.Color;
+import java.awt.Dimension;
+import java.awt.GradientPaint;
+import java.awt.Graphics2D;
+import java.awt.RenderingHints;
+import java.awt.geom.AffineTransform;
+import java.awt.geom.Rectangle2D;
+import java.io.Serializable;
+import java.util.Date;
+import java.util.Map;
+
+import javax.faces.context.FacesContext;
+
+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.HtmlDimensions;
+import org.ajax4jsf.util.Zipper2;
+import org.richfaces.renderkit.html.images.GradientAlignment;
+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;
+
+/**
+ * @author Nick Belaevski - nbelaevski(a)exadel.com
+ * created 02.02.2007
+ *
+ */
+public class CustomizeableGradient extends Java2Dresource {
+
+ private Dimension dimension = new Dimension(20, 500);
+
+ public CustomizeableGradient() {
+ super();
+
+ setRenderer(new PngRenderer());
+ setLastModified(new Date(InternetResourceBuilder.getInstance().getStartTime()));
+ }
+
+ public Dimension getDimensions(FacesContext facesContext, Object data) {
+ return dimension;
+ }
+
+ protected Dimension getDimensions(ResourceContext resourceContext) {
+ return dimension;
+ }
+
+ private void drawRectangle(Graphics2D g2d, Rectangle2D rect, BiColor biColor, boolean useTop) {
+ if (biColor != null) {
+ Color color = useTop ? biColor.getTopColor() : biColor.getBottomColor();
+ g2d.setColor(color);
+ g2d.fill(rect);
+ }
+ }
+
+ private void drawGradient(Graphics2D g2d, Rectangle2D rectangle, BiColor colors, int height) {
+ if (colors != null) {
+ GradientPaint 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_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) {
+ BiColor biColor = new GradientType.BiColor(dataToStore.getGradientColor(), dataToStore.getBaseColor());
+
+ GradientType type = dataToStore.getGradientType();
+ BiColor firstLayer = type.getFirstLayerColors(biColor);
+ BiColor secondLayer = type.getSecondLayerColors(biColor);
+
+ Dimension dim = getDimensions(resourceContext);
+ int gradientHeight = dataToStore.getGradientHeight();
+
+ Rectangle2D rect =
+ new Rectangle2D.Float(
+ 0,
+ 0,
+ dim.width,
+ dim.height);
+
+ GradientAlignment gradientAlignment = dataToStore.getGradientAlignment();
+ int topRectangleHeight = gradientAlignment.getTopRectangleHeight(dim.height, gradientHeight);
+ int bottomRectangleHeight = gradientAlignment.getBottomRectangleHeight(dim.height, gradientHeight);
+
+ rect = new Rectangle2D.Float(
+ 0,
+ 0,
+ dim.width,
+ topRectangleHeight);
+
+ drawRectangle(g2d, rect, firstLayer, true);
+ drawRectangle(g2d, rect, secondLayer, true);
+
+ rect = new Rectangle2D.Float(
+ 0,
+ dim.height - bottomRectangleHeight,
+ dim.width,
+ dim.height);
+
+ drawRectangle(g2d, rect, firstLayer, false);
+ drawRectangle(g2d, rect, secondLayer, false);
+
+ g2d.transform(AffineTransform.getTranslateInstance(0, topRectangleHeight));
+
+ rect = new Rectangle2D.Float(
+ 0,
+ 0,
+ dim.width,
+ dim.height);
+
+ drawGradient(g2d, rect, firstLayer, gradientHeight);
+
+ rect = new Rectangle2D.Float(
+ 0,
+ 0,
+ dim.width,
+ gradientHeight / 2);
+
+ drawGradient(g2d, rect, secondLayer, gradientHeight / 2);
+ }
+ }
+
+ protected Object deserializeData(byte[] objectArray) {
+ Data data = new Data();
+ if (objectArray != null) {
+ Zipper2 zipper2 = new Zipper2(objectArray);
+
+ data.setGradientType(GradientType.values()[zipper2.nextByte()]);
+ data.setGradientAlignment(GradientAlignment.values()[zipper2.nextByte()]);
+ data.setGradientHeight(zipper2.nextInt());
+ data.setBaseColor(Integer.valueOf(zipper2.nextIntColor()));
+
+ if (zipper2.hasMore()) {
+ data.setGradientColor(Integer.valueOf(zipper2.nextIntColor()));
+ } else {
+ data.setGradientColor(data.getBaseColor());
+ }
+ }
+
+ return data;
+ }
+
+ private Integer decodeColor(String value) {
+ if (value !=null && value.length() != 0) {
+ return Integer.valueOf(HtmlColor.decode(value).getRGB());
+ } else {
+ return null;
+ }
+ }
+
+ private Integer decodeHeight(String value) {
+ if (value !=null && value.length() != 0) {
+ return HtmlDimensions.decode(value).intValue();
+ } else {
+ return null;
+ }
+ }
+
+ protected Object getDataToStore(FacesContext context, Object parameterData) {
+ Data data = new Data();
+
+ Integer baseIntColor = null;
+ Integer gradientIntColor = null;
+ Integer gradientHeight = null;
+
+ String gradientTypeString = null;
+ String alignmentString = null;
+
+ if (parameterData instanceof Map<?, ?>) {
+ Map<?, ?> map = (Map<?, ?>) parameterData;
+
+ gradientTypeString = (String) map.get(Skin.gradientType);
+ alignmentString = (String) map.get("valign");
+ baseIntColor = decodeColor((String) map.get("baseColor"));
+ gradientIntColor = decodeColor((String) map.get("gradientColor"));
+ gradientHeight = decodeHeight((String) map.get("gradientHeight"));
+ }
+
+ data.setBaseColor(baseIntColor);
+ if (gradientIntColor != null) {
+ data.setGradientColor(gradientIntColor);
+ } else {
+ data.setGradientColor(baseIntColor);
+ }
+
+ if (gradientHeight == null) {
+ gradientHeight = 22;
+ }
+ data.setGradientHeight(gradientHeight);
+
+ if (gradientTypeString == null || gradientTypeString.length() == 0) {
+ gradientTypeString = getValueParameter(context, Skin.gradientType);
+ }
+
+ data.setGradientType(GradientType.getBySkinParameter(gradientTypeString));
+ data.setGradientAlignment(GradientAlignment.getByParameter(alignmentString));
+
+ return data.toByteArray();
+ }
+
+ public boolean isCacheable() {
+ return true;
+ }
+
+ protected String getValueParameter(FacesContext context, String name) {
+ SkinFactory skinFactory = SkinFactory.getInstance();
+
+ 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;
+ }
+
+ protected static class Data implements Serializable {
+ public Data() {
+ }
+
+ /**
+ *
+ */
+ private static final long serialVersionUID = 1732700513743861250L;
+ private Integer gradientColor;
+ private Integer baseColor;
+ private Integer gradientHeight;
+
+ private GradientType gradientType;
+ private GradientAlignment gradientAlignment;
+
+ public byte[] toByteArray() {
+ if (baseColor != null && gradientColor != null && gradientHeight != null && gradientAlignment != null && gradientType != null) {
+ byte[] ret = new byte[12];
+ new Zipper2(ret)
+ .addByte((byte) gradientType.ordinal())
+ .addByte((byte) gradientAlignment.ordinal())
+ .addInt(gradientHeight.intValue())
+ .addColor(baseColor.intValue())
+ .addColor(gradientColor.intValue());
+
+ return ret;
+ } else {
+ return null;
+ }
+ }
+
+ public Integer getGradientColor() {
+ return gradientColor;
+ }
+
+ public void setGradientColor(Integer headerBackgroundColor) {
+ this.gradientColor = headerBackgroundColor;
+ }
+
+ public Integer getBaseColor() {
+ return baseColor;
+ }
+
+ public void setBaseColor(Integer headerGradientColor) {
+ this.baseColor = headerGradientColor;
+ }
+
+ public GradientType getGradientType() {
+ return gradientType;
+ }
+
+ public void setGradientType(GradientType gradientType) {
+ this.gradientType = gradientType;
+ }
+
+ public GradientAlignment getGradientAlignment() {
+ return gradientAlignment;
+ }
+
+ public void setGradientAlignment(GradientAlignment gradientAlignment) {
+ this.gradientAlignment = gradientAlignment;
+ }
+
+ public Integer getGradientHeight() {
+ return gradientHeight;
+ }
+
+ public void setGradientHeight(Integer gradientHeight) {
+ this.gradientHeight = gradientHeight;
+ }
+
+ }
+
+}
Modified: trunk/framework/impl/src/main/java/org/richfaces/renderkit/html/images/GradientAlignment.java
===================================================================
--- trunk/framework/impl/src/main/java/org/richfaces/renderkit/html/images/GradientAlignment.java 2008-04-24 12:37:10 UTC (rev 8118)
+++ trunk/framework/impl/src/main/java/org/richfaces/renderkit/html/images/GradientAlignment.java 2008-04-24 13:08:04 UTC (rev 8119)
@@ -21,6 +21,7 @@
package org.richfaces.renderkit.html.images;
+import static java.lang.Math.max;
/**
@@ -33,7 +34,7 @@
TOP {
@Override
public int getBottomRectangleHeight(int imageHeight, int gradientHeight) {
- return imageHeight - gradientHeight;
+ return max(imageHeight - gradientHeight, 0);
}
@Override
@@ -45,7 +46,7 @@
CENTER {
@Override
public int getBottomRectangleHeight(int imageHeight, int gradientHeight) {
- return (imageHeight - gradientHeight) / 2;
+ return max((imageHeight - gradientHeight) / 2, 0);
}
@Override
@@ -62,7 +63,7 @@
@Override
public int getTopRectangleHeight(int imageHeight, int gradientHeight) {
- return imageHeight - gradientHeight;
+ return max(imageHeight - gradientHeight, 0);
}
};
Modified: 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 2008-04-24 12:37:10 UTC (rev 8118)
+++ trunk/framework/impl/src/main/java/org/richfaces/renderkit/html/images/GradientType.java 2008-04-24 13:08:04 UTC (rev 8119)
@@ -17,32 +17,28 @@
@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);
+ if (bottomColor != null) {
+ 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];
+ 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);
+ Color topColor = new Color(Color.HSBtoRGB(hsb[0], hsb[1], hsb[2]));
+
+ return new BiColor(bottomColor, topColor);
+ } else {
+ return null;
+ }
}
@Override
public BiColor getSecondLayerColors(BiColor biColor) {
- return WHITE;
+ if (biColor.getBottomColor() != null) {
+ return WHITE;
+ } else {
+ return null;
+ }
}
},
@@ -52,20 +48,27 @@
@Override
public BiColor getFirstLayerColors(BiColor biColor) {
Color bottomColor = biColor.getBottomColor();
+ if (bottomColor != null) {
+ float[] hsb = Color.RGBtoHSB(bottomColor.getRed(), bottomColor.getGreen(), bottomColor.getBlue(), null);
- 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];
- 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]));
- Color topColor = new Color(Color.HSBtoRGB(hsb[0], hsb[1], hsb[2]));
-
- return new BiColor(topColor, bottomColor);
+ return new BiColor(topColor, bottomColor);
+ } else {
+ return null;
+ }
}
@Override
public BiColor getSecondLayerColors(BiColor biColor) {
- return WHITE;
+ if (biColor.getBottomColor() != null) {
+ return WHITE;
+ } else {
+ return null;
+ }
}
},
@@ -74,7 +77,11 @@
@Override
public BiColor getFirstLayerColors(BiColor biColor) {
- return biColor;
+ if (biColor.getBottomColor() != null && biColor.getTopColor() != null) {
+ return biColor;
+ } else {
+ return null;
+ }
}
@Override
@@ -105,14 +112,17 @@
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 BiColor(Integer topColor, Integer bottomColor) {
+ super();
+
+ this.topColor = topColor != null ? new Color(topColor.intValue()) : null;
+ this.bottomColor = bottomColor != null ? new Color(bottomColor.intValue()) : null;
+ }
+
public Color getTopColor() {
return topColor;
}
16 years, 8 months
JBoss Rich Faces SVN: r8118 - trunk/test-applications/facelets/src/main/webapp/InplaceSelect.
by richfaces-svn-commits@lists.jboss.org
Author: gmaksimenko
Date: 2008-04-24 08:37:10 -0400 (Thu, 24 Apr 2008)
New Revision: 8118
Modified:
trunk/test-applications/facelets/src/main/webapp/InplaceSelect/InplaceSelect.xhtml
Log:
Add events
Modified: trunk/test-applications/facelets/src/main/webapp/InplaceSelect/InplaceSelect.xhtml
===================================================================
--- trunk/test-applications/facelets/src/main/webapp/InplaceSelect/InplaceSelect.xhtml 2008-04-24 12:36:57 UTC (rev 8117)
+++ trunk/test-applications/facelets/src/main/webapp/InplaceSelect/InplaceSelect.xhtml 2008-04-24 12:37:10 UTC (rev 8118)
@@ -5,8 +5,7 @@
This is because such an error can easily be made at programming level, <br />
and while invisible for the user who does not understand or cannot <br />
acquire the source code, many of those
-<rich:inplaceSelect id="inplaceSelectID"
-
+<rich:inplaceSelect id="inplaceSelectID"
tabindex="#{inplaceSelect.tabindex}"
editEvent="#{inplaceSelect.editEvent}"
maxSelectWidth="#{inplaceSelect.maxSelectWidth}"
@@ -23,7 +22,38 @@
openOnEdit="#{inplaceSelect.openOnEdit}"
rendered="#{inplaceSelect.rendered}"
immediate="#{inplaceSelect.immediate}"
- binding="#{inplaceSelect.myInplaceSelect}">
+ binding="#{inplaceSelect.myInplaceSelect}"
+
+ onblur="#{event.onblur}"
+ onchange="#{event.onchange}"
+ onclick="#{event.onclick}"
+ ondblclick="#{event.ondblclick}"
+ oneditactivated="#{event.oneditactivated}"
+ oneditactivation="#{event.oneditactivation}"
+ onfocus="#{event.onfocus}"
+ oninputblur="#{event.oninputblur}"
+ oninputclick="#{event.oninputclick}"
+ oninputdblclick="#{event.oninputdblclick}"
+ oninputfocus="#{event.oninputfocus}"
+ oninputkeydown="#{event.oninputkeydown}"
+ oninputkeypress="#{event.oninputkeypress}"
+ oninputkeyup="#{event.oninputkeyup}"
+ oninputmousedown="#{event.oninputmousedown}"
+ oninputmousemove="#{event.oninputmousemove}"
+ oninputmouseout="#{event.oninputmouseout}"
+ oninputmouseover="#{event.oninputmouseover}"
+ oninputmouseup="#{event.oninputmouseup}"
+ onkeydown="#{event.onkeydown}"
+ onkeypress="#{event.onkeypress}"
+ onkeyup="#{event.onkeyup}"
+ onmousedown="#{event.onmousedown}"
+ onmousemove="#{event.onmousemove}"
+ onmouseout="#{event.onmouseout}"
+ onmouseover="#{event.onmouseover}"
+ onmouseup="#{event.onmouseup}"
+ onselect="#{event.onselect}"
+ onviewactivated="#{evant.onviewactivated}"
+ onviewactivation="#{event.onviewactivation}">
<f:selectItem itemLabel="errors" itemValue="errors" />
<f:selectItem itemLabel="fatals" itemValue="fatals" />
<f:selectItem itemLabel="infos" itemValue="infos" />
16 years, 8 months
JBoss Rich Faces SVN: r8117 - trunk/test-applications/jsp/src/main/webapp/InplaceSelect.
by richfaces-svn-commits@lists.jboss.org
Author: gmaksimenko
Date: 2008-04-24 08:36:57 -0400 (Thu, 24 Apr 2008)
New Revision: 8117
Modified:
trunk/test-applications/jsp/src/main/webapp/InplaceSelect/InplaceSelect.jsp
Log:
Add events
Modified: trunk/test-applications/jsp/src/main/webapp/InplaceSelect/InplaceSelect.jsp
===================================================================
--- trunk/test-applications/jsp/src/main/webapp/InplaceSelect/InplaceSelect.jsp 2008-04-24 12:21:37 UTC (rev 8116)
+++ trunk/test-applications/jsp/src/main/webapp/InplaceSelect/InplaceSelect.jsp 2008-04-24 12:36:57 UTC (rev 8117)
@@ -27,7 +27,38 @@
openOnEdit="#{inplaceSelect.openOnEdit}"
rendered="#{inplaceSelect.rendered}"
immediate="#{inplaceSelect.immediate}"
- binding="#{inplaceSelect.myInplaceSelect}">
+ binding="#{inplaceSelect.myInplaceSelect}"
+
+ onblur="#{event.onblur}"
+ onchange="#{event.onchange}"
+ onclick="#{event.onclick}"
+ ondblclick="#{event.ondblclick}"
+ oneditactivated="#{event.oneditactivated}"
+ oneditactivation="#{event.oneditactivation}"
+ onfocus="#{event.onfocus}"
+ oninputblur="#{event.oninputblur}"
+ oninputclick="#{event.oninputclick}"
+ oninputdblclick="#{event.oninputdblclick}"
+ oninputfocus="#{event.oninputfocus}"
+ oninputkeydown="#{event.oninputkeydown}"
+ oninputkeypress="#{event.oninputkeypress}"
+ oninputkeyup="#{event.oninputkeyup}"
+ oninputmousedown="#{event.oninputmousedown}"
+ oninputmousemove="#{event.oninputmousemove}"
+ oninputmouseout="#{event.oninputmouseout}"
+ oninputmouseover="#{event.oninputmouseover}"
+ oninputmouseup="#{event.oninputmouseup}"
+ onkeydown="#{event.onkeydown}"
+ onkeypress="#{event.onkeypress}"
+ onkeyup="#{event.onkeyup}"
+ onmousedown="#{event.onmousedown}"
+ onmousemove="#{event.onmousemove}"
+ onmouseout="#{event.onmouseout}"
+ onmouseover="#{event.onmouseover}"
+ onmouseup="#{event.onmouseup}"
+ onselect="#{event.onselect}"
+ onviewactivated="#{evant.onviewactivated}"
+ onviewactivation="#{event.onviewactivation}">
<f:selectItem itemLabel="errors" itemValue="errors" />
<f:selectItem itemLabel="fatals" itemValue="fatals" />
<f:selectItem itemLabel="infos" itemValue="infos" />
16 years, 8 months
JBoss Rich Faces SVN: r8116 - trunk/test-applications/facelets/src/main/webapp/InplaceSelect.
by richfaces-svn-commits@lists.jboss.org
Author: gmaksimenko
Date: 2008-04-24 08:21:37 -0400 (Thu, 24 Apr 2008)
New Revision: 8116
Modified:
trunk/test-applications/facelets/src/main/webapp/InplaceSelect/InplaceSelect.xhtml
Log:
Add checkbox for rendered
Modified: trunk/test-applications/facelets/src/main/webapp/InplaceSelect/InplaceSelect.xhtml
===================================================================
--- trunk/test-applications/facelets/src/main/webapp/InplaceSelect/InplaceSelect.xhtml 2008-04-24 12:21:26 UTC (rev 8115)
+++ trunk/test-applications/facelets/src/main/webapp/InplaceSelect/InplaceSelect.xhtml 2008-04-24 12:21:37 UTC (rev 8116)
@@ -2,7 +2,6 @@
<f:subview xmlns:ui="http://java.sun.com/jsf/facelets" xmlns:f="http://java.sun.com/jsf/core" xmlns:a4j="http://richfaces.org/a4j" xmlns:h="http://java.sun.com/jsf/html" xmlns:rich="http://richfaces.org/rich" id="inplaceSelectSubviewID">
<h:inputText value="For verify tabbing"/> <br/>
-
This is because such an error can easily be made at programming level, <br />
and while invisible for the user who does not understand or cannot <br />
acquire the source code, many of those
@@ -103,6 +102,10 @@
<h:selectBooleanCheckbox value="#{inplaceSelect.openOnEdit}"
onchange="submit();"></h:selectBooleanCheckbox>
+ <h:outputText value="rendered"></h:outputText>
+ <h:selectBooleanCheckbox value="#{inplaceSelect.rendered}"
+ onchange="submit();"></h:selectBooleanCheckbox>
+
<h:commandButton actionListener="#{inplaceSelect.checkBinding}" value="Binding"></h:commandButton>
<h:outputText value="#{inplaceSelect.bindLabel}"></h:outputText>
</h:panelGrid><h:commandButton value="ok"></h:commandButton>
16 years, 8 months
JBoss Rich Faces SVN: r8115 - trunk/test-applications/jsp/src/main/webapp/InplaceSelect.
by richfaces-svn-commits@lists.jboss.org
Author: gmaksimenko
Date: 2008-04-24 08:21:26 -0400 (Thu, 24 Apr 2008)
New Revision: 8115
Modified:
trunk/test-applications/jsp/src/main/webapp/InplaceSelect/InplaceSelect.jsp
Log:
Add checkbox for rendered
Modified: trunk/test-applications/jsp/src/main/webapp/InplaceSelect/InplaceSelect.jsp
===================================================================
--- trunk/test-applications/jsp/src/main/webapp/InplaceSelect/InplaceSelect.jsp 2008-04-24 11:55:55 UTC (rev 8114)
+++ trunk/test-applications/jsp/src/main/webapp/InplaceSelect/InplaceSelect.jsp 2008-04-24 12:21:26 UTC (rev 8115)
@@ -10,8 +10,7 @@
This is because such an error can easily be made at programming level, <br />
and while invisible for the user who does not understand or cannot <br />
acquire the source code, many of those
-<rich:inplaceSelect id="inplaceSelectID"
-
+<rich:inplaceSelect id="inplaceSelectID"
tabindex="#{inplaceSelect.tabindex}"
editEvent="#{inplaceSelect.editEvent}"
maxSelectWidth="#{inplaceSelect.maxSelectWidth}"
@@ -34,6 +33,7 @@
<f:selectItem itemLabel="infos" itemValue="infos" />
<f:selectItem itemLabel="passeds" itemValue="passeds" />
<f:selectItem itemLabel="warns" itemValue="warns" />
+ <f:selectItem itemLabel="warnswarnswarnswarns" itemValue="warnswarnswarnswarns" />
</rich:inplaceSelect>
are easy to exploit.
<h:panelGrid columns="2">
@@ -107,6 +107,10 @@
<h:selectBooleanCheckbox value="#{inplaceSelect.openOnEdit}"
onchange="submit();"></h:selectBooleanCheckbox>
+ <h:outputText value="rendered"></h:outputText>
+ <h:selectBooleanCheckbox value="#{inplaceSelect.rendered}"
+ onchange="submit();"></h:selectBooleanCheckbox>
+
<h:commandButton actionListener="#{inplaceSelect.checkBinding}" value="Binding"></h:commandButton>
<h:outputText value = "#{inplaceSelect.bindLabel}"/>
16 years, 8 months
JBoss Rich Faces SVN: r8114 - in trunk/ui/dataFilterSlider/src/main: java/org/richfaces/component and 1 other directories.
by richfaces-svn-commits@lists.jboss.org
Author: vbaranov
Date: 2008-04-24 07:55:55 -0400 (Thu, 24 Apr 2008)
New Revision: 8114
Added:
trunk/ui/dataFilterSlider/src/main/java/org/richfaces/taglib/DataFilterSliderTagBase.java
Modified:
trunk/ui/dataFilterSlider/src/main/config/component/dataFilterSlider.xml
trunk/ui/dataFilterSlider/src/main/java/org/richfaces/component/UIDataFltrSlider.java
trunk/ui/dataFilterSlider/src/main/java/org/richfaces/taglib/DataFilterSliderListenerTagHandler.java
Log:
http://jira.jboss.com/jira/browse/RF-2801
Modified: trunk/ui/dataFilterSlider/src/main/config/component/dataFilterSlider.xml
===================================================================
--- trunk/ui/dataFilterSlider/src/main/config/component/dataFilterSlider.xml 2008-04-24 11:49:59 UTC (rev 8113)
+++ trunk/ui/dataFilterSlider/src/main/config/component/dataFilterSlider.xml 2008-04-24 11:55:55 UTC (rev 8114)
@@ -22,9 +22,7 @@
<tag>
<name>dataFilterSlider</name>
<classname>org.richfaces.taglib.DataFilterSliderTag</classname>
- <superclass>
- org.ajax4jsf.webapp.taglib.HtmlComponentTagBase
- </superclass>
+ <superclass>org.richfaces.taglib.DataFilterSliderTagBase</superclass>
<test/>
</tag>
<taghandler generate="true">
@@ -206,9 +204,16 @@
<property>
<name>onSlideSubmit</name>
<classname>boolean</classname>
- <description>If the slider value changes must submit a form, onSlideSubmit can be true</description>
+ <description>DEPRECATED(use submitOnSlide). If the slider value changes must submit a form. Default value is true.</description>
<defaultvalue>true</defaultvalue>
</property>
+
+ <property>
+ <name>submitOnSlide</name>
+ <classname>boolean</classname>
+ <description>If the slider value changes must submit a form. Default value is true.</description>
+ <defaultvalue>true</defaultvalue>
+ </property>
<property>
<name>storeResults</name>
Modified: trunk/ui/dataFilterSlider/src/main/java/org/richfaces/component/UIDataFltrSlider.java
===================================================================
--- trunk/ui/dataFilterSlider/src/main/java/org/richfaces/component/UIDataFltrSlider.java 2008-04-24 11:49:59 UTC (rev 8113)
+++ trunk/ui/dataFilterSlider/src/main/java/org/richfaces/component/UIDataFltrSlider.java 2008-04-24 11:55:55 UTC (rev 8114)
@@ -28,17 +28,14 @@
import javax.faces.component.UICommand;
import javax.faces.component.UIComponent;
-import javax.faces.component.UIComponentBase;
import javax.faces.component.UIData;
import javax.faces.context.FacesContext;
import javax.faces.el.MethodBinding;
import javax.faces.event.AbortProcessingException;
import javax.faces.event.FacesEvent;
-import javax.faces.event.PhaseId;
import javax.faces.model.ListDataModel;
import org.ajax4jsf.component.AjaxComponent;
-import org.ajax4jsf.event.AjaxEvent;
import org.ajax4jsf.renderkit.AjaxRendererUtils;
import org.ajax4jsf.renderkit.RendererUtils;
import org.richfaces.event.DataFilterSliderAdapter;
@@ -118,7 +115,7 @@
_active = active;
}
- private Map getSession() {
+ private Map<String, Object> getSession() {
return getFacesContext().getExternalContext().getSessionMap();
}
@@ -259,10 +256,16 @@
public abstract void setTrackStyleClass(String trackStyleClass);
+ @Deprecated
public abstract boolean isOnSlideSubmit();
+ @Deprecated
public abstract void setOnSlideSubmit(boolean value);
+ public abstract boolean isSubmitOnSlide();
+
+ public abstract void setSubmitOnSlide(boolean value);
+
public abstract boolean isStoreResults();
public abstract void setStoreResults(boolean storeResults);
Modified: trunk/ui/dataFilterSlider/src/main/java/org/richfaces/taglib/DataFilterSliderListenerTagHandler.java
===================================================================
--- trunk/ui/dataFilterSlider/src/main/java/org/richfaces/taglib/DataFilterSliderListenerTagHandler.java 2008-04-24 11:49:59 UTC (rev 8113)
+++ trunk/ui/dataFilterSlider/src/main/java/org/richfaces/taglib/DataFilterSliderListenerTagHandler.java 2008-04-24 11:55:55 UTC (rev 8114)
@@ -22,6 +22,7 @@
package org.richfaces.taglib;
import javax.faces.component.UIComponent;
+import javax.faces.context.FacesContext;
import javax.faces.el.MethodBinding;
import org.richfaces.event.DataFilterSliderEvent;
@@ -32,6 +33,7 @@
import com.sun.facelets.tag.Metadata;
import com.sun.facelets.tag.MetadataTarget;
import com.sun.facelets.tag.TagAttribute;
+import com.sun.facelets.tag.TagAttributes;
import com.sun.facelets.tag.jsf.ComponentConfig;
import com.sun.facelets.tag.jsf.ComponentHandler;
@@ -39,30 +41,44 @@
public class DataFilterSliderListenerTagHandler extends ComponentHandler {
private final static String SLIDER_LISTENER = "sliderListener";
-
public DataFilterSliderListenerTagHandler(ComponentConfig config) {
- super(config);
+ super(config);
}
protected MetaRuleset createMetaRuleset(Class clazz) {
- MetaRuleset ruleset = super.createMetaRuleset(clazz);
+ TagAttributes attributes = this.tag.getAttributes();
+ TagAttribute attribute = attributes.get("onSlideSubmit");
+ if ((attribute != null) && (attributes.get("submitOnSlide") != null)) {
+ TagAttribute idAttribute = attributes.get("id");
+ StringBuilder builder = new StringBuilder();
+ builder.append("submitOnSlide attribute has been already set for component with id=");
+ builder.append(idAttribute != null ? idAttribute.getValue() : null);
+ builder.append(": [").append(attribute.getValue()).append("]. ");
+ builder.append("Attribute onSlideSubmit is deprecated and thus has been dropped!");
- ruleset.addRule(new MetaRule() {
+ FacesContext.getCurrentInstance().getExternalContext().log(builder.toString());
+ }
- public Metadata applyRule(String name, final TagAttribute attribute, MetadataTarget metadataTarget) {
- if (SLIDER_LISTENER.equals(name)) {
- return new Metadata() {
- public void applyMetadata(FaceletContext context, Object object) {
- MethodBinding binding = context.getFacesContext().getApplication().createMethodBinding(attribute.getValue(), new Class[] {DataFilterSliderEvent.class});
- ((UIComponent) object).getAttributes().put(SLIDER_LISTENER, binding);
- }
- };
- }
- return null;
- }
- });
+ MetaRuleset ruleset = super.createMetaRuleset(clazz);
+ ruleset.alias("submitOnSlide", "onSlideSubmit");
- return ruleset;
+ ruleset.addRule(new MetaRule() {
+
+ public Metadata applyRule(String name, final TagAttribute attribute, MetadataTarget metadataTarget) {
+ if (SLIDER_LISTENER.equals(name)) {
+ return new Metadata() {
+ public void applyMetadata(FaceletContext context, Object object) {
+ MethodBinding binding = context.getFacesContext().getApplication().createMethodBinding(
+ attribute.getValue(), new Class[] { DataFilterSliderEvent.class });
+ ((UIComponent) object).getAttributes().put(SLIDER_LISTENER, binding);
+ }
+ };
+ }
+ return null;
+ }
+ });
+
+ return ruleset;
}
}
Added: trunk/ui/dataFilterSlider/src/main/java/org/richfaces/taglib/DataFilterSliderTagBase.java
===================================================================
--- trunk/ui/dataFilterSlider/src/main/java/org/richfaces/taglib/DataFilterSliderTagBase.java (rev 0)
+++ trunk/ui/dataFilterSlider/src/main/java/org/richfaces/taglib/DataFilterSliderTagBase.java 2008-04-24 11:55:55 UTC (rev 8114)
@@ -0,0 +1,97 @@
+package org.richfaces.taglib;
+
+import javax.el.ELException;
+import javax.el.ValueExpression;
+import javax.faces.FacesException;
+import javax.faces.component.UIComponent;
+import javax.faces.context.FacesContext;
+
+import org.ajax4jsf.webapp.taglib.HtmlComponentTagBase;
+import org.richfaces.component.UIDataFltrSlider;
+
+public abstract class DataFilterSliderTagBase extends HtmlComponentTagBase {
+
+ /**
+ * Constant String message
+ */
+ private static String ATTRIBUTE_DEPRECATION_MESSAGE = "Attribute onSlideSubmit is deprecated!";
+
+ /**
+ * Flag indicating that attribute 'onSlideSubmit' has already been set
+ */
+ private boolean isSubmitOnSlideSet = false;
+
+ /*
+ * submitOnSlide If the slider value changes must submit a form. Default
+ * value is true.
+ */
+ private ValueExpression _submitOnSlide = null;
+
+ /**
+ * DEPRECATED(use submitOnSlide). If the slider value changes must submit a
+ * form. Default value is true. Setter for onSlideSubmit
+ *
+ * @param onSlideSubmit - new value
+ */
+ public void setOnSlideSubmit(ValueExpression onSlideSubmit) {
+ FacesContext.getCurrentInstance().getExternalContext().log(ATTRIBUTE_DEPRECATION_MESSAGE);
+ if (!isSubmitOnSlideSet && (_submitOnSlide != null)) {
+ logValueDeprecation(_submitOnSlide);
+ }
+ this._submitOnSlide = onSlideSubmit;
+ isSubmitOnSlideSet = true;
+ }
+
+ /**
+ * If the slider value changes must submit a form. Default value is true.
+ * Setter for submitOnSlide
+ *
+ * @param submitOnSlide - new value
+ */
+ public void setSubmitOnSlide(ValueExpression submitOnSlide) {
+ if (!isSubmitOnSlideSet) {
+ this._submitOnSlide = submitOnSlide;
+ } else {
+ logValueDeprecation(this._submitOnSlide);
+ }
+
+ }
+
+ private void logValueDeprecation(ValueExpression value) {
+ StringBuilder builder = new StringBuilder();
+ builder.append("submitOnSlide attribute has been already set for DataFilterSlider component with id=");
+ builder.append(this.getId());
+ builder.append(": [").append(value.getExpressionString()).append("]. ");
+ builder.append(ATTRIBUTE_DEPRECATION_MESSAGE);
+
+ FacesContext.getCurrentInstance().getExternalContext().log(builder.toString());
+ }
+
+ protected void setProperties(UIComponent component) {
+ super.setProperties(component);
+
+ if (this._submitOnSlide != null) {
+ if (this._submitOnSlide.isLiteralText()) {
+ UIDataFltrSlider filterSlider = (UIDataFltrSlider) component;
+ try {
+ Boolean __onSlideSubmit = (Boolean) getFacesContext().getApplication().getExpressionFactory()
+ .coerceToType(this._submitOnSlide.getExpressionString(), Boolean.class);
+
+ filterSlider.setSubmitOnSlide(__onSlideSubmit.booleanValue());
+ } catch (ELException e) {
+ throw new FacesException(e);
+ }
+ } else {
+ component.setValueExpression("onSlideSubmit", this._submitOnSlide);
+ }
+ }
+
+ }
+
+ public void release() {
+ super.release();
+ isSubmitOnSlideSet = false;
+ _submitOnSlide = null;
+ }
+
+}
Property changes on: trunk/ui/dataFilterSlider/src/main/java/org/richfaces/taglib/DataFilterSliderTagBase.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Name: svn:keywords
+ Author Id Revision Date
Name: svn:eol-style
+ native
16 years, 8 months
JBoss Rich Faces SVN: r8113 - in trunk/ui/pickList/src/main: resources/org/richfaces/renderkit/html/css and 1 other directory.
by richfaces-svn-commits@lists.jboss.org
Author: vmolotkov
Date: 2008-04-24 07:49:59 -0400 (Thu, 24 Apr 2008)
New Revision: 8113
Modified:
trunk/ui/pickList/src/main/java/org/richfaces/renderkit/PickListRenderer.java
trunk/ui/pickList/src/main/resources/org/richfaces/renderkit/html/css/picklist.xcss
Log:
http://jira.jboss.com/jira/browse/RF-3223
Modified: trunk/ui/pickList/src/main/java/org/richfaces/renderkit/PickListRenderer.java
===================================================================
--- trunk/ui/pickList/src/main/java/org/richfaces/renderkit/PickListRenderer.java 2008-04-24 11:13:30 UTC (rev 8112)
+++ trunk/ui/pickList/src/main/java/org/richfaces/renderkit/PickListRenderer.java 2008-04-24 11:49:59 UTC (rev 8113)
@@ -427,7 +427,6 @@
writer.startElement(HTML.a_ELEMENT, component);
writer.writeAttribute(HTML.id_ATTRIBUTE, controlId + "link", null); // FIXME:
- writer.writeAttribute(HTML.HREF_ATTR, "#", null);
writer.writeAttribute(HTML.onclick_ATTRIBUTE, "return false;", null);
if (!helper.enable) {
@@ -452,9 +451,7 @@
renderChild(context, facet);
} else {
writer.startElement(HTML.IMG_ELEMENT, component);
- writer.writeAttribute(HTML.width_ATTRIBUTE, "15", null);
- writer.writeAttribute(HTML.height_ATTRIBUTE, "15", null);
- writer.writeAttribute(HTML.border_ATTRIBUTE, "0", null);
+ writer.writeAttribute(HTML.class_ATTRIBUTE, "rich-picklist-control-img", null);
writer.writeAttribute(HTML.alt_ATTRIBUTE, helper.getFacetName(), null);
writer.writeAttribute(HTML.src_ATTRIBUTE, getResource(helper.getImageURI()).getUri(context, null), null);
writer.endElement(HTML.IMG_ELEMENT);
Modified: trunk/ui/pickList/src/main/resources/org/richfaces/renderkit/html/css/picklist.xcss
===================================================================
--- trunk/ui/pickList/src/main/resources/org/richfaces/renderkit/html/css/picklist.xcss 2008-04-24 11:13:30 UTC (rev 8112)
+++ trunk/ui/pickList/src/main/resources/org/richfaces/renderkit/html/css/picklist.xcss 2008-04-24 11:49:59 UTC (rev 8113)
@@ -130,6 +130,13 @@
border-bottom: 1px dotted;
}
+.rich-picklist-control-img {
+ margin: 0px;
+ padding: 0px;
+ border:0px;
+ width: 15px;
+ height: 15px;
+}
]]>
</f:verbatim>
16 years, 8 months
JBoss Rich Faces SVN: r8112 - in trunk/ui/orderingList/src/main: resources/org/richfaces/renderkit/html/css and 1 other directories.
by richfaces-svn-commits@lists.jboss.org
Author: vmolotkov
Date: 2008-04-24 07:13:30 -0400 (Thu, 24 Apr 2008)
New Revision: 8112
Modified:
trunk/ui/orderingList/src/main/java/org/richfaces/renderkit/OrderingComponentRendererBase.java
trunk/ui/orderingList/src/main/resources/org/richfaces/renderkit/html/css/orderingList.xcss
trunk/ui/orderingList/src/main/resources/org/richfaces/renderkit/html/scripts/LayoutManager.js
Log:
http://jira.jboss.com/jira/browse/RF-3223
Modified: trunk/ui/orderingList/src/main/java/org/richfaces/renderkit/OrderingComponentRendererBase.java
===================================================================
--- trunk/ui/orderingList/src/main/java/org/richfaces/renderkit/OrderingComponentRendererBase.java 2008-04-24 10:04:47 UTC (rev 8111)
+++ trunk/ui/orderingList/src/main/java/org/richfaces/renderkit/OrderingComponentRendererBase.java 2008-04-24 11:13:30 UTC (rev 8112)
@@ -368,11 +368,10 @@
writer.startElement(HTML.IMG_ELEMENT, orderingList);
//buttons sometimes don't work under IE if mouse cursor
//is above some special areas of the button
- writer.writeAttribute(HTML.style_ATTRIBUTE, "margin:0px;padding:0px;border:0px;", null);
+ writer.writeAttribute(HTML.class_ATTRIBUTE, "rich-ordering-control-img", null);
- writer.writeAttribute(HTML.width_ATTRIBUTE, "15", null);
- writer.writeAttribute(HTML.height_ATTRIBUTE, "15", null);
- writer.writeAttribute(HTML.border_ATTRIBUTE, "0", null);
+ //writer.writeAttribute(HTML.width_ATTRIBUTE, "15", null);
+ //writer.writeAttribute(HTML.height_ATTRIBUTE, "15", null);
writer.writeAttribute(HTML.alt_ATTRIBUTE, helper.getDefaultText(),
null);
writer.writeAttribute(HTML.src_ATTRIBUTE, getResource(
Modified: trunk/ui/orderingList/src/main/resources/org/richfaces/renderkit/html/css/orderingList.xcss
===================================================================
--- trunk/ui/orderingList/src/main/resources/org/richfaces/renderkit/html/css/orderingList.xcss 2008-04-24 10:04:47 UTC (rev 8111)
+++ trunk/ui/orderingList/src/main/resources/org/richfaces/renderkit/html/css/orderingList.xcss 2008-04-24 11:13:30 UTC (rev 8112)
@@ -5,6 +5,14 @@
<f:verbatim><![CDATA[
+.rich-ordering-control-img {
+ margin: 0px;
+ padding: 0px;
+ border:0px;
+ width: 15px;
+ height: 15px;
+}
+
.rich-ordering-control-disabled {
border : 1px solid;
margin-bottom : 3px;
Modified: trunk/ui/orderingList/src/main/resources/org/richfaces/renderkit/html/scripts/LayoutManager.js
===================================================================
--- trunk/ui/orderingList/src/main/resources/org/richfaces/renderkit/html/scripts/LayoutManager.js 2008-04-24 10:04:47 UTC (rev 8111)
+++ trunk/ui/orderingList/src/main/resources/org/richfaces/renderkit/html/scripts/LayoutManager.js 2008-04-24 11:13:30 UTC (rev 8112)
@@ -38,20 +38,17 @@
}
}
- if (Prototype.Browser.IE) {
+ if (Prototype.Browser.IE && this.contentDiv && this.contentTable && this.getScrollWidth()) {
//IE displays unnecessary horizontal scroll
//when vertical scroll's displayed
- if (this.contentDiv && this.contentTable && this.getScrollWidth()) {
- //alert(this.contentTable.offsetWidth +" "+ this.contentDiv.offsetWidth);
- if (this.contentTable.offsetWidth && ((this.contentTable.offsetWidth <= this.contentDiv.clientWidth))) {
- this.contentTable.style.width = this.contentDiv.clientWidth + "px";
- this.headerTable.style.width = this.contentDiv.offsetWidth + "px";
- this.contentDiv.style.overflowX = 'hidden';
- }
- } else {
- this.contentTable.style.width = "100%";
- this.headerTable.style.width = "100%";
+ if (this.contentTable.offsetWidth && ((this.contentTable.offsetWidth <= this.contentDiv.clientWidth))) {
+ this.contentTable.style.width = this.contentDiv.clientWidth + "px";
+ this.headerTable.style.width = this.contentDiv.offsetWidth + "px";
+ this.contentDiv.style.overflowX = 'hidden';
}
+ } else {
+ this.contentTable.style.width = "100%";
+ this.headerTable.style.width = "100%";
}
}
16 years, 8 months