Author: nbelaevski
Date: 2009-07-24 04:52:05 -0400 (Fri, 24 Jul 2009)
New Revision: 14997
Added:
root/ui-sandbox/trunk/components/common/
root/ui-sandbox/trunk/components/common/src/
root/ui-sandbox/trunk/components/common/src/main/
root/ui-sandbox/trunk/components/common/src/main/java/
root/ui-sandbox/trunk/components/common/src/main/java/org/
root/ui-sandbox/trunk/components/common/src/main/java/org/richfaces/
root/ui-sandbox/trunk/components/common/src/main/java/org/richfaces/renderkit/
root/ui-sandbox/trunk/components/common/src/main/java/org/richfaces/renderkit/html/
root/ui-sandbox/trunk/components/common/src/main/java/org/richfaces/renderkit/html/images/
root/ui-sandbox/trunk/components/common/src/main/java/org/richfaces/renderkit/html/images/CancelControlIcon.java
root/ui-sandbox/trunk/components/common/src/main/java/org/richfaces/renderkit/html/images/ComboBoxArrowImage.java
root/ui-sandbox/trunk/components/common/src/main/java/org/richfaces/renderkit/html/images/ComboBoxArrowImageDisable.java
root/ui-sandbox/trunk/components/common/src/main/java/org/richfaces/renderkit/html/images/ComboBoxButtonPressGradient.java
root/ui-sandbox/trunk/components/common/src/main/java/org/richfaces/renderkit/html/images/EditIcon.java
root/ui-sandbox/trunk/components/common/src/main/java/org/richfaces/renderkit/html/images/InputErrorIcon.java
root/ui-sandbox/trunk/components/common/src/main/java/org/richfaces/renderkit/html/images/OneColorBasedResource.java
root/ui-sandbox/trunk/components/common/src/main/java/org/richfaces/renderkit/html/images/SaveControlIcon.java
root/ui-sandbox/trunk/components/common/src/main/java/org/richfaces/renderkit/html/images/TriangleIconBase.java
root/ui-sandbox/trunk/components/common/src/main/java/org/richfaces/renderkit/html/images/TriangleIconDown.java
root/ui-sandbox/trunk/components/common/src/main/java/org/richfaces/renderkit/html/images/TriangleIconUp.java
root/ui-sandbox/trunk/components/numberinputs/
root/ui-sandbox/trunk/components/numberinputs/src/
root/ui-sandbox/trunk/components/numberinputs/src/main/
root/ui-sandbox/trunk/components/numberinputs/src/main/java/
root/ui-sandbox/trunk/components/numberinputs/src/main/java/org/
root/ui-sandbox/trunk/components/numberinputs/src/main/java/org/richfaces/
root/ui-sandbox/trunk/components/numberinputs/src/main/java/org/richfaces/renderkit/
root/ui-sandbox/trunk/components/numberinputs/src/main/java/org/richfaces/renderkit/html/
root/ui-sandbox/trunk/components/numberinputs/src/main/java/org/richfaces/renderkit/html/images/
root/ui-sandbox/trunk/components/numberinputs/src/main/java/org/richfaces/renderkit/html/images/SliderArrowBase.java
root/ui-sandbox/trunk/components/numberinputs/src/main/java/org/richfaces/renderkit/html/images/SliderArrowImage.java
root/ui-sandbox/trunk/components/numberinputs/src/main/java/org/richfaces/renderkit/html/images/SpinnerButtonDown.java
root/ui-sandbox/trunk/components/numberinputs/src/main/java/org/richfaces/renderkit/html/images/SpinnerButtonGradient.java
root/ui-sandbox/trunk/components/numberinputs/src/main/java/org/richfaces/renderkit/html/images/SpinnerButtonImage.java
root/ui-sandbox/trunk/components/numberinputs/src/main/java/org/richfaces/renderkit/html/images/SpinnerButtonUp.java
root/ui-sandbox/trunk/components/numberinputs/src/main/java/org/richfaces/renderkit/html/images/SpinnerFieldGradient.java
root/ui-sandbox/trunk/components/tables/api/src/main/java/org/richfaces/component/ScriptExportable.java
root/ui-sandbox/trunk/components/tables/api/src/main/java/org/richfaces/event/AttributeHolder.java
root/ui-sandbox/trunk/components/tables/api/src/main/java/org/richfaces/event/AttributedEvent.java
Log:
Moving component APIs into ui-sandbox
Copied:
root/ui-sandbox/trunk/components/common/src/main/java/org/richfaces/renderkit/html/images/CancelControlIcon.java
(from rev 14989,
root/framework/trunk/impl/src/main/java/org/richfaces/renderkit/html/images/CancelControlIcon.java)
===================================================================
---
root/ui-sandbox/trunk/components/common/src/main/java/org/richfaces/renderkit/html/images/CancelControlIcon.java
(rev 0)
+++
root/ui-sandbox/trunk/components/common/src/main/java/org/richfaces/renderkit/html/images/CancelControlIcon.java 2009-07-24
08:52:05 UTC (rev 14997)
@@ -0,0 +1,139 @@
+/**
+ * License Agreement.
+ *
+ * Rich Faces - Natural Ajax for Java Server Faces (JSF)
+ *
+ * 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.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);
+
+
+ }
+}
+
Copied:
root/ui-sandbox/trunk/components/common/src/main/java/org/richfaces/renderkit/html/images/ComboBoxArrowImage.java
(from rev 14989,
root/framework/trunk/impl/src/main/java/org/richfaces/renderkit/html/images/ComboBoxArrowImage.java)
===================================================================
---
root/ui-sandbox/trunk/components/common/src/main/java/org/richfaces/renderkit/html/images/ComboBoxArrowImage.java
(rev 0)
+++
root/ui-sandbox/trunk/components/common/src/main/java/org/richfaces/renderkit/html/images/ComboBoxArrowImage.java 2009-07-24
08:52:05 UTC (rev 14997)
@@ -0,0 +1,164 @@
+/**
+ * License Agreement.
+ *
+ * Rich Faces - Natural Ajax for Java Server Faces (JSF)
+ *
+ * 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;
+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));
+ }
+ }
+}
Copied:
root/ui-sandbox/trunk/components/common/src/main/java/org/richfaces/renderkit/html/images/ComboBoxArrowImageDisable.java
(from rev 14989,
root/framework/trunk/impl/src/main/java/org/richfaces/renderkit/html/images/ComboBoxArrowImageDisable.java)
===================================================================
---
root/ui-sandbox/trunk/components/common/src/main/java/org/richfaces/renderkit/html/images/ComboBoxArrowImageDisable.java
(rev 0)
+++
root/ui-sandbox/trunk/components/common/src/main/java/org/richfaces/renderkit/html/images/ComboBoxArrowImageDisable.java 2009-07-24
08:52:05 UTC (rev 14997)
@@ -0,0 +1,36 @@
+/**
+ * License Agreement.
+ *
+ * Rich Faces - Natural Ajax for Java Server Faces (JSF)
+ *
+ * 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 javax.faces.context.FacesContext;
+
+/**
+ * @author Anton Belevich
+ * @since 3.2.0
+ * ComboBox disable arrow image renderer
+ *
+ */
+public class ComboBoxArrowImageDisable extends ComboBoxArrowImage{
+
+ protected Object storeData(FacesContext context, String colorSkinParam, String
backgroundSkinParam, String borderSkinParam) {
+ return super.storeData(context, DISABLED_ICON_COLOR, BACKGROUND_COLOR,
DISABLED_BORDER_COLOR);
+ }
+}
Copied:
root/ui-sandbox/trunk/components/common/src/main/java/org/richfaces/renderkit/html/images/ComboBoxButtonPressGradient.java
(from rev 14989,
root/framework/trunk/impl/src/main/java/org/richfaces/renderkit/html/images/ComboBoxButtonPressGradient.java)
===================================================================
---
root/ui-sandbox/trunk/components/common/src/main/java/org/richfaces/renderkit/html/images/ComboBoxButtonPressGradient.java
(rev 0)
+++
root/ui-sandbox/trunk/components/common/src/main/java/org/richfaces/renderkit/html/images/ComboBoxButtonPressGradient.java 2009-07-24
08:52:05 UTC (rev 14997)
@@ -0,0 +1,36 @@
+/**
+ * License Agreement.
+ *
+ * Rich Faces - Natural Ajax for Java Server Faces (JSF)
+ *
+ * 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;
+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");
+ }
+
+}
Copied:
root/ui-sandbox/trunk/components/common/src/main/java/org/richfaces/renderkit/html/images/EditIcon.java
(from rev 14989,
root/framework/trunk/impl/src/main/java/org/richfaces/renderkit/html/images/EditIcon.java)
===================================================================
---
root/ui-sandbox/trunk/components/common/src/main/java/org/richfaces/renderkit/html/images/EditIcon.java
(rev 0)
+++
root/ui-sandbox/trunk/components/common/src/main/java/org/richfaces/renderkit/html/images/EditIcon.java 2009-07-24
08:52:05 UTC (rev 14997)
@@ -0,0 +1,93 @@
+/**
+ * License Agreement.
+ *
+ * Rich Faces - Natural Ajax for Java Server Faces (JSF)
+ *
+ * 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.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 EDIT icon renderer
+ * @author Anton Belevich
+ * @since 3.2.0
+ *
+ */
+public class EditIcon extends Java2Dresource {
+
+ protected static final String ICON_COLOR = "#FF0000";
+
+ private static final Dimension dimensions = new Dimension(4, 4);
+
+ public EditIcon() {
+ 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()};
+ }
+
+ protected Object getDataToStore(FacesContext context, Object data){
+
+ byte [] ret = new byte[3];
+
+ Color color = null;
+ Zipper2 zipper = new Zipper2(ret);
+
+ color = HtmlColor.decode(ICON_COLOR);
+ zipper.addColor(color);
+
+ return ret;
+ }
+
+ protected void paint(ResourceContext context, Graphics2D g2d) {
+ Color [] data = (Color[]) restoreData(context);
+ Color iconColor = data[0];
+
+ g2d.setColor(iconColor);
+ g2d.drawLine(0, 0, 0, 4);
+ g2d.drawLine(0, 0, 4, 0);
+ g2d.drawLine(1, 0, 1, 2);
+ g2d.drawLine(2, 0, 2, 1);
+ }
+}
Copied:
root/ui-sandbox/trunk/components/common/src/main/java/org/richfaces/renderkit/html/images/InputErrorIcon.java
(from rev 14989,
root/framework/trunk/impl/src/main/java/org/richfaces/renderkit/html/images/InputErrorIcon.java)
===================================================================
---
root/ui-sandbox/trunk/components/common/src/main/java/org/richfaces/renderkit/html/images/InputErrorIcon.java
(rev 0)
+++
root/ui-sandbox/trunk/components/common/src/main/java/org/richfaces/renderkit/html/images/InputErrorIcon.java 2009-07-24
08:52:05 UTC (rev 14997)
@@ -0,0 +1,45 @@
+/**
+ * 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.Graphics2D;
+import java.awt.RenderingHints;
+
+import org.ajax4jsf.resource.Java2Dresource;
+import org.ajax4jsf.resource.ResourceContext;
+
+public class InputErrorIcon extends OneColorBasedResource {
+
+ public InputErrorIcon() {
+ super(6, 11, "warningColor");
+ }
+
+ /**
+ * @see Java2Dresource#paint(ResourceContext, Graphics2D)
+ */
+ protected void paint(ResourceContext context, Graphics2D g2d) {
+ g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING,
RenderingHints.VALUE_ANTIALIAS_ON);
+ g2d.setColor(getBasicColor());
+ g2d.fillRect(3, 2, 2, 6);
+ g2d.fillRect(3, 9, 2, 2);
+ }
+
+}
Copied:
root/ui-sandbox/trunk/components/common/src/main/java/org/richfaces/renderkit/html/images/OneColorBasedResource.java
(from rev 14989,
root/framework/trunk/impl/src/main/java/org/richfaces/renderkit/html/images/OneColorBasedResource.java)
===================================================================
---
root/ui-sandbox/trunk/components/common/src/main/java/org/richfaces/renderkit/html/images/OneColorBasedResource.java
(rev 0)
+++
root/ui-sandbox/trunk/components/common/src/main/java/org/richfaces/renderkit/html/images/OneColorBasedResource.java 2009-07-24
08:52:05 UTC (rev 14997)
@@ -0,0 +1,122 @@
+/**
+ * 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.util.Date;
+
+import javax.faces.context.FacesContext;
+
+import org.ajax4jsf.resource.GifRenderer;
+import org.ajax4jsf.resource.InternetResourceBase;
+import org.ajax4jsf.resource.InternetResourceBuilder;
+import org.ajax4jsf.resource.Java2Dresource;
+import org.ajax4jsf.resource.ResourceContext;
+import org.ajax4jsf.util.HtmlColor;
+import org.ajax4jsf.util.Zipper2;
+import org.richfaces.skin.SkinFactory;
+
+public abstract class OneColorBasedResource extends Java2Dresource {
+
+ private Dimension dimension;
+
+ private String basicColorParamName;
+
+ private Color basicColor;
+
+ public OneColorBasedResource(int width, int height, final String basicColorParamName)
{
+ this.basicColorParamName = basicColorParamName;
+ this.dimension = new Dimension(width, height);
+ setRenderer(new GifRenderer());
+ setLastModified(new Date(InternetResourceBuilder.getInstance().getStartTime()));
+ }
+
+ /**
+ * @see Java2Dresource#getDimensions(ResourceContext)
+ */
+ protected Dimension getDimensions(ResourceContext resourceContext) {
+ return dimension;
+ }
+
+ /**
+ * @see Java2Dresource#getDimensions(FacesContext, Object)
+ */
+ public Dimension getDimensions(FacesContext facesContext, Object data) {
+ return dimension;
+ }
+
+ /**
+ * @see Java2Dresource#isCacheable(ResourceContext)
+ */
+ public boolean isCacheable(ResourceContext ctx) {
+ return true;
+ }
+
+ /**
+ * Gets value of basicColor field.
+ * @return value of basicColor field
+ */
+ public Color getBasicColor() {
+ return basicColor;
+ }
+
+ /**
+ * @see InternetResourceBase#getDataToStore(FacesContext, Object)
+ */
+ protected Object getDataToStore(FacesContext context, Object data) {
+ byte[] retVal = null;
+ if (basicColor == null) {
+ basicColor = getColorValueParameter(context, basicColorParamName);
+ }
+
+ if (basicColor != null) {
+ retVal = new byte[3 * 1];
+ new Zipper2(retVal).addColor(basicColor);
+
+ return retVal;
+ } else {
+ return null;
+ }
+ }
+
+ /**
+ * @see InternetResourceBase#deserializeData(byte[])
+ */
+ protected Object deserializeData(byte[] objectArray) {
+ if (objectArray != null) {
+ Zipper2 zipper2 = new Zipper2(objectArray);
+ basicColor = zipper2.nextColor();
+ }
+
+ return objectArray;
+ }
+
+ private Color getColorValueParameter(FacesContext context, String name) {
+ Color retVal = null;
+ String color = (String)
SkinFactory.getInstance().getSkin(context).getParameter(context, name);
+ if (color != null && !color.trim().equals("")) {
+ retVal = HtmlColor.decode(color);
+ }
+ return retVal;
+ }
+}
Copied:
root/ui-sandbox/trunk/components/common/src/main/java/org/richfaces/renderkit/html/images/SaveControlIcon.java
(from rev 14989,
root/framework/trunk/impl/src/main/java/org/richfaces/renderkit/html/images/SaveControlIcon.java)
===================================================================
---
root/ui-sandbox/trunk/components/common/src/main/java/org/richfaces/renderkit/html/images/SaveControlIcon.java
(rev 0)
+++
root/ui-sandbox/trunk/components/common/src/main/java/org/richfaces/renderkit/html/images/SaveControlIcon.java 2009-07-24
08:52:05 UTC (rev 14997)
@@ -0,0 +1,142 @@
+/**
+ * License Agreement.
+ *
+ * Rich Faces - Natural Ajax for Java Server Faces (JSF)
+ *
+ * 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;
+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);
+
+
+
+ }
+}
Copied:
root/ui-sandbox/trunk/components/common/src/main/java/org/richfaces/renderkit/html/images/TriangleIconBase.java
(from rev 14989,
root/framework/trunk/impl/src/main/java/org/richfaces/renderkit/html/images/TriangleIconBase.java)
===================================================================
---
root/ui-sandbox/trunk/components/common/src/main/java/org/richfaces/renderkit/html/images/TriangleIconBase.java
(rev 0)
+++
root/ui-sandbox/trunk/components/common/src/main/java/org/richfaces/renderkit/html/images/TriangleIconBase.java 2009-07-24
08:52:05 UTC (rev 14997)
@@ -0,0 +1,182 @@
+/**
+ * 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;
+import org.ajax4jsf.util.HtmlColor;
+import org.ajax4jsf.util.Zipper2;
+import org.richfaces.skin.Skin;
+import org.richfaces.skin.SkinFactory;
+
+/**
+ * @author Siarhej Chalipau
+ *
+ */
+public abstract class TriangleIconBase extends Java2Dresource {
+
+ private static final Dimension DIMENSION = new Dimension(15, 15);
+
+ 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";
+
+ public TriangleIconBase() {
+ setRenderer(new GifRenderer());
+ setLastModified(new Date(InternetResourceBuilder.getInstance().getStartTime()));
+ }
+
+ abstract protected void paintImage(ResourceContext context, Graphics2D g2d, Color
textColor, Color borderColor);
+
+ 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));
+ }
+ }
+
+ 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.setRenderingHint(RenderingHints.KEY_ANTIALIASING,
RenderingHints.VALUE_ANTIALIAS_OFF);
+// g2d.setRenderingHint(RenderingHints.KEY_DITHERING,
RenderingHints.VALUE_DITHER_DISABLE);
+// g2d.setRenderingHint(RenderingHints.KEY_COLOR_RENDERING,
RenderingHints.VALUE_COLOR_RENDER_QUALITY);
+
+ if (textColor != null && borderColor != null && g2d != null) {
+ paintImage(context, g2d, textColor, borderColor);
+ }
+
+ }
+
+ public Dimension getDimensions(FacesContext facesContext, Object data) {
+ return DIMENSION;
+ }
+ protected Dimension getDimensions(ResourceContext resourceContext) {
+ return DIMENSION;
+ }
+
+ /**
+ * @param data - pass icon color and background color
+ */
+ protected Object getDataToStore(FacesContext context, Object data) {
+ return getDataToStore(context, null, ICON_COLOR, null,
+ BORDER_COLOR);
+ }
+
+ protected String getParameterValue(FacesContext context, Skin skin, Skin defaultSkin,
+ String parameterName, String defaultParameterName) {
+
+ String value = null;
+
+ if (parameterName != null && parameterName.length() != 0) {
+ value = (String) skin.getParameter(context, parameterName);
+ if (value == null || value.length() == 0) {
+ value = (String) defaultSkin.getParameter(context, parameterName);
+ }
+ }
+
+ if (value == null || value.length() == 0) {
+ if (defaultParameterName != null && defaultParameterName.length() != 0) {
+ value = (String) skin.getParameter(context, defaultParameterName);
+ if (value == null || value.length() == 0) {
+ value = (String) defaultSkin.getParameter(context, defaultParameterName);
+ }
+ }
+ }
+
+ if (value == null) {
+ return "#FFFFFF";
+ }
+
+ return value;
+ }
+
+ protected Object getDataToStore(FacesContext context,
+ String iconColorParam,
+ String defaultIconColorParam,
+ String borderColorParam,
+ String defaultBorderColorParam) {
+ SkinFactory skinFactory = SkinFactory.getInstance();
+ Skin skin = skinFactory.getSkin(context);
+ Skin defaultSkin = skinFactory.getDefaultSkin(context);
+
+ byte [] ret = new byte[6];
+
+ Color color = null;
+ Zipper2 zipper = new Zipper2(ret);
+
+ String color1 = getParameterValue(context, skin, defaultSkin,
+ iconColorParam,
+ defaultIconColorParam);
+
+ color = HtmlColor.decode(color1);
+
+ zipper.addColor(color);
+
+ String color2 = getParameterValue(context, skin, defaultSkin,
+ borderColorParam,
+ defaultBorderColorParam);
+
+ color = HtmlColor.decode(color2);
+ zipper.addColor(color);
+
+ return ret;
+ }
+
+ protected Object deserializeData(byte[] objectArray) {
+ if (objectArray == null) {
+ return null;
+ }
+
+ Zipper2 zipper = new Zipper2(objectArray);
+
+ return new Color[] {zipper.nextColor(), zipper.nextColor()};
+ }
+
+ public boolean isCacheable() {
+ return true;
+ }
+
+}
Copied:
root/ui-sandbox/trunk/components/common/src/main/java/org/richfaces/renderkit/html/images/TriangleIconDown.java
(from rev 14989,
root/framework/trunk/impl/src/main/java/org/richfaces/renderkit/html/images/TriangleIconDown.java)
===================================================================
---
root/ui-sandbox/trunk/components/common/src/main/java/org/richfaces/renderkit/html/images/TriangleIconDown.java
(rev 0)
+++
root/ui-sandbox/trunk/components/common/src/main/java/org/richfaces/renderkit/html/images/TriangleIconDown.java 2009-07-24
08:52:05 UTC (rev 14997)
@@ -0,0 +1,49 @@
+/**
+ * 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.Graphics2D;
+
+import org.ajax4jsf.resource.ResourceContext;
+
+/**
+ * @author Siarhej Chalipau
+ *
+ */
+public class TriangleIconDown extends TriangleIconBase {
+
+ protected void paintImage(ResourceContext context, Graphics2D g2d,
+ Color textColor, Color borderColor) {
+
+ 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);
+ }
+
+}
Copied:
root/ui-sandbox/trunk/components/common/src/main/java/org/richfaces/renderkit/html/images/TriangleIconUp.java
(from rev 14989,
root/framework/trunk/impl/src/main/java/org/richfaces/renderkit/html/images/TriangleIconUp.java)
===================================================================
---
root/ui-sandbox/trunk/components/common/src/main/java/org/richfaces/renderkit/html/images/TriangleIconUp.java
(rev 0)
+++
root/ui-sandbox/trunk/components/common/src/main/java/org/richfaces/renderkit/html/images/TriangleIconUp.java 2009-07-24
08:52:05 UTC (rev 14997)
@@ -0,0 +1,44 @@
+/**
+ * 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.Graphics2D;
+
+import org.ajax4jsf.resource.ResourceContext;
+
+/**
+ * @author Siarhej Chalipau
+ *
+ */
+public class TriangleIconUp extends TriangleIconDown {
+
+ protected void paintImage(ResourceContext context, Graphics2D g2d,
+ Color textColor, Color borderColor) {
+
+ g2d.translate(0, 14);
+ g2d.scale(1, -1);
+
+ super.paintImage(context, g2d, textColor, borderColor);
+ }
+
+}
Copied:
root/ui-sandbox/trunk/components/numberinputs/src/main/java/org/richfaces/renderkit/html/images/SliderArrowBase.java
(from rev 14989,
root/framework/trunk/impl/src/main/java/org/richfaces/renderkit/html/images/SliderArrowBase.java)
===================================================================
---
root/ui-sandbox/trunk/components/numberinputs/src/main/java/org/richfaces/renderkit/html/images/SliderArrowBase.java
(rev 0)
+++
root/ui-sandbox/trunk/components/numberinputs/src/main/java/org/richfaces/renderkit/html/images/SliderArrowBase.java 2009-07-24
08:52:05 UTC (rev 14997)
@@ -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;
+ }
+
+}
Copied:
root/ui-sandbox/trunk/components/numberinputs/src/main/java/org/richfaces/renderkit/html/images/SliderArrowImage.java
(from rev 14989,
root/framework/trunk/impl/src/main/java/org/richfaces/renderkit/html/images/SliderArrowImage.java)
===================================================================
---
root/ui-sandbox/trunk/components/numberinputs/src/main/java/org/richfaces/renderkit/html/images/SliderArrowImage.java
(rev 0)
+++
root/ui-sandbox/trunk/components/numberinputs/src/main/java/org/richfaces/renderkit/html/images/SliderArrowImage.java 2009-07-24
08:52:05 UTC (rev 14997)
@@ -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
Copied:
root/ui-sandbox/trunk/components/numberinputs/src/main/java/org/richfaces/renderkit/html/images/SpinnerButtonDown.java
(from rev 14989,
root/framework/trunk/impl/src/main/java/org/richfaces/renderkit/html/images/SpinnerButtonDown.java)
===================================================================
---
root/ui-sandbox/trunk/components/numberinputs/src/main/java/org/richfaces/renderkit/html/images/SpinnerButtonDown.java
(rev 0)
+++
root/ui-sandbox/trunk/components/numberinputs/src/main/java/org/richfaces/renderkit/html/images/SpinnerButtonDown.java 2009-07-24
08:52:05 UTC (rev 14997)
@@ -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);
+
+
+ }
+
+
+}
Copied:
root/ui-sandbox/trunk/components/numberinputs/src/main/java/org/richfaces/renderkit/html/images/SpinnerButtonGradient.java
(from rev 14989,
root/framework/trunk/impl/src/main/java/org/richfaces/renderkit/html/images/SpinnerButtonGradient.java)
===================================================================
---
root/ui-sandbox/trunk/components/numberinputs/src/main/java/org/richfaces/renderkit/html/images/SpinnerButtonGradient.java
(rev 0)
+++
root/ui-sandbox/trunk/components/numberinputs/src/main/java/org/richfaces/renderkit/html/images/SpinnerButtonGradient.java 2009-07-24
08:52:05 UTC (rev 14997)
@@ -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");
+ }
+}
Copied:
root/ui-sandbox/trunk/components/numberinputs/src/main/java/org/richfaces/renderkit/html/images/SpinnerButtonImage.java
(from rev 14989,
root/framework/trunk/impl/src/main/java/org/richfaces/renderkit/html/images/SpinnerButtonImage.java)
===================================================================
---
root/ui-sandbox/trunk/components/numberinputs/src/main/java/org/richfaces/renderkit/html/images/SpinnerButtonImage.java
(rev 0)
+++
root/ui-sandbox/trunk/components/numberinputs/src/main/java/org/richfaces/renderkit/html/images/SpinnerButtonImage.java 2009-07-24
08:52:05 UTC (rev 14997)
@@ -0,0 +1,82 @@
+/**
+ * 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.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.util.HtmlColor;
+import org.ajax4jsf.util.Zipper2;
+import org.richfaces.skin.Skin;
+import org.richfaces.skin.SkinFactory;
+
+public abstract class SpinnerButtonImage extends Java2Dresource {
+
+ public SpinnerButtonImage() {
+ 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()};
+ }
+
+ protected Object getDataToStore(FacesContext context, Object data) {
+ Skin skin = SkinFactory.getInstance().getSkin(context);
+ byte[] ret = new byte[6];
+ Zipper2 zipper = new Zipper2(ret);
+
+ String skinParameterTextColor = "generalTextColor";
+ String generalTextColor = (String) skin.getParameter(context, skinParameterTextColor);
+ if (null == generalTextColor || "".equals(generalTextColor)) {
+ Skin defaultSkin = SkinFactory.getInstance().getDefaultSkin(context);
+ generalTextColor = (String) defaultSkin.getParameter(context,
skinParameterTextColor);
+ }
+
+ Integer color = HtmlColor.decode( generalTextColor == null ?
"#000000":generalTextColor ).getRGB();
+
+ zipper.addColor(color);
+
+ String skinParameterBackgroundColor = "controlBackgroundColor";
+ String generalBackgroundColor = (String) skin.getParameter(context,
skinParameterBackgroundColor);
+
+ if (null == generalBackgroundColor || "".equals(generalBackgroundColor)) {
+ Skin defaultSkin = SkinFactory.getInstance().getDefaultSkin(context);
+ generalBackgroundColor = (String) defaultSkin.getParameter(context,
skinParameterBackgroundColor);
+ }
+
+ color = HtmlColor.decode( generalTextColor == null ?
"#FFFFFF":generalBackgroundColor ).getRGB();
+ zipper.addColor(color);
+
+ return ret;
+ }
+
+}
Copied:
root/ui-sandbox/trunk/components/numberinputs/src/main/java/org/richfaces/renderkit/html/images/SpinnerButtonUp.java
(from rev 14989,
root/framework/trunk/impl/src/main/java/org/richfaces/renderkit/html/images/SpinnerButtonUp.java)
===================================================================
---
root/ui-sandbox/trunk/components/numberinputs/src/main/java/org/richfaces/renderkit/html/images/SpinnerButtonUp.java
(rev 0)
+++
root/ui-sandbox/trunk/components/numberinputs/src/main/java/org/richfaces/renderkit/html/images/SpinnerButtonUp.java 2009-07-24
08:52:05 UTC (rev 14997)
@@ -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);
+
+ }
+
+}
+
+
Copied:
root/ui-sandbox/trunk/components/numberinputs/src/main/java/org/richfaces/renderkit/html/images/SpinnerFieldGradient.java
(from rev 14989,
root/framework/trunk/impl/src/main/java/org/richfaces/renderkit/html/images/SpinnerFieldGradient.java)
===================================================================
---
root/ui-sandbox/trunk/components/numberinputs/src/main/java/org/richfaces/renderkit/html/images/SpinnerFieldGradient.java
(rev 0)
+++
root/ui-sandbox/trunk/components/numberinputs/src/main/java/org/richfaces/renderkit/html/images/SpinnerFieldGradient.java 2009-07-24
08:52:05 UTC (rev 14997)
@@ -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");
+ }
+
+
+}
Copied:
root/ui-sandbox/trunk/components/tables/api/src/main/java/org/richfaces/component/ScriptExportable.java
(from rev 14980,
root/framework/trunk/api/src/main/java/org/richfaces/component/ScriptExportable.java)
===================================================================
---
root/ui-sandbox/trunk/components/tables/api/src/main/java/org/richfaces/component/ScriptExportable.java
(rev 0)
+++
root/ui-sandbox/trunk/components/tables/api/src/main/java/org/richfaces/component/ScriptExportable.java 2009-07-24
08:52:05 UTC (rev 14997)
@@ -0,0 +1,30 @@
+/**
+ * License Agreement.
+ *
+ * Rich Faces - Natural Ajax for Java Server Faces (JSF)
+ *
+ * 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.component;
+
+/**
+ * @author Maksim Kaszynski
+ *
+ */
+public interface ScriptExportable {
+ public String getScriptVar();
+ public void setScriptVar(String s);
+}
Copied:
root/ui-sandbox/trunk/components/tables/api/src/main/java/org/richfaces/event/AttributeHolder.java
(from rev 14980,
root/framework/trunk/api/src/main/java/org/richfaces/event/AttributeHolder.java)
===================================================================
---
root/ui-sandbox/trunk/components/tables/api/src/main/java/org/richfaces/event/AttributeHolder.java
(rev 0)
+++
root/ui-sandbox/trunk/components/tables/api/src/main/java/org/richfaces/event/AttributeHolder.java 2009-07-24
08:52:05 UTC (rev 14997)
@@ -0,0 +1,54 @@
+/**
+ * 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.event;
+
+import javax.faces.component.UIComponent;
+
+/**
+ * Base interface holding attributes that can lately
+ * be applied on {@link UIComponent}
+ * @author Maksim Kaszynski
+ *
+ */
+public interface AttributeHolder {
+
+ /**
+ *
+ * @param name
+ * @param value
+ */
+ public abstract void setAttribute(String name, Object value);
+
+ /**
+ *
+ * @param name
+ * @return
+ */
+ public abstract Object getAttribute(String name);
+
+ /**
+ * Copy attributes from event map to component
+ * @param component
+ */
+ public abstract void applyAttributes(UIComponent component);
+
+}
\ No newline at end of file
Copied:
root/ui-sandbox/trunk/components/tables/api/src/main/java/org/richfaces/event/AttributedEvent.java
(from rev 14980,
root/framework/trunk/api/src/main/java/org/richfaces/event/AttributedEvent.java)
===================================================================
---
root/ui-sandbox/trunk/components/tables/api/src/main/java/org/richfaces/event/AttributedEvent.java
(rev 0)
+++
root/ui-sandbox/trunk/components/tables/api/src/main/java/org/richfaces/event/AttributedEvent.java 2009-07-24
08:52:05 UTC (rev 14997)
@@ -0,0 +1,97 @@
+/**
+ * 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.event;
+
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.Map;
+
+import javax.faces.component.UIComponent;
+import javax.faces.event.FacesEvent;
+
+/**
+ * Base class for events carrying component attributes.
+ * By using it, renderer-specific attributes can
+ * be applied when event is broadcast
+ * @author Maksim Kaszynski
+ *
+ */
+public abstract class AttributedEvent extends FacesEvent implements AttributeHolder{
+
+ private static final long serialVersionUID = 1L;
+
+ private Map<String, Object> attributes = new HashMap<String, Object>();
+
+ public AttributedEvent(UIComponent component) {
+ super(component);
+ }
+
+ public AttributedEvent(UIComponent component, Map<String, Object> attributes) {
+ super(component);
+ this.attributes.putAll(attributes);
+ }
+
+ /* (non-Javadoc)
+ * @see org.richfaces.event.AttributeHolder#setAttribute(java.lang.String,
java.lang.Object)
+ */
+ public void setAttribute(String name, Object value) {
+ attributes.put(name, value);
+ }
+
+ /* (non-Javadoc)
+ * @see org.richfaces.event.AttributeHolder#getAttribute(java.lang.String)
+ */
+ public Object getAttribute(String name) {
+ return attributes.get(name);
+ }
+
+ /* (non-Javadoc)
+ * @see
org.richfaces.event.AttributeHolder#applyAttributes(javax.faces.component.UIComponent)
+ */
+ public void applyAttributes(UIComponent component) {
+
+ Map<String, Object> attrs = component.getAttributes();
+
+ for(Iterator<Map.Entry<String, Object>> iterator =
attributes.entrySet().iterator();
+ iterator.hasNext(); ) {
+
+ Map.Entry<String, Object> entry = iterator.next();
+
+ String key = entry.getKey();
+ Object value = entry.getValue();
+
+ if (value == null) {
+ attrs.remove(key);
+ } else {
+ attrs.put(key, value);
+ }
+ }
+ }
+
+ /**
+ * copy attributes to event source
+ */
+ public void applyAttributes() {
+ applyAttributes(getComponent());
+ }
+
+}