JBoss Rich Faces SVN: r14997 - in root/ui-sandbox/trunk/components: common and 19 other directories.
by richfaces-svn-commits@lists.jboss.org
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());
+ }
+
+}
15 years, 5 months
JBoss Rich Faces SVN: r14996 - in root/cdk/trunk/plugins/generator: src/main/java/org/richfaces/builder/config and 4 other directories.
by richfaces-svn-commits@lists.jboss.org
Author: alexsmirnov
Date: 2009-07-23 21:32:04 -0400 (Thu, 23 Jul 2009)
New Revision: 14996
Added:
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/JavaLogger.java
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/Logger.java
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/LoggerFactory.java
Removed:
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/builder/generator/Logger.java
Modified:
root/cdk/trunk/plugins/generator/pom.xml
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/builder/config/BuilderConfig.java
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/builder/config/JsfBean.java
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/builder/config/LoaderHolder.java
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/builder/generator/BlankRendererGenerator.java
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/builder/generator/ComponentGenerator.java
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/builder/generator/ComponentGenerator2.java
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/builder/generator/ComponentTagGenerator.java
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/builder/generator/ComponentTestGenerator.java
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/builder/generator/ConverterGenerator.java
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/builder/generator/ConverterTagGenerator.java
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/builder/generator/FaceletsTaglibGenerator.java
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/builder/generator/FacesConfigGenerator.java
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/builder/generator/InnerGenerator.java
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/builder/generator/ListenerGenerator.java
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/builder/generator/ListenerTagGenerator.java
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/builder/generator/RendererCompilationContext.java
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/builder/generator/RendererGenerator.java
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/builder/generator/ResourcesConfigGenerator.java
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/builder/generator/ResourcesConfigParser.java
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/builder/generator/ResourcesDependenciesGenerator.java
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/builder/generator/TagHandlerGenerator.java
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/builder/generator/TagTestGenerator.java
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/builder/generator/TaglibGenerator.java
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/builder/generator/TestDataGenerator.java
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/builder/generator/TestDataGenerator2.java
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/builder/generator/ValidatorGenerator.java
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/builder/generator/ValidatorTagGenerator.java
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/builder/generator/XMLConfigGenerator.java
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/apt/VirtualFileManager.java
root/cdk/trunk/plugins/generator/src/test/java/org/richfaces/cdk/apt/ProcessorTest.java
root/cdk/trunk/plugins/generator/src/test/java/org/richfaces/cdk/apt/VirtualFileTest.java
Log:
New logging factory, continue to process annotations.
Modified: root/cdk/trunk/plugins/generator/pom.xml
===================================================================
--- root/cdk/trunk/plugins/generator/pom.xml 2009-07-23 19:40:10 UTC (rev 14995)
+++ root/cdk/trunk/plugins/generator/pom.xml 2009-07-24 01:32:04 UTC (rev 14996)
@@ -22,7 +22,7 @@
<target>1.6</target>
</configuration>
</plugin>
- <plugin>
+ <!--plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>jaxb2-maven-plugin</artifactId>
<executions>
@@ -33,9 +33,9 @@
</execution>
</executions>
<configuration>
- <packageName>org.richfaces.cdk.model</packageName> <!-- The name of your generated source package -->
+ <packageName>org.richfaces.cdk.model</packageName>
</configuration>
- </plugin>
+ </plugin -->
</plugins>
</build>
<dependencies>
Modified: root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/builder/config/BuilderConfig.java
===================================================================
--- root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/builder/config/BuilderConfig.java 2009-07-23 19:40:10 UTC (rev 14995)
+++ root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/builder/config/BuilderConfig.java 2009-07-24 01:32:04 UTC (rev 14996)
@@ -38,7 +38,7 @@
import org.apache.commons.digester.Digester;
import org.apache.commons.digester.ExtendedBaseRules;
import org.apache.tools.ant.BuildException;
-import org.richfaces.builder.generator.Logger;
+import org.richfaces.cdk.Logger;
import org.xml.sax.InputSource;
import org.xml.sax.SAXException;
import org.xml.sax.ext.EntityResolver2;
Modified: root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/builder/config/JsfBean.java
===================================================================
--- root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/builder/config/JsfBean.java 2009-07-23 19:40:10 UTC (rev 14995)
+++ root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/builder/config/JsfBean.java 2009-07-24 01:32:04 UTC (rev 14996)
@@ -26,7 +26,7 @@
import java.util.Collections;
import java.util.List;
-import org.richfaces.builder.generator.Logger;
+import org.richfaces.cdk.Logger;
/**
Modified: root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/builder/config/LoaderHolder.java
===================================================================
--- root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/builder/config/LoaderHolder.java 2009-07-23 19:40:10 UTC (rev 14995)
+++ root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/builder/config/LoaderHolder.java 2009-07-24 01:32:04 UTC (rev 14996)
@@ -21,7 +21,7 @@
package org.richfaces.builder.config;
-import org.richfaces.builder.generator.Logger;
+import org.richfaces.cdk.Logger;
/**
* @author asmirnov(a)exadel.com (latest modification by $Author: ishabalov $)
Modified: root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/builder/generator/BlankRendererGenerator.java
===================================================================
--- root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/builder/generator/BlankRendererGenerator.java 2009-07-23 19:40:10 UTC (rev 14995)
+++ root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/builder/generator/BlankRendererGenerator.java 2009-07-24 01:32:04 UTC (rev 14996)
@@ -33,6 +33,7 @@
import org.apache.velocity.VelocityContext;
import org.richfaces.builder.config.BuilderConfig;
import org.richfaces.builder.config.ComponentBean;
+import org.richfaces.cdk.Logger;
/**
Modified: root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/builder/generator/ComponentGenerator.java
===================================================================
--- root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/builder/generator/ComponentGenerator.java 2009-07-23 19:40:10 UTC (rev 14995)
+++ root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/builder/generator/ComponentGenerator.java 2009-07-24 01:32:04 UTC (rev 14996)
@@ -34,6 +34,7 @@
import org.richfaces.builder.config.BuilderConfig;
import org.richfaces.builder.config.ComponentBean;
import org.richfaces.builder.config.PropertyBean;
+import org.richfaces.cdk.Logger;
/**
Modified: root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/builder/generator/ComponentGenerator2.java
===================================================================
--- root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/builder/generator/ComponentGenerator2.java 2009-07-23 19:40:10 UTC (rev 14995)
+++ root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/builder/generator/ComponentGenerator2.java 2009-07-24 01:32:04 UTC (rev 14996)
@@ -33,6 +33,7 @@
import org.richfaces.builder.config.ComponentBean;
import org.richfaces.builder.model.JavaClass;
import org.richfaces.builder.render.JavaClassRenderer;
+import org.richfaces.cdk.Logger;
/**
* @author Maksim Kaszynski
Modified: root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/builder/generator/ComponentTagGenerator.java
===================================================================
--- root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/builder/generator/ComponentTagGenerator.java 2009-07-23 19:40:10 UTC (rev 14995)
+++ root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/builder/generator/ComponentTagGenerator.java 2009-07-24 01:32:04 UTC (rev 14996)
@@ -35,6 +35,7 @@
import org.richfaces.builder.config.ComponentBean;
import org.richfaces.builder.config.PropertyBean;
import org.richfaces.builder.config.TagBean;
+import org.richfaces.cdk.Logger;
/**
Modified: root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/builder/generator/ComponentTestGenerator.java
===================================================================
--- root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/builder/generator/ComponentTestGenerator.java 2009-07-23 19:40:10 UTC (rev 14995)
+++ root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/builder/generator/ComponentTestGenerator.java 2009-07-24 01:32:04 UTC (rev 14996)
@@ -34,6 +34,7 @@
import org.richfaces.builder.config.BuilderConfig;
import org.richfaces.builder.config.ComponentBean;
import org.richfaces.builder.config.PropertyBean;
+import org.richfaces.cdk.Logger;
public class ComponentTestGenerator extends InnerGenerator{
Modified: root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/builder/generator/ConverterGenerator.java
===================================================================
--- root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/builder/generator/ConverterGenerator.java 2009-07-23 19:40:10 UTC (rev 14995)
+++ root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/builder/generator/ConverterGenerator.java 2009-07-24 01:32:04 UTC (rev 14996)
@@ -35,6 +35,7 @@
import org.richfaces.builder.config.ConverterBean;
import org.richfaces.builder.config.PropertyBean;
import org.richfaces.builder.config.ValidatorBean;
+import org.richfaces.cdk.Logger;
Modified: root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/builder/generator/ConverterTagGenerator.java
===================================================================
--- root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/builder/generator/ConverterTagGenerator.java 2009-07-23 19:40:10 UTC (rev 14995)
+++ root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/builder/generator/ConverterTagGenerator.java 2009-07-24 01:32:04 UTC (rev 14996)
@@ -36,6 +36,7 @@
import org.richfaces.builder.config.PropertyBean;
import org.richfaces.builder.config.TagBean;
import org.richfaces.builder.config.ValidatorBean;
+import org.richfaces.cdk.Logger;
/**
Modified: root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/builder/generator/FaceletsTaglibGenerator.java
===================================================================
--- root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/builder/generator/FaceletsTaglibGenerator.java 2009-07-23 19:40:10 UTC (rev 14995)
+++ root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/builder/generator/FaceletsTaglibGenerator.java 2009-07-24 01:32:04 UTC (rev 14996)
@@ -38,6 +38,7 @@
import org.richfaces.builder.config.FunctionBean;
import org.richfaces.builder.config.ListenerBean;
import org.richfaces.builder.config.ValidatorBean;
+import org.richfaces.cdk.Logger;
/**
* @author asmirnov(a)exadel.com (latest modification by $Author: ishabalov $)
Modified: root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/builder/generator/FacesConfigGenerator.java
===================================================================
--- root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/builder/generator/FacesConfigGenerator.java 2009-07-23 19:40:10 UTC (rev 14995)
+++ root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/builder/generator/FacesConfigGenerator.java 2009-07-24 01:32:04 UTC (rev 14996)
@@ -31,6 +31,7 @@
import org.apache.velocity.Template;
import org.apache.velocity.VelocityContext;
import org.richfaces.builder.config.BuilderConfig;
+import org.richfaces.cdk.Logger;
/**
* Class implement functionality for generate faces-config file inner element of
Modified: root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/builder/generator/InnerGenerator.java
===================================================================
--- root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/builder/generator/InnerGenerator.java 2009-07-23 19:40:10 UTC (rev 14995)
+++ root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/builder/generator/InnerGenerator.java 2009-07-24 01:32:04 UTC (rev 14996)
@@ -29,6 +29,7 @@
import org.richfaces.builder.config.ComponentBaseBean;
import org.richfaces.builder.config.ComponentBean;
import org.richfaces.builder.generator.ClassPatternSet.PatternEntry;
+import org.richfaces.cdk.Logger;
/**
Modified: root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/builder/generator/ListenerGenerator.java
===================================================================
--- root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/builder/generator/ListenerGenerator.java 2009-07-23 19:40:10 UTC (rev 14995)
+++ root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/builder/generator/ListenerGenerator.java 2009-07-24 01:32:04 UTC (rev 14996)
@@ -32,6 +32,7 @@
import org.richfaces.builder.config.BuilderConfig;
import org.richfaces.builder.config.ListenerBean;
import org.richfaces.builder.config.TagHandlerBean;
+import org.richfaces.cdk.Logger;
/**
* @author Nick - mailto:nbelaevski@exadel.com
Modified: root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/builder/generator/ListenerTagGenerator.java
===================================================================
--- root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/builder/generator/ListenerTagGenerator.java 2009-07-23 19:40:10 UTC (rev 14995)
+++ root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/builder/generator/ListenerTagGenerator.java 2009-07-24 01:32:04 UTC (rev 14996)
@@ -32,6 +32,7 @@
import org.richfaces.builder.config.BuilderConfig;
import org.richfaces.builder.config.ListenerBean;
import org.richfaces.builder.config.TagBean;
+import org.richfaces.cdk.Logger;
/**
*
Deleted: root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/builder/generator/Logger.java
===================================================================
--- root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/builder/generator/Logger.java 2009-07-23 19:40:10 UTC (rev 14995)
+++ root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/builder/generator/Logger.java 2009-07-24 01:32:04 UTC (rev 14996)
@@ -1,63 +0,0 @@
-/**
- * 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.builder.generator;
-
-/**
- * @author shura
- *
- */
-public interface Logger {
-
- boolean isDebugEnabled();
-
- void debug( CharSequence content );
-
- void debug( CharSequence content, Throwable error );
-
- void debug( Throwable error );
-
- boolean isInfoEnabled();
-
- void info( CharSequence content );
-
- void info( CharSequence content, Throwable error );
-
- void info( Throwable error );
-
- boolean isWarnEnabled();
-
- void warn( CharSequence content );
-
- void warn( CharSequence content, Throwable error );
-
- void warn( Throwable error );
-
- boolean isErrorEnabled();
-
- void error( CharSequence content );
-
- void error( CharSequence content, Throwable error );
-
- void error( Throwable error );
-
-
-}
Modified: root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/builder/generator/RendererCompilationContext.java
===================================================================
--- root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/builder/generator/RendererCompilationContext.java 2009-07-23 19:40:10 UTC (rev 14995)
+++ root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/builder/generator/RendererCompilationContext.java 2009-07-24 01:32:04 UTC (rev 14996)
@@ -22,6 +22,7 @@
package org.richfaces.builder.generator;
import org.apache.velocity.Template;
+import org.richfaces.cdk.Logger;
import org.richfaces.templatecompiler.builder.AbstractCompilationContext;
import org.richfaces.templatecompiler.builder.CompilationException;
Modified: root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/builder/generator/RendererGenerator.java
===================================================================
--- root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/builder/generator/RendererGenerator.java 2009-07-23 19:40:10 UTC (rev 14995)
+++ root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/builder/generator/RendererGenerator.java 2009-07-24 01:32:04 UTC (rev 14996)
@@ -33,6 +33,7 @@
import org.richfaces.builder.config.ComponentBaseBean;
import org.richfaces.builder.config.ComponentBean;
import org.richfaces.builder.config.RendererBean;
+import org.richfaces.cdk.Logger;
import org.richfaces.templatecompiler.builder.CompilationContext;
import org.richfaces.templatecompiler.builder.CompilationException;
import org.richfaces.templatecompiler.builder.TemplateCompiler;
Modified: root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/builder/generator/ResourcesConfigGenerator.java
===================================================================
--- root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/builder/generator/ResourcesConfigGenerator.java 2009-07-23 19:40:10 UTC (rev 14995)
+++ root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/builder/generator/ResourcesConfigGenerator.java 2009-07-24 01:32:04 UTC (rev 14996)
@@ -41,6 +41,7 @@
import org.apache.velocity.Template;
import org.apache.velocity.VelocityContext;
import org.richfaces.builder.config.BuilderConfig;
+import org.richfaces.cdk.Logger;
import org.xml.sax.Attributes;
import org.xml.sax.InputSource;
import org.xml.sax.SAXException;
Modified: root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/builder/generator/ResourcesConfigParser.java
===================================================================
--- root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/builder/generator/ResourcesConfigParser.java 2009-07-23 19:40:10 UTC (rev 14995)
+++ root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/builder/generator/ResourcesConfigParser.java 2009-07-24 01:32:04 UTC (rev 14996)
@@ -44,6 +44,7 @@
import org.richfaces.builder.config.RendererBean;
import org.richfaces.builder.config.TagBean;
import org.richfaces.builder.config.TagHandlerBean;
+import org.richfaces.cdk.Logger;
import org.richfaces.templatecompiler.builder.CompilationContext;
import org.richfaces.templatecompiler.builder.CompilationException;
import org.richfaces.templatecompiler.builder.TemplateCompiler;
Modified: root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/builder/generator/ResourcesDependenciesGenerator.java
===================================================================
--- root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/builder/generator/ResourcesDependenciesGenerator.java 2009-07-23 19:40:10 UTC (rev 14995)
+++ root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/builder/generator/ResourcesDependenciesGenerator.java 2009-07-24 01:32:04 UTC (rev 14996)
@@ -36,6 +36,7 @@
import org.apache.velocity.Template;
import org.apache.velocity.VelocityContext;
import org.richfaces.builder.config.BuilderConfig;
+import org.richfaces.cdk.Logger;
/**
* @author Nick Belaevski
Modified: root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/builder/generator/TagHandlerGenerator.java
===================================================================
--- root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/builder/generator/TagHandlerGenerator.java 2009-07-23 19:40:10 UTC (rev 14995)
+++ root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/builder/generator/TagHandlerGenerator.java 2009-07-24 01:32:04 UTC (rev 14996)
@@ -35,6 +35,7 @@
import org.richfaces.builder.config.ComponentBean;
import org.richfaces.builder.config.PropertyBean;
import org.richfaces.builder.config.TagHandlerBean;
+import org.richfaces.cdk.Logger;
/**
Modified: root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/builder/generator/TagTestGenerator.java
===================================================================
--- root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/builder/generator/TagTestGenerator.java 2009-07-23 19:40:10 UTC (rev 14995)
+++ root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/builder/generator/TagTestGenerator.java 2009-07-24 01:32:04 UTC (rev 14996)
@@ -35,6 +35,7 @@
import org.richfaces.builder.config.ComponentBean;
import org.richfaces.builder.config.PropertyBean;
import org.richfaces.builder.config.TagBean;
+import org.richfaces.cdk.Logger;
public class TagTestGenerator extends InnerGenerator{
Modified: root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/builder/generator/TaglibGenerator.java
===================================================================
--- root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/builder/generator/TaglibGenerator.java 2009-07-23 19:40:10 UTC (rev 14995)
+++ root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/builder/generator/TaglibGenerator.java 2009-07-24 01:32:04 UTC (rev 14996)
@@ -37,6 +37,7 @@
import org.richfaces.builder.config.FunctionBean;
import org.richfaces.builder.config.ListenerBean;
import org.richfaces.builder.config.ValidatorBean;
+import org.richfaces.cdk.Logger;
/**
Modified: root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/builder/generator/TestDataGenerator.java
===================================================================
--- root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/builder/generator/TestDataGenerator.java 2009-07-23 19:40:10 UTC (rev 14995)
+++ root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/builder/generator/TestDataGenerator.java 2009-07-24 01:32:04 UTC (rev 14996)
@@ -26,6 +26,7 @@
import java.util.Map;
import org.richfaces.builder.config.PropertyBean;
+import org.richfaces.cdk.Logger;
/**
* @author Nick Belaevski - nbelaevski(a)exadel.com
Modified: root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/builder/generator/TestDataGenerator2.java
===================================================================
--- root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/builder/generator/TestDataGenerator2.java 2009-07-23 19:40:10 UTC (rev 14995)
+++ root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/builder/generator/TestDataGenerator2.java 2009-07-24 01:32:04 UTC (rev 14996)
@@ -25,6 +25,7 @@
import java.util.Map;
import org.richfaces.builder.config.PropertyBean;
+import org.richfaces.cdk.Logger;
/**
* @author Administrator
Modified: root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/builder/generator/ValidatorGenerator.java
===================================================================
--- root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/builder/generator/ValidatorGenerator.java 2009-07-23 19:40:10 UTC (rev 14995)
+++ root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/builder/generator/ValidatorGenerator.java 2009-07-24 01:32:04 UTC (rev 14996)
@@ -34,6 +34,7 @@
import org.richfaces.builder.config.BuilderConfig;
import org.richfaces.builder.config.PropertyBean;
import org.richfaces.builder.config.ValidatorBean;
+import org.richfaces.cdk.Logger;
/**
Modified: root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/builder/generator/ValidatorTagGenerator.java
===================================================================
--- root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/builder/generator/ValidatorTagGenerator.java 2009-07-23 19:40:10 UTC (rev 14995)
+++ root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/builder/generator/ValidatorTagGenerator.java 2009-07-24 01:32:04 UTC (rev 14996)
@@ -35,6 +35,7 @@
import org.richfaces.builder.config.PropertyBean;
import org.richfaces.builder.config.TagBean;
import org.richfaces.builder.config.ValidatorBean;
+import org.richfaces.cdk.Logger;
/**
Modified: root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/builder/generator/XMLConfigGenerator.java
===================================================================
--- root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/builder/generator/XMLConfigGenerator.java 2009-07-23 19:40:10 UTC (rev 14995)
+++ root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/builder/generator/XMLConfigGenerator.java 2009-07-24 01:32:04 UTC (rev 14996)
@@ -27,6 +27,7 @@
import org.richfaces.builder.config.ParsingException;
import org.richfaces.builder.xml.XMLBody;
+import org.richfaces.cdk.Logger;
/**
* @author shura
Added: root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/JavaLogger.java
===================================================================
--- root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/JavaLogger.java (rev 0)
+++ root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/JavaLogger.java 2009-07-24 01:32:04 UTC (rev 14996)
@@ -0,0 +1,168 @@
+/*
+ * $Id$
+ *
+ * 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.cdk;
+
+import java.util.logging.Level;
+
+/**
+ * <p class="changed_added_4_0">That logger delegates all calls to the JDK {@link java.util.logging.Logger}</p>
+ * @author asmirnov(a)exadel.com
+ *
+ */
+class JavaLogger implements Logger {
+
+ java.util.logging.Logger jdkLogger = java.util.logging.Logger.getLogger(LoggerFactory.CDK_LOG);
+
+ /* (non-Javadoc)
+ * @see org.richfaces.cdk.Logger#debug(java.lang.CharSequence)
+ */
+ @Override
+ public void debug(CharSequence content) {
+ jdkLogger.fine(String.valueOf(content));
+ }
+
+ /* (non-Javadoc)
+ * @see org.richfaces.cdk.Logger#debug(java.lang.CharSequence, java.lang.Throwable)
+ */
+ @Override
+ public void debug(CharSequence content, Throwable error) {
+ jdkLogger.log(Level.FINE, String.valueOf(content), error);
+ }
+
+ /* (non-Javadoc)
+ * @see org.richfaces.cdk.Logger#debug(java.lang.Throwable)
+ */
+ @Override
+ public void debug(Throwable error) {
+ jdkLogger.log(Level.FINE, "", error);
+ }
+
+ /* (non-Javadoc)
+ * @see org.richfaces.cdk.Logger#error(java.lang.CharSequence)
+ */
+ @Override
+ public void error(CharSequence content) {
+ jdkLogger.severe(String.valueOf(content));
+
+ }
+
+ /* (non-Javadoc)
+ * @see org.richfaces.cdk.Logger#error(java.lang.CharSequence, java.lang.Throwable)
+ */
+ @Override
+ public void error(CharSequence content, Throwable error) {
+ jdkLogger.log(Level.SEVERE, String.valueOf(content), error);
+ }
+
+ /* (non-Javadoc)
+ * @see org.richfaces.cdk.Logger#error(java.lang.Throwable)
+ */
+ @Override
+ public void error(Throwable error) {
+ jdkLogger.log(Level.SEVERE, "", error);
+ }
+
+ /* (non-Javadoc)
+ * @see org.richfaces.cdk.Logger#info(java.lang.CharSequence)
+ */
+ @Override
+ public void info(CharSequence content) {
+ jdkLogger.info(String.valueOf(content));
+ }
+
+ /* (non-Javadoc)
+ * @see org.richfaces.cdk.Logger#info(java.lang.CharSequence, java.lang.Throwable)
+ */
+ @Override
+ public void info(CharSequence content, Throwable error) {
+ jdkLogger.log(Level.INFO, String.valueOf(content), error);
+
+ }
+
+ /* (non-Javadoc)
+ * @see org.richfaces.cdk.Logger#info(java.lang.Throwable)
+ */
+ @Override
+ public void info(Throwable error) {
+ jdkLogger.log(Level.INFO, "", error);
+ }
+
+ /* (non-Javadoc)
+ * @see org.richfaces.cdk.Logger#isDebugEnabled()
+ */
+ @Override
+ public boolean isDebugEnabled() {
+ return jdkLogger.isLoggable(Level.FINE);
+ }
+
+ /* (non-Javadoc)
+ * @see org.richfaces.cdk.Logger#isErrorEnabled()
+ */
+ @Override
+ public boolean isErrorEnabled() {
+ return jdkLogger.isLoggable(Level.SEVERE);
+ }
+
+ /* (non-Javadoc)
+ * @see org.richfaces.cdk.Logger#isInfoEnabled()
+ */
+ @Override
+ public boolean isInfoEnabled() {
+ return jdkLogger.isLoggable(Level.INFO);
+ }
+
+ /* (non-Javadoc)
+ * @see org.richfaces.cdk.Logger#isWarnEnabled()
+ */
+ @Override
+ public boolean isWarnEnabled() {
+ return jdkLogger.isLoggable(Level.WARNING);
+ }
+
+ /* (non-Javadoc)
+ * @see org.richfaces.cdk.Logger#warn(java.lang.CharSequence)
+ */
+ @Override
+ public void warn(CharSequence content) {
+ jdkLogger.warning(String.valueOf(content));
+ }
+
+ /* (non-Javadoc)
+ * @see org.richfaces.cdk.Logger#warn(java.lang.CharSequence, java.lang.Throwable)
+ */
+ @Override
+ public void warn(CharSequence content, Throwable error) {
+ jdkLogger.log(Level.WARNING, String.valueOf(content), error);
+
+ }
+
+ /* (non-Javadoc)
+ * @see org.richfaces.cdk.Logger#warn(java.lang.Throwable)
+ */
+ @Override
+ public void warn(Throwable error) {
+ jdkLogger.log(Level.WARNING, "", error);
+ }
+
+}
Property changes on: root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/JavaLogger.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Copied: root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/Logger.java (from rev 14984, root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/builder/generator/Logger.java)
===================================================================
--- root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/Logger.java (rev 0)
+++ root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/Logger.java 2009-07-24 01:32:04 UTC (rev 14996)
@@ -0,0 +1,66 @@
+/**
+ * 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.cdk;
+
+/**
+ * That interface hides current logging system from generator classe.
+ * Concrete tools ( Maven, Ant, JUnit ) should provide appropriate logger instance that delegates
+ * messages to the current log system.
+ * @author shura
+ *
+ */
+public interface Logger {
+
+ boolean isDebugEnabled();
+
+ void debug( CharSequence content );
+
+ void debug( CharSequence content, Throwable error );
+
+ void debug( Throwable error );
+
+ boolean isInfoEnabled();
+
+ void info( CharSequence content );
+
+ void info( CharSequence content, Throwable error );
+
+ void info( Throwable error );
+
+ boolean isWarnEnabled();
+
+ void warn( CharSequence content );
+
+ void warn( CharSequence content, Throwable error );
+
+ void warn( Throwable error );
+
+ boolean isErrorEnabled();
+
+ void error( CharSequence content );
+
+ void error( CharSequence content, Throwable error );
+
+ void error( Throwable error );
+
+
+}
Added: root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/LoggerFactory.java
===================================================================
--- root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/LoggerFactory.java (rev 0)
+++ root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/LoggerFactory.java 2009-07-24 01:32:04 UTC (rev 14996)
@@ -0,0 +1,143 @@
+/*
+ * $Id$
+ *
+ * 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.cdk;
+
+/**
+ * <p class="changed_added_4_0"></p>
+ * @author asmirnov(a)exadel.com
+ *
+ */
+public final class LoggerFactory {
+
+ private static final class LoggerWrapper implements Logger {
+ @Override
+ public void debug(CharSequence content) {
+ logger.debug(content);
+ }
+
+ @Override
+ public void debug(CharSequence content, Throwable error) {
+ logger.debug(content, error);
+ }
+
+ @Override
+ public void debug(Throwable error) {
+ logger.debug(error);
+ }
+
+ @Override
+ public void error(CharSequence content) {
+ logger.error(content);
+ }
+
+ @Override
+ public void error(CharSequence content, Throwable error) {
+ logger.error(content, error);
+ }
+
+ @Override
+ public void error(Throwable error) {
+ logger.error(error);
+ }
+
+ @Override
+ public void info(CharSequence content) {
+ logger.info(content);
+ }
+
+ @Override
+ public void info(CharSequence content, Throwable error) {
+ logger.info(content, error);
+ }
+
+ @Override
+ public void info(Throwable error) {
+ logger.info(error);
+ }
+
+ @Override
+ public boolean isDebugEnabled() {
+ return logger.isDebugEnabled();
+ }
+
+ @Override
+ public boolean isErrorEnabled() {
+ return logger.isErrorEnabled();
+ }
+
+ @Override
+ public boolean isInfoEnabled() {
+ return logger.isInfoEnabled();
+ }
+
+ @Override
+ public boolean isWarnEnabled() {
+ return logger.isWarnEnabled();
+ }
+
+ @Override
+ public void warn(CharSequence content) {
+ logger.warn(content);
+ }
+
+ @Override
+ public void warn(CharSequence content, Throwable error) {
+ logger.warn(content, error);
+
+ }
+
+ @Override
+ public void warn(Throwable error) {
+ logger.warn(error);
+ }
+ }
+
+ /**
+ * <p class="changed_added_4_0">Current logger. By default all calls will be sent to system {@link java.util.logging.Logger}</p>
+ */
+ private static Logger logger = new JavaLogger();
+
+ /**
+ * <p class="changed_added_4_0">
+ * That constant wraps current logger object to allow access to logger at
+ * the class instantiation time.
+ * </p>
+ */
+ private static final Logger wrapper = new LoggerWrapper();
+
+ public static final String CDK_LOG = "org.richfaces.cdk";
+
+ private LoggerFactory() {
+ // That class has static methods only.
+ }
+
+ public static Logger getLogger(){
+ return wrapper;
+ }
+
+ public static void setLogger(Logger newLogger){
+ assert(null != newLogger);
+ logger = newLogger;
+ }
+}
Property changes on: root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/LoggerFactory.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Modified: root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/apt/VirtualFileManager.java
===================================================================
--- root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/apt/VirtualFileManager.java 2009-07-23 19:40:10 UTC (rev 14995)
+++ root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/apt/VirtualFileManager.java 2009-07-24 01:32:04 UTC (rev 14996)
@@ -28,18 +28,20 @@
import java.net.URISyntaxException;
import java.net.URL;
import java.util.ArrayList;
+import java.util.Iterator;
import java.util.List;
import java.util.Set;
-import java.util.concurrent.ConcurrentHashMap;
import javax.tools.FileObject;
import javax.tools.ForwardingJavaFileManager;
import javax.tools.JavaFileObject;
import javax.tools.StandardJavaFileManager;
import javax.tools.StandardLocation;
-import javax.tools.JavaFileManager.Location;
import javax.tools.JavaFileObject.Kind;
+import org.richfaces.cdk.Logger;
+import org.richfaces.cdk.LoggerFactory;
+
/**
* <p class="changed_added_4_0">That class wraps {@link StandardJavaFileManager}
* </p>
@@ -49,6 +51,8 @@
*/
final class VirtualFileManager extends
ForwardingJavaFileManager<StandardJavaFileManager> {
+
+ private static final Logger log = LoggerFactory.getLogger();
private final List<JavaFileObject> sources;
@@ -92,6 +96,9 @@
@Override
public JavaFileObject getJavaFileForInput(Location location,
String className, Kind kind) throws IOException {
+ if(log.isDebugEnabled()){
+ log.debug("VirtualFileManager.getJavaFileForInput("+String.valueOf(location)+","+className+","+String.valueOf(kind)+")");
+ }
if (StandardLocation.CLASS_PATH.equals(location)) {
String fileName = className.replace('.', '/') + kind.extension;
URL resource = getClassPathLoader().getResource(fileName);
@@ -113,6 +120,9 @@
@Override
public ClassLoader getClassLoader(Location location) {
+ if(log.isDebugEnabled()){
+ log.debug("VirtualFileManager.getClassLoader("+String.valueOf(location)+")");
+ }
if (StandardLocation.CLASS_PATH.equals(location)
|| StandardLocation.CLASS_OUTPUT.equals(location)) {
return getClassPathLoader();
@@ -132,6 +142,9 @@
@Override
public JavaFileObject getJavaFileForOutput(Location location,
String className, Kind kind, FileObject sibling) throws IOException {
+ if(log.isDebugEnabled()){
+ log.debug("VirtualFileManager.getJavaFileForOutput("+String.valueOf(location)+","+className+","+String.valueOf(kind)+","+String.valueOf(sibling)+")");
+ }
JavaFileObject fileForOutput = null;
if (StandardLocation.CLASS_OUTPUT.equals(location)
&& null != getOutputDirectory()) {
@@ -152,6 +165,9 @@
@Override
public boolean hasLocation(Location location) {
boolean hasLocation;
+ if(log.isDebugEnabled()){
+ log.debug("VirtualFileManager.hasLocation("+String.valueOf(location)+")");
+ }
if (StandardLocation.SOURCE_PATH.equals(location)) {
hasLocation = null != getJavaSourceDirectory() || !getSources().isEmpty();
} else if (StandardLocation.CLASS_OUTPUT.equals(location)) {
@@ -165,11 +181,106 @@
@Override
public Iterable<JavaFileObject> list(Location location, String packageName,
Set<Kind> kinds, boolean recurse) throws IOException {
+ if(log.isDebugEnabled()){
+ log.debug("VirtualFileManager.list("+String.valueOf(location)+","+packageName+","+String.valueOf(kinds)+","+String.valueOf(recurse)+")");
+ }
Iterable<JavaFileObject> list = super.list(location, packageName,
kinds, recurse);
return list;
}
+
+
+ /* (non-Javadoc)
+ * @see javax.tools.ForwardingJavaFileManager#close()
+ */
+ @Override
+ public void close() throws IOException {
+ if(log.isDebugEnabled()){
+ log.debug("VirtualFileManager.close()");
+ }
+ super.close();
+ }
+
+ /* (non-Javadoc)
+ * @see javax.tools.ForwardingJavaFileManager#flush()
+ */
+ @Override
+ public void flush() throws IOException {
+ if(log.isDebugEnabled()){
+ log.debug("VirtualFileManager.flush()");
+ }
+ super.flush();
+ }
+
+ /* (non-Javadoc)
+ * @see javax.tools.ForwardingJavaFileManager#getFileForInput(javax.tools.JavaFileManager.Location, java.lang.String, java.lang.String)
+ */
+ @Override
+ public FileObject getFileForInput(Location location, String packageName,
+ String relativeName) throws IOException {
+ if(log.isDebugEnabled()){
+ log.debug("VirtualFileManager.getFileForInput("+String.valueOf(location)+","+packageName+","+relativeName+")");
+ }
+ return super.getFileForInput(location, packageName, relativeName);
+ }
+
+ /* (non-Javadoc)
+ * @see javax.tools.ForwardingJavaFileManager#getFileForOutput(javax.tools.JavaFileManager.Location, java.lang.String, java.lang.String, javax.tools.FileObject)
+ */
+ @Override
+ public FileObject getFileForOutput(Location location, String packageName,
+ String relativeName, FileObject sibling) throws IOException {
+ if(log.isDebugEnabled()){
+ log.debug("VirtualFileManager.getFileForOutput("+String.valueOf(location)+","+packageName+","+relativeName+","+String.valueOf(sibling)+")");
+ }
+ return super.getFileForOutput(location, packageName, relativeName, sibling);
+ }
+
+ /* (non-Javadoc)
+ * @see javax.tools.ForwardingJavaFileManager#handleOption(java.lang.String, java.util.Iterator)
+ */
+ @Override
+ public boolean handleOption(String current, Iterator<String> remaining) {
+ if(log.isDebugEnabled()){
+ log.debug("VirtualFileManager.handleOption("+current+",remaining)");
+ }
+ return super.handleOption(current, remaining);
+ }
+
+ /* (non-Javadoc)
+ * @see javax.tools.ForwardingJavaFileManager#inferBinaryName(javax.tools.JavaFileManager.Location, javax.tools.JavaFileObject)
+ */
+ @Override
+ public String inferBinaryName(Location location, JavaFileObject file) {
+ if(log.isDebugEnabled()){
+ log.debug("VirtualFileManager.inferBinaryName("+String.valueOf(location)+","+String.valueOf(file)+")");
+ }
+ return super.inferBinaryName(location, file);
+ }
+
+ /* (non-Javadoc)
+ * @see javax.tools.ForwardingJavaFileManager#isSameFile(javax.tools.FileObject, javax.tools.FileObject)
+ */
+ @Override
+ public boolean isSameFile(FileObject a, FileObject b) {
+ if(log.isDebugEnabled()){
+ log.debug("VirtualFileManager.isSameFile("+String.valueOf(a)+","+String.valueOf(b)+")");
+ }
+ return super.isSameFile(a, b);
+ }
+
+ /* (non-Javadoc)
+ * @see javax.tools.ForwardingJavaFileManager#isSupportedOption(java.lang.String)
+ */
+ @Override
+ public int isSupportedOption(String option) {
+ if(log.isDebugEnabled()){
+ log.debug("VirtualFileManager.isSupportedOption("+option+")");
+ }
+ return super.isSupportedOption(option);
+ }
+
/**
* <p class="changed_added_4_0"></p>
*
Modified: root/cdk/trunk/plugins/generator/src/test/java/org/richfaces/cdk/apt/ProcessorTest.java
===================================================================
--- root/cdk/trunk/plugins/generator/src/test/java/org/richfaces/cdk/apt/ProcessorTest.java 2009-07-23 19:40:10 UTC (rev 14995)
+++ root/cdk/trunk/plugins/generator/src/test/java/org/richfaces/cdk/apt/ProcessorTest.java 2009-07-24 01:32:04 UTC (rev 14996)
@@ -35,6 +35,9 @@
import java.util.HashSet;
import java.util.List;
import java.util.Set;
+import java.util.logging.Level;
+import java.util.logging.LogManager;
+import java.util.logging.Logger;
import javax.annotation.processing.RoundEnvironment;
import javax.lang.model.element.Element;
@@ -50,6 +53,8 @@
import javax.tools.JavaCompiler.CompilationTask;
import javax.tools.JavaFileObject.Kind;
+import org.richfaces.cdk.LoggerFactory;
+
import junit.framework.TestCase;
/**
@@ -75,6 +80,7 @@
*/
protected void setUp() throws Exception {
super.setUp();
+ Logger.getLogger(LoggerFactory.CDK_LOG).setLevel(Level.ALL);
}
/*
Modified: root/cdk/trunk/plugins/generator/src/test/java/org/richfaces/cdk/apt/VirtualFileTest.java
===================================================================
--- root/cdk/trunk/plugins/generator/src/test/java/org/richfaces/cdk/apt/VirtualFileTest.java 2009-07-23 19:40:10 UTC (rev 14995)
+++ root/cdk/trunk/plugins/generator/src/test/java/org/richfaces/cdk/apt/VirtualFileTest.java 2009-07-24 01:32:04 UTC (rev 14996)
@@ -32,7 +32,6 @@
import javax.tools.JavaFileObject.Kind;
-import sun.reflect.ReflectionFactory.GetReflectionFactoryAction;
import junit.framework.TestCase;
15 years, 5 months
JBoss Rich Faces SVN: r14995 - branches/community/3.3.X/ui/inputnumber-slider/src/main/config/component.
by richfaces-svn-commits@lists.jboss.org
Author: smukhina
Date: 2009-07-23 15:40:10 -0400 (Thu, 23 Jul 2009)
New Revision: 14995
Modified:
branches/community/3.3.X/ui/inputnumber-slider/src/main/config/component/inputNumberSlider.xml
Log:
https://jira.jboss.org/jira/browse/RF-7535 "inputPosition" attribute "left" value is added
Modified: branches/community/3.3.X/ui/inputnumber-slider/src/main/config/component/inputNumberSlider.xml
===================================================================
--- branches/community/3.3.X/ui/inputnumber-slider/src/main/config/component/inputNumberSlider.xml 2009-07-23 19:15:03 UTC (rev 14994)
+++ branches/community/3.3.X/ui/inputnumber-slider/src/main/config/component/inputNumberSlider.xml 2009-07-23 19:40:10 UTC (rev 14995)
@@ -270,7 +270,7 @@
<property>
<name>inputPosition</name>
<classname>java.lang.String</classname>
- <description>If "right", the InputText Box would be rendered on the right side of the ruler. If "top", the InputText Box would be rendered on the top of the ruler. If "bottom", the InputText Box would be rendered on the bottom of the ruler.</description>
+ <description>If "right", the InputText Box would be rendered on the right side of the ruler. If "left", the InputText Box would be rendered on the left side of the ruler. If "top", the InputText Box would be rendered on the top of the ruler. If "bottom", the InputText Box would be rendered on the bottom of the ruler.</description>
<defaultvalue><![CDATA["right"]]></defaultvalue>
</property>
&ui_component_attributes;
15 years, 5 months
JBoss Rich Faces SVN: r14994 - branches/community/3.3.X/docs/userguide/en/src/main/docbook/included.
by richfaces-svn-commits@lists.jboss.org
Author: smukhina
Date: 2009-07-23 15:15:03 -0400 (Thu, 23 Jul 2009)
New Revision: 14994
Modified:
branches/community/3.3.X/docs/userguide/en/src/main/docbook/included/toolTip.xml
Log:
https://jira.jboss.org/jira/browse/RF-7387 mistake in class name is fixed
Modified: branches/community/3.3.X/docs/userguide/en/src/main/docbook/included/toolTip.xml
===================================================================
--- branches/community/3.3.X/docs/userguide/en/src/main/docbook/included/toolTip.xml 2009-07-23 18:39:41 UTC (rev 14993)
+++ branches/community/3.3.X/docs/userguide/en/src/main/docbook/included/toolTip.xml 2009-07-23 19:15:03 UTC (rev 14994)
@@ -23,7 +23,7 @@
</row>
<row>
<entry>component-class</entry>
- <entry>org.richfaces.component.html.HtmltoolTip</entry>
+ <entry>org.richfaces.component.html.HtmlToolTip</entry>
</row>
<row>
<entry>component-family</entry>
@@ -35,7 +35,7 @@
</row>
<row>
<entry>tag-class</entry>
- <entry>org.richfaces.taglib.HtmltoolTipTag</entry>
+ <entry>org.richfaces.taglib.HtmlToolTipTag</entry>
</row>
</tbody>
</tgroup>
@@ -58,7 +58,7 @@
<para>
<emphasis role="bold">Example:</emphasis>
</para>
- <programlisting role="JAVA"><![CDATA[import org.richfaces.component.html.HtmltoolTip;
+ <programlisting role="JAVA"><![CDATA[import org.richfaces.component.html.HtmlToolTip;
...
HtmltoolTip mytoolTip = new HtmltoolTip();
...
15 years, 5 months
JBoss Rich Faces SVN: r14992 - in root/framework/trunk: impl/src/main/java/org/ajax4jsf/application and 9 other directories.
by richfaces-svn-commits@lists.jboss.org
Author: nbelaevski
Date: 2009-07-23 13:23:34 -0400 (Thu, 23 Jul 2009)
New Revision: 14992
Removed:
root/framework/trunk/api/src/main/java/org/ajax4jsf/application/StateHolder.java
root/framework/trunk/impl/src/main/java/org/ajax4jsf/application/AjaxStateHolder.java
root/framework/trunk/impl/src/main/java/org/ajax4jsf/application/AjaxStateManager.java
root/framework/trunk/impl/src/main/java/org/ajax4jsf/application/ComponentsLoader.java
root/framework/trunk/impl/src/main/java/org/ajax4jsf/application/ComponentsLoaderImpl.java
root/framework/trunk/impl/src/main/java/org/ajax4jsf/application/TreeStructureNode.java
root/framework/trunk/impl/src/main/resources/org/ajax4jsf/org/w3c/tidy/
root/framework/trunk/impl/src/main/resources/org/ajax4jsf/webapp/output.properties
root/framework/trunk/impl/src/main/resources/org/ajax4jsf/webapp/tidy/
root/framework/trunk/impl/src/main/resources/org/ajax4jsf/xml/serializer/
root/framework/trunk/impl/src/test/java/org/ajax4jsf/framework/ajax/xmlfilter/
root/framework/trunk/impl/src/test/java/org/ajax4jsf/framework/util/
root/framework/trunk/impl/src/test/java/org/richfaces/model/impl/
Modified:
root/framework/trunk/api/src/main/java/org/ajax4jsf/application/ViewHandlerWrapper.java
root/framework/trunk/impl/src/main/java/org/ajax4jsf/context/ContextInitParameters.java
root/framework/trunk/impl/src/main/java/org/ajax4jsf/event/InitPhaseListener.java
root/framework/trunk/impl/src/test/java/org/ajax4jsf/context/InitParametersTest.java
Log:
Removed StateManager
Deleted: root/framework/trunk/api/src/main/java/org/ajax4jsf/application/StateHolder.java
===================================================================
--- root/framework/trunk/api/src/main/java/org/ajax4jsf/application/StateHolder.java 2009-07-23 17:22:34 UTC (rev 14991)
+++ root/framework/trunk/api/src/main/java/org/ajax4jsf/application/StateHolder.java 2009-07-23 17:23:34 UTC (rev 14992)
@@ -1,31 +0,0 @@
-/**
- * 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.ajax4jsf.application;
-
-import javax.faces.context.FacesContext;
-
-public interface StateHolder {
-
- public Object[] getState(FacesContext context, String viewId, String sequence);
-
- public void saveState(FacesContext context, String viewId, String sequence, Object state[]);
-
-}
\ No newline at end of file
Modified: root/framework/trunk/api/src/main/java/org/ajax4jsf/application/ViewHandlerWrapper.java
===================================================================
--- root/framework/trunk/api/src/main/java/org/ajax4jsf/application/ViewHandlerWrapper.java 2009-07-23 17:22:34 UTC (rev 14991)
+++ root/framework/trunk/api/src/main/java/org/ajax4jsf/application/ViewHandlerWrapper.java 2009-07-23 17:23:34 UTC (rev 14992)
@@ -41,6 +41,7 @@
* @version $Revision: 1.1.2.1 $ $Date: 2007/01/09 18:57:12 $
*
*/
+//TODO remove
public class ViewHandlerWrapper extends ViewHandler {
private static final String HANDLERS = "org.ajax4jsf.VIEW_HANDLERS";
Deleted: root/framework/trunk/impl/src/main/java/org/ajax4jsf/application/AjaxStateHolder.java
===================================================================
--- root/framework/trunk/impl/src/main/java/org/ajax4jsf/application/AjaxStateHolder.java 2009-07-23 17:22:34 UTC (rev 14991)
+++ root/framework/trunk/impl/src/main/java/org/ajax4jsf/application/AjaxStateHolder.java 2009-07-23 17:23:34 UTC (rev 14992)
@@ -1,227 +0,0 @@
-/**
- * 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.ajax4jsf.application;
-
-import java.io.IOException;
-import java.io.Serializable;
-import java.util.Map;
-
-import javax.faces.context.ExternalContext;
-import javax.faces.context.FacesContext;
-
-import org.ajax4jsf.context.ContextInitParameters;
-import org.ajax4jsf.util.LRUMap;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-
-/**
- * @author asmirnov
- *
- */
-public class AjaxStateHolder implements Serializable, StateHolder {
-
- private static final Log _log = LogFactory.getLog(AjaxStateHolder.class);
- /**
- *
- */
- private static final long serialVersionUID = 6414488517358423537L;
- private static final String STATE_HOLDER = AjaxStateHolder.class.getName();
-
- private final LRUMap<String, LRUMap<String, StateReference>> views;
-
- private final int numberOfViews;
-
- private AjaxStateHolder(int capacity, int numberOfViews) {
- views = new LRUMap<String, LRUMap<String, StateReference>>(capacity+1);
- this.numberOfViews = numberOfViews;
- }
-
- public static StateHolder getInstance(FacesContext context) {
- if (null == context) {
- throw new NullPointerException(
- "FacesContext parameter for get view states object is null");
- }
- ExternalContext externalContext = context.getExternalContext();
- Object session = externalContext.getSession(true);
- Map<String, Object> sessionMap = externalContext.getSessionMap();
- if (_log.isDebugEnabled()) {
- _log.debug("Request for a view states holder instance");
- }
- StateHolder instance = (StateHolder) sessionMap.get(STATE_HOLDER);
- if (instance == null) {
- synchronized (session) {
- instance = (StateHolder) sessionMap.get(STATE_HOLDER);
- if (null == instance) {
- // Create and store in session new state holder.
- int numbersOfViewsInSession = ContextInitParameters
- .getNumbersOfViewsInSession(context);
- int numbersOfLogicalViews = ContextInitParameters
- .getNumbersOfLogicalViews(context);
- if (_log.isDebugEnabled()) {
- _log
- .debug("No AjaxStateHolder instance in session, create new for hold "
- + numbersOfViewsInSession
- + " viewId and "
- + numbersOfLogicalViews
- + " logical views for each");
- }
- instance = new AjaxStateHolder(numbersOfViewsInSession,
- numbersOfLogicalViews);
- sessionMap.put(STATE_HOLDER, instance);
- }
- }
- }
-
- return instance;
- }
-
- /**
- * Updates instance of AjaxStateHolder saved in session in order
- * to force replication in clustered environment
- *
- * @param context
- */
- protected void updateInstance(FacesContext context) {
- ExternalContext externalContext = context.getExternalContext();
- Object session = externalContext.getSession(true);
- Map<String, Object> sessionMap = externalContext.getSessionMap();
-
- synchronized (session) {
- sessionMap.put(STATE_HOLDER, this);
- }
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.ajax4jsf.application.StateHolder#getState(java.lang.String,
- * java.lang.Object)
- */
- public Object[] getState(FacesContext context, String viewId, String sequence) {
- if (null == viewId) {
- throw new NullPointerException(
- "viewId parameter for get saved view state is null");
- }
- Object state[] = null;
- synchronized (views) {
- LRUMap<String, StateReference> viewVersions = views.get(viewId);
- if (null != viewVersions) {
- if (null != sequence) {
- StateReference stateReference = viewVersions.get(sequence);
- if (null != stateReference) {
- state = stateReference.getState();
- }
- }
- if (null == state) {
- if (_log.isDebugEnabled()) {
- _log.debug("No saved view state for sequence "
- + sequence);
- }
- // state = viewVersions.getMostRecent();
- }
- } else if (_log.isDebugEnabled()) {
- _log.debug("No saved view states for viewId " + viewId);
- }
- }
- return state;
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.ajax4jsf.application.StateHolder#saveState(java.lang.String,
- * java.lang.Object, java.lang.Object)
- */
- public void saveState(FacesContext context, String viewId, String sequence, Object[] state) {
- if (null == viewId) {
- throw new NullPointerException(
- "viewId parameter for save view state is null");
- }
- if (null == sequence) {
- throw new NullPointerException(
- "sequence parameter for save view state is null");
- }
- if (null != state) {
- if (_log.isDebugEnabled()) {
- _log.debug("Save new viewState in session for viewId " + viewId
- + " and sequence " + sequence);
- }
- synchronized (views) {
- LRUMap<String, StateReference> viewVersions = views.get(viewId);
- StateReference stateReference = null;
- if (null == viewVersions) {
- // TODO - make size parameter configurable
- viewVersions = new LRUMap<String, StateReference>(
- this.numberOfViews+1);
- views.put(viewId, viewVersions);
- stateReference = new StateReference(state);
- viewVersions.put(sequence, stateReference);
- } else {
- stateReference = viewVersions.get(sequence);
- if(null == stateReference){
- stateReference = new StateReference(state);
- viewVersions.put(sequence, stateReference);
- } else {
- stateReference.setState(state);
- }
- }
- }
-
- //serialization is synchronized in writeObject()
- updateInstance(context);
- }
- }
-
- private void writeObject(java.io.ObjectOutputStream stream)
- throws IOException {
-
- synchronized (views) {
- stream.defaultWriteObject();
- }
- }
-
- private void readObject(java.io.ObjectInputStream stream)
- throws IOException, ClassNotFoundException {
-
- stream.defaultReadObject();
- }
-
- @SuppressWarnings("serial")
- private static class StateReference implements Serializable {
- private Object[] state;
-
- public Object[] getState() {
- return state;
- }
-
- public void setState(Object[] state) {
- this.state = state;
- }
-
- /**
- * @param state
- */
- public StateReference(Object[] state) {
- super();
- this.state = state;
- }
- }
-}
Deleted: root/framework/trunk/impl/src/main/java/org/ajax4jsf/application/AjaxStateManager.java
===================================================================
--- root/framework/trunk/impl/src/main/java/org/ajax4jsf/application/AjaxStateManager.java 2009-07-23 17:22:34 UTC (rev 14991)
+++ root/framework/trunk/impl/src/main/java/org/ajax4jsf/application/AjaxStateManager.java 2009-07-23 17:23:34 UTC (rev 14992)
@@ -1,668 +0,0 @@
-/**
- * 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.ajax4jsf.application;
-
-import java.io.ByteArrayInputStream;
-import java.io.ByteArrayOutputStream;
-import java.io.IOException;
-import java.io.ObjectInputStream;
-import java.io.ObjectOutputStream;
-import java.io.ObjectStreamClass;
-import java.io.StringWriter;
-import java.lang.reflect.Constructor;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.Map;
-import java.util.Map.Entry;
-import java.util.regex.Matcher;
-import java.util.regex.Pattern;
-
-import javax.faces.FacesException;
-import javax.faces.FactoryFinder;
-import javax.faces.application.StateManager;
-import javax.faces.component.UIComponentBase;
-import javax.faces.component.UIViewRoot;
-import javax.faces.context.ExternalContext;
-import javax.faces.context.FacesContext;
-import javax.faces.context.ResponseWriter;
-import javax.faces.render.RenderKit;
-import javax.faces.render.RenderKitFactory;
-import javax.faces.render.ResponseStateManager;
-
-import org.ajax4jsf.context.AjaxContext;
-import org.ajax4jsf.context.ContextInitParameters;
-import org.ajax4jsf.model.KeepAlive;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-
-/**
- * @author shura
- *
- */
-public class AjaxStateManager extends StateManager {
-
-
- public static final String CAPTURED_VIEW_STATE = "org.ajax4jsf.captured_view_state";
-
- private final class SeamStateManagerWrapper extends StateManager {
- protected Object getComponentStateToSave(FacesContext arg0) {
- // do nothing
- return null;
- }
-
- protected Object getTreeStructureToSave(FacesContext arg0) {
- // do nothing
- return null;
- }
-
- protected void restoreComponentState(FacesContext arg0,
- UIViewRoot arg1, String arg2) {
- // do nothing
-
- }
-
- protected UIViewRoot restoreTreeStructure(FacesContext arg0,
- String arg1, String arg2) {
- // do nothing
- return null;
- }
-
- public UIViewRoot restoreView(FacesContext arg0, String arg1,
- String arg2) {
- // do nothing
- return null;
- }
-
- @SuppressWarnings("deprecation")
- public SerializedView saveSerializedView(FacesContext context) {
- // delegate to enclosed class method.
- Object[] viewState = buildViewState(context);
- return new SerializedView(viewState[0],viewState[1]);
- }
-
- @Override
- public Object saveView(FacesContext context) {
- // TODO Auto-generated method stub
- return buildViewState(context);
- }
- @SuppressWarnings("deprecation")
- public void writeState(FacesContext arg0, SerializedView arg1)
- throws IOException {
- // do nothing
- }
- }
-
- private static final Class<StateManager> STATE_MANAGER_ARGUMENTS = StateManager.class;
-
- public static final int DEFAULT_NUMBER_OF_VIEWS = 16;
-
- public static final String AJAX_VIEW_SEQUENCE = AjaxStateManager.class.getName()
- + ".AJAX_VIEW_SEQUENCE";
- public static final String VIEW_SEQUENCE = AjaxStateManager.class.getName()
- + ".VIEW_SEQUENCE";
-
- private final StateManager parent;
-
- private StateManager seamStateManager;
-
- private final ComponentsLoader componentLoader;
-
- private static final Log _log = LogFactory.getLog(AjaxStateManager.class);
-
- public static final String VIEW_SEQUENCE_ATTRIBUTE = AjaxStateManager.class
- .getName()
- + ".view_sequence";
-
- /**
- * @param parent
- */
- public AjaxStateManager(StateManager parent) {
- super();
- this.parent = parent;
- componentLoader = new ComponentsLoaderImpl();
- // HACK - Seam perform significant operations before save tree state.
- // Try to create it instance by reflection,
- // to call in real state saving operations.
- ClassLoader classLoader = Thread.currentThread()
- .getContextClassLoader();
- if (null == classLoader) {
- classLoader = AjaxStateManager.class.getClassLoader();
- }
- try {
- Class<? extends StateManager> seamStateManagerClass = classLoader
- .loadClass("org.jboss.seam.jsf.SeamStateManager")
- .asSubclass(StateManager.class);
- Constructor<? extends StateManager> constructor = seamStateManagerClass
- .getConstructor(STATE_MANAGER_ARGUMENTS);
- seamStateManager = constructor
- .newInstance(new Object[] { new SeamStateManagerWrapper() });
- if (_log.isDebugEnabled()) {
- _log.debug("Create instance of the SeamStateManager");
- }
- } catch (Exception e) {
- seamStateManager = null;
- if (_log.isDebugEnabled()) {
- _log.debug("SeamStateManager is not present");
- }
- }
- }
-
- /*
- * (non-Javadoc)
- *
- * @see javax.faces.application.StateManager#getComponentStateToSave(javax.faces.context.FacesContext)
- */
- protected Object getComponentStateToSave(FacesContext context) {
- Object treeState = context.getViewRoot().processSaveState(context);
- Object state[] = { treeState, getAdditionalState(context) };
- return state;
- }
-
- /*
- * (non-Javadoc)
- *
- * @see javax.faces.application.StateManager#getTreeStructureToSave(javax.faces.context.FacesContext)
- */
- protected Object getTreeStructureToSave(FacesContext context) {
- TreeStructureNode treeStructure = new TreeStructureNode();
- treeStructure.apply(context, context.getViewRoot(),
- new HashSet<String>());
- return treeStructure;
- }
-
- /*
- * (non-Javadoc)
- *
- * @see javax.faces.application.StateManager#restoreComponentState(javax.faces.context.FacesContext,
- * javax.faces.component.UIViewRoot, java.lang.String)
- */
- protected void restoreComponentState(FacesContext context,
- UIViewRoot viewRoot, String renderKitId) {
- throw new UnsupportedOperationException();
- }
-
- /*
- * (non-Javadoc)
- *
- * @see javax.faces.application.StateManager#restoreTreeStructure(javax.faces.context.FacesContext,
- * java.lang.String, java.lang.String)
- */
- protected UIViewRoot restoreTreeStructure(FacesContext context,
- String viewId, String renderKitId) {
- throw new UnsupportedOperationException();
- }
-
- /*
- * (non-Javadoc)
- *
- * @see javax.faces.application.StateManager#writeState(javax.faces.context.FacesContext,
- * javax.faces.application.StateManager.SerializedView)
- */
- public void writeState(FacesContext context, Object state)
- throws IOException {
- RenderKit renderKit = getRenderKit(context);
- ResponseStateManager responseStateManager = renderKit
- .getResponseStateManager();
- Object[] stateArray = getStateArray( state );
- if(null == stateArray[0] && null == stateArray[1]){
- // Myfaces https://issues.apache.org/jira/browse/MYFACES-1753 hack.
- stateArray=new Object[]{getLogicalViewId(context),null};
- }
- writeState(context, responseStateManager, stateArray);
- if (_log.isDebugEnabled()) {
- _log.debug("Write view state to the response");
- }
- }
-
- /*
- * (non-Javadoc)
- *
- * @see javax.faces.application.StateManager#writeState(javax.faces.context.FacesContext,
- * javax.faces.application.StateManager.SerializedView)
- */
- @SuppressWarnings("deprecation")
- public void writeState(FacesContext context, SerializedView state)
- throws IOException {
- RenderKit renderKit = getRenderKit(context);
- ResponseStateManager responseStateManager = renderKit
- .getResponseStateManager();
- Object[] stateArray;
- if(null == state.getState() && null == state.getStructure()){
- // MyFaces https://issues.apache.org/jira/browse/MYFACES-1753 hack
- stateArray = new Object[]{getLogicalViewId(context),null};
- } else {
- stateArray = new Object[] {
- state.getStructure(),state.getState() };
- }
- writeState(context, responseStateManager, stateArray);
- if (_log.isDebugEnabled()) {
- _log.debug("Write view state to the response");
- }
- }
-
- /**
- * @param context
- * @param state
- * @param responseStateManager
- * @throws IOException
- * @throws FacesException
- */
- private Object[] getStateArray(Object state) throws IOException,
- FacesException {
- if (null != state && state.getClass().isArray()
- && state.getClass().getComponentType().equals(Object.class)) {
- Object stateArray[] = (Object[]) state;
- if (2 == stateArray.length) {
- return stateArray;
- } else {
- throw new FacesException("Unexpected length of the state object array "+stateArray.length);
- }
- } else {
- throw new FacesException("Unexpected type of the state "+state.getClass().getName());
- }
- }
-
- private void writeState(FacesContext context,
- ResponseStateManager responseStateManager, Object[] stateArray)
- throws IOException {
- // Capture writed state into string.
- ResponseWriter originalWriter = context.getResponseWriter();
- StringWriter buff = new StringWriter(128);
- try {
- ResponseWriter stateResponseWriter = originalWriter
- .cloneWithWriter(buff);
- context.setResponseWriter(stateResponseWriter);
- responseStateManager.writeState(context, stateArray);
- stateResponseWriter.flush();
- String stateString = buff.toString();
- originalWriter.write(stateString);
- String stateValue = getStateValue(stateString);
- context.getExternalContext().getRequestMap().put(CAPTURED_VIEW_STATE, stateValue);
- if (null != stateValue) {
- } else {
- }
- } finally {
- context.setResponseWriter(originalWriter);
- }
- }
-
- private static final Pattern PATTERN = Pattern.compile(".*<input.*(?:\\svalue=[\"\'](.*)[\"\']\\s).*name=[\"']"+ResponseStateManager.VIEW_STATE_PARAM+"[\"'].*>");
-
- private static final Pattern PATTERN2 = Pattern.compile(".*<input .*name=[\"']"+ResponseStateManager.VIEW_STATE_PARAM+"[\"'].*(?:\\svalue=[\"\'](.*)[\"\']\\s).*>");
-
-
- /**
- * Parse content of the writed viewState hidden input field for a state value.
- * @param input
- * @return
- */
- private String getStateValue(String input) {
- Matcher matcher = PATTERN.matcher(input);
- if(!matcher.matches()){
- matcher = PATTERN2.matcher(input);
- if(!matcher.matches()){
- return null;
- }
- }
- return matcher.group(1);
-}
-
- private static final Map<String,Class<?>> PRIMITIVE_CLASSES =
- new HashMap<String,Class<?>>(9, 1.0F);
-
- static {
- PRIMITIVE_CLASSES.put("boolean", boolean.class);
- PRIMITIVE_CLASSES.put("byte", byte.class);
- PRIMITIVE_CLASSES.put("char", char.class);
- PRIMITIVE_CLASSES.put("short", short.class);
- PRIMITIVE_CLASSES.put("int", int.class);
- PRIMITIVE_CLASSES.put("long", long.class);
- PRIMITIVE_CLASSES.put("float", float.class);
- PRIMITIVE_CLASSES.put("double", double.class);
- PRIMITIVE_CLASSES.put("void", void.class);
- }
-
- private static final Object handleRestoreState(FacesContext context, Object state) {
- if (ContextInitParameters.isSerializeServerState(context)) {
- ObjectInputStream ois = null;
- try {
- ois = new ObjectInputStream(new ByteArrayInputStream((byte[]) state)) {
- @Override
- protected Class<?> resolveClass(ObjectStreamClass desc)
- throws IOException, ClassNotFoundException {
- String name = desc.getName();
- try {
- return Class.forName(name, true,
- Thread.currentThread().getContextClassLoader());
- } catch (ClassNotFoundException cnfe) {
- Class<?> clazz = PRIMITIVE_CLASSES.get(name);
- if (clazz != null) {
- return clazz;
- } else {
- throw cnfe;
- }
- }
- }
- };
- return ois.readObject();
- } catch (Exception e) {
- throw new FacesException(e);
- } finally {
- if (ois != null) {
- try {
- ois.close();
- } catch (IOException ignored) { }
- }
- }
- } else {
- return state;
- }
- }
-
- private static final Object handleSaveState(FacesContext context, Object state) {
- if (ContextInitParameters.isSerializeServerState(context)) {
- ByteArrayOutputStream baos = new ByteArrayOutputStream(1024);
- ObjectOutputStream oas = null;
- try {
- oas = new ObjectOutputStream(baos);
- oas.writeObject(state);
- oas.flush();
- } catch (Exception e) {
- throw new FacesException(e);
- } finally {
- if (oas != null) {
- try {
- oas.close();
- } catch (IOException ignored) { }
- }
- }
- return baos.toByteArray();
- } else {
- return state;
- }
- }
-
- /*
- * (non-Javadoc)
- *
- * @see javax.faces.application.StateManager#restoreView(javax.faces.context.FacesContext,
- * java.lang.String, java.lang.String)
- */
- public UIViewRoot restoreView(FacesContext context, String viewId,
- String renderKitId) {
- UIViewRoot viewRoot = null;
- ResponseStateManager responseStateManager = getRenderKit(context,
- renderKitId).getResponseStateManager();
- TreeStructureNode treeStructure = null;
- Object[] state = null;
- Object[] serializedView = null;
- if (isSavingStateInClient(context)) {
- serializedView = (Object[]) responseStateManager.getState(context,
- viewId);
-
- if (null != serializedView) {
- treeStructure = (TreeStructureNode) serializedView[0];
- state = (Object[]) serializedView[1];
- }
- } else {
- serializedView = restoreStateFromSession(context, viewId,
- renderKitId);
-
- if (null != serializedView) {
- treeStructure = (TreeStructureNode) serializedView[0];
- state = (Object[]) handleRestoreState(context, serializedView[1]);
- }
- }
-
- if (null != treeStructure) {
- viewRoot = (UIViewRoot) treeStructure.restore(componentLoader);
- if (null != viewRoot && null != state) {
- viewRoot.processRestoreState(context, state[0]);
- restoreAdditionalState(context, state[1]);
- }
- }
- return viewRoot;
-
- }
-
- @SuppressWarnings("deprecation")
- public SerializedView saveSerializedView(FacesContext context) {
- Object[] stateViewArray;
- if (null == seamStateManager) {
- stateViewArray = buildViewState(context);
- } else {
- // Delegate save method to seam State Manager.
- stateViewArray=(Object[]) seamStateManager.saveView(context);
- }
- return new SerializedView(stateViewArray[0],stateViewArray[1]);
- }
-
- @Override
- public Object saveView(FacesContext context) {
- if (null == seamStateManager) {
- return buildViewState(context);
- } else {
- // Delegate save method to seam State Manager.
- return seamStateManager.saveView(context);
- }
- }
- /**
- * @param context
- * @return
- * @see javax.faces.application.StateManager#isSavingStateInClient(javax.faces.context.FacesContext)
- */
- public boolean isSavingStateInClient(FacesContext context) {
- return parent.isSavingStateInClient(context);
- }
-
- protected Object[] restoreStateFromSession(FacesContext context,
- String viewId, String renderKitId) {
- String id = restoreLogicalViewId(context, viewId, renderKitId);
- StateHolder stateHolder = getStateHolder(context);
- Object[] restoredState = stateHolder.getState(context, viewId, id);
-
- if (restoredState != null && id != null) {
- context.getExternalContext().getRequestMap().put(AJAX_VIEW_SEQUENCE, id);
- }
-
- return restoredState;
- }
-
- /**
- * @param context
- * @return
- */
- protected Object[] buildViewState(FacesContext context) {
- Object[] viewStateArray = null;
- UIViewRoot viewRoot = context.getViewRoot();
- if (null != viewRoot && !viewRoot.isTransient()) {
- TreeStructureNode treeStructure = (TreeStructureNode) getTreeStructureToSave(context);
- Object state = getComponentStateToSave(context);
- if (isSavingStateInClient(context)) {
- viewStateArray = new Object[]{treeStructure, state};
- } else {
- viewStateArray = saveStateInSession(context, treeStructure,
- handleSaveState(context, state));
- }
-
- }
- return viewStateArray;
- }
-
- /**
- * @param context
- * @param treeStructure
- * @param state
- * @return
- */
- protected Object[] saveStateInSession(FacesContext context,
- Object treeStructure, Object state) {
- Object[] serializedView;
- UIViewRoot viewRoot = context.getViewRoot();
- StateHolder stateHolder = getStateHolder(context);
- String id = getLogicalViewId(context);
- stateHolder.saveState(context, viewRoot.getViewId(), id, new Object[] {
- treeStructure, state });
- serializedView = new Object[]{id, null};
- return serializedView;
- }
-
- /**
- * @param context
- * @return
- */
- protected StateHolder getStateHolder(FacesContext context) {
- return AjaxStateHolder.getInstance(context);
- }
-
- protected Object getAdditionalState(FacesContext context) {
- Map<String, Object> keepAliveBeans = new HashMap<String, Object>();
- Map<String, Object> requestMap = context.getExternalContext()
- .getRequestMap();
- // Save all objects form request map wich marked by @KeepAlive
- // annotations
- for (Entry<String, Object> requestEntry : requestMap.entrySet()) {
- Object bean = requestEntry.getValue();
- // check value for a NULL -
- // http://jira.jboss.com/jira/browse/RF-3576
- if (null != bean
- && bean.getClass().isAnnotationPresent(KeepAlive.class)) {
- keepAliveBeans.put(requestEntry.getKey(), bean);
- }
- }
- if (keepAliveBeans.size() > 0) {
- return UIComponentBase.saveAttachedState(context, keepAliveBeans);
- } else {
- return null;
- }
- }
-
- @SuppressWarnings("unchecked")
- protected void restoreAdditionalState(FacesContext context, Object state) {
- if (null != state) {
- boolean isAjax = AjaxContext.getCurrentInstance(context).isAjaxRequest();
-
- // Append all saved beans to the request map.
- Map beansMap = (Map) UIComponentBase.restoreAttachedState(context,
- state);
- Map<String, Object> requestMap = context.getExternalContext()
- .getRequestMap();
- for (Object key : beansMap.keySet()) {
- Object bean = beansMap.get(key);
- if (bean != null) {
- KeepAlive annotation = bean.getClass().getAnnotation(KeepAlive.class);
- if (annotation != null) {
- if (!isAjax && annotation.ajaxOnly()) {
-
- //skip ajax-only beans for non-ajax requests
- continue;
- }
- }
- }
-
- requestMap.put((String) key, bean);
- }
- }
- }
-
- /**
- * Restore logical view id from request.
- *
- * @param context
- * @param viewId
- * @param renderKitId
- * @return
- */
- @SuppressWarnings("deprecation")
- protected String restoreLogicalViewId(FacesContext context, String viewId,
- String renderKitId) {
- String id = (String) getRenderKit(context, renderKitId)
- .getResponseStateManager().getTreeStructureToRestore(context,
- viewId);
- return id;
- }
-
- /**
- * Return logical Id for current request view state. For a faces requests,
- * generate sequence numbers. For a ajax request, attempt to re-use id from
- * request submit.
- *
- * @param context
- * @return
- */
- protected String getLogicalViewId(FacesContext context) {
- AjaxContext ajaxContext = AjaxContext.getCurrentInstance(context);
- ExternalContext externalContext = context.getExternalContext();
- Object id=null;
- Map<String, Object> requestMap = externalContext.getRequestMap();
- id = requestMap.get(ajaxContext.isAjaxRequest()?AJAX_VIEW_SEQUENCE:VIEW_SEQUENCE);
- if (null != id) {
- return id.toString();
- }
- // Store sequence in session, to avoyd claster configuration problem
- // see https://javaserverfaces.dev.java.net/issues/show_bug.cgi?id=662
- Object session = externalContext.getSession(true);
- int viewSequence;
- synchronized (session) {
- Map<String, Object> sessionMap = externalContext.getSessionMap();
- Integer sequence = (Integer) sessionMap
- .get(VIEW_SEQUENCE_ATTRIBUTE);
- if (null != sequence) {
- viewSequence = sequence.intValue();
- } else {
- viewSequence = 0;
- }
- if (viewSequence++ == Character.MAX_VALUE) {
- viewSequence = 0;
- }
- sessionMap.put(VIEW_SEQUENCE_ATTRIBUTE, new Integer(viewSequence));
- }
- String logicalViewId = UIViewRoot.UNIQUE_ID_PREFIX + ((int) viewSequence);
- // Store new viewId in the request parameters, to avoid re-increments in the same request.
- requestMap.put(VIEW_SEQUENCE,logicalViewId);
- return logicalViewId;
- }
-
- protected RenderKit getRenderKit(FacesContext context) {
- String renderKitId = null;
- UIViewRoot viewRoot = context.getViewRoot();
- if (null != viewRoot) {
- renderKitId = viewRoot.getRenderKitId();
- }
- if (null == renderKitId) {
- renderKitId = context.getApplication().getViewHandler()
- .calculateRenderKitId(context);
- }
- return getRenderKit(context, renderKitId);
- }
-
- protected RenderKit getRenderKit(FacesContext context, String renderKitId) {
- RenderKit renderKit = context.getRenderKit();
- if (null == renderKit) {
- RenderKitFactory factory = (RenderKitFactory) FactoryFinder
- .getFactory(FactoryFinder.RENDER_KIT_FACTORY);
- renderKit = factory.getRenderKit(context, renderKitId);
- }
- return renderKit;
- }
-
-}
Deleted: root/framework/trunk/impl/src/main/java/org/ajax4jsf/application/ComponentsLoader.java
===================================================================
--- root/framework/trunk/impl/src/main/java/org/ajax4jsf/application/ComponentsLoader.java 2009-07-23 17:22:34 UTC (rev 14991)
+++ root/framework/trunk/impl/src/main/java/org/ajax4jsf/application/ComponentsLoader.java 2009-07-23 17:23:34 UTC (rev 14992)
@@ -1,29 +0,0 @@
-/**
- * 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.ajax4jsf.application;
-
-import javax.faces.component.UIComponent;
-
-public interface ComponentsLoader {
-
- public abstract UIComponent createComponent(String type);
-
-}
\ No newline at end of file
Deleted: root/framework/trunk/impl/src/main/java/org/ajax4jsf/application/ComponentsLoaderImpl.java
===================================================================
--- root/framework/trunk/impl/src/main/java/org/ajax4jsf/application/ComponentsLoaderImpl.java 2009-07-23 17:22:34 UTC (rev 14991)
+++ root/framework/trunk/impl/src/main/java/org/ajax4jsf/application/ComponentsLoaderImpl.java 2009-07-23 17:23:34 UTC (rev 14992)
@@ -1,83 +0,0 @@
-/**
- * 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.ajax4jsf.application;
-
-import java.util.Map;
-import java.util.concurrent.ConcurrentHashMap;
-
-import javax.faces.FacesException;
-import javax.faces.component.UIComponent;
-
-/**
- * @author asmirnov
- *
- */
-public class ComponentsLoaderImpl implements ComponentsLoader {
-
- private Map<String, Class<? extends UIComponent>> classes;
-
- private ClassLoader loader;
-
- public ComponentsLoaderImpl() {
- classes = new ConcurrentHashMap<String, Class<? extends UIComponent>>(
- 64);
- loader = Thread.currentThread().getContextClassLoader();
- if (loader == null) {
- loader = ComponentsLoaderImpl.class.getClassLoader();
- }
- }
-
- /*
- * (non-Javadoc)
- *
- * @see
- * org.ajax4jsf.portlet.application.ComponentsLoader#createComponent(java
- * .lang.String)
- */
- public UIComponent createComponent(String type) {
- // Classes is a lazy Map, new object will be create on the fly.
- Class<? extends UIComponent> componentClass = classes.get(type);
- if(null == componentClass){
- try {
- componentClass = loader.loadClass(type).asSubclass(UIComponent.class);
- classes.put(type, componentClass);
- } catch (ClassNotFoundException e) {
- throw new FacesException("Can't load class " + type, e);
- }
-
- }
- try {
- return componentClass.newInstance();
- } catch (InstantiationException e) {
- throw new FacesException(
- "Error on create new instance of the component with class "
- + type, e);
- } catch (IllegalAccessException e) {
- throw new FacesException(
- "IllegalAccess on attempt to create new instance of the component with class "
- + type, e);
- }
- }
-
- ClassLoader getClassLoader() {
- return loader;
- }
-}
Deleted: root/framework/trunk/impl/src/main/java/org/ajax4jsf/application/TreeStructureNode.java
===================================================================
--- root/framework/trunk/impl/src/main/java/org/ajax4jsf/application/TreeStructureNode.java 2009-07-23 17:22:34 UTC (rev 14991)
+++ root/framework/trunk/impl/src/main/java/org/ajax4jsf/application/TreeStructureNode.java 2009-07-23 17:23:34 UTC (rev 14992)
@@ -1,264 +0,0 @@
-/**
- * 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.ajax4jsf.application;
-
-import java.io.Externalizable;
-import java.io.IOException;
-import java.io.ObjectInput;
-import java.io.ObjectOutput;
-import java.io.Serializable;
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-import java.util.Map.Entry;
-
-import javax.faces.component.UIComponent;
-import javax.faces.context.FacesContext;
-
-/**
- * @author asmirnov
- *
- */
-final class TreeStructureNode implements Externalizable {
- /**
- * TODO - implement Externalizable to reduce serialized state.
- */
- private static final long serialVersionUID = -9038742487716977912L;
-
- private static final String NULL_ID = "";
-
- private List<FacetEntry> facets = null;
-
- private List<TreeStructureNode> children = null;
-
- private String type;
-
- private String id;
-
- public TreeStructureNode() {
- }
-
- public void apply(FacesContext context, UIComponent component,
- Set<String> uniqueIds) {
- type = component.getClass().getName();
- id = component.getId();
- String clientId = component.getClientId(context);
- if (!uniqueIds.add(clientId)) {
- throw new IllegalStateException("duplicate Id for a component "
- + clientId);
- }
- Map<String, UIComponent> componentFacets = component.getFacets();
- for (Iterator<Entry<String, UIComponent>> i = componentFacets
- .entrySet().iterator(); i.hasNext();) {
- Entry<String, UIComponent> element = i.next();
- UIComponent f = element.getValue();
- if (!f.isTransient()) {
- TreeStructureNode facet = new TreeStructureNode();
- facet.apply(context, f, uniqueIds);
- if (null == facets) {
- facets = new ArrayList<FacetEntry>(componentFacets.size());
- }
- facets.add(new FacetEntry(element.getKey(), facet));
-
- }
- }
- List<UIComponent> componentChildren = component.getChildren();
- for (Iterator<UIComponent> i = componentChildren.iterator(); i
- .hasNext();) {
- UIComponent child = i.next();
- if (!child.isTransient()) {
- TreeStructureNode t = new TreeStructureNode();
- t.apply(context, child, uniqueIds);
- if (null == children) {
- children = new ArrayList<TreeStructureNode>(
- componentChildren.size());
- }
- children.add(t);
-
- }
- }
- }
-
- public UIComponent restore(ComponentsLoader loader) {
- UIComponent component;
- component = loader.createComponent(type);
- component.setId(id);
- if (null != facets) {
- for (Iterator<FacetEntry> i = facets.iterator(); i.hasNext();) {
- FacetEntry element = i.next();
- UIComponent facet = (element.getNode()).restore(loader);
- component.getFacets().put(element.getName(), facet);
- }
-
- }
- if (null != children) {
- for (Iterator<TreeStructureNode> i = children.iterator(); i
- .hasNext();) {
- TreeStructureNode node = i.next();
- UIComponent child = node.restore(loader);
- component.getChildren().add(child);
- }
-
- }
- return component;
- }
-
- /**
- * @return the facets
- */
- public List<FacetEntry> getFacets() {
- return facets;
- }
-
-
- /**
- * @return the children
- */
- public List<TreeStructureNode> getChildren() {
- return children;
- }
-
-
- /**
- * @return the type
- */
- public String getType() {
- return type;
- }
-
- /**
- * @param type
- * the type to set
- */
- public void setType(String type) {
- this.type = type;
- }
-
- /**
- * @return the id
- */
- public String getId() {
- return id;
- }
-
- /**
- * @param id
- * the id to set
- */
- public void setId(String id) {
- this.id = id;
- }
-
- public void readExternal(ObjectInput in) throws IOException,
- ClassNotFoundException {
- type = in.readUTF();
- id = in.readUTF();
- if (NULL_ID.equals(id)) {
- id = null;
- }
- int facetsSize = in.readInt();
- if (facetsSize > 0) {
- facets = new ArrayList<FacetEntry>(facetsSize);
- for (int i = 0; i < facetsSize; i++) {
- String facetName = in.readUTF();
- TreeStructureNode facet = new TreeStructureNode();
- facet.readExternal(in);
- facets.add(new FacetEntry(facetName, facet));
- }
- }
- int childrenSize = in.readInt();
- if (childrenSize > 0) {
- children = new ArrayList<TreeStructureNode>(childrenSize);
- for (int i = 0; i < childrenSize; i++) {
- TreeStructureNode child = new TreeStructureNode();
- child.readExternal(in);
- children.add(child);
- }
- }
- }
-
- public void writeExternal(ObjectOutput out) throws IOException {
- out.writeUTF(type);
- out.writeUTF(null == id ? NULL_ID : id);
- if (null != facets) {
- out.writeInt(facets.size());
- for (Iterator<FacetEntry> i = facets.iterator(); i.hasNext();) {
- FacetEntry entry = i.next();
- out.writeUTF(entry.getName());
- TreeStructureNode node = entry.getNode();
- node.writeExternal(out);
- }
-
- } else {
- out.writeInt(0);
- }
- if (null != children) {
- out.writeInt(children.size());
- for (Iterator<TreeStructureNode> i = children.iterator(); i
- .hasNext();) {
- TreeStructureNode child = i.next();
- child.writeExternal(out);
- }
-
- } else {
- out.writeInt(0);
- }
- }
-
- @SuppressWarnings("serial")
- static final class FacetEntry implements Externalizable {
- private String name;
- private TreeStructureNode node;
-
- public String getName() {
- return name;
- }
-
- public TreeStructureNode getNode() {
- return node;
- }
-
- /**
- * @param name
- * @param node
- */
- public FacetEntry(String name, TreeStructureNode node) {
- super();
- this.name = name;
- this.node = node;
- }
-
- public void readExternal(ObjectInput in) throws IOException,
- ClassNotFoundException {
- this.name = in.readUTF();
- this.node = new TreeStructureNode();
- this.node.readExternal(in);
- }
-
- public void writeExternal(ObjectOutput out) throws IOException {
- out.writeUTF(name);
- node.writeExternal(out);
- }
- }
-}
\ No newline at end of file
Modified: root/framework/trunk/impl/src/main/java/org/ajax4jsf/context/ContextInitParameters.java
===================================================================
--- root/framework/trunk/impl/src/main/java/org/ajax4jsf/context/ContextInitParameters.java 2009-07-23 17:22:34 UTC (rev 14991)
+++ root/framework/trunk/impl/src/main/java/org/ajax4jsf/context/ContextInitParameters.java 2009-07-23 17:23:34 UTC (rev 14992)
@@ -25,8 +25,6 @@
import javax.faces.context.ExternalContext;
import javax.faces.context.FacesContext;
-import org.ajax4jsf.application.AjaxStateManager;
-
/**
* This class hold all methods for get application init parameters. Created for
* single access point to all parameters - simplest for a documentation.
@@ -44,17 +42,6 @@
// parameters. Do not Instantiate !
}
- public static final String[] SERIALIZE_SERVER_STATE = new String[] {
- "org.ajax4jsf.SERIALIZE_SERVER_STATE",
-
- /* detect MyFaces vs. RI */
- "com.sun.faces.serializeServerState",
- "org.apache.myfaces.SERIALIZE_STATE_IN_SESSION"
- };
-
- public static final String[] NUMBER_OF_VIEWS_IN_SESSION = {"com.sun.faces.numberOfViewsInSession"};
- public static final String[] NUMBER_OF_LOGICAL_VIEWS_IN_SESSION = {"com.sun.faces.numberOfLogicalViews"};
-
/**
* This parameter define where {@link ViewExpiredException} should be handled.
* If is it equals "true" , framework should proparate exception to client-side.
@@ -63,31 +50,7 @@
public static final String[] DATATABLE_USES_VIEW_LOCALE = {"org.richfaces.datatableUsesViewLocale"};
- public static final boolean isSerializeServerState(FacesContext context) {
- return getBoolean(context, SERIALIZE_SERVER_STATE, false);
- }
-
/**
- * Get number of views for store in session by {@link AjaxStateManager}
- * @param context - current faces context.
- * @return
- */
- public static int getNumbersOfViewsInSession(FacesContext context) {
- return getInteger(context, NUMBER_OF_VIEWS_IN_SESSION,
- AjaxStateManager.DEFAULT_NUMBER_OF_VIEWS);
- }
-
- /**
- * Get number of logical views for store in session for every viewId by {@link AjaxStateManager}
- * @param context - current faces context.
- * @return
- */
- public static int getNumbersOfLogicalViews(FacesContext context) {
- return getInteger(context, NUMBER_OF_LOGICAL_VIEWS_IN_SESSION,
- AjaxStateManager.DEFAULT_NUMBER_OF_VIEWS);
- }
-
- /**
* Defines whether data table should use view root locale for sorting and filtering or the
* default platform one
*
Modified: root/framework/trunk/impl/src/main/java/org/ajax4jsf/event/InitPhaseListener.java
===================================================================
--- root/framework/trunk/impl/src/main/java/org/ajax4jsf/event/InitPhaseListener.java 2009-07-23 17:22:34 UTC (rev 14991)
+++ root/framework/trunk/impl/src/main/java/org/ajax4jsf/event/InitPhaseListener.java 2009-07-23 17:23:34 UTC (rev 14992)
@@ -25,7 +25,6 @@
import javax.faces.FactoryFinder;
import javax.faces.application.Application;
-import javax.faces.application.StateManager;
import javax.faces.application.ViewHandler;
import javax.faces.context.FacesContext;
import javax.faces.event.PhaseEvent;
@@ -34,7 +33,6 @@
import javax.faces.lifecycle.Lifecycle;
import javax.faces.lifecycle.LifecycleFactory;
-import org.ajax4jsf.application.AjaxStateManager;
import org.ajax4jsf.application.AjaxViewHandler;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
Deleted: root/framework/trunk/impl/src/main/resources/org/ajax4jsf/webapp/output.properties
===================================================================
--- root/framework/trunk/impl/src/main/resources/org/ajax4jsf/webapp/output.properties 2009-07-23 17:22:34 UTC (rev 14991)
+++ root/framework/trunk/impl/src/main/resources/org/ajax4jsf/webapp/output.properties 2009-07-23 17:23:34 UTC (rev 14992)
@@ -1,4 +0,0 @@
-method = xml
-omit-xml-declaration = no
-doctype-public = -//W3C//DTD XHTML 1.0 Transitional//EN
-doctype-system = http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd
\ No newline at end of file
Modified: root/framework/trunk/impl/src/test/java/org/ajax4jsf/context/InitParametersTest.java
===================================================================
--- root/framework/trunk/impl/src/test/java/org/ajax4jsf/context/InitParametersTest.java 2009-07-23 17:22:34 UTC (rev 14991)
+++ root/framework/trunk/impl/src/test/java/org/ajax4jsf/context/InitParametersTest.java 2009-07-23 17:23:34 UTC (rev 14992)
@@ -5,7 +5,6 @@
import javax.faces.FacesException;
-import org.ajax4jsf.application.AjaxStateManager;
import org.richfaces.test.AbstractFacesTest;
/**
@@ -49,20 +48,6 @@
}
/**
- * Test method for {@link org.ajax4jsf.context.ContextInitParameters#getNumbersOfViewsInSession(javax.faces.context.FacesContext)}.
- */
- public void testGetNumbersOfViewsInSession() {
- assertEquals(AjaxStateManager.DEFAULT_NUMBER_OF_VIEWS, ContextInitParameters.getNumbersOfViewsInSession(facesContext));
- }
-
- /**
- * Test method for {@link org.ajax4jsf.context.ContextInitParameters#getNumbersOfLogicalViews(javax.faces.context.FacesContext)}.
- */
- public void testGetNumbersOfLogicalViews() {
- assertEquals(AjaxStateManager.DEFAULT_NUMBER_OF_VIEWS, ContextInitParameters.getNumbersOfLogicalViews(facesContext));
- }
-
- /**
* Test method for {@link org.ajax4jsf.context.ContextInitParameters#getInteger(javax.faces.context.FacesContext, java.lang.String[], int)}.
*/
public void testGetInteger() {
15 years, 5 months
JBoss Rich Faces SVN: r14991 - in root/framework/trunk/impl/src/main/resources/META-INF: resources and 2 other directories.
by richfaces-svn-commits@lists.jboss.org
Author: nbelaevski
Date: 2009-07-23 13:22:34 -0400 (Thu, 23 Jul 2009)
New Revision: 14991
Added:
root/framework/trunk/impl/src/main/resources/META-INF/resources/
root/framework/trunk/impl/src/main/resources/META-INF/resources/jquery.js/
root/framework/trunk/impl/src/main/resources/META-INF/resources/jquery.js/1_3_2.js
root/framework/trunk/impl/src/main/resources/META-INF/resources/richfaces.js/
root/framework/trunk/impl/src/main/resources/META-INF/resources/richfaces.js/4_0_0.js
Log:
https://jira.jboss.org/jira/browse/RF-7568
Added: root/framework/trunk/impl/src/main/resources/META-INF/resources/jquery.js/1_3_2.js
===================================================================
--- root/framework/trunk/impl/src/main/resources/META-INF/resources/jquery.js/1_3_2.js (rev 0)
+++ root/framework/trunk/impl/src/main/resources/META-INF/resources/jquery.js/1_3_2.js 2009-07-23 17:22:34 UTC (rev 14991)
@@ -0,0 +1,4376 @@
+/*!
+ * jQuery JavaScript Library v1.3.2
+ * http://jquery.com/
+ *
+ * Copyright (c) 2009 John Resig
+ * Dual licensed under the MIT and GPL licenses.
+ * http://docs.jquery.com/License
+ *
+ * Date: 2009-02-19 17:34:21 -0500 (Thu, 19 Feb 2009)
+ * Revision: 6246
+ */
+(function(){
+
+var
+ // Will speed up references to window, and allows munging its name.
+ window = this,
+ // Will speed up references to undefined, and allows munging its name.
+ undefined,
+ // Map over jQuery in case of overwrite
+ _jQuery = window.jQuery,
+ // Map over the $ in case of overwrite
+ _$ = window.$,
+
+ jQuery = window.jQuery = window.$ = function( selector, context ) {
+ // The jQuery object is actually just the init constructor 'enhanced'
+ return new jQuery.fn.init( selector, context );
+ },
+
+ // A simple way to check for HTML strings or ID strings
+ // (both of which we optimize for)
+ quickExpr = /^[^<]*(<(.|\s)+>)[^>]*$|^#([\w-]+)$/,
+ // Is it a simple selector
+ isSimple = /^.[^:#\[\.,]*$/;
+
+jQuery.fn = jQuery.prototype = {
+ init: function( selector, context ) {
+ // Make sure that a selection was provided
+ selector = selector || document;
+
+ // Handle $(DOMElement)
+ if ( selector.nodeType ) {
+ this[0] = selector;
+ this.length = 1;
+ this.context = selector;
+ return this;
+ }
+ // Handle HTML strings
+ if ( typeof selector === "string" ) {
+ // Are we dealing with HTML string or an ID?
+ var match = quickExpr.exec( selector );
+
+ // Verify a match, and that no context was specified for #id
+ if ( match && (match[1] || !context) ) {
+
+ // HANDLE: $(html) -> $(array)
+ if ( match[1] )
+ selector = jQuery.clean( [ match[1] ], context );
+
+ // HANDLE: $("#id")
+ else {
+ var elem = document.getElementById( match[3] );
+
+ // Handle the case where IE and Opera return items
+ // by name instead of ID
+ if ( elem && elem.id != match[3] )
+ return jQuery().find( selector );
+
+ // Otherwise, we inject the element directly into the jQuery object
+ var ret = jQuery( elem || [] );
+ ret.context = document;
+ ret.selector = selector;
+ return ret;
+ }
+
+ // HANDLE: $(expr, [context])
+ // (which is just equivalent to: $(content).find(expr)
+ } else
+ return jQuery( context ).find( selector );
+
+ // HANDLE: $(function)
+ // Shortcut for document ready
+ } else if ( jQuery.isFunction( selector ) )
+ return jQuery( document ).ready( selector );
+
+ // Make sure that old selector state is passed along
+ if ( selector.selector && selector.context ) {
+ this.selector = selector.selector;
+ this.context = selector.context;
+ }
+
+ return this.setArray(jQuery.isArray( selector ) ?
+ selector :
+ jQuery.makeArray(selector));
+ },
+
+ // Start with an empty selector
+ selector: "",
+
+ // The current version of jQuery being used
+ jquery: "1.3.2",
+
+ // The number of elements contained in the matched element set
+ size: function() {
+ return this.length;
+ },
+
+ // Get the Nth element in the matched element set OR
+ // Get the whole matched element set as a clean array
+ get: function( num ) {
+ return num === undefined ?
+
+ // Return a 'clean' array
+ Array.prototype.slice.call( this ) :
+
+ // Return just the object
+ this[ num ];
+ },
+
+ // Take an array of elements and push it onto the stack
+ // (returning the new matched element set)
+ pushStack: function( elems, name, selector ) {
+ // Build a new jQuery matched element set
+ var ret = jQuery( elems );
+
+ // Add the old object onto the stack (as a reference)
+ ret.prevObject = this;
+
+ ret.context = this.context;
+
+ if ( name === "find" )
+ ret.selector = this.selector + (this.selector ? " " : "") + selector;
+ else if ( name )
+ ret.selector = this.selector + "." + name + "(" + selector + ")";
+
+ // Return the newly-formed element set
+ return ret;
+ },
+
+ // Force the current matched set of elements to become
+ // the specified array of elements (destroying the stack in the process)
+ // You should use pushStack() in order to do this, but maintain the stack
+ setArray: function( elems ) {
+ // Resetting the length to 0, then using the native Array push
+ // is a super-fast way to populate an object with array-like properties
+ this.length = 0;
+ Array.prototype.push.apply( this, elems );
+
+ return this;
+ },
+
+ // Execute a callback for every element in the matched set.
+ // (You can seed the arguments with an array of args, but this is
+ // only used internally.)
+ each: function( callback, args ) {
+ return jQuery.each( this, callback, args );
+ },
+
+ // Determine the position of an element within
+ // the matched set of elements
+ index: function( elem ) {
+ // Locate the position of the desired element
+ return jQuery.inArray(
+ // If it receives a jQuery object, the first element is used
+ elem && elem.jquery ? elem[0] : elem
+ , this );
+ },
+
+ attr: function( name, value, type ) {
+ var options = name;
+
+ // Look for the case where we're accessing a style value
+ if ( typeof name === "string" )
+ if ( value === undefined )
+ return this[0] && jQuery[ type || "attr" ]( this[0], name );
+
+ else {
+ options = {};
+ options[ name ] = value;
+ }
+
+ // Check to see if we're setting style values
+ return this.each(function(i){
+ // Set all the styles
+ for ( name in options )
+ jQuery.attr(
+ type ?
+ this.style :
+ this,
+ name, jQuery.prop( this, options[ name ], type, i, name )
+ );
+ });
+ },
+
+ css: function( key, value ) {
+ // ignore negative width and height values
+ if ( (key == 'width' || key == 'height') && parseFloat(value) < 0 )
+ value = undefined;
+ return this.attr( key, value, "curCSS" );
+ },
+
+ text: function( text ) {
+ if ( typeof text !== "object" && text != null )
+ return this.empty().append( (this[0] && this[0].ownerDocument || document).createTextNode( text ) );
+
+ var ret = "";
+
+ jQuery.each( text || this, function(){
+ jQuery.each( this.childNodes, function(){
+ if ( this.nodeType != 8 )
+ ret += this.nodeType != 1 ?
+ this.nodeValue :
+ jQuery.fn.text( [ this ] );
+ });
+ });
+
+ return ret;
+ },
+
+ wrapAll: function( html ) {
+ if ( this[0] ) {
+ // The elements to wrap the target around
+ var wrap = jQuery( html, this[0].ownerDocument ).clone();
+
+ if ( this[0].parentNode )
+ wrap.insertBefore( this[0] );
+
+ wrap.map(function(){
+ var elem = this;
+
+ while ( elem.firstChild )
+ elem = elem.firstChild;
+
+ return elem;
+ }).append(this);
+ }
+
+ return this;
+ },
+
+ wrapInner: function( html ) {
+ return this.each(function(){
+ jQuery( this ).contents().wrapAll( html );
+ });
+ },
+
+ wrap: function( html ) {
+ return this.each(function(){
+ jQuery( this ).wrapAll( html );
+ });
+ },
+
+ append: function() {
+ return this.domManip(arguments, true, function(elem){
+ if (this.nodeType == 1)
+ this.appendChild( elem );
+ });
+ },
+
+ prepend: function() {
+ return this.domManip(arguments, true, function(elem){
+ if (this.nodeType == 1)
+ this.insertBefore( elem, this.firstChild );
+ });
+ },
+
+ before: function() {
+ return this.domManip(arguments, false, function(elem){
+ this.parentNode.insertBefore( elem, this );
+ });
+ },
+
+ after: function() {
+ return this.domManip(arguments, false, function(elem){
+ this.parentNode.insertBefore( elem, this.nextSibling );
+ });
+ },
+
+ end: function() {
+ return this.prevObject || jQuery( [] );
+ },
+
+ // For internal use only.
+ // Behaves like an Array's method, not like a jQuery method.
+ push: [].push,
+ sort: [].sort,
+ splice: [].splice,
+
+ find: function( selector ) {
+ if ( this.length === 1 ) {
+ var ret = this.pushStack( [], "find", selector );
+ ret.length = 0;
+ jQuery.find( selector, this[0], ret );
+ return ret;
+ } else {
+ return this.pushStack( jQuery.unique(jQuery.map(this, function(elem){
+ return jQuery.find( selector, elem );
+ })), "find", selector );
+ }
+ },
+
+ clone: function( events ) {
+ // Do the clone
+ var ret = this.map(function(){
+ if ( !jQuery.support.noCloneEvent && !jQuery.isXMLDoc(this) ) {
+ // IE copies events bound via attachEvent when
+ // using cloneNode. Calling detachEvent on the
+ // clone will also remove the events from the orignal
+ // In order to get around this, we use innerHTML.
+ // Unfortunately, this means some modifications to
+ // attributes in IE that are actually only stored
+ // as properties will not be copied (such as the
+ // the name attribute on an input).
+ var html = this.outerHTML;
+ if ( !html ) {
+ var div = this.ownerDocument.createElement("div");
+ div.appendChild( this.cloneNode(true) );
+ html = div.innerHTML;
+ }
+
+ return jQuery.clean([html.replace(/ jQuery\d+="(?:\d+|null)"/g, "").replace(/^\s*/, "")])[0];
+ } else
+ return this.cloneNode(true);
+ });
+
+ // Copy the events from the original to the clone
+ if ( events === true ) {
+ var orig = this.find("*").andSelf(), i = 0;
+
+ ret.find("*").andSelf().each(function(){
+ if ( this.nodeName !== orig[i].nodeName )
+ return;
+
+ var events = jQuery.data( orig[i], "events" );
+
+ for ( var type in events ) {
+ for ( var handler in events[ type ] ) {
+ jQuery.event.add( this, type, events[ type ][ handler ], events[ type ][ handler ].data );
+ }
+ }
+
+ i++;
+ });
+ }
+
+ // Return the cloned set
+ return ret;
+ },
+
+ filter: function( selector ) {
+ return this.pushStack(
+ jQuery.isFunction( selector ) &&
+ jQuery.grep(this, function(elem, i){
+ return selector.call( elem, i );
+ }) ||
+
+ jQuery.multiFilter( selector, jQuery.grep(this, function(elem){
+ return elem.nodeType === 1;
+ }) ), "filter", selector );
+ },
+
+ closest: function( selector ) {
+ var pos = jQuery.expr.match.POS.test( selector ) ? jQuery(selector) : null,
+ closer = 0;
+
+ return this.map(function(){
+ var cur = this;
+ while ( cur && cur.ownerDocument ) {
+ if ( pos ? pos.index(cur) > -1 : jQuery(cur).is(selector) ) {
+ jQuery.data(cur, "closest", closer);
+ return cur;
+ }
+ cur = cur.parentNode;
+ closer++;
+ }
+ });
+ },
+
+ not: function( selector ) {
+ if ( typeof selector === "string" )
+ // test special case where just one selector is passed in
+ if ( isSimple.test( selector ) )
+ return this.pushStack( jQuery.multiFilter( selector, this, true ), "not", selector );
+ else
+ selector = jQuery.multiFilter( selector, this );
+
+ var isArrayLike = selector.length && selector[selector.length - 1] !== undefined && !selector.nodeType;
+ return this.filter(function() {
+ return isArrayLike ? jQuery.inArray( this, selector ) < 0 : this != selector;
+ });
+ },
+
+ add: function( selector ) {
+ return this.pushStack( jQuery.unique( jQuery.merge(
+ this.get(),
+ typeof selector === "string" ?
+ jQuery( selector ) :
+ jQuery.makeArray( selector )
+ )));
+ },
+
+ is: function( selector ) {
+ return !!selector && jQuery.multiFilter( selector, this ).length > 0;
+ },
+
+ hasClass: function( selector ) {
+ return !!selector && this.is( "." + selector );
+ },
+
+ val: function( value ) {
+ if ( value === undefined ) {
+ var elem = this[0];
+
+ if ( elem ) {
+ if( jQuery.nodeName( elem, 'option' ) )
+ return (elem.attributes.value || {}).specified ? elem.value : elem.text;
+
+ // We need to handle select boxes special
+ if ( jQuery.nodeName( elem, "select" ) ) {
+ var index = elem.selectedIndex,
+ values = [],
+ options = elem.options,
+ one = elem.type == "select-one";
+
+ // Nothing was selected
+ if ( index < 0 )
+ return null;
+
+ // Loop through all the selected options
+ for ( var i = one ? index : 0, max = one ? index + 1 : options.length; i < max; i++ ) {
+ var option = options[ i ];
+
+ if ( option.selected ) {
+ // Get the specifc value for the option
+ value = jQuery(option).val();
+
+ // We don't need an array for one selects
+ if ( one )
+ return value;
+
+ // Multi-Selects return an array
+ values.push( value );
+ }
+ }
+
+ return values;
+ }
+
+ // Everything else, we just grab the value
+ return (elem.value || "").replace(/\r/g, "");
+
+ }
+
+ return undefined;
+ }
+
+ if ( typeof value === "number" )
+ value += '';
+
+ return this.each(function(){
+ if ( this.nodeType != 1 )
+ return;
+
+ if ( jQuery.isArray(value) && /radio|checkbox/.test( this.type ) )
+ this.checked = (jQuery.inArray(this.value, value) >= 0 ||
+ jQuery.inArray(this.name, value) >= 0);
+
+ else if ( jQuery.nodeName( this, "select" ) ) {
+ var values = jQuery.makeArray(value);
+
+ jQuery( "option", this ).each(function(){
+ this.selected = (jQuery.inArray( this.value, values ) >= 0 ||
+ jQuery.inArray( this.text, values ) >= 0);
+ });
+
+ if ( !values.length )
+ this.selectedIndex = -1;
+
+ } else
+ this.value = value;
+ });
+ },
+
+ html: function( value ) {
+ return value === undefined ?
+ (this[0] ?
+ this[0].innerHTML.replace(/ jQuery\d+="(?:\d+|null)"/g, "") :
+ null) :
+ this.empty().append( value );
+ },
+
+ replaceWith: function( value ) {
+ return this.after( value ).remove();
+ },
+
+ eq: function( i ) {
+ return this.slice( i, +i + 1 );
+ },
+
+ slice: function() {
+ return this.pushStack( Array.prototype.slice.apply( this, arguments ),
+ "slice", Array.prototype.slice.call(arguments).join(",") );
+ },
+
+ map: function( callback ) {
+ return this.pushStack( jQuery.map(this, function(elem, i){
+ return callback.call( elem, i, elem );
+ }));
+ },
+
+ andSelf: function() {
+ return this.add( this.prevObject );
+ },
+
+ domManip: function( args, table, callback ) {
+ if ( this[0] ) {
+ var fragment = (this[0].ownerDocument || this[0]).createDocumentFragment(),
+ scripts = jQuery.clean( args, (this[0].ownerDocument || this[0]), fragment ),
+ first = fragment.firstChild;
+
+ if ( first )
+ for ( var i = 0, l = this.length; i < l; i++ )
+ callback.call( root(this[i], first), this.length > 1 || i > 0 ?
+ fragment.cloneNode(true) : fragment );
+
+ if ( scripts )
+ jQuery.each( scripts, evalScript );
+ }
+
+ return this;
+
+ function root( elem, cur ) {
+ return table && jQuery.nodeName(elem, "table") && jQuery.nodeName(cur, "tr") ?
+ (elem.getElementsByTagName("tbody")[0] ||
+ elem.appendChild(elem.ownerDocument.createElement("tbody"))) :
+ elem;
+ }
+ }
+};
+
+// Give the init function the jQuery prototype for later instantiation
+jQuery.fn.init.prototype = jQuery.fn;
+
+function evalScript( i, elem ) {
+ if ( elem.src )
+ jQuery.ajax({
+ url: elem.src,
+ async: false,
+ dataType: "script"
+ });
+
+ else
+ jQuery.globalEval( elem.text || elem.textContent || elem.innerHTML || "" );
+
+ if ( elem.parentNode )
+ elem.parentNode.removeChild( elem );
+}
+
+function now(){
+ return +new Date;
+}
+
+jQuery.extend = jQuery.fn.extend = function() {
+ // copy reference to target object
+ var target = arguments[0] || {}, i = 1, length = arguments.length, deep = false, options;
+
+ // Handle a deep copy situation
+ if ( typeof target === "boolean" ) {
+ deep = target;
+ target = arguments[1] || {};
+ // skip the boolean and the target
+ i = 2;
+ }
+
+ // Handle case when target is a string or something (possible in deep copy)
+ if ( typeof target !== "object" && !jQuery.isFunction(target) )
+ target = {};
+
+ // extend jQuery itself if only one argument is passed
+ if ( length == i ) {
+ target = this;
+ --i;
+ }
+
+ for ( ; i < length; i++ )
+ // Only deal with non-null/undefined values
+ if ( (options = arguments[ i ]) != null )
+ // Extend the base object
+ for ( var name in options ) {
+ var src = target[ name ], copy = options[ name ];
+
+ // Prevent never-ending loop
+ if ( target === copy )
+ continue;
+
+ // Recurse if we're merging object values
+ if ( deep && copy && typeof copy === "object" && !copy.nodeType )
+ target[ name ] = jQuery.extend( deep,
+ // Never move original objects, clone them
+ src || ( copy.length != null ? [ ] : { } )
+ , copy );
+
+ // Don't bring in undefined values
+ else if ( copy !== undefined )
+ target[ name ] = copy;
+
+ }
+
+ // Return the modified object
+ return target;
+};
+
+// exclude the following css properties to add px
+var exclude = /z-?index|font-?weight|opacity|zoom|line-?height/i,
+ // cache defaultView
+ defaultView = document.defaultView || {},
+ toString = Object.prototype.toString;
+
+jQuery.extend({
+ noConflict: function( deep ) {
+ window.$ = _$;
+
+ if ( deep )
+ window.jQuery = _jQuery;
+
+ return jQuery;
+ },
+
+ // See test/unit/core.js for details concerning isFunction.
+ // Since version 1.3, DOM methods and functions like alert
+ // aren't supported. They return false on IE (#2968).
+ isFunction: function( obj ) {
+ return toString.call(obj) === "[object Function]";
+ },
+
+ isArray: function( obj ) {
+ return toString.call(obj) === "[object Array]";
+ },
+
+ // check if an element is in a (or is an) XML document
+ isXMLDoc: function( elem ) {
+ return elem.nodeType === 9 && elem.documentElement.nodeName !== "HTML" ||
+ !!elem.ownerDocument && jQuery.isXMLDoc( elem.ownerDocument );
+ },
+
+ // Evalulates a script in a global context
+ globalEval: function( data ) {
+ if ( data && /\S/.test(data) ) {
+ // Inspired by code by Andrea Giammarchi
+ // http://webreflection.blogspot.com/2007/08/global-scope-evaluation-and-dom...
+ var head = document.getElementsByTagName("head")[0] || document.documentElement,
+ script = document.createElement("script");
+
+ script.type = "text/javascript";
+ if ( jQuery.support.scriptEval )
+ script.appendChild( document.createTextNode( data ) );
+ else
+ script.text = data;
+
+ // Use insertBefore instead of appendChild to circumvent an IE6 bug.
+ // This arises when a base node is used (#2709).
+ head.insertBefore( script, head.firstChild );
+ head.removeChild( script );
+ }
+ },
+
+ nodeName: function( elem, name ) {
+ return elem.nodeName && elem.nodeName.toUpperCase() == name.toUpperCase();
+ },
+
+ // args is for internal usage only
+ each: function( object, callback, args ) {
+ var name, i = 0, length = object.length;
+
+ if ( args ) {
+ if ( length === undefined ) {
+ for ( name in object )
+ if ( callback.apply( object[ name ], args ) === false )
+ break;
+ } else
+ for ( ; i < length; )
+ if ( callback.apply( object[ i++ ], args ) === false )
+ break;
+
+ // A special, fast, case for the most common use of each
+ } else {
+ if ( length === undefined ) {
+ for ( name in object )
+ if ( callback.call( object[ name ], name, object[ name ] ) === false )
+ break;
+ } else
+ for ( var value = object[0];
+ i < length && callback.call( value, i, value ) !== false; value = object[++i] ){}
+ }
+
+ return object;
+ },
+
+ prop: function( elem, value, type, i, name ) {
+ // Handle executable functions
+ if ( jQuery.isFunction( value ) )
+ value = value.call( elem, i );
+
+ // Handle passing in a number to a CSS property
+ return typeof value === "number" && type == "curCSS" && !exclude.test( name ) ?
+ value + "px" :
+ value;
+ },
+
+ className: {
+ // internal only, use addClass("class")
+ add: function( elem, classNames ) {
+ jQuery.each((classNames || "").split(/\s+/), function(i, className){
+ if ( elem.nodeType == 1 && !jQuery.className.has( elem.className, className ) )
+ elem.className += (elem.className ? " " : "") + className;
+ });
+ },
+
+ // internal only, use removeClass("class")
+ remove: function( elem, classNames ) {
+ if (elem.nodeType == 1)
+ elem.className = classNames !== undefined ?
+ jQuery.grep(elem.className.split(/\s+/), function(className){
+ return !jQuery.className.has( classNames, className );
+ }).join(" ") :
+ "";
+ },
+
+ // internal only, use hasClass("class")
+ has: function( elem, className ) {
+ return elem && jQuery.inArray( className, (elem.className || elem).toString().split(/\s+/) ) > -1;
+ }
+ },
+
+ // A method for quickly swapping in/out CSS properties to get correct calculations
+ swap: function( elem, options, callback ) {
+ var old = {};
+ // Remember the old values, and insert the new ones
+ for ( var name in options ) {
+ old[ name ] = elem.style[ name ];
+ elem.style[ name ] = options[ name ];
+ }
+
+ callback.call( elem );
+
+ // Revert the old values
+ for ( var name in options )
+ elem.style[ name ] = old[ name ];
+ },
+
+ css: function( elem, name, force, extra ) {
+ if ( name == "width" || name == "height" ) {
+ var val, props = { position: "absolute", visibility: "hidden", display:"block" }, which = name == "width" ? [ "Left", "Right" ] : [ "Top", "Bottom" ];
+
+ function getWH() {
+ val = name == "width" ? elem.offsetWidth : elem.offsetHeight;
+
+ if ( extra === "border" )
+ return;
+
+ jQuery.each( which, function() {
+ if ( !extra )
+ val -= parseFloat(jQuery.curCSS( elem, "padding" + this, true)) || 0;
+ if ( extra === "margin" )
+ val += parseFloat(jQuery.curCSS( elem, "margin" + this, true)) || 0;
+ else
+ val -= parseFloat(jQuery.curCSS( elem, "border" + this + "Width", true)) || 0;
+ });
+ }
+
+ if ( elem.offsetWidth !== 0 )
+ getWH();
+ else
+ jQuery.swap( elem, props, getWH );
+
+ return Math.max(0, Math.round(val));
+ }
+
+ return jQuery.curCSS( elem, name, force );
+ },
+
+ curCSS: function( elem, name, force ) {
+ var ret, style = elem.style;
+
+ // We need to handle opacity special in IE
+ if ( name == "opacity" && !jQuery.support.opacity ) {
+ ret = jQuery.attr( style, "opacity" );
+
+ return ret == "" ?
+ "1" :
+ ret;
+ }
+
+ // Make sure we're using the right name for getting the float value
+ if ( name.match( /float/i ) )
+ name = styleFloat;
+
+ if ( !force && style && style[ name ] )
+ ret = style[ name ];
+
+ else if ( defaultView.getComputedStyle ) {
+
+ // Only "float" is needed here
+ if ( name.match( /float/i ) )
+ name = "float";
+
+ name = name.replace( /([A-Z])/g, "-$1" ).toLowerCase();
+
+ var computedStyle = defaultView.getComputedStyle( elem, null );
+
+ if ( computedStyle )
+ ret = computedStyle.getPropertyValue( name );
+
+ // We should always get a number back from opacity
+ if ( name == "opacity" && ret == "" )
+ ret = "1";
+
+ } else if ( elem.currentStyle ) {
+ var camelCase = name.replace(/\-(\w)/g, function(all, letter){
+ return letter.toUpperCase();
+ });
+
+ ret = elem.currentStyle[ name ] || elem.currentStyle[ camelCase ];
+
+ // From the awesome hack by Dean Edwards
+ // http://erik.eae.net/archives/2007/07/27/18.54.15/#comment-102291
+
+ // If we're not dealing with a regular pixel number
+ // but a number that has a weird ending, we need to convert it to pixels
+ if ( !/^\d+(px)?$/i.test( ret ) && /^\d/.test( ret ) ) {
+ // Remember the original values
+ var left = style.left, rsLeft = elem.runtimeStyle.left;
+
+ // Put in the new values to get a computed value out
+ elem.runtimeStyle.left = elem.currentStyle.left;
+ style.left = ret || 0;
+ ret = style.pixelLeft + "px";
+
+ // Revert the changed values
+ style.left = left;
+ elem.runtimeStyle.left = rsLeft;
+ }
+ }
+
+ return ret;
+ },
+
+ clean: function( elems, context, fragment ) {
+ context = context || document;
+
+ // !context.createElement fails in IE with an error but returns typeof 'object'
+ if ( typeof context.createElement === "undefined" )
+ context = context.ownerDocument || context[0] && context[0].ownerDocument || document;
+
+ // If a single string is passed in and it's a single tag
+ // just do a createElement and skip the rest
+ if ( !fragment && elems.length === 1 && typeof elems[0] === "string" ) {
+ var match = /^<(\w+)\s*\/?>$/.exec(elems[0]);
+ if ( match )
+ return [ context.createElement( match[1] ) ];
+ }
+
+ var ret = [], scripts = [], div = context.createElement("div");
+
+ jQuery.each(elems, function(i, elem){
+ if ( typeof elem === "number" )
+ elem += '';
+
+ if ( !elem )
+ return;
+
+ // Convert html string into DOM nodes
+ if ( typeof elem === "string" ) {
+ // Fix "XHTML"-style tags in all browsers
+ elem = elem.replace(/(<(\w+)[^>]*?)\/>/g, function(all, front, tag){
+ return tag.match(/^(abbr|br|col|img|input|link|meta|param|hr|area|embed)$/i) ?
+ all :
+ front + "></" + tag + ">";
+ });
+
+ // Trim whitespace, otherwise indexOf won't work as expected
+ var tags = elem.replace(/^\s+/, "").substring(0, 10).toLowerCase();
+
+ var wrap =
+ // option or optgroup
+ !tags.indexOf("<opt") &&
+ [ 1, "<select multiple='multiple'>", "</select>" ] ||
+
+ !tags.indexOf("<leg") &&
+ [ 1, "<fieldset>", "</fieldset>" ] ||
+
+ tags.match(/^<(thead|tbody|tfoot|colg|cap)/) &&
+ [ 1, "<table>", "</table>" ] ||
+
+ !tags.indexOf("<tr") &&
+ [ 2, "<table><tbody>", "</tbody></table>" ] ||
+
+ // <thead> matched above
+ (!tags.indexOf("<td") || !tags.indexOf("<th")) &&
+ [ 3, "<table><tbody><tr>", "</tr></tbody></table>" ] ||
+
+ !tags.indexOf("<col") &&
+ [ 2, "<table><tbody></tbody><colgroup>", "</colgroup></table>" ] ||
+
+ // IE can't serialize <link> and <script> tags normally
+ !jQuery.support.htmlSerialize &&
+ [ 1, "div<div>", "</div>" ] ||
+
+ [ 0, "", "" ];
+
+ // Go to html and back, then peel off extra wrappers
+ div.innerHTML = wrap[1] + elem + wrap[2];
+
+ // Move to the right depth
+ while ( wrap[0]-- )
+ div = div.lastChild;
+
+ // Remove IE's autoinserted <tbody> from table fragments
+ if ( !jQuery.support.tbody ) {
+
+ // String was a <table>, *may* have spurious <tbody>
+ var hasBody = /<tbody/i.test(elem),
+ tbody = !tags.indexOf("<table") && !hasBody ?
+ div.firstChild && div.firstChild.childNodes :
+
+ // String was a bare <thead> or <tfoot>
+ wrap[1] == "<table>" && !hasBody ?
+ div.childNodes :
+ [];
+
+ for ( var j = tbody.length - 1; j >= 0 ; --j )
+ if ( jQuery.nodeName( tbody[ j ], "tbody" ) && !tbody[ j ].childNodes.length )
+ tbody[ j ].parentNode.removeChild( tbody[ j ] );
+
+ }
+
+ // IE completely kills leading whitespace when innerHTML is used
+ if ( !jQuery.support.leadingWhitespace && /^\s/.test( elem ) )
+ div.insertBefore( context.createTextNode( elem.match(/^\s*/)[0] ), div.firstChild );
+
+ elem = jQuery.makeArray( div.childNodes );
+ }
+
+ if ( elem.nodeType )
+ ret.push( elem );
+ else
+ ret = jQuery.merge( ret, elem );
+
+ });
+
+ if ( fragment ) {
+ for ( var i = 0; ret[i]; i++ ) {
+ if ( jQuery.nodeName( ret[i], "script" ) && (!ret[i].type || ret[i].type.toLowerCase() === "text/javascript") ) {
+ scripts.push( ret[i].parentNode ? ret[i].parentNode.removeChild( ret[i] ) : ret[i] );
+ } else {
+ if ( ret[i].nodeType === 1 )
+ ret.splice.apply( ret, [i + 1, 0].concat(jQuery.makeArray(ret[i].getElementsByTagName("script"))) );
+ fragment.appendChild( ret[i] );
+ }
+ }
+
+ return scripts;
+ }
+
+ return ret;
+ },
+
+ attr: function( elem, name, value ) {
+ // don't set attributes on text and comment nodes
+ if (!elem || elem.nodeType == 3 || elem.nodeType == 8)
+ return undefined;
+
+ var notxml = !jQuery.isXMLDoc( elem ),
+ // Whether we are setting (or getting)
+ set = value !== undefined;
+
+ // Try to normalize/fix the name
+ name = notxml && jQuery.props[ name ] || name;
+
+ // Only do all the following if this is a node (faster for style)
+ // IE elem.getAttribute passes even for style
+ if ( elem.tagName ) {
+
+ // These attributes require special treatment
+ var special = /href|src|style/.test( name );
+
+ // Safari mis-reports the default selected property of a hidden option
+ // Accessing the parent's selectedIndex property fixes it
+ if ( name == "selected" && elem.parentNode )
+ elem.parentNode.selectedIndex;
+
+ // If applicable, access the attribute via the DOM 0 way
+ if ( name in elem && notxml && !special ) {
+ if ( set ){
+ // We can't allow the type property to be changed (since it causes problems in IE)
+ if ( name == "type" && jQuery.nodeName( elem, "input" ) && elem.parentNode )
+ throw "type property can't be changed";
+
+ elem[ name ] = value;
+ }
+
+ // browsers index elements by id/name on forms, give priority to attributes.
+ if( jQuery.nodeName( elem, "form" ) && elem.getAttributeNode(name) )
+ return elem.getAttributeNode( name ).nodeValue;
+
+ // elem.tabIndex doesn't always return the correct value when it hasn't been explicitly set
+ // http://fluidproject.org/blog/2008/01/09/getting-setting-and-removing-tabi...
+ if ( name == "tabIndex" ) {
+ var attributeNode = elem.getAttributeNode( "tabIndex" );
+ return attributeNode && attributeNode.specified
+ ? attributeNode.value
+ : elem.nodeName.match(/(button|input|object|select|textarea)/i)
+ ? 0
+ : elem.nodeName.match(/^(a|area)$/i) && elem.href
+ ? 0
+ : undefined;
+ }
+
+ return elem[ name ];
+ }
+
+ if ( !jQuery.support.style && notxml && name == "style" )
+ return jQuery.attr( elem.style, "cssText", value );
+
+ if ( set )
+ // convert the value to a string (all browsers do this but IE) see #1070
+ elem.setAttribute( name, "" + value );
+
+ var attr = !jQuery.support.hrefNormalized && notxml && special
+ // Some attributes require a special call on IE
+ ? elem.getAttribute( name, 2 )
+ : elem.getAttribute( name );
+
+ // Non-existent attributes return null, we normalize to undefined
+ return attr === null ? undefined : attr;
+ }
+
+ // elem is actually elem.style ... set the style
+
+ // IE uses filters for opacity
+ if ( !jQuery.support.opacity && name == "opacity" ) {
+ if ( set ) {
+ // IE has trouble with opacity if it does not have layout
+ // Force it by setting the zoom level
+ elem.zoom = 1;
+
+ // Set the alpha filter to set the opacity
+ elem.filter = (elem.filter || "").replace( /alpha\([^)]*\)/, "" ) +
+ (parseInt( value ) + '' == "NaN" ? "" : "alpha(opacity=" + value * 100 + ")");
+ }
+
+ return elem.filter && elem.filter.indexOf("opacity=") >= 0 ?
+ (parseFloat( elem.filter.match(/opacity=([^)]*)/)[1] ) / 100) + '':
+ "";
+ }
+
+ name = name.replace(/-([a-z])/ig, function(all, letter){
+ return letter.toUpperCase();
+ });
+
+ if ( set )
+ elem[ name ] = value;
+
+ return elem[ name ];
+ },
+
+ trim: function( text ) {
+ return (text || "").replace( /^\s+|\s+$/g, "" );
+ },
+
+ makeArray: function( array ) {
+ var ret = [];
+
+ if( array != null ){
+ var i = array.length;
+ // The window, strings (and functions) also have 'length'
+ if( i == null || typeof array === "string" || jQuery.isFunction(array) || array.setInterval )
+ ret[0] = array;
+ else
+ while( i )
+ ret[--i] = array[i];
+ }
+
+ return ret;
+ },
+
+ inArray: function( elem, array ) {
+ for ( var i = 0, length = array.length; i < length; i++ )
+ // Use === because on IE, window == document
+ if ( array[ i ] === elem )
+ return i;
+
+ return -1;
+ },
+
+ merge: function( first, second ) {
+ // We have to loop this way because IE & Opera overwrite the length
+ // expando of getElementsByTagName
+ var i = 0, elem, pos = first.length;
+ // Also, we need to make sure that the correct elements are being returned
+ // (IE returns comment nodes in a '*' query)
+ if ( !jQuery.support.getAll ) {
+ while ( (elem = second[ i++ ]) != null )
+ if ( elem.nodeType != 8 )
+ first[ pos++ ] = elem;
+
+ } else
+ while ( (elem = second[ i++ ]) != null )
+ first[ pos++ ] = elem;
+
+ return first;
+ },
+
+ unique: function( array ) {
+ var ret = [], done = {};
+
+ try {
+
+ for ( var i = 0, length = array.length; i < length; i++ ) {
+ var id = jQuery.data( array[ i ] );
+
+ if ( !done[ id ] ) {
+ done[ id ] = true;
+ ret.push( array[ i ] );
+ }
+ }
+
+ } catch( e ) {
+ ret = array;
+ }
+
+ return ret;
+ },
+
+ grep: function( elems, callback, inv ) {
+ var ret = [];
+
+ // Go through the array, only saving the items
+ // that pass the validator function
+ for ( var i = 0, length = elems.length; i < length; i++ )
+ if ( !inv != !callback( elems[ i ], i ) )
+ ret.push( elems[ i ] );
+
+ return ret;
+ },
+
+ map: function( elems, callback ) {
+ var ret = [];
+
+ // Go through the array, translating each of the items to their
+ // new value (or values).
+ for ( var i = 0, length = elems.length; i < length; i++ ) {
+ var value = callback( elems[ i ], i );
+
+ if ( value != null )
+ ret[ ret.length ] = value;
+ }
+
+ return ret.concat.apply( [], ret );
+ }
+});
+
+// Use of jQuery.browser is deprecated.
+// It's included for backwards compatibility and plugins,
+// although they should work to migrate away.
+
+var userAgent = navigator.userAgent.toLowerCase();
+
+// Figure out what browser is being used
+jQuery.browser = {
+ version: (userAgent.match( /.+(?:rv|it|ra|ie)[\/: ]([\d.]+)/ ) || [0,'0'])[1],
+ safari: /webkit/.test( userAgent ),
+ opera: /opera/.test( userAgent ),
+ msie: /msie/.test( userAgent ) && !/opera/.test( userAgent ),
+ mozilla: /mozilla/.test( userAgent ) && !/(compatible|webkit)/.test( userAgent )
+};
+
+jQuery.each({
+ parent: function(elem){return elem.parentNode;},
+ parents: function(elem){return jQuery.dir(elem,"parentNode");},
+ next: function(elem){return jQuery.nth(elem,2,"nextSibling");},
+ prev: function(elem){return jQuery.nth(elem,2,"previousSibling");},
+ nextAll: function(elem){return jQuery.dir(elem,"nextSibling");},
+ prevAll: function(elem){return jQuery.dir(elem,"previousSibling");},
+ siblings: function(elem){return jQuery.sibling(elem.parentNode.firstChild,elem);},
+ children: function(elem){return jQuery.sibling(elem.firstChild);},
+ contents: function(elem){return jQuery.nodeName(elem,"iframe")?elem.contentDocument||elem.contentWindow.document:jQuery.makeArray(elem.childNodes);}
+}, function(name, fn){
+ jQuery.fn[ name ] = function( selector ) {
+ var ret = jQuery.map( this, fn );
+
+ if ( selector && typeof selector == "string" )
+ ret = jQuery.multiFilter( selector, ret );
+
+ return this.pushStack( jQuery.unique( ret ), name, selector );
+ };
+});
+
+jQuery.each({
+ appendTo: "append",
+ prependTo: "prepend",
+ insertBefore: "before",
+ insertAfter: "after",
+ replaceAll: "replaceWith"
+}, function(name, original){
+ jQuery.fn[ name ] = function( selector ) {
+ var ret = [], insert = jQuery( selector );
+
+ for ( var i = 0, l = insert.length; i < l; i++ ) {
+ var elems = (i > 0 ? this.clone(true) : this).get();
+ jQuery.fn[ original ].apply( jQuery(insert[i]), elems );
+ ret = ret.concat( elems );
+ }
+
+ return this.pushStack( ret, name, selector );
+ };
+});
+
+jQuery.each({
+ removeAttr: function( name ) {
+ jQuery.attr( this, name, "" );
+ if (this.nodeType == 1)
+ this.removeAttribute( name );
+ },
+
+ addClass: function( classNames ) {
+ jQuery.className.add( this, classNames );
+ },
+
+ removeClass: function( classNames ) {
+ jQuery.className.remove( this, classNames );
+ },
+
+ toggleClass: function( classNames, state ) {
+ if( typeof state !== "boolean" )
+ state = !jQuery.className.has( this, classNames );
+ jQuery.className[ state ? "add" : "remove" ]( this, classNames );
+ },
+
+ remove: function( selector ) {
+ if ( !selector || jQuery.filter( selector, [ this ] ).length ) {
+ // Prevent memory leaks
+ jQuery( "*", this ).add([this]).each(function(){
+ jQuery.event.remove(this);
+ jQuery.removeData(this);
+ });
+ if (this.parentNode)
+ this.parentNode.removeChild( this );
+ }
+ },
+
+ empty: function() {
+ // Remove element nodes and prevent memory leaks
+ jQuery(this).children().remove();
+
+ // Remove any remaining nodes
+ while ( this.firstChild )
+ this.removeChild( this.firstChild );
+ }
+}, function(name, fn){
+ jQuery.fn[ name ] = function(){
+ return this.each( fn, arguments );
+ };
+});
+
+// Helper function used by the dimensions and offset modules
+function num(elem, prop) {
+ return elem[0] && parseInt( jQuery.curCSS(elem[0], prop, true), 10 ) || 0;
+}
+var expando = "jQuery" + now(), uuid = 0, windowData = {};
+
+jQuery.extend({
+ cache: {},
+
+ data: function( elem, name, data ) {
+ elem = elem == window ?
+ windowData :
+ elem;
+
+ var id = elem[ expando ];
+
+ // Compute a unique ID for the element
+ if ( !id )
+ id = elem[ expando ] = ++uuid;
+
+ // Only generate the data cache if we're
+ // trying to access or manipulate it
+ if ( name && !jQuery.cache[ id ] )
+ jQuery.cache[ id ] = {};
+
+ // Prevent overriding the named cache with undefined values
+ if ( data !== undefined )
+ jQuery.cache[ id ][ name ] = data;
+
+ // Return the named cache data, or the ID for the element
+ return name ?
+ jQuery.cache[ id ][ name ] :
+ id;
+ },
+
+ removeData: function( elem, name ) {
+ elem = elem == window ?
+ windowData :
+ elem;
+
+ var id = elem[ expando ];
+
+ // If we want to remove a specific section of the element's data
+ if ( name ) {
+ if ( jQuery.cache[ id ] ) {
+ // Remove the section of cache data
+ delete jQuery.cache[ id ][ name ];
+
+ // If we've removed all the data, remove the element's cache
+ name = "";
+
+ for ( name in jQuery.cache[ id ] )
+ break;
+
+ if ( !name )
+ jQuery.removeData( elem );
+ }
+
+ // Otherwise, we want to remove all of the element's data
+ } else {
+ // Clean up the element expando
+ try {
+ delete elem[ expando ];
+ } catch(e){
+ // IE has trouble directly removing the expando
+ // but it's ok with using removeAttribute
+ if ( elem.removeAttribute )
+ elem.removeAttribute( expando );
+ }
+
+ // Completely remove the data cache
+ delete jQuery.cache[ id ];
+ }
+ },
+ queue: function( elem, type, data ) {
+ if ( elem ){
+
+ type = (type || "fx") + "queue";
+
+ var q = jQuery.data( elem, type );
+
+ if ( !q || jQuery.isArray(data) )
+ q = jQuery.data( elem, type, jQuery.makeArray(data) );
+ else if( data )
+ q.push( data );
+
+ }
+ return q;
+ },
+
+ dequeue: function( elem, type ){
+ var queue = jQuery.queue( elem, type ),
+ fn = queue.shift();
+
+ if( !type || type === "fx" )
+ fn = queue[0];
+
+ if( fn !== undefined )
+ fn.call(elem);
+ }
+});
+
+jQuery.fn.extend({
+ data: function( key, value ){
+ var parts = key.split(".");
+ parts[1] = parts[1] ? "." + parts[1] : "";
+
+ if ( value === undefined ) {
+ var data = this.triggerHandler("getData" + parts[1] + "!", [parts[0]]);
+
+ if ( data === undefined && this.length )
+ data = jQuery.data( this[0], key );
+
+ return data === undefined && parts[1] ?
+ this.data( parts[0] ) :
+ data;
+ } else
+ return this.trigger("setData" + parts[1] + "!", [parts[0], value]).each(function(){
+ jQuery.data( this, key, value );
+ });
+ },
+
+ removeData: function( key ){
+ return this.each(function(){
+ jQuery.removeData( this, key );
+ });
+ },
+ queue: function(type, data){
+ if ( typeof type !== "string" ) {
+ data = type;
+ type = "fx";
+ }
+
+ if ( data === undefined )
+ return jQuery.queue( this[0], type );
+
+ return this.each(function(){
+ var queue = jQuery.queue( this, type, data );
+
+ if( type == "fx" && queue.length == 1 )
+ queue[0].call(this);
+ });
+ },
+ dequeue: function(type){
+ return this.each(function(){
+ jQuery.dequeue( this, type );
+ });
+ }
+});/*!
+ * Sizzle CSS Selector Engine - v0.9.3
+ * Copyright 2009, The Dojo Foundation
+ * Released under the MIT, BSD, and GPL Licenses.
+ * More information: http://sizzlejs.com/
+ */
+(function(){
+
+var chunker = /((?:\((?:\([^()]+\)|[^()]+)+\)|\[(?:\[[^[\]]*\]|['"][^'"]*['"]|[^[\]'"]+)+\]|\\.|[^ >+~,(\[\\]+)+|[>+~])(\s*,\s*)?/g,
+ done = 0,
+ toString = Object.prototype.toString;
+
+var Sizzle = function(selector, context, results, seed) {
+ results = results || [];
+ context = context || document;
+
+ if ( context.nodeType !== 1 && context.nodeType !== 9 )
+ return [];
+
+ if ( !selector || typeof selector !== "string" ) {
+ return results;
+ }
+
+ var parts = [], m, set, checkSet, check, mode, extra, prune = true;
+
+ // Reset the position of the chunker regexp (start from head)
+ chunker.lastIndex = 0;
+
+ while ( (m = chunker.exec(selector)) !== null ) {
+ parts.push( m[1] );
+
+ if ( m[2] ) {
+ extra = RegExp.rightContext;
+ break;
+ }
+ }
+
+ if ( parts.length > 1 && origPOS.exec( selector ) ) {
+ if ( parts.length === 2 && Expr.relative[ parts[0] ] ) {
+ set = posProcess( parts[0] + parts[1], context );
+ } else {
+ set = Expr.relative[ parts[0] ] ?
+ [ context ] :
+ Sizzle( parts.shift(), context );
+
+ while ( parts.length ) {
+ selector = parts.shift();
+
+ if ( Expr.relative[ selector ] )
+ selector += parts.shift();
+
+ set = posProcess( selector, set );
+ }
+ }
+ } else {
+ var ret = seed ?
+ { expr: parts.pop(), set: makeArray(seed) } :
+ Sizzle.find( parts.pop(), parts.length === 1 && context.parentNode ? context.parentNode : context, isXML(context) );
+ set = Sizzle.filter( ret.expr, ret.set );
+
+ if ( parts.length > 0 ) {
+ checkSet = makeArray(set);
+ } else {
+ prune = false;
+ }
+
+ while ( parts.length ) {
+ var cur = parts.pop(), pop = cur;
+
+ if ( !Expr.relative[ cur ] ) {
+ cur = "";
+ } else {
+ pop = parts.pop();
+ }
+
+ if ( pop == null ) {
+ pop = context;
+ }
+
+ Expr.relative[ cur ]( checkSet, pop, isXML(context) );
+ }
+ }
+
+ if ( !checkSet ) {
+ checkSet = set;
+ }
+
+ if ( !checkSet ) {
+ throw "Syntax error, unrecognized expression: " + (cur || selector);
+ }
+
+ if ( toString.call(checkSet) === "[object Array]" ) {
+ if ( !prune ) {
+ results.push.apply( results, checkSet );
+ } else if ( context.nodeType === 1 ) {
+ for ( var i = 0; checkSet[i] != null; i++ ) {
+ if ( checkSet[i] && (checkSet[i] === true || checkSet[i].nodeType === 1 && contains(context, checkSet[i])) ) {
+ results.push( set[i] );
+ }
+ }
+ } else {
+ for ( var i = 0; checkSet[i] != null; i++ ) {
+ if ( checkSet[i] && checkSet[i].nodeType === 1 ) {
+ results.push( set[i] );
+ }
+ }
+ }
+ } else {
+ makeArray( checkSet, results );
+ }
+
+ if ( extra ) {
+ Sizzle( extra, context, results, seed );
+
+ if ( sortOrder ) {
+ hasDuplicate = false;
+ results.sort(sortOrder);
+
+ if ( hasDuplicate ) {
+ for ( var i = 1; i < results.length; i++ ) {
+ if ( results[i] === results[i-1] ) {
+ results.splice(i--, 1);
+ }
+ }
+ }
+ }
+ }
+
+ return results;
+};
+
+Sizzle.matches = function(expr, set){
+ return Sizzle(expr, null, null, set);
+};
+
+Sizzle.find = function(expr, context, isXML){
+ var set, match;
+
+ if ( !expr ) {
+ return [];
+ }
+
+ for ( var i = 0, l = Expr.order.length; i < l; i++ ) {
+ var type = Expr.order[i], match;
+
+ if ( (match = Expr.match[ type ].exec( expr )) ) {
+ var left = RegExp.leftContext;
+
+ if ( left.substr( left.length - 1 ) !== "\\" ) {
+ match[1] = (match[1] || "").replace(/\\/g, "");
+ set = Expr.find[ type ]( match, context, isXML );
+ if ( set != null ) {
+ expr = expr.replace( Expr.match[ type ], "" );
+ break;
+ }
+ }
+ }
+ }
+
+ if ( !set ) {
+ set = context.getElementsByTagName("*");
+ }
+
+ return {set: set, expr: expr};
+};
+
+Sizzle.filter = function(expr, set, inplace, not){
+ var old = expr, result = [], curLoop = set, match, anyFound,
+ isXMLFilter = set && set[0] && isXML(set[0]);
+
+ while ( expr && set.length ) {
+ for ( var type in Expr.filter ) {
+ if ( (match = Expr.match[ type ].exec( expr )) != null ) {
+ var filter = Expr.filter[ type ], found, item;
+ anyFound = false;
+
+ if ( curLoop == result ) {
+ result = [];
+ }
+
+ if ( Expr.preFilter[ type ] ) {
+ match = Expr.preFilter[ type ]( match, curLoop, inplace, result, not, isXMLFilter );
+
+ if ( !match ) {
+ anyFound = found = true;
+ } else if ( match === true ) {
+ continue;
+ }
+ }
+
+ if ( match ) {
+ for ( var i = 0; (item = curLoop[i]) != null; i++ ) {
+ if ( item ) {
+ found = filter( item, match, i, curLoop );
+ var pass = not ^ !!found;
+
+ if ( inplace && found != null ) {
+ if ( pass ) {
+ anyFound = true;
+ } else {
+ curLoop[i] = false;
+ }
+ } else if ( pass ) {
+ result.push( item );
+ anyFound = true;
+ }
+ }
+ }
+ }
+
+ if ( found !== undefined ) {
+ if ( !inplace ) {
+ curLoop = result;
+ }
+
+ expr = expr.replace( Expr.match[ type ], "" );
+
+ if ( !anyFound ) {
+ return [];
+ }
+
+ break;
+ }
+ }
+ }
+
+ // Improper expression
+ if ( expr == old ) {
+ if ( anyFound == null ) {
+ throw "Syntax error, unrecognized expression: " + expr;
+ } else {
+ break;
+ }
+ }
+
+ old = expr;
+ }
+
+ return curLoop;
+};
+
+var Expr = Sizzle.selectors = {
+ order: [ "ID", "NAME", "TAG" ],
+ match: {
+ ID: /#((?:[\w\u00c0-\uFFFF_-]|\\.)+)/,
+ CLASS: /\.((?:[\w\u00c0-\uFFFF_-]|\\.)+)/,
+ NAME: /\[name=['"]*((?:[\w\u00c0-\uFFFF_-]|\\.)+)['"]*\]/,
+ ATTR: /\[\s*((?:[\w\u00c0-\uFFFF_-]|\\.)+)\s*(?:(\S?=)\s*(['"]*)(.*?)\3|)\s*\]/,
+ TAG: /^((?:[\w\u00c0-\uFFFF\*_-]|\\.)+)/,
+ CHILD: /:(only|nth|last|first)-child(?:\((even|odd|[\dn+-]*)\))?/,
+ POS: /:(nth|eq|gt|lt|first|last|even|odd)(?:\((\d*)\))?(?=[^-]|$)/,
+ PSEUDO: /:((?:[\w\u00c0-\uFFFF_-]|\\.)+)(?:\((['"]*)((?:\([^\)]+\)|[^\2\(\)]*)+)\2\))?/
+ },
+ attrMap: {
+ "class": "className",
+ "for": "htmlFor"
+ },
+ attrHandle: {
+ href: function(elem){
+ return elem.getAttribute("href");
+ }
+ },
+ relative: {
+ "+": function(checkSet, part, isXML){
+ var isPartStr = typeof part === "string",
+ isTag = isPartStr && !/\W/.test(part),
+ isPartStrNotTag = isPartStr && !isTag;
+
+ if ( isTag && !isXML ) {
+ part = part.toUpperCase();
+ }
+
+ for ( var i = 0, l = checkSet.length, elem; i < l; i++ ) {
+ if ( (elem = checkSet[i]) ) {
+ while ( (elem = elem.previousSibling) && elem.nodeType !== 1 ) {}
+
+ checkSet[i] = isPartStrNotTag || elem && elem.nodeName === part ?
+ elem || false :
+ elem === part;
+ }
+ }
+
+ if ( isPartStrNotTag ) {
+ Sizzle.filter( part, checkSet, true );
+ }
+ },
+ ">": function(checkSet, part, isXML){
+ var isPartStr = typeof part === "string";
+
+ if ( isPartStr && !/\W/.test(part) ) {
+ part = isXML ? part : part.toUpperCase();
+
+ for ( var i = 0, l = checkSet.length; i < l; i++ ) {
+ var elem = checkSet[i];
+ if ( elem ) {
+ var parent = elem.parentNode;
+ checkSet[i] = parent.nodeName === part ? parent : false;
+ }
+ }
+ } else {
+ for ( var i = 0, l = checkSet.length; i < l; i++ ) {
+ var elem = checkSet[i];
+ if ( elem ) {
+ checkSet[i] = isPartStr ?
+ elem.parentNode :
+ elem.parentNode === part;
+ }
+ }
+
+ if ( isPartStr ) {
+ Sizzle.filter( part, checkSet, true );
+ }
+ }
+ },
+ "": function(checkSet, part, isXML){
+ var doneName = done++, checkFn = dirCheck;
+
+ if ( !part.match(/\W/) ) {
+ var nodeCheck = part = isXML ? part : part.toUpperCase();
+ checkFn = dirNodeCheck;
+ }
+
+ checkFn("parentNode", part, doneName, checkSet, nodeCheck, isXML);
+ },
+ "~": function(checkSet, part, isXML){
+ var doneName = done++, checkFn = dirCheck;
+
+ if ( typeof part === "string" && !part.match(/\W/) ) {
+ var nodeCheck = part = isXML ? part : part.toUpperCase();
+ checkFn = dirNodeCheck;
+ }
+
+ checkFn("previousSibling", part, doneName, checkSet, nodeCheck, isXML);
+ }
+ },
+ find: {
+ ID: function(match, context, isXML){
+ if ( typeof context.getElementById !== "undefined" && !isXML ) {
+ var m = context.getElementById(match[1]);
+ return m ? [m] : [];
+ }
+ },
+ NAME: function(match, context, isXML){
+ if ( typeof context.getElementsByName !== "undefined" ) {
+ var ret = [], results = context.getElementsByName(match[1]);
+
+ for ( var i = 0, l = results.length; i < l; i++ ) {
+ if ( results[i].getAttribute("name") === match[1] ) {
+ ret.push( results[i] );
+ }
+ }
+
+ return ret.length === 0 ? null : ret;
+ }
+ },
+ TAG: function(match, context){
+ return context.getElementsByTagName(match[1]);
+ }
+ },
+ preFilter: {
+ CLASS: function(match, curLoop, inplace, result, not, isXML){
+ match = " " + match[1].replace(/\\/g, "") + " ";
+
+ if ( isXML ) {
+ return match;
+ }
+
+ for ( var i = 0, elem; (elem = curLoop[i]) != null; i++ ) {
+ if ( elem ) {
+ if ( not ^ (elem.className && (" " + elem.className + " ").indexOf(match) >= 0) ) {
+ if ( !inplace )
+ result.push( elem );
+ } else if ( inplace ) {
+ curLoop[i] = false;
+ }
+ }
+ }
+
+ return false;
+ },
+ ID: function(match){
+ return match[1].replace(/\\/g, "");
+ },
+ TAG: function(match, curLoop){
+ for ( var i = 0; curLoop[i] === false; i++ ){}
+ return curLoop[i] && isXML(curLoop[i]) ? match[1] : match[1].toUpperCase();
+ },
+ CHILD: function(match){
+ if ( match[1] == "nth" ) {
+ // parse equations like 'even', 'odd', '5', '2n', '3n+2', '4n-1', '-n+6'
+ var test = /(-?)(\d*)n((?:\+|-)?\d*)/.exec(
+ match[2] == "even" && "2n" || match[2] == "odd" && "2n+1" ||
+ !/\D/.test( match[2] ) && "0n+" + match[2] || match[2]);
+
+ // calculate the numbers (first)n+(last) including if they are negative
+ match[2] = (test[1] + (test[2] || 1)) - 0;
+ match[3] = test[3] - 0;
+ }
+
+ // TODO: Move to normal caching system
+ match[0] = done++;
+
+ return match;
+ },
+ ATTR: function(match, curLoop, inplace, result, not, isXML){
+ var name = match[1].replace(/\\/g, "");
+
+ if ( !isXML && Expr.attrMap[name] ) {
+ match[1] = Expr.attrMap[name];
+ }
+
+ if ( match[2] === "~=" ) {
+ match[4] = " " + match[4] + " ";
+ }
+
+ return match;
+ },
+ PSEUDO: function(match, curLoop, inplace, result, not){
+ if ( match[1] === "not" ) {
+ // If we're dealing with a complex expression, or a simple one
+ if ( match[3].match(chunker).length > 1 || /^\w/.test(match[3]) ) {
+ match[3] = Sizzle(match[3], null, null, curLoop);
+ } else {
+ var ret = Sizzle.filter(match[3], curLoop, inplace, true ^ not);
+ if ( !inplace ) {
+ result.push.apply( result, ret );
+ }
+ return false;
+ }
+ } else if ( Expr.match.POS.test( match[0] ) || Expr.match.CHILD.test( match[0] ) ) {
+ return true;
+ }
+
+ return match;
+ },
+ POS: function(match){
+ match.unshift( true );
+ return match;
+ }
+ },
+ filters: {
+ enabled: function(elem){
+ return elem.disabled === false && elem.type !== "hidden";
+ },
+ disabled: function(elem){
+ return elem.disabled === true;
+ },
+ checked: function(elem){
+ return elem.checked === true;
+ },
+ selected: function(elem){
+ // Accessing this property makes selected-by-default
+ // options in Safari work properly
+ elem.parentNode.selectedIndex;
+ return elem.selected === true;
+ },
+ parent: function(elem){
+ return !!elem.firstChild;
+ },
+ empty: function(elem){
+ return !elem.firstChild;
+ },
+ has: function(elem, i, match){
+ return !!Sizzle( match[3], elem ).length;
+ },
+ header: function(elem){
+ return /h\d/i.test( elem.nodeName );
+ },
+ text: function(elem){
+ return "text" === elem.type;
+ },
+ radio: function(elem){
+ return "radio" === elem.type;
+ },
+ checkbox: function(elem){
+ return "checkbox" === elem.type;
+ },
+ file: function(elem){
+ return "file" === elem.type;
+ },
+ password: function(elem){
+ return "password" === elem.type;
+ },
+ submit: function(elem){
+ return "submit" === elem.type;
+ },
+ image: function(elem){
+ return "image" === elem.type;
+ },
+ reset: function(elem){
+ return "reset" === elem.type;
+ },
+ button: function(elem){
+ return "button" === elem.type || elem.nodeName.toUpperCase() === "BUTTON";
+ },
+ input: function(elem){
+ return /input|select|textarea|button/i.test(elem.nodeName);
+ }
+ },
+ setFilters: {
+ first: function(elem, i){
+ return i === 0;
+ },
+ last: function(elem, i, match, array){
+ return i === array.length - 1;
+ },
+ even: function(elem, i){
+ return i % 2 === 0;
+ },
+ odd: function(elem, i){
+ return i % 2 === 1;
+ },
+ lt: function(elem, i, match){
+ return i < match[3] - 0;
+ },
+ gt: function(elem, i, match){
+ return i > match[3] - 0;
+ },
+ nth: function(elem, i, match){
+ return match[3] - 0 == i;
+ },
+ eq: function(elem, i, match){
+ return match[3] - 0 == i;
+ }
+ },
+ filter: {
+ PSEUDO: function(elem, match, i, array){
+ var name = match[1], filter = Expr.filters[ name ];
+
+ if ( filter ) {
+ return filter( elem, i, match, array );
+ } else if ( name === "contains" ) {
+ return (elem.textContent || elem.innerText || "").indexOf(match[3]) >= 0;
+ } else if ( name === "not" ) {
+ var not = match[3];
+
+ for ( var i = 0, l = not.length; i < l; i++ ) {
+ if ( not[i] === elem ) {
+ return false;
+ }
+ }
+
+ return true;
+ }
+ },
+ CHILD: function(elem, match){
+ var type = match[1], node = elem;
+ switch (type) {
+ case 'only':
+ case 'first':
+ while (node = node.previousSibling) {
+ if ( node.nodeType === 1 ) return false;
+ }
+ if ( type == 'first') return true;
+ node = elem;
+ case 'last':
+ while (node = node.nextSibling) {
+ if ( node.nodeType === 1 ) return false;
+ }
+ return true;
+ case 'nth':
+ var first = match[2], last = match[3];
+
+ if ( first == 1 && last == 0 ) {
+ return true;
+ }
+
+ var doneName = match[0],
+ parent = elem.parentNode;
+
+ if ( parent && (parent.sizcache !== doneName || !elem.nodeIndex) ) {
+ var count = 0;
+ for ( node = parent.firstChild; node; node = node.nextSibling ) {
+ if ( node.nodeType === 1 ) {
+ node.nodeIndex = ++count;
+ }
+ }
+ parent.sizcache = doneName;
+ }
+
+ var diff = elem.nodeIndex - last;
+ if ( first == 0 ) {
+ return diff == 0;
+ } else {
+ return ( diff % first == 0 && diff / first >= 0 );
+ }
+ }
+ },
+ ID: function(elem, match){
+ return elem.nodeType === 1 && elem.getAttribute("id") === match;
+ },
+ TAG: function(elem, match){
+ return (match === "*" && elem.nodeType === 1) || elem.nodeName === match;
+ },
+ CLASS: function(elem, match){
+ return (" " + (elem.className || elem.getAttribute("class")) + " ")
+ .indexOf( match ) > -1;
+ },
+ ATTR: function(elem, match){
+ var name = match[1],
+ result = Expr.attrHandle[ name ] ?
+ Expr.attrHandle[ name ]( elem ) :
+ elem[ name ] != null ?
+ elem[ name ] :
+ elem.getAttribute( name ),
+ value = result + "",
+ type = match[2],
+ check = match[4];
+
+ return result == null ?
+ type === "!=" :
+ type === "=" ?
+ value === check :
+ type === "*=" ?
+ value.indexOf(check) >= 0 :
+ type === "~=" ?
+ (" " + value + " ").indexOf(check) >= 0 :
+ !check ?
+ value && result !== false :
+ type === "!=" ?
+ value != check :
+ type === "^=" ?
+ value.indexOf(check) === 0 :
+ type === "$=" ?
+ value.substr(value.length - check.length) === check :
+ type === "|=" ?
+ value === check || value.substr(0, check.length + 1) === check + "-" :
+ false;
+ },
+ POS: function(elem, match, i, array){
+ var name = match[2], filter = Expr.setFilters[ name ];
+
+ if ( filter ) {
+ return filter( elem, i, match, array );
+ }
+ }
+ }
+};
+
+var origPOS = Expr.match.POS;
+
+for ( var type in Expr.match ) {
+ Expr.match[ type ] = RegExp( Expr.match[ type ].source + /(?![^\[]*\])(?![^\(]*\))/.source );
+}
+
+var makeArray = function(array, results) {
+ array = Array.prototype.slice.call( array );
+
+ if ( results ) {
+ results.push.apply( results, array );
+ return results;
+ }
+
+ return array;
+};
+
+// Perform a simple check to determine if the browser is capable of
+// converting a NodeList to an array using builtin methods.
+try {
+ Array.prototype.slice.call( document.documentElement.childNodes );
+
+// Provide a fallback method if it does not work
+} catch(e){
+ makeArray = function(array, results) {
+ var ret = results || [];
+
+ if ( toString.call(array) === "[object Array]" ) {
+ Array.prototype.push.apply( ret, array );
+ } else {
+ if ( typeof array.length === "number" ) {
+ for ( var i = 0, l = array.length; i < l; i++ ) {
+ ret.push( array[i] );
+ }
+ } else {
+ for ( var i = 0; array[i]; i++ ) {
+ ret.push( array[i] );
+ }
+ }
+ }
+
+ return ret;
+ };
+}
+
+var sortOrder;
+
+if ( document.documentElement.compareDocumentPosition ) {
+ sortOrder = function( a, b ) {
+ var ret = a.compareDocumentPosition(b) & 4 ? -1 : a === b ? 0 : 1;
+ if ( ret === 0 ) {
+ hasDuplicate = true;
+ }
+ return ret;
+ };
+} else if ( "sourceIndex" in document.documentElement ) {
+ sortOrder = function( a, b ) {
+ var ret = a.sourceIndex - b.sourceIndex;
+ if ( ret === 0 ) {
+ hasDuplicate = true;
+ }
+ return ret;
+ };
+} else if ( document.createRange ) {
+ sortOrder = function( a, b ) {
+ var aRange = a.ownerDocument.createRange(), bRange = b.ownerDocument.createRange();
+ aRange.selectNode(a);
+ aRange.collapse(true);
+ bRange.selectNode(b);
+ bRange.collapse(true);
+ var ret = aRange.compareBoundaryPoints(Range.START_TO_END, bRange);
+ if ( ret === 0 ) {
+ hasDuplicate = true;
+ }
+ return ret;
+ };
+}
+
+// Check to see if the browser returns elements by name when
+// querying by getElementById (and provide a workaround)
+(function(){
+ // We're going to inject a fake input element with a specified name
+ var form = document.createElement("form"),
+ id = "script" + (new Date).getTime();
+ form.innerHTML = "<input name='" + id + "'/>";
+
+ // Inject it into the root element, check its status, and remove it quickly
+ var root = document.documentElement;
+ root.insertBefore( form, root.firstChild );
+
+ // The workaround has to do additional checks after a getElementById
+ // Which slows things down for other browsers (hence the branching)
+ if ( !!document.getElementById( id ) ) {
+ Expr.find.ID = function(match, context, isXML){
+ if ( typeof context.getElementById !== "undefined" && !isXML ) {
+ var m = context.getElementById(match[1]);
+ return m ? m.id === match[1] || typeof m.getAttributeNode !== "undefined" && m.getAttributeNode("id").nodeValue === match[1] ? [m] : undefined : [];
+ }
+ };
+
+ Expr.filter.ID = function(elem, match){
+ var node = typeof elem.getAttributeNode !== "undefined" && elem.getAttributeNode("id");
+ return elem.nodeType === 1 && node && node.nodeValue === match;
+ };
+ }
+
+ root.removeChild( form );
+})();
+
+(function(){
+ // Check to see if the browser returns only elements
+ // when doing getElementsByTagName("*")
+
+ // Create a fake element
+ var div = document.createElement("div");
+ div.appendChild( document.createComment("") );
+
+ // Make sure no comments are found
+ if ( div.getElementsByTagName("*").length > 0 ) {
+ Expr.find.TAG = function(match, context){
+ var results = context.getElementsByTagName(match[1]);
+
+ // Filter out possible comments
+ if ( match[1] === "*" ) {
+ var tmp = [];
+
+ for ( var i = 0; results[i]; i++ ) {
+ if ( results[i].nodeType === 1 ) {
+ tmp.push( results[i] );
+ }
+ }
+
+ results = tmp;
+ }
+
+ return results;
+ };
+ }
+
+ // Check to see if an attribute returns normalized href attributes
+ div.innerHTML = "<a href='#'></a>";
+ if ( div.firstChild && typeof div.firstChild.getAttribute !== "undefined" &&
+ div.firstChild.getAttribute("href") !== "#" ) {
+ Expr.attrHandle.href = function(elem){
+ return elem.getAttribute("href", 2);
+ };
+ }
+})();
+
+if ( document.querySelectorAll ) (function(){
+ var oldSizzle = Sizzle, div = document.createElement("div");
+ div.innerHTML = "<p class='TEST'></p>";
+
+ // Safari can't handle uppercase or unicode characters when
+ // in quirks mode.
+ if ( div.querySelectorAll && div.querySelectorAll(".TEST").length === 0 ) {
+ return;
+ }
+
+ Sizzle = function(query, context, extra, seed){
+ context = context || document;
+
+ // Only use querySelectorAll on non-XML documents
+ // (ID selectors don't work in non-HTML documents)
+ if ( !seed && context.nodeType === 9 && !isXML(context) ) {
+ try {
+ return makeArray( context.querySelectorAll(query), extra );
+ } catch(e){}
+ }
+
+ return oldSizzle(query, context, extra, seed);
+ };
+
+ Sizzle.find = oldSizzle.find;
+ Sizzle.filter = oldSizzle.filter;
+ Sizzle.selectors = oldSizzle.selectors;
+ Sizzle.matches = oldSizzle.matches;
+})();
+
+if ( document.getElementsByClassName && document.documentElement.getElementsByClassName ) (function(){
+ var div = document.createElement("div");
+ div.innerHTML = "<div class='test e'></div><div class='test'></div>";
+
+ // Opera can't find a second classname (in 9.6)
+ if ( div.getElementsByClassName("e").length === 0 )
+ return;
+
+ // Safari caches class attributes, doesn't catch changes (in 3.2)
+ div.lastChild.className = "e";
+
+ if ( div.getElementsByClassName("e").length === 1 )
+ return;
+
+ Expr.order.splice(1, 0, "CLASS");
+ Expr.find.CLASS = function(match, context, isXML) {
+ if ( typeof context.getElementsByClassName !== "undefined" && !isXML ) {
+ return context.getElementsByClassName(match[1]);
+ }
+ };
+})();
+
+function dirNodeCheck( dir, cur, doneName, checkSet, nodeCheck, isXML ) {
+ var sibDir = dir == "previousSibling" && !isXML;
+ for ( var i = 0, l = checkSet.length; i < l; i++ ) {
+ var elem = checkSet[i];
+ if ( elem ) {
+ if ( sibDir && elem.nodeType === 1 ){
+ elem.sizcache = doneName;
+ elem.sizset = i;
+ }
+ elem = elem[dir];
+ var match = false;
+
+ while ( elem ) {
+ if ( elem.sizcache === doneName ) {
+ match = checkSet[elem.sizset];
+ break;
+ }
+
+ if ( elem.nodeType === 1 && !isXML ){
+ elem.sizcache = doneName;
+ elem.sizset = i;
+ }
+
+ if ( elem.nodeName === cur ) {
+ match = elem;
+ break;
+ }
+
+ elem = elem[dir];
+ }
+
+ checkSet[i] = match;
+ }
+ }
+}
+
+function dirCheck( dir, cur, doneName, checkSet, nodeCheck, isXML ) {
+ var sibDir = dir == "previousSibling" && !isXML;
+ for ( var i = 0, l = checkSet.length; i < l; i++ ) {
+ var elem = checkSet[i];
+ if ( elem ) {
+ if ( sibDir && elem.nodeType === 1 ) {
+ elem.sizcache = doneName;
+ elem.sizset = i;
+ }
+ elem = elem[dir];
+ var match = false;
+
+ while ( elem ) {
+ if ( elem.sizcache === doneName ) {
+ match = checkSet[elem.sizset];
+ break;
+ }
+
+ if ( elem.nodeType === 1 ) {
+ if ( !isXML ) {
+ elem.sizcache = doneName;
+ elem.sizset = i;
+ }
+ if ( typeof cur !== "string" ) {
+ if ( elem === cur ) {
+ match = true;
+ break;
+ }
+
+ } else if ( Sizzle.filter( cur, [elem] ).length > 0 ) {
+ match = elem;
+ break;
+ }
+ }
+
+ elem = elem[dir];
+ }
+
+ checkSet[i] = match;
+ }
+ }
+}
+
+var contains = document.compareDocumentPosition ? function(a, b){
+ return a.compareDocumentPosition(b) & 16;
+} : function(a, b){
+ return a !== b && (a.contains ? a.contains(b) : true);
+};
+
+var isXML = function(elem){
+ return elem.nodeType === 9 && elem.documentElement.nodeName !== "HTML" ||
+ !!elem.ownerDocument && isXML( elem.ownerDocument );
+};
+
+var posProcess = function(selector, context){
+ var tmpSet = [], later = "", match,
+ root = context.nodeType ? [context] : context;
+
+ // Position selectors must be done after the filter
+ // And so must :not(positional) so we move all PSEUDOs to the end
+ while ( (match = Expr.match.PSEUDO.exec( selector )) ) {
+ later += match[0];
+ selector = selector.replace( Expr.match.PSEUDO, "" );
+ }
+
+ selector = Expr.relative[selector] ? selector + "*" : selector;
+
+ for ( var i = 0, l = root.length; i < l; i++ ) {
+ Sizzle( selector, root[i], tmpSet );
+ }
+
+ return Sizzle.filter( later, tmpSet );
+};
+
+// EXPOSE
+jQuery.find = Sizzle;
+jQuery.filter = Sizzle.filter;
+jQuery.expr = Sizzle.selectors;
+jQuery.expr[":"] = jQuery.expr.filters;
+
+Sizzle.selectors.filters.hidden = function(elem){
+ return elem.offsetWidth === 0 || elem.offsetHeight === 0;
+};
+
+Sizzle.selectors.filters.visible = function(elem){
+ return elem.offsetWidth > 0 || elem.offsetHeight > 0;
+};
+
+Sizzle.selectors.filters.animated = function(elem){
+ return jQuery.grep(jQuery.timers, function(fn){
+ return elem === fn.elem;
+ }).length;
+};
+
+jQuery.multiFilter = function( expr, elems, not ) {
+ if ( not ) {
+ expr = ":not(" + expr + ")";
+ }
+
+ return Sizzle.matches(expr, elems);
+};
+
+jQuery.dir = function( elem, dir ){
+ var matched = [], cur = elem[dir];
+ while ( cur && cur != document ) {
+ if ( cur.nodeType == 1 )
+ matched.push( cur );
+ cur = cur[dir];
+ }
+ return matched;
+};
+
+jQuery.nth = function(cur, result, dir, elem){
+ result = result || 1;
+ var num = 0;
+
+ for ( ; cur; cur = cur[dir] )
+ if ( cur.nodeType == 1 && ++num == result )
+ break;
+
+ return cur;
+};
+
+jQuery.sibling = function(n, elem){
+ var r = [];
+
+ for ( ; n; n = n.nextSibling ) {
+ if ( n.nodeType == 1 && n != elem )
+ r.push( n );
+ }
+
+ return r;
+};
+
+return;
+
+window.Sizzle = Sizzle;
+
+})();
+/*
+ * A number of helper functions used for managing events.
+ * Many of the ideas behind this code originated from
+ * Dean Edwards' addEvent library.
+ */
+jQuery.event = {
+
+ // Bind an event to an element
+ // Original by Dean Edwards
+ add: function(elem, types, handler, data) {
+ if ( elem.nodeType == 3 || elem.nodeType == 8 )
+ return;
+
+ // For whatever reason, IE has trouble passing the window object
+ // around, causing it to be cloned in the process
+ if ( elem.setInterval && elem != window )
+ elem = window;
+
+ // Make sure that the function being executed has a unique ID
+ if ( !handler.guid )
+ handler.guid = this.guid++;
+
+ // if data is passed, bind to handler
+ if ( data !== undefined ) {
+ // Create temporary function pointer to original handler
+ var fn = handler;
+
+ // Create unique handler function, wrapped around original handler
+ handler = this.proxy( fn );
+
+ // Store data in unique handler
+ handler.data = data;
+ }
+
+ // Init the element's event structure
+ var events = jQuery.data(elem, "events") || jQuery.data(elem, "events", {}),
+ handle = jQuery.data(elem, "handle") || jQuery.data(elem, "handle", function(){
+ // Handle the second event of a trigger and when
+ // an event is called after a page has unloaded
+ return typeof jQuery !== "undefined" && !jQuery.event.triggered ?
+ jQuery.event.handle.apply(arguments.callee.elem, arguments) :
+ undefined;
+ });
+ // Add elem as a property of the handle function
+ // This is to prevent a memory leak with non-native
+ // event in IE.
+ handle.elem = elem;
+
+ // Handle multiple events separated by a space
+ // jQuery(...).bind("mouseover mouseout", fn);
+ jQuery.each(types.split(/\s+/), function(index, type) {
+ // Namespaced event handlers
+ var namespaces = type.split(".");
+ type = namespaces.shift();
+ handler.type = namespaces.slice().sort().join(".");
+
+ // Get the current list of functions bound to this event
+ var handlers = events[type];
+
+ if ( jQuery.event.specialAll[type] )
+ jQuery.event.specialAll[type].setup.call(elem, data, namespaces);
+
+ // Init the event handler queue
+ if (!handlers) {
+ handlers = events[type] = {};
+
+ // Check for a special event handler
+ // Only use addEventListener/attachEvent if the special
+ // events handler returns false
+ if ( !jQuery.event.special[type] || jQuery.event.special[type].setup.call(elem, data, namespaces) === false ) {
+ // Bind the global event handler to the element
+ if (elem.addEventListener)
+ elem.addEventListener(type, handle, false);
+ else if (elem.attachEvent)
+ elem.attachEvent("on" + type, handle);
+ }
+ }
+
+ // Add the function to the element's handler list
+ handlers[handler.guid] = handler;
+
+ // Keep track of which events have been used, for global triggering
+ jQuery.event.global[type] = true;
+ });
+
+ // Nullify elem to prevent memory leaks in IE
+ elem = null;
+ },
+
+ guid: 1,
+ global: {},
+
+ // Detach an event or set of events from an element
+ remove: function(elem, types, handler) {
+ // don't do events on text and comment nodes
+ if ( elem.nodeType == 3 || elem.nodeType == 8 )
+ return;
+
+ var events = jQuery.data(elem, "events"), ret, index;
+
+ if ( events ) {
+ // Unbind all events for the element
+ if ( types === undefined || (typeof types === "string" && types.charAt(0) == ".") )
+ for ( var type in events )
+ this.remove( elem, type + (types || "") );
+ else {
+ // types is actually an event object here
+ if ( types.type ) {
+ handler = types.handler;
+ types = types.type;
+ }
+
+ // Handle multiple events seperated by a space
+ // jQuery(...).unbind("mouseover mouseout", fn);
+ jQuery.each(types.split(/\s+/), function(index, type){
+ // Namespaced event handlers
+ var namespaces = type.split(".");
+ type = namespaces.shift();
+ var namespace = RegExp("(^|\\.)" + namespaces.slice().sort().join(".*\\.") + "(\\.|$)");
+
+ if ( events[type] ) {
+ // remove the given handler for the given type
+ if ( handler )
+ delete events[type][handler.guid];
+
+ // remove all handlers for the given type
+ else
+ for ( var handle in events[type] )
+ // Handle the removal of namespaced events
+ if ( namespace.test(events[type][handle].type) )
+ delete events[type][handle];
+
+ if ( jQuery.event.specialAll[type] )
+ jQuery.event.specialAll[type].teardown.call(elem, namespaces);
+
+ // remove generic event handler if no more handlers exist
+ for ( ret in events[type] ) break;
+ if ( !ret ) {
+ if ( !jQuery.event.special[type] || jQuery.event.special[type].teardown.call(elem, namespaces) === false ) {
+ if (elem.removeEventListener)
+ elem.removeEventListener(type, jQuery.data(elem, "handle"), false);
+ else if (elem.detachEvent)
+ elem.detachEvent("on" + type, jQuery.data(elem, "handle"));
+ }
+ ret = null;
+ delete events[type];
+ }
+ }
+ });
+ }
+
+ // Remove the expando if it's no longer used
+ for ( ret in events ) break;
+ if ( !ret ) {
+ var handle = jQuery.data( elem, "handle" );
+ if ( handle ) handle.elem = null;
+ jQuery.removeData( elem, "events" );
+ jQuery.removeData( elem, "handle" );
+ }
+ }
+ },
+
+ // bubbling is internal
+ trigger: function( event, data, elem, bubbling ) {
+ // Event object or event type
+ var type = event.type || event;
+
+ if( !bubbling ){
+ event = typeof event === "object" ?
+ // jQuery.Event object
+ event[expando] ? event :
+ // Object literal
+ jQuery.extend( jQuery.Event(type), event ) :
+ // Just the event type (string)
+ jQuery.Event(type);
+
+ if ( type.indexOf("!") >= 0 ) {
+ event.type = type = type.slice(0, -1);
+ event.exclusive = true;
+ }
+
+ // Handle a global trigger
+ if ( !elem ) {
+ // Don't bubble custom events when global (to avoid too much overhead)
+ event.stopPropagation();
+ // Only trigger if we've ever bound an event for it
+ if ( this.global[type] )
+ jQuery.each( jQuery.cache, function(){
+ if ( this.events && this.events[type] )
+ jQuery.event.trigger( event, data, this.handle.elem );
+ });
+ }
+
+ // Handle triggering a single element
+
+ // don't do events on text and comment nodes
+ if ( !elem || elem.nodeType == 3 || elem.nodeType == 8 )
+ return undefined;
+
+ // Clean up in case it is reused
+ event.result = undefined;
+ event.target = elem;
+
+ // Clone the incoming data, if any
+ data = jQuery.makeArray(data);
+ data.unshift( event );
+ }
+
+ event.currentTarget = elem;
+
+ // Trigger the event, it is assumed that "handle" is a function
+ var handle = jQuery.data(elem, "handle");
+ if ( handle )
+ handle.apply( elem, data );
+
+ // Handle triggering native .onfoo handlers (and on links since we don't call .click() for links)
+ if ( (!elem[type] || (jQuery.nodeName(elem, 'a') && type == "click")) && elem["on"+type] && elem["on"+type].apply( elem, data ) === false )
+ event.result = false;
+
+ // Trigger the native events (except for clicks on links)
+ if ( !bubbling && elem[type] && !event.isDefaultPrevented() && !(jQuery.nodeName(elem, 'a') && type == "click") ) {
+ this.triggered = true;
+ try {
+ elem[ type ]();
+ // prevent IE from throwing an error for some hidden elements
+ } catch (e) {}
+ }
+
+ this.triggered = false;
+
+ if ( !event.isPropagationStopped() ) {
+ var parent = elem.parentNode || elem.ownerDocument;
+ if ( parent )
+ jQuery.event.trigger(event, data, parent, true);
+ }
+ },
+
+ handle: function(event) {
+ // returned undefined or false
+ var all, handlers;
+
+ event = arguments[0] = jQuery.event.fix( event || window.event );
+ event.currentTarget = this;
+
+ // Namespaced event handlers
+ var namespaces = event.type.split(".");
+ event.type = namespaces.shift();
+
+ // Cache this now, all = true means, any handler
+ all = !namespaces.length && !event.exclusive;
+
+ var namespace = RegExp("(^|\\.)" + namespaces.slice().sort().join(".*\\.") + "(\\.|$)");
+
+ handlers = ( jQuery.data(this, "events") || {} )[event.type];
+
+ for ( var j in handlers ) {
+ var handler = handlers[j];
+
+ // Filter the functions by class
+ if ( all || namespace.test(handler.type) ) {
+ // Pass in a reference to the handler function itself
+ // So that we can later remove it
+ event.handler = handler;
+ event.data = handler.data;
+
+ var ret = handler.apply(this, arguments);
+
+ if( ret !== undefined ){
+ event.result = ret;
+ if ( ret === false ) {
+ event.preventDefault();
+ event.stopPropagation();
+ }
+ }
+
+ if( event.isImmediatePropagationStopped() )
+ break;
+
+ }
+ }
+ },
+
+ props: "altKey attrChange attrName bubbles button cancelable charCode clientX clientY ctrlKey currentTarget data detail eventPhase fromElement handler keyCode metaKey newValue originalTarget pageX pageY prevValue relatedNode relatedTarget screenX screenY shiftKey srcElement target toElement view wheelDelta which".split(" "),
+
+ fix: function(event) {
+ if ( event[expando] )
+ return event;
+
+ // store a copy of the original event object
+ // and "clone" to set read-only properties
+ var originalEvent = event;
+ event = jQuery.Event( originalEvent );
+
+ for ( var i = this.props.length, prop; i; ){
+ prop = this.props[ --i ];
+ event[ prop ] = originalEvent[ prop ];
+ }
+
+ // Fix target property, if necessary
+ if ( !event.target )
+ event.target = event.srcElement || document; // Fixes #1925 where srcElement might not be defined either
+
+ // check if target is a textnode (safari)
+ if ( event.target.nodeType == 3 )
+ event.target = event.target.parentNode;
+
+ // Add relatedTarget, if necessary
+ if ( !event.relatedTarget && event.fromElement )
+ event.relatedTarget = event.fromElement == event.target ? event.toElement : event.fromElement;
+
+ // Calculate pageX/Y if missing and clientX/Y available
+ if ( event.pageX == null && event.clientX != null ) {
+ var doc = document.documentElement, body = document.body;
+ event.pageX = event.clientX + (doc && doc.scrollLeft || body && body.scrollLeft || 0) - (doc.clientLeft || 0);
+ event.pageY = event.clientY + (doc && doc.scrollTop || body && body.scrollTop || 0) - (doc.clientTop || 0);
+ }
+
+ // Add which for key events
+ if ( !event.which && ((event.charCode || event.charCode === 0) ? event.charCode : event.keyCode) )
+ event.which = event.charCode || event.keyCode;
+
+ // Add metaKey to non-Mac browsers (use ctrl for PC's and Meta for Macs)
+ if ( !event.metaKey && event.ctrlKey )
+ event.metaKey = event.ctrlKey;
+
+ // Add which for click: 1 == left; 2 == middle; 3 == right
+ // Note: button is not normalized, so don't use it
+ if ( !event.which && event.button )
+ event.which = (event.button & 1 ? 1 : ( event.button & 2 ? 3 : ( event.button & 4 ? 2 : 0 ) ));
+
+ return event;
+ },
+
+ proxy: function( fn, proxy ){
+ proxy = proxy || function(){ return fn.apply(this, arguments); };
+ // Set the guid of unique handler to the same of original handler, so it can be removed
+ proxy.guid = fn.guid = fn.guid || proxy.guid || this.guid++;
+ // So proxy can be declared as an argument
+ return proxy;
+ },
+
+ special: {
+ ready: {
+ // Make sure the ready event is setup
+ setup: bindReady,
+ teardown: function() {}
+ }
+ },
+
+ specialAll: {
+ live: {
+ setup: function( selector, namespaces ){
+ jQuery.event.add( this, namespaces[0], liveHandler );
+ },
+ teardown: function( namespaces ){
+ if ( namespaces.length ) {
+ var remove = 0, name = RegExp("(^|\\.)" + namespaces[0] + "(\\.|$)");
+
+ jQuery.each( (jQuery.data(this, "events").live || {}), function(){
+ if ( name.test(this.type) )
+ remove++;
+ });
+
+ if ( remove < 1 )
+ jQuery.event.remove( this, namespaces[0], liveHandler );
+ }
+ }
+ }
+ }
+};
+
+jQuery.Event = function( src ){
+ // Allow instantiation without the 'new' keyword
+ if( !this.preventDefault )
+ return new jQuery.Event(src);
+
+ // Event object
+ if( src && src.type ){
+ this.originalEvent = src;
+ this.type = src.type;
+ // Event type
+ }else
+ this.type = src;
+
+ // timeStamp is buggy for some events on Firefox(#3843)
+ // So we won't rely on the native value
+ this.timeStamp = now();
+
+ // Mark it as fixed
+ this[expando] = true;
+};
+
+function returnFalse(){
+ return false;
+}
+function returnTrue(){
+ return true;
+}
+
+// jQuery.Event is based on DOM3 Events as specified by the ECMAScript Language Binding
+// http://www.w3.org/TR/2003/WD-DOM-Level-3-Events-20030331/ecma-script-bind...
+jQuery.Event.prototype = {
+ preventDefault: function() {
+ this.isDefaultPrevented = returnTrue;
+
+ var e = this.originalEvent;
+ if( !e )
+ return;
+ // if preventDefault exists run it on the original event
+ if (e.preventDefault)
+ e.preventDefault();
+ // otherwise set the returnValue property of the original event to false (IE)
+ e.returnValue = false;
+ },
+ stopPropagation: function() {
+ this.isPropagationStopped = returnTrue;
+
+ var e = this.originalEvent;
+ if( !e )
+ return;
+ // if stopPropagation exists run it on the original event
+ if (e.stopPropagation)
+ e.stopPropagation();
+ // otherwise set the cancelBubble property of the original event to true (IE)
+ e.cancelBubble = true;
+ },
+ stopImmediatePropagation:function(){
+ this.isImmediatePropagationStopped = returnTrue;
+ this.stopPropagation();
+ },
+ isDefaultPrevented: returnFalse,
+ isPropagationStopped: returnFalse,
+ isImmediatePropagationStopped: returnFalse
+};
+// Checks if an event happened on an element within another element
+// Used in jQuery.event.special.mouseenter and mouseleave handlers
+var withinElement = function(event) {
+ // Check if mouse(over|out) are still within the same parent element
+ var parent = event.relatedTarget;
+ // Traverse up the tree
+ while ( parent && parent != this )
+ try { parent = parent.parentNode; }
+ catch(e) { parent = this; }
+
+ if( parent != this ){
+ // set the correct event type
+ event.type = event.data;
+ // handle event if we actually just moused on to a non sub-element
+ jQuery.event.handle.apply( this, arguments );
+ }
+};
+
+jQuery.each({
+ mouseover: 'mouseenter',
+ mouseout: 'mouseleave'
+}, function( orig, fix ){
+ jQuery.event.special[ fix ] = {
+ setup: function(){
+ jQuery.event.add( this, orig, withinElement, fix );
+ },
+ teardown: function(){
+ jQuery.event.remove( this, orig, withinElement );
+ }
+ };
+});
+
+jQuery.fn.extend({
+ bind: function( type, data, fn ) {
+ return type == "unload" ? this.one(type, data, fn) : this.each(function(){
+ jQuery.event.add( this, type, fn || data, fn && data );
+ });
+ },
+
+ one: function( type, data, fn ) {
+ var one = jQuery.event.proxy( fn || data, function(event) {
+ jQuery(this).unbind(event, one);
+ return (fn || data).apply( this, arguments );
+ });
+ return this.each(function(){
+ jQuery.event.add( this, type, one, fn && data);
+ });
+ },
+
+ unbind: function( type, fn ) {
+ return this.each(function(){
+ jQuery.event.remove( this, type, fn );
+ });
+ },
+
+ trigger: function( type, data ) {
+ return this.each(function(){
+ jQuery.event.trigger( type, data, this );
+ });
+ },
+
+ triggerHandler: function( type, data ) {
+ if( this[0] ){
+ var event = jQuery.Event(type);
+ event.preventDefault();
+ event.stopPropagation();
+ jQuery.event.trigger( event, data, this[0] );
+ return event.result;
+ }
+ },
+
+ toggle: function( fn ) {
+ // Save reference to arguments for access in closure
+ var args = arguments, i = 1;
+
+ // link all the functions, so any of them can unbind this click handler
+ while( i < args.length )
+ jQuery.event.proxy( fn, args[i++] );
+
+ return this.click( jQuery.event.proxy( fn, function(event) {
+ // Figure out which function to execute
+ this.lastToggle = ( this.lastToggle || 0 ) % i;
+
+ // Make sure that clicks stop
+ event.preventDefault();
+
+ // and execute the function
+ return args[ this.lastToggle++ ].apply( this, arguments ) || false;
+ }));
+ },
+
+ hover: function(fnOver, fnOut) {
+ return this.mouseenter(fnOver).mouseleave(fnOut);
+ },
+
+ ready: function(fn) {
+ // Attach the listeners
+ bindReady();
+
+ // If the DOM is already ready
+ if ( jQuery.isReady )
+ // Execute the function immediately
+ fn.call( document, jQuery );
+
+ // Otherwise, remember the function for later
+ else
+ // Add the function to the wait list
+ jQuery.readyList.push( fn );
+
+ return this;
+ },
+
+ live: function( type, fn ){
+ var proxy = jQuery.event.proxy( fn );
+ proxy.guid += this.selector + type;
+
+ jQuery(document).bind( liveConvert(type, this.selector), this.selector, proxy );
+
+ return this;
+ },
+
+ die: function( type, fn ){
+ jQuery(document).unbind( liveConvert(type, this.selector), fn ? { guid: fn.guid + this.selector + type } : null );
+ return this;
+ }
+});
+
+function liveHandler( event ){
+ var check = RegExp("(^|\\.)" + event.type + "(\\.|$)"),
+ stop = true,
+ elems = [];
+
+ jQuery.each(jQuery.data(this, "events").live || [], function(i, fn){
+ if ( check.test(fn.type) ) {
+ var elem = jQuery(event.target).closest(fn.data)[0];
+ if ( elem )
+ elems.push({ elem: elem, fn: fn });
+ }
+ });
+
+ elems.sort(function(a,b) {
+ return jQuery.data(a.elem, "closest") - jQuery.data(b.elem, "closest");
+ });
+
+ jQuery.each(elems, function(){
+ if ( this.fn.call(this.elem, event, this.fn.data) === false )
+ return (stop = false);
+ });
+
+ return stop;
+}
+
+function liveConvert(type, selector){
+ return ["live", type, selector.replace(/\./g, "`").replace(/ /g, "|")].join(".");
+}
+
+jQuery.extend({
+ isReady: false,
+ readyList: [],
+ // Handle when the DOM is ready
+ ready: function() {
+ // Make sure that the DOM is not already loaded
+ if ( !jQuery.isReady ) {
+ // Remember that the DOM is ready
+ jQuery.isReady = true;
+
+ // If there are functions bound, to execute
+ if ( jQuery.readyList ) {
+ // Execute all of them
+ jQuery.each( jQuery.readyList, function(){
+ this.call( document, jQuery );
+ });
+
+ // Reset the list of functions
+ jQuery.readyList = null;
+ }
+
+ // Trigger any bound ready events
+ jQuery(document).triggerHandler("ready");
+ }
+ }
+});
+
+var readyBound = false;
+
+function bindReady(){
+ if ( readyBound ) return;
+ readyBound = true;
+
+ // Mozilla, Opera and webkit nightlies currently support this event
+ if ( document.addEventListener ) {
+ // Use the handy event callback
+ document.addEventListener( "DOMContentLoaded", function(){
+ document.removeEventListener( "DOMContentLoaded", arguments.callee, false );
+ jQuery.ready();
+ }, false );
+
+ // If IE event model is used
+ } else if ( document.attachEvent ) {
+ // ensure firing before onload,
+ // maybe late but safe also for iframes
+ document.attachEvent("onreadystatechange", function(){
+ if ( document.readyState === "complete" ) {
+ document.detachEvent( "onreadystatechange", arguments.callee );
+ jQuery.ready();
+ }
+ });
+
+ // If IE and not an iframe
+ // continually check to see if the document is ready
+ if ( document.documentElement.doScroll && window == window.top ) (function(){
+ if ( jQuery.isReady ) return;
+
+ try {
+ // If IE is used, use the trick by Diego Perini
+ // http://javascript.nwbox.com/IEContentLoaded/
+ document.documentElement.doScroll("left");
+ } catch( error ) {
+ setTimeout( arguments.callee, 0 );
+ return;
+ }
+
+ // and execute any waiting functions
+ jQuery.ready();
+ })();
+ }
+
+ // A fallback to window.onload, that will always work
+ jQuery.event.add( window, "load", jQuery.ready );
+}
+
+jQuery.each( ("blur,focus,load,resize,scroll,unload,click,dblclick," +
+ "mousedown,mouseup,mousemove,mouseover,mouseout,mouseenter,mouseleave," +
+ "change,select,submit,keydown,keypress,keyup,error").split(","), function(i, name){
+
+ // Handle event binding
+ jQuery.fn[name] = function(fn){
+ return fn ? this.bind(name, fn) : this.trigger(name);
+ };
+});
+
+// Prevent memory leaks in IE
+// And prevent errors on refresh with events like mouseover in other browsers
+// Window isn't included so as not to unbind existing unload events
+jQuery( window ).bind( 'unload', function(){
+ for ( var id in jQuery.cache )
+ // Skip the window
+ if ( id != 1 && jQuery.cache[ id ].handle )
+ jQuery.event.remove( jQuery.cache[ id ].handle.elem );
+});
+(function(){
+
+ jQuery.support = {};
+
+ var root = document.documentElement,
+ script = document.createElement("script"),
+ div = document.createElement("div"),
+ id = "script" + (new Date).getTime();
+
+ div.style.display = "none";
+ div.innerHTML = ' <link/><table></table><a href="/a" style="color:red;float:left;opacity:.5;">a</a><select><option>text</option></select><object><param/></object>';
+
+ var all = div.getElementsByTagName("*"),
+ a = div.getElementsByTagName("a")[0];
+
+ // Can't get basic test support
+ if ( !all || !all.length || !a ) {
+ return;
+ }
+
+ jQuery.support = {
+ // IE strips leading whitespace when .innerHTML is used
+ leadingWhitespace: div.firstChild.nodeType == 3,
+
+ // Make sure that tbody elements aren't automatically inserted
+ // IE will insert them into empty tables
+ tbody: !div.getElementsByTagName("tbody").length,
+
+ // Make sure that you can get all elements in an <object> element
+ // IE 7 always returns no results
+ objectAll: !!div.getElementsByTagName("object")[0]
+ .getElementsByTagName("*").length,
+
+ // Make sure that link elements get serialized correctly by innerHTML
+ // This requires a wrapper element in IE
+ htmlSerialize: !!div.getElementsByTagName("link").length,
+
+ // Get the style information from getAttribute
+ // (IE uses .cssText insted)
+ style: /red/.test( a.getAttribute("style") ),
+
+ // Make sure that URLs aren't manipulated
+ // (IE normalizes it by default)
+ hrefNormalized: a.getAttribute("href") === "/a",
+
+ // Make sure that element opacity exists
+ // (IE uses filter instead)
+ opacity: a.style.opacity === "0.5",
+
+ // Verify style float existence
+ // (IE uses styleFloat instead of cssFloat)
+ cssFloat: !!a.style.cssFloat,
+
+ // Will be defined later
+ scriptEval: false,
+ noCloneEvent: true,
+ boxModel: null
+ };
+
+ script.type = "text/javascript";
+ try {
+ script.appendChild( document.createTextNode( "window." + id + "=1;" ) );
+ } catch(e){}
+
+ root.insertBefore( script, root.firstChild );
+
+ // Make sure that the execution of code works by injecting a script
+ // tag with appendChild/createTextNode
+ // (IE doesn't support this, fails, and uses .text instead)
+ if ( window[ id ] ) {
+ jQuery.support.scriptEval = true;
+ delete window[ id ];
+ }
+
+ root.removeChild( script );
+
+ if ( div.attachEvent && div.fireEvent ) {
+ div.attachEvent("onclick", function(){
+ // Cloning a node shouldn't copy over any
+ // bound event handlers (IE does this)
+ jQuery.support.noCloneEvent = false;
+ div.detachEvent("onclick", arguments.callee);
+ });
+ div.cloneNode(true).fireEvent("onclick");
+ }
+
+ // Figure out if the W3C box model works as expected
+ // document.body must exist before we can do this
+ jQuery(function(){
+ var div = document.createElement("div");
+ div.style.width = div.style.paddingLeft = "1px";
+
+ document.body.appendChild( div );
+ jQuery.boxModel = jQuery.support.boxModel = div.offsetWidth === 2;
+ document.body.removeChild( div ).style.display = 'none';
+ });
+})();
+
+var styleFloat = jQuery.support.cssFloat ? "cssFloat" : "styleFloat";
+
+jQuery.props = {
+ "for": "htmlFor",
+ "class": "className",
+ "float": styleFloat,
+ cssFloat: styleFloat,
+ styleFloat: styleFloat,
+ readonly: "readOnly",
+ maxlength: "maxLength",
+ cellspacing: "cellSpacing",
+ rowspan: "rowSpan",
+ tabindex: "tabIndex"
+};
+jQuery.fn.extend({
+ // Keep a copy of the old load
+ _load: jQuery.fn.load,
+
+ load: function( url, params, callback ) {
+ if ( typeof url !== "string" )
+ return this._load( url );
+
+ var off = url.indexOf(" ");
+ if ( off >= 0 ) {
+ var selector = url.slice(off, url.length);
+ url = url.slice(0, off);
+ }
+
+ // Default to a GET request
+ var type = "GET";
+
+ // If the second parameter was provided
+ if ( params )
+ // If it's a function
+ if ( jQuery.isFunction( params ) ) {
+ // We assume that it's the callback
+ callback = params;
+ params = null;
+
+ // Otherwise, build a param string
+ } else if( typeof params === "object" ) {
+ params = jQuery.param( params );
+ type = "POST";
+ }
+
+ var self = this;
+
+ // Request the remote document
+ jQuery.ajax({
+ url: url,
+ type: type,
+ dataType: "html",
+ data: params,
+ complete: function(res, status){
+ // If successful, inject the HTML into all the matched elements
+ if ( status == "success" || status == "notmodified" )
+ // See if a selector was specified
+ self.html( selector ?
+ // Create a dummy div to hold the results
+ jQuery("<div/>")
+ // inject the contents of the document in, removing the scripts
+ // to avoid any 'Permission Denied' errors in IE
+ .append(res.responseText.replace(/<script(.|\s)*?\/script>/g, ""))
+
+ // Locate the specified elements
+ .find(selector) :
+
+ // If not, just inject the full result
+ res.responseText );
+
+ if( callback )
+ self.each( callback, [res.responseText, status, res] );
+ }
+ });
+ return this;
+ },
+
+ serialize: function() {
+ return jQuery.param(this.serializeArray());
+ },
+ serializeArray: function() {
+ return this.map(function(){
+ return this.elements ? jQuery.makeArray(this.elements) : this;
+ })
+ .filter(function(){
+ return this.name && !this.disabled &&
+ (this.checked || /select|textarea/i.test(this.nodeName) ||
+ /text|hidden|password|search/i.test(this.type));
+ })
+ .map(function(i, elem){
+ var val = jQuery(this).val();
+ return val == null ? null :
+ jQuery.isArray(val) ?
+ jQuery.map( val, function(val, i){
+ return {name: elem.name, value: val};
+ }) :
+ {name: elem.name, value: val};
+ }).get();
+ }
+});
+
+// Attach a bunch of functions for handling common AJAX events
+jQuery.each( "ajaxStart,ajaxStop,ajaxComplete,ajaxError,ajaxSuccess,ajaxSend".split(","), function(i,o){
+ jQuery.fn[o] = function(f){
+ return this.bind(o, f);
+ };
+});
+
+var jsc = now();
+
+jQuery.extend({
+
+ get: function( url, data, callback, type ) {
+ // shift arguments if data argument was ommited
+ if ( jQuery.isFunction( data ) ) {
+ callback = data;
+ data = null;
+ }
+
+ return jQuery.ajax({
+ type: "GET",
+ url: url,
+ data: data,
+ success: callback,
+ dataType: type
+ });
+ },
+
+ getScript: function( url, callback ) {
+ return jQuery.get(url, null, callback, "script");
+ },
+
+ getJSON: function( url, data, callback ) {
+ return jQuery.get(url, data, callback, "json");
+ },
+
+ post: function( url, data, callback, type ) {
+ if ( jQuery.isFunction( data ) ) {
+ callback = data;
+ data = {};
+ }
+
+ return jQuery.ajax({
+ type: "POST",
+ url: url,
+ data: data,
+ success: callback,
+ dataType: type
+ });
+ },
+
+ ajaxSetup: function( settings ) {
+ jQuery.extend( jQuery.ajaxSettings, settings );
+ },
+
+ ajaxSettings: {
+ url: location.href,
+ global: true,
+ type: "GET",
+ contentType: "application/x-www-form-urlencoded",
+ processData: true,
+ async: true,
+ /*
+ timeout: 0,
+ data: null,
+ username: null,
+ password: null,
+ */
+ // Create the request object; Microsoft failed to properly
+ // implement the XMLHttpRequest in IE7, so we use the ActiveXObject when it is available
+ // This function can be overriden by calling jQuery.ajaxSetup
+ xhr:function(){
+ return window.ActiveXObject ? new ActiveXObject("Microsoft.XMLHTTP") : new XMLHttpRequest();
+ },
+ accepts: {
+ xml: "application/xml, text/xml",
+ html: "text/html",
+ script: "text/javascript, application/javascript",
+ json: "application/json, text/javascript",
+ text: "text/plain",
+ _default: "*/*"
+ }
+ },
+
+ // Last-Modified header cache for next request
+ lastModified: {},
+
+ ajax: function( s ) {
+ // Extend the settings, but re-extend 's' so that it can be
+ // checked again later (in the test suite, specifically)
+ s = jQuery.extend(true, s, jQuery.extend(true, {}, jQuery.ajaxSettings, s));
+
+ var jsonp, jsre = /=\?(&|$)/g, status, data,
+ type = s.type.toUpperCase();
+
+ // convert data if not already a string
+ if ( s.data && s.processData && typeof s.data !== "string" )
+ s.data = jQuery.param(s.data);
+
+ // Handle JSONP Parameter Callbacks
+ if ( s.dataType == "jsonp" ) {
+ if ( type == "GET" ) {
+ if ( !s.url.match(jsre) )
+ s.url += (s.url.match(/\?/) ? "&" : "?") + (s.jsonp || "callback") + "=?";
+ } else if ( !s.data || !s.data.match(jsre) )
+ s.data = (s.data ? s.data + "&" : "") + (s.jsonp || "callback") + "=?";
+ s.dataType = "json";
+ }
+
+ // Build temporary JSONP function
+ if ( s.dataType == "json" && (s.data && s.data.match(jsre) || s.url.match(jsre)) ) {
+ jsonp = "jsonp" + jsc++;
+
+ // Replace the =? sequence both in the query string and the data
+ if ( s.data )
+ s.data = (s.data + "").replace(jsre, "=" + jsonp + "$1");
+ s.url = s.url.replace(jsre, "=" + jsonp + "$1");
+
+ // We need to make sure
+ // that a JSONP style response is executed properly
+ s.dataType = "script";
+
+ // Handle JSONP-style loading
+ window[ jsonp ] = function(tmp){
+ data = tmp;
+ success();
+ complete();
+ // Garbage collect
+ window[ jsonp ] = undefined;
+ try{ delete window[ jsonp ]; } catch(e){}
+ if ( head )
+ head.removeChild( script );
+ };
+ }
+
+ if ( s.dataType == "script" && s.cache == null )
+ s.cache = false;
+
+ if ( s.cache === false && type == "GET" ) {
+ var ts = now();
+ // try replacing _= if it is there
+ var ret = s.url.replace(/(\?|&)_=.*?(&|$)/, "$1_=" + ts + "$2");
+ // if nothing was replaced, add timestamp to the end
+ s.url = ret + ((ret == s.url) ? (s.url.match(/\?/) ? "&" : "?") + "_=" + ts : "");
+ }
+
+ // If data is available, append data to url for get requests
+ if ( s.data && type == "GET" ) {
+ s.url += (s.url.match(/\?/) ? "&" : "?") + s.data;
+
+ // IE likes to send both get and post data, prevent this
+ s.data = null;
+ }
+
+ // Watch for a new set of requests
+ if ( s.global && ! jQuery.active++ )
+ jQuery.event.trigger( "ajaxStart" );
+
+ // Matches an absolute URL, and saves the domain
+ var parts = /^(\w+:)?\/\/([^\/?#]+)/.exec( s.url );
+
+ // If we're requesting a remote document
+ // and trying to load JSON or Script with a GET
+ if ( s.dataType == "script" && type == "GET" && parts
+ && ( parts[1] && parts[1] != location.protocol || parts[2] != location.host )){
+
+ var head = document.getElementsByTagName("head")[0];
+ var script = document.createElement("script");
+ script.src = s.url;
+ if (s.scriptCharset)
+ script.charset = s.scriptCharset;
+
+ // Handle Script loading
+ if ( !jsonp ) {
+ var done = false;
+
+ // Attach handlers for all browsers
+ script.onload = script.onreadystatechange = function(){
+ if ( !done && (!this.readyState ||
+ this.readyState == "loaded" || this.readyState == "complete") ) {
+ done = true;
+ success();
+ complete();
+
+ // Handle memory leak in IE
+ script.onload = script.onreadystatechange = null;
+ head.removeChild( script );
+ }
+ };
+ }
+
+ head.appendChild(script);
+
+ // We handle everything using the script element injection
+ return undefined;
+ }
+
+ var requestDone = false;
+
+ // Create the request object
+ var xhr = s.xhr();
+
+ // Open the socket
+ // Passing null username, generates a login popup on Opera (#2865)
+ if( s.username )
+ xhr.open(type, s.url, s.async, s.username, s.password);
+ else
+ xhr.open(type, s.url, s.async);
+
+ // Need an extra try/catch for cross domain requests in Firefox 3
+ try {
+ // Set the correct header, if data is being sent
+ if ( s.data )
+ xhr.setRequestHeader("Content-Type", s.contentType);
+
+ // Set the If-Modified-Since header, if ifModified mode.
+ if ( s.ifModified )
+ xhr.setRequestHeader("If-Modified-Since",
+ jQuery.lastModified[s.url] || "Thu, 01 Jan 1970 00:00:00 GMT" );
+
+ // Set header so the called script knows that it's an XMLHttpRequest
+ xhr.setRequestHeader("X-Requested-With", "XMLHttpRequest");
+
+ // Set the Accepts header for the server, depending on the dataType
+ xhr.setRequestHeader("Accept", s.dataType && s.accepts[ s.dataType ] ?
+ s.accepts[ s.dataType ] + ", */*" :
+ s.accepts._default );
+ } catch(e){}
+
+ // Allow custom headers/mimetypes and early abort
+ if ( s.beforeSend && s.beforeSend(xhr, s) === false ) {
+ // Handle the global AJAX counter
+ if ( s.global && ! --jQuery.active )
+ jQuery.event.trigger( "ajaxStop" );
+ // close opended socket
+ xhr.abort();
+ return false;
+ }
+
+ if ( s.global )
+ jQuery.event.trigger("ajaxSend", [xhr, s]);
+
+ // Wait for a response to come back
+ var onreadystatechange = function(isTimeout){
+ // The request was aborted, clear the interval and decrement jQuery.active
+ if (xhr.readyState == 0) {
+ if (ival) {
+ // clear poll interval
+ clearInterval(ival);
+ ival = null;
+ // Handle the global AJAX counter
+ if ( s.global && ! --jQuery.active )
+ jQuery.event.trigger( "ajaxStop" );
+ }
+ // The transfer is complete and the data is available, or the request timed out
+ } else if ( !requestDone && xhr && (xhr.readyState == 4 || isTimeout == "timeout") ) {
+ requestDone = true;
+
+ // clear poll interval
+ if (ival) {
+ clearInterval(ival);
+ ival = null;
+ }
+
+ status = isTimeout == "timeout" ? "timeout" :
+ !jQuery.httpSuccess( xhr ) ? "error" :
+ s.ifModified && jQuery.httpNotModified( xhr, s.url ) ? "notmodified" :
+ "success";
+
+ if ( status == "success" ) {
+ // Watch for, and catch, XML document parse errors
+ try {
+ // process the data (runs the xml through httpData regardless of callback)
+ data = jQuery.httpData( xhr, s.dataType, s );
+ } catch(e) {
+ status = "parsererror";
+ }
+ }
+
+ // Make sure that the request was successful or notmodified
+ if ( status == "success" ) {
+ // Cache Last-Modified header, if ifModified mode.
+ var modRes;
+ try {
+ modRes = xhr.getResponseHeader("Last-Modified");
+ } catch(e) {} // swallow exception thrown by FF if header is not available
+
+ if ( s.ifModified && modRes )
+ jQuery.lastModified[s.url] = modRes;
+
+ // JSONP handles its own success callback
+ if ( !jsonp )
+ success();
+ } else
+ jQuery.handleError(s, xhr, status);
+
+ // Fire the complete handlers
+ complete();
+
+ if ( isTimeout )
+ xhr.abort();
+
+ // Stop memory leaks
+ if ( s.async )
+ xhr = null;
+ }
+ };
+
+ if ( s.async ) {
+ // don't attach the handler to the request, just poll it instead
+ var ival = setInterval(onreadystatechange, 13);
+
+ // Timeout checker
+ if ( s.timeout > 0 )
+ setTimeout(function(){
+ // Check to see if the request is still happening
+ if ( xhr && !requestDone )
+ onreadystatechange( "timeout" );
+ }, s.timeout);
+ }
+
+ // Send the data
+ try {
+ xhr.send(s.data);
+ } catch(e) {
+ jQuery.handleError(s, xhr, null, e);
+ }
+
+ // firefox 1.5 doesn't fire statechange for sync requests
+ if ( !s.async )
+ onreadystatechange();
+
+ function success(){
+ // If a local callback was specified, fire it and pass it the data
+ if ( s.success )
+ s.success( data, status );
+
+ // Fire the global callback
+ if ( s.global )
+ jQuery.event.trigger( "ajaxSuccess", [xhr, s] );
+ }
+
+ function complete(){
+ // Process result
+ if ( s.complete )
+ s.complete(xhr, status);
+
+ // The request was completed
+ if ( s.global )
+ jQuery.event.trigger( "ajaxComplete", [xhr, s] );
+
+ // Handle the global AJAX counter
+ if ( s.global && ! --jQuery.active )
+ jQuery.event.trigger( "ajaxStop" );
+ }
+
+ // return XMLHttpRequest to allow aborting the request etc.
+ return xhr;
+ },
+
+ handleError: function( s, xhr, status, e ) {
+ // If a local callback was specified, fire it
+ if ( s.error ) s.error( xhr, status, e );
+
+ // Fire the global callback
+ if ( s.global )
+ jQuery.event.trigger( "ajaxError", [xhr, s, e] );
+ },
+
+ // Counter for holding the number of active queries
+ active: 0,
+
+ // Determines if an XMLHttpRequest was successful or not
+ httpSuccess: function( xhr ) {
+ try {
+ // IE error sometimes returns 1223 when it should be 204 so treat it as success, see #1450
+ return !xhr.status && location.protocol == "file:" ||
+ ( xhr.status >= 200 && xhr.status < 300 ) || xhr.status == 304 || xhr.status == 1223;
+ } catch(e){}
+ return false;
+ },
+
+ // Determines if an XMLHttpRequest returns NotModified
+ httpNotModified: function( xhr, url ) {
+ try {
+ var xhrRes = xhr.getResponseHeader("Last-Modified");
+
+ // Firefox always returns 200. check Last-Modified date
+ return xhr.status == 304 || xhrRes == jQuery.lastModified[url];
+ } catch(e){}
+ return false;
+ },
+
+ httpData: function( xhr, type, s ) {
+ var ct = xhr.getResponseHeader("content-type"),
+ xml = type == "xml" || !type && ct && ct.indexOf("xml") >= 0,
+ data = xml ? xhr.responseXML : xhr.responseText;
+
+ if ( xml && data.documentElement.tagName == "parsererror" )
+ throw "parsererror";
+
+ // Allow a pre-filtering function to sanitize the response
+ // s != null is checked to keep backwards compatibility
+ if( s && s.dataFilter )
+ data = s.dataFilter( data, type );
+
+ // The filter can actually parse the response
+ if( typeof data === "string" ){
+
+ // If the type is "script", eval it in global context
+ if ( type == "script" )
+ jQuery.globalEval( data );
+
+ // Get the JavaScript object, if JSON is used.
+ if ( type == "json" )
+ data = window["eval"]("(" + data + ")");
+ }
+
+ return data;
+ },
+
+ // Serialize an array of form elements or a set of
+ // key/values into a query string
+ param: function( a ) {
+ var s = [ ];
+
+ function add( key, value ){
+ s[ s.length ] = encodeURIComponent(key) + '=' + encodeURIComponent(value);
+ };
+
+ // If an array was passed in, assume that it is an array
+ // of form elements
+ if ( jQuery.isArray(a) || a.jquery )
+ // Serialize the form elements
+ jQuery.each( a, function(){
+ add( this.name, this.value );
+ });
+
+ // Otherwise, assume that it's an object of key/value pairs
+ else
+ // Serialize the key/values
+ for ( var j in a )
+ // If the value is an array then the key names need to be repeated
+ if ( jQuery.isArray(a[j]) )
+ jQuery.each( a[j], function(){
+ add( j, this );
+ });
+ else
+ add( j, jQuery.isFunction(a[j]) ? a[j]() : a[j] );
+
+ // Return the resulting serialization
+ return s.join("&").replace(/%20/g, "+");
+ }
+
+});
+var elemdisplay = {},
+ timerId,
+ fxAttrs = [
+ // height animations
+ [ "height", "marginTop", "marginBottom", "paddingTop", "paddingBottom" ],
+ // width animations
+ [ "width", "marginLeft", "marginRight", "paddingLeft", "paddingRight" ],
+ // opacity animations
+ [ "opacity" ]
+ ];
+
+function genFx( type, num ){
+ var obj = {};
+ jQuery.each( fxAttrs.concat.apply([], fxAttrs.slice(0,num)), function(){
+ obj[ this ] = type;
+ });
+ return obj;
+}
+
+jQuery.fn.extend({
+ show: function(speed,callback){
+ if ( speed ) {
+ return this.animate( genFx("show", 3), speed, callback);
+ } else {
+ for ( var i = 0, l = this.length; i < l; i++ ){
+ var old = jQuery.data(this[i], "olddisplay");
+
+ this[i].style.display = old || "";
+
+ if ( jQuery.css(this[i], "display") === "none" ) {
+ var tagName = this[i].tagName, display;
+
+ if ( elemdisplay[ tagName ] ) {
+ display = elemdisplay[ tagName ];
+ } else {
+ var elem = jQuery("<" + tagName + " />").appendTo("body");
+
+ display = elem.css("display");
+ if ( display === "none" )
+ display = "block";
+
+ elem.remove();
+
+ elemdisplay[ tagName ] = display;
+ }
+
+ jQuery.data(this[i], "olddisplay", display);
+ }
+ }
+
+ // Set the display of the elements in a second loop
+ // to avoid the constant reflow
+ for ( var i = 0, l = this.length; i < l; i++ ){
+ this[i].style.display = jQuery.data(this[i], "olddisplay") || "";
+ }
+
+ return this;
+ }
+ },
+
+ hide: function(speed,callback){
+ if ( speed ) {
+ return this.animate( genFx("hide", 3), speed, callback);
+ } else {
+ for ( var i = 0, l = this.length; i < l; i++ ){
+ var old = jQuery.data(this[i], "olddisplay");
+ if ( !old && old !== "none" )
+ jQuery.data(this[i], "olddisplay", jQuery.css(this[i], "display"));
+ }
+
+ // Set the display of the elements in a second loop
+ // to avoid the constant reflow
+ for ( var i = 0, l = this.length; i < l; i++ ){
+ this[i].style.display = "none";
+ }
+
+ return this;
+ }
+ },
+
+ // Save the old toggle function
+ _toggle: jQuery.fn.toggle,
+
+ toggle: function( fn, fn2 ){
+ var bool = typeof fn === "boolean";
+
+ return jQuery.isFunction(fn) && jQuery.isFunction(fn2) ?
+ this._toggle.apply( this, arguments ) :
+ fn == null || bool ?
+ this.each(function(){
+ var state = bool ? fn : jQuery(this).is(":hidden");
+ jQuery(this)[ state ? "show" : "hide" ]();
+ }) :
+ this.animate(genFx("toggle", 3), fn, fn2);
+ },
+
+ fadeTo: function(speed,to,callback){
+ return this.animate({opacity: to}, speed, callback);
+ },
+
+ animate: function( prop, speed, easing, callback ) {
+ var optall = jQuery.speed(speed, easing, callback);
+
+ return this[ optall.queue === false ? "each" : "queue" ](function(){
+
+ var opt = jQuery.extend({}, optall), p,
+ hidden = this.nodeType == 1 && jQuery(this).is(":hidden"),
+ self = this;
+
+ for ( p in prop ) {
+ if ( prop[p] == "hide" && hidden || prop[p] == "show" && !hidden )
+ return opt.complete.call(this);
+
+ if ( ( p == "height" || p == "width" ) && this.style ) {
+ // Store display property
+ opt.display = jQuery.css(this, "display");
+
+ // Make sure that nothing sneaks out
+ opt.overflow = this.style.overflow;
+ }
+ }
+
+ if ( opt.overflow != null )
+ this.style.overflow = "hidden";
+
+ opt.curAnim = jQuery.extend({}, prop);
+
+ jQuery.each( prop, function(name, val){
+ var e = new jQuery.fx( self, opt, name );
+
+ if ( /toggle|show|hide/.test(val) )
+ e[ val == "toggle" ? hidden ? "show" : "hide" : val ]( prop );
+ else {
+ var parts = val.toString().match(/^([+-]=)?([\d+-.]+)(.*)$/),
+ start = e.cur(true) || 0;
+
+ if ( parts ) {
+ var end = parseFloat(parts[2]),
+ unit = parts[3] || "px";
+
+ // We need to compute starting value
+ if ( unit != "px" ) {
+ self.style[ name ] = (end || 1) + unit;
+ start = ((end || 1) / e.cur(true)) * start;
+ self.style[ name ] = start + unit;
+ }
+
+ // If a +=/-= token was provided, we're doing a relative animation
+ if ( parts[1] )
+ end = ((parts[1] == "-=" ? -1 : 1) * end) + start;
+
+ e.custom( start, end, unit );
+ } else
+ e.custom( start, val, "" );
+ }
+ });
+
+ // For JS strict compliance
+ return true;
+ });
+ },
+
+ stop: function(clearQueue, gotoEnd){
+ var timers = jQuery.timers;
+
+ if (clearQueue)
+ this.queue([]);
+
+ this.each(function(){
+ // go in reverse order so anything added to the queue during the loop is ignored
+ for ( var i = timers.length - 1; i >= 0; i-- )
+ if ( timers[i].elem == this ) {
+ if (gotoEnd)
+ // force the next step to be the last
+ timers[i](true);
+ timers.splice(i, 1);
+ }
+ });
+
+ // start the next in the queue if the last step wasn't forced
+ if (!gotoEnd)
+ this.dequeue();
+
+ return this;
+ }
+
+});
+
+// Generate shortcuts for custom animations
+jQuery.each({
+ slideDown: genFx("show", 1),
+ slideUp: genFx("hide", 1),
+ slideToggle: genFx("toggle", 1),
+ fadeIn: { opacity: "show" },
+ fadeOut: { opacity: "hide" }
+}, function( name, props ){
+ jQuery.fn[ name ] = function( speed, callback ){
+ return this.animate( props, speed, callback );
+ };
+});
+
+jQuery.extend({
+
+ speed: function(speed, easing, fn) {
+ var opt = typeof speed === "object" ? speed : {
+ complete: fn || !fn && easing ||
+ jQuery.isFunction( speed ) && speed,
+ duration: speed,
+ easing: fn && easing || easing && !jQuery.isFunction(easing) && easing
+ };
+
+ opt.duration = jQuery.fx.off ? 0 : typeof opt.duration === "number" ? opt.duration :
+ jQuery.fx.speeds[opt.duration] || jQuery.fx.speeds._default;
+
+ // Queueing
+ opt.old = opt.complete;
+ opt.complete = function(){
+ if ( opt.queue !== false )
+ jQuery(this).dequeue();
+ if ( jQuery.isFunction( opt.old ) )
+ opt.old.call( this );
+ };
+
+ return opt;
+ },
+
+ easing: {
+ linear: function( p, n, firstNum, diff ) {
+ return firstNum + diff * p;
+ },
+ swing: function( p, n, firstNum, diff ) {
+ return ((-Math.cos(p*Math.PI)/2) + 0.5) * diff + firstNum;
+ }
+ },
+
+ timers: [],
+
+ fx: function( elem, options, prop ){
+ this.options = options;
+ this.elem = elem;
+ this.prop = prop;
+
+ if ( !options.orig )
+ options.orig = {};
+ }
+
+});
+
+jQuery.fx.prototype = {
+
+ // Simple function for setting a style value
+ update: function(){
+ if ( this.options.step )
+ this.options.step.call( this.elem, this.now, this );
+
+ (jQuery.fx.step[this.prop] || jQuery.fx.step._default)( this );
+
+ // Set display property to block for height/width animations
+ if ( ( this.prop == "height" || this.prop == "width" ) && this.elem.style )
+ this.elem.style.display = "block";
+ },
+
+ // Get the current size
+ cur: function(force){
+ if ( this.elem[this.prop] != null && (!this.elem.style || this.elem.style[this.prop] == null) )
+ return this.elem[ this.prop ];
+
+ var r = parseFloat(jQuery.css(this.elem, this.prop, force));
+ return r && r > -10000 ? r : parseFloat(jQuery.curCSS(this.elem, this.prop)) || 0;
+ },
+
+ // Start an animation from one number to another
+ custom: function(from, to, unit){
+ this.startTime = now();
+ this.start = from;
+ this.end = to;
+ this.unit = unit || this.unit || "px";
+ this.now = this.start;
+ this.pos = this.state = 0;
+
+ var self = this;
+ function t(gotoEnd){
+ return self.step(gotoEnd);
+ }
+
+ t.elem = this.elem;
+
+ if ( t() && jQuery.timers.push(t) && !timerId ) {
+ timerId = setInterval(function(){
+ var timers = jQuery.timers;
+
+ for ( var i = 0; i < timers.length; i++ )
+ if ( !timers[i]() )
+ timers.splice(i--, 1);
+
+ if ( !timers.length ) {
+ clearInterval( timerId );
+ timerId = undefined;
+ }
+ }, 13);
+ }
+ },
+
+ // Simple 'show' function
+ show: function(){
+ // Remember where we started, so that we can go back to it later
+ this.options.orig[this.prop] = jQuery.attr( this.elem.style, this.prop );
+ this.options.show = true;
+
+ // Begin the animation
+ // Make sure that we start at a small width/height to avoid any
+ // flash of content
+ this.custom(this.prop == "width" || this.prop == "height" ? 1 : 0, this.cur());
+
+ // Start by showing the element
+ jQuery(this.elem).show();
+ },
+
+ // Simple 'hide' function
+ hide: function(){
+ // Remember where we started, so that we can go back to it later
+ this.options.orig[this.prop] = jQuery.attr( this.elem.style, this.prop );
+ this.options.hide = true;
+
+ // Begin the animation
+ this.custom(this.cur(), 0);
+ },
+
+ // Each step of an animation
+ step: function(gotoEnd){
+ var t = now();
+
+ if ( gotoEnd || t >= this.options.duration + this.startTime ) {
+ this.now = this.end;
+ this.pos = this.state = 1;
+ this.update();
+
+ this.options.curAnim[ this.prop ] = true;
+
+ var done = true;
+ for ( var i in this.options.curAnim )
+ if ( this.options.curAnim[i] !== true )
+ done = false;
+
+ if ( done ) {
+ if ( this.options.display != null ) {
+ // Reset the overflow
+ this.elem.style.overflow = this.options.overflow;
+
+ // Reset the display
+ this.elem.style.display = this.options.display;
+ if ( jQuery.css(this.elem, "display") == "none" )
+ this.elem.style.display = "block";
+ }
+
+ // Hide the element if the "hide" operation was done
+ if ( this.options.hide )
+ jQuery(this.elem).hide();
+
+ // Reset the properties, if the item has been hidden or shown
+ if ( this.options.hide || this.options.show )
+ for ( var p in this.options.curAnim )
+ jQuery.attr(this.elem.style, p, this.options.orig[p]);
+
+ // Execute the complete function
+ this.options.complete.call( this.elem );
+ }
+
+ return false;
+ } else {
+ var n = t - this.startTime;
+ this.state = n / this.options.duration;
+
+ // Perform the easing function, defaults to swing
+ this.pos = jQuery.easing[this.options.easing || (jQuery.easing.swing ? "swing" : "linear")](this.state, n, 0, 1, this.options.duration);
+ this.now = this.start + ((this.end - this.start) * this.pos);
+
+ // Perform the next step of the animation
+ this.update();
+ }
+
+ return true;
+ }
+
+};
+
+jQuery.extend( jQuery.fx, {
+ speeds:{
+ slow: 600,
+ fast: 200,
+ // Default speed
+ _default: 400
+ },
+ step: {
+
+ opacity: function(fx){
+ jQuery.attr(fx.elem.style, "opacity", fx.now);
+ },
+
+ _default: function(fx){
+ if ( fx.elem.style && fx.elem.style[ fx.prop ] != null )
+ fx.elem.style[ fx.prop ] = fx.now + fx.unit;
+ else
+ fx.elem[ fx.prop ] = fx.now;
+ }
+ }
+});
+if ( document.documentElement["getBoundingClientRect"] )
+ jQuery.fn.offset = function() {
+ if ( !this[0] ) return { top: 0, left: 0 };
+ if ( this[0] === this[0].ownerDocument.body ) return jQuery.offset.bodyOffset( this[0] );
+ var box = this[0].getBoundingClientRect(), doc = this[0].ownerDocument, body = doc.body, docElem = doc.documentElement,
+ clientTop = docElem.clientTop || body.clientTop || 0, clientLeft = docElem.clientLeft || body.clientLeft || 0,
+ top = box.top + (self.pageYOffset || jQuery.boxModel && docElem.scrollTop || body.scrollTop ) - clientTop,
+ left = box.left + (self.pageXOffset || jQuery.boxModel && docElem.scrollLeft || body.scrollLeft) - clientLeft;
+ return { top: top, left: left };
+ };
+else
+ jQuery.fn.offset = function() {
+ if ( !this[0] ) return { top: 0, left: 0 };
+ if ( this[0] === this[0].ownerDocument.body ) return jQuery.offset.bodyOffset( this[0] );
+ jQuery.offset.initialized || jQuery.offset.initialize();
+
+ var elem = this[0], offsetParent = elem.offsetParent, prevOffsetParent = elem,
+ doc = elem.ownerDocument, computedStyle, docElem = doc.documentElement,
+ body = doc.body, defaultView = doc.defaultView,
+ prevComputedStyle = defaultView.getComputedStyle(elem, null),
+ top = elem.offsetTop, left = elem.offsetLeft;
+
+ while ( (elem = elem.parentNode) && elem !== body && elem !== docElem ) {
+ computedStyle = defaultView.getComputedStyle(elem, null);
+ top -= elem.scrollTop, left -= elem.scrollLeft;
+ if ( elem === offsetParent ) {
+ top += elem.offsetTop, left += elem.offsetLeft;
+ if ( jQuery.offset.doesNotAddBorder && !(jQuery.offset.doesAddBorderForTableAndCells && /^t(able|d|h)$/i.test(elem.tagName)) )
+ top += parseInt( computedStyle.borderTopWidth, 10) || 0,
+ left += parseInt( computedStyle.borderLeftWidth, 10) || 0;
+ prevOffsetParent = offsetParent, offsetParent = elem.offsetParent;
+ }
+ if ( jQuery.offset.subtractsBorderForOverflowNotVisible && computedStyle.overflow !== "visible" )
+ top += parseInt( computedStyle.borderTopWidth, 10) || 0,
+ left += parseInt( computedStyle.borderLeftWidth, 10) || 0;
+ prevComputedStyle = computedStyle;
+ }
+
+ if ( prevComputedStyle.position === "relative" || prevComputedStyle.position === "static" )
+ top += body.offsetTop,
+ left += body.offsetLeft;
+
+ if ( prevComputedStyle.position === "fixed" )
+ top += Math.max(docElem.scrollTop, body.scrollTop),
+ left += Math.max(docElem.scrollLeft, body.scrollLeft);
+
+ return { top: top, left: left };
+ };
+
+jQuery.offset = {
+ initialize: function() {
+ if ( this.initialized ) return;
+ var body = document.body, container = document.createElement('div'), innerDiv, checkDiv, table, td, rules, prop, bodyMarginTop = body.style.marginTop,
+ html = '<div style="position:absolute;top:0;left:0;margin:0;border:5px solid #000;padding:0;width:1px;height:1px;"><div></div></div><table style="position:absolute;top:0;left:0;margin:0;border:5px solid #000;padding:0;width:1px;height:1px;" cellpadding="0" cellspacing="0"><tr><td></td></tr></table>';
+
+ rules = { position: 'absolute', top: 0, left: 0, margin: 0, border: 0, width: '1px', height: '1px', visibility: 'hidden' };
+ for ( prop in rules ) container.style[prop] = rules[prop];
+
+ container.innerHTML = html;
+ body.insertBefore(container, body.firstChild);
+ innerDiv = container.firstChild, checkDiv = innerDiv.firstChild, td = innerDiv.nextSibling.firstChild.firstChild;
+
+ this.doesNotAddBorder = (checkDiv.offsetTop !== 5);
+ this.doesAddBorderForTableAndCells = (td.offsetTop === 5);
+
+ innerDiv.style.overflow = 'hidden', innerDiv.style.position = 'relative';
+ this.subtractsBorderForOverflowNotVisible = (checkDiv.offsetTop === -5);
+
+ body.style.marginTop = '1px';
+ this.doesNotIncludeMarginInBodyOffset = (body.offsetTop === 0);
+ body.style.marginTop = bodyMarginTop;
+
+ body.removeChild(container);
+ this.initialized = true;
+ },
+
+ bodyOffset: function(body) {
+ jQuery.offset.initialized || jQuery.offset.initialize();
+ var top = body.offsetTop, left = body.offsetLeft;
+ if ( jQuery.offset.doesNotIncludeMarginInBodyOffset )
+ top += parseInt( jQuery.curCSS(body, 'marginTop', true), 10 ) || 0,
+ left += parseInt( jQuery.curCSS(body, 'marginLeft', true), 10 ) || 0;
+ return { top: top, left: left };
+ }
+};
+
+
+jQuery.fn.extend({
+ position: function() {
+ var left = 0, top = 0, results;
+
+ if ( this[0] ) {
+ // Get *real* offsetParent
+ var offsetParent = this.offsetParent(),
+
+ // Get correct offsets
+ offset = this.offset(),
+ parentOffset = /^body|html$/i.test(offsetParent[0].tagName) ? { top: 0, left: 0 } : offsetParent.offset();
+
+ // Subtract element margins
+ // note: when an element has margin: auto the offsetLeft and marginLeft
+ // are the same in Safari causing offset.left to incorrectly be 0
+ offset.top -= num( this, 'marginTop' );
+ offset.left -= num( this, 'marginLeft' );
+
+ // Add offsetParent borders
+ parentOffset.top += num( offsetParent, 'borderTopWidth' );
+ parentOffset.left += num( offsetParent, 'borderLeftWidth' );
+
+ // Subtract the two offsets
+ results = {
+ top: offset.top - parentOffset.top,
+ left: offset.left - parentOffset.left
+ };
+ }
+
+ return results;
+ },
+
+ offsetParent: function() {
+ var offsetParent = this[0].offsetParent || document.body;
+ while ( offsetParent && (!/^body|html$/i.test(offsetParent.tagName) && jQuery.css(offsetParent, 'position') == 'static') )
+ offsetParent = offsetParent.offsetParent;
+ return jQuery(offsetParent);
+ }
+});
+
+
+// Create scrollLeft and scrollTop methods
+jQuery.each( ['Left', 'Top'], function(i, name) {
+ var method = 'scroll' + name;
+
+ jQuery.fn[ method ] = function(val) {
+ if (!this[0]) return null;
+
+ return val !== undefined ?
+
+ // Set the scroll offset
+ this.each(function() {
+ this == window || this == document ?
+ window.scrollTo(
+ !i ? val : jQuery(window).scrollLeft(),
+ i ? val : jQuery(window).scrollTop()
+ ) :
+ this[ method ] = val;
+ }) :
+
+ // Return the scroll offset
+ this[0] == window || this[0] == document ?
+ self[ i ? 'pageYOffset' : 'pageXOffset' ] ||
+ jQuery.boxModel && document.documentElement[ method ] ||
+ document.body[ method ] :
+ this[0][ method ];
+ };
+});
+// Create innerHeight, innerWidth, outerHeight and outerWidth methods
+jQuery.each([ "Height", "Width" ], function(i, name){
+
+ var tl = i ? "Left" : "Top", // top or left
+ br = i ? "Right" : "Bottom", // bottom or right
+ lower = name.toLowerCase();
+
+ // innerHeight and innerWidth
+ jQuery.fn["inner" + name] = function(){
+ return this[0] ?
+ jQuery.css( this[0], lower, false, "padding" ) :
+ null;
+ };
+
+ // outerHeight and outerWidth
+ jQuery.fn["outer" + name] = function(margin) {
+ return this[0] ?
+ jQuery.css( this[0], lower, false, margin ? "margin" : "border" ) :
+ null;
+ };
+
+ var type = name.toLowerCase();
+
+ jQuery.fn[ type ] = function( size ) {
+ // Get window width or height
+ return this[0] == window ?
+ // Everyone else use document.documentElement or document.body depending on Quirks vs Standards mode
+ document.compatMode == "CSS1Compat" && document.documentElement[ "client" + name ] ||
+ document.body[ "client" + name ] :
+
+ // Get document width or height
+ this[0] == document ?
+ // Either scroll[Width/Height] or offset[Width/Height], whichever is greater
+ Math.max(
+ document.documentElement["client" + name],
+ document.body["scroll" + name], document.documentElement["scroll" + name],
+ document.body["offset" + name], document.documentElement["offset" + name]
+ ) :
+
+ // Get or set width or height on the element
+ size === undefined ?
+ // Get width or height on the element
+ (this.length ? jQuery.css( this[0], type ) : null) :
+
+ // Set the width or height on the element (default to pixels if value is unitless)
+ this.css( type, typeof size === "string" ? size : size + "px" );
+ };
+
+});
+})();
Added: root/framework/trunk/impl/src/main/resources/META-INF/resources/richfaces.js/4_0_0.js
===================================================================
--- root/framework/trunk/impl/src/main/resources/META-INF/resources/richfaces.js/4_0_0.js (rev 0)
+++ root/framework/trunk/impl/src/main/resources/META-INF/resources/richfaces.js/4_0_0.js 2009-07-23 17:22:34 UTC (rev 14991)
@@ -0,0 +1,45 @@
+(function(richFaces, jQuery) {
+ //form.js
+ richFaces.submitForm = function(form, parameters, target) {
+ if (typeof form === "string") { form = jQuery(form) };
+ var initialTarget = form.attr("target");
+ var parameterInputs = new Array();
+ try {
+ form.attr("target", target);
+
+ if (parameters) {
+ for (var parameterName in parameters) {
+ var parameterValue = parameters[parameterName];
+
+ var input = jQuery("input[name='" + parameterName + "']", form);
+ if (input.length == 0) {
+ var newInput = jQuery("<input type='hidden' name='" + parameterName + "' id='" + parameterName + "' value='" + parameterValue + "' />");
+ if (parameterName === 'javax.faces.portletbridge.STATE_ID' /* fix for fileUpload in portlets */) {
+ input = newInput.prependTo(form);
+ } else {
+ input = newInput.appendTo(form);
+ }
+ } else {
+ input.val(parameterValue);
+ }
+
+ input.each(function() {parameterInputs.push(this)});
+ }
+ }
+
+ //TODO: inline onsubmit handler is not triggered - http://dev.jquery.com/ticket/4930
+ form.trigger("submit");
+ } finally {
+ form.attr("target", initialTarget);
+ jQuery(parameterInputs).remove();
+ }
+ };
+ //
+
+ //utils.js
+ richfaces.clonePosition = function(element, baseElement, positioning, offset) {
+
+ };
+ //
+}(window.RichFaces = {}, jQuery));
+
15 years, 5 months
JBoss Rich Faces SVN: r14990 - in root/framework/trunk: impl/src/main/java/org/ajax4jsf and 4 other directories.
by richfaces-svn-commits@lists.jboss.org
Author: nbelaevski
Date: 2009-07-23 13:14:59 -0400 (Thu, 23 Jul 2009)
New Revision: 14990
Removed:
root/framework/trunk/api/src/main/java/org/ajax4jsf/renderkit/HeaderResourceProducer.java
root/framework/trunk/api/src/main/java/org/ajax4jsf/renderkit/HeaderResourceProducer2.java
root/framework/trunk/api/src/main/java/org/ajax4jsf/renderkit/ProducerContext.java
root/framework/trunk/api/src/main/java/org/ajax4jsf/renderkit/UserResourceRenderer.java
root/framework/trunk/api/src/main/java/org/ajax4jsf/renderkit/UserResourceRenderer2.java
root/framework/trunk/impl/src/main/java/org/ajax4jsf/org/
root/framework/trunk/impl/src/main/java/org/ajax4jsf/renderkit/HeaderResourcesRendererBase.java
root/framework/trunk/impl/src/main/java/org/ajax4jsf/renderkit/ProducerContextImpl.java
root/framework/trunk/impl/src/main/java/org/ajax4jsf/renderkit/PrototypeBasedRendererBase.java
root/framework/trunk/impl/src/main/java/org/ajax4jsf/xml/
root/framework/trunk/impl/src/main/java/org/richfaces/model/
Modified:
root/framework/trunk/impl/src/main/java/org/ajax4jsf/context/ViewResources.java
root/framework/trunk/impl/src/main/java/org/ajax4jsf/renderkit/AjaxComponentRendererBase.java
root/framework/trunk/impl/src/main/java/org/richfaces/renderkit/TemplateEncoderRendererBase.java
Log:
https://jira.jboss.org/jira/browse/RF-7563
Deleted: root/framework/trunk/api/src/main/java/org/ajax4jsf/renderkit/HeaderResourceProducer.java
===================================================================
--- root/framework/trunk/api/src/main/java/org/ajax4jsf/renderkit/HeaderResourceProducer.java 2009-07-23 17:08:50 UTC (rev 14989)
+++ root/framework/trunk/api/src/main/java/org/ajax4jsf/renderkit/HeaderResourceProducer.java 2009-07-23 17:14:59 UTC (rev 14990)
@@ -1,55 +0,0 @@
-/**
- * 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.ajax4jsf.renderkit;
-
-import java.util.LinkedHashSet;
-
-import javax.faces.component.UIComponent;
-import javax.faces.context.FacesContext;
-
-/**
- * Interface for renderers, for wich nessesary insert script or style resource in header.
- * @author asmirnov(a)exadel.com (latest modification by $Author: alexsmirnov $)
- * @version $Revision: 1.1.2.1 $ $Date: 2007/01/09 18:58:50 $
- *
- */
-public interface HeaderResourceProducer {
-
- /**
- * Return set of strings with URI's of nessesary scripts.
- * Use linked set to preserve insertion order
- * @param context - current faces context.
- * @param component TODO
- * @return - set of URI's or null
- */
- public LinkedHashSet<String> getHeaderScripts(FacesContext context, UIComponent component);
-
- /**
- * Return set of strings with URI's of nessesary CSS styles.
- * Use linked set to preserve insertion order.
- * @param context - current faces context.
- * @param component TODO
- * @return - set of URI's or null
- */
- public LinkedHashSet<String> getHeaderStyles(FacesContext context, UIComponent component);
-
-}
Deleted: root/framework/trunk/api/src/main/java/org/ajax4jsf/renderkit/HeaderResourceProducer2.java
===================================================================
--- root/framework/trunk/api/src/main/java/org/ajax4jsf/renderkit/HeaderResourceProducer2.java 2009-07-23 17:08:50 UTC (rev 14989)
+++ root/framework/trunk/api/src/main/java/org/ajax4jsf/renderkit/HeaderResourceProducer2.java 2009-07-23 17:14:59 UTC (rev 14990)
@@ -1,42 +0,0 @@
-/**
- * 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.ajax4jsf.renderkit;
-
-import java.io.IOException;
-import java.util.Set;
-
-import javax.faces.component.UIComponent;
-import javax.faces.context.FacesContext;
-
-import org.ajax4jsf.resource.InternetResource;
-
-/**
- * Interface for renderers, for wich nessesary insert script or style resource in header.
- * This is the second revision of {@link HeaderResourceProducer} interface that returns
- * arrays of {@link InternetResource} instead of {@link Set}
- * @author nbelaevski(a)exadel.com
- *
- */
-public interface HeaderResourceProducer2 {
-
- public void encodeToHead(FacesContext context, UIComponent component, ProducerContext pc) throws IOException;
-}
Deleted: root/framework/trunk/api/src/main/java/org/ajax4jsf/renderkit/ProducerContext.java
===================================================================
--- root/framework/trunk/api/src/main/java/org/ajax4jsf/renderkit/ProducerContext.java 2009-07-23 17:08:50 UTC (rev 14989)
+++ root/framework/trunk/api/src/main/java/org/ajax4jsf/renderkit/ProducerContext.java 2009-07-23 17:14:59 UTC (rev 14990)
@@ -1,35 +0,0 @@
-/**
- * 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.ajax4jsf.renderkit;
-
-
-/**
- * @author Nick Belaevski
- * @since 3.2.2
- */
-
-public interface ProducerContext {
-
- public boolean isProcessStyles();
-
- public boolean isProcessScripts();
-}
Deleted: root/framework/trunk/api/src/main/java/org/ajax4jsf/renderkit/UserResourceRenderer.java
===================================================================
--- root/framework/trunk/api/src/main/java/org/ajax4jsf/renderkit/UserResourceRenderer.java 2009-07-23 17:08:50 UTC (rev 14989)
+++ root/framework/trunk/api/src/main/java/org/ajax4jsf/renderkit/UserResourceRenderer.java 2009-07-23 17:14:59 UTC (rev 14990)
@@ -1,54 +0,0 @@
-/**
- * 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.ajax4jsf.renderkit;
-
-import java.util.LinkedHashSet;
-
-import javax.faces.component.UIComponent;
-import javax.faces.context.FacesContext;
-
-/**
- * Marker interface for a user-defined resources for a HTML HEAD tag.
- * There resourses must be loaded AFTER all other components.
- * @author asmirnov
- *
- */
-public interface UserResourceRenderer {
-
- /**
- * Return set of strings with URI's of nessesary scripts.
- * Use linked set to preserve insertion order
- * @param context - current faces context.
- * @param component TODO
- * @return - set of URI's or null
- */
- public LinkedHashSet<String> getHeaderScripts(FacesContext context, UIComponent component);
-
- /**
- * Return set of strings with URI's of nessesary CSS styles.
- * Use linked set to preserve insertion order.
- * @param context - current faces context.
- * @param component TODO
- * @return - set of URI's or null
- */
- public LinkedHashSet<String> getHeaderStyles(FacesContext context, UIComponent component);
-
-}
Deleted: root/framework/trunk/api/src/main/java/org/ajax4jsf/renderkit/UserResourceRenderer2.java
===================================================================
--- root/framework/trunk/api/src/main/java/org/ajax4jsf/renderkit/UserResourceRenderer2.java 2009-07-23 17:08:50 UTC (rev 14989)
+++ root/framework/trunk/api/src/main/java/org/ajax4jsf/renderkit/UserResourceRenderer2.java 2009-07-23 17:14:59 UTC (rev 14990)
@@ -1,42 +0,0 @@
-/**
- * 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.ajax4jsf.renderkit;
-
-import java.io.IOException;
-import java.util.Set;
-
-import javax.faces.component.UIComponent;
-import javax.faces.context.FacesContext;
-
-import org.ajax4jsf.resource.InternetResource;
-
-/**
- * Marker interface for a user-defined resources for a HTML HEAD tag.
- * There resourses must be loaded AFTER all other components.
- * This is the second revision of {@link UserResourceRenderer} interface that returns
- * arrays of {@link InternetResource} instead of {@link Set}
- * @author nbelaevski(a)exadel.com
- *
- */
-public interface UserResourceRenderer2 {
-
- public void encodeToHead(FacesContext context, UIComponent component) throws IOException;
-}
Modified: root/framework/trunk/impl/src/main/java/org/ajax4jsf/context/ViewResources.java
===================================================================
--- root/framework/trunk/impl/src/main/java/org/ajax4jsf/context/ViewResources.java 2009-07-23 17:08:50 UTC (rev 14989)
+++ root/framework/trunk/impl/src/main/java/org/ajax4jsf/context/ViewResources.java 2009-07-23 17:14:59 UTC (rev 14990)
@@ -47,12 +47,6 @@
import org.ajax4jsf.component.QueueRegistry;
import org.ajax4jsf.io.SAXResponseWriter;
-import org.ajax4jsf.renderkit.HeaderResourceProducer;
-import org.ajax4jsf.renderkit.HeaderResourceProducer2;
-import org.ajax4jsf.renderkit.ProducerContext;
-import org.ajax4jsf.renderkit.ProducerContextImpl;
-import org.ajax4jsf.renderkit.UserResourceRenderer;
-import org.ajax4jsf.renderkit.UserResourceRenderer2;
import org.ajax4jsf.renderkit.RendererUtils.HTML;
import org.ajax4jsf.resource.InternetResource;
import org.ajax4jsf.resource.InternetResourceBase;
@@ -72,7 +66,7 @@
/**
* @author Nick Belaevski
*/
-
+//TODO remove - https://jira.jboss.org/jira/browse/RFPL-42
public class ViewResources {
private static final String INIT_PARAMETER_PREFIX = "_init_parameter_";
@@ -243,8 +237,6 @@
private boolean ajaxRequest;
- private ProducerContext producerContext;
-
public static final String COMPONENT_RESOURCE_LINK_CLASS = "component";
public static final String USER_RESOURCE_LINK_CLASS = "user";
@@ -305,59 +297,6 @@
return false;
}
- protected void processComponent(FacesContext context, UIComponent component) throws IOException, FacesException {
- Renderer renderer = getRenderer(context, component);
- if (null != renderer) {
- ResponseWriter oldResponseWriter = context.getResponseWriter();
- try {
- if ((processScripts || processStyles)
- && (renderer instanceof HeaderResourceProducer2 || renderer instanceof HeaderResourceProducer)) {
-
- context.setResponseWriter(componentWriter);
-
- if (renderer instanceof HeaderResourceProducer2) {
- HeaderResourceProducer2 producer = (HeaderResourceProducer2) renderer;
-
- if (producerContext == null) {
- producerContext = new ProducerContextImpl(processScripts, processStyles);
- }
-
- producer.encodeToHead(context, component, producerContext);
- } else if (renderer instanceof HeaderResourceProducer) {
- HeaderResourceProducer producer = (HeaderResourceProducer) renderer;
-
- if (processScripts) {
- encodeResources(context, resourceBuilder.getScriptRenderer(), producer.getHeaderScripts(context,
- component));
- }
- if (processStyles) {
- encodeResources(context, resourceBuilder.getStyleRenderer(), producer.getHeaderStyles(context,
- component));
- }
- }
- } else if (renderer instanceof UserResourceRenderer2) {
- context.setResponseWriter(userWriter);
-
- UserResourceRenderer2 producer = (UserResourceRenderer2) renderer;
- producer.encodeToHead(context, component);
- } else if (renderer instanceof UserResourceRenderer) {
- context.setResponseWriter(userWriter);
-
- UserResourceRenderer producer = (UserResourceRenderer) renderer;
-
- encodeResources(context, resourceBuilder.getScriptRenderer(), producer.getHeaderScripts(context,
- component));
-
- encodeResources(context, resourceBuilder.getStyleRenderer(), producer.getHeaderStyles(context,
- component));
- }
- } finally {
- context.setResponseWriter(oldResponseWriter);
- }
- }
-
- }
-
/**
* Find renderer for given component.
*
@@ -376,24 +315,6 @@
}
}
- protected void traverse(FacesContext context, UIComponent component) throws IOException, FacesException {
- if (component != null) {
- processComponent(context, component);
-
- if (component.getChildCount() > 0) {
- for (UIComponent child : component.getChildren()) {
- traverse(context, child);
- }
- }
-
- if (component.getFacetCount() > 0) {
- for (UIComponent child : component.getFacets().values()) {
- traverse(context, child);
- }
- }
- }
- }
-
public void processHeadResources(FacesContext context) throws FacesException {
RenderKitFactory rkFactory = (RenderKitFactory) FactoryFinder
@@ -511,7 +432,7 @@
}
//traverse components
- traverse(context, context.getViewRoot());
+ //traverse(context, context.getViewRoot());
context.setResponseWriter(componentWriter);
Modified: root/framework/trunk/impl/src/main/java/org/ajax4jsf/renderkit/AjaxComponentRendererBase.java
===================================================================
--- root/framework/trunk/impl/src/main/java/org/ajax4jsf/renderkit/AjaxComponentRendererBase.java 2009-07-23 17:08:50 UTC (rev 14989)
+++ root/framework/trunk/impl/src/main/java/org/ajax4jsf/renderkit/AjaxComponentRendererBase.java 2009-07-23 17:14:59 UTC (rev 14990)
@@ -32,7 +32,7 @@
* @version $Revision: 1.1.2.1 $ $Date: 2007/01/09 18:58:49 $
*
*/
-public abstract class AjaxComponentRendererBase extends HeaderResourcesRendererBase implements HeaderResourceProducer2 {
+public abstract class AjaxComponentRendererBase extends RendererBase {
// private InternetResource ajaxScript = getResource("/com/exadel/vcp/framework/ajax/scripts/AJAX.js");
private static final String AJAX_SCRIPT = AjaxScript.class.getName();
Deleted: root/framework/trunk/impl/src/main/java/org/ajax4jsf/renderkit/HeaderResourcesRendererBase.java
===================================================================
--- root/framework/trunk/impl/src/main/java/org/ajax4jsf/renderkit/HeaderResourcesRendererBase.java 2009-07-23 17:08:50 UTC (rev 14989)
+++ root/framework/trunk/impl/src/main/java/org/ajax4jsf/renderkit/HeaderResourcesRendererBase.java 2009-07-23 17:14:59 UTC (rev 14990)
@@ -1,156 +0,0 @@
-/**
- * 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.ajax4jsf.renderkit;
-
-import java.io.IOException;
-import java.util.LinkedHashSet;
-
-import javax.faces.component.UIComponent;
-import javax.faces.context.FacesContext;
-
-import org.ajax4jsf.resource.InternetResource;
-
-/**
- * Base renderer for components used JavaScripts and Styles in header. In real
- * class override getScripts or/and getStyles methods
- *
- * @author asmirnov(a)exadel.com (latest modification by $Author: alexsmirnov $)
- * @version $Revision: 1.1.2.1 $ $Date: 2007/01/09 18:58:51 $
- *
- */
-public abstract class HeaderResourcesRendererBase extends RendererBase
- implements HeaderResourceProducer2, HeaderResourceProducer {
-
- /*
- * (non-Javadoc)
- *
- * @see org.ajax4jsf.renderkit.HeaderResourceProducer#getHeaderScripts(javax.faces.context.FacesContext)
- */
- public LinkedHashSet<String> getHeaderScripts(FacesContext context,
- UIComponent component) {
- return getUrisSet(context, getScripts(), component);
- }
-
- /**
- * Hoock method to return array of scripts resources to store in head.
- *
- * @return
- */
- protected InternetResource[] getScripts() {
- // return nothing by default.
- return null;
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.ajax4jsf.renderkit.HeaderResourceProducer#getHeaderStyles(javax.faces.context.FacesContext)
- */
- public LinkedHashSet<String> getHeaderStyles(FacesContext context,
- UIComponent component) {
- return getUrisSet(context, getStyles(), component);
- }
-
- /**
- * Hoock method to return array of styles resources to store in head
- *
- * @return
- */
- protected InternetResource[] getStyles() {
- // TODO Auto-generated method stub
- return null;
- }
-
- /**
- * @param context
- * @param resources
- * @param component
- * TODO
- * @return
- */
- private LinkedHashSet<String> getUrisSet(FacesContext context,
- InternetResource[] resources, UIComponent component) {
- if (null != resources) {
- LinkedHashSet<String> uris = new LinkedHashSet<String>(); // Collections.singleton(ajaxScript.getUri(context,
- // null));
- for (int i = 0; i < resources.length; i++) {
- InternetResource resource = resources[i];
- uris.add(resource.getUri(context, component));
- }
- return uris;
- }
- return null;
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.ajax4jsf.renderkit.RendererBase#preEncodeBegin(javax.faces.context.FacesContext,
- * javax.faces.component.UIComponent)
- */
-// protected void preEncodeBegin(FacesContext context, UIComponent component)
-// throws IOException {
-// if ((null == context.getExternalContext().getRequestMap().get(
-// BaseFilter.RESPONSE_WRAPPER_ATTRIBUTE))
-// /* && (!AjaxRendererUtils.isAjaxRequest(context)) */) {
-// // Filter not used - encode scripts and CSS before component.
-// ExternalContext externalContext = context.getExternalContext();
-// String scriptStrategy = externalContext
-// .getInitParameter(InternetResourceBuilder.LOAD_SCRIPT_STRATEGY_PARAM);
-// if (null == scriptStrategy || !InternetResourceBuilder.LOAD_NONE.equals(scriptStrategy)) {
-// encodeResourcesArray(context, component, getScripts());
-// }
-// String styleStrategy = externalContext
-// .getInitParameter(InternetResourceBuilder.LOAD_STYLE_STRATEGY_PARAM);
-// if (null != styleStrategy || !InternetResourceBuilder.LOAD_NONE.equals(styleStrategy)) {
-// encodeResourcesArray(context, component, getStyles());
-// }
-// }
-// }
-
- /**
- * @param context
- * @param component
- * @param resources
- * @throws IOException
- */
- protected void encodeResourcesArray(FacesContext context,
- UIComponent component, InternetResource[] resources)
- throws IOException {
- if (resources != null) {
- for (int i = 0; i < resources.length; i++) {
- resources[i].encode(context, component);
- }
- }
- }
-
- public void encodeToHead(FacesContext context, UIComponent component, ProducerContext pc) throws IOException {
-
- if (pc.isProcessScripts()) {
- encodeResourcesArray(context, component, getScripts());
- }
-
- if (pc.isProcessStyles()) {
- encodeResourcesArray(context, component, getStyles());
- }
- }
-}
Deleted: root/framework/trunk/impl/src/main/java/org/ajax4jsf/renderkit/ProducerContextImpl.java
===================================================================
--- root/framework/trunk/impl/src/main/java/org/ajax4jsf/renderkit/ProducerContextImpl.java 2009-07-23 17:08:50 UTC (rev 14989)
+++ root/framework/trunk/impl/src/main/java/org/ajax4jsf/renderkit/ProducerContextImpl.java 2009-07-23 17:14:59 UTC (rev 14990)
@@ -1,50 +0,0 @@
-/**
- * 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.ajax4jsf.renderkit;
-
-
-/**
- * @author Nick Belaevski
- * @since 3.2.2
- */
-
-public class ProducerContextImpl implements ProducerContext {
-
- private boolean processScripts;
-
- private boolean processStyles;
-
- public boolean isProcessScripts() {
- return processScripts;
- }
-
- public boolean isProcessStyles() {
- return processStyles;
- }
-
- public ProducerContextImpl(boolean processScripts, boolean processStyles) {
- super();
- this.processScripts = processScripts;
- this.processStyles = processStyles;
- }
-
-}
Deleted: root/framework/trunk/impl/src/main/java/org/ajax4jsf/renderkit/PrototypeBasedRendererBase.java
===================================================================
--- root/framework/trunk/impl/src/main/java/org/ajax4jsf/renderkit/PrototypeBasedRendererBase.java 2009-07-23 17:08:50 UTC (rev 14989)
+++ root/framework/trunk/impl/src/main/java/org/ajax4jsf/renderkit/PrototypeBasedRendererBase.java 2009-07-23 17:14:59 UTC (rev 14990)
@@ -1,65 +0,0 @@
-/**
- * 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.ajax4jsf.renderkit;
-
-import java.util.LinkedHashSet;
-
-import javax.faces.component.UIComponent;
-import javax.faces.context.FacesContext;
-
-import org.ajax4jsf.javascript.PrototypeScript;
-import org.ajax4jsf.resource.InternetResource;
-
-
-/**
- * @author Maksim Kaszynski
- *
- */
-public abstract class PrototypeBasedRendererBase extends RendererBase implements HeaderResourceProducer {
-
- protected static final String[] EMPTY_ARRAY = {};
- private InternetResource prototypeScript = getResource(PrototypeScript.class.getName());
-
- public LinkedHashSet<String> getHeaderScripts(FacesContext context, UIComponent component) {
- LinkedHashSet<String> scripts = new LinkedHashSet<String>() ; // Collections.singleton(ajaxScript.getUri(context, null));
- scripts.add(prototypeScript.getUri(context, null));
- String[] additionalScripts = getAdditionalScripts();
- for (int i = 0; i < additionalScripts.length; i++) {
- String resource = additionalScripts[i];
- scripts.add(getResource(resource).getUri(context, null));
- }
- return scripts;
- }
-
- /* (non-Javadoc)
- * @see org.ajax4jsf.renderkit.HeaderResourceProducer#getHeaderStyles(javax.faces.context.FacesContext)
- */
- public LinkedHashSet<String> getHeaderStyles(FacesContext context, UIComponent component) {
- // TODO Auto-generated method stub
- return null;
- }
-
- protected String[] getAdditionalScripts() {
- return EMPTY_ARRAY;
- }
-
-}
Modified: root/framework/trunk/impl/src/main/java/org/richfaces/renderkit/TemplateEncoderRendererBase.java
===================================================================
--- root/framework/trunk/impl/src/main/java/org/richfaces/renderkit/TemplateEncoderRendererBase.java 2009-07-23 17:08:50 UTC (rev 14989)
+++ root/framework/trunk/impl/src/main/java/org/richfaces/renderkit/TemplateEncoderRendererBase.java 2009-07-23 17:14:59 UTC (rev 14990)
@@ -28,7 +28,7 @@
import javax.faces.context.ResponseWriter;
import org.ajax4jsf.io.SAXResponseWriter;
-import org.ajax4jsf.renderkit.HeaderResourcesRendererBase;
+import org.ajax4jsf.renderkit.RendererBase;
import org.richfaces.component.TemplateComponent;
import org.xml.sax.ContentHandler;
@@ -37,7 +37,7 @@
* created 22.06.2007
*
*/
-public abstract class TemplateEncoderRendererBase extends HeaderResourcesRendererBase {
+public abstract class TemplateEncoderRendererBase extends RendererBase {
public final boolean getRendersChildren() {
return true;
15 years, 5 months
JBoss Rich Faces SVN: r14989 - in root/framework/trunk/impl/src: main/java/org/ajax4jsf/org and 2 other directories.
by richfaces-svn-commits@lists.jboss.org
Author: nbelaevski
Date: 2009-07-23 13:08:50 -0400 (Thu, 23 Jul 2009)
New Revision: 14989
Removed:
root/framework/trunk/impl/src/main/java/org/ajax4jsf/io/parser/
root/framework/trunk/impl/src/main/java/org/ajax4jsf/org/w3c/
root/framework/trunk/impl/src/main/java/org/ajax4jsf/xml/serializer/
root/framework/trunk/impl/src/test/java/org/ajax4jsf/io/parser/AllParsingTests.java
root/framework/trunk/impl/src/test/java/org/ajax4jsf/io/parser/ParsingTest.java
Log:
XML Serializer APIs removed - https://jira.jboss.org/jira/browse/RF-7553
Deleted: root/framework/trunk/impl/src/test/java/org/ajax4jsf/io/parser/AllParsingTests.java
===================================================================
--- root/framework/trunk/impl/src/test/java/org/ajax4jsf/io/parser/AllParsingTests.java 2009-07-23 17:02:30 UTC (rev 14988)
+++ root/framework/trunk/impl/src/test/java/org/ajax4jsf/io/parser/AllParsingTests.java 2009-07-23 17:08:50 UTC (rev 14989)
@@ -1,37 +0,0 @@
-/**
- * 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.ajax4jsf.io.parser;
-
-import junit.framework.Test;
-import junit.framework.TestSuite;
-
-public class AllParsingTests {
-
- public static Test suite() {
- TestSuite suite = new TestSuite("Test for org.ajax4jsf.io.parser");
- //$JUnit-BEGIN$
- suite.addTestSuite(ParsingTest.class);
- //$JUnit-END$
- return suite;
- }
-
-}
Deleted: root/framework/trunk/impl/src/test/java/org/ajax4jsf/io/parser/ParsingTest.java
===================================================================
--- root/framework/trunk/impl/src/test/java/org/ajax4jsf/io/parser/ParsingTest.java 2009-07-23 17:02:30 UTC (rev 14988)
+++ root/framework/trunk/impl/src/test/java/org/ajax4jsf/io/parser/ParsingTest.java 2009-07-23 17:08:50 UTC (rev 14989)
@@ -1,193 +0,0 @@
-/**
- * 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.ajax4jsf.io.parser;
-
-import java.io.IOException;
-import java.io.StringWriter;
-
-import junit.framework.TestCase;
-
-public class ParsingTest extends TestCase {
-
- ParserState initialState;
- ParsingStateManager instance;
- StringWriter out;
-
- protected void setUp() throws Exception {
- super.setUp();
- instance = ParsingStateManager.getInstance();
- initialState = instance.getInitialState();
- }
-
- protected void tearDown() throws Exception {
- super.tearDown();
- }
-
- protected ParserState parseString(String toParse) {
- char[] buff = toParse.toCharArray();
- out = new StringWriter();
- ParsingContext context = new ParsingContext(out);
- context.setBaseState(initialState);
- ParserState state = initialState;
- for (int i = 0; i < buff.length; i++) {
- char c = buff[i];
- state = state.getNextState(c,context);
- try {
- state.send(c,context);
- } catch (IOException e) {
- assertTrue("Exception on send char",false);
- e.printStackTrace();
- }
- }
- try {
- context.send();
- } catch (IOException e) {
- assertTrue("Exception on send char",false);
- e.printStackTrace();
- }
- return state;
- }
- /*
- * Test method for 'org.ajax4jsf.io.parser.ParsingStateManager.getInitialState()'
- */
- public void testGetInitialState() {
- assertSame(initialState,instance.DOCUMENT);
- }
-
- public void testParseLt(){
- ParserState state = parseString(" <");
- assertSame(state,instance.LT);
- state = parseString(" < ");
- assertSame(state,instance.DOCUMENT);
- }
-
- public void testParsePI(){
- ParserState state = parseString("<?xml version=\"1.0\" encoding=\"UTF-8\" ?>");
- assertSame(state,instance.PIEND);
- state = parseString("<?xml version=\"1.0\" encoding=\"UTF-8\" ?> ");
- assertSame(state,instance.DOCUMENT);
- state = parseString("<?xml version=\"1.0\" encoding=\"UTF-8\" ? ");
- assertSame(state,instance.PI);
- }
-
- public void testParseDOCTYPE(){
- ParserState state = parseString("<!DOC ");
- assertSame(state,instance.DOCUMENT);
- state = parseString("<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd\">");
- assertSame(state,instance.DOCTYPEEND);
- state = parseString("<!DOCTYPE html <");
- assertSame(state,instance.DOCTYPE);
- state = parseString("<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd\"> ");
- assertSame(state,instance.DOCUMENT);
- }
-
- public void testParseCDATA(){
- ParserState state = parseString("<![CDATA []]>");
- assertSame(state,instance.DOCUMENT);
- state = parseString("<![CDATA[]]>");
- assertSame(state,instance.CDATAEND);
- state = parseString("<![CDATA[ ] ]>");
- assertSame(state,instance.CDATA);
- state = parseString("<![CDATA[<?xml <!DOCTYPE html ]]> ");
- assertSame(state,instance.DOCUMENT);
- }
-
- public void testParseComment(){
- ParserState state = parseString("<!-- -->");
- assertSame(state,instance.COMMENTEND);
- state = parseString("<!-- --> ");
- assertSame(state,instance.DOCUMENT);
- state = parseString("<!-- -- >");
- assertSame(state,instance.COMMENT);
- state = parseString("<!- - -->");
- assertSame(state,instance.DOCUMENT);
- }
-
- public void testParseElement(){
- ParserState state = parseString("<foo -->");
- assertSame(state,instance.ENDELEMENT);
- state = parseString("<foo ");
- assertSame(state,instance.INELEMENT);
- state = parseString("<foo --");
- assertSame(state,instance.INELEMENTCONTENT);
- state = parseString("<foo x='<!-- ");
- assertSame(state,instance.COMMENT_ELEMENT);
- state = parseString("<foo x='<![CDATA[ ] ]> ");
- assertSame(state,instance.CDATA_ELEMENT);
- state = parseString("<foo x='<![CDATA[ ]]>' <!-- --> >");
- assertSame(state,instance.ENDELEMENT);
- }
-
- public void testParseHtml0(){
- ParserState state = parseString("<html -->");
- assertSame(state,instance.ENDELEMENT);
- }
- public void testParseHtml1(){
- ParserState state = parseString("<htmlfo");
- assertSame(state,instance.ELEMENT);
- }
- public void testParseHtml2(){
- ParserState state = parseString("<htm");
- assertSame(state,instance.HTML);
- }
- public void testParseHtml3(){
- ParserState state = parseString("<html x='<!-- ");
- assertSame(state,instance.COMMENT_ELEMENT);
- }
- public void testParseHtml4(){
- ParserState state = parseString("<html x='<![CDATA[ ] ]> ");
- assertSame(state,instance.CDATA_ELEMENT);
- }
- public void testParseHtml5(){
- ParserState state = parseString("<html x='<![CDATA[ ]]>' <!-- --> >");
- assertSame(state,instance.ENDELEMENT);
- }
-
- public void testParseHtml6(){
- ParserState state = parseString("<html --><");
- assertSame(state,instance.LT);
- }
-
-
- public void testSendParsed(){
- String toParse;
- ParserState state;
- toParse="xxx";
- state = parseString(toParse);
- assertEquals(toParse,out.toString());
- toParse="<xxx";
- state = parseString(toParse);
- assertEquals(toParse,out.toString());
- assertSame(state, instance.ELEMENT);
- toParse="<?xml version=\"1.0\" encoding=\"UTF-8\" ?>\n" +
- "<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd\">\n" +
- "<!-- Test for page comment -->\n" +
- "<f:view contentType=\"application/xhtml+xml\" \n" +
- " xmlns:f=\"http://java.sun.com/jsf/core\"\n" +
- " xmlns:h=\"http://java.sun.com/jsf/html\" \n" +
- " xmlns:a4j=\"https://ajax4jsf.dev.java.net/ajax\" >\n" +
- "<html xmlns=\"http://www.w3.org/1999/xhtml\" >\n" +
- "<body>";
- state = parseString(toParse);
- assertEquals(toParse,out.toString());
- }
-}
15 years, 5 months