JBoss Rich Faces SVN: r6197 - in trunk/framework/impl/src/main/java/org/richfaces/renderkit: html and 1 other directories.
by richfaces-svn-commits@lists.jboss.org
Author: abelevich
Date: 2008-02-20 08:36:23 -0500 (Wed, 20 Feb 2008)
New Revision: 6197
Added:
trunk/framework/impl/src/main/java/org/richfaces/renderkit/html/
trunk/framework/impl/src/main/java/org/richfaces/renderkit/html/images/
trunk/framework/impl/src/main/java/org/richfaces/renderkit/html/images/CancelControlIcon.java
trunk/framework/impl/src/main/java/org/richfaces/renderkit/html/images/ComboBoxArrowImage.java
trunk/framework/impl/src/main/java/org/richfaces/renderkit/html/images/ComboBoxButtonPressGradient.java
trunk/framework/impl/src/main/java/org/richfaces/renderkit/html/images/SaveControlIcon.java
trunk/framework/impl/src/main/java/org/richfaces/renderkit/html/images/SliderArrowBase.java
trunk/framework/impl/src/main/java/org/richfaces/renderkit/html/images/SliderArrowImage.java
trunk/framework/impl/src/main/java/org/richfaces/renderkit/html/images/SpinnerButtonDown.java
trunk/framework/impl/src/main/java/org/richfaces/renderkit/html/images/SpinnerButtonGradient.java
trunk/framework/impl/src/main/java/org/richfaces/renderkit/html/images/SpinnerButtonUp.java
trunk/framework/impl/src/main/java/org/richfaces/renderkit/html/images/SpinnerFieldGradient.java
Log:
Added: trunk/framework/impl/src/main/java/org/richfaces/renderkit/html/images/CancelControlIcon.java
===================================================================
--- trunk/framework/impl/src/main/java/org/richfaces/renderkit/html/images/CancelControlIcon.java (rev 0)
+++ trunk/framework/impl/src/main/java/org/richfaces/renderkit/html/images/CancelControlIcon.java 2008-02-20 13:36:23 UTC (rev 6197)
@@ -0,0 +1,122 @@
+/**
+ *
+ */
+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.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.Zipper2;
+
+/**
+ * implementation of the default CANCEL icon renderer
+ * @author Anton Belevich
+ * @since 3.2.0
+ *
+ */
+public class CancelControlIcon extends Java2Dresource {
+
+ protected static final String ICON_COLOR = "#971715";
+ protected static final String ICON_BORDER = "#FFFFFF";
+ protected static final String ALTERNATE_COLOR = "#ED6161";
+
+ private static final Dimension dimensions = new Dimension(11, 11);
+
+ public CancelControlIcon() {
+ setRenderer(new GifRenderer());
+ setLastModified(new Date(InternetResourceBuilder.getInstance().getStartTime()));
+ }
+
+ public Dimension getDimensions(FacesContext facesContext, Object data) {
+ return dimensions;
+ }
+
+ protected Dimension getDimensions(ResourceContext resourceContext) {
+ return dimensions;
+ }
+
+ protected Object deserializeData(byte[] objectArray) {
+ if (objectArray == null) {
+ return null;
+ }
+ Zipper2 zipper = new Zipper2(objectArray);
+ return new Color[] {zipper.nextColor(), zipper.nextColor()};
+ }
+
+ protected Object getDataToStore(FacesContext context, Object data){
+
+ byte [] ret = new byte[6];
+
+ Color color = null;
+ Zipper2 zipper = new Zipper2(ret);
+
+ color = HtmlColor.decode(ICON_COLOR);
+ zipper.addColor(color);
+
+ color = HtmlColor.decode(ICON_BORDER);
+ zipper.addColor(color);
+
+ return ret;
+ }
+
+ protected void paint(ResourceContext context, Graphics2D g2d) {
+ Color [] data = (Color[]) restoreData(context);
+
+ Color iconColor = data[0];
+ Color iconBorder = data[1];
+
+ g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_OFF);
+// g2d.setRenderingHint(RenderingHints.KEY_FRACTIONALMETRICS, RenderingHints.VALUE_FRACTIONALMETRICS_ON);
+// g2d.setRenderingHint(RenderingHints.KEY_TEXT_ANTIALIASING, RenderingHints.VALUE_TEXT_ANTIALIAS_ON);
+ g2d.setRenderingHint(RenderingHints.KEY_STROKE_CONTROL, RenderingHints.VALUE_STROKE_DEFAULT);
+ g2d.setRenderingHint(RenderingHints.KEY_COLOR_RENDERING, RenderingHints.VALUE_COLOR_RENDER_DEFAULT);
+ g2d.setRenderingHint(RenderingHints.KEY_DITHERING, RenderingHints.VALUE_DITHER_ENABLE);
+ g2d.setRenderingHint(RenderingHints.KEY_ALPHA_INTERPOLATION, RenderingHints.VALUE_ALPHA_INTERPOLATION_QUALITY);
+ g2d.setRenderingHint(RenderingHints.KEY_INTERPOLATION, RenderingHints.VALUE_INTERPOLATION_BILINEAR);
+ g2d.setRenderingHint(RenderingHints.KEY_RENDERING, RenderingHints.VALUE_RENDER_DEFAULT);
+
+ g2d.setColor(iconColor);
+
+ Color altenateColor = HtmlColor.decode(ALTERNATE_COLOR);
+ GradientPaint gradient = new GradientPaint(2,3,altenateColor,3,9,iconColor);
+ g2d.setPaint(gradient);
+
+ // draw cross
+ g2d.drawLine(2, 3, 7, 8);
+ g2d.drawLine(3, 3, 7, 7);
+ g2d.drawLine(3, 2, 8, 7);
+
+ g2d.drawLine(2, 7, 7, 2);
+ g2d.drawLine(3, 7, 7, 3);
+ g2d.drawLine(3, 8, 8, 3);
+
+ //draw border
+ g2d.setColor(iconBorder);
+ g2d.drawLine(1, 3, 3, 5);
+ g2d.drawLine(3, 5, 1, 7);
+ g2d.drawLine(1, 7, 3, 9);
+ g2d.drawLine(3, 9, 5, 7);
+ g2d.drawLine(5, 7, 7, 9);
+ g2d.drawLine(7, 9, 9, 7);
+ g2d.drawLine(9, 7, 7, 5);
+ g2d.drawLine(7, 5, 9, 3);
+ g2d.drawLine(9, 3, 7, 1);
+ g2d.drawLine(7, 1, 5, 3);
+ g2d.drawLine(5, 3, 3, 1);
+ g2d.drawLine(3, 1, 1, 3);
+
+
+ }
+}
+
Added: trunk/framework/impl/src/main/java/org/richfaces/renderkit/html/images/ComboBoxArrowImage.java
===================================================================
--- trunk/framework/impl/src/main/java/org/richfaces/renderkit/html/images/ComboBoxArrowImage.java (rev 0)
+++ trunk/framework/impl/src/main/java/org/richfaces/renderkit/html/images/ComboBoxArrowImage.java 2008-02-20 13:36:23 UTC (rev 6197)
@@ -0,0 +1,144 @@
+package org.richfaces.renderkit.html.images;
+
+import java.awt.Color;
+import java.awt.Dimension;
+import java.awt.Graphics2D;
+import java.awt.RenderingHints;
+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.Zipper2;
+import org.richfaces.skin.Skin;
+import org.richfaces.skin.SkinFactory;
+
+/**
+ * @author Anton Belevich
+ * @since 3.2.0
+ * ComboBox down image renderer
+ */
+public class ComboBoxArrowImage extends Java2Dresource{
+
+
+ protected static final String ICON_COLOR = "generalTextColor";
+ protected static final String BACKGROUND_COLOR = "tabBackgroundColor";
+ protected static final String BORDER_COLOR = "generalBackgroundColor";
+
+ protected static final String DISABLED_ICON_COLOR = "tabDisabledTextColor";
+ protected static final String DISABLED_BACKGROUND_COLOR = "tabBackgroundColor";
+ protected static final String DISABLED_BORDER_COLOR = "generalBackgroundColor";
+
+ private static final Dimension dimensions = new Dimension(15, 15);
+
+ public ComboBoxArrowImage() {
+ setRenderer(new GifRenderer());
+ setLastModified(new Date(InternetResourceBuilder.getInstance().getStartTime()));
+ }
+
+ protected Dimension getDimensions(ResourceContext resourceContext) {
+ return dimensions;
+ }
+ public Dimension getDimensions(FacesContext facesContext, Object data) {
+ return dimensions;
+ }
+
+ protected Object deserializeData(byte[] objectArray) {
+ if (objectArray == null) {
+ return null;
+ }
+ Zipper2 zipper = new Zipper2(objectArray);
+ return new Color[] {zipper.nextColor(), zipper.nextColor(), zipper.nextColor()};
+ }
+
+ protected Object getDataToStore(FacesContext context, Object data) {
+ return storeData(context, ICON_COLOR, BACKGROUND_COLOR, BORDER_COLOR);
+ }
+
+ protected Object storeData(FacesContext context, String colorSkinParam, String backgroundSkinParam, String borderSkinParam) {
+
+ Skin skin = SkinFactory.getInstance().getSkin(context);
+ Skin defaultSkin = SkinFactory.getInstance().getDefaultSkin(context);
+
+ byte [] ret = new byte[9];
+
+ Color color = null;
+ Zipper2 zipper = new Zipper2(ret);
+
+ String color1 = (String) skin.getParameter(context, colorSkinParam);
+
+ if (null == color1 || "".equals(color1)) {
+ color1 = (String) defaultSkin.getParameter(context, colorSkinParam);
+ }
+
+ if (color1 == null) {
+ color1 = "#FFFFFF";
+ }
+
+ color = HtmlColor.decode(color1);
+
+ zipper.addColor(color);
+
+ String color2 = (String) skin.getParameter(context, backgroundSkinParam);
+ if (null == color2 || "".equals(color2))
+ color2 = (String) defaultSkin.getParameter(context, backgroundSkinParam);
+
+ if (color2 == null) {
+ color2 = "#000000";
+ }
+
+ color = HtmlColor.decode(color2);
+ zipper.addColor(color);
+
+ String color3 = (String) skin.getParameter(context, borderSkinParam);
+ if (null == color3 || "".equals(color3))
+ color3 = (String) defaultSkin.getParameter(context, backgroundSkinParam);
+
+ if (color3 == null) {
+ color3 = "#000000";
+ }
+
+ color = HtmlColor.decode(color3);
+ zipper.addColor(color);
+
+ return ret;
+ }
+
+ protected void paint(ResourceContext context, Graphics2D g2d) {
+ Color [] data = (Color[]) restoreData(context);
+ Color textColor = data[0];
+// Color backgroundColor = data[1];
+ Color borderColor = data[2];
+
+ g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_OFF);
+ g2d.setRenderingHint(RenderingHints.KEY_STROKE_CONTROL, RenderingHints.VALUE_STROKE_NORMALIZE);
+ g2d.setRenderingHint(RenderingHints.KEY_COLOR_RENDERING, RenderingHints.VALUE_COLOR_RENDER_QUALITY);
+ g2d.setRenderingHint(RenderingHints.KEY_DITHERING, RenderingHints.VALUE_DITHER_DISABLE);
+ g2d.setRenderingHint(RenderingHints.KEY_ALPHA_INTERPOLATION, RenderingHints.VALUE_ALPHA_INTERPOLATION_QUALITY);
+ g2d.setRenderingHint(RenderingHints.KEY_INTERPOLATION, RenderingHints.VALUE_INTERPOLATION_BICUBIC);
+ g2d.setRenderingHint(RenderingHints.KEY_RENDERING, RenderingHints.VALUE_RENDER_QUALITY);
+
+ if (textColor != null && borderColor != null && g2d != null) {
+
+ g2d.setColor(textColor);
+ g2d.translate(7, 5);
+ paintBaseTriangle(g2d);
+ g2d.translate(-7, -5);
+
+ g2d.setColor(borderColor);
+ g2d.drawLine(4, 5, 10, 5);
+ g2d.drawLine(11, 6, 7, 10);
+ g2d.drawLine(7, 10, 3, 6);
+ }
+ }
+
+ protected void paintBaseTriangle(Graphics2D g2d) {
+ for (int i = 0; i < 7; i++) {
+ g2d.drawLine(-3 + i, 1, -3 + i, 1 + (i < 4 ? i : 6 - i));
+ }
+ }
+}
Added: trunk/framework/impl/src/main/java/org/richfaces/renderkit/html/images/ComboBoxButtonPressGradient.java
===================================================================
--- trunk/framework/impl/src/main/java/org/richfaces/renderkit/html/images/ComboBoxButtonPressGradient.java (rev 0)
+++ trunk/framework/impl/src/main/java/org/richfaces/renderkit/html/images/ComboBoxButtonPressGradient.java 2008-02-20 13:36:23 UTC (rev 6197)
@@ -0,0 +1,19 @@
+/**
+ *
+ */
+package org.richfaces.renderkit.html.images;
+
+import org.richfaces.renderkit.html.BaseGradient;
+import org.richfaces.skin.Skin;
+
+/**
+ * @author Anton Belevich
+ * @since 3.2.0
+ */
+public class ComboBoxButtonPressGradient extends BaseGradient{
+
+ public ComboBoxButtonPressGradient() {
+ super(7,15 , 9, Skin.headerBackgroundColor, "headerGradientColor");
+ }
+
+}
Added: trunk/framework/impl/src/main/java/org/richfaces/renderkit/html/images/SaveControlIcon.java
===================================================================
--- trunk/framework/impl/src/main/java/org/richfaces/renderkit/html/images/SaveControlIcon.java (rev 0)
+++ trunk/framework/impl/src/main/java/org/richfaces/renderkit/html/images/SaveControlIcon.java 2008-02-20 13:36:23 UTC (rev 6197)
@@ -0,0 +1,125 @@
+/**
+ *
+ */
+package org.richfaces.renderkit.html.images;
+
+import java.awt.Color;
+import java.awt.Dimension;
+import java.awt.Graphics2D;
+import java.awt.RenderingHints;
+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.Zipper2;
+
+/**
+ * implementation of the default OK icon renderer
+ * @author Anton Belevich
+ * @since 3.2.0
+ *
+ */
+public class saveControlIcon extends Java2Dresource {
+
+ protected static final String ICON_COLOR = "#5BC248";
+ protected static final String ICON_SHADOW = "#006406";
+ protected static final String ICON_BORDER = "#FFFFFF";
+
+ private static final Dimension dimensions = new Dimension(11, 11);
+
+ public Dimension getDimensions(FacesContext facesContext, Object data) {
+ return dimensions;
+ }
+
+
+ protected Dimension getDimensions(ResourceContext resourceContext) {
+ return dimensions;
+ }
+ public saveControlIcon() {
+ setRenderer(new GifRenderer());
+ setLastModified(new Date(InternetResourceBuilder.getInstance().getStartTime()));
+ }
+
+ protected Object deserializeData(byte[] objectArray) {
+ if (objectArray == null) {
+ return null;
+ }
+ Zipper2 zipper = new Zipper2(objectArray);
+ return new Color[] {zipper.nextColor(), zipper.nextColor(), zipper.nextColor()};
+ }
+
+ protected Object getDataToStore(FacesContext context, Object data){
+
+ byte [] ret = new byte[9];
+
+ Color color = null;
+ Zipper2 zipper = new Zipper2(ret);
+
+ color = HtmlColor.decode(ICON_COLOR);
+ zipper.addColor(color);
+
+ color = HtmlColor.decode(ICON_SHADOW);
+ zipper.addColor(color);
+
+ color = HtmlColor.decode(ICON_BORDER);
+ zipper.addColor(color);
+
+ return ret;
+ }
+
+ protected void paint(ResourceContext context, Graphics2D g2d) {
+ Color [] data = (Color[]) restoreData(context);
+
+ Color iconColor = data[0];
+ Color iconShadow = data[1];
+ Color borderColor = data[2];
+
+ g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_OFF);
+ g2d.setRenderingHint(RenderingHints.KEY_STROKE_CONTROL, RenderingHints.VALUE_STROKE_NORMALIZE);
+ g2d.setRenderingHint(RenderingHints.KEY_COLOR_RENDERING, RenderingHints.VALUE_COLOR_RENDER_QUALITY);
+ g2d.setRenderingHint(RenderingHints.KEY_DITHERING, RenderingHints.VALUE_DITHER_DISABLE);
+ g2d.setRenderingHint(RenderingHints.KEY_ALPHA_INTERPOLATION, RenderingHints.VALUE_ALPHA_INTERPOLATION_QUALITY);
+ g2d.setRenderingHint(RenderingHints.KEY_INTERPOLATION, RenderingHints.VALUE_INTERPOLATION_BICUBIC);
+ g2d.setRenderingHint(RenderingHints.KEY_RENDERING, RenderingHints.VALUE_RENDER_QUALITY);
+
+ g2d.setColor(iconColor);
+ g2d.drawLine(1, 6, 4, 9);
+ g2d.drawLine(4, 9, 4, 8);
+ g2d.drawLine(4, 8, 2, 6);
+ g2d.drawLine(2, 5, 5, 8);
+ g2d.drawLine(5, 8, 5, 6);
+ g2d.drawLine(5, 6, 9, 2);
+ g2d.drawLine(9, 2, 9, 3);
+ g2d.drawLine(9, 3, 5, 7);
+
+ //draw shadow
+ g2d.setColor(iconShadow);
+ g2d.drawLine(3, 5, 4, 6);
+ g2d.drawLine(5, 9, 6, 8);
+ g2d.drawLine(6, 8, 6, 7);
+ g2d.drawLine(6, 7, 9, 4);
+
+ // draw border
+ g2d.setColor(borderColor);
+ g2d.drawLine(0, 6, 4, 10);
+ g2d.drawLine(4, 10, 5,10);
+ g2d.drawLine(5,10,7,8);
+ g2d.drawLine(7,8,7,7);
+ g2d.drawLine(7,7,10,4);
+ g2d.drawLine(10,4,10,1);
+ g2d.drawLine(10,1,9,1);
+ g2d.drawLine(9,1,5,5);
+ g2d.drawLine(5,5,4,5);
+ g2d.drawLine(4,5,3,4);
+ g2d.drawLine(3,4,2,4);
+ g2d.drawLine(2,4,0,6);
+
+
+
+ }
+}
Added: trunk/framework/impl/src/main/java/org/richfaces/renderkit/html/images/SliderArrowBase.java
===================================================================
--- trunk/framework/impl/src/main/java/org/richfaces/renderkit/html/images/SliderArrowBase.java (rev 0)
+++ trunk/framework/impl/src/main/java/org/richfaces/renderkit/html/images/SliderArrowBase.java 2008-02-20 13:36:23 UTC (rev 6197)
@@ -0,0 +1,66 @@
+/**
+ * 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.images;
+
+import java.awt.Color;
+import java.awt.Dimension;
+import java.awt.Graphics2D;
+import java.awt.RenderingHints;
+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;
+
+public abstract class SliderArrowBase extends Java2Dresource{
+ private static final Dimension dimensions = new Dimension(7, 8);
+
+ public SliderArrowBase() {
+ setRenderer(new GifRenderer());
+ setLastModified(new Date(InternetResourceBuilder.getInstance().getStartTime()));
+ }
+
+ protected Dimension getDimensions(ResourceContext resourceContext) {
+ return dimensions;
+ }
+ public Dimension getDimensions(FacesContext facesContext, Object data) {
+ return dimensions;
+ }
+
+ protected void paint(ResourceContext context, Graphics2D g2d) {
+ Integer color = (Integer) restoreData(context);
+ g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
+ g2d.setColor(new Color(color.intValue()));
+ g2d.drawLine(0,2,6,2);
+ g2d.drawLine(1,3,5,3);
+ g2d.drawLine(2,4,4,4);
+ g2d.drawLine(3,5,3,5);
+ }
+
+ public boolean isCacheable() {
+ return true;
+ }
+
+}
Added: trunk/framework/impl/src/main/java/org/richfaces/renderkit/html/images/SliderArrowImage.java
===================================================================
--- trunk/framework/impl/src/main/java/org/richfaces/renderkit/html/images/SliderArrowImage.java (rev 0)
+++ trunk/framework/impl/src/main/java/org/richfaces/renderkit/html/images/SliderArrowImage.java 2008-02-20 13:36:23 UTC (rev 6197)
@@ -0,0 +1,56 @@
+/**
+ * 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.images;
+
+import java.nio.ByteBuffer;
+import java.nio.IntBuffer;
+
+import javax.faces.context.FacesContext;
+
+import org.ajax4jsf.util.HtmlColor;
+import org.richfaces.skin.Skin;
+import org.richfaces.skin.SkinFactory;
+
+public class SliderArrowImage extends SliderArrowBase {
+ protected Object getDataToStore(FacesContext context, Object data) {
+ Skin skin = SkinFactory.getInstance().getSkin(context);
+
+ String skinParameter = "generalTextColor";
+ String tmp = (String) skin.getParameter(context, skinParameter);
+ if (null == tmp || "".equals(tmp)) {
+ Skin defaultSkin = SkinFactory.getInstance().getDefaultSkin(context);
+ tmp = (String) defaultSkin.getParameter(context, skinParameter);
+ }
+ int intValue = HtmlColor.decode(tmp ==null? "#000000":tmp).getRGB();
+ // Serialize data as byte[]
+ ByteBuffer buff = ByteBuffer.allocate(1*4);
+ IntBuffer intBuffer = buff.asIntBuffer();
+ intBuffer.put(intValue);
+ return buff.array();
+ }
+
+ protected Object deserializeData(byte[] objectArray) {
+ // restore color value from a byte[] array.
+ int i = ByteBuffer.wrap(objectArray).asIntBuffer().get();
+ return new Integer(i);
+ }
+}
\ No newline at end of file
Added: trunk/framework/impl/src/main/java/org/richfaces/renderkit/html/images/SpinnerButtonDown.java
===================================================================
--- trunk/framework/impl/src/main/java/org/richfaces/renderkit/html/images/SpinnerButtonDown.java (rev 0)
+++ trunk/framework/impl/src/main/java/org/richfaces/renderkit/html/images/SpinnerButtonDown.java 2008-02-20 13:36:23 UTC (rev 6197)
@@ -0,0 +1,71 @@
+/**
+ * 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.images;
+
+import java.awt.Color;
+import java.awt.Dimension;
+import java.awt.Graphics2D;
+import java.awt.RenderingHints;
+
+import javax.faces.context.FacesContext;
+
+import org.ajax4jsf.resource.ResourceContext;
+
+public class SpinnerButtonDown extends SpinnerButtonImage {
+ private static final Dimension dimensions = new Dimension(14, 7);
+
+ protected Dimension getDimensions(ResourceContext resourceContext) {
+ return dimensions;
+ }
+ public Dimension getDimensions(FacesContext facesContext, Object data) {
+ return dimensions;
+ }
+
+ protected void paint(ResourceContext context, Graphics2D g2d) {
+ Color[] color = (Color []) restoreData(context);
+ Color triangleColor = color[0];
+ Color borderColor = color[1];
+
+ g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
+ g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_OFF);
+ g2d.setRenderingHint(RenderingHints.KEY_STROKE_CONTROL, RenderingHints.VALUE_STROKE_NORMALIZE);
+ g2d.setRenderingHint(RenderingHints.KEY_COLOR_RENDERING, RenderingHints.VALUE_COLOR_RENDER_QUALITY);
+ g2d.setRenderingHint(RenderingHints.KEY_DITHERING, RenderingHints.VALUE_DITHER_DISABLE);
+ g2d.setRenderingHint(RenderingHints.KEY_ALPHA_INTERPOLATION, RenderingHints.VALUE_ALPHA_INTERPOLATION_QUALITY);
+ g2d.setRenderingHint(RenderingHints.KEY_INTERPOLATION, RenderingHints.VALUE_INTERPOLATION_BICUBIC);
+ g2d.setRenderingHint(RenderingHints.KEY_RENDERING, RenderingHints.VALUE_RENDER_QUALITY);
+
+ g2d.setColor(triangleColor);
+ g2d.drawLine(5,2,9,2);
+ g2d.drawLine(6,3,8,3);
+ g2d.drawLine(7,4,7,4);
+
+ g2d.setColor(borderColor);
+ g2d.drawLine(5, 1, 9, 1);
+ g2d.drawLine(10, 2, 7, 5);
+ g2d.drawLine(7, 5, 4, 2);
+
+
+ }
+
+
+}
Added: trunk/framework/impl/src/main/java/org/richfaces/renderkit/html/images/SpinnerButtonGradient.java
===================================================================
--- trunk/framework/impl/src/main/java/org/richfaces/renderkit/html/images/SpinnerButtonGradient.java (rev 0)
+++ trunk/framework/impl/src/main/java/org/richfaces/renderkit/html/images/SpinnerButtonGradient.java 2008-02-20 13:36:23 UTC (rev 6197)
@@ -0,0 +1,30 @@
+/**
+ * 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.images;
+
+import org.richfaces.renderkit.html.BaseGradient;
+
+public class SpinnerButtonGradient extends BaseGradient {
+ public SpinnerButtonGradient() {
+ super(30, 50, 20, "headerGradientColor", "headerBackgroundColor");
+ }
+}
Added: trunk/framework/impl/src/main/java/org/richfaces/renderkit/html/images/SpinnerButtonUp.java
===================================================================
--- trunk/framework/impl/src/main/java/org/richfaces/renderkit/html/images/SpinnerButtonUp.java (rev 0)
+++ trunk/framework/impl/src/main/java/org/richfaces/renderkit/html/images/SpinnerButtonUp.java 2008-02-20 13:36:23 UTC (rev 6197)
@@ -0,0 +1,71 @@
+/**
+ * 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.images;
+
+import java.awt.Color;
+import java.awt.Dimension;
+import java.awt.Graphics2D;
+import java.awt.RenderingHints;
+
+import javax.faces.context.FacesContext;
+
+import org.ajax4jsf.resource.ResourceContext;
+
+public class SpinnerButtonUp extends SpinnerButtonImage {
+ private static final Dimension dimensions = new Dimension(14, 7);
+
+ protected Dimension getDimensions(ResourceContext resourceContext) {
+ return dimensions;
+ }
+ public Dimension getDimensions(FacesContext facesContext, Object data) {
+ return dimensions;
+ }
+
+ protected void paint(ResourceContext context, Graphics2D g2d) {
+
+ Color [] data = (Color []) restoreData(context);
+ Color textColor = data[0];
+ Color borderColor = data[1];
+
+ g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_OFF);
+ g2d.setRenderingHint(RenderingHints.KEY_STROKE_CONTROL, RenderingHints.VALUE_STROKE_NORMALIZE);
+ g2d.setRenderingHint(RenderingHints.KEY_COLOR_RENDERING, RenderingHints.VALUE_COLOR_RENDER_QUALITY);
+ g2d.setRenderingHint(RenderingHints.KEY_DITHERING, RenderingHints.VALUE_DITHER_DISABLE);
+ g2d.setRenderingHint(RenderingHints.KEY_ALPHA_INTERPOLATION, RenderingHints.VALUE_ALPHA_INTERPOLATION_QUALITY);
+ g2d.setRenderingHint(RenderingHints.KEY_INTERPOLATION, RenderingHints.VALUE_INTERPOLATION_BICUBIC);
+ g2d.setRenderingHint(RenderingHints.KEY_RENDERING, RenderingHints.VALUE_RENDER_QUALITY);
+
+ g2d.setColor(textColor);
+ g2d.drawLine(5,5,9,5);
+ g2d.drawLine(6,4,8,4);
+ g2d.drawLine(7,3,7,3);
+
+ g2d.setColor(borderColor);
+ g2d.drawLine(5, 6, 9, 6);
+ g2d.drawLine(10, 5, 7, 2);
+ g2d.drawLine(7, 2, 4, 5);
+
+ }
+
+}
+
+
Added: trunk/framework/impl/src/main/java/org/richfaces/renderkit/html/images/SpinnerFieldGradient.java
===================================================================
--- trunk/framework/impl/src/main/java/org/richfaces/renderkit/html/images/SpinnerFieldGradient.java (rev 0)
+++ trunk/framework/impl/src/main/java/org/richfaces/renderkit/html/images/SpinnerFieldGradient.java 2008-02-20 13:36:23 UTC (rev 6197)
@@ -0,0 +1,33 @@
+/**
+ * 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.images;
+
+import org.richfaces.renderkit.html.BaseGradient;
+
+public class SpinnerFieldGradient extends BaseGradient {
+
+ public SpinnerFieldGradient() {
+ super(30, 50, 12, "additionalBackgroundColor", "controlBackgroundColor");
+ }
+
+
+}
18 years, 2 months
JBoss Rich Faces SVN: r6195 - trunk/framework/impl/src/main/java/org/richfaces/renderkit/html/images.
by richfaces-svn-commits@lists.jboss.org
Author: abelevich
Date: 2008-02-20 08:24:38 -0500 (Wed, 20 Feb 2008)
New Revision: 6195
Added:
trunk/framework/impl/src/main/java/org/richfaces/renderkit/html/images/SaveControlIcon.java
Log:
Added: trunk/framework/impl/src/main/java/org/richfaces/renderkit/html/images/SaveControlIcon.java
===================================================================
--- trunk/framework/impl/src/main/java/org/richfaces/renderkit/html/images/SaveControlIcon.java (rev 0)
+++ trunk/framework/impl/src/main/java/org/richfaces/renderkit/html/images/SaveControlIcon.java 2008-02-20 13:24:38 UTC (rev 6195)
@@ -0,0 +1,125 @@
+/**
+ *
+ */
+package org.richfaces.renderkit.html.images;
+
+import java.awt.Color;
+import java.awt.Dimension;
+import java.awt.Graphics2D;
+import java.awt.RenderingHints;
+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.Zipper2;
+
+/**
+ * implementation of the default OK icon renderer
+ * @author Anton Belevich
+ * @since 3.2.0
+ *
+ */
+public class SaveControlIcon extends Java2Dresource {
+
+ protected static final String ICON_COLOR = "#5BC248";
+ protected static final String ICON_SHADOW = "#006406";
+ protected static final String ICON_BORDER = "#FFFFFF";
+
+ private static final Dimension dimensions = new Dimension(11, 11);
+
+ public Dimension getDimensions(FacesContext facesContext, Object data) {
+ return dimensions;
+ }
+
+
+ protected Dimension getDimensions(ResourceContext resourceContext) {
+ return dimensions;
+ }
+ public SaveControlIcon() {
+ setRenderer(new GifRenderer());
+ setLastModified(new Date(InternetResourceBuilder.getInstance().getStartTime()));
+ }
+
+ protected Object deserializeData(byte[] objectArray) {
+ if (objectArray == null) {
+ return null;
+ }
+ Zipper2 zipper = new Zipper2(objectArray);
+ return new Color[] {zipper.nextColor(), zipper.nextColor(), zipper.nextColor()};
+ }
+
+ protected Object getDataToStore(FacesContext context, Object data){
+
+ byte [] ret = new byte[9];
+
+ Color color = null;
+ Zipper2 zipper = new Zipper2(ret);
+
+ color = HtmlColor.decode(ICON_COLOR);
+ zipper.addColor(color);
+
+ color = HtmlColor.decode(ICON_SHADOW);
+ zipper.addColor(color);
+
+ color = HtmlColor.decode(ICON_BORDER);
+ zipper.addColor(color);
+
+ return ret;
+ }
+
+ protected void paint(ResourceContext context, Graphics2D g2d) {
+ Color [] data = (Color[]) restoreData(context);
+
+ Color iconColor = data[0];
+ Color iconShadow = data[1];
+ Color borderColor = data[2];
+
+ g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_OFF);
+ g2d.setRenderingHint(RenderingHints.KEY_STROKE_CONTROL, RenderingHints.VALUE_STROKE_NORMALIZE);
+ g2d.setRenderingHint(RenderingHints.KEY_COLOR_RENDERING, RenderingHints.VALUE_COLOR_RENDER_QUALITY);
+ g2d.setRenderingHint(RenderingHints.KEY_DITHERING, RenderingHints.VALUE_DITHER_DISABLE);
+ g2d.setRenderingHint(RenderingHints.KEY_ALPHA_INTERPOLATION, RenderingHints.VALUE_ALPHA_INTERPOLATION_QUALITY);
+ g2d.setRenderingHint(RenderingHints.KEY_INTERPOLATION, RenderingHints.VALUE_INTERPOLATION_BICUBIC);
+ g2d.setRenderingHint(RenderingHints.KEY_RENDERING, RenderingHints.VALUE_RENDER_QUALITY);
+
+ g2d.setColor(iconColor);
+ g2d.drawLine(1, 6, 4, 9);
+ g2d.drawLine(4, 9, 4, 8);
+ g2d.drawLine(4, 8, 2, 6);
+ g2d.drawLine(2, 5, 5, 8);
+ g2d.drawLine(5, 8, 5, 6);
+ g2d.drawLine(5, 6, 9, 2);
+ g2d.drawLine(9, 2, 9, 3);
+ g2d.drawLine(9, 3, 5, 7);
+
+ //draw shadow
+ g2d.setColor(iconShadow);
+ g2d.drawLine(3, 5, 4, 6);
+ g2d.drawLine(5, 9, 6, 8);
+ g2d.drawLine(6, 8, 6, 7);
+ g2d.drawLine(6, 7, 9, 4);
+
+ // draw border
+ g2d.setColor(borderColor);
+ g2d.drawLine(0, 6, 4, 10);
+ g2d.drawLine(4, 10, 5,10);
+ g2d.drawLine(5,10,7,8);
+ g2d.drawLine(7,8,7,7);
+ g2d.drawLine(7,7,10,4);
+ g2d.drawLine(10,4,10,1);
+ g2d.drawLine(10,1,9,1);
+ g2d.drawLine(9,1,5,5);
+ g2d.drawLine(5,5,4,5);
+ g2d.drawLine(4,5,3,4);
+ g2d.drawLine(3,4,2,4);
+ g2d.drawLine(2,4,0,6);
+
+
+
+ }
+}
18 years, 2 months
JBoss Rich Faces SVN: r6194 - in trunk/sandbox/ui/inplaceSelect/src/main: templates and 1 other directory.
by richfaces-svn-commits@lists.jboss.org
Author: vmolotkov
Date: 2008-02-20 08:21:26 -0500 (Wed, 20 Feb 2008)
New Revision: 6194
Modified:
trunk/sandbox/ui/inplaceSelect/src/main/config/component/inplaceselect.xml
trunk/sandbox/ui/inplaceSelect/src/main/templates/inplaceselect.jspx
Log:
aligning is corrected
Modified: trunk/sandbox/ui/inplaceSelect/src/main/config/component/inplaceselect.xml
===================================================================
--- trunk/sandbox/ui/inplaceSelect/src/main/config/component/inplaceselect.xml 2008-02-20 12:16:23 UTC (rev 6193)
+++ trunk/sandbox/ui/inplaceSelect/src/main/config/component/inplaceselect.xml 2008-02-20 13:21:26 UTC (rev 6194)
@@ -69,6 +69,11 @@
<property>
<name>controlsPosition</name>
<classname>java.lang.String</classname>
+ <defaultvalue><![CDATA["center"]]></defaultvalue>
+ </property>
+ <property>
+ <name>controlsHorizontalAlign</name>
+ <classname>java.lang.String</classname>
<defaultvalue><![CDATA["right"]]></defaultvalue>
</property>
<property>
Modified: trunk/sandbox/ui/inplaceSelect/src/main/templates/inplaceselect.jspx
===================================================================
--- trunk/sandbox/ui/inplaceSelect/src/main/templates/inplaceselect.jspx 2008-02-20 12:16:23 UTC (rev 6193)
+++ trunk/sandbox/ui/inplaceSelect/src/main/templates/inplaceselect.jspx 2008-02-20 13:21:26 UTC (rev 6194)
@@ -72,7 +72,7 @@
tabindex='#{component.attributes["tabindex"]}'
class="insel_field"/>
<input id='#{clientId}inplaceValue' name='#{clientId}value' type='hidden' value='#{fieldValue}'/>
- <div id="#{clientId}bar" class="insel_btn_set">
+ <div id="#{clientId}bar" class="insel_btn_set" style="display:none;">
<div class="insel_shadow">
<table cellpadding="0" cellspacing="0" border="0" class="insel_shadow_size">
<tr>
@@ -93,9 +93,9 @@
</tr>
</table>
</div>
- <div style="position : relative">
- <input type="image" src="#{saveIcon}" class="insel_btn" onmousedown="this.className='insel_btn_press'" onmouseout="this.className='insel_btn'" onmouseup="this.className='insel_btn'"/>
- <input type="image" src="#{cancelIcon}" class="insel_btn" onmousedown="this.className='insel_btn_press'" onmouseout="this.className='insel_btn'" onmouseup="this.className='insel_btn'"/>
+ <div id="#{clientId}buttons" style="position : relative">
+ <input id="#{clientId}ok" type="image" src="#{saveIcon}" class="insel_btn" onmousedown="this.className='insel_btn_press'" onmouseout="this.className='insel_btn'" onmouseup="this.className='insel_btn'"/>
+ <input id="#{clientId}cancel" type="image" src="#{cancelIcon}" class="insel_btn" onmousedown="this.className='insel_btn_press'" onmouseout="this.className='insel_btn'" onmouseup="this.className='insel_btn'"/>
</div>
</div>
@@ -149,9 +149,9 @@
SELECTED : "rich-combobox-item rich-combobox-item-selected #{itemSelectedClass}"
}
},
- COMPONENT : {CHANGED : {NORMAL : 'rich-inplace rich-inplace-changed #{component.attributes["changedClass"]}', HOVERED : '#{component.attributes["changedHoveredClass"]}'},
- VIEW : {NORMAL : 'rich-inplace rich-inplace-view #{component.attributes["viewClass"]}', HOVERED : '#{component.attributes["viewHoveredClass"]}'},
- EDITABLE : 'rich-inplace rich-inplace-edit #{component.attributes["editClass"]}'
+ COMPONENT : {CHANGED : {NORMAL : 'rich-inplace insel_default_state insel_changed_state #{component.attributes["changedClass"]}', HOVERED : '#{component.attributes["changedHoveredClass"]}'},
+ VIEW : {NORMAL : 'rich-inplace insel_default_state #{component.attributes["viewClass"]}', HOVERED : '#{component.attributes["viewHoveredClass"]}'},
+ EDITABLE : 'rich-inplace insel_edit_state #{component.attributes["editClass"]}'
}
};
18 years, 2 months
JBoss Rich Faces SVN: r6193 - trunk/ui/progressBAR/src/main/java/org/richfaces/component.
by richfaces-svn-commits@lists.jboss.org
Author: andrei_exadel
Date: 2008-02-20 07:16:23 -0500 (Wed, 20 Feb 2008)
New Revision: 6193
Modified:
trunk/ui/progressBAR/src/main/java/org/richfaces/component/UIProgressBar.java
Log:
little refactoring
Modified: trunk/ui/progressBAR/src/main/java/org/richfaces/component/UIProgressBar.java
===================================================================
--- trunk/ui/progressBAR/src/main/java/org/richfaces/component/UIProgressBar.java 2008-02-20 11:57:05 UTC (rev 6192)
+++ trunk/ui/progressBAR/src/main/java/org/richfaces/component/UIProgressBar.java 2008-02-20 12:16:23 UTC (rev 6193)
@@ -76,7 +76,7 @@
ajaxContext.addComponentToAjaxRender(this, id);
}
}
- } else {
+ } else if (params.containsKey(FORCE_PERCENT_PARAM)) {
ajaxContext.addComponentToAjaxRender(this);
}
18 years, 2 months
JBoss Rich Faces SVN: r6192 - in trunk/sandbox/ui/fileUpload/src/main: templates/org/richfaces and 1 other directory.
by richfaces-svn-commits@lists.jboss.org
Author: dsvyatobatsko
Date: 2008-02-20 06:57:05 -0500 (Wed, 20 Feb 2008)
New Revision: 6192
Modified:
trunk/sandbox/ui/fileUpload/src/main/resources/org/richfaces/renderkit/html/js/FileUpload.js
trunk/sandbox/ui/fileUpload/src/main/templates/org/richfaces/fileUpload.jspx
Log:
Modified: trunk/sandbox/ui/fileUpload/src/main/resources/org/richfaces/renderkit/html/js/FileUpload.js
===================================================================
--- trunk/sandbox/ui/fileUpload/src/main/resources/org/richfaces/renderkit/html/js/FileUpload.js 2008-02-20 11:42:22 UTC (rev 6191)
+++ trunk/sandbox/ui/fileUpload/src/main/resources/org/richfaces/renderkit/html/js/FileUpload.js 2008-02-20 11:57:05 UTC (rev 6192)
@@ -285,8 +285,12 @@
options: null,
runUpload: false,
-
- initialize: function(id, stopScript, progressBarId, options) {
+
+ classes: null,
+
+ maxFileBatchSize: 5,
+
+ initialize: function(id, stopScript, progressBarId, classes, options) {
this.id = id;
this.element = $(this.id);
//this.progressBarId = progressBarId;
@@ -299,11 +303,12 @@
this.iframe = $(this.id + "_iframe");
this.items = $(this.id + ":fileItems");
+ this.classes = classes;
+
this.options = options || {};
-
this.setupAutoUpload();
},
-
+
prepareProgressBar: function () {
this.progressBar.setValue(0);
Element.show(this._progressBar);
@@ -318,17 +323,17 @@
setupAutoUpload: function() {
this.runUpload = this.options.autoUpload;
},
-
+
add: function(elt) {
var newEntry = new FileUploadEntry(elt, this);
this.entries.push(newEntry);
-
+
if (this.runUpload) {
newEntry.setState(FileUploadEntry.READY);
} else {
newEntry.setState(FileUploadEntry.INITIALIZED);
}
-
+
var newUpload = elt.cloneNode(true);
newUpload.id = this.id + ":file" + (this.idCounter++);
$(this.id + ":add1").appendChild(newUpload);
@@ -336,13 +341,17 @@
if (this.runUpload) {
this.upload();
}
+
+ this.disableAddButton(this.entries.length > this.maxFileBatchSize);
},
-
+
remove: function(entry) {
entry.clear();
this.entries = this.entries.without(entry);
+
+ this.disableAddButton(this.entries.length > this.maxFileBatchSize);
},
-
+
_selectEntryForUpload: function() {
var l = this.entries.length;
for (var i = 0; i < l; i++) {
@@ -358,7 +367,7 @@
upload: function() {
this.runUpload = true;
-
+
if (!this.activeEntry) {
//no upload is being run now
@@ -371,7 +380,7 @@
stop: function() {
this.runUpload = false;
-
+
if (this.activeEntry) {
this.activeEntry.stop();
}
@@ -396,8 +405,38 @@
if (this.entries.length == 0) {
this.setupAutoUpload();
}
+
+ this.disableAddButton(this.entries.length > this.maxFileBatchSize);
},
+ disableCleanButton: function(disabled) {
+ if(disabled) {
+ $(this.id + ":clean1").onclick = function() {return false;};
+ } else {
+ $(this.id + ":clean1").onclick = function() {return this.clear();}.bind(this);
+ }
+
+ $(this.id+":clean1").className = (disabled? this.classes.CLEAN.DISABLED : this.classes.CLEAN.ENABLED);
+ $(this.id+":clean2").className = (disabled? this.classes.CLEAN_CONTENT.DISABLED : this.classes.CLEAN_CONTENT.ENABLED);
+ },
+
+ disableAddButton: function(disabled) {
+ $(this.id+":file").disabled = disabled;
+ $(this.id+":add1").className = (disabled? this.classes.ADD.DISABLED : this.classes.ADD.ENABLED);
+ $(this.id+":add2").className = (disabled? this.classes.ADD_CONTENT.DISABLED : this.classes.ADD_CONTENT.ENABLED);
+ },
+
+ disableUploadButton: function (disabled) {
+ if(disabled) {
+ $(this.id + ":upload1").onclick = function() {return false;};
+ } else {
+ $(this.id + ":upload1").onclick = function() {return this.upload();}.bind(this);
+ }
+
+ $(this.id + ":upload1").className = (disabled? this.classes.UPDATE.DISABLED : this.classes.UPDATE.ENABLED);
+ $(this.id + ":upload2").className = (disabled? this.classes.UPDATE_CONTENT.DISABLED : this.classes.UPDATE_CONTENT.ENABLED);
+ },
+
_endUpload: function() {
this.activeEntry = null;
//this.progressBar.setValue(100);
@@ -450,9 +489,10 @@
//has been requested to stop by user
this.setupAutoUpload();
}
-
+
this._updateEntriesState();
-
+ this.disableUploadButton(false);
+
} else if (newState == FileUploadEntry.UPLOAD_CANCELED ||
newState == FileUploadEntry.UPLOAD_TRANSFER_ERROR ||
newState == FileUploadEntry.UPLOAD_SERVER_ERROR) {
@@ -463,7 +503,9 @@
this.runUpload = false;
this._updateEntriesState();
-
+
+ this.disableUploadButton(false);
+
} else if (newState == FileUploadEntry.UPLOAD_IN_PROGRESS) {
this.activeEntry = entry;
@@ -471,6 +513,8 @@
this.progressBar.enable();
this._updateEntriesState();
+
+ this.disableUploadButton(true);
}
},
Modified: trunk/sandbox/ui/fileUpload/src/main/templates/org/richfaces/fileUpload.jspx
===================================================================
--- trunk/sandbox/ui/fileUpload/src/main/templates/org/richfaces/fileUpload.jspx 2008-02-20 11:42:22 UTC (rev 6191)
+++ trunk/sandbox/ui/fileUpload/src/main/templates/org/richfaces/fileUpload.jspx 2008-02-20 11:57:05 UTC (rev 6192)
@@ -103,7 +103,42 @@
<span>
<script type="text/javascript">
- new FileUpload('#{clientId}', #{this:getStopScript(context, component)}, '#{this:getProgressBarId(context, component)}');
+ FileUpload.CLASSES = {
+ ADD : {
+ ENABLED : 'upload_button upload_font #{component.attributes["addStyle"]}',
+ DISABLED : 'upload_button_dis upload_font #{component.attributes["addStyleDisabled"]}'
+ },
+ ADD_CONTENT : {
+ ENABLED : 'upload_button_content upload_font upload_ico upload_ico_add #{component.attributes["addStyle"]}',
+ DISABLED : 'upload_button_content upload_font upload_ico upload_ico_add_dis #{component.attributes["addStyleDisabled"]}'
+ },
+ UPDATE : {
+ ENABLED : 'upload_button upload_font #{component.attributes["uploadStyle"]}',
+ DISABLED : 'upload_button_dis upload_font #{component.attributes["uploadStyleDisabled"]}'
+ },
+ UPDATE_CONTENT : {
+ ENABLED : 'upload_button_content upload_font upload_ico upload_ico_start #{component.attributes["uploadStyle"]}',
+ DISABLED : 'upload_button_content upload_font upload_ico upload_ico_start_dis #{component.attributes["uploadStyleDisabled"]}'
+ },
+ CANCEL : {
+ ENABLED : 'upload_button upload_font #{component.attributes["cancelStyle"]}',
+ DISABLED : 'upload_button_dis upload_font #{component.attributes["cancelStyleDisabled"]}'
+ },
+ CANCEL_CONTENT : {
+ ENABLED : 'upload_button_content upload_font upload_ico upload_ico_stop #{component.attributes["cancelStyle"]}',
+ DISABLED : 'upload_button_content upload_font upload_ico upload_ico_stop_dis #{component.attributes["cancelStyleDisabled"]}'
+ },
+ CLEAN : {
+ ENABLED : 'upload_button upload_font #{component.attributes["cleanStyle"]}',
+ DISABLED : 'upload_button_dis upload_font #{component.attributes["cleanStyleDisabled"]}'
+ },
+ CLEAN_CONTENT : {
+ ENABLED : 'upload_button_content upload_font upload_ico upload_ico_clear #{component.attributes["cleanStyle"]}',
+ DISABLED : 'upload_button_content upload_font upload_ico upload_ico_clear_dis #{component.attributes["cleanStyleDisabled"]}'
+ }
+ };
+
+ new FileUpload('#{clientId}', #{this:getStopScript(context, component)}, '#{this:getProgressBarId(context, component)}', FileUpload.CLASSES);
</script>
</span>
18 years, 2 months
JBoss Rich Faces SVN: r6191 - trunk/docs/userguide.
by richfaces-svn-commits@lists.jboss.org
Author: msorokin
Date: 2008-02-20 06:42:22 -0500 (Wed, 20 Feb 2008)
New Revision: 6191
Modified:
trunk/docs/userguide/pom.xml
Log:
Progress bar added.
http://jira.jboss.com/jira/browse/RF-1690
Modified: trunk/docs/userguide/pom.xml
===================================================================
--- trunk/docs/userguide/pom.xml 2008-02-20 11:33:36 UTC (rev 6190)
+++ trunk/docs/userguide/pom.xml 2008-02-20 11:42:22 UTC (rev 6191)
@@ -63,6 +63,7 @@
</version>
</artifactItem>
+
<artifactItem>
<groupId>
org.richfaces.ui
@@ -75,11 +76,24 @@
</version>
</artifactItem>
+
<artifactItem>
<groupId>
org.richfaces.ui
</groupId>
<artifactId>
+ progressBar
+ </artifactId>
+ <version>
+ ${project.version}
+ </version>
+ </artifactItem>
+
+ <artifactItem>
+ <groupId>
+ org.richfaces.ui
+ </groupId>
+ <artifactId>
combobox
</artifactId>
<version>
18 years, 2 months
JBoss Rich Faces SVN: r6190 - trunk/docs/userguide/en/src/main/docbook/included.
by richfaces-svn-commits@lists.jboss.org
Author: msorokin
Date: 2008-02-20 06:33:36 -0500 (Wed, 20 Feb 2008)
New Revision: 6190
Modified:
trunk/docs/userguide/en/src/main/docbook/included/tree.desc.xml
Log:
Description and key features were re-written.
http://jira.jboss.com/jira/browse/RF-1137
Modified: trunk/docs/userguide/en/src/main/docbook/included/tree.desc.xml
===================================================================
--- trunk/docs/userguide/en/src/main/docbook/included/tree.desc.xml 2008-02-20 10:39:03 UTC (rev 6189)
+++ trunk/docs/userguide/en/src/main/docbook/included/tree.desc.xml 2008-02-20 11:33:36 UTC (rev 6190)
@@ -7,8 +7,8 @@
</sectioninfo>
<section>
<title>Description</title>
- <para>A component for a tree-like presentation of data. It includes built-in drag and drop
- support for its child elements.</para>
+ <para>The component is designed for hierarchical data presentation and is applied for building
+a tree structure with a drag-and-drop capability. </para>
<figure>
<title>Expanded <emphasis role="bold"><property><rich:tree></property></emphasis> with child elements</title>
<mediaobject>
@@ -24,40 +24,16 @@
<section>
<title>Key Features</title>
<itemizedlist>
- <listitem>
- <para>Highly customizable look-and-feel</para>
- <para>This feature provides rich possibilities to change an appearance of a component into different styles.</para>
- </listitem>
-
- <listitem>
- <para>Built-in drag and drop support</para>
- <para>This feature allows programming DnD possibility for the <emphasis role="bold">
- <property><rich:tree></property>
- </emphasis> component so that it would be possible to change a placement of nodes in a <property>tree</property> simply by dropping a certain node from one place to another. Look at the screenshot below:</para>
- <figure>
- <title>Drag and drop support</title>
- <mediaobject>
- <imageobject>
- <imagedata fileref="images/tree3.png"/>
- </imageobject>
- </mediaobject>
- </figure>
- <para>
- Here, an appropriate CD-disk is been moving from one album to the next one.
- </para>
- </listitem>
-
- <listitem>
- <para>Built-in Ajax processing</para>
- </listitem>
- <listitem>
- <para>Possibility to define a visual representation by a node type</para>
- </listitem>
+<listitem><para>Highly customizable look-and-feel</para></listitem>
+<listitem><para>Built-in drag and drop capability, than enable relocating tree nodes within the tree</para></listitem>
+<listitem><para>Built-in Ajax processing</para></listitem>
+<listitem><para>Possibility to define a visual representation by node type</para></listitem>
+<listitem><para>Support of several root elements in a tree</para></listitem>
+
- <listitem>
- <para>Support of several root elements in a tree</para>
- </listitem>
+
+
</itemizedlist>
</section>
-</section>
+</section>
\ No newline at end of file
18 years, 2 months
JBoss Rich Faces SVN: r6189 - trunk/sandbox/ui/fileUpload/src/main/java/org/richfaces/org/jboss/seam/ui/component.
by richfaces-svn-commits@lists.jboss.org
Author: akushunin
Date: 2008-02-20 05:39:03 -0500 (Wed, 20 Feb 2008)
New Revision: 6189
Modified:
trunk/sandbox/ui/fileUpload/src/main/java/org/richfaces/org/jboss/seam/ui/component/UIFileUpload.java
Log:
additional commit for fileUploadListener
Modified: trunk/sandbox/ui/fileUpload/src/main/java/org/richfaces/org/jboss/seam/ui/component/UIFileUpload.java
===================================================================
--- trunk/sandbox/ui/fileUpload/src/main/java/org/richfaces/org/jboss/seam/ui/component/UIFileUpload.java 2008-02-20 10:28:49 UTC (rev 6188)
+++ trunk/sandbox/ui/fileUpload/src/main/java/org/richfaces/org/jboss/seam/ui/component/UIFileUpload.java 2008-02-20 10:39:03 UTC (rev 6189)
@@ -2,6 +2,7 @@
import java.io.InputStream;
+import javax.el.MethodExpression;
import javax.faces.component.UIInput;
import javax.faces.context.FacesContext;
import javax.faces.el.MethodBinding;
@@ -121,9 +122,9 @@
public abstract void setStyle(String style);
- public abstract MethodBinding getFileUploadListener();
+ public abstract MethodExpression getFileUploadListener();
- public abstract void setFileUploadListener(MethodBinding scrollerListener);
+ public abstract void setFileUploadListener(MethodExpression scrollerListener);
public void addFileUploadListener(FileUploadListener listener) {
addFacesListener(listener);
@@ -142,9 +143,9 @@
if (e instanceof UploadEvent) {
FacesContext facesContext = FacesContext.getCurrentInstance();
- MethodBinding binding = getFileUploadListener();
+ MethodExpression binding = getFileUploadListener();
if (binding != null) {
- binding.invoke(facesContext, new Object[] { e });
+ binding.invoke(facesContext.getELContext(), new Object[] { e });
}
} else {
super.broadcast(e);
18 years, 2 months
JBoss Rich Faces SVN: r6188 - in trunk/sandbox/ui/fileUpload/src/main: java/org/richfaces/org/jboss/seam/ui/component and 1 other directories.
by richfaces-svn-commits@lists.jboss.org
Author: akushunin
Date: 2008-02-20 05:28:49 -0500 (Wed, 20 Feb 2008)
New Revision: 6188
Added:
trunk/sandbox/ui/fileUpload/src/main/config/component/listener.ent
Modified:
trunk/sandbox/ui/fileUpload/src/main/config/component/fileUpload.xml
trunk/sandbox/ui/fileUpload/src/main/java/org/richfaces/org/jboss/seam/ui/component/UIFileUpload.java
trunk/sandbox/ui/fileUpload/src/main/java/org/richfaces/org/jboss/seam/ui/renderkit/FileUploadRendererBase.java
Log:
Modified: trunk/sandbox/ui/fileUpload/src/main/config/component/fileUpload.xml
===================================================================
--- trunk/sandbox/ui/fileUpload/src/main/config/component/fileUpload.xml 2008-02-20 09:48:22 UTC (rev 6187)
+++ trunk/sandbox/ui/fileUpload/src/main/config/component/fileUpload.xml 2008-02-20 10:28:49 UTC (rev 6188)
@@ -1,5 +1,9 @@
<?xml version="1.0" encoding="UTF-8"?>
-<!DOCTYPE components PUBLIC "-//AJAX4JSF//CDK Generator config/EN" "https://ajax4jsf.dev.java.net/nonav/dtds/component-config.dtd" >
+<!DOCTYPE components PUBLIC "-//AJAX4JSF//CDK Generator config/EN" "https://ajax4jsf.dev.java.net/nonav/dtds/component-config.dtd"
+[
+<!ENTITY listeners SYSTEM "listener.ent">
+]
+>
<components>
<component>
<name>org.richfaces.component.FileUpload</name>
@@ -136,6 +140,15 @@
<name>cleanStyleDisabled</name>
<classname>java.lang.String</classname>
<description>CSS style for clean button disabled</description>
+ </property>
+ <property>
+ <name>fileUploadListener</name>
+ <classname>javax.el.MethodExpression</classname>
+ <description>
+ MethodExpression representing an action listener method
+ that will be notified after file uploaded.
+ </description>
</property>
- </component>
+ </component>
+ &listeners;
</components>
Added: trunk/sandbox/ui/fileUpload/src/main/config/component/listener.ent
===================================================================
--- trunk/sandbox/ui/fileUpload/src/main/config/component/listener.ent (rev 0)
+++ trunk/sandbox/ui/fileUpload/src/main/config/component/listener.ent 2008-02-20 10:28:49 UTC (rev 6188)
@@ -0,0 +1,17 @@
+<listener>
+ <name>fileUploadListener</name>
+ <listenerclass>
+ org.richfaces.event.FileUploadListener
+ </listenerclass>
+ <componentclass>
+ org.richfaces.org.jboss.seam.ui.component.UIFileUpload
+ </componentclass>
+ <eventclass>
+ org.richfaces.event.UploadEvent
+ </eventclass>
+ <taghandler generate="true">
+ <classname>
+ org.richfaces.taglib.FileUploadListenerTagHandler
+ </classname>
+ </taghandler>
+</listener>
\ No newline at end of file
Modified: trunk/sandbox/ui/fileUpload/src/main/java/org/richfaces/org/jboss/seam/ui/component/UIFileUpload.java
===================================================================
--- trunk/sandbox/ui/fileUpload/src/main/java/org/richfaces/org/jboss/seam/ui/component/UIFileUpload.java 2008-02-20 09:48:22 UTC (rev 6187)
+++ trunk/sandbox/ui/fileUpload/src/main/java/org/richfaces/org/jboss/seam/ui/component/UIFileUpload.java 2008-02-20 10:28:49 UTC (rev 6188)
@@ -3,119 +3,152 @@
import java.io.InputStream;
import javax.faces.component.UIInput;
+import javax.faces.context.FacesContext;
+import javax.faces.el.MethodBinding;
+import javax.faces.event.FacesEvent;
+import org.richfaces.event.FileUploadListener;
+import org.richfaces.event.UploadEvent;
+
/**
* JSF component class
*
*/
public abstract class UIFileUpload extends UIInput {
-
- private String localContentType;
- private String localFileName;
+ private String localContentType;
- private Integer localFileSize;
-
- private InputStream localInputStream;
-
-
-
-// @Override
-// public void processUpdates(FacesContext context) {
-// ValueExpression dataBinding = getValueExpression("data");
-// if (dataBinding != null) {
-// Class clazz = dataBinding.getType(context.getELContext());
-// if (clazz.isAssignableFrom(InputStream.class)) {
-// dataBinding.setValue(context.getELContext(),
-// getLocalInputStream());
-// } else if (clazz.isAssignableFrom(byte[].class)) {
-// byte[] bytes = null;
-// if (getLocalInputStream() != null) {
-// ByteArrayOutputStream bos = new ByteArrayOutputStream();
-// try {
-// byte[] buffer = new byte[512];
-// int read = getLocalInputStream().read(buffer);
-// while (read != -1) {
-// bos.write(buffer, 0, read);
-// read = getLocalInputStream().read(buffer);
-// }
-// bytes = bos.toByteArray();
-// } catch (IOException e) {
-// throw new RuntimeException(e);
-// }
-// }
-// dataBinding.setValue(context.getELContext(), bytes);
-// }
-//
-// if (getLocalContentType() != null) {
-// ValueExpression valueExpression = getValueExpression("contentType");
-// if (valueExpression != null) {
-// valueExpression.setValue(context.getELContext(),
-// getLocalContentType());
-// }
-// }
-//
-// if (getLocalFileName() != null) {
-// ValueExpression valueExpression = getValueExpression("fileName");
-// if (valueExpression != null) {
-// valueExpression.setValue(context.getELContext(),
-// getLocalFileName());
-// }
-// }
-//
-// if (getLocalFileSize() != null) {
-// ValueExpression valueExpression = getValueExpression("fileSize");
-// if (valueExpression != null) {
-// valueExpression.setValue(context.getELContext(),
-// getLocalFileSize());
-// }
-// }
-// }
-// }
-
- public String getLocalContentType() {
- return localContentType;
- }
+ private String localFileName;
- public void setLocalContentType(String localContentType) {
- this.localContentType = localContentType;
- }
+ private Integer localFileSize;
- public String getLocalFileName() {
- return localFileName;
- }
+ private InputStream localInputStream;
- public void setLocalFileName(String localFileName) {
- this.localFileName = localFileName;
- }
+ // @Override
+ // public void processUpdates(FacesContext context) {
+ // ValueExpression dataBinding = getValueExpression("data");
+ // if (dataBinding != null) {
+ // Class clazz = dataBinding.getType(context.getELContext());
+ // if (clazz.isAssignableFrom(InputStream.class)) {
+ // dataBinding.setValue(context.getELContext(),
+ // getLocalInputStream());
+ // } else if (clazz.isAssignableFrom(byte[].class)) {
+ // byte[] bytes = null;
+ // if (getLocalInputStream() != null) {
+ // ByteArrayOutputStream bos = new ByteArrayOutputStream();
+ // try {
+ // byte[] buffer = new byte[512];
+ // int read = getLocalInputStream().read(buffer);
+ // while (read != -1) {
+ // bos.write(buffer, 0, read);
+ // read = getLocalInputStream().read(buffer);
+ // }
+ // bytes = bos.toByteArray();
+ // } catch (IOException e) {
+ // throw new RuntimeException(e);
+ // }
+ // }
+ // dataBinding.setValue(context.getELContext(), bytes);
+ // }
+ //
+ // if (getLocalContentType() != null) {
+ // ValueExpression valueExpression = getValueExpression("contentType");
+ // if (valueExpression != null) {
+ // valueExpression.setValue(context.getELContext(),
+ // getLocalContentType());
+ // }
+ // }
+ //
+ // if (getLocalFileName() != null) {
+ // ValueExpression valueExpression = getValueExpression("fileName");
+ // if (valueExpression != null) {
+ // valueExpression.setValue(context.getELContext(),
+ // getLocalFileName());
+ // }
+ // }
+ //
+ // if (getLocalFileSize() != null) {
+ // ValueExpression valueExpression = getValueExpression("fileSize");
+ // if (valueExpression != null) {
+ // valueExpression.setValue(context.getELContext(),
+ // getLocalFileSize());
+ // }
+ // }
+ // }
+ // }
- public Integer getLocalFileSize() {
- return localFileSize;
- }
+ public String getLocalContentType() {
+ return localContentType;
+ }
- public void setLocalFileSize(Integer localFileSize) {
- this.localFileSize = localFileSize;
- }
+ public void setLocalContentType(String localContentType) {
+ this.localContentType = localContentType;
+ }
- public InputStream getLocalInputStream() {
- return localInputStream;
- }
+ public String getLocalFileName() {
+ return localFileName;
+ }
- public void setLocalInputStream(InputStream localInputStream) {
- this.localInputStream = localInputStream;
- }
+ public void setLocalFileName(String localFileName) {
+ this.localFileName = localFileName;
+ }
- public abstract void setAccept(String accept);
+ public Integer getLocalFileSize() {
+ return localFileSize;
+ }
- public abstract String getAccept();
+ public void setLocalFileSize(Integer localFileSize) {
+ this.localFileSize = localFileSize;
+ }
- public abstract String getStyleClass();
+ public InputStream getLocalInputStream() {
+ return localInputStream;
+ }
- public abstract String getStyle();
+ public void setLocalInputStream(InputStream localInputStream) {
+ this.localInputStream = localInputStream;
+ }
- public abstract void setStyleClass(String styleClass);
+ public abstract void setAccept(String accept);
- public abstract void setStyle(String style);
+ public abstract String getAccept();
-
+ public abstract String getStyleClass();
+
+ public abstract String getStyle();
+
+ public abstract void setStyleClass(String styleClass);
+
+ public abstract void setStyle(String style);
+
+ public abstract MethodBinding getFileUploadListener();
+
+ public abstract void setFileUploadListener(MethodBinding scrollerListener);
+
+ public void addFileUploadListener(FileUploadListener listener) {
+ addFacesListener(listener);
+ }
+
+ public FileUploadListener[] getFileUploadListeners() {
+ return (FileUploadListener[]) getFacesListeners(FileUploadListener.class);
+ }
+
+ public void removeFileUploadListener(FileUploadListener listener) {
+ removeFacesListener(listener);
+ }
+
+ public void broadcast(FacesEvent e) {
+
+ if (e instanceof UploadEvent) {
+
+ FacesContext facesContext = FacesContext.getCurrentInstance();
+ MethodBinding binding = getFileUploadListener();
+ if (binding != null) {
+ binding.invoke(facesContext, new Object[] { e });
+ }
+ } else {
+ super.broadcast(e);
+ }
+
+ }
}
Modified: trunk/sandbox/ui/fileUpload/src/main/java/org/richfaces/org/jboss/seam/ui/renderkit/FileUploadRendererBase.java
===================================================================
--- trunk/sandbox/ui/fileUpload/src/main/java/org/richfaces/org/jboss/seam/ui/renderkit/FileUploadRendererBase.java 2008-02-20 09:48:22 UTC (rev 6187)
+++ trunk/sandbox/ui/fileUpload/src/main/java/org/richfaces/org/jboss/seam/ui/renderkit/FileUploadRendererBase.java 2008-02-20 10:28:49 UTC (rev 6188)
@@ -21,6 +21,7 @@
import org.ajax4jsf.renderkit.AjaxRendererUtils;
import org.ajax4jsf.renderkit.RendererUtils;
import org.richfaces.component.UIProgressBar;
+import org.richfaces.event.UploadEvent;
import org.richfaces.org.jboss.seam.ui.component.UIFileUpload;
import org.richfaces.org.jboss.seam.web.MultipartRequest;
import org.richfaces.renderkit.TemplateEncoderRendererBase;
@@ -69,12 +70,11 @@
//
// AjaxContext ajaxContext = AjaxContextImpl.getCurrentInstance(context);
- new AjaxEvent(component).queue();
-
+ new AjaxEvent(component).queue();
if (!(request instanceof MultipartRequest)) {
request = unwrapMultipartRequest(request);
}
-
+
if (request instanceof MultipartRequest) {
MultipartRequest multipartRequest = (MultipartRequest) request;
clientId = clientId + ":file";
@@ -84,6 +84,7 @@
.getFileContentType(clientId));
fileUpload.setLocalFileName(multipartRequest.getFileName(clientId));
fileUpload.setLocalFileSize(multipartRequest.getFileSize(clientId));
+ new UploadEvent(component, multipartRequest.getFile(clientId)).queue();
onUploadComplete(context, multipartRequest.getFile(clientId),
fileUpload);
}
@@ -104,7 +105,7 @@
private void onUploadComplete(FacesContext context, File file,
UIFileUpload fileUpload) {
- storeData(context, fileUpload, file);
+ storeData(context, fileUpload, file);
try {
context.responseComplete();
} catch (Exception e) {
18 years, 2 months