JBoss Rich Faces SVN: r19605 - in sandbox/trunk/ui/calendar/ui: src/main/java and 7 other directories.
by richfaces-svn-commits@lists.jboss.org
Author: amarkhel
Date: 2010-10-19 12:05:14 -0400 (Tue, 19 Oct 2010)
New Revision: 19605
Added:
sandbox/trunk/ui/calendar/ui/src/main/java/org/
sandbox/trunk/ui/calendar/ui/src/main/java/org/richfaces/
sandbox/trunk/ui/calendar/ui/src/main/java/org/richfaces/component/
sandbox/trunk/ui/calendar/ui/src/main/java/org/richfaces/component/AbstractCalendar.java
sandbox/trunk/ui/calendar/ui/src/main/java/org/richfaces/renderkit/
sandbox/trunk/ui/calendar/ui/src/main/java/org/richfaces/renderkit/CalendarRendererBase.java
sandbox/trunk/ui/calendar/ui/src/main/java/org/richfaces/renderkit/html/
sandbox/trunk/ui/calendar/ui/src/main/java/org/richfaces/renderkit/html/images/
sandbox/trunk/ui/calendar/ui/src/main/resources/META-INF/resources/org.richfaces/calendar.ecss
Modified:
sandbox/trunk/ui/calendar/ui/pom.xml
sandbox/trunk/ui/calendar/ui/src/main/templates/calendar.template.xml
Log:
calendar renderer/ui/template initial commit
Modified: sandbox/trunk/ui/calendar/ui/pom.xml
===================================================================
--- sandbox/trunk/ui/calendar/ui/pom.xml 2010-10-19 12:56:00 UTC (rev 19604)
+++ sandbox/trunk/ui/calendar/ui/pom.xml 2010-10-19 16:05:14 UTC (rev 19605)
@@ -52,6 +52,10 @@
<artifactId>richfaces-core-api</artifactId>
</dependency>
<dependency>
+ <groupId>org.richfaces.core</groupId>
+ <artifactId>richfaces-core-impl</artifactId>
+ </dependency>
+ <dependency>
<groupId>org.richfaces.ui.common</groupId>
<artifactId>richfaces-ui-common-ui</artifactId>
</dependency>
Added: sandbox/trunk/ui/calendar/ui/src/main/java/org/richfaces/component/AbstractCalendar.java
===================================================================
--- sandbox/trunk/ui/calendar/ui/src/main/java/org/richfaces/component/AbstractCalendar.java (rev 0)
+++ sandbox/trunk/ui/calendar/ui/src/main/java/org/richfaces/component/AbstractCalendar.java 2010-10-19 16:05:14 UTC (rev 19605)
@@ -0,0 +1,172 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc. and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software 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 software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+
+
+package org.richfaces.component;
+
+import java.util.Locale;
+import java.util.TimeZone;
+
+import javax.faces.component.UIInput;
+
+import org.richfaces.cdk.annotations.Attribute;
+import org.richfaces.cdk.annotations.EventName;
+import org.richfaces.cdk.annotations.JsfComponent;
+import org.richfaces.cdk.annotations.JsfRenderer;
+import org.richfaces.cdk.annotations.Tag;
+
+/**
+ * @author amarkhel
+ *
+ */
+
+@JsfComponent(
+ type = AbstractCalendar.COMPONENT_TYPE,
+ family = AbstractCalendar.COMPONENT_FAMILY,
+ generate = "org.richfaces.component.UICalendar",
+ renderer = @JsfRenderer(type = "org.richfaces.CalendarRenderer"),
+ tag = @Tag(name="calendar")
+)
+public abstract class AbstractCalendar extends UIInput{
+
+ public static final String COMPONENT_TYPE = "org.richfaces.Calendar";
+
+ public static final String COMPONENT_FAMILY = "org.richfaces.Calendar";
+
+ private static final String DEFAULT_TIME_PATTERN = "HH:mm";
+
+
+ @Attribute(defaultValue=DEFAULT_TIME_PATTERN)
+ public abstract String getDatePattern();
+
+ @Attribute
+ public abstract Object getLocale();
+
+ @Attribute
+ public abstract TimeZone getTimeZone();
+
+ @Attribute
+ public abstract boolean isDisabled();
+
+ @Attribute
+ public abstract boolean isShowInput();
+
+ @Attribute
+ public abstract boolean isPopup();
+
+ @Attribute
+ public abstract boolean isEnableManualInput();
+
+ @Attribute
+ public abstract String getTabindex();
+
+ @Attribute
+ public abstract String getInputStyle();
+
+ @Attribute
+ public abstract String getButtonClass();
+
+ @Attribute
+ public abstract String getInputClass();
+
+ @Attribute
+ public abstract String getButtonLabel();
+
+ @Attribute
+ public abstract String getInputSize();
+
+ @Attribute
+ public abstract Object getCurrentDate();
+
+ @Attribute
+ public abstract String getButtonIcon();
+
+ @Attribute
+ public abstract String getButtonIconDisabled();
+
+ @Attribute(events=@EventName("inputclick"))
+ public abstract String getOninputclick();
+
+ @Attribute(events=@EventName("inputdblclick"))
+ public abstract String getOninputdblclick();
+
+ @Attribute(events=@EventName("inputchange"))
+ public abstract String getOninputchange();
+
+ @Attribute(events=@EventName("inputselect"))
+ public abstract String getOninputselect();
+
+ @Attribute(events=@EventName("inputmousedown"))
+ public abstract String getOninputmousedown();
+
+ @Attribute(events=@EventName("inputmousemove"))
+ public abstract String getOninputmousemove();
+
+ @Attribute(events=@EventName("inputmouseout"))
+ public abstract String getOninputmouseout();
+
+ @Attribute(events=@EventName("inputmouseover"))
+ public abstract String getOninputmouseover();
+
+ @Attribute(events=@EventName("inputmouseup"))
+ public abstract String getOninputmouseup();
+
+ @Attribute(events=@EventName("inputkeydown"))
+ public abstract String getOninputkeydown();
+
+ @Attribute(events=@EventName("inputkeypress"))
+ public abstract String getOninputkeypress();
+
+ @Attribute(events=@EventName("inputkeyup"))
+ public abstract String getOninputkeypup();
+
+ @Attribute(events=@EventName("inputfocus"))
+ public abstract String getOninputfocus();
+
+ @Attribute(events=@EventName("inputblur"))
+ public abstract String getOninputblur();
+
+ public Locale getAsLocale(Object locale) {
+ /*
+ if (locale instanceof Locale) {
+ return (Locale) locale;
+
+ } else if (locale instanceof String) {
+
+ return parseLocale((String) locale);
+
+ } else {
+
+ FacesContext context = FacesContext.getCurrentInstance();
+ Application application = context.getApplication();
+ Converter converter = application .createConverter(locale.getClass());
+ if (null != converter) {
+ return parseLocale(converter.getAsString(context, this, locale));
+ } else {
+ throw new FacesException(
+ "Wrong locale attibute type or there is no converter for custom attibute type");
+ }
+ }*/
+ return null;
+ }
+
+}
Added: sandbox/trunk/ui/calendar/ui/src/main/java/org/richfaces/renderkit/CalendarRendererBase.java
===================================================================
--- sandbox/trunk/ui/calendar/ui/src/main/java/org/richfaces/renderkit/CalendarRendererBase.java (rev 0)
+++ sandbox/trunk/ui/calendar/ui/src/main/java/org/richfaces/renderkit/CalendarRendererBase.java 2010-10-19 16:05:14 UTC (rev 19605)
@@ -0,0 +1,173 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc. and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software 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 software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+
+package org.richfaces.renderkit;
+
+import java.io.IOException;
+import java.util.Collections;
+import java.util.Date;
+import java.util.Map;
+
+import javax.faces.application.ResourceDependencies;
+import javax.faces.application.ResourceDependency;
+import javax.faces.component.UIComponent;
+import javax.faces.context.FacesContext;
+import javax.faces.convert.Converter;
+import javax.faces.convert.ConverterException;
+import javax.faces.convert.DateTimeConverter;
+
+import org.richfaces.component.AbstractCalendar;
+import org.richfaces.component.util.SelectUtils;
+import org.richfaces.component.util.ViewUtil;
+
+/**
+ * @author amarkhel
+ *
+ */
+
+@ResourceDependencies({ @ResourceDependency(library = "javax.faces", name = "jsf.js"),
+ @ResourceDependency(name = "jquery.position.js"),
+ @ResourceDependency(name = "richfaces-event.js"),
+ @ResourceDependency(library = "org.richfaces", name = "json-dom.js"),
+ @ResourceDependency(library = "org.richfaces", name = "jquery.effects.core.js"),
+ @ResourceDependency(library = "org.richfaces", name = "jquery.effects.highlight.js"),
+ @ResourceDependency(library = "org.richfaces", name = "JQuerySpinBtn.js.js"),
+ @ResourceDependency(library = "org.richfaces", name = "calendar-utils.js"),
+ @ResourceDependency(library = "org.richfaces", name = "calendar.js"),
+ @ResourceDependency(library = "org.richfaces", name = "calendar.ecss") })
+public class CalendarRendererBase extends InputRendererBase {
+
+ protected static final Map<String, ComponentAttribute> CALENDAR_INPUT_HANDLER_ATTRIBUTES = Collections.unmodifiableMap(ComponentAttribute.createMap(
+ new ComponentAttribute(HtmlConstants.ONCLICK_ATTRIBUTE)
+ .setEventNames("inputclick")
+ .setComponentAttributeName("oninputclick"),
+ new ComponentAttribute(HtmlConstants.ONDBLCLICK_ATTRIBUTE)
+ .setEventNames("inputdblclick")
+ .setComponentAttributeName("oninputdblclick"),
+ new ComponentAttribute(HtmlConstants.ONMOUSEDOWN_ATTRIBUTE)
+ .setEventNames("inputmousedown")
+ .setComponentAttributeName("oninputmousedown"),
+ new ComponentAttribute(HtmlConstants.ONMOUSEUP_ATTRIBUTE)
+ .setEventNames("inputmouseup")
+ .setComponentAttributeName("oninputmouseup"),
+ new ComponentAttribute(HtmlConstants.ONMOUSEOVER_ATTRIBUTE)
+ .setEventNames("inputmouseover")
+ .setComponentAttributeName("oninputmouseover"),
+ new ComponentAttribute(HtmlConstants.ONMOUSEMOVE_ATTRIBUTE)
+ .setEventNames("inputmousemove")
+ .setComponentAttributeName("oninputmousemove"),
+ new ComponentAttribute(HtmlConstants.ONMOUSEOUT_ATTRIBUTE)
+ .setEventNames("inputmouseout")
+ .setComponentAttributeName("oninputmouseout"),
+ new ComponentAttribute(HtmlConstants.ONKEYPRESS_ATTRIBUTE)
+ .setEventNames("inputkeypress")
+ .setComponentAttributeName("oninputkeypress"),
+ new ComponentAttribute(HtmlConstants.ONKEYDOWN_ATTRIBUTE)
+ .setEventNames("inputkeydown")
+ .setComponentAttributeName("oninputkeydown"),
+ new ComponentAttribute(HtmlConstants.ONKEYUP_ATTRIBUTE)
+ .setEventNames("inputkeyup")
+ .setComponentAttributeName("oninputkeyup"),
+ new ComponentAttribute(HtmlConstants.ONBLUR_ATTRIBUTE)
+ .setEventNames("inputblur")
+ .setComponentAttributeName("oninputblur"),
+ new ComponentAttribute(HtmlConstants.ONFOCUS_ATTRIBUTE)
+ .setEventNames("inputfocus")
+ .setComponentAttributeName("oninputfocus"),
+ new ComponentAttribute(HtmlConstants.ONCHANGE_ATTRIBUTE)
+ .setEventNames("inputchange")
+ .setComponentAttributeName("oninputchange"),
+ new ComponentAttribute(HtmlConstants.ONSELECT_ATTRIBUTE)
+ .setEventNames("inputselect")
+ .setComponentAttributeName("oninputselect")));
+
+
+ public void renderInputHandlers(FacesContext facesContext, UIComponent component) throws IOException {
+ RenderKitUtils.renderPassThroughAttributesOptimized(facesContext, component, CALENDAR_INPUT_HANDLER_ATTRIBUTES);
+ }
+
+ @Override
+ public Object getConvertedValue(FacesContext context, UIComponent component, Object submittedValue) throws ConverterException {
+ if ((context == null) || (component == null)) {
+ throw new NullPointerException();
+ }
+
+ // skip conversion of already converted date
+ if (submittedValue instanceof Date) {
+ return (Date) submittedValue;
+ }
+
+ // Store submitted value in the local variable as a string
+ String newValue = (String) submittedValue;
+ // if we have no local value, try to get the valueExpression.
+ AbstractCalendar calendar = (AbstractCalendar) component;
+ Converter converter = SelectUtils.getConverterForProperty(context, calendar, "value");
+
+ // in case the converter hasn't been set, try to use default
+ // DateTimeConverter
+ if (converter == null) {
+ converter = createDefaultConverter();
+ }
+ setupDefaultConverter(converter, calendar);
+
+ return converter.getAsObject(context, component, newValue);
+ }
+
+ public String getButtonIcon(FacesContext facesContext, UIComponent component) {
+ boolean disable = (Boolean)component.getAttributes().get("disable");
+ String buttonIcon = (String)component.getAttributes().get("buttonIcon");
+ if(disable) {
+ buttonIcon = (String)component.getAttributes().get("buttonIconDisabled");
+ }
+ //TODO: add default icon
+ return (buttonIcon != null && !"".equals(buttonIcon)) ? getResourcePath(facesContext, buttonIcon) : "";
+ }
+
+ protected String getResourcePath(FacesContext facesContext, String source) {
+ return (source != null && !"".equals(source)) ? ViewUtil.getResourceURL(source, facesContext) :"" ;
+ }
+
+ public boolean isUseIcons(FacesContext facesContext, UIComponent component) {
+ Object label = component.getAttributes().get("buttonLabel");
+ return (label == null || ((String)label).trim().length() == 0);
+ }
+
+ protected static Converter createDefaultConverter() {
+ return new DateTimeConverter();
+ }
+
+ protected static Converter setupDefaultConverter(Converter converter, AbstractCalendar calendar) {
+ // skip id converter is null
+ if(converter == null) {
+ return null;
+ }
+
+ if(converter instanceof DateTimeConverter) {
+ DateTimeConverter defaultConverter = (DateTimeConverter) converter;
+ defaultConverter.setPattern(calendar.getDatePattern());
+ defaultConverter.setLocale(calendar.getAsLocale(calendar.getLocale()));
+ defaultConverter.setTimeZone(calendar.getTimeZone());
+ }
+
+ return converter;
+ }
+}
\ No newline at end of file
Added: sandbox/trunk/ui/calendar/ui/src/main/resources/META-INF/resources/org.richfaces/calendar.ecss
===================================================================
Modified: sandbox/trunk/ui/calendar/ui/src/main/templates/calendar.template.xml
===================================================================
--- sandbox/trunk/ui/calendar/ui/src/main/templates/calendar.template.xml 2010-10-19 12:56:00 UTC (rev 19604)
+++ sandbox/trunk/ui/calendar/ui/src/main/templates/calendar.template.xml 2010-10-19 16:05:14 UTC (rev 19605)
@@ -1,38 +1,35 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
-JBoss, Home of Professional Open Source
-Copyright ${year}, Red Hat, Inc. and individual contributors
-by the @authors tag. See the copyright.txt in the distribution for a
-full listing of individual contributors.
-
-
-This is free software; you can redistribute it and/or modify it
-under the terms of the GNU Lesser General Public License as
-published by the Free Software Foundation; either version 2.1 of
-the License, or (at your option) any later version.
-
-
-This software 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 software; if not, write to the Free
-Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
-02110-1301 USA, or see the FSF site: http://www.fsf.org.
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc. and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software 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 software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
-->
<cdk:root xmlns="http://jboss.org/schema/richfaces/cdk/xhtml-el" xmlns:cdk="http://jboss.org/schema/richfaces/cdk/core"
xmlns:cc="http://jboss.org/schema/richfaces/cdk/jsf/composite" xmlns:c="http://jboss.org/schema/richfaces/cdk/jstl/core"
xmlns:xi="http://www.w3.org/2001/XInclude">
<cc:interface>
<cdk:class>org.richfaces.renderkit.html.CalendarRenderer</cdk:class>
- <cdk:superclass>org.richfaces.renderkit.InputRendererBase</cdk:superclass>
- <cdk:component-family>javax.faces.Input</cdk:component-family>
+ <cdk:superclass>org.richfaces.renderkit.CalendarRendererBase</cdk:superclass>
<cdk:renderer-type>org.richfaces.CalendarRenderer</cdk:renderer-type>
<cdk:resource-dependency library="org.richfaces" name="base-component.reslib" />
- <cdk:resource-dependency name="jquery.position.js" />
</cc:interface>
<cc:implementation>
<span id="#{clientId}" class="rf-ca #{component.attributes['styleClass']}" cdk:passThroughWithExclusions="id class">
@@ -45,77 +42,37 @@
<c:otherwise>
<input id="#{clientId}InputDate"
name="#{clientId}InputDate"
- value="#{this:getInputValue(facesContext,component)}" type="#{component.attributes['showInput'] ? 'text' : 'hidden'}"
+ value="#{this:getInputValue(facesContext,component)}"
+ type="#{component.attributes['showInput'] ? 'text' : 'hidden'}"
disabled="#{component.attributes['disabled']}"
accesskey="#{component.attributes['accesskey']}"
maxlength="#{component.attributes['maxlength']}"
- onchange="#{component.attributes['oninputchange']}"
- onselect="#{component.attributes['oninputselect']}"
- onfocus="#{component.attributes['oninputfocus']}"
- onblur="#{component.attributes['oninputblur']}"
- onclick="#{component.attributes['oninputclick']}"
- onkeypress="#{component.attributes['oninputkeypress']}"
- onkeydown="#{component.attributes['oninputkeydown']}"
- onkeyup="#{component.attributes['oninputkeyup']}"
- onmouseover="#{component.attributes['oninputmouseover']}"
- onmouseout="#{component.attributes['oninputmouseout']}"
size="#{component.attributes['inputSize']}"
style="vertical-align: middle; #{component.attributes['inputStyle']}"
class="rich-calendar-input #{component.attributes['inputClass']}"
tabindex="#{component.attributes['tabindex']}"
- readonly="#{!component.attributes['enableManualInput'] || component.attributes['readonly']}" />
-
- <!--jsp:scriptlet>
- <![CDATA[
- String buttonIconAttr = (String) component.getAttributes().get("buttonIcon");
- String buttonIcon = buttonIconAttr == null || buttonIconAttr.length() < 1 ? null :
- org.richfaces.component.util.ViewUtil.getResourceURL(buttonIconAttr, facesContext);
- String buttonIconDisabledAttr =(String) component.getAttributes().get("buttonIconDisabled");
- String buttonIconDisabled = buttonIconDisabledAttr == null || buttonIconDisabledAttr.length() < 1 ? null :
- org.richfaces.component.util.ViewUtil.getResourceURL(buttonIconDisabledAttr, facesContext);
- String buttonLabel = (String) component.getAttributes().get("buttonLabel");
- variables.setVariable("buttonLabel",buttonLabel);
- variables.setVariable("buttonIconDisabled",buttonIconDisabled);
- variables.setVariable("buttonIcon",buttonIcon);
- if(buttonLabel==null || buttonLabel.length()==0){
- ]]>
- </jsp:scriptlet><img id="#{clientId}PopupButton" alt=""
- class="rich-calendar-button #{component.attributes['buttonClass']}"
- accesskey="#{component.attributes['accesskey']}"
- style="vertical-align: middle"
- tabindex="#{component.attributes['tabindex']}">
- <jsp:scriptlet>
- <![CDATA[
- if(!disabled){
- if(buttonIcon==null){
- getUtils().writeAttribute(writer, "src", variables.getVariable("icon"));
- }
- else{
- getUtils().writeAttribute(writer, "src", buttonIcon);
- }
- }
- else{
-
- //getUtils().writeAttribute(writer, "onclick", null);
- if(buttonIconDisabled==null){
- getUtils().writeAttribute(writer, "src", variables.getVariable("disabledIcon"));
- }
- else{
- getUtils().writeAttribute(writer, "src", buttonIconDisabled);
- }
- }
- ]]>
- </jsp:scriptlet> </img> <jsp:scriptlet>
- <![CDATA[
- }
- else{
- ]]>
- </jsp:scriptlet-->
- <button type="button" id="#{clientId}PopupButton" name="#{clientId}PopupButton"
- style="vertical-align: middle"
- class="rich-calendar-button #{component.attributes['buttonClass']}"
- tabindex="#{component.attributes['tabindex']}" disabled="#{component.attributes['disabled']}">
- #{component.attributes['buttonLabel']}</button>
+ readonly="#{(!component.attributes['enableManualInput'] || component.attributes['readonly']) ? 'readonly' : ''}">
+ <cdk:call expression="renderInputHandlers(facesContext, component);"/>
+ </input>
+ <c:choose>
+ <c:when test="#{isUseIcons(facesContext, component)}">
+ <img id="#{clientId}PopupButton" alt=""
+ class="rich-calendar-button #{component.attributes['buttonClass']}"
+ accesskey="#{component.attributes['accesskey']}"
+ style="vertical-align: middle"
+ tabindex="#{component.attributes['tabindex']}" src="#{getButtonIcon(facesContext, component)}"/>
+ </c:when>
+ <c:otherwise>
+ <button type="button"
+ id="#{clientId}PopupButton"
+ name="#{clientId}PopupButton"
+ style="vertical-align: middle"
+ class="rich-calendar-button #{component.attributes['buttonClass']}"
+ tabindex="#{component.attributes['tabindex']}" disabled="#{component.attributes['disabled']}">
+ #{component.attributes['buttonLabel']}
+ </button>
+ </c:otherwise>
+ </c:choose>
</c:otherwise>
</c:choose>
<input id="#{clientId}InputCurrentDate"
@@ -126,6 +83,7 @@
</span>
<div style="display: none;" id="#{clientId}">
</div>
+
<!--cdk:scriptObject var="options" >
<cdk:scriptOption attributes="enableManualInput, disabled, readonly, resetTimeOnDateSelect, showApplyButton, styleClass, minDaysInFirstWeek" />
<cdk:scriptOption attributes="popup" defaultValue="true" />
13 years, 8 months
JBoss Rich Faces SVN: r19604 - in management/design-4x: panelMenu and 1 other directory.
by richfaces-svn-commits@lists.jboss.org
Author: Alex.Kolonitsky
Date: 2010-10-19 08:56:00 -0400 (Tue, 19 Oct 2010)
New Revision: 19604
Added:
management/design-4x/panelMenu/
management/design-4x/panelMenu/taglib-panelmenu.png
Log:
RF-9317 panelMenu components
taglib view image
Added: management/design-4x/panelMenu/taglib-panelmenu.png
===================================================================
(Binary files differ)
Property changes on: management/design-4x/panelMenu/taglib-panelmenu.png
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
13 years, 8 months
JBoss Rich Faces SVN: r19603 - sandbox/trunk/ui/calendar/ui/src/main/resources/META-INF/resources/org.richfaces.
by richfaces-svn-commits@lists.jboss.org
Author: pyaschenko
Date: 2010-10-19 08:14:33 -0400 (Tue, 19 Oct 2010)
New Revision: 19603
Added:
sandbox/trunk/ui/calendar/ui/src/main/resources/META-INF/resources/org.richfaces/JQuerySpinBtn.js
sandbox/trunk/ui/calendar/ui/src/main/resources/META-INF/resources/org.richfaces/calendar-utils.js
sandbox/trunk/ui/calendar/ui/src/main/resources/META-INF/resources/org.richfaces/calendar.js
sandbox/trunk/ui/calendar/ui/src/main/resources/META-INF/resources/org.richfaces/jquery.effects.core.js
sandbox/trunk/ui/calendar/ui/src/main/resources/META-INF/resources/org.richfaces/jquery.effects.highlight.js
sandbox/trunk/ui/calendar/ui/src/main/resources/META-INF/resources/org.richfaces/json-dom.js
Log:
https://jira.jboss.org/browse/RF-9152
https://jira.jboss.org/browse/RF-9168
Copied: sandbox/trunk/ui/calendar/ui/src/main/resources/META-INF/resources/org.richfaces/JQuerySpinBtn.js (from rev 19569, sandbox/trunk/prototypes/calendar/JQuerySpinBtn.js)
===================================================================
--- sandbox/trunk/ui/calendar/ui/src/main/resources/META-INF/resources/org.richfaces/JQuerySpinBtn.js (rev 0)
+++ sandbox/trunk/ui/calendar/ui/src/main/resources/META-INF/resources/org.richfaces/JQuerySpinBtn.js 2010-10-19 12:14:33 UTC (rev 19603)
@@ -0,0 +1,295 @@
+/* SpinButton control
+ *
+ * Adds bells and whistles to any ordinary textbox to
+ * make it look and feel like a SpinButton Control.
+ *
+ * Originally written by George Adamson, Software Unity (george.jquery(a)softwareunity.com) August 2006.
+ * - Added min/max options
+ * - Added step size option
+ * - Added bigStep (page up/down) option
+ *
+ * Modifications made by Mark Gibson, (mgibson(a)designlinks.net) September 2006:
+ * - Converted to jQuery plugin
+ * - Allow limited or unlimited min/max values
+ * - Allow custom class names, and add class to input element
+ * - Removed global vars
+ * - Reset (to original or through config) when invalid value entered
+ * - Repeat whilst holding mouse button down (with initial pause, like keyboard repeat)
+ * - Support mouse wheel in Firefox
+ * - Fix double click in IE
+ * - Refactored some code and renamed some vars
+ *
+ * Tested in IE6, Opera9, Firefox 1.5
+ * v1.0 11 Aug 2006 - George Adamson - First release
+ * v1.1 Aug 2006 - George Adamson - Minor enhancements
+ * v1.2 27 Sep 2006 - Mark Gibson - Major enhancements
+ * v1.3a 28 Sep 2006 - George Adamson - Minor enhancements
+ * rf1.3a 15 Nov 2007 - Pavel Yaschenko - some changes
+
+ Sample usage:
+
+ // Create group of settings to initialise spinbutton(s). (Optional)
+ var myOptions = {
+ min: 0, // Set lower limit.
+ max: 100, // Set upper limit.
+ step: 1, // Set increment size.
+ spinClass: mySpinBtnClass, // CSS class to style the spinbutton. (Class also specifies url of the up/down button image.)
+ upClass: mySpinUpClass, // CSS class for style when mouse over up button.
+ downClass: mySpinDnClass // CSS class for style when mouse over down button.
+ }
+
+ $(document).ready(function(){
+
+ // Initialise INPUT element(s) as SpinButtons: (passing options if desired)
+ $("#myInputElement").SpinButton(myOptions);
+
+ });
+
+ */
+var sbjQuery = jQuery;
+sbjQuery.fn.SpinButton = function(cfg){
+ return this.each(function(){
+
+ // Apply specified options or defaults:
+ // (Ought to refactor this some day to use $.extend() instead)
+ this.spinCfg = {
+ //min: cfg && cfg.min ? Number(cfg.min) : null,
+ //max: cfg && cfg.max ? Number(cfg.max) : null,
+ min: cfg && !isNaN(parseFloat(cfg.min)) ? Number(cfg.min) : null, // Fixes bug with min:0
+ max: cfg && !isNaN(parseFloat(cfg.max)) ? Number(cfg.max) : null,
+ step: cfg && cfg.step ? Number(cfg.step) : 1,
+ page: cfg && cfg.page ? Number(cfg.page) : 10,
+ upClass: cfg && cfg.upClass ? cfg.upClass : 'up',
+ downClass: cfg && cfg.downClass ? cfg.downClass : 'down',
+ reset: cfg && cfg.reset ? cfg.reset : this.value,
+ delay: cfg && cfg.delay ? Number(cfg.delay) : 500,
+ interval: cfg && cfg.interval ? Number(cfg.interval) : 100,
+ _btn_width: 20,
+ _btn_height: 12,
+ _direction: null,
+ _delay: null,
+ _repeat: null,
+
+ digits: cfg && cfg.digits ? Number(cfg.digits) : 1
+ };
+
+ this.adjustValue = function(i){
+ var v = this.value.toLowerCase();
+ if (v=="am")
+ {
+ this.value="PM";
+ return;
+ }
+ else if (v=="pm") {
+ this.value="AM";
+ return;
+ }
+ v = (isNaN(this.value) ? this.spinCfg.reset : Number(this.value)) + Number(i);
+ if (this.spinCfg.min !== null) v = (v<this.spinCfg.min ? (this.spinCfg.max != null ? this.spinCfg.max : this.spinCfg.min) : v);
+ if (this.spinCfg.max !== null) v = (v>this.spinCfg.max ? (this.spinCfg.min != null ? this.spinCfg.min : this.spinCfg.max) : v);
+
+ var value = String(v);
+ while (value.length<this.spinCfg.digits) value="0"+value;
+
+ this.value = value;
+ };
+
+ sbjQuery(this)
+// .addClass(cfg && cfg.spinClass ? cfg.spinClass : 'spin-button')
+//
+// .mousemove(function(e){
+// // Determine which button mouse is over, or not (spin direction):
+// var x = e.pageX || e.x;
+// var y = e.pageY || e.y;
+// var el = e.target || e.srcElement;
+// var direction =
+// (x > coord(el,'offsetLeft') + el.offsetWidth - this.spinCfg._btn_width)
+// ? ((y < coord(el,'offsetTop') + this.spinCfg._btn_height) ? 1 : -1) : 0;
+//
+// if (direction !== this.spinCfg._direction) {
+// // Style up/down buttons:
+// switch(direction){
+// case 1: // Up arrow:
+// sbjQuery(this).removeClass(this.spinCfg.downClass).addClass(this.spinCfg.upClass);
+// break;
+// case -1: // Down arrow:
+// sbjQuery(this).removeClass(this.spinCfg.upClass).addClass(this.spinCfg.downClass);
+// break;
+// default: // Mouse is elsewhere in the textbox
+// sbjQuery(this).removeClass(this.spinCfg.upClass).removeClass(this.spinCfg.downClass);
+// }
+//
+// // Set spin direction:
+// this.spinCfg._direction = direction;
+// }
+// })
+//
+// .mouseout(function(){
+// // Reset up/down buttons to their normal appearance when mouse moves away:
+// sbjQuery(this).removeClass(this.spinCfg.upClass).removeClass(this.spinCfg.downClass);
+// this.spinCfg._direction = null;
+// })
+
+// .mousedown(function(e){
+// if (this.spinCfg._direction != 0) {
+// // Respond to click on one of the buttons:
+// var self = this;
+// var adjust = function() {
+// self.adjustValue(self.spinCfg._direction * self.spinCfg.step);
+// };
+//
+// adjust();
+//
+// // Initial delay before repeating adjustment
+// self.spinCfg._delay = window.setTimeout(function() {
+// adjust();
+// // Repeat adjust at regular intervals
+// self.spinCfg._repeat = window.setInterval(adjust, self.spinCfg.interval);
+// }, self.spinCfg.delay);
+// }
+// })
+//
+// .mouseup(function(e){
+// // Cancel repeating adjustment
+// window.clearInterval(this.spinCfg._repeat);
+// window.clearTimeout(this.spinCfg._delay);
+// })
+//
+// .dblclick(function(e) {
+// if (sbjQuery.browser.msie)
+// this.adjustValue(this.spinCfg._direction * this.spinCfg.step);
+// })
+
+ .keydown(function(e){
+ // Respond to up/down arrow keys.
+ switch(e.keyCode){
+ case 38: this.adjustValue(this.spinCfg.step); break; // Up
+ case 40: this.adjustValue(-this.spinCfg.step); break; // Down
+ case 33: this.adjustValue(this.spinCfg.page); break; // PageUp
+ case 34: this.adjustValue(-this.spinCfg.page); break; // PageDown
+ }
+ })
+
+ .bind("mousewheel", function(e){
+ // Respond to mouse wheel in IE. (It returns up/dn motion in multiples of 120)
+ if (e.wheelDelta >= 120)
+ this.adjustValue(this.spinCfg.step);
+ else if (e.wheelDelta <= -120)
+ this.adjustValue(-this.spinCfg.step);
+
+ e.preventDefault();
+ })
+
+ .change(function(e){
+ this.adjustValue(0);
+ });
+
+ var self = this;
+
+ var btnUp = document.getElementById(this.id + 'BtnUp');
+ sbjQuery(btnUp)
+ .mousedown(function(e){
+ // Respond to click on one of the buttons:
+ var adjust = function() {
+ self.adjustValue(self.spinCfg.step);
+ };
+
+ adjust();
+
+ // Initial delay before repeating adjustment
+ self.spinCfg._delay = window.setTimeout(function() {
+ adjust();
+ // Repeat adjust at regular intervals
+ self.spinCfg._repeat = window.setInterval(adjust, self.spinCfg.interval);
+ }, self.spinCfg.delay);
+ self.spinCfg._repeater = true;
+ return false;
+ })
+
+ .mouseup(function(e){
+ // Cancel repeating adjustment
+ self.spinCfg._repeater = false;
+ window.clearInterval(self.spinCfg._repeat);
+ window.clearTimeout(self.spinCfg._delay);
+ })
+
+ .dblclick(function(e) {
+ if (sbjQuery.browser.msie)
+ self.adjustValue(self.spinCfg.step);
+ })
+ .mouseout(function(e){
+ // Cancel repeating adjustment
+ if (self.spinCfg._repeater)
+ {
+ self.spinCfg._repeater = false
+ window.clearInterval(self.spinCfg._repeat);
+ window.clearTimeout(self.spinCfg._delay);
+ }
+ });
+
+ var btnDown = document.getElementById(this.id + 'BtnDown');
+ sbjQuery(btnDown)
+ .mousedown(function(e){
+ // Respond to click on one of the buttons:
+ var adjust = function() {
+ self.adjustValue(-self.spinCfg.step);
+ };
+
+ adjust();
+
+ // Initial delay before repeating adjustment
+ self.spinCfg._delay = window.setTimeout(function() {
+ adjust();
+ // Repeat adjust at regular intervals
+ self.spinCfg._repeat = window.setInterval(adjust, self.spinCfg.interval);
+ }, self.spinCfg.delay);
+ self.spinCfg._repeater = true;
+ return false;
+ })
+
+ .mouseup(function(e){
+ // Cancel repeating adjustment
+ self.spinCfg._repeater = false;
+ window.clearInterval(self.spinCfg._repeat);
+ window.clearTimeout(self.spinCfg._delay);
+ })
+
+ .dblclick(function(e) {
+ if (sbjQuery.browser.msie)
+ self.adjustValue(-self.spinCfg.step);
+ })
+ .mouseout(function(e){
+ // Cancel repeating adjustment
+ if (self.spinCfg._repeater)
+ {
+ self.spinCfg._repeater = false
+ window.clearInterval(self.spinCfg._repeat);
+ window.clearTimeout(self.spinCfg._delay);
+ }
+ });
+
+
+ if (this.addEventListener) {
+ // Respond to mouse wheel in Firefox
+ this.addEventListener('DOMMouseScroll', function(e) {
+ if (e.detail > 0)
+ this.adjustValue(-this.spinCfg.step);
+ else if (e.detail < 0)
+ this.adjustValue(this.spinCfg.step);
+
+ e.preventDefault();
+ }, false);
+ }
+ });
+
+ function coord(el,prop) {
+ var c = el[prop], b = document.body;
+
+ while ((el = el.offsetParent) && (el != b)) {
+ if (!sbjQuery.browser.msie || (el.currentStyle.position != 'relative'))
+ c += el[prop];
+ }
+
+ return c;
+ }
+};
Copied: sandbox/trunk/ui/calendar/ui/src/main/resources/META-INF/resources/org.richfaces/calendar-utils.js (from rev 19580, sandbox/trunk/prototypes/calendar/calendar-utils.js)
===================================================================
--- sandbox/trunk/ui/calendar/ui/src/main/resources/META-INF/resources/org.richfaces/calendar-utils.js (rev 0)
+++ sandbox/trunk/ui/calendar/ui/src/main/resources/META-INF/resources/org.richfaces/calendar-utils.js 2010-10-19 12:14:33 UTC (rev 19603)
@@ -0,0 +1,343 @@
+(function ($, rf) {
+
+ rf.calendarUtils = rf.calendarUtils || {};
+
+ var getDefaultMonthNames = function(shortNames)
+ {
+ return (shortNames
+ ? ['Jan','Feb','Mar','Apr','May','Jun','Jul','Aug','Sep','Oct','Nov','Dec']
+ : ['January','February','March','April','May','June','July','August','September','October','November','December']);
+ };
+
+ $.extend(rf.calendarUtils, {
+ // TODO: rewrite this function or use the same function if exists
+ /*clonePosition: function (elements, source)
+ {
+ if (!elements.length) elements = [elements];
+ var offset = Position.cumulativeOffset(source);
+ offset = {left:offset[0], top:offset[1]};
+ var offsetTemp;
+ if (source.style.position!='absolute')
+ {
+ offsetTemp = Position.realOffset(source);
+ offset.left -= offsetTemp.left;
+ offset.top -= offsetTemp.top;
+ offsetTemp = Richfaces.Calendar.getWindowScrollOffset();
+ offset.left += offsetTemp.left;
+ offset.top += offsetTemp.top;
+ }
+
+ for (var i=0;i<elements.length;i++)
+ {
+ offsetTemp = Richfaces.Calendar.getParentOffset(elements[i]);
+ elements[i].style.left = (offset.left - offsetTemp.left) + 'px';
+ elements[i].style.top = (offset.top - offsetTemp.top) + 'px';
+ }
+ return offset;
+ }*/
+
+ //TODO: not used
+ /*Object.extend(Event, {
+ findElementByAttr : function(event, tagName, attribute, value, flag) {
+ var element = Event.findElement(event, tagName);
+ while (!element[attribute] || (flag ? element[attribute].indexOf(value)!=0 : element[attribute]!=value) )
+ {
+ element = element.parentNode;
+ }
+ return element;
+ }
+ });
+
+ Object.extend(Element, {
+ replaceClassName : function (element, whichClassName, toClassName) {
+ if (!(element = $(element))) return;
+ var e = Element.classNames(element);
+ e.remove(whichClassName);
+ e.add(toClassName);
+ return element;
+ }
+ });*/
+
+ // TODO: move joinArray to richfaces utils
+ joinArray: function(array, begin, end, separator)
+ {
+ var value = '';
+ if (array.length!=0) value = begin+array.pop()+end;
+ while (array.length)
+ value = begin+array.pop()+end+separator+value;
+ return value;
+ },
+
+ getMonthByLabel: function (monthLabel, monthNames) {
+ var toLowerMonthLabel = monthLabel.toLowerCase();
+ var i = 0;
+ while (i < monthNames.length) {
+ if (monthNames[i].toLowerCase() == toLowerMonthLabel) {
+ return i;
+ }
+
+ i++;
+ }
+ },
+
+ /* Year:
+ * y,yy - 00-99
+ * yyy+ - 1999
+ * Month:
+ * M - 1-12
+ * MM - 01-12
+ * MMM - short (Jul)
+ * MMMM+ - long (July)
+ * Date:
+ * d - 1-31
+ * dd+ - 01-31 */
+ parseDate: function(dateString, pattern, monthNames, monthNamesShort)
+ {
+ var re = /([.*+?^<>=!:${}()[\]\/\\])/g;
+ var monthNamesStr
+ var monthNamesShortStr;
+ if (!monthNames) {
+ monthNames = getDefaultMonthNames();
+ monthNamesStr = monthNames.join('|');
+ } else {
+ monthNamesStr = monthNames.join('|').replace(re, '\\$1');
+ }
+
+ if (!monthNamesShort) {
+ monthNamesShort = getDefaultMonthNames(true);
+ monthNamesShortStr = monthNamesShort.join('|');
+ } else {
+ monthNamesShortStr = monthNamesShort.join('|').replace(re, '\\$1');
+ }
+
+ var counter=1;
+ var y,m,d;
+ var a,h,min;
+ var shortLabel=false;
+
+ pattern = pattern.replace(/([.*+?^<>=!:${}()|[\]\/\\])/g, '\\$1');
+ pattern = pattern.replace(/(y+|M+|d+|a|H{1,2}|h{1,2}|m{2})/g,
+ function($1) {
+ switch ($1) {
+ case 'y' :
+ case 'yy' : y=counter; counter++; return '(\\d{2})';
+ case 'MM' : m=counter; counter++; return '(\\d{2})';
+ case 'M' : m=counter; counter++; return '(\\d{1,2})';
+ case 'd' : d=counter; counter++; return '(\\d{1,2})';
+ case 'MMM': m=counter; counter++; shortLabel=true; return '('+monthNamesShortStr+')';
+ case 'a' : a=counter; counter++; return '(AM|am|PM|pm)?';
+ case 'HH' :
+ case 'hh' : h=counter; counter++; return '(\\d{2})?';
+ case 'H' :
+ case 'h' : h=counter; counter++; return '(\\d{1,2})?';
+ case 'mm' : min=counter; counter++; return '(\\d{2})?';
+ }
+ // y+,M+,d+
+ var ch = $1.charAt(0);
+ if (ch=='y') {y=counter; counter++; return '(\\d{3,4})'};
+ if (ch=='M') {m=counter; counter++; return '('+monthNamesStr+')'};
+ if (ch=='d') {d=counter; counter++; return '(\\d{2})'};
+ }
+ );
+
+ var re = new RegExp(pattern,'i');
+ var match = dateString.match(re);
+ if (match!=null)
+ {
+ // set default century start
+ var correctYear = false;
+ var defaultCenturyStart = new Date();
+ defaultCenturyStart.setFullYear(defaultCenturyStart.getFullYear()-80);
+
+ var yy = parseInt(match[y],10);
+ if (isNaN(yy)) return null;
+ else if (yy<100){
+ // calculate full year if year has only two digits
+ var defaultCenturyStartYear = defaultCenturyStart.getFullYear();
+ var ambiguousTwoDigitYear = defaultCenturyStartYear % 100;
+ correctYear = yy == ambiguousTwoDigitYear;
+ yy += Math.floor(defaultCenturyStartYear/100)*100 + (yy < ambiguousTwoDigitYear ? 100 : 0);
+ }
+
+ var mm = parseInt(match[m],10); if (isNaN(mm)) mm = Richfaces.Calendar.getMonthByLabel(match[m], shortLabel ? monthNamesShort : monthNames); else if (--mm<0 || mm>11) return null;
+ var addDay = correctYear ? 1 : 0;
+ var dd = parseInt(match[d],10); if (isNaN(dd) || dd<1 || dd>this.daysInMonth(yy, mm) + addDay) return null;
+
+ var date = new Date(yy, mm, dd);
+
+ // time parsing
+ if (min!=undefined && h!=undefined)
+ {
+ var hh,mmin,aa;
+ mmin = parseInt(match[min],10); if (isNaN(mmin) || mmin<0 || mmin>59) return null;
+ hh = parseInt(match[h],10); if (isNaN(hh)) return null;
+ if (a!=undefined)
+ {
+ aa = match[a];
+ if (!aa) return null;
+ aa = aa.toLowerCase();
+ if ((aa!='am' && aa!='pm') || hh<1 || hh>12) return null;
+ if (aa=='pm')
+ {
+ if (hh!=12) hh+=12;
+ } else if (hh==12) hh = 0;
+ }
+ else if (hh<0 || hh>23) return null;
+
+ date.setHours(hh); date.setMinutes(mmin);
+ }
+
+ if (correctYear) {
+ if (date.getTime() < defaultCenturyStart.getTime()) {
+ date.setFullYear(yy + 100);
+ }
+ if (date.getMonth() != mm) return null;
+ }
+
+ return date;
+ }
+ return null;
+ },
+
+ formatDate: function(date, pattern, monthNames, monthNamesShort) {
+ if (!monthNames) monthNames = getDefaultMonthNames();
+ if (!monthNamesShort) monthNamesShort = getDefaultMonthNames(true);
+ var mm; var dd; var hh; var min;
+ var result = pattern.replace(/(\\\\|\\[yMdaHhm])|(y+|M+|d+|a|H{1,2}|h{1,2}|m{2})/g,
+ function($1,$2,$3) {
+ if ($2) return $2.charAt(1);
+ switch ($3) {
+ case 'y':
+ case 'yy': return date.getYear().toString().slice(-2);
+ case 'M': return (date.getMonth()+1);
+ case 'MM': return ((mm = date.getMonth()+1)<10 ? '0'+mm : mm);
+ case 'MMM': return monthNamesShort[date.getMonth()];
+ case 'd': return date.getDate();
+ case 'a' : return (date.getHours()<12 ? 'AM' : 'PM');
+ case 'HH' : return ((hh = date.getHours())<10 ? '0'+hh : hh);
+ case 'H' : return date.getHours();
+ case 'hh' : return ((hh = date.getHours())==0 ? '12' : (hh<10 ? '0'+hh : (hh>21 ? hh-12 : (hh>12) ? '0'+(hh-12) : hh)));
+ case 'h' : return ((hh = date.getHours())==0 ? '12' : (hh>12 ? hh-12 : hh));
+ case 'mm' : return ((min = date.getMinutes())<10 ? '0'+min : min);
+ }
+ // y+,M+,d+
+ var ch = $3.charAt(0);
+ if (ch=='y') return date.getFullYear();
+ if (ch=='M') return monthNames[date.getMonth()];
+ if (ch=='d') return ((dd = date.getDate())<10 ? '0'+dd : dd);
+ }
+ );
+ return result;
+ },
+
+ isLeapYear: function(year) {
+ return new Date(year, 1, 29).getDate()==29;
+ },
+
+ daysInMonth: function(year,month) {
+ return 32 - new Date(year, month, 32).getDate();
+ },
+
+ daysInMonthByDate: function(date) {
+ return 32 - new Date(date.getFullYear(), date.getMonth(), 32).getDate();
+ },
+
+ getDay: function(date, firstWeekDay ) {
+ var value = date.getDay() - firstWeekDay;
+ if (value < 0) value = 7 + value;
+ return value;
+ },
+
+ getFirstWeek: function(year, mdifw, fdow) {
+ var date = new Date(year,0,1);
+ var firstday = this.getDay(date, fdow);
+
+ var weeknumber = (7-firstday<mdifw) ? 0 : 1;
+
+ return {date:date, firstDay:firstday, weekNumber:weeknumber, mdifw:mdifw, fdow:fdow};
+ },
+
+ getLastWeekOfPrevYear: function(o) {
+ var year = o.date.getFullYear()-1;
+ var days = (isLeapYear(year) ? 366 : 365);
+ var obj = this.getFirstWeek(year, o.mdifw, o.fdow);
+ days = (days - 7 + o.firstDay);
+ var weeks = Math.floor(days/7)+1;
+
+ return weeks+obj.weekNumber;
+ },
+
+ weekNumber: function(year, month, mdifw, fdow) {
+
+ var o = this.getFirstWeek(year, mdifw, fdow);
+
+ if (month==0)
+ {
+ if (o.weekNumber==1) return 1;
+ return getLastWeekOfPrevYear(o);
+ }
+ var oneweek = 604800000;
+ var d = new Date(year, month,1);
+ d.setDate( 1+o.firstDay + (this.getDay(d,fdow)==0?1:0));
+
+ weeknumber = o.weekNumber + Math.floor((d.getTime() - o.date.getTime()) / oneweek);
+
+ return weeknumber;
+ }
+
+ });
+
+ rf.calendarTemplates = rf.calendarTemplates || {};
+
+ $.extend(rf.calendarTemplates, (function (){
+
+ var VARIABLE_NAME_PATTERN = /^\s*[_,A-Z,a-z][\w,_\.]*\s*$/;
+
+ var getObjectValue = function (str, object) {
+ var a=str.split(".");
+ var value=object[a[0]];
+ var c=1;
+ while (value && c<a.length) value = value[a[c++]];
+ return (value ? value : "");
+ };
+
+ return {
+ evalMacro: function(template, object)
+ {
+ var _value_="";
+ // variable evaluation
+ if (VARIABLE_NAME_PATTERN.test(template))
+ {
+ if (template.indexOf('.')==-1) {
+ _value_ = object[template];
+ if (!_value_) _value_=window[template];
+ }
+ // object's variable evaluation
+ else {
+ _value_ = getObjectValue(template, object);
+ if (!_value_) _value_=getObjectValue(template, window);
+ }
+ if (_value_ && typeof _value_=='function') _value_ = _value_(object);
+ if (!_value_) _value_="";
+ }
+ //js string evaluation
+ else {
+ try {
+ if (object.eval) {
+ _value_ = object.eval(template);
+ }
+ else with (object) {
+ _value_ = eval(template) ;
+ }
+
+ if (typeof _value_ == 'function') {
+ _value_ = _value_(object);
+ }
+ } catch (e) { LOG.warn("Exception: "+e.Message + "\n[" + template + "]"); }
+ }
+ return _value_;
+ }
+ };
+ })());
+
+})(jQuery, RichFaces);
\ No newline at end of file
Copied: sandbox/trunk/ui/calendar/ui/src/main/resources/META-INF/resources/org.richfaces/calendar.js (from rev 19581, sandbox/trunk/prototypes/calendar/calendar.js)
===================================================================
--- sandbox/trunk/ui/calendar/ui/src/main/resources/META-INF/resources/org.richfaces/calendar.js (rev 0)
+++ sandbox/trunk/ui/calendar/ui/src/main/resources/META-INF/resources/org.richfaces/calendar.js 2010-10-19 12:14:33 UTC (rev 19603)
@@ -0,0 +1,1788 @@
+/*if(!window.LOG){
+ window.LOG = {warn:function(){}};
+}*/
+
+// TODO: try to change RichFaces.$ to $$ if possible
+
+(function ($, rf) {
+
+ rf.ui = rf.ui || {};
+
+ //calendar templates
+ var CalendarView = {
+ getControl: function(text, attributes, functionName, paramsStr) {
+ var attr = $.extend({
+ onclick: (functionName ? "RichFaces.$$('Calendar',this)."+functionName+"("+(paramsStr ? paramsStr : "")+");" : "")+"return true;"
+ }, attributes);
+ return new E('div',attr,[new T(text)]);
+ },
+
+ getSelectedDateControl: function(calendar) {
+
+ if (!calendar.selectedDate || calendar.params.showApplyButton) return "";
+
+ var text = rf.calendarUtils.formatDate(calendar.selectedDate,(calendar.timeType ? calendar.datePattern : calendar.params.datePattern), calendar.params.monthLabels, calendar.params.monthLabelsShort);
+ var onclick = "RichFaces.$$('Calendar',this).showSelectedDate(); return true;"
+ var markup = ( calendar.params.disabled ?
+ new E('div', {'class': 'rich-calendar-tool-btn-disabled'}, [new ET(text)]) :
+ new E('div', {'class': 'rich-calendar-tool-btn', 'onclick': onclick}, [new ET(text)]) );
+
+ return markup;
+ },
+
+ getTimeControl: function(calendar) {
+
+ if (!calendar.selectedDate || !calendar.timeType) return "";
+
+ var text = rf.calendarUtils.formatDate(calendar.selectedDate, calendar.timePattern, calendar.params.monthLabels, calendar.params.monthLabelsShort);
+
+ var onmouseover = "jQuery(this).removeClass('rich-calendar-tool-btn-press');";
+ var onmouseout = "jQuery(this).addClass('rich-calendar-tool-btn-press');";
+ var onclick = "RichFaces.$$('Calendar',this).showTimeEditor();return true;";
+ var markup = calendar.params.disabled || calendar.params.readonly ?
+ new E('div', {'class': 'rich-calendar-tool-btn-disabled'}, [new ET(text)]) :
+ new E('div', {'class': 'rich-calendar-tool-btn rich-calendar-tool-btn-hover rich-calendar-tool-btn-press', 'onclick': onclick,
+ 'onmouseover': + onmouseover ,
+ 'onmouseout' : + onmouseout}, [new ET(text)]);
+
+ return markup;
+ },
+
+ toolButtonAttributes: {className: "rich-calendar-tool-btn", onmouseover:"this.className='rich-calendar-tool-btn rich-calendar-tool-btn-hover'", onmouseout:"this.className='rich-calendar-tool-btn'", onmousedown:"this.className='rich-calendar-tool-btn rich-calendar-tool-btn-hover rich-calendar-tool-btn-press'", onmouseup:"this.className='rich-calendar-tool-btn rich-calendar-tool-btn-hover'"},
+ nextYearControl: function (context) {
+ return (!context.calendar.params.disabled ? CalendarView.getControl(">>", CalendarView.toolButtonAttributes, "nextYear") : "");
+ },
+ previousYearControl: function (context) {
+ return (!context.calendar.params.disabled ? CalendarView.getControl("<<", CalendarView.toolButtonAttributes, "prevYear") : "");
+ },
+ nextMonthControl: function (context) {
+ return (!context.calendar.params.disabled ? CalendarView.getControl(">", CalendarView.toolButtonAttributes, "nextMonth") : "");
+ },
+ previousMonthControl: function (context) {
+ return (!context.calendar.params.disabled ? CalendarView.getControl("<", CalendarView.toolButtonAttributes, "prevMonth") : "");
+ },
+ currentMonthControl: function (context) {
+ var text = rf.calendarUtils.formatDate(context.calendar.getCurrentDate(), "MMMM, yyyy", context.monthLabels, context.monthLabelsShort);
+ var markup = context.calendar.params.disabled ?
+ new E('div',{className: "rich-calendar-tool-btn-disabled"},[new T(text)]) :
+ CalendarView.getControl(text, CalendarView.toolButtonAttributes, "showDateEditor");
+ return markup;
+ },
+ todayControl: function (context) {
+ return (!context.calendar.params.disabled && context.calendar.params.todayControlMode!='hidden' ? CalendarView.getControl(context.controlLabels.today, CalendarView.toolButtonAttributes, "today") : "");
+ },
+ closeControl: function (context) {
+ return (context.calendar.params.popup ? CalendarView.getControl(context.controlLabels.close, CalendarView.toolButtonAttributes, "close", "false") : "");
+ },
+ applyControl: function (context) {
+ return (!context.calendar.params.disabled && !context.calendar.params.readonly && context.calendar.params.showApplyButton ? CalendarView.getControl(context.controlLabels.apply, CalendarView.toolButtonAttributes, "close", "true") : "");
+ },
+ cleanControl: function (context) {
+ return (!context.calendar.params.disabled && !context.calendar.params.readonly && context.calendar.selectedDate ? CalendarView.getControl(context.controlLabels.clean, CalendarView.toolButtonAttributes, "resetSelectedDate") : "");
+ },
+
+ selectedDateControl: function (context) { return CalendarView.getSelectedDateControl(context.calendar);},
+ timeControl: function (context) { return CalendarView.getTimeControl(context.calendar);},
+ timeEditorFields: function (context) {return context.calendar.timePatternHtml;},
+
+ header: [
+ new E('table',{'border': '0', 'cellpadding': '0', 'cellspacing': '0', 'width': '100%'},
+ [
+ new E('tbody',{},
+ [
+ new E('tr',{},
+ [
+ new E('td',{'class': 'rich-calendar-tool'},
+ [
+ new ET(function (context) { return rf.calendarTemplates.evalMacro("previousYearControl", context)})
+ ]),
+ new E('td',{'class': 'rich-calendar-tool'},
+ [
+ new ET(function (context) { return rf.calendarTemplates.evalMacro("previousMonthControl", context)})
+ ]),
+ new E('td',{'class': 'rich-calendar-month'},
+ [
+ new ET(function (context) { return rf.calendarTemplates.evalMacro("currentMonthControl", context)})
+ ]),
+ new E('td',{'class': 'rich-calendar-tool'},
+ [
+ new ET(function (context) { return rf.calendarTemplates.evalMacro("nextMonthControl", context)})
+ ]),
+ new E('td',{'class': 'rich-calendar-tool'},
+ [
+ new ET(function (context) { return rf.calendarTemplates.evalMacro("nextYearControl", context)})
+ ]),
+ new E('td',{'class': 'rich-calendar-tool rich-calendar-tool-close', 'style':function(context){return (this.isEmpty ? 'display:none;' : '');}},
+ [
+ new ET(function (context) { return rf.calendarTemplates.evalMacro("closeControl", context)})
+ ])
+ ])
+ ])
+ ]
+ )],
+
+ footer: [
+ new E('table',{'border': '0', 'cellpadding': '0', 'cellspacing': '0', 'width': '100%'},
+ [
+ new E('tbody',{},
+ [
+ new E('tr',{},
+ [
+ new E('td',{'class': 'rich-calendar-toolfooter', 'style':function(context){return (this.isEmpty ? 'display:none;' : '');}},
+ [
+ new ET(function (context) { return rf.calendarTemplates.evalMacro("selectedDateControl", context)})
+ ]),
+ new E('td',{'class': 'rich-calendar-toolfooter', 'style':function(context){return (this.isEmpty ? 'display:none;' : '');}},
+ [
+ new ET(function (context) { return rf.calendarTemplates.evalMacro("cleanControl", context)})
+ ]),
+ new E('td',{'class': 'rich-calendar-toolfooter', 'style':function(context){return (this.isEmpty ? 'display:none;' : '');}},
+ [
+ new ET(function (context) { return rf.calendarTemplates.evalMacro("timeControl", context)})
+ ]),
+ new E('td',{'class': 'rich-calendar-toolfooter', 'style': 'background-image:none;', 'width': '100%'}, []),
+ new E('td',{'class': 'rich-calendar-toolfooter', 'style':function(context){return (this.isEmpty ? 'display:none;' : '')+(context.calendar.params.disabled || context.calendar.params.readonly || !context.calendar.params.showApplyButton ? 'background-image:none;' : '');}},
+ [
+ new ET(function (context) { return rf.calendarTemplates.evalMacro("todayControl", context)})
+ ]),
+ new E('td',{'class': 'rich-calendar-toolfooter', 'style':function(context){return (this.isEmpty ? 'display:none;' : '')+'background-image:none;';}},
+ [
+ new ET(function (context) { return rf.calendarTemplates.evalMacro("applyControl", context)})
+ ])
+ ])
+ ])
+ ]
+ )],
+
+ timeEditorLayout: [
+
+ new E('table',{'id': function(context){return context.calendar.TIME_EDITOR_LAYOUT_ID}, 'border': '0', 'cellpadding': '0', 'cellspacing': '0', 'class': 'rich-calendar-time-layout'},
+ [
+ new E('tbody',{},
+ [
+ new E('tr',{},
+ [
+ new E('td',{'class': 'rich-calendar-time-layout-fields', 'colspan': '2', 'align': 'center'},
+ [
+ new ET(function (context) { return rf.calendarTemplates.evalMacro("timeEditorFields", context)})
+ ])
+ ]),
+ new E('tr',{},
+ [
+ new E('td',{'class': 'rich-calendar-time-layout-ok'},
+ [
+ new E('div',{'id': function(context){return context.calendar.TIME_EDITOR_BUTTON_OK}, 'class': 'rich-calendar-time-btn', 'style': 'float:right;', 'onmousedown': "jQuery(this).addClass('rich-calendar-time-btn-press');", 'onmouseout': "jQuery(this).removeClass('rich-calendar-time-btn-press');", 'onmouseup': "jQuery(this).removeClass('rich-calendar-time-btn-press');", 'onclick': function(context){return "RichFaces.$('"+context.calendar.id+"').hideTimeEditor(true)";}},
+ [
+ new E('span',{},
+ [
+ new ET(function (context) { return context.controlLabels.ok; })
+ ])
+ ])
+ ])
+ ,
+ new E('td',{'class': 'rich-calendar-time-layout-cancel'},
+ [
+ new E('div',{'id': function(context){return context.calendar.TIME_EDITOR_BUTTON_CANCEL}, 'class': 'rich-calendar-time-btn', 'style': 'float:left;', 'onmousedown': "jQuery(this).addClass('rich-calendar-time-btn-press');", 'onmouseout': "jQuery(this).removeClass('rich-calendar-time-btn-press');", 'onmouseup': "jQuery(this).removeClass('rich-calendar-time-btn-press');", 'onclick': function(context){return "RichFaces.$('"+context.calendar.id+"').hideTimeEditor(false)";}},
+ [
+ new E('span',{},
+ [
+ new ET(function (context) { return context.controlLabels.cancel; })
+ ])
+ ])
+ ])
+ ])
+ ])
+ ]
+ )],
+
+ dayList: [new ET(function (context) { return context.day})],
+ weekNumber: [new ET(function (context) { return context.weekNumber})],
+ weekDay: [new ET(function (context) { return context.weekDayLabelShort})]
+ };
+ // calendar templates end
+
+ // calendar context
+ var CalendarContext = function(calendar) {
+ this.calendar=calendar;
+ this.monthLabels=calendar.params.monthLabels;
+ this.monthLabelsShort=calendar.params.monthLabelsShort;
+ this.weekDayLabels=calendar.params.weekDayLabels;
+ this.weekDayLabelsShort=calendar.params.weekDayLabelsShort;
+ this.controlLabels=calendar.params.labels;
+ };
+
+ $.extend(CalendarContext.prototype, {
+ nextYearControl: CalendarView.nextYearControl,
+ previousYearControl: CalendarView.previousYearControl,
+ nextMonthControl: CalendarView.nextMonthControl,
+ previousMonthControl: CalendarView.previousMonthControl,
+ currentMonthControl: CalendarView.currentMonthControl,
+ selectedDateControl: CalendarView.selectedDateControl,
+ cleanControl: CalendarView.cleanControl,
+ timeControl: CalendarView.timeControl,
+ todayControl: CalendarView.todayControl,
+ closeControl: CalendarView.closeControl,
+ applyControl: CalendarView.applyControl,
+ timeEditorFields: CalendarView.timeEditorFields,
+ });
+
+ // must be :defaultTime, minDaysInFirstWeek, firstWeekday, weekDayLabels, weekDayLabelsShort, monthLabels, monthLabelsShort
+
+ // defaults definition
+ var defaultOptions = {
+ showWeekDaysBar: true,
+ showWeeksBar: true,
+ datePattern: "MMM d, yyyy",
+ horizontalOffset: 0,
+ verticalOffset: 0,
+ dayListMarkup: CalendarView.dayList,
+ weekNumberMarkup: CalendarView.weekNumber,
+ weekDayMarkup: CalendarView.weekDay,
+ headerMarkup: CalendarView.header,
+ footerMarkup: CalendarView.footer,
+ isDayEnabled: function (context) {return true;},
+ dayStyleClass: function (context) {return "";},
+ showHeader: true,
+ showFooter: true,
+ direction: "AA",
+ jointPoint: "AA",
+ popup: true,
+ boundaryDatesMode: "inactive",
+ todayControlMode: "select",
+ style: "",
+ className: "",
+ disabled: false,
+ readonly: false,
+ enableManualInput: false,
+ showInput: true,
+ resetTimeOnDateSelect: false,
+ style: "z-index: 3;",
+ showApplyButton: false,
+ selectedDate: null,
+ currentDate: null,
+ defaultTime: {hours:12,minutes:0},
+ hidePopupOnScroll: true
+ };
+
+ var defaultLabels = {apply:'Apply', today:'Today', clean:'Clean', ok:'OK', cancel:'Cancel', close:'x'};
+
+ // Constructor definition
+ rf.ui.Calendar = function(componentId, locale, options, markups) {
+
+ // dayListMarkup - day cell markup
+ // context: {day, date, weekNumber, weekDayNumber, isWeekend, isCurrentMonth, elementId, component}
+ // weekNumberMarkup - week number cell markup
+ // context: {weekNumber, elementId, component}
+ // weekDayMarkup - week day cell markup
+ // context: {weekDayLabel, weekDayLabelShort, weekDayNumber, isWeekend, elementId, component}
+
+ // headerMarkup
+ // footerMarkup
+ // optionalHeaderMarkup - user defined header (optional)
+ // optionalFooterMarkup - user defined footer (optional)
+
+ // currentDate - date to show month (day not used) (mm/yyyy)
+ // selectedDate - selected date (mm/dd/yyyy)
+ // weekDayLabels - collection of week day labels keyed by week day numbers
+ // weekDayLabelsShort - collection of week day short labels keyed by week day numbers
+ // minDaysInFirstWeek - locale-specific constant defining number of days in the first week
+ // firstWeekDay - (0..6) locale-specific constant defining number of the first week day
+ // showWeekDaysBar - show WeekDays Bar [default value is true]
+ // showWeeksBar - show Weeks numbers bar [default value is true]
+ // showApplyButton
+ // showHeader
+ // showFooter
+
+ // POPUP description
+ // direction - [top-left, top-right, bottom-left, bottom-right, auto]
+ // jointPoint - [top-left, top-right, bottom-left, bottom-right]
+ // popup - true
+ // id+PopupButton, id+InputDate,
+
+ // boundaryDatesMode - boundary dates onclick action:
+ // "inactive" or undefined - no action (default)
+ // "scroll" - change current month
+ // "select" - change current month and select date
+ //
+ // todayControlMode - today control onclick action:
+ // "scroll"
+ // "select"
+ // "hidden"
+
+ // isDayEnabled - end-developer JS function
+ // dayStyleClass - end-developer JS function that provide style class for day's cells.
+
+ // dayCellClass - add div to day cell with class 'rich-calendar-cell-div' and add this class to TD if defined
+ // style - table style
+ // styleClass - table class
+
+ // disabled
+ // readonly
+
+ //var _d = new Date();
+
+ // call constructor of parent class
+ $super.constructor.call(this, componentId);
+
+ this.namespace = "."+rf.Event.createNamespace(this.name, componentId);
+
+ //create parameters
+ //this.options = $.extend(this.options, defaultOptions, options);
+ this.params = $.extend({}, defaultOptions, locales[locale], options, markups);
+
+ // labels
+ var value = options.labels || {};
+ for (var name in defaultLabels) {
+ if (!value[name]) value[name] = defaultLabels[name];
+ }
+ this.params.labels = value;
+
+ this.popupOffset = {dx:this.params.horizontalOffset, dy:this.params.verticalOffset};
+
+ //
+ if (!this.params.popup) this.params.showApplyButton = false;
+
+ //
+ this.params.boundaryDatesMode = this.params.boundaryDatesMode.toLowerCase();
+ this.params.todayControlMode = this.params.todayControlMode.toLowerCase();
+
+ // time
+ this.setTimeProperties();
+
+ this.customDayListMarkup = (this.params.dayListMarkup!=CalendarView.dayList);
+
+ this.currentDate = this.params.currentDate ? this.params.currentDate : (this.params.selectedDate ? this.params.selectedDate : new Date());
+ this.currentDate.setDate(1);
+ this.selectedDate = this.params.selectedDate;
+
+ this.todayDate = new Date();
+
+ this.firstWeekendDayNumber = 6-this.params.firstWeekDay;
+ this.secondWeekendDayNumber = (this.params.firstWeekDay>0 ? 7-this.params.firstWeekDay : 0);
+
+ this.calendarContext = new CalendarContext(this);
+
+ // TODO: move it from constructor
+ this.DATE_ELEMENT_ID = this.id+'DayCell';
+ this.WEEKNUMBER_BAR_ID = this.id+"WeekNum";
+ this.WEEKNUMBER_ELEMENT_ID = this.WEEKNUMBER_BAR_ID+'Cell';
+ this.WEEKDAY_BAR_ID = this.id+"WeekDay";
+ this.WEEKDAY_ELEMENT_ID = this.WEEKDAY_BAR_ID+'Cell';
+ this.POPUP_ID = this.id+'Popup';
+ this.POPUP_BUTTON_ID = this.id+'PopupButton';
+ this.INPUT_DATE_ID = this.id+'InputDate';
+ this.EDITOR_ID = this.id+'Editor';
+ this.EDITOR_SHADOW_ID = this.id+'EditorShadow';
+
+ this.TIME_EDITOR_LAYOUT_ID = this.id+'TimeEditorLayout';
+ this.DATE_EDITOR_LAYOUT_ID = this.id+'DateEditorLayout';
+ this.EDITOR_LAYOUT_SHADOW_ID = this.id+'EditorLayoutShadow';
+ this.TIME_EDITOR_BUTTON_OK = this.id+'TimeEditorButtonOk';
+ this.TIME_EDITOR_BUTTON_CANCEL = this.id+'TimeEditorButtonCancel';
+ this.DATE_EDITOR_BUTTON_OK = this.id+'DateEditorButtonOk';
+ this.DATE_EDITOR_BUTTON_CANCEL = this.id+'DateEditorButtonCancel';
+
+ this.firstDateIndex = 0;
+
+ this.daysData = {startDate:null, days:[]};
+ this.days = [];
+ this.todayCellId = null;
+ this.todayCellColor = "";
+
+ this.selectedDateCellId = null;
+ this.selectedDateCellColor = "";
+
+ var popupStyles = "";
+ this.isVisible = true;
+ if (this.params.popup==true)
+ {
+ // popup mode initialisation
+ popupStyles = "display:none; position:absolute;"
+ this.isVisible = false;
+ }
+
+ var tempStr = "RichFaces.$('"+this.id+"').";
+
+ var htmlTextHeader = '<table id="'+this.id+'" border="0" cellpadding="0" cellspacing="0" class="rich-calendar-exterior rich-calendar-popup '+this.params.styleClass+'" style="'+popupStyles+this.params.style+'" onclick="'+tempStr+'skipEventOnCollapse=true;"><tbody>';
+ var colspan = (this.params.showWeeksBar ? "8" : "7");
+ var htmlHeaderOptional = (this.params.optionalHeaderMarkup) ? '<tr><td class="rich-calendar-header-optional" colspan="'+colspan+'" id="'+this.id+'HeaderOptional"></td></tr>' : '';
+ var htmlFooterOptional = (this.params.optionalFooterMarkup) ? '<tr><td class="rich-calendar-footer-optional" colspan="'+colspan+'" id="'+this.id+'FooterOptional"></td></tr>' : '';
+ var htmlControlsHeader = (this.params.showHeader ? '<tr><td class="rich-calendar-header" colspan="'+colspan+'" id="'+this.id+'Header"></td></tr>' : '');
+ var htmlControlsFooter = (this.params.showFooter ? '<tr><td class="rich-calendar-footer" colspan="'+colspan+'" id="'+this.id+'Footer"></td></tr>' : '');
+ var htmlTextFooter = '</tbody></table>'
+
+ // days bar creation
+ var styleClass;
+ var bottomStyleClass;
+ var htmlTextWeekDayBar=[];
+ var context;
+
+ var eventsStr = this.params.disabled || this.params.readonly ? '' : 'onclick="'+tempStr+'eventCellOnClick(event, this);" onmouseover="'+tempStr+'eventCellOnMouseOver(event, this);" onmouseout="'+tempStr+'eventCellOnMouseOut(event, this);"';
+ if (this.params.showWeekDaysBar)
+ {
+ htmlTextWeekDayBar.push('<tr id="'+this.WEEKDAY_BAR_ID+'">');
+ if (this.params.showWeeksBar) htmlTextWeekDayBar.push('<td class="rich-calendar-days"><br/></td>');
+ var weekDayCounter = this.params.firstWeekDay;
+ for (var i=0;i<7;i++)
+ {
+ context = {weekDayLabel: this.params.weekDayLabels[weekDayCounter], weekDayLabelShort: this.params.weekDayLabelsShort[weekDayCounter], weekDayNumber:weekDayCounter, isWeekend:this.isWeekend(i), elementId:this.WEEKDAY_ELEMENT_ID+i, component:this};
+ var weekDayHtml = this.evaluateMarkup(this.params.weekDayMarkup, context );
+ if (weekDayCounter==6) weekDayCounter=0; else weekDayCounter++;
+
+ styleClass = "rich-calendar-days";
+ if (context.isWeekend)
+ {
+ styleClass += " rich-calendar-weekends";
+ }
+ if (i==6) styleClass += " rich-right-cell";
+ htmlTextWeekDayBar.push('<td class="'+styleClass+'" id="'+context.elementId+'">'+weekDayHtml+'</td>');
+ }
+ htmlTextWeekDayBar.push('</tr>\n');
+ }
+
+ // week & weekNumber creation
+ var htmlTextWeek=[];
+ var p=0;
+ this.dayCellClassName = [];
+
+ for (k=1;k<7;k++)
+ {
+ bottomStyleClass = (k==6 ? "rich-bottom-cell " : "");
+ htmlTextWeek.push('<tr id="'+this.WEEKNUMBER_BAR_ID+k+'">');
+ if (this.params.showWeeksBar)
+ {
+ context = {weekNumber: k, elementId:this.WEEKNUMBER_ELEMENT_ID+k, component:this};
+ var weekNumberHtml = this.evaluateMarkup(this.params.weekNumberMarkup, context );
+ htmlTextWeek.push('<td class="rich-calendar-week '+bottomStyleClass+'" id="'+context.elementId+'">'+weekNumberHtml+'</td>');
+ }
+
+ // day cells creation
+ for (var i=0;i<7;i++)
+ {
+ styleClass = bottomStyleClass+(!this.params.dayCellClass ? "rich-calendar-cell-size" : (!this.customDayListMarkup ? this.params.dayCellClass : ""))+" rich-calendar-cell";
+ if (i==this.firstWeekendDayNumber || i==this.secondWeekendDayNumber) styleClass+=" rich-calendar-holly";
+ if (i==6) styleClass+=" rich-right-cell";
+
+ this.dayCellClassName.push(styleClass);
+ htmlTextWeek.push('<td class="'+styleClass+'" id="'+this.DATE_ELEMENT_ID+p+'" '+
+ eventsStr+
+ '>'+(this.customDayListMarkup ? '<div class="rich-calendar-cell-div'+(this.params.dayCellClass ? ' '+this.params.dayCellClass : '')+'"></div>' : '')+'</td>');
+ p++;
+ }
+ htmlTextWeek.push('</tr>');
+ }
+
+ var div = rf.getDomElement(this.id);
+ div = $(div).replaceWith(htmlTextHeader+htmlHeaderOptional+htmlControlsHeader+htmlTextWeekDayBar.join('')+htmlTextWeek.join('')+htmlControlsFooter+htmlFooterOptional+htmlTextFooter);
+ this.attachToDom(this.id); // TODO: optimize double $
+
+ // memory leaks fix // from old 3.3.x code, may be not needed now
+ div = null;
+
+ // add onclick event handlers to input field and popup button
+ if (this.params.popup && !this.params.disabled)
+ {
+ var handler = new Function ('event', "RichFaces.$('"+this.id+"').doSwitch();");
+ rf.Event.bindById(this.POPUP_BUTTON_ID, "click"+this.namespace, handler, this);
+ if (!this.params.enableManualInput)
+ {
+ rf.Event.bindById(this.INPUT_DATE_ID, "click"+this.namespace, handler, this);
+ }
+ }
+
+ this.scrollElements = null;
+
+ //alert(new Date().getTime()-_d.getTime());
+
+ };
+
+ // Extend component class and add protected methods from parent class to our container
+ rf.BaseComponent.extend(rf.ui.Calendar);
+
+ // define super class link
+ var $super = rf.ui.Calendar.$super;
+
+ // static methods definition
+ var locales = {};
+
+ rf.ui.Calendar.addLocale = function (locale, symbols) {
+ if (!locales[locale]) {
+ locales[locale] = symbols;
+ }
+ };
+
+ /*
+ * Prototype definition
+ */
+ $.extend(rf.ui.Calendar.prototype, {
+ name: "Calendar",
+ destructor: function()
+ {
+ if (this.params.popup && this.isVisible)
+ {
+ this.scrollElements && rf.Event.unbindScrollEventHandlers(this.scrollElements, this);
+ this.scrollElements = null;
+ rf.Event.unbind(window.document, "click"+this.namespace);
+ }
+ },
+
+ dateEditorSelectYear: function(value)
+ {
+ if (this.dateEditorYearID)
+ {
+ $(rf.getDomElement(this.dateEditorYearID)).removeClass('rich-calendar-editor-btn-selected');
+ }
+ this.dateEditorYear = this.dateEditorStartYear + value;
+ this.dateEditorYearID = this.DATE_EDITOR_LAYOUT_ID+'Y'+value;
+ $(rf.getDomElement(this.dateEditorYearID)).addClass('rich-calendar-editor-btn-selected');
+ },
+
+ dateEditorSelectMonth: function(value)
+ {
+ this.dateEditorMonth = value;
+ $(rf.getDomElement(this.dateEditorMonthID)).removeClass('rich-calendar-editor-btn-selected');
+ this.dateEditorMonthID = this.DATE_EDITOR_LAYOUT_ID+'M'+value;
+ $(rf.getDomElement(this.dateEditorMonthID)).addClass('rich-calendar-editor-btn-selected');
+ },
+
+ scrollEditorYear: function(value)
+ {
+ var element = rf.getDomElement(this.DATE_EDITOR_LAYOUT_ID+'TR');
+
+ if (this.dateEditorYearID)
+ {
+ $(rf.getDomElement(this.dateEditorYearID)).removeClass('rich-calendar-editor-btn-selected');
+ this.dateEditorYearID='';
+ }
+
+ if (!value)
+ {
+ // update month selection when open editor (value == 0)
+ if (this.dateEditorMonth != this.getCurrentMonth())
+ {
+ this.dateEditorMonth = this.getCurrentMonth();
+ $(rf.getDomElement(this.dateEditorMonthID)).removeClass('rich-calendar-editor-btn-selected');
+ this.dateEditorMonthID = this.DATE_EDITOR_LAYOUT_ID+'M'+this.dateEditorMonth;
+ $(rf.getDomElement(this.dateEditorMonthID)).addClass('rich-calendar-editor-btn-selected');
+ }
+ }
+
+ if (element)
+ {
+ var div;
+ var year = this.dateEditorStartYear = this.dateEditorStartYear+value*10;
+ for (var i=0;i<5;i++)
+ {
+ element = element.nextSibling;
+ div = element.firstChild.nextSibling.nextSibling;
+ div.firstChild.innerHTML=year;
+ if (year == this.dateEditorYear)
+ {
+ $(div.firstChild).addClass('rich-calendar-editor-btn-selected');
+ this.dateEditorYearID = div.firstChild.id;
+ }
+ div = div.nextSibling;
+ div.firstChild.innerHTML=year+5;
+ if (year+5 == this.dateEditorYear)
+ {
+ $(div.firstChild).addClass('rich-calendar-editor-btn-selected');
+ this.dateEditorYearID = div.firstChild.id;
+ }
+ year++;
+ }
+ }
+ },
+
+ updateDateEditor: function()
+ {
+ this.dateEditorYear = this.getCurrentYear();
+ this.dateEditorStartYear = this.getCurrentYear() - 4;
+ this.scrollEditorYear(0);
+ },
+
+ updateTimeEditor: function()
+ {
+ var th=rf.getDomElement(this.id+'TimeHours');
+ var ts=rf.getDomElement(this.id+'TimeSign');
+ var tm=rf.getDomElement(this.id+'TimeMinutes');
+
+ var h = this.selectedDate.getHours();
+ var m = this.selectedDate.getMinutes();
+ if (this.timeType==2)
+ {
+ var a = (h<12 ? 'AM' : 'PM');
+ ts.value = a;
+ h = (h==0 ? '12' : (h>12 ? h-12 : h));
+ }
+ th.value = (this.timeHoursDigits==2 && h<10 ? '0'+h : h);
+ tm.value = (m<10 ? '0'+m : m);
+ },
+
+
+ createEditor: function()
+ {
+ var element = $(rf.getDomElement(this.id));
+ var zindex = parseInt(element.css('z-index'), 10);
+ var htmlBegin = '<div id="'+this.EDITOR_SHADOW_ID+'" class="rich-calendar-editor-shadow" style="position:absolute; display:none;z-index:'+zindex+'"></div><table border="0" cellpadding="0" cellspacing="0" id="'+this.EDITOR_ID+'" style="position:absolute; display:none;z-index:'+(zindex+1)+'" onclick="RichFaces.$(\''+this.id+'\').skipEventOnCollapse=true;"><tbody><tr><td class="rich-calendar-editor-container" align="center"><div style="position:relative; width:100%">';
+ var htmlContent = '<div id="'+this.EDITOR_LAYOUT_SHADOW_ID+'" class="rich-calendar-editor-layout-shadow"></div>';
+
+ var htmlEnd = '</div></td></tr></tbody></table>';
+ element.after(htmlBegin+htmlContent+htmlEnd);
+
+ this.isEditorCreated = true;
+
+ return rf.getDomElement(this.EDITOR_ID);
+ },
+
+ createTimeEditorLayout: function(editor)
+ {
+ $(rf.getDomElement(this.EDITOR_LAYOUT_SHADOW_ID)).after(this.evaluateMarkup(CalendarView.timeEditorLayout, this.calendarContext));
+
+ var th=rf.getDomElement(this.id+'TimeHours');
+ var ts;
+ var tm=rf.getDomElement(this.id+'TimeMinutes');
+ if (this.timeType==1)
+ {
+ sbjQuery(th).SpinButton({digits:this.timeHoursDigits,min:0,max:23});
+ }
+ else
+ {
+ sbjQuery(th).SpinButton({digits:this.timeHoursDigits,min:1,max:12});
+ ts=rf.getDomElement(this.id+'TimeSign');
+ sbjQuery(ts).SpinButton({});
+ }
+ sbjQuery(tm).SpinButton({digits:2,min:0,max:59});
+
+ this.correctEditorButtons(editor, this.TIME_EDITOR_BUTTON_OK, this.TIME_EDITOR_BUTTON_CANCEL);
+
+ this.isTimeEditorLayoutCreated = true;
+ },
+
+ correctEditorButtons: function(editor, buttonID1, buttonID2)
+ {
+ var button1 = rf.getDomElement(buttonID1);
+ var button2 = rf.getDomElement(buttonID2);
+ editor.style.visibility = "hidden";
+ editor.style.display = "";
+ var width1 = $(button1.firstChild).width();
+ var width2 = $(button2.firstChild).width();
+ editor.style.display = "none";
+ editor.style.visibility = "";
+
+ if (width1!=width2)
+ {
+ button1.style.width = button2.style.width = (width1>width2 ? width1 : width2)+"px";
+ }
+ },
+
+ createDECell: function(id, value, buttonType, param, className)
+ {
+ if (buttonType==0)
+ {
+ return '<div id="'+id+'" class="rich-calendar-editor-btn'+(className ? ' '+className : '')+
+ '" onmouseover="this.className=\'rich-calendar-editor-btn rich-calendar-editor-tool-over\';" onmouseout="this.className=\'rich-calendar-editor-btn\';" onmousedown="this.className=\'rich-calendar-editor-btn rich-calendar-editor-tool-press\';" onmouseup="this.className=\'rich-calendar-editor-btn rich-calendar-editor-tool-over\';" onclick="RichFaces.$(\''+this.id+'\').scrollEditorYear('+param+');">'+value+'</div>';
+ }
+ else
+ {
+ var onclick = (buttonType==1 ? 'RichFaces.$(\''+this.id+'\').dateEditorSelectMonth('+param+');':
+ 'RichFaces.$(\''+this.id+'\').dateEditorSelectYear('+param+');' );
+ return '<div id="'+id+'" class="rich-calendar-editor-btn'+(className ? ' '+className : '')+
+ '" onmouseover="jQuery(this).addClass(\'rich-calendar-editor-btn-over\');" onmouseout="$(this).removeClass(\'rich-calendar-editor-btn-over\');" onclick="'+onclick+'">'+value+'</div>';
+ }
+ },
+
+ createDateEditorLayout: function(editor)
+ {
+ var htmlBegin = '<table id="'+this.DATE_EDITOR_LAYOUT_ID+'" class="rich-calendar-date-layout" border="0" cellpadding="0" cellspacing="0"><tbody><tr id="'+this.DATE_EDITOR_LAYOUT_ID+'TR">';
+ var htmlEnd = '</tr></tbody></table>';
+ var month = 0;
+ this.dateEditorYear = this.getCurrentYear();
+ var year = this.dateEditorStartYear = this.dateEditorYear-4;
+ var htmlContent = '<td align="center">'+this.createDECell(this.DATE_EDITOR_LAYOUT_ID+'M'+month, this.params.monthLabelsShort[month], 1, month)+'</td>'
+ +'<td align="center" class="rich-calendar-date-layout-split">'+this.createDECell(this.DATE_EDITOR_LAYOUT_ID+'M'+(month+6), this.params.monthLabelsShort[month+6], 1, month+6)+'</td>'
+ +'<td align="center">'+this.createDECell('','<', 0, -1)+'</td>'
+ +'<td align="center">'+this.createDECell('','>', 0, 1)+'</td>';
+ month++;
+
+ for (var i=0;i<5;i++)
+ {
+ htmlContent+='</tr><tr><td align="center">'+this.createDECell(this.DATE_EDITOR_LAYOUT_ID+'M'+month, this.params.monthLabelsShort[month], 1, month)+'</td>'
+ +'<td align="center" class="rich-calendar-date-layout-split">'+this.createDECell(this.DATE_EDITOR_LAYOUT_ID+'M'+(month+6), this.params.monthLabelsShort[month+6], 1, month+6)+'</td>'
+ +'<td align="center">'+this.createDECell(this.DATE_EDITOR_LAYOUT_ID+'Y'+i, year, 2, i, (i==4 ? 'rich-calendar-editor-btn-selected' : ''))+'</td>'
+ +'<td align="center">'+this.createDECell(this.DATE_EDITOR_LAYOUT_ID+'Y'+(i+5), year+5, 2, i+5)+'</td>';
+ month++;
+ year++;
+ }
+ this.dateEditorYearID = this.DATE_EDITOR_LAYOUT_ID+'Y4';
+ this.dateEditorMonth = this.getCurrentMonth();
+ this.dateEditorMonthID = this.DATE_EDITOR_LAYOUT_ID+'M'+this.dateEditorMonth;
+
+ htmlContent+='</tr><tr><td colspan="2" class="rich-calendar-date-layout-ok">'+
+ '<div id="'+this.DATE_EDITOR_BUTTON_OK+'" class="rich-calendar-time-btn" style="float:right;" onmousedown="jQuery(this).addClass(\'rich-calendar-time-btn-press\');" onmouseout="$(this).removeClass(\'rich-calendar-time-btn-press\');" onmouseup="$(this).removeClass(\'rich-calendar-time-btn-press\');" onclick="RichFaces.$(\''+this.id+'\').hideDateEditor(true);"><span>'+this.params.labels.ok+'</span></div>'+
+ '</td><td colspan="2" class="rich-calendar-date-layout-cancel">'+
+ '<div id="'+this.DATE_EDITOR_BUTTON_CANCEL+'" class="rich-calendar-time-btn" style="float:left;" onmousedown="jQuery(this).addClass(\'rich-calendar-time-btn-press\');" onmouseout="$(this).removeClass(\'rich-calendar-time-btn-press\');" onmouseup="$(this).removeClass(\'rich-calendar-time-btn-press\');" onclick="RichFaces.$(\''+this.id+'\').hideDateEditor(false);"><span>'+this.params.labels.cancel+'</span></div>'+
+ '</td>';
+
+
+ $(rf.getDomElement(this.EDITOR_LAYOUT_SHADOW_ID)).after(htmlBegin+htmlContent+htmlEnd);
+
+ $(rf.getDomElement(this.dateEditorMonthID)).addClass('rich-calendar-editor-btn-selected');
+
+ this.correctEditorButtons(editor, this.DATE_EDITOR_BUTTON_OK, this.DATE_EDITOR_BUTTON_CANCEL);
+
+ this.isDateEditorLayoutCreated = true;
+ },
+
+ createSpinnerTable: function(id) {
+ return '<table cellspacing="0" cellpadding="0" border="0"><tbody><tr>'+
+ '<td class="rich-calendar-spinner-input-container">'+
+ '<input id="' + id + '" name="' + id + '" class="rich-calendar-spinner-input" type="text" />'+
+ '</td>'+
+ '<td class="rich-calendar-spinner-buttons">'+
+ '<table border="0" cellspacing="0" cellpadding="0"><tbody>'+
+ '<tr><td>'+
+ '<div id="'+id+'BtnUp" class="rich-calendar-spinner-up"'+
+ ' onmousedown="this.className=\'rich-calendar-spinner-up rich-calendar-spinner-pressed\'"'+
+ ' onmouseup="this.className=\'rich-calendar-spinner-up\'"'+
+ ' onmouseout="this.className=\'rich-calendar-spinner-up\'"><span></span></div>'+
+ '</td></tr>'+
+ '<tr><td>'+
+ '<div id="'+id+'BtnDown" class="rich-calendar-spinner-down"'+
+ ' onmousedown="this.className=\'rich-calendar-spinner-down rich-calendar-spinner-pressed\'"'+
+ ' onmouseup="this.className=\'rich-calendar-spinner-down\'"'+
+ ' onmouseout="this.className=\'rich-calendar-spinner-down\'"><span></span></div>'+
+ '</td></tr>'+
+ '</tbody></table>'+
+ '</td>'+
+ '</tr></tbody></table>';
+ },
+
+ setTimeProperties: function() {
+ this.timeType = 0;
+
+ var dateTimePattern = this.params.datePattern;
+ var pattern = [];
+ var re = /(\\\\|\\[yMdaHhm])|(y+|M+|d+|a|H{1,2}|h{1,2}|m{2})/g;
+ var r;
+ while (r = re.exec(dateTimePattern))
+ if (!r[1])
+ pattern.push({str:r[0],marker:r[2],idx:r.index});
+
+ var datePattern = "";
+ var timePattern = "";
+
+ var digits,h,hh,m,a;
+ var id = this.id;
+
+ var getString = function (p) {
+ return (p.length==0 ? obj.marker : dateTimePattern.substring(pattern[i-1].str.length+pattern[i-1].idx, obj.idx+obj.str.length));
+ };
+
+ for (var i=0;i<pattern.length;i++)
+ {
+ var obj = pattern[i];
+ var ch = obj.marker.charAt(0);
+ if (ch=='y'||ch=='M'||ch=='d') datePattern+=getString(datePattern);
+ else if (ch=='a')
+ {
+ a=true;
+ timePattern+=getString(timePattern);
+ }
+ else if (ch=='H')
+ {
+ h=true;
+ digits=obj.marker.length;
+ timePattern+=getString(timePattern);
+ }
+ else if (ch=='h')
+ {
+ hh=true;
+ digits=obj.marker.length;
+ timePattern+=getString(timePattern);
+ }
+ else if (ch=='m')
+ {
+ m=true;
+ timePattern+=getString(timePattern);
+ }
+
+
+ }
+ this.datePattern = datePattern;
+ this.timePattern = timePattern;
+
+ var calendar = this;
+
+ this.timePatternHtml = timePattern.replace(/(\\\\|\\[yMdaHhm])|(H{1,2}|h{1,2}|m{2}|a)/g,
+ function($1,$2,$3) {
+ if ($2) return $2.charAt(1);
+ switch ($3) {
+ case 'a' : return '</td><td>'+calendar.createSpinnerTable(id+'TimeSign')+'</td><td>';
+ case 'H' :
+ case 'HH' :
+ case 'h' :
+ case 'hh' : return '</td><td>'+calendar.createSpinnerTable(id+'TimeHours')+'</td><td>';
+ case 'mm' : return '</td><td>'+calendar.createSpinnerTable(id+'TimeMinutes')+'</td><td>';
+ }
+ }
+ );
+
+ this.timePatternHtml = '<table border="0" cellpadding="0"><tbody><tr><td>'+this.timePatternHtml+'</td></tr></tbody></table>';
+
+ if (m && h)
+ {
+ this.timeType = 1;
+ }
+ else if (m && hh && a)
+ {
+ this.timeType = 2;
+ }
+ this.timeHoursDigits = digits;
+ },
+
+ eventOnScroll: function (e) {
+ this.doCollapse();
+ },
+
+ doCollapse: function() {
+
+ if (!this.params.popup || !this.isVisible) return;
+
+ var element = rf.getDomElement(this.id);
+
+ if (this.invokeEvent("collapse", element))
+ {
+ if (this.isEditorVisible) this.hideEditor();
+ this.scrollElements && rf.Event.unbindScrollEventHandlers(this.scrollElements, this);
+ this.scrollElements = null;
+ rf.Event.unbind(window.document, "click"+this.namespace);
+
+ $(element).hide();
+ this.isVisible = false;
+
+ }
+ },
+
+ collapse: function() {
+ this.doCollapse();
+ },
+
+ doExpand: function(e) {
+ if (!this.isRendered) {
+ this.isRendered = true;
+ this.render();
+ }
+ this.skipEventOnCollapse = false;
+ if (e && e.type=='click') this.skipEventOnCollapse = true;
+ if (!this.params.popup || this.isVisible) return;
+
+ var element = rf.getDomElement(this.id);
+
+ if (this.invokeEvent("expand", element, e))
+ {
+ var base = rf.getDomElement(this.POPUP_ID)
+ var baseInput = base.firstChild;
+ var baseButton = baseInput.nextSibling;
+
+ if (baseInput && baseInput.value!=undefined)
+ {
+ this.selectDate(baseInput.value, false, {event:e, element:element});
+ }
+
+ //rect calculation
+
+ if (this.params.showInput)
+ {
+ base = base.children;
+ } else {
+ base = baseButton;
+ };
+
+ $(element).setPosition(base, {type:"DROPDOWN", from: this.params.jointPoint, to:this.params.direction, offset: this.popupOffset}).show();
+
+ this.isVisible = true;
+
+ rf.Event.bind(window.document, "click"+this.namespace, this.eventOnCollapse, this);
+
+ this.scrollElements && rf.Event.unbindScrollEventHandlers(this.scrollElements, this);
+ this.scrollElements = null;
+ if (this.params.hidePopupOnScroll) {
+ this.scrollElements = rf.Event.bindScrollEventHandlers(element, this.eventOnScroll, this);
+ }
+ }
+ },
+
+ expand: function(e) {
+ this.doExpand(e);
+ },
+
+ doSwitch: function(e) {
+ this.isVisible ? this.doCollapse() : this.doExpand(e);
+ },
+
+ switchState: function(e) {
+ this.doSwitch(e);
+ },
+
+ eventOnCollapse: function (e) {
+ if (this.skipEventOnCollapse)
+ {
+ this.skipEventOnCollapse = false;
+ return true;
+ }
+
+ if (e.target.id == this.POPUP_BUTTON_ID || (!this.params.enableManualInput && e.target.id == this.INPUT_DATE_ID) ) return true;
+
+ this.doCollapse();
+
+ return true;
+ },
+
+ setInputField: function(dateStr, event)
+ {
+ var field = rf.getDomElement(this.INPUT_DATE_ID);
+ if (field.value!=dateStr)
+ {
+ field.value=dateStr;
+ this.invokeEvent("changed",field, event, this.selectedDate);
+ }
+ },
+
+ getCurrentDate: function() {
+ return this.currentDate;
+ },
+ getSelectedDate: function() {
+ if (!this.selectedDate) return null; else return this.selectedDate;
+ },
+ getSelectedDateString: function(pattern) {
+ if (!this.selectedDate) return "";
+ if (!pattern) pattern = this.params.datePattern;
+ return rf.calendarUtils.formatDate(this.selectedDate, pattern, this.params.monthLabels, this.params.monthLabelsShort);
+ },
+
+ getPrevYear: function() {
+ var value = this.currentDate.getFullYear()-1;
+ if (value<0) value = 0;
+ return value;
+ },
+ getPrevMonth: function(asMonthLabel) {
+ var value = this.currentDate.getMonth()-1;
+ if (value < 0 ) value = 11;
+ if (asMonthLabel)
+ {
+ return this.params.monthLabels[value];
+ } else return value;
+ },
+ getCurrentYear: function() {
+ return this.currentDate.getFullYear();
+ },
+ getCurrentMonth: function(asMonthLabel) {
+ var value = this.currentDate.getMonth();
+ if (asMonthLabel)
+ {
+ return this.params.monthLabels[value];
+ } else return value;
+ },
+ getNextYear: function() {
+ return this.currentDate.getFullYear()+1;
+ },
+ getNextMonth: function(asMonthLabel) {
+ var value = this.currentDate.getMonth()+1;
+ if (value > 11 ) value = 0;
+ if (asMonthLabel)
+ {
+ return this.params.monthLabels[value];
+ } else return value;
+ },
+
+ isWeekend: function(weekday) {
+ return (weekday == this.firstWeekendDayNumber || weekday == this.secondWeekendDayNumber);
+ },
+
+ setupTimeForDate: function (date) {
+ if (this.selectedDate && (!this.params.resetTimeOnDateSelect ||
+ (this.selectedDate.getFullYear() == date.getFullYear() &&
+ this.selectedDate.getMonth() == date.getMonth() &&
+ this.selectedDate.getDate() == date.getDate())))
+ {
+ date.setHours(this.selectedDate.getHours());
+ date.setMinutes(this.selectedDate.getMinutes());
+ } else
+ {
+ date.setHours(this.params.defaultTime.hours);
+ date.setMinutes(this.params.defaultTime.minutes);
+ }
+ },
+
+ eventCellOnClick: function (e, obj) {
+ var daydata = this.days[parseInt(obj.id.substr(this.DATE_ELEMENT_ID.length),10)];
+ if (daydata.enabled && daydata._month==0)
+ {
+ var date=new Date(this.currentDate);
+ date.setDate(daydata.day);
+ if (this.timeType)
+ {
+ this.setupTimeForDate(date);
+ }
+
+ if (this.selectDate(date,true, {event:e, element:obj}) && !this.params.showApplyButton)
+ {
+ this.doCollapse();
+ }
+
+ } else if (daydata._month!=0){
+ if (this.params.boundaryDatesMode == "scroll")
+ if (daydata._month==-1) this.prevMonth(); else this.nextMonth();
+ else if (this.params.boundaryDatesMode == "select")
+ {
+ var date = new Date(daydata.date);
+ if (this.timeType)
+ {
+ this.setupTimeForDate(date);
+ }
+
+ if (this.selectDate(date, false, {event:e, element:obj}) && !this.params.showApplyButton)
+ {
+ this.doCollapse();
+ }
+ }
+ }
+ },
+
+ eventCellOnMouseOver: function (e, obj) {
+ var daydata = this.days[parseInt(obj.id.substr(this.DATE_ELEMENT_ID.length),10)];
+ if (this.invokeEvent("datemouseover", obj, e, daydata.date) && daydata.enabled)
+ {
+ if (daydata._month==0 && obj.id!=this.selectedDateCellId && obj.id!=this.todayCellId) {
+ $(obj).addClass('rich-calendar-hover');
+ }
+ }
+ },
+
+ eventCellOnMouseOut: function (e, obj) {
+ var daydata = this.days[parseInt(obj.id.substr(this.DATE_ELEMENT_ID.length),10)];
+ if (this.invokeEvent("datemouseout", obj, e, daydata.date) && daydata.enabled)
+ {
+ if (daydata._month==0 && obj.id!=this.selectedDateCellId && obj.id!=this.todayCellId) {
+ $(obj).removeClass('rich-calendar-hover');
+ }
+ }
+ },
+
+ load:function(daysData, isAjaxMode) {
+ // startDate,
+ // daysData:array[]
+ // {
+ // day
+ // enabled boolean
+ // text1: 'Meeting...',
+ // text2: 'Meeting...'
+ // tooltip
+ // hasTooltip
+ // styleClass
+ // }
+
+
+ if (daysData) {
+ this.daysData = this.indexData(daysData, isAjaxMode);
+ } else {
+ this.daysData = null;
+ }
+
+ this.isRendered = false;
+ if (this.isVisible) {
+ this.render();
+ };
+
+ if (typeof this.afterLoad=='function')
+ {
+ this.afterLoad();
+ this.afterLoad=null;
+ }
+ },
+
+ indexData:function(daysData, isAjaxMode) {
+ var dateYear = daysData.startDate.getFullYear();
+ var dateMonth = daysData.startDate.getMonth();
+
+ daysData.index = [];
+ daysData.index[dateYear+'-'+dateMonth] = 0;
+ if (isAjaxMode)
+ {
+ this.currentDate = daysData.startDate;
+ this.currentDate.setDate(1);
+ return daysData;
+ }
+ var idx = rf.calendarUtils.daysInMonthByDate(daysData.startDate)-daysData.startDate.getDate()+1;
+
+ while (daysData.days[idx])
+ {
+ if (dateMonth==11) {dateYear++; dateMonth=0;} else dateMonth++;
+ daysData.index[dateYear+'-'+dateMonth] = idx;
+ idx+= (32 - new Date(dateYear, dateMonth, 32).getDate());
+ }
+ return daysData;
+ },
+
+ getCellBackgroundColor: function(element)
+ {
+ return $(element).css('background-color');
+ },
+
+ clearEffect: function (element_id, className, className1)
+ {
+ if (element_id)
+ {
+ var e = $(rf.getDomElement(element_id)).stop(true, true);
+ if (className) e.removeClass(className);
+ if (className1) e.addClass(className1);
+ }
+ return null;
+ },
+
+ render:function() {
+ //var _d=new Date();
+ this.isRendered = true;
+ this.todayDate = new Date();
+
+ var currentYear = this.getCurrentYear();
+ var currentMonth = this.getCurrentMonth();
+
+ var todayflag = (currentYear == this.todayDate.getFullYear() && currentMonth == this.todayDate.getMonth());
+ var todaydate = this.todayDate.getDate();
+
+ var selectedflag = this.selectedDate && (currentYear == this.selectedDate.getFullYear() && currentMonth == this.selectedDate.getMonth())
+ var selecteddate = this.selectedDate && this.selectedDate.getDate();
+
+ var wd = rf.calendarUtils.getDay(this.currentDate, this.params.firstWeekDay);
+ var currentMonthDays = rf.calendarUtils.daysInMonthByDate(this.currentDate);
+ var previousMonthDays = rf.calendarUtils.daysInMonth(currentYear, currentMonth-1);
+
+ var p=0;
+ var month=-1;
+ this.days = [];
+ var dayCounter = previousMonthDays - wd + 1;
+
+ // previuos month days
+ if (wd>0) while (dayCounter<=previousMonthDays)
+ {
+ this.days.push({day:dayCounter, isWeekend: this.isWeekend(p), _month:month}); dayCounter++; p++;
+ }
+
+ dayCounter = 1;
+ month=0;
+
+ this.firstDateIndex = p;
+
+ // current month days
+ if (this.daysData && this.daysData.index[currentYear+'-'+currentMonth]!=undefined)
+ {
+ var idx = this.daysData.index[currentYear+'-'+currentMonth];
+ if (this.daysData.startDate.getFullYear()==currentYear && this.daysData.startDate.getMonth()==currentMonth)
+ {
+ var firstDay = firstDay=(this.daysData.days[idx].day ? this.daysData.days[idx].day : this.daysData.startDate.getDate());
+ while (dayCounter<firstDay)
+ {
+ this.days.push({day:dayCounter, isWeekend:this.isWeekend(p%7), _month:month});
+
+ dayCounter++;
+ p++;
+ }
+ }
+
+ var len = this.daysData.days.length;
+ var obj;
+ var flag;
+ while (idx<len && dayCounter<=currentMonthDays)
+ {
+ flag = this.isWeekend(p%7);
+ obj = this.daysData.days[idx];
+ obj.day = dayCounter;
+ obj.isWeekend = flag;
+ obj._month = month;
+ this.days.push(obj);
+ idx++;
+ dayCounter++;
+ p++;
+ }
+ }
+ while (p<42)
+ {
+ if (dayCounter>currentMonthDays) {dayCounter=1; month=1;}
+ this.days.push({day:dayCounter, isWeekend: this.isWeekend(p%7), _month:month});
+ dayCounter++;
+ p++;
+ }
+
+ // render
+ this.renderHF();
+
+ //days render
+ p=0;
+ var element;
+ var dataobj;
+ var wn;
+ if (this.params.showWeeksBar) wn = rf.calendarUtils.weekNumber(currentYear, currentMonth, this.params.minDaysInFirstWeek, this.params.firstWeekDay); /// fix it
+ this.selectedDayElement=null;
+ var weekflag=true;
+
+ var e;
+
+ var boundaryDatesModeFlag = (this.params.boundaryDatesMode == "scroll" || this.params.boundaryDatesMode == "select");
+
+ this.todayCellId = this.clearEffect(this.todayCellId);
+ this.selectedDateCellId = this.clearEffect(this.selectedDateCellId);
+
+ //var _d=new Date();
+ var obj = rf.getDomElement(this.WEEKNUMBER_BAR_ID+"1");
+ for (var k=1;k<7;k++)
+ {
+ //
+ dataobj = this.days[p];
+
+ element = obj.firstChild;
+ var weeknumber;
+
+ // week number update
+ if (this.params.showWeeksBar)
+ {
+ // TODO: fix: there is no weekNumber in dataobj if showWeeksBar == false;
+ if (weekflag && currentMonth==11 &&
+ (k==5||k==6) &&
+ (dataobj._month==1 || (7 - (currentMonthDays - dataobj.day + 1)) >= this.params.minDaysInFirstWeek) )
+ {
+ wn=1;
+ weekflag=false;
+ }
+ weeknumber = wn;
+ element.innerHTML = this.evaluateMarkup(this.params.weekNumberMarkup, {weekNumber: wn++, elementId:element.id, component:this} );
+ if (k==1&&wn>52) wn=1;
+ element = element.nextSibling;
+ }
+
+ var weekdaycounter = this.params.firstWeekDay;
+ var contentElement = null;
+
+ while (element)
+ {
+ dataobj.elementId=element.id;
+ dataobj.date=new Date(currentYear, currentMonth+dataobj._month, dataobj.day);
+ dataobj.weekNumber = weeknumber;
+ dataobj.component = this;
+ dataobj.isCurrentMonth = (dataobj._month==0);
+ dataobj.weekDayNumber = weekdaycounter;
+
+ // call user function to get day state
+ if (dataobj.enabled != false) dataobj.enabled = this.params.isDayEnabled(dataobj);
+ // call user function to custom class style
+ if (!dataobj.styleClass) dataobj.customStyleClass = this.params.dayStyleClass(dataobj);
+ else
+ {
+ var styleclass = this.params.dayStyleClass(dataobj);
+ dataobj.customStyleClass = dataobj.styleClass;
+ if (styleclass) dataobj.customStyleClass += " " + styleclass;
+ }
+
+ contentElement = (this.customDayListMarkup ? element.firstChild : element);
+ contentElement.innerHTML = this.evaluateMarkup(this.params.dayListMarkup, dataobj );
+
+ if (weekdaycounter==6) weekdaycounter=0; else weekdaycounter++;
+
+ var classNames = this.dayCellClassName[p];
+
+ // class styles
+ if (dataobj._month!=0)
+ {
+ classNames+=' rich-calendar-boundary-dates';
+ if (!this.params.disabled && !this.params.readonly && boundaryDatesModeFlag)
+ {
+ classNames+=' rich-calendar-btn';
+ }
+ }
+ else
+ {
+ if (todayflag && dataobj.day==todaydate)
+ {
+ this.todayCellId = element.id;
+ this.todayCellColor = this.getCellBackgroundColor(element);
+ classNames+=" rich-calendar-today";
+ }
+
+ if (selectedflag && dataobj.day==selecteddate)
+ {
+ this.selectedDateCellId = element.id;
+ this.selectedDateCellColor = this.getCellBackgroundColor(element);
+ classNames+=" rich-calendar-select";
+ }
+ else if (!this.params.disabled && !this.params.readonly && dataobj.enabled) classNames+=' rich-calendar-btn';
+
+ // add custom style class
+ if (dataobj.customStyleClass)
+ {
+ classNames+=' '+dataobj.customStyleClass;
+ }
+ }
+ element.className = classNames;
+
+ p++;
+
+ dataobj = this.days[p];
+ element=element.nextSibling;
+ }
+ obj = obj.nextSibling;
+ }
+
+ //alert(new Date().getTime()-_d.getTime());
+
+ },
+
+ renderHF: function()
+ {
+ if (this.params.showHeader) this.renderMarkup(this.params.headerMarkup, this.id+"Header", this.calendarContext);
+ if (this.params.showFooter) this.renderMarkup(this.params.footerMarkup, this.id+"Footer", this.calendarContext);
+
+ this.renderHeaderOptional();
+ this.renderFooterOptional();
+ },
+
+ renderHeaderOptional: function()
+ {
+ this.renderMarkup(this.params.optionalHeaderMarkup, this.id+"HeaderOptional", this.calendarContext);
+ },
+
+ renderFooterOptional: function()
+ {
+ this.renderMarkup(this.params.optionalFooterMarkup, this.id+"FooterOptional", this.calendarContext);
+ },
+
+ renderMarkup: function (markup, elementId, context)
+ {
+ if (!markup) return;
+
+ var e = rf.getDomElement(elementId);
+ if (!e) return;
+
+ e.innerHTML = this.evaluateMarkup(markup, context);
+ },
+
+ evaluateMarkup: function(markup, context)
+ {
+ if (!markup) return "";
+
+ var result = [];
+ var m;
+ for (var i=0; i<markup.length; i++) {
+ m = markup[i];
+ if (m['getContent']) {
+ result.push(m.getContent(context));
+ }
+ }
+ return result.join('');
+ },
+
+ onUpdate: function()
+ {
+ var formattedDate = rf.calendarUtils.formatDate(this.getCurrentDate(),"MM/yyyy");
+ rf.getDomElement(this.id+'InputCurrentDate').value=formattedDate;
+
+ if (this.submitFunction)
+ this.submitFunction.call(this, formattedDate);
+ else
+ this.render();
+ },
+
+ nextMonth: function() {
+ this.changeCurrentDateOffset(0,1);
+ },
+
+ prevMonth: function() {
+ this.changeCurrentDateOffset(0,-1);
+ },
+
+ nextYear: function() {
+ this.changeCurrentDateOffset(1,0);
+ },
+
+ prevYear: function() {
+ this.changeCurrentDateOffset(-1,0);
+ },
+
+ changeCurrentDate: function(year, month, noUpdate) {
+ if (this.getCurrentMonth()!=month || this.getCurrentYear()!=year)
+ {
+ var date = new Date(year, month,1);
+ if (this.invokeEvent("currentdateselect", rf.getDomElement(this.id), null, date))
+ {
+ // fix for RF-2450.
+ // Additional event is fired: after the hidden input with current date
+ // value is updated in function onUpdate() and then
+ // the "currentdateselected" Event is fired.
+ this.currentDate = date;
+ if (noUpdate) this.render(); else this.onUpdate();
+ this.invokeEvent("currentdateselected", rf.getDomElement(this.id), null, date);
+ return true;
+ }
+ }
+ return false;
+ },
+
+ changeCurrentDateOffset: function(yearOffset, monthOffset) {
+ var date = new Date(this.currentDate.getFullYear()+yearOffset, this.currentDate.getMonth()+monthOffset,1);
+
+ if (this.invokeEvent("currentdateselect", rf.getDomElement(this.id), null, date))
+ {
+ // fix for RF-2450.
+ // Additional event is fired: after the hidden input with current date
+ // value is updated in function onUpdate() and then
+ // the "currentdateselected" Event is fired.
+ this.currentDate = date;
+ this.onUpdate();
+ this.invokeEvent("currentdateselected", rf.getDomElement(this.id), null, date);
+ }
+ },
+
+ today: function(noUpdate, noHighlight) {
+
+ var now = new Date();
+
+ var nowyear = now.getFullYear();
+ var nowmonth = now.getMonth();
+ var nowdate = now.getDate();
+ var updateflag = false;
+
+ if (nowdate!=this.todayDate.getDate()) {updateflag=true; this.todayDate = now;}
+
+ if (nowyear != this.currentDate.getFullYear() || nowmonth != this.currentDate.getMonth() )
+ {
+ updateflag = true;
+ this.currentDate = new Date(nowyear, nowmonth, 1);
+ }
+
+ if (this.params.todayControlMode=='select')
+ {
+ noHighlight=true;
+ }
+
+ if (updateflag)
+ {
+ if (noUpdate) this.render(); else this.onUpdate();
+ }
+ else
+ {
+ // highlight today
+
+ if (this.isVisible && this.todayCellId && !noHighlight)
+ {
+ this.clearEffect(this.todayCellId);
+ if (this.todayCellColor!="transparent")
+ {
+ $(rf.getDomElement(this.todayCellId)).effect("highlight", {easing:'easeInOutSine', color: this.todayCellColor}, 300);
+ }
+ }
+ }
+
+ // todayControl select mode
+ if (this.params.todayControlMode=='select' && !this.params.disabled && !this.params.readonly)
+ if (updateflag && !noUpdate && this.submitFunction)
+ {
+ this.afterLoad = this.selectToday;
+ }
+ else this.selectToday();
+
+ },
+
+ selectToday: function()
+ {
+ if (this.todayCellId)
+ {
+ var daydata = this.days[parseInt(this.todayCellId.substr(this.DATE_ELEMENT_ID.length),10)];
+ var today = new Date();
+ var date = new Date(today.getFullYear(), today.getMonth(), today.getDate());
+ if (this.timeType)
+ {
+ this.setupTimeForDate(date);
+ }
+ if (daydata.enabled && this.selectDate(date,true) && !this.params.showApplyButton)
+ {
+ this.doCollapse();
+ }
+ }
+ },
+
+ selectDate: function(date, noUpdate, eventData) {
+
+ if (!eventData)
+ {
+ eventData = {event: null, element: null};
+ }
+
+ var oldSelectedDate = this.selectedDate;
+ var newSelectedDate;
+ if (date)
+ {
+ if (typeof date=='string')
+ {
+ date = rf.calendarUtils.parseDate(date,this.params.datePattern, this.params.monthLabels, this.params.monthLabelsShort);
+ }
+ newSelectedDate = date;
+ }
+ else
+ {
+ newSelectedDate = null;
+ }
+
+ // fire user event
+ var flag = true;
+ var isDateChange = false;
+ if ( (oldSelectedDate - newSelectedDate) && (oldSelectedDate!=null || newSelectedDate!=null) )
+ {
+ isDateChange = true;
+ flag = this.invokeEvent("dateselect", eventData.element, eventData.event, date);
+ }
+
+ if (flag)
+ {
+ if (newSelectedDate!=null)
+ {
+ if (newSelectedDate.getMonth()==this.currentDate.getMonth() && newSelectedDate.getFullYear()==this.currentDate.getFullYear())
+ {
+ this.selectedDate = newSelectedDate;
+ if (!oldSelectedDate || (oldSelectedDate - this.selectedDate))
+ {
+ // find cell and change style class
+ var e = $(rf.getDomElement(this.DATE_ELEMENT_ID+(this.firstDateIndex + this.selectedDate.getDate()-1)));
+
+ this.clearEffect(this.selectedDateCellId, "rich-calendar-select", (this.params.disabled || this.params.readonly ? null : "rich-calendar-btn"));
+ this.selectedDateCellId = e.attr('id');
+ this.selectedDateCellColor = this.getCellBackgroundColor(e);
+
+ e.removeClass("rich-calendar-btn");
+ e.removeClass("rich-calendar-hover");
+ e.addClass("rich-calendar-select");
+
+ this.renderHF();
+ }
+ else if (this.timeType!=0) this.renderHF();
+ }
+ else
+ {
+ //RF-5600
+ this.selectedDate = newSelectedDate;
+
+ // change currentDate and call this.onUpdate();
+ if (this.changeCurrentDate(newSelectedDate.getFullYear(), newSelectedDate.getMonth(), noUpdate))
+ {
+ //this.selectedDate = newSelectedDate;
+ } else {
+ this.selectedDate = oldSelectedDate;
+ isDateChange = false;
+ }
+ }
+ }
+ else
+ {
+ this.selectedDate = null;
+
+ this.clearEffect(this.selectedDateCellId, "rich-calendar-select", (this.params.disabled || this.params.readonly ? null : "rich-calendar-btn"));
+
+ if (this.selectedDateCellId)
+ {
+ this.selectedDateCellId = null;
+ this.renderHF();
+ }
+
+ var date = new Date();
+ if (this.currentDate.getMonth()==date.getMonth() && this.currentDate.getFullYear()==date.getFullYear())
+ {
+ this.renderHF();
+ }
+
+ var todayControlMode = this.params.todayControlMode;
+ this.params.todayControlMode = '';
+ this.today(noUpdate, true);
+ this.params.todayControlMode = todayControlMode;
+ }
+
+ // call user event
+ if (isDateChange)
+ {
+ this.invokeEvent("dateselected", eventData.element, eventData.event, this.selectedDate);
+ if (!this.params.showApplyButton)
+ {
+ this.setInputField(this.selectedDate!=null ? this.getSelectedDateString(this.params.datePattern) : "", eventData.event);
+ }
+ }
+ }
+
+ return isDateChange;
+ },
+
+ resetSelectedDate: function()
+ {
+ if (!this.selectedDate) return;
+ if (this.invokeEvent("dateselect", null, null, null))
+ {
+ this.selectedDate = null;
+ this.invokeEvent("dateselected", null, null, null);
+
+ this.selectedDateCellId = this.clearEffect(this.selectedDateCellId, "rich-calendar-select", (this.params.disabled || this.params.readonly ? null : "rich-calendar-btn"));
+
+ this.renderHF();
+ if (!this.params.showApplyButton)
+ {
+ this.setInputField("", null);
+ this.doCollapse();
+ }
+ }
+ },
+
+ showSelectedDate: function()
+ {
+ if (!this.selectedDate) return;
+ if (this.currentDate.getMonth()!=this.selectedDate.getMonth() || this.currentDate.getFullYear()!=this.selectedDate.getFullYear())
+ {
+ this.currentDate = new Date(this.selectedDate);
+ this.currentDate.setDate(1);
+ this.onUpdate();
+ }
+ else
+ {
+ // highlight Selected Date
+ if (this.isVisible && this.selectedDateCellId)
+ {
+ this.clearEffect(this.selectedDateCellId);
+ if (this.selectedDateCellColor!="transparent")
+ {
+ $(rf.getDomElement(this.selectedDateCellId)).effect("highlight", {easing:'easeInOutSine', color: this.selectedDateCellColor}, 300);
+
+ }
+ }
+ }
+ },
+
+ close: function(updateDate)
+ {
+ if (updateDate)
+ {
+ this.setInputField(this.getSelectedDateString(this.params.datePattern), null);
+ }
+ this.doCollapse();
+ },
+
+ clonePosition: function (source, elements, offset)
+ {
+ var jqe = $(source);
+ if (!elements.length) elements = [elements];
+ offset = offset || {left:0,top:0};
+ var width = jqe.outerWidth()+"px", height = jqe.outerHeight()+"px";
+ var pos = jqe.position();
+ var left = Math.floor(pos.left)+offset.left+"px", top = Math.floor(pos.top)+offset.top+"px";
+ var element;
+ for (var i = 0; i<elements.length;i++) {
+ element = elements[i];
+ element.style.width = width;
+ element.style.height = height;
+ element.style.left = left;
+ element.style.top = top;
+ }
+ },
+
+ showTimeEditor: function()
+ {
+ var editor;
+ if (this.timeType==0) return;
+ if (!this.isEditorCreated) editor = this.createEditor();
+ else editor = rf.getDomElement(this.EDITOR_ID);
+ if (!this.isTimeEditorLayoutCreated) this.createTimeEditorLayout(editor);
+
+ $(rf.getDomElement(this.TIME_EDITOR_LAYOUT_ID)).show();
+
+ var editor_shadow = rf.getDomElement(this.EDITOR_SHADOW_ID);
+
+ this.clonePosition(rf.getDomElement(this.id), [editor, editor_shadow]);
+
+ this.updateTimeEditor();
+
+ $(editor_shadow).show();
+
+ $(editor).show();
+
+ this.clonePosition(rf.getDomElement(this.TIME_EDITOR_LAYOUT_ID), rf.getDomElement(this.EDITOR_LAYOUT_SHADOW_ID), {left: 3, top: 3});
+ this.isEditorVisible = true;
+ },
+
+ hideEditor: function()
+ {
+ if (this.isTimeEditorLayoutCreated) $(rf.getDomElement(this.TIME_EDITOR_LAYOUT_ID)).hide();
+ if (this.isDateEditorLayoutCreated) $(rf.getDomElement(this.DATE_EDITOR_LAYOUT_ID)).hide();
+ $(rf.getDomElement(this.EDITOR_ID)).hide();
+ $(rf.getDomElement(this.EDITOR_SHADOW_ID)).hide();
+ this.isEditorVisible = false;
+ },
+
+ hideTimeEditor: function(updateTime)
+ {
+ this.hideEditor();
+ if (updateTime && this.selectedDate)
+ {
+ var m = parseInt(rf.getDomElement(this.id+'TimeMinutes').value,10);
+ var h=parseInt(rf.getDomElement(this.id+'TimeHours').value,10);
+ if (this.timeType==2)
+ {
+ if (rf.getDomElement(this.id+'TimeSign').value.toLowerCase()=="am")
+ {
+ if (h==12) h = 0;
+ }
+ else
+ {
+ if (h!=12) h+=12;
+ }
+ }
+ var date = new Date(this.selectedDate.getFullYear(), this.selectedDate.getMonth(), this.selectedDate.getDate(), h, m, 0);
+ if (date-this.selectedDate && this.invokeEvent("timeselect",null, null, date))
+ {
+ this.selectedDate = date;
+ this.renderHF();
+ if (!this.params.popup || !this.params.showApplyButton) this.setInputField(this.getSelectedDateString(this.params.datePattern), null);
+ this.invokeEvent("timeselected",null, null, this.selectedDate);
+ }
+ }
+ if (this.params.popup && !this.params.showApplyButton) this.close(false);
+ },
+
+ showDateEditor: function()
+ {
+ var editor;
+ if (!this.isEditorCreated) editor = this.createEditor();
+ else editor = rf.getDomElement(this.EDITOR_ID);
+ if (!this.isDateEditorLayoutCreated) this.createDateEditorLayout(editor);
+ else this.updateDateEditor();
+
+ $(rf.getDomElement(this.DATE_EDITOR_LAYOUT_ID)).show();
+
+ var editor_shadow = rf.getDomElement(this.EDITOR_SHADOW_ID);
+
+ this.clonePosition(rf.getDomElement(this.id), [editor, editor_shadow]);
+
+ $(editor_shadow).show();
+ $(editor).show();
+
+ this.clonePosition(rf.getDomElement(this.DATE_EDITOR_LAYOUT_ID), rf.getDomElement(this.EDITOR_LAYOUT_SHADOW_ID), {left: 3, top: 3});
+
+ this.isEditorVisible = true;
+ },
+
+ hideDateEditor: function(updateCurrentDate)
+ {
+ this.hideEditor();
+ if (updateCurrentDate)
+ {
+ this.changeCurrentDate(this.dateEditorYear, this.dateEditorMonth);
+ }
+ },
+
+ getNamespace: function () {
+ return this.namespace;
+ }
+ });
+})(jQuery, RichFaces);
\ No newline at end of file
Copied: sandbox/trunk/ui/calendar/ui/src/main/resources/META-INF/resources/org.richfaces/jquery.effects.core.js (from rev 19569, sandbox/trunk/prototypes/calendar/jquery.effects.core.js)
===================================================================
--- sandbox/trunk/ui/calendar/ui/src/main/resources/META-INF/resources/org.richfaces/jquery.effects.core.js (rev 0)
+++ sandbox/trunk/ui/calendar/ui/src/main/resources/META-INF/resources/org.richfaces/jquery.effects.core.js 2010-10-19 12:14:33 UTC (rev 19603)
@@ -0,0 +1,714 @@
+/*
+ * jQuery UI Effects 1.8.5
+ *
+ * Copyright 2010, AUTHORS.txt (http://jqueryui.com/about)
+ * Dual licensed under the MIT or GPL Version 2 licenses.
+ * http://jquery.org/license
+ *
+ * http://docs.jquery.com/UI/Effects/
+ */
+;jQuery.effects || (function($, undefined) {
+
+$.effects = {};
+
+
+
+/******************************************************************************/
+/****************************** COLOR ANIMATIONS ******************************/
+/******************************************************************************/
+
+// override the animation for color styles
+$.each(['backgroundColor', 'borderBottomColor', 'borderLeftColor',
+ 'borderRightColor', 'borderTopColor', 'color', 'outlineColor'],
+function(i, attr) {
+ $.fx.step[attr] = function(fx) {
+ if (!fx.colorInit) {
+ fx.start = getColor(fx.elem, attr);
+ fx.end = getRGB(fx.end);
+ fx.colorInit = true;
+ }
+
+ fx.elem.style[attr] = 'rgb(' +
+ Math.max(Math.min(parseInt((fx.pos * (fx.end[0] - fx.start[0])) + fx.start[0], 10), 255), 0) + ',' +
+ Math.max(Math.min(parseInt((fx.pos * (fx.end[1] - fx.start[1])) + fx.start[1], 10), 255), 0) + ',' +
+ Math.max(Math.min(parseInt((fx.pos * (fx.end[2] - fx.start[2])) + fx.start[2], 10), 255), 0) + ')';
+ };
+});
+
+// Color Conversion functions from highlightFade
+// By Blair Mitchelmore
+// http://jquery.offput.ca/highlightFade/
+
+// Parse strings looking for color tuples [255,255,255]
+function getRGB(color) {
+ var result;
+
+ // Check if we're already dealing with an array of colors
+ if ( color && color.constructor == Array && color.length == 3 )
+ return color;
+
+ // Look for rgb(num,num,num)
+ if (result = /rgb\(\s*([0-9]{1,3})\s*,\s*([0-9]{1,3})\s*,\s*([0-9]{1,3})\s*\)/.exec(color))
+ return [parseInt(result[1],10), parseInt(result[2],10), parseInt(result[3],10)];
+
+ // Look for rgb(num%,num%,num%)
+ if (result = /rgb\(\s*([0-9]+(?:\.[0-9]+)?)\%\s*,\s*([0-9]+(?:\.[0-9]+)?)\%\s*,\s*([0-9]+(?:\.[0-9]+)?)\%\s*\)/.exec(color))
+ return [parseFloat(result[1])*2.55, parseFloat(result[2])*2.55, parseFloat(result[3])*2.55];
+
+ // Look for #a0b1c2
+ if (result = /#([a-fA-F0-9]{2})([a-fA-F0-9]{2})([a-fA-F0-9]{2})/.exec(color))
+ return [parseInt(result[1],16), parseInt(result[2],16), parseInt(result[3],16)];
+
+ // Look for #fff
+ if (result = /#([a-fA-F0-9])([a-fA-F0-9])([a-fA-F0-9])/.exec(color))
+ return [parseInt(result[1]+result[1],16), parseInt(result[2]+result[2],16), parseInt(result[3]+result[3],16)];
+
+ // Look for rgba(0, 0, 0, 0) == transparent in Safari 3
+ if (result = /rgba\(0, 0, 0, 0\)/.exec(color))
+ return colors['transparent'];
+
+ // Otherwise, we're most likely dealing with a named color
+ return colors[$.trim(color).toLowerCase()];
+}
+
+function getColor(elem, attr) {
+ var color;
+
+ do {
+ color = $.curCSS(elem, attr);
+
+ // Keep going until we find an element that has color, or we hit the body
+ if ( color != '' && color != 'transparent' || $.nodeName(elem, "body") )
+ break;
+
+ attr = "backgroundColor";
+ } while ( elem = elem.parentNode );
+
+ return getRGB(color);
+};
+
+// Some named colors to work with
+// From Interface by Stefan Petre
+// http://interface.eyecon.ro/
+
+var colors = {
+ aqua:[0,255,255],
+ azure:[240,255,255],
+ beige:[245,245,220],
+ black:[0,0,0],
+ blue:[0,0,255],
+ brown:[165,42,42],
+ cyan:[0,255,255],
+ darkblue:[0,0,139],
+ darkcyan:[0,139,139],
+ darkgrey:[169,169,169],
+ darkgreen:[0,100,0],
+ darkkhaki:[189,183,107],
+ darkmagenta:[139,0,139],
+ darkolivegreen:[85,107,47],
+ darkorange:[255,140,0],
+ darkorchid:[153,50,204],
+ darkred:[139,0,0],
+ darksalmon:[233,150,122],
+ darkviolet:[148,0,211],
+ fuchsia:[255,0,255],
+ gold:[255,215,0],
+ green:[0,128,0],
+ indigo:[75,0,130],
+ khaki:[240,230,140],
+ lightblue:[173,216,230],
+ lightcyan:[224,255,255],
+ lightgreen:[144,238,144],
+ lightgrey:[211,211,211],
+ lightpink:[255,182,193],
+ lightyellow:[255,255,224],
+ lime:[0,255,0],
+ magenta:[255,0,255],
+ maroon:[128,0,0],
+ navy:[0,0,128],
+ olive:[128,128,0],
+ orange:[255,165,0],
+ pink:[255,192,203],
+ purple:[128,0,128],
+ violet:[128,0,128],
+ red:[255,0,0],
+ silver:[192,192,192],
+ white:[255,255,255],
+ yellow:[255,255,0],
+ transparent: [255,255,255]
+};
+
+
+
+/******************************************************************************/
+/****************************** CLASS ANIMATIONS ******************************/
+/******************************************************************************/
+
+var classAnimationActions = ['add', 'remove', 'toggle'],
+ shorthandStyles = {
+ border: 1,
+ borderBottom: 1,
+ borderColor: 1,
+ borderLeft: 1,
+ borderRight: 1,
+ borderTop: 1,
+ borderWidth: 1,
+ margin: 1,
+ padding: 1
+ };
+
+function getElementStyles() {
+ var style = document.defaultView
+ ? document.defaultView.getComputedStyle(this, null)
+ : this.currentStyle,
+ newStyle = {},
+ key,
+ camelCase;
+
+ // webkit enumerates style porperties
+ if (style && style.length && style[0] && style[style[0]]) {
+ var len = style.length;
+ while (len--) {
+ key = style[len];
+ if (typeof style[key] == 'string') {
+ camelCase = key.replace(/\-(\w)/g, function(all, letter){
+ return letter.toUpperCase();
+ });
+ newStyle[camelCase] = style[key];
+ }
+ }
+ } else {
+ for (key in style) {
+ if (typeof style[key] === 'string') {
+ newStyle[key] = style[key];
+ }
+ }
+ }
+
+ return newStyle;
+}
+
+function filterStyles(styles) {
+ var name, value;
+ for (name in styles) {
+ value = styles[name];
+ if (
+ // ignore null and undefined values
+ value == null ||
+ // ignore functions (when does this occur?)
+ $.isFunction(value) ||
+ // shorthand styles that need to be expanded
+ name in shorthandStyles ||
+ // ignore scrollbars (break in IE)
+ (/scrollbar/).test(name) ||
+
+ // only colors or values that can be converted to numbers
+ (!(/color/i).test(name) && isNaN(parseFloat(value)))
+ ) {
+ delete styles[name];
+ }
+ }
+
+ return styles;
+}
+
+function styleDifference(oldStyle, newStyle) {
+ var diff = { _: 0 }, // http://dev.jquery.com/ticket/5459
+ name;
+
+ for (name in newStyle) {
+ if (oldStyle[name] != newStyle[name]) {
+ diff[name] = newStyle[name];
+ }
+ }
+
+ return diff;
+}
+
+$.effects.animateClass = function(value, duration, easing, callback) {
+ if ($.isFunction(easing)) {
+ callback = easing;
+ easing = null;
+ }
+
+ return this.each(function() {
+
+ var that = $(this),
+ originalStyleAttr = that.attr('style') || ' ',
+ originalStyle = filterStyles(getElementStyles.call(this)),
+ newStyle,
+ className = that.attr('className');
+
+ $.each(classAnimationActions, function(i, action) {
+ if (value[action]) {
+ that[action + 'Class'](value[action]);
+ }
+ });
+ newStyle = filterStyles(getElementStyles.call(this));
+ that.attr('className', className);
+
+ that.animate(styleDifference(originalStyle, newStyle), duration, easing, function() {
+ $.each(classAnimationActions, function(i, action) {
+ if (value[action]) { that[action + 'Class'](value[action]); }
+ });
+ // work around bug in IE by clearing the cssText before setting it
+ if (typeof that.attr('style') == 'object') {
+ that.attr('style').cssText = '';
+ that.attr('style').cssText = originalStyleAttr;
+ } else {
+ that.attr('style', originalStyleAttr);
+ }
+ if (callback) { callback.apply(this, arguments); }
+ });
+ });
+};
+
+$.fn.extend({
+ _addClass: $.fn.addClass,
+ addClass: function(classNames, speed, easing, callback) {
+ return speed ? $.effects.animateClass.apply(this, [{ add: classNames },speed,easing,callback]) : this._addClass(classNames);
+ },
+
+ _removeClass: $.fn.removeClass,
+ removeClass: function(classNames,speed,easing,callback) {
+ return speed ? $.effects.animateClass.apply(this, [{ remove: classNames },speed,easing,callback]) : this._removeClass(classNames);
+ },
+
+ _toggleClass: $.fn.toggleClass,
+ toggleClass: function(classNames, force, speed, easing, callback) {
+ if ( typeof force == "boolean" || force === undefined ) {
+ if ( !speed ) {
+ // without speed parameter;
+ return this._toggleClass(classNames, force);
+ } else {
+ return $.effects.animateClass.apply(this, [(force?{add:classNames}:{remove:classNames}),speed,easing,callback]);
+ }
+ } else {
+ // without switch parameter;
+ return $.effects.animateClass.apply(this, [{ toggle: classNames },force,speed,easing]);
+ }
+ },
+
+ switchClass: function(remove,add,speed,easing,callback) {
+ return $.effects.animateClass.apply(this, [{ add: add, remove: remove },speed,easing,callback]);
+ }
+});
+
+
+
+/******************************************************************************/
+/*********************************** EFFECTS **********************************/
+/******************************************************************************/
+
+$.extend($.effects, {
+ version: "1.8.5",
+
+ // Saves a set of properties in a data storage
+ save: function(element, set) {
+ for(var i=0; i < set.length; i++) {
+ if(set[i] !== null) element.data("ec.storage."+set[i], element[0].style[set[i]]);
+ }
+ },
+
+ // Restores a set of previously saved properties from a data storage
+ restore: function(element, set) {
+ for(var i=0; i < set.length; i++) {
+ if(set[i] !== null) element.css(set[i], element.data("ec.storage."+set[i]));
+ }
+ },
+
+ setMode: function(el, mode) {
+ if (mode == 'toggle') mode = el.is(':hidden') ? 'show' : 'hide'; // Set for toggle
+ return mode;
+ },
+
+ getBaseline: function(origin, original) { // Translates a [top,left] array into a baseline value
+ // this should be a little more flexible in the future to handle a string & hash
+ var y, x;
+ switch (origin[0]) {
+ case 'top': y = 0; break;
+ case 'middle': y = 0.5; break;
+ case 'bottom': y = 1; break;
+ default: y = origin[0] / original.height;
+ };
+ switch (origin[1]) {
+ case 'left': x = 0; break;
+ case 'center': x = 0.5; break;
+ case 'right': x = 1; break;
+ default: x = origin[1] / original.width;
+ };
+ return {x: x, y: y};
+ },
+
+ // Wraps the element around a wrapper that copies position properties
+ createWrapper: function(element) {
+
+ // if the element is already wrapped, return it
+ if (element.parent().is('.ui-effects-wrapper')) {
+ return element.parent();
+ }
+
+ // wrap the element
+ var props = {
+ width: element.outerWidth(true),
+ height: element.outerHeight(true),
+ 'float': element.css('float')
+ },
+ wrapper = $('<div></div>')
+ .addClass('ui-effects-wrapper')
+ .css({
+ fontSize: '100%',
+ background: 'transparent',
+ border: 'none',
+ margin: 0,
+ padding: 0
+ });
+
+ element.wrap(wrapper);
+ wrapper = element.parent(); //Hotfix for jQuery 1.4 since some change in wrap() seems to actually loose the reference to the wrapped element
+
+ // transfer positioning properties to the wrapper
+ if (element.css('position') == 'static') {
+ wrapper.css({ position: 'relative' });
+ element.css({ position: 'relative' });
+ } else {
+ $.extend(props, {
+ position: element.css('position'),
+ zIndex: element.css('z-index')
+ });
+ $.each(['top', 'left', 'bottom', 'right'], function(i, pos) {
+ props[pos] = element.css(pos);
+ if (isNaN(parseInt(props[pos], 10))) {
+ props[pos] = 'auto';
+ }
+ });
+ element.css({position: 'relative', top: 0, left: 0 });
+ }
+
+ return wrapper.css(props).show();
+ },
+
+ removeWrapper: function(element) {
+ if (element.parent().is('.ui-effects-wrapper'))
+ return element.parent().replaceWith(element);
+ return element;
+ },
+
+ setTransition: function(element, list, factor, value) {
+ value = value || {};
+ $.each(list, function(i, x){
+ unit = element.cssUnit(x);
+ if (unit[0] > 0) value[x] = unit[0] * factor + unit[1];
+ });
+ return value;
+ }
+});
+
+
+function _normalizeArguments(effect, options, speed, callback) {
+ // shift params for method overloading
+ if (typeof effect == 'object') {
+ callback = options;
+ speed = null;
+ options = effect;
+ effect = options.effect;
+ }
+ if ($.isFunction(options)) {
+ callback = options;
+ speed = null;
+ options = {};
+ }
+ if (typeof options == 'number' || $.fx.speeds[options]) {
+ callback = speed;
+ speed = options;
+ options = {};
+ }
+ if ($.isFunction(speed)) {
+ callback = speed;
+ speed = null;
+ }
+
+ options = options || {};
+
+ speed = speed || options.duration;
+ speed = $.fx.off ? 0 : typeof speed == 'number'
+ ? speed : $.fx.speeds[speed] || $.fx.speeds._default;
+
+ callback = callback || options.complete;
+
+ return [effect, options, speed, callback];
+}
+
+$.fn.extend({
+ effect: function(effect, options, speed, callback) {
+ var args = _normalizeArguments.apply(this, arguments),
+ // TODO: make effects takes actual parameters instead of a hash
+ args2 = {
+ options: args[1],
+ duration: args[2],
+ callback: args[3]
+ },
+ effectMethod = $.effects[effect];
+
+ return effectMethod && !$.fx.off ? effectMethod.call(this, args2) : this;
+ },
+
+ _show: $.fn.show,
+ show: function(speed) {
+ if (!speed || typeof speed == 'number' || $.fx.speeds[speed] || !$.effects[speed] ) {
+ return this._show.apply(this, arguments);
+ } else {
+ var args = _normalizeArguments.apply(this, arguments);
+ args[1].mode = 'show';
+ return this.effect.apply(this, args);
+ }
+ },
+
+ _hide: $.fn.hide,
+ hide: function(speed) {
+ if (!speed || typeof speed == 'number' || $.fx.speeds[speed] || !$.effects[speed] ) {
+ return this._hide.apply(this, arguments);
+ } else {
+ var args = _normalizeArguments.apply(this, arguments);
+ args[1].mode = 'hide';
+ return this.effect.apply(this, args);
+ }
+ },
+
+ // jQuery core overloads toggle and creates _toggle
+ __toggle: $.fn.toggle,
+ toggle: function(speed) {
+ if (!speed || typeof speed == 'number' || $.fx.speeds[speed] || !$.effects[speed] ||
+ typeof speed == 'boolean' || $.isFunction(speed)) {
+ return this.__toggle.apply(this, arguments);
+ } else {
+ var args = _normalizeArguments.apply(this, arguments);
+ args[1].mode = 'toggle';
+ return this.effect.apply(this, args);
+ }
+ },
+
+ // helper functions
+ cssUnit: function(key) {
+ var style = this.css(key), val = [];
+ $.each( ['em','px','%','pt'], function(i, unit){
+ if(style.indexOf(unit) > 0)
+ val = [parseFloat(style), unit];
+ });
+ return val;
+ }
+});
+
+
+
+/******************************************************************************/
+/*********************************** EASING ***********************************/
+/******************************************************************************/
+
+/*
+ * jQuery Easing v1.3 - http://gsgd.co.uk/sandbox/jquery/easing/
+ *
+ * Uses the built in easing capabilities added In jQuery 1.1
+ * to offer multiple easing options
+ *
+ * TERMS OF USE - jQuery Easing
+ *
+ * Open source under the BSD License.
+ *
+ * Copyright 2008 George McGinley Smith
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without modification,
+ * are permitted provided that the following conditions are met:
+ *
+ * Redistributions of source code must retain the above copyright notice, this list of
+ * conditions and the following disclaimer.
+ * Redistributions in binary form must reproduce the above copyright notice, this list
+ * of conditions and the following disclaimer in the documentation and/or other materials
+ * provided with the distribution.
+ *
+ * Neither the name of the author nor the names of contributors may be used to endorse
+ * or promote products derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
+ * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
+ * OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+*/
+
+// t: current time, b: begInnIng value, c: change In value, d: duration
+$.easing.jswing = $.easing.swing;
+
+$.extend($.easing,
+{
+ def: 'easeOutQuad',
+ swing: function (x, t, b, c, d) {
+ //alert($.easing.default);
+ return $.easing[$.easing.def](x, t, b, c, d);
+ },
+ easeInQuad: function (x, t, b, c, d) {
+ return c*(t/=d)*t + b;
+ },
+ easeOutQuad: function (x, t, b, c, d) {
+ return -c *(t/=d)*(t-2) + b;
+ },
+ easeInOutQuad: function (x, t, b, c, d) {
+ if ((t/=d/2) < 1) return c/2*t*t + b;
+ return -c/2 * ((--t)*(t-2) - 1) + b;
+ },
+ easeInCubic: function (x, t, b, c, d) {
+ return c*(t/=d)*t*t + b;
+ },
+ easeOutCubic: function (x, t, b, c, d) {
+ return c*((t=t/d-1)*t*t + 1) + b;
+ },
+ easeInOutCubic: function (x, t, b, c, d) {
+ if ((t/=d/2) < 1) return c/2*t*t*t + b;
+ return c/2*((t-=2)*t*t + 2) + b;
+ },
+ easeInQuart: function (x, t, b, c, d) {
+ return c*(t/=d)*t*t*t + b;
+ },
+ easeOutQuart: function (x, t, b, c, d) {
+ return -c * ((t=t/d-1)*t*t*t - 1) + b;
+ },
+ easeInOutQuart: function (x, t, b, c, d) {
+ if ((t/=d/2) < 1) return c/2*t*t*t*t + b;
+ return -c/2 * ((t-=2)*t*t*t - 2) + b;
+ },
+ easeInQuint: function (x, t, b, c, d) {
+ return c*(t/=d)*t*t*t*t + b;
+ },
+ easeOutQuint: function (x, t, b, c, d) {
+ return c*((t=t/d-1)*t*t*t*t + 1) + b;
+ },
+ easeInOutQuint: function (x, t, b, c, d) {
+ if ((t/=d/2) < 1) return c/2*t*t*t*t*t + b;
+ return c/2*((t-=2)*t*t*t*t + 2) + b;
+ },
+ easeInSine: function (x, t, b, c, d) {
+ return -c * Math.cos(t/d * (Math.PI/2)) + c + b;
+ },
+ easeOutSine: function (x, t, b, c, d) {
+ return c * Math.sin(t/d * (Math.PI/2)) + b;
+ },
+ easeInOutSine: function (x, t, b, c, d) {
+ return -c/2 * (Math.cos(Math.PI*t/d) - 1) + b;
+ },
+ easeInExpo: function (x, t, b, c, d) {
+ return (t==0) ? b : c * Math.pow(2, 10 * (t/d - 1)) + b;
+ },
+ easeOutExpo: function (x, t, b, c, d) {
+ return (t==d) ? b+c : c * (-Math.pow(2, -10 * t/d) + 1) + b;
+ },
+ easeInOutExpo: function (x, t, b, c, d) {
+ if (t==0) return b;
+ if (t==d) return b+c;
+ if ((t/=d/2) < 1) return c/2 * Math.pow(2, 10 * (t - 1)) + b;
+ return c/2 * (-Math.pow(2, -10 * --t) + 2) + b;
+ },
+ easeInCirc: function (x, t, b, c, d) {
+ return -c * (Math.sqrt(1 - (t/=d)*t) - 1) + b;
+ },
+ easeOutCirc: function (x, t, b, c, d) {
+ return c * Math.sqrt(1 - (t=t/d-1)*t) + b;
+ },
+ easeInOutCirc: function (x, t, b, c, d) {
+ if ((t/=d/2) < 1) return -c/2 * (Math.sqrt(1 - t*t) - 1) + b;
+ return c/2 * (Math.sqrt(1 - (t-=2)*t) + 1) + b;
+ },
+ easeInElastic: function (x, t, b, c, d) {
+ var s=1.70158;var p=0;var a=c;
+ if (t==0) return b; if ((t/=d)==1) return b+c; if (!p) p=d*.3;
+ if (a < Math.abs(c)) { a=c; var s=p/4; }
+ else var s = p/(2*Math.PI) * Math.asin (c/a);
+ return -(a*Math.pow(2,10*(t-=1)) * Math.sin( (t*d-s)*(2*Math.PI)/p )) + b;
+ },
+ easeOutElastic: function (x, t, b, c, d) {
+ var s=1.70158;var p=0;var a=c;
+ if (t==0) return b; if ((t/=d)==1) return b+c; if (!p) p=d*.3;
+ if (a < Math.abs(c)) { a=c; var s=p/4; }
+ else var s = p/(2*Math.PI) * Math.asin (c/a);
+ return a*Math.pow(2,-10*t) * Math.sin( (t*d-s)*(2*Math.PI)/p ) + c + b;
+ },
+ easeInOutElastic: function (x, t, b, c, d) {
+ var s=1.70158;var p=0;var a=c;
+ if (t==0) return b; if ((t/=d/2)==2) return b+c; if (!p) p=d*(.3*1.5);
+ if (a < Math.abs(c)) { a=c; var s=p/4; }
+ else var s = p/(2*Math.PI) * Math.asin (c/a);
+ if (t < 1) return -.5*(a*Math.pow(2,10*(t-=1)) * Math.sin( (t*d-s)*(2*Math.PI)/p )) + b;
+ return a*Math.pow(2,-10*(t-=1)) * Math.sin( (t*d-s)*(2*Math.PI)/p )*.5 + c + b;
+ },
+ easeInBack: function (x, t, b, c, d, s) {
+ if (s == undefined) s = 1.70158;
+ return c*(t/=d)*t*((s+1)*t - s) + b;
+ },
+ easeOutBack: function (x, t, b, c, d, s) {
+ if (s == undefined) s = 1.70158;
+ return c*((t=t/d-1)*t*((s+1)*t + s) + 1) + b;
+ },
+ easeInOutBack: function (x, t, b, c, d, s) {
+ if (s == undefined) s = 1.70158;
+ if ((t/=d/2) < 1) return c/2*(t*t*(((s*=(1.525))+1)*t - s)) + b;
+ return c/2*((t-=2)*t*(((s*=(1.525))+1)*t + s) + 2) + b;
+ },
+ easeInBounce: function (x, t, b, c, d) {
+ return c - $.easing.easeOutBounce (x, d-t, 0, c, d) + b;
+ },
+ easeOutBounce: function (x, t, b, c, d) {
+ if ((t/=d) < (1/2.75)) {
+ return c*(7.5625*t*t) + b;
+ } else if (t < (2/2.75)) {
+ return c*(7.5625*(t-=(1.5/2.75))*t + .75) + b;
+ } else if (t < (2.5/2.75)) {
+ return c*(7.5625*(t-=(2.25/2.75))*t + .9375) + b;
+ } else {
+ return c*(7.5625*(t-=(2.625/2.75))*t + .984375) + b;
+ }
+ },
+ easeInOutBounce: function (x, t, b, c, d) {
+ if (t < d/2) return $.easing.easeInBounce (x, t*2, 0, c, d) * .5 + b;
+ return $.easing.easeOutBounce (x, t*2-d, 0, c, d) * .5 + c*.5 + b;
+ }
+});
+
+/*
+ *
+ * TERMS OF USE - EASING EQUATIONS
+ *
+ * Open source under the BSD License.
+ *
+ * Copyright 2001 Robert Penner
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without modification,
+ * are permitted provided that the following conditions are met:
+ *
+ * Redistributions of source code must retain the above copyright notice, this list of
+ * conditions and the following disclaimer.
+ * Redistributions in binary form must reproduce the above copyright notice, this list
+ * of conditions and the following disclaimer in the documentation and/or other materials
+ * provided with the distribution.
+ *
+ * Neither the name of the author nor the names of contributors may be used to endorse
+ * or promote products derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
+ * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
+ * OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ */
+
+})(jQuery);
Copied: sandbox/trunk/ui/calendar/ui/src/main/resources/META-INF/resources/org.richfaces/jquery.effects.highlight.js (from rev 19569, sandbox/trunk/prototypes/calendar/jquery.effects.highlight.js)
===================================================================
--- sandbox/trunk/ui/calendar/ui/src/main/resources/META-INF/resources/org.richfaces/jquery.effects.highlight.js (rev 0)
+++ sandbox/trunk/ui/calendar/ui/src/main/resources/META-INF/resources/org.richfaces/jquery.effects.highlight.js 2010-10-19 12:14:33 UTC (rev 19603)
@@ -0,0 +1,50 @@
+/*
+ * jQuery UI Effects Highlight 1.8.5
+ *
+ * Copyright 2010, AUTHORS.txt (http://jqueryui.com/about)
+ * Dual licensed under the MIT or GPL Version 2 licenses.
+ * http://jquery.org/license
+ *
+ * http://docs.jquery.com/UI/Effects/Highlight
+ *
+ * Depends:
+ * jquery.effects.core.js
+ */
+(function( $, undefined ) {
+
+$.effects.highlight = function(o) {
+ return this.queue(function() {
+ var elem = $(this),
+ props = ['backgroundImage', 'backgroundColor', 'opacity'],
+ mode = $.effects.setMode(elem, o.options.mode || 'show'),
+ animation = {
+ backgroundColor: elem.css('backgroundColor')
+ };
+
+ if (mode == 'hide') {
+ animation.opacity = 0;
+ }
+
+ $.effects.save(elem, props);
+ elem
+ .show()
+ .css({
+ backgroundImage: 'none',
+ backgroundColor: o.options.color || '#ffff99'
+ })
+ .animate(animation, {
+ queue: false,
+ duration: o.duration,
+ easing: o.options.easing,
+ complete: function() {
+ (mode == 'hide' && elem.hide());
+ $.effects.restore(elem, props);
+ (mode == 'show' && !$.support.opacity && this.style.removeAttribute('filter'));
+ (o.callback && o.callback.apply(this, arguments));
+ elem.dequeue();
+ }
+ });
+ });
+};
+
+})(jQuery);
Copied: sandbox/trunk/ui/calendar/ui/src/main/resources/META-INF/resources/org.richfaces/json-dom.js (from rev 19569, sandbox/trunk/prototypes/calendar/json-dom.js)
===================================================================
--- sandbox/trunk/ui/calendar/ui/src/main/resources/META-INF/resources/org.richfaces/json-dom.js (rev 0)
+++ sandbox/trunk/ui/calendar/ui/src/main/resources/META-INF/resources/org.richfaces/json-dom.js 2010-10-19 12:14:33 UTC (rev 19603)
@@ -0,0 +1,133 @@
+// AJAX-JSF AJAX-like library, for communicate with view Tree on server side.
+// In case of XMLHttpRequest don't worked, use :
+// JSHttpRequest v1.12. (C) Dmitry Koterov, 2005-01-27.
+// http://forum.dklab.ru/users/DmitryKoterov/
+//
+// Do not remove this comment if you want to use script!
+// ?? ???????? ?????? ???????????, ???? ?? ?????? ???????????? ??????!
+//
+// Modified by Alexander J. Smirnov to use as JSF AJAX-like components.
+
+// DOM - like elements for JSRequest. JS serialiser encode
+// XML sax events to creation of corresponding objects.
+JSNode = function() {
+};
+
+// Base node
+JSNode.prototype = {
+ tag : null,
+ attrs : {},
+ childs : [],
+ value : "",
+ _symbols : {
+ '&':"&",
+ '<':"<",
+ '>':">",
+ '"':""",
+ '\'':"'",
+ '\u00A0':" "
+ },
+ // Public functions
+ getInnerHTML : function(context) {
+ var children = [];
+ for (var i = 0; i < this.childs.length; i++)
+ {
+ children.push(this.childs[i].getContent(context));
+ }
+ return children.join('');
+ },
+ // Escape XML symbols - < > & ' ...
+ xmlEscape : function(value) {
+ var text = value ? value.toString() : "";
+ for(var i in this._symbols ) {
+ text = text.replace(i,this._symbols[i]);
+
+ }
+ return text;
+ }
+};
+
+// Element node
+E = function(tagname,attributes,childnodes) {
+ this.tag = tagname;
+ if (attributes) this.attrs = attributes;
+ if(childnodes) this.childs = childnodes;
+};
+
+E.prototype = new JSNode();
+E.prototype.getContent = function(context) {
+ var html = "<"+this.tag;
+ var inner = this.getInnerHTML(context);
+ if (inner=='') this.isEmpty = true; else this.isEmpty=false;
+ for(var i in this.attrs) {
+ if (!this.attrs.hasOwnProperty(i)) {
+ continue ;
+ }
+
+ var attrValue = this.attrs[i];
+
+ if (typeof attrValue == "function")
+ attrValue = attrValue.call(this, context);
+
+ if (attrValue)
+ html += " "+(i=='className'?'class':i)+'="'+this.xmlEscape(attrValue)+'"';
+ }
+ html+= ">"+inner+"</"+this.tag+">";
+ return html;
+};
+
+// Escaped Text node
+ET = function(text) {
+ this.value = text;
+};
+
+
+//ET.prototype = new JSNode();
+ET.prototype.getContent = function(context) {
+ var value = this.value;
+ if (typeof value=="function") value=value(context);
+ if (value && value.getContent) {
+ value = value.getContent(context);
+ }
+
+ if (value) return value;
+
+ return "";
+};
+
+// Text node
+T = function(text) {
+ this.value = text;
+};
+
+T.prototype = new JSNode();
+T.prototype.getContent = function(context) {
+ var value = this.value;
+ if (typeof value=="function") value=value(context);
+
+ if (value) return this.xmlEscape(value);
+
+ return "";
+};
+
+// Comment node
+C = function(text) {
+ this.value = text;
+};
+
+//C.prototype = new JSNode();
+C.prototype.getContent = function(context) {
+ return "<!--"+this.value+"-->";
+};
+
+// CDATA Section node.
+D = function(text) {
+ this.value = text;
+};
+
+//D.prototype = new JSNode();
+D.prototype.getContent = function(context) {
+ return "<![CDATA["+this.value+"]]>";
+};
+
+
13 years, 8 months
JBoss Rich Faces SVN: r19602 - trunk/examples/input-demo/src/main/webapp/examples.
by richfaces-svn-commits@lists.jboss.org
Author: abelevich
Date: 2010-10-19 05:51:19 -0400 (Tue, 19 Oct 2010)
New Revision: 19602
Modified:
trunk/examples/input-demo/src/main/webapp/examples/inplaceInput.xhtml
trunk/examples/input-demo/src/main/webapp/examples/inplaceSelect.xhtml
trunk/examples/input-demo/src/main/webapp/examples/select.xhtml
Log:
fix minor issues
Modified: trunk/examples/input-demo/src/main/webapp/examples/inplaceInput.xhtml
===================================================================
--- trunk/examples/input-demo/src/main/webapp/examples/inplaceInput.xhtml 2010-10-19 09:36:02 UTC (rev 19601)
+++ trunk/examples/input-demo/src/main/webapp/examples/inplaceInput.xhtml 2010-10-19 09:51:19 UTC (rev 19602)
@@ -12,7 +12,8 @@
<h:body>
<h:form id="form">
- <in:inplaceInput showControls="true" value="New York"/>
+ <in:inplaceInput showControls="true" value="New York">
+ </in:inplaceInput>
<h:commandButton value="submit"/>
</h:form>
</h:body>
Modified: trunk/examples/input-demo/src/main/webapp/examples/inplaceSelect.xhtml
===================================================================
--- trunk/examples/input-demo/src/main/webapp/examples/inplaceSelect.xhtml 2010-10-19 09:36:02 UTC (rev 19601)
+++ trunk/examples/input-demo/src/main/webapp/examples/inplaceSelect.xhtml 2010-10-19 09:51:19 UTC (rev 19602)
@@ -13,15 +13,15 @@
<h:body>
<h:form id="form">
- <div id="scroll" style="width: 400px; height:400px; overflow:auto;" >
+ <div id="scroll" style="width: 400px; height:200px; overflow:auto;" >
<fieldset>
<legend>InplaceSelect Test App</legend>
Fresh off his victory in the Florida primary, Sen. John McCain is poised to take another big prize. Former
<in:inplaceSelect defaultLabel="Edit Text" value="#{inputBean.value}">
- <f:selectItem itemLabel="1#OptionLabel" itemValue="1#OptionValue"/>
- <f:selectItem itemLabel="2#OptionLabel" itemValue="2#OptionValue"/>
- <f:selectItem itemLabel="3#OptionLabel" itemValue="3#OptionValue"/>
- <f:selectItem itemLabel="4#OptionLabel" itemValue="4#OptionValue"/>
+ <f:selectItem itemLabel="Label#1" itemValue="Value#1"/>
+ <f:selectItem itemLabel="Label#2" itemValue="Value#2"/>
+ <f:selectItem itemLabel="Label#3" itemValue="Value#3"/>
+ <f:selectItem itemLabel="Label#4" itemValue="Value#4"/>
</in:inplaceSelect>
Mayor Rudy Giuliani plans to drop out and endorse McCain, two GOP sources said. That would give McCain added momentum heading into a debate Wednesday and next week's Super Tuesday contests
</fieldset>
Modified: trunk/examples/input-demo/src/main/webapp/examples/select.xhtml
===================================================================
--- trunk/examples/input-demo/src/main/webapp/examples/select.xhtml 2010-10-19 09:36:02 UTC (rev 19601)
+++ trunk/examples/input-demo/src/main/webapp/examples/select.xhtml 2010-10-19 09:51:19 UTC (rev 19602)
@@ -13,7 +13,7 @@
<h:body>
<h:form id="form">
- <div id="scroll" style="width: 400px; height:400px; overflow:auto;" >
+ <div id="scroll" style="width: 400px; height:100px; overflow:auto;" >
<fieldset>
<legend>Select Test App</legend>
<in:select defaultLabel="Select Value ..." value="#{inputBean.value}">
13 years, 8 months
JBoss Rich Faces SVN: r19601 - in trunk/ui/input/ui/src/main: java/org/richfaces/renderkit and 1 other directories.
by richfaces-svn-commits@lists.jboss.org
Author: abelevich
Date: 2010-10-19 05:36:02 -0400 (Tue, 19 Oct 2010)
New Revision: 19601
Modified:
trunk/ui/input/ui/src/main/java/org/richfaces/component/AbstractInplaceInput.java
trunk/ui/input/ui/src/main/java/org/richfaces/component/AbstractInplaceSelect.java
trunk/ui/input/ui/src/main/java/org/richfaces/component/AbstractSelect.java
trunk/ui/input/ui/src/main/java/org/richfaces/renderkit/InplaceInputRendererBase.java
trunk/ui/input/ui/src/main/java/org/richfaces/renderkit/InplaceSelectRendererBase.java
trunk/ui/input/ui/src/main/java/org/richfaces/renderkit/SelectHelper.java
trunk/ui/input/ui/src/main/templates/inplaceSelect.template.xml
Log:
fix events rendering
Modified: trunk/ui/input/ui/src/main/java/org/richfaces/component/AbstractInplaceInput.java
===================================================================
--- trunk/ui/input/ui/src/main/java/org/richfaces/component/AbstractInplaceInput.java 2010-10-18 23:49:42 UTC (rev 19600)
+++ trunk/ui/input/ui/src/main/java/org/richfaces/component/AbstractInplaceInput.java 2010-10-19 09:36:02 UTC (rev 19601)
@@ -130,7 +130,7 @@
@Attribute(events=@EventName("inputkeypress"))
public abstract String getOninputkeypress();
- @Attribute(events=@EventName("oninputkeyup"))
+ @Attribute(events=@EventName("inputkeyup"))
public abstract String getOninputkeypup();
@Attribute(events=@EventName("inputfocus"))
@@ -139,11 +139,11 @@
@Attribute(events=@EventName("inputblur"))
public abstract String getOninputblur();
- @Attribute(events=@EventName("select"))
- public abstract String getOnselect();
+ @Attribute(events=@EventName("inputselect"))
+ public abstract String getOninputselect();
- @Attribute(events=@EventName("change"))
- public abstract String getOnchange();
+ @Attribute(events=@EventName("inputchange"))
+ public abstract String getOninputchange();
//TODO: what is default event?, add onViewActivated, onEditActivated events support
}
Modified: trunk/ui/input/ui/src/main/java/org/richfaces/component/AbstractInplaceSelect.java
===================================================================
--- trunk/ui/input/ui/src/main/java/org/richfaces/component/AbstractInplaceSelect.java 2010-10-18 23:49:42 UTC (rev 19600)
+++ trunk/ui/input/ui/src/main/java/org/richfaces/component/AbstractInplaceSelect.java 2010-10-19 09:36:02 UTC (rev 19601)
@@ -23,6 +23,7 @@
package org.richfaces.component;
import org.richfaces.cdk.annotations.Attribute;
+import org.richfaces.cdk.annotations.EventName;
import org.richfaces.cdk.annotations.JsfComponent;
import org.richfaces.cdk.annotations.JsfRenderer;
import org.richfaces.cdk.annotations.Tag;
@@ -45,7 +46,7 @@
public static final String COMPONENT_TYPE = "org.richfaces.InplaceSelect";
public static final String COMPONENT_FAMILY = "org.richfaces.Select";
-
+
@Attribute(defaultValue="InplaceState.ready")
public abstract InplaceState getState();
@@ -73,4 +74,40 @@
@Attribute(defaultValue="rf-is-lst-cord")
public abstract String getListCss();
+ @Attribute(events=@EventName("inputclick"))
+ public abstract String getOninputclick();
+
+ @Attribute(events=@EventName("inputdblclick"))
+ public abstract String getOninputdblclick();
+
+ @Attribute(events=@EventName("inputmousedown"))
+ public abstract String getOninputmousedown();
+
+ @Attribute(events=@EventName("inputmousemove"))
+ public abstract String getOninputmousemove();
+
+ @Attribute(events=@EventName("inputmouseout"))
+ public abstract String getOninputmouseout();
+
+ @Attribute(events=@EventName("inputmouseover"))
+ public abstract String getOninputmouseover();
+
+ @Attribute(events=@EventName("inputmouseup"))
+ public abstract String getOninputmouseup();
+
+ @Attribute(events=@EventName("inputkeydown"))
+ public abstract String getOninputkeydown();
+
+ @Attribute(events=@EventName("inputkeypress"))
+ public abstract String getOninputkeypress();
+
+ @Attribute(events=@EventName("inputkeyup"))
+ public abstract String getOninputkeypup();
+
+ @Attribute(events=@EventName("inputfocus"))
+ public abstract String getOninputfocus();
+
+ @Attribute(events=@EventName("inputblur"))
+ public abstract String getOninputblur();
+
}
Modified: trunk/ui/input/ui/src/main/java/org/richfaces/component/AbstractSelect.java
===================================================================
--- trunk/ui/input/ui/src/main/java/org/richfaces/component/AbstractSelect.java 2010-10-18 23:49:42 UTC (rev 19600)
+++ trunk/ui/input/ui/src/main/java/org/richfaces/component/AbstractSelect.java 2010-10-19 09:36:02 UTC (rev 19601)
@@ -66,7 +66,7 @@
@Attribute(events=@EventName("click"))
public abstract String getOnclick();
- @Attribute(events=@EventName("ondblclick"))
+ @Attribute(events=@EventName("dblclick"))
public abstract String getOndblclick();
@Attribute(events=@EventName("focus"))
@@ -96,11 +96,42 @@
@Attribute(events=@EventName("mouseup"))
public abstract String getOnmouseup();
+ @Attribute(events=@EventName("listclick"))
+ public abstract String getOnlistclick();
+
+ @Attribute(events=@EventName("listdblclick"))
+ public abstract String getOnlistdblclick();
+
+ @Attribute(events=@EventName("listmousedown"))
+ public abstract String getOnlistmousedown();
+
+ @Attribute(events=@EventName("listmouseup"))
+ public abstract String getOnlistmouseup();
+
+ @Attribute(events=@EventName("listmouseover"))
+ public abstract String getOnlistmouseover();
+
+ @Attribute(events=@EventName("listmousemove"))
+ public abstract String getOnlistmousemove();
+
+ @Attribute(events=@EventName("listmouseout"))
+ public abstract String getOnlistmouseout();
+
+ @Attribute(events=@EventName("listkeypress"))
+ public abstract String getOnlistkeypress();
+
+ @Attribute(events=@EventName("listkeydown"))
+ public abstract String getOnlistkeydown();
+
+ @Attribute(events=@EventName("listkeyup"))
+ public abstract String getOnlistkeyup();
+
@Attribute(events=@EventName("select"))
public abstract String getOnselect();
@Attribute(events=@EventName("change"))
public abstract String getOnchange();
+ //TODO: add list event attributes
@Attribute(defaultValue = "rf-sel-opt")
public abstract String getItemCss();
Modified: trunk/ui/input/ui/src/main/java/org/richfaces/renderkit/InplaceInputRendererBase.java
===================================================================
--- trunk/ui/input/ui/src/main/java/org/richfaces/renderkit/InplaceInputRendererBase.java 2010-10-18 23:49:42 UTC (rev 19600)
+++ trunk/ui/input/ui/src/main/java/org/richfaces/renderkit/InplaceInputRendererBase.java 2010-10-19 09:36:02 UTC (rev 19601)
@@ -85,7 +85,7 @@
public static final String OPTIONS_SAVE_ON_BLUR = "saveOnBlur";
- private static final Map<String, ComponentAttribute> INPLACEINPUT_HANDLER_ATTRIBUTES = Collections
+ protected static final Map<String, ComponentAttribute> INPLACEINPUT_HANDLER_ATTRIBUTES = Collections
.unmodifiableMap(ComponentAttribute.createMap(
new ComponentAttribute(HtmlConstants.ONCLICK_ATTRIBUTE)
.setEventNames("inputclick")
@@ -124,13 +124,13 @@
.setEventNames("inputfocus")
.setComponentAttributeName("oninputfocus"),
new ComponentAttribute(HtmlConstants.ONCHANGE_ATTRIBUTE)
- .setEventNames("change").setComponentAttributeName(
- "onchange"),
+ .setEventNames("inputchange").setComponentAttributeName(
+ "oninputchange"),
new ComponentAttribute(HtmlConstants.ONSELECT_ATTRIBUTE)
- .setEventNames("select").setComponentAttributeName(
- "onselect")));
+ .setEventNames("inputselect").setComponentAttributeName(
+ "oninputselect")));
- protected void renderInputHandlers(FacesContext facesContext,
+ public void renderInputHandlers(FacesContext facesContext,
UIComponent component) throws IOException {
RenderKitUtils.renderPassThroughAttributesOptimized(facesContext,
component, INPLACEINPUT_HANDLER_ATTRIBUTES);
Modified: trunk/ui/input/ui/src/main/java/org/richfaces/renderkit/InplaceSelectRendererBase.java
===================================================================
--- trunk/ui/input/ui/src/main/java/org/richfaces/renderkit/InplaceSelectRendererBase.java 2010-10-18 23:49:42 UTC (rev 19600)
+++ trunk/ui/input/ui/src/main/java/org/richfaces/renderkit/InplaceSelectRendererBase.java 2010-10-19 09:36:02 UTC (rev 19601)
@@ -23,7 +23,6 @@
package org.richfaces.renderkit;
import java.io.IOException;
-import java.util.Collections;
import java.util.List;
import java.util.Map;
@@ -59,13 +58,6 @@
public static final String OPTIONS_VISIBLE = "visible";
- private static final Map<String, ComponentAttribute> INPLACESELECT_HANDLER_ATTRIBUTES = Collections.unmodifiableMap(ComponentAttribute.createMap(
- new ComponentAttribute(HtmlConstants.ONCHANGE_ATTRIBUTE).setEventNames("change").
- setComponentAttributeName("onchange"),
- new ComponentAttribute(HtmlConstants.ONSELECT_ATTRIBUTE).setEventNames("select").
- setComponentAttributeName("onselect")
- ));
-
@Override
protected String getScriptName() {
return "new RichFaces.ui.InplaceSelect";
@@ -79,9 +71,13 @@
SelectHelper.encodeItems(facesContext, component, clientSelectItems, HtmlConstants.SPAN_ELEM);
}
+ public void renderListHandlers(FacesContext facesContext, UIComponent component) throws IOException {
+ RenderKitUtils.renderPassThroughAttributesOptimized(facesContext, component, SelectHelper.SELECT_LIST_HANDLER_ATTRIBUTES);
+ }
+
@Override
- protected void renderInputHandlers(FacesContext facesContext, UIComponent component) throws IOException {
- RenderKitUtils.renderPassThroughAttributesOptimized(facesContext, component, INPLACESELECT_HANDLER_ATTRIBUTES);
+ public void renderInputHandlers(FacesContext facesContext, UIComponent component) throws IOException {
+ RenderKitUtils.renderPassThroughAttributesOptimized(facesContext, component, INPLACEINPUT_HANDLER_ATTRIBUTES);
}
public String getSelectInputLabel(FacesContext facesContext, UIComponent component) {
Modified: trunk/ui/input/ui/src/main/java/org/richfaces/renderkit/SelectHelper.java
===================================================================
--- trunk/ui/input/ui/src/main/java/org/richfaces/renderkit/SelectHelper.java 2010-10-18 23:49:42 UTC (rev 19600)
+++ trunk/ui/input/ui/src/main/java/org/richfaces/renderkit/SelectHelper.java 2010-10-19 09:36:02 UTC (rev 19601)
@@ -49,6 +49,7 @@
public static final String OPTIONS_LIST_ITEMS = "items";
+
public static final Map<String, ComponentAttribute> SELECT_LIST_HANDLER_ATTRIBUTES = Collections
.unmodifiableMap(ComponentAttribute.createMap(
new ComponentAttribute(HtmlConstants.ONCLICK_ATTRIBUTE)
Modified: trunk/ui/input/ui/src/main/templates/inplaceSelect.template.xml
===================================================================
--- trunk/ui/input/ui/src/main/templates/inplaceSelect.template.xml 2010-10-18 23:49:42 UTC (rev 19600)
+++ trunk/ui/input/ui/src/main/templates/inplaceSelect.template.xml 2010-10-19 09:36:02 UTC (rev 19601)
@@ -37,8 +37,7 @@
<cdk:object type="java.util.List" type-arguments="InplaceSelectBaseRenderer.ClientSelectItem" name="clientSelectItems"
value="#{getConvertedSelectItems(facesContext, component)}" />
- <span id="#{clientId}" class="#{getStateStyleClass(component, inplaceState)}"
- cdk:passThroughWithExclusions="id class">
+ <span id="#{clientId}" class="#{getStateStyleClass(component, inplaceState)}" cdk:passThroughWithExclusions="id class">
<span id="#{clientId}Label" class="rf-is-lbl">
#{inplaceValue}
@@ -80,6 +79,7 @@
</span>
</c:if>
<span id="#{clientId}List" style="#{getListStyles(facesContext, component)}" class="rf-is-lst-cord">
+ <cdk:call expression="renderListHandlers(facesContext, component);"/>
<span class="rf-is-lst-pos" style="width: #{component.attributes['listWidth']}">
<span class="rf-is-shdw">
<span class="rf-is-shdw-t"></span>
13 years, 8 months
JBoss Rich Faces SVN: r19600 - in branches/RF-8742/ui/validator: ui/src/main/java/org/richfaces/renderkit/html and 1 other directories.
by richfaces-svn-commits@lists.jboss.org
Author: alexsmirnov
Date: 2010-10-18 19:49:42 -0400 (Mon, 18 Oct 2010)
New Revision: 19600
Added:
branches/RF-8742/ui/validator/api/src/main/java/org/richfaces/validator/LibraryResource.java
branches/RF-8742/ui/validator/api/src/main/java/org/richfaces/validator/LibraryScript.java
branches/RF-8742/ui/validator/ui/src/main/java/org/richfaces/renderkit/html/LibraryScriptFunction.java
branches/RF-8742/ui/validator/ui/src/test/java/org/richfaces/renderkit/html/RendererGetClientSideScriptTest.java
branches/RF-8742/ui/validator/ui/src/test/java/org/richfaces/renderkit/html/RendererGetComponentScriptTest.java
branches/RF-8742/ui/validator/ui/src/test/java/org/richfaces/renderkit/html/ValidatorRendererGetScriptTest.java
Removed:
branches/RF-8742/ui/validator/api/src/main/java/org/richfaces/validator/ClientScript.java
branches/RF-8742/ui/validator/ui/src/main/java/org/richfaces/renderkit/html/ScriptObject.java
branches/RF-8742/ui/validator/ui/src/test/java/org/richfaces/renderkit/html/ValidatorRendererTest.java
Modified:
branches/RF-8742/ui/validator/api/src/main/java/org/richfaces/validator/ClientScriptService.java
branches/RF-8742/ui/validator/api/src/main/java/org/richfaces/validator/ValidatorDescriptor.java
branches/RF-8742/ui/validator/ui/src/main/java/org/richfaces/renderkit/html/ClientValidatorRenderer.java
branches/RF-8742/ui/validator/ui/src/main/java/org/richfaces/renderkit/html/ComponentValidatorScript.java
branches/RF-8742/ui/validator/ui/src/test/java/org/richfaces/renderkit/html/RendererTestBase.java
Log:
OPEN - issue RF-9507: ClientValidatorRendererunit tests and implementation.
https://jira.jboss.org/browse/RF-9507
Deleted: branches/RF-8742/ui/validator/api/src/main/java/org/richfaces/validator/ClientScript.java
===================================================================
--- branches/RF-8742/ui/validator/api/src/main/java/org/richfaces/validator/ClientScript.java 2010-10-18 17:56:04 UTC (rev 19599)
+++ branches/RF-8742/ui/validator/api/src/main/java/org/richfaces/validator/ClientScript.java 2010-10-18 23:49:42 UTC (rev 19600)
@@ -1,42 +0,0 @@
-/*
- * $Id$
- * JBoss, Home of Professional Open Source
- * Copyright 2010, Red Hat, Inc. and individual contributors
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software 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 software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-
-package org.richfaces.validator;
-
-/**
- * <p class="changed_added_4_0">
- * This class contains information about JavaScript associated with JSF object ( converter or validator )
- * </p>
- *
- * @author asmirnov(a)exadel.com
- *
- */
-public interface ClientScript {
-
- String getLibrary();
-
- String getResourceName();
-
- String getFunctionName();
-
-}
Modified: branches/RF-8742/ui/validator/api/src/main/java/org/richfaces/validator/ClientScriptService.java
===================================================================
--- branches/RF-8742/ui/validator/api/src/main/java/org/richfaces/validator/ClientScriptService.java 2010-10-18 17:56:04 UTC (rev 19599)
+++ branches/RF-8742/ui/validator/api/src/main/java/org/richfaces/validator/ClientScriptService.java 2010-10-18 23:49:42 UTC (rev 19600)
@@ -37,6 +37,6 @@
* @return description of client-side script.
* @throws ScriptNotFoundException if no JavaScript code associated with Java class.
*/
- ClientScript getScript(Class<?> javaClass) throws ScriptNotFoundException;
+ LibraryScript getScript(Class<?> javaClass) throws ScriptNotFoundException;
}
Added: branches/RF-8742/ui/validator/api/src/main/java/org/richfaces/validator/LibraryResource.java
===================================================================
--- branches/RF-8742/ui/validator/api/src/main/java/org/richfaces/validator/LibraryResource.java (rev 0)
+++ branches/RF-8742/ui/validator/api/src/main/java/org/richfaces/validator/LibraryResource.java 2010-10-18 23:49:42 UTC (rev 19600)
@@ -0,0 +1,9 @@
+package org.richfaces.validator;
+
+public interface LibraryResource {
+
+ String getLibrary();
+
+ String getResourceName();
+
+}
\ No newline at end of file
Property changes on: branches/RF-8742/ui/validator/api/src/main/java/org/richfaces/validator/LibraryResource.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Copied: branches/RF-8742/ui/validator/api/src/main/java/org/richfaces/validator/LibraryScript.java (from rev 19593, branches/RF-8742/ui/validator/api/src/main/java/org/richfaces/validator/ClientScript.java)
===================================================================
--- branches/RF-8742/ui/validator/api/src/main/java/org/richfaces/validator/LibraryScript.java (rev 0)
+++ branches/RF-8742/ui/validator/api/src/main/java/org/richfaces/validator/LibraryScript.java 2010-10-18 23:49:42 UTC (rev 19600)
@@ -0,0 +1,38 @@
+/*
+ * $Id$
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc. and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software 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 software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+
+package org.richfaces.validator;
+
+/**
+ * <p class="changed_added_4_0">
+ * This class contains information about JavaScript associated with JSF object ( converter or validator )
+ * </p>
+ *
+ * @author asmirnov(a)exadel.com
+ *
+ */
+public interface LibraryScript extends LibraryResource {
+
+ String getName();
+
+}
Property changes on: branches/RF-8742/ui/validator/api/src/main/java/org/richfaces/validator/LibraryScript.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Modified: branches/RF-8742/ui/validator/api/src/main/java/org/richfaces/validator/ValidatorDescriptor.java
===================================================================
--- branches/RF-8742/ui/validator/api/src/main/java/org/richfaces/validator/ValidatorDescriptor.java 2010-10-18 17:56:04 UTC (rev 19599)
+++ branches/RF-8742/ui/validator/api/src/main/java/org/richfaces/validator/ValidatorDescriptor.java 2010-10-18 23:49:42 UTC (rev 19600)
@@ -29,7 +29,7 @@
*
* @return non null map with validator instance parameters.
*/
- Map<String, Object> getValidatorParameters();
+ Map<String, ? extends Object> getValidatorParameters();
/**
* <p class="changed_added_4_0">
Modified: branches/RF-8742/ui/validator/ui/src/main/java/org/richfaces/renderkit/html/ClientValidatorRenderer.java
===================================================================
--- branches/RF-8742/ui/validator/ui/src/main/java/org/richfaces/renderkit/html/ClientValidatorRenderer.java 2010-10-18 17:56:04 UTC (rev 19599)
+++ branches/RF-8742/ui/validator/ui/src/main/java/org/richfaces/renderkit/html/ClientValidatorRenderer.java 2010-10-18 23:49:42 UTC (rev 19600)
@@ -10,6 +10,7 @@
import org.richfaces.component.UIValidatorScript;
import org.richfaces.component.behavior.ClientValidatorBehavior;
+import org.richfaces.validator.ConverterDescriptor;
import org.richfaces.validator.ScriptNotFoundException;
import org.richfaces.validator.ValidatorDescriptor;
@@ -19,7 +20,11 @@
public class ClientValidatorRenderer extends ClientBehaviorRenderer {
public static final String RENDERER_TYPE = "org.richfaces.ClientValidatorRenderer";
+
+ public static final String VALUE_VAR = "value";
+ public static final String CONVERTED_VALUE_VAR = "convertedValue";
+
public ClientValidatorRenderer() {
super();
}
@@ -36,25 +41,46 @@
return null;
}
- String buildValidatorScript(ClientBehaviorContext behaviorContext, ClientValidatorBehavior behavior){
+ /**
+ * <p class="changed_added_4_0">This method builds client-side validation script and stores it in View resource component</p>
+ * @param behaviorContext
+ * @param behavior
+ * @return name of the JavaScript function to call
+ */
+ String buildAndStoreValidatorScript(ClientBehaviorContext behaviorContext, ClientValidatorBehavior behavior){
return null;
}
- UIValidatorScript getOrCreateValidatorScriptComponent(ClientBehaviorContext behaviorContext, ClientValidatorBehavior behavior){
+ UIValidatorScript getOrCreateValidatorScriptResource(ClientBehaviorContext behaviorContext, ClientValidatorBehavior behavior){
return null;
}
+
ComponentValidatorScript createValidatorScript(ClientBehaviorContext behaviorContext,
ClientValidatorBehavior behavior) {
return null;
}
- ScriptObject getConverterScript(ClientBehaviorContext behaviorContext, ClientValidatorBehavior behavior)
+ /**
+ * <p class="changed_added_4_0">Build client-side function call for Server-side component descriptor.</p>
+ * @param behaviorContext
+ * @param validator
+ * @return
+ * @throws ScriptNotFoundException
+ */
+ LibraryScriptFunction getClientSideConverterScript(ClientBehaviorContext behaviorContext, ConverterDescriptor converter)
throws ScriptNotFoundException {
return null;
}
- ScriptObject getValidatorScript(ClientBehaviorContext behaviorContext, ValidatorDescriptor validator)
+ /**
+ * <p class="changed_added_4_0">Build client-side function call for Server-side component descriptor.</p>
+ * @param behaviorContext
+ * @param validator
+ * @return
+ * @throws ScriptNotFoundException
+ */
+ LibraryScriptFunction getClientSideValidatorScript(ClientBehaviorContext behaviorContext, ValidatorDescriptor validator)
throws ScriptNotFoundException {
return null;
}
Modified: branches/RF-8742/ui/validator/ui/src/main/java/org/richfaces/renderkit/html/ComponentValidatorScript.java
===================================================================
--- branches/RF-8742/ui/validator/ui/src/main/java/org/richfaces/renderkit/html/ComponentValidatorScript.java 2010-10-18 17:56:04 UTC (rev 19599)
+++ branches/RF-8742/ui/validator/ui/src/main/java/org/richfaces/renderkit/html/ComponentValidatorScript.java 2010-10-18 23:49:42 UTC (rev 19600)
@@ -1,5 +1,14 @@
package org.richfaces.renderkit.html;
-public class ComponentValidatorScript {
+import java.util.Collection;
+import org.ajax4jsf.javascript.ScriptString;
+import org.richfaces.validator.LibraryResource;
+
+public interface ComponentValidatorScript extends ScriptString {
+
+ String getName();
+
+ Collection<LibraryResource> getResources();
+
}
Copied: branches/RF-8742/ui/validator/ui/src/main/java/org/richfaces/renderkit/html/LibraryScriptFunction.java (from rev 19593, branches/RF-8742/ui/validator/ui/src/main/java/org/richfaces/renderkit/html/ScriptObject.java)
===================================================================
--- branches/RF-8742/ui/validator/ui/src/main/java/org/richfaces/renderkit/html/LibraryScriptFunction.java (rev 0)
+++ branches/RF-8742/ui/validator/ui/src/main/java/org/richfaces/renderkit/html/LibraryScriptFunction.java 2010-10-18 23:49:42 UTC (rev 19600)
@@ -0,0 +1,63 @@
+/*
+ * $Id$
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc. and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software 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 software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+
+package org.richfaces.renderkit.html;
+
+import org.ajax4jsf.javascript.JSFunction;
+import org.richfaces.validator.LibraryScript;
+
+/**
+ * <p class="changed_added_4_0"></p>
+ * @author asmirnov(a)exadel.com
+ *
+ */
+public class LibraryScriptFunction extends JSFunction {
+
+ private final String library;
+ private final String resourceName;
+
+ public LibraryScriptFunction(LibraryScript libraryScript, Object... parameters) {
+ super(libraryScript.getName(), parameters);
+ this.library = libraryScript.getLibrary();
+ this.resourceName = libraryScript.getResourceName();
+ }
+
+ /**
+ * <p class="changed_added_4_0"></p>
+ * @return the resourceName
+ */
+ public String getResourceName() {
+ return resourceName;
+ }
+
+ /**
+ * <p class="changed_added_4_0"></p>
+ * @return the library
+ */
+ public String getLibrary() {
+ return library;
+ }
+
+
+
+}
Property changes on: branches/RF-8742/ui/validator/ui/src/main/java/org/richfaces/renderkit/html/LibraryScriptFunction.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Deleted: branches/RF-8742/ui/validator/ui/src/main/java/org/richfaces/renderkit/html/ScriptObject.java
===================================================================
--- branches/RF-8742/ui/validator/ui/src/main/java/org/richfaces/renderkit/html/ScriptObject.java 2010-10-18 17:56:04 UTC (rev 19599)
+++ branches/RF-8742/ui/validator/ui/src/main/java/org/richfaces/renderkit/html/ScriptObject.java 2010-10-18 23:49:42 UTC (rev 19600)
@@ -1,73 +0,0 @@
-/*
- * $Id$
- * JBoss, Home of Professional Open Source
- * Copyright 2010, Red Hat, Inc. and individual contributors
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software 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 software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-
-package org.richfaces.renderkit.html;
-
-import java.util.Collection;
-
-import org.richfaces.validator.ClientScript;
-
-/**
- * <p class="changed_added_4_0"></p>
- * @author asmirnov(a)exadel.com
- *
- */
-public class ScriptObject {
-
- private ClientScript script;
-
- private Collection<Object> parameters;
-
- /**
- * <p class="changed_added_4_0"></p>
- * @return the script
- */
- public ClientScript getScript() {
- return this.script;
- }
-
- /**
- * <p class="changed_added_4_0"></p>
- * @param script the script to set
- */
- public void setScript(ClientScript script) {
- this.script = script;
- }
-
- /**
- * <p class="changed_added_4_0"></p>
- * @return the parameters
- */
- public Collection<Object> getParameters() {
- return this.parameters;
- }
-
- /**
- * <p class="changed_added_4_0"></p>
- * @param parameters the parameters to set
- */
- public void setParameters(Collection<Object> parameters) {
- this.parameters = parameters;
- }
-
-}
Added: branches/RF-8742/ui/validator/ui/src/test/java/org/richfaces/renderkit/html/RendererGetClientSideScriptTest.java
===================================================================
--- branches/RF-8742/ui/validator/ui/src/test/java/org/richfaces/renderkit/html/RendererGetClientSideScriptTest.java (rev 0)
+++ branches/RF-8742/ui/validator/ui/src/test/java/org/richfaces/renderkit/html/RendererGetClientSideScriptTest.java 2010-10-18 23:49:42 UTC (rev 19600)
@@ -0,0 +1,108 @@
+package org.richfaces.renderkit.html;
+
+import static org.easymock.EasyMock.*;
+import static org.junit.Assert.*;
+
+import java.util.Map;
+
+import javax.faces.convert.NumberConverter;
+import javax.faces.validator.RegexValidator;
+
+import org.jboss.test.faces.mock.Mock;
+import org.jboss.test.faces.mock.MockTestRunner;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.richfaces.application.ServiceTracker;
+import org.richfaces.validator.ClientScriptService;
+import org.richfaces.validator.ConverterDescriptor;
+import org.richfaces.validator.LibraryScript;
+import org.richfaces.validator.ScriptNotFoundException;
+import org.richfaces.validator.ValidatorDescriptor;
+
+
+(a)RunWith(MockTestRunner.class)
+public class RendererGetClientSideScriptTest extends RendererTestBase {
+
+ @Mock
+ private ValidatorDescriptor descriptor;
+
+ @Mock
+ private ConverterDescriptor converterDescriptor;
+
+ @Mock
+ private ClientScriptService scriptService;
+
+ @Mock
+ private LibraryScript script;
+
+ @Before
+ public void setupService() {
+ expect(factory.getInstance(ClientScriptService.class)).andStubReturn(scriptService);
+ ServiceTracker.setFactory(factory);
+ }
+
+ @After
+ public void releaseService() {
+ ServiceTracker.release();
+ }
+
+ @Test(expected = ScriptNotFoundException.class)
+ public void testGetClientSideScriptNotExists() throws Throwable {
+ expect((Class) descriptor.getValidatorClass()).andReturn(RegexValidator.class);
+ expect(scriptService.getScript(RegexValidator.class)).andThrow(new ScriptNotFoundException());
+ controller.replay();
+ renderer.getClientSideValidatorScript(behaviorContext, descriptor);
+ controller.verify();
+ }
+
+ @Test(expected = ScriptNotFoundException.class)
+ public void testGetClientSideConverterScriptNotExists() throws Throwable {
+ expect((Class) converterDescriptor.getValidatorClass()).andReturn(NumberConverter.class);
+ expect(scriptService.getScript(NumberConverter.class)).andThrow(new ScriptNotFoundException());
+ controller.replay();
+ renderer.getClientSideConverterScript(behaviorContext, converterDescriptor);
+ controller.verify();
+ }
+
+ @Test
+ public void testGetClientSideValidatorScriptFromDescription() throws Exception {
+ expect((Class) descriptor.getValidatorClass()).andReturn(RegexValidator.class);
+ expect(descriptor.getMessage()).andReturn(VALIDATOR_MESSAGE);
+ expect((Map<String, Object>) descriptor.getValidatorParameters()).andReturn(
+ (Map<String, Object>) VALIDATOR_PARAMS);
+ controller.replay();
+ expect(scriptService.getScript(RegexValidator.class)).andReturn(script);
+ expect(script.getName()).andReturn(REGEX_VALIDATOR);
+ expect(script.getLibrary()).andReturn(ORG_RICHFACES);
+ expect(script.getResourceName()).andReturn(CLIENT_VALIDATORS_JS);
+ LibraryScriptFunction clientSideScript = renderer.getClientSideValidatorScript(behaviorContext, descriptor);
+ assertEquals(ClientValidatorRenderer.CONVERTED_VALUE_VAR, clientSideScript.getParameters().get(0));
+ assertEquals(VALIDATOR_MESSAGE, clientSideScript.getParameters().get(1));
+ assertEquals(VALIDATOR_PARAMS, clientSideScript.getParameters().get(2));
+ assertEquals(ORG_RICHFACES, clientSideScript.getLibrary());
+ assertEquals(CLIENT_VALIDATORS_JS, clientSideScript.getResourceName());
+ }
+
+ @Test
+ public void testGetClientSideConverterScriptFromDescription() throws Exception {
+ expect((Class) converterDescriptor.getValidatorClass()).andReturn(NumberConverter.class);
+ expect(converterDescriptor.getMessage()).andReturn(VALIDATOR_MESSAGE);
+ expect((Map<String, Object>) converterDescriptor.getValidatorParameters()).andReturn(
+ (Map<String, Object>) VALIDATOR_PARAMS);
+ controller.replay();
+ expect(scriptService.getScript(NumberConverter.class)).andReturn(script);
+ expect(script.getName()).andReturn(REGEX_VALIDATOR);
+ expect(script.getLibrary()).andReturn(ORG_RICHFACES);
+ expect(script.getResourceName()).andReturn(CLIENT_VALIDATORS_JS);
+ LibraryScriptFunction clientSideScript =
+ renderer.getClientSideConverterScript(behaviorContext, converterDescriptor);
+ assertEquals(ClientValidatorRenderer.VALUE_VAR, clientSideScript.getParameters().get(0));
+ assertEquals(VALIDATOR_MESSAGE, clientSideScript.getParameters().get(1));
+ assertEquals(VALIDATOR_PARAMS, clientSideScript.getParameters().get(2));
+ assertEquals(ORG_RICHFACES, clientSideScript.getLibrary());
+ assertEquals(CLIENT_VALIDATORS_JS, clientSideScript.getResourceName());
+ }
+
+}
Property changes on: branches/RF-8742/ui/validator/ui/src/test/java/org/richfaces/renderkit/html/RendererGetClientSideScriptTest.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: branches/RF-8742/ui/validator/ui/src/test/java/org/richfaces/renderkit/html/RendererGetComponentScriptTest.java
===================================================================
--- branches/RF-8742/ui/validator/ui/src/test/java/org/richfaces/renderkit/html/RendererGetComponentScriptTest.java (rev 0)
+++ branches/RF-8742/ui/validator/ui/src/test/java/org/richfaces/renderkit/html/RendererGetComponentScriptTest.java 2010-10-18 23:49:42 UTC (rev 19600)
@@ -0,0 +1,116 @@
+package org.richfaces.renderkit.html;
+
+import static org.junit.Assert.*;
+
+import javax.faces.component.behavior.ClientBehaviorContext;
+
+import org.ajax4jsf.javascript.JSLiteral;
+import org.junit.Test;
+import org.richfaces.validator.ConverterDescriptor;
+import org.richfaces.validator.LibraryScript;
+import org.richfaces.validator.ScriptNotFoundException;
+import org.richfaces.validator.ValidatorDescriptor;
+
+public class RendererGetComponentScriptTest extends RendererTestBase {
+
+ private static final String NUMBER_CONVERTER = "numConverter";
+
+ /**
+ * <p class="changed_added_4_0">Test generated script for case there is no client-side converter.</p>
+ */
+ @Test
+ public void testCreateValidatorScriptNoConverter() {
+ ClientValidatorRenderer renderer = createStubRenderer(null, createValidatorFunction());
+ }
+
+
+ /**
+ * <p class="changed_added_4_0">Test generated script for case there is no client-side validator scripts.</p>
+ */
+ @Test
+ public void testCreateValidatorScriptNoValidator() {
+ ClientValidatorRenderer renderer = createStubRenderer(createConverterFunction());
+ }
+
+ /**
+ * <p class="changed_added_4_0">Test generated script for case there is no client-side script for some validator, but exists for other</p>
+ */
+ @Test
+ public void testCreateValidatorScriptPartialValidator() {
+ fail("Not yet implemented");
+ }
+
+ /**
+ * <p class="changed_added_4_0">Test case when validation does not required at all.</p>
+ */
+ @Test
+ public void testCreateValidatorScriptEmptyValidator() {
+ fail("Not yet implemented");
+ }
+
+ /**
+ * <p class="changed_added_4_0">Test for case when client side converter is not required.</p>
+ */
+ @Test
+ public void testCreateValidatorScriptNullConverter() {
+ fail("Not yet implemented");
+ }
+
+ /**
+ * <p class="changed_added_4_0">Test case when all converter and validators available on client.</p>
+ */
+ @Test
+ public void testCreateValidatorScriptClientOnly() {
+ fail("Not yet implemented");
+ }
+
+ private LibraryScriptFunction createValidatorFunction() {
+ return createFunction(REGEX_VALIDATOR, ClientValidatorRenderer.CONVERTED_VALUE_VAR, VALIDATOR_MESSAGE);
+ }
+
+ private LibraryScriptFunction createConverterFunction() {
+ return createFunction(NUMBER_CONVERTER, ClientValidatorRenderer.VALUE_VAR, VALIDATOR_MESSAGE);
+ }
+
+ private LibraryScriptFunction createFunction(final String name,String var,String message) {
+ LibraryScript libraryScript = new LibraryScript() {
+
+ public String getResourceName() {
+ return CLIENT_VALIDATORS_JS;
+ }
+
+ public String getLibrary() {
+ return ORG_RICHFACES;
+ }
+
+ public String getName() {
+ return name;
+ }
+ };
+ return new LibraryScriptFunction(libraryScript,new JSLiteral(var),message,VALIDATOR_PARAMS);
+ }
+
+ private ClientValidatorRenderer createStubRenderer(final LibraryScriptFunction converterFunction, final LibraryScriptFunction ...validatorFunctions){
+ return new ClientValidatorRenderer(){
+
+ private int validatorsCounter = 0;
+ @Override
+ LibraryScriptFunction getClientSideConverterScript(ClientBehaviorContext behaviorContext,
+ ConverterDescriptor converter) throws ScriptNotFoundException {
+ if(null == converterFunction){
+ throw new ScriptNotFoundException();
+ }
+ return converterFunction;
+ }
+
+ @Override
+ LibraryScriptFunction getClientSideValidatorScript(ClientBehaviorContext behaviorContext,
+ ValidatorDescriptor validator) throws ScriptNotFoundException {
+ if(validatorsCounter>=validatorFunctions.length){
+ throw new ScriptNotFoundException();
+ }
+ return validatorFunctions[validatorsCounter++];
+ }
+ };
+ }
+}
Property changes on: branches/RF-8742/ui/validator/ui/src/test/java/org/richfaces/renderkit/html/RendererGetComponentScriptTest.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Modified: branches/RF-8742/ui/validator/ui/src/test/java/org/richfaces/renderkit/html/RendererTestBase.java
===================================================================
--- branches/RF-8742/ui/validator/ui/src/test/java/org/richfaces/renderkit/html/RendererTestBase.java 2010-10-18 17:56:04 UTC (rev 19599)
+++ branches/RF-8742/ui/validator/ui/src/test/java/org/richfaces/renderkit/html/RendererTestBase.java 2010-10-18 23:49:42 UTC (rev 19600)
@@ -1,10 +1,19 @@
package org.richfaces.renderkit.html;
+import java.util.Map;
+
import org.richfaces.component.behavior.BehaviorTestBase;
import org.richfaces.component.behavior.ClientValidatorBehavior;
+import com.google.common.collect.ImmutableMap;
+
public class RendererTestBase extends BehaviorTestBase {
+ protected static final String CLIENT_VALIDATORS_JS = "clientValidators.js";
+ protected static final String ORG_RICHFACES = "org.richfaces";
+ protected static final String REGEX_VALIDATOR = "regexValidator";
+ protected static final String VALIDATOR_MESSAGE = "Validator Message";
+ protected static final Map<String, ? extends Object> VALIDATOR_PARAMS = ImmutableMap.of("foo", "value", "bar", 10);
protected ClientValidatorRenderer renderer = new ClientValidatorRenderer();
public RendererTestBase() {
Copied: branches/RF-8742/ui/validator/ui/src/test/java/org/richfaces/renderkit/html/ValidatorRendererGetScriptTest.java (from rev 19593, branches/RF-8742/ui/validator/ui/src/test/java/org/richfaces/renderkit/html/ValidatorRendererTest.java)
===================================================================
--- branches/RF-8742/ui/validator/ui/src/test/java/org/richfaces/renderkit/html/ValidatorRendererGetScriptTest.java (rev 0)
+++ branches/RF-8742/ui/validator/ui/src/test/java/org/richfaces/renderkit/html/ValidatorRendererGetScriptTest.java 2010-10-18 23:49:42 UTC (rev 19600)
@@ -0,0 +1,31 @@
+package org.richfaces.renderkit.html;
+
+import javax.faces.FacesException;
+import javax.faces.component.behavior.ClientBehavior;
+
+import org.jboss.test.faces.mock.MockTestRunner;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+
+/**
+ * <p class="changed_added_4_0">Test getScript method for wrong parameters.</p>
+ * @author asmirnov(a)exadel.com
+ *
+ */
+(a)RunWith(MockTestRunner.class)
+public class ValidatorRendererGetScriptTest extends RendererTestBase {
+
+ @Test(expected=NullPointerException.class)
+ public void testGetScriptNullContext() {
+ renderer.getScript(null, behavior);
+ }
+ @Test(expected=NullPointerException.class)
+ public void testGetScriptNullBehavior() {
+ renderer.getScript(setupBehaviorContext(input), null);
+ }
+
+ @Test(expected=FacesException.class)
+ public void testGetScriptWrongBehavior() {
+ renderer.getScript(null, controller.createNiceMock(ClientBehavior.class));
+ }
+}
Property changes on: branches/RF-8742/ui/validator/ui/src/test/java/org/richfaces/renderkit/html/ValidatorRendererGetScriptTest.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Deleted: branches/RF-8742/ui/validator/ui/src/test/java/org/richfaces/renderkit/html/ValidatorRendererTest.java
===================================================================
--- branches/RF-8742/ui/validator/ui/src/test/java/org/richfaces/renderkit/html/ValidatorRendererTest.java 2010-10-18 17:56:04 UTC (rev 19599)
+++ branches/RF-8742/ui/validator/ui/src/test/java/org/richfaces/renderkit/html/ValidatorRendererTest.java 2010-10-18 23:49:42 UTC (rev 19600)
@@ -1,31 +0,0 @@
-package org.richfaces.renderkit.html;
-
-import javax.faces.FacesException;
-import javax.faces.component.behavior.ClientBehavior;
-
-import org.jboss.test.faces.mock.MockTestRunner;
-import org.junit.Test;
-import org.junit.runner.RunWith;
-
-/**
- * <p class="changed_added_4_0">Test getScript method for wrong parameters.</p>
- * @author asmirnov(a)exadel.com
- *
- */
-(a)RunWith(MockTestRunner.class)
-public class ValidatorRendererTest extends RendererTestBase {
-
- @Test(expected=NullPointerException.class)
- public void testGetScriptNullContext() {
- renderer.getScript(null, behavior);
- }
- @Test(expected=NullPointerException.class)
- public void testGetScriptNullBehavior() {
- renderer.getScript(setupBehaviorContext(input), null);
- }
-
- @Test(expected=FacesException.class)
- public void testGetScriptWrongBehavior() {
- renderer.getScript(null, controller.createNiceMock(ClientBehavior.class));
- }
-}
13 years, 8 months
JBoss Rich Faces SVN: r19599 - in trunk/ui/input/ui/src/main: java/org/richfaces/renderkit and 2 other directories.
by richfaces-svn-commits@lists.jboss.org
Author: abelevich
Date: 2010-10-18 13:56:04 -0400 (Mon, 18 Oct 2010)
New Revision: 19599
Added:
trunk/ui/input/ui/src/main/resources/META-INF/resources/org.richfaces/inputBase.js
Modified:
trunk/ui/input/ui/src/main/java/org/richfaces/component/AbstractSelect.java
trunk/ui/input/ui/src/main/java/org/richfaces/renderkit/InplaceInputRendererBase.java
trunk/ui/input/ui/src/main/java/org/richfaces/renderkit/InplaceSelectRendererBase.java
trunk/ui/input/ui/src/main/java/org/richfaces/renderkit/InputRendererBase.java
trunk/ui/input/ui/src/main/java/org/richfaces/renderkit/SelectHelper.java
trunk/ui/input/ui/src/main/java/org/richfaces/renderkit/SelectRendererBase.java
trunk/ui/input/ui/src/main/resources/META-INF/resources/org.richfaces/inplaceBase.js
trunk/ui/input/ui/src/main/resources/META-INF/resources/org.richfaces/inplaceInput.js
trunk/ui/input/ui/src/main/resources/META-INF/resources/org.richfaces/inplaceSelect.js
trunk/ui/input/ui/src/main/resources/META-INF/resources/org.richfaces/select.js
trunk/ui/input/ui/src/main/templates/inplaceInput.template.xml
trunk/ui/input/ui/src/main/templates/inplaceSelect.template.xml
trunk/ui/input/ui/src/main/templates/select.template.xml
Log:
add base class for input components, fix id for inplaces, fix bugs with default labels behavior
Modified: trunk/ui/input/ui/src/main/java/org/richfaces/component/AbstractSelect.java
===================================================================
--- trunk/ui/input/ui/src/main/java/org/richfaces/component/AbstractSelect.java 2010-10-18 16:19:23 UTC (rev 19598)
+++ trunk/ui/input/ui/src/main/java/org/richfaces/component/AbstractSelect.java 2010-10-18 17:56:04 UTC (rev 19599)
@@ -111,7 +111,5 @@
@Attribute(defaultValue = "rf-sel-lst-cord")
public abstract String getListCss();
-
-
}
Modified: trunk/ui/input/ui/src/main/java/org/richfaces/renderkit/InplaceInputRendererBase.java
===================================================================
--- trunk/ui/input/ui/src/main/java/org/richfaces/renderkit/InplaceInputRendererBase.java 2010-10-18 16:19:23 UTC (rev 19598)
+++ trunk/ui/input/ui/src/main/java/org/richfaces/renderkit/InplaceInputRendererBase.java 2010-10-18 17:56:04 UTC (rev 19599)
@@ -49,6 +49,7 @@
@ResourceDependency(name = "richfaces.js"),
@ResourceDependency(name = "richfaces-event.js"),
@ResourceDependency(name = "richfaces-base-component.js"),
+ @ResourceDependency(library = "org.richfaces", name = "inputBase.js"),
@ResourceDependency(library = "org.richfaces", name = "inplaceBase.js"),
@ResourceDependency(library = "org.richfaces", name = "inplaceInput.js"),
@ResourceDependency(library = "org.richfaces", name = "inplaceInput.ecss") })
@@ -188,28 +189,7 @@
InplaceState inplaceState) {
return (InplaceState.edit != inplaceState) ? HtmlUtil.concatClasses(getEditCss(), getNoneCss()) : getEditCss();
}
-
- public String getReadyClientId(FacesContext facesContext,
- UIComponent component, InplaceState inplaceState) {
- String clientId = component.getClientId(facesContext);
- return getId(clientId, InplaceState.ready, inplaceState);
- }
-
- public String getChangedClientId(FacesContext facesContext,
- UIComponent component, InplaceState inplaceState) {
- String clientId = component.getClientId(facesContext);
- return getId(clientId, InplaceState.changed, inplaceState);
- }
-
- private String getId(String clientId, InplaceState expect,
- InplaceState current) {
- String result = clientId;
- if (expect != current) {
- result = clientId + ":" + expect;
- }
- return result;
- }
-
+
public void buildScript(ResponseWriter writer, FacesContext facesContext,
UIComponent component, Object additional) throws IOException {
if (!(component instanceof InplaceComponent)) {
@@ -239,10 +219,10 @@
options.put(OPTIONS_NONE_CSS, getNoneCss());
options.put(OPTIONS_CHANGED_CSS, getChangedStateCss());
options.put(OPTIONS_EDIT_CSS, getEditStateCss());
- options.put(OPTIONS_EDIT_CONTAINER, clientId + ":edit");
- options.put(OPTIONS_INPUT, clientId + ":input");
- options.put(OPTIONS_LABEL, clientId + ":label");
- options.put(OPTIONS_FOCUS, clientId + ":focus");
+ options.put(OPTIONS_EDIT_CONTAINER, clientId + "Edit");
+ options.put(OPTIONS_INPUT, clientId + "Input");
+ options.put(OPTIONS_LABEL, clientId + "Label");
+ options.put(OPTIONS_FOCUS, clientId + "Focus");
options.put(OPTIONS_DEFAULT_LABEL, inplaceComponent.getDefaultLabel());
options.put(OPTIONS_SAVE_ON_BLUR, inplaceComponent.isSaveOnBlur());
@@ -250,8 +230,8 @@
options.put(OPTIONS_SHOWCONTROLS, showControls);
if (showControls) {
- options.put(OPTIONS_BUTTON_OK, clientId + ":okbtn");
- options.put(OPTIONS_BUTTON_CANCEL, clientId + ":cancelbtn");
+ options.put(OPTIONS_BUTTON_OK, clientId + "Okbtn");
+ options.put(OPTIONS_BUTTON_CANCEL, clientId + "Cancelbtn");
}
return options;
}
Modified: trunk/ui/input/ui/src/main/java/org/richfaces/renderkit/InplaceSelectRendererBase.java
===================================================================
--- trunk/ui/input/ui/src/main/java/org/richfaces/renderkit/InplaceSelectRendererBase.java 2010-10-18 16:19:23 UTC (rev 19598)
+++ trunk/ui/input/ui/src/main/java/org/richfaces/renderkit/InplaceSelectRendererBase.java 2010-10-18 17:56:04 UTC (rev 19599)
@@ -48,19 +48,14 @@
@ResourceDependency(name = "richfaces-event.js"),
@ResourceDependency(name = "richfaces-base-component.js"),
@ResourceDependency(name = "richfaces-selection.js"),
+ @ResourceDependency(library = "org.richfaces", name = "inputBase.js"),
@ResourceDependency(library = "org.richfaces", name = "inplaceBase.js"),
@ResourceDependency(library = "org.richfaces", name = "popup.js"),
@ResourceDependency(library = "org.richfaces", name = "popupList.js"),
- @ResourceDependency(library = "org.richfaces", name = "selectList.js"),
@ResourceDependency(library = "org.richfaces", name = "inplaceInput.js"),
@ResourceDependency(library = "org.richfaces", name = "inplaceSelect.js"),
@ResourceDependency(library = "org.richfaces", name = "inplaceSelect.ecss") })
public class InplaceSelectRendererBase extends InplaceInputRendererBase {
-
-
- public static final String OPTION_LIST_ITEMS = "items";
-
- public static final String OPTIONS_SELECT_ITEM_VALUE_INPUT = "selValueInput";
public static final String OPTIONS_VISIBLE = "visible";
@@ -97,13 +92,12 @@
public void addToOptions(FacesContext facesContext, UIComponent component, Map<String, Object> options, Object additional) {
options.put(PopupConstants.OPTIONS_ITEM_CLASS, "rf-is-opt");
options.put(PopupConstants.OPTIONS_SELECT_ITEM_CLASS, "rf-is-sel");
- options.put(OPTION_LIST_ITEMS, additional);
String clientId = component.getClientId(facesContext);
options.put(PopupConstants.OPTIONS_LIST_CORD, clientId + "List");
options.put(PopupConstants.OPTIONS_LIST_CLASS, component.getAttributes().get("listCss"));
-
- options.put(OPTIONS_SELECT_ITEM_VALUE_INPUT, clientId + "selValue");
+ options.put(SelectHelper.OPTIONS_SELECT_ITEM_VALUE_INPUT, clientId + "selValue");
+ options.put(SelectHelper.OPTIONS_LIST_ITEMS, additional);
options.put(OPTIONS_VISIBLE, component.getAttributes().get("openOnEdit"));
}
Modified: trunk/ui/input/ui/src/main/java/org/richfaces/renderkit/InputRendererBase.java
===================================================================
--- trunk/ui/input/ui/src/main/java/org/richfaces/renderkit/InputRendererBase.java 2010-10-18 16:19:23 UTC (rev 19598)
+++ trunk/ui/input/ui/src/main/java/org/richfaces/renderkit/InputRendererBase.java 2010-10-18 17:56:04 UTC (rev 19599)
@@ -36,13 +36,10 @@
* created 23.01.2007
*/
public class InputRendererBase extends AjaxComponentRendererBase {
- protected Class getComponentClass() {
- return UIInput.class;
- }
protected void doDecode(FacesContext context, UIComponent component) {
String clientId = component.getClientId(context);
- Map requestParameterMap = context.getExternalContext().getRequestParameterMap();
+ Map<String, String> requestParameterMap = context.getExternalContext().getRequestParameterMap();
String newValue = (String) requestParameterMap.get(clientId);
if (null != newValue) {
Modified: trunk/ui/input/ui/src/main/java/org/richfaces/renderkit/SelectHelper.java
===================================================================
--- trunk/ui/input/ui/src/main/java/org/richfaces/renderkit/SelectHelper.java 2010-10-18 16:19:23 UTC (rev 19598)
+++ trunk/ui/input/ui/src/main/java/org/richfaces/renderkit/SelectHelper.java 2010-10-18 17:56:04 UTC (rev 19599)
@@ -129,6 +129,7 @@
public static String getSelectInputLabel(FacesContext facesContext, UIComponent component) {
AbstractSelect select = (AbstractSelect) component;
Object value = select.getSubmittedValue();
+ String label = null;
if (value == null) {
value = select.getValue();
if (value != null) {
@@ -136,13 +137,13 @@
facesContext, component);
for (SelectItem item : items) {
if (value.equals(item.getValue())) {
- value = item.getLabel();
+ label = item.getLabel();
}
}
}
}
- return (String) value;
+ return label;
}
}
Modified: trunk/ui/input/ui/src/main/java/org/richfaces/renderkit/SelectRendererBase.java
===================================================================
--- trunk/ui/input/ui/src/main/java/org/richfaces/renderkit/SelectRendererBase.java 2010-10-18 16:19:23 UTC (rev 19598)
+++ trunk/ui/input/ui/src/main/java/org/richfaces/renderkit/SelectRendererBase.java 2010-10-18 17:56:04 UTC (rev 19599)
@@ -41,9 +41,9 @@
@ResourceDependency(name = "richfaces.js"), @ResourceDependency(name = "jquery.position.js"),
@ResourceDependency(name = "richfaces-event.js"), @ResourceDependency(name = "richfaces-base-component.js"),
@ResourceDependency(name = "richfaces-selection.js"),
+ @ResourceDependency(library = "org.richfaces", name = "inputBase.js"),
@ResourceDependency(library = "org.richfaces", name = "popup.js"),
@ResourceDependency(library = "org.richfaces", name = "popupList.js"),
- @ResourceDependency(library = "org.richfaces", name = "selectList.js"),
@ResourceDependency(library = "org.richfaces", name = "select.js"),
@ResourceDependency(library = "org.richfaces", name = "select.ecss") })
public class SelectRendererBase extends InputRendererBase {
@@ -59,6 +59,15 @@
public String getSelectInputLabel(FacesContext facesContext, UIComponent component) {
return SelectHelper.getSelectInputLabel(facesContext, component);
}
+
+ public String getSelectLabel(FacesContext facesContext, UIComponent component) {
+ AbstractSelect select = (AbstractSelect) component;
+ String label = getSelectInputLabel(facesContext, select);
+ if (label == null || "".equals(label.trim())) {
+ label = select.getDefaultLabel();
+ }
+ return label;
+ }
public void encodeItems(FacesContext facesContext, UIComponent component, List<ClientSelectItem> clientSelectItems)
throws IOException {
@@ -78,25 +87,19 @@
Map<String, Object> options = new HashMap<String, Object>();
options.put(SelectHelper.OPTIONS_SHOWCONTROL, abstractSelect.isShowButton());
options.put(SelectHelper.OPTIONS_LIST_ITEMS, selectItems);
+ options.put(SelectHelper.OPTIONS_SELECT_ITEM_VALUE_INPUT, clientId + "selValue");
options.put(PopupConstants.OPTIONS_ITEM_CLASS, abstractSelect.getItemCss());
options.put(PopupConstants.OPTIONS_SELECT_ITEM_CLASS, abstractSelect.getSelectItemCss());
options.put(PopupConstants.OPTIONS_LIST_CLASS, abstractSelect.getListCss());
options.put(PopupConstants.OPTIONS_LIST_CORD, clientId + "List");
+
function.addParameter(clientId);
function.addParameter(options);
writer.write(function.toString());
}
- public String getValue(FacesContext facesContext, UIComponent component) throws IOException {
- String value = getInputValue(facesContext, component);
- if (value == null || "".equals(value)) {
- value = ((AbstractSelect) component).getDefaultLabel();
- }
- return value;
- }
-
protected String getScriptName() {
return "new RichFaces.ui.Select";
}
Modified: trunk/ui/input/ui/src/main/resources/META-INF/resources/org.richfaces/inplaceBase.js
===================================================================
--- trunk/ui/input/ui/src/main/resources/META-INF/resources/org.richfaces/inplaceBase.js 2010-10-18 16:19:23 UTC (rev 19598)
+++ trunk/ui/input/ui/src/main/resources/META-INF/resources/org.richfaces/inplaceBase.js 2010-10-18 17:56:04 UTC (rev 19599)
@@ -44,10 +44,8 @@
rf.ui.InplaceBase = function(id, options) {
$super.constructor.call(this, id);
- this.attachToDom(id);
- this.namespace = this.getNamespace() || "." + rf.Event.createNamespace(this.getName(), this.id);
-
- this.editEvent = options.editEvent;
+
+ this.editEvent = options.editEvent;
this.noneCss = options.noneCss;
this.changedCss = options.changedCss;
this.defaultLabel = options.defaultLabel;
@@ -64,7 +62,7 @@
};
- rf.BaseComponent.extend(rf.ui.InplaceBase);
+ rf.ui.InputBase.extend(rf.ui.InplaceBase);
var $super = rf.ui.InplaceBase.$super;
$.extend(rf.ui.InplaceBase.prototype, ( function () {
@@ -77,18 +75,7 @@
};
return {
- getName: function() {
- },
-
- getNamespace: function() {
- },
-
- getValue: function() {
- },
- setValue: function(value){
- },
-
getLabel: function() {
},
@@ -101,9 +88,6 @@
onhide: function() {
},
- getNamespace: function() {
- },
-
isValueSaved: function() {
return this.isSaved;
},
Modified: trunk/ui/input/ui/src/main/resources/META-INF/resources/org.richfaces/inplaceInput.js
===================================================================
--- trunk/ui/input/ui/src/main/resources/META-INF/resources/org.richfaces/inplaceInput.js 2010-10-18 16:19:23 UTC (rev 19598)
+++ trunk/ui/input/ui/src/main/resources/META-INF/resources/org.richfaces/inplaceInput.js 2010-10-18 17:56:04 UTC (rev 19599)
@@ -5,21 +5,19 @@
rf.ui.InplaceInput = function(id, options) {
$super.constructor.call(this, id, options);
- this.input = $(document.getElementById(options.input));
+ //rename input id in template (id + "Input")
+
this.label = $(document.getElementById(options.label));
var label = this.label.text();
- var inputLabel = this.input.val();
+ var inputLabel = this.getValue();
this.initialValue = (label == inputLabel) ? label : "";
this.saveOnBlur = options.saveOnBlur;
this.showControls = options.showControls;
- this.input.bind("focus", $.proxy(this.__editHandler, this));
- this.input.bind("change", $.proxy(this.__changeHandler, this));
- this.input.bind("blur", $.proxy(this.__blurHandler, this));
- this.input.bind("keydown", $.proxy(this.__keydownHandler, this));
-
- if(this.showControls) {
+ this.getInput().bind("focus", $.proxy(this.__editHandler, this));
+
+ if(this.showControls) {
this.okbtn = $(document.getElementById(options.okbtn));
this.cancelbtn = $(document.getElementById(options.cancelbtn));
this.okbtn.bind("mousedown", $.proxy(this.__saveBtnHandler, this));
@@ -88,9 +86,9 @@
},
__setInputFocus: function() {
- this.input.unbind("focus", this.__editHandler);
- this.input.focus();
- this.input.bind("focus", $.proxy(this.__editHandler, this));
+ this.getInput().unbind("focus", this.__editHandler);
+ this.getInput().focus();
+ this.getInput().bind("focus", $.proxy(this.__editHandler, this));
},
__saveBtnHandler: function(e) {
@@ -102,15 +100,7 @@
this.cancel();
return false;
},
-
- getValue: function() {
- return this.input.val();
- },
-
- setValue: function(value){
- this.input.val(value);
- },
-
+
getLabel: function() {
return this.label.text();
},
Modified: trunk/ui/input/ui/src/main/resources/META-INF/resources/org.richfaces/inplaceSelect.js
===================================================================
--- trunk/ui/input/ui/src/main/resources/META-INF/resources/org.richfaces/inplaceSelect.js 2010-10-18 16:19:23 UTC (rev 19598)
+++ trunk/ui/input/ui/src/main/resources/META-INF/resources/org.richfaces/inplaceSelect.js 2010-10-18 17:56:04 UTC (rev 19599)
@@ -7,18 +7,17 @@
options['attachTo'] = id;
options['attachToBody'] = true;
- this.popupList = new rf.ui.SelectList(options.list, this, options);
+ this.popupList = new rf.ui.PopupList(options.list, this, options);
this.items = options.items;
this.selValueInput = $(document.getElementById(options.selValueInput));
this.openPopup = false;
}
-
- rf.ui.InplaceInput.extend(rf.ui.InplaceSelect);
- $.extend(rf.ui.InplaceSelect, rf.ui.SelectListener);
+ rf.ui.InplaceInput.extend(rf.ui.InplaceSelect);
var $super = rf.ui.InplaceSelect.$super;
+
$.extend(rf.ui.InplaceSelect.prototype, ( function () {
return{
@@ -119,11 +118,7 @@
$super.__keydownHandler.call(this,e);
},
-
- __isButton: function(target) {
-
- },
-
+
__blurHandler: function(e) {
var target = $(e.originalEvent.explicitOriginalTarget);
if(!this.popupList.isPopupList(target)) {
Added: trunk/ui/input/ui/src/main/resources/META-INF/resources/org.richfaces/inputBase.js
===================================================================
--- trunk/ui/input/ui/src/main/resources/META-INF/resources/org.richfaces/inputBase.js (rev 0)
+++ trunk/ui/input/ui/src/main/resources/META-INF/resources/org.richfaces/inputBase.js 2010-10-18 17:56:04 UTC (rev 19599)
@@ -0,0 +1,91 @@
+(function (rf) {
+ rf.KEYS = {
+ BACKSPACE: 8,
+ TAB: 9,
+ RETURN: 13,
+ ESC: 27,
+ PAGEUP: 33,
+ PAGEDOWN: 34,
+ LEFT: 37,
+ UP: 38,
+ RIGHT: 39,
+ DOWN: 40,
+ DEL: 46
+ };
+})(RichFaces);
+
+(function ($, rf) {
+
+ rf.ui = rf.ui || {};
+
+ rf.ui.InputBase = function(id, options) {
+ $super.constructor.call(this, id);
+ this.namespace = this.getNamespace() || "." + rf.Event.createNamespace(this.getName(), this.getId());
+
+ this.id = id;
+ this.input = $(document.getElementById(id + "Input"));
+ this.attachToDom(id);
+
+ this.input.bind("keydown", $.proxy(this.__keydownHandler, this));
+ this.input.bind("blur", $.proxy(this.__blurHandler, this));
+ this.input.bind("change", $.proxy(this.__changeHandler, this));
+ this.input.bind("click", $.proxy(this.__clickHandler, this));
+ this.input.bind("focus", $.proxy(this.__focusHandler, this));
+ };
+
+ rf.BaseComponent.extend(rf.ui.InputBase);
+ var $super = rf.ui.InputBase.$super;
+
+ $.extend(rf.ui.InputBase.prototype, ( function () {
+
+ return {
+
+ name : "inputBase",
+
+ getName: function() {
+ return this.name;
+ },
+
+ getNamespace: function() {
+ return this.namespace;
+ },
+
+ __focusHandler: function(e) {
+
+ },
+
+ __clickHandler: function(e) {
+ },
+
+ __keydownHandler: function(e) {
+ },
+
+ __blurHandler: function(e) {
+ },
+
+ __changeHandler: function(e) {
+ },
+
+ __setInputFocus: function() {
+ this.input.focus();
+ },
+
+ getValue: function() {
+ return this.input.val();
+ },
+
+ setValue: function(value){
+ this.input.val(value);
+ },
+
+ getInput: function() {
+ return this.input;
+ },
+
+ getId: function() {
+ return this.id;
+ }
+ }
+ })());
+
+})(jQuery, window.RichFaces);
\ No newline at end of file
Modified: trunk/ui/input/ui/src/main/resources/META-INF/resources/org.richfaces/select.js
===================================================================
--- trunk/ui/input/ui/src/main/resources/META-INF/resources/org.richfaces/select.js 2010-10-18 16:19:23 UTC (rev 19598)
+++ trunk/ui/input/ui/src/main/resources/META-INF/resources/org.richfaces/select.js 2010-10-18 17:56:04 UTC (rev 19599)
@@ -1,3 +1,21 @@
+//TODO: to the utils?
+(function (rf) {
+ rf.KEYS = {
+ BACKSPACE: 8,
+ TAB: 9,
+ RETURN: 13,
+ ESC: 27,
+ PAGEUP: 33,
+ PAGEDOWN: 34,
+ LEFT: 37,
+ UP: 38,
+ RIGHT: 39,
+ DOWN: 40,
+ DEL: 46
+ };
+})(RichFaces);
+
+
(function ($, rf) {
rf.ui = rf.ui || {};
@@ -3,4 +21,5 @@
rf.ui.Select = function(id, options) {
+ $super.constructor.call(this, id);
this.id = id;
@@ -10,22 +29,16 @@
options['attachToBody'] = true;
this.selValueInput = $(document.getElementById(options.selValueInput));
-
- this.input = $(document.getElementById(id+"Input"));
- this.input.bind("click", $.proxy(this.__clickHandler, this));
- this.input.bind("keydown", $.proxy(this.__keydownHandler, this));
- this.input.bind("blur", $.proxy(this.__blurHandler, this));
-
this.items = options.items;
if(options.showControl) {
this.btn = $(document.getElementById(id+"Button"));
this.btn.bind("click", $.proxy(this.__clickHandler, this));
}
- this.popupList = new rf.ui.SelectList(options.list, this, options);
+ this.popupList = new rf.ui.PopupList(options.list, this, options);
};
- rf.BaseComponent.extend(rf.ui.Select);
+ rf.ui.InputBase.extend(rf.ui.Select);
var $super = rf.ui.Select.$super;
$.extend(rf.ui.Select.prototype, ( function () {
@@ -75,10 +88,6 @@
}
}
},
-
- __setInputFocus: function() {
- this.input.focus();
- },
__blurHandler: function(e) {
var target = $(e.originalEvent.explicitOriginalTarget);
@@ -119,11 +128,7 @@
saveItemValue: function(value) {
this.selValueInput.val(value);
- },
-
- setValue: function(value){
- this.input.val(value);
- }
+ }
}
})());
Modified: trunk/ui/input/ui/src/main/templates/inplaceInput.template.xml
===================================================================
--- trunk/ui/input/ui/src/main/templates/inplaceInput.template.xml 2010-10-18 16:19:23 UTC (rev 19598)
+++ trunk/ui/input/ui/src/main/templates/inplaceInput.template.xml 2010-10-18 17:56:04 UTC (rev 19599)
@@ -43,34 +43,34 @@
<cdk:object type="java.lang.String" name="inplaceValue" value="#{getValue(facesContext, component)}" />
<span id="#{clientId}" class="#{getStateStyleClass(component, inplaceState)}" cdk:passThroughWithExclusions="id class">
- <span id="#{clientId}:label" class="rf-ii-lbl">
+ <span id="#{clientId}Label" class="rf-ii-lbl">
#{inplaceValue}
</span>
<c:if test="#{!isDisable(inplaceState)}">
- <input id="#{clientId}:focus" type="image" style="position: absolute; top: 0px; left: 0px; outline-style: none;" class="rf-ii-none"/>
- <span id="#{clientId}:edit" class="#{getEditStyleClass(component, inplaceState)}">
- <input id="#{clientId}:input" autocomplete="off" name="#{clientId}"
+ <input id="#{clientId}Focus" type="image" style="position: absolute; top: 0px; left: 0px; outline-style: none;" class="rf-ii-none"/>
+ <span id="#{clientId}Edit" class="#{getEditStyleClass(component, inplaceState)}">
+ <input id="#{clientId}Input" autocomplete="off" name="#{clientId}"
type="text" value="#{getInputValue(facesContext, component)}" class="rf-ii-fld" style="width: #{component.attributes['inputWidth']};" cdk:passThrough="tabIndex">
<cdk:call expression="renderInputHandlers(facesContext, component);"/>
</input>
<c:if test="#{component.attributes['showControls']}">
<span class="rf-ii-btn-prepos">
<span class="rf-ii-btn-pos">
- <span id="#{clientId}:btnshadow" class="rf-ii-btn-shadow">
+ <span id="#{clientId}Btnshadow" class="rf-ii-btn-shadow">
<span class="rf-ii-btn-shdw-t"></span>
<span class="rf-ii-btn-shdw-l"></span>
<span class="rf-ii-btn-shdw-r"></span>
<span class="rf-ii-btn-shdw-b"></span>
- <span id="#{clientId}:btn" style="position : relative">
+ <span id="#{clientId}Btn" style="position : relative">
<input type="image"
- id="#{clientId}:okbtn"
+ id="#{clientId}Okbtn"
src="#{getResourcePath(facesContext, 'org.richfaces/ico_ok.gif')}"
class="rf-ii-btn" onmousedown="this.className='rf-ii-btn-p'"
onmouseout="this.className='rf-ii-btn'" onmouseup="this.className='rf-ii-btn'" />
<input type="image"
- id="#{clientId}:cancelbtn"
+ id="#{clientId}Cancelbtn"
src="#{getResourcePath(facesContext,'org.richfaces/ico_cancel.gif')}"
class="rf-ii-btn" onmousedown="this.className='rf-ii-btn-press'"
onmouseout="this.className='rf-ii-btn'" onmouseup="this.className='rf-ii-btn'" />
Modified: trunk/ui/input/ui/src/main/templates/inplaceSelect.template.xml
===================================================================
--- trunk/ui/input/ui/src/main/templates/inplaceSelect.template.xml 2010-10-18 16:19:23 UTC (rev 19598)
+++ trunk/ui/input/ui/src/main/templates/inplaceSelect.template.xml 2010-10-18 17:56:04 UTC (rev 19599)
@@ -40,16 +40,16 @@
<span id="#{clientId}" class="#{getStateStyleClass(component, inplaceState)}"
cdk:passThroughWithExclusions="id class">
- <span id="#{clientId}:label" class="rf-is-lbl">
+ <span id="#{clientId}Label" class="rf-is-lbl">
#{inplaceValue}
</span>
<c:if test="#{!isDisable(inplaceState)}">
- <input id="#{clientId}:focus" type="image" style="position: absolute; top: 0px; left: 0px; outline-style: none;" class="rf-is-none" />
+ <input id="#{clientId}Focus" type="image" style="position: absolute; top: 0px; left: 0px; outline-style: none;" class="rf-is-none" />
- <span id="#{clientId}:edit" class="#{getEditStyleClass(component, inplaceState)}">
+ <span id="#{clientId}Edit" class="#{getEditStyleClass(component, inplaceState)}">
<input id="#{clientId}selValue" name="#{clientId}" type="hidden" value="#{getValue(facesContext, component)}"/>
- <input id="#{clientId}:input" autocomplete="off"
+ <input id="#{clientId}Input" autocomplete="off"
type="text" value="#{getSelectInputLabel(facesContext, component)}"
class="rf-is-fld" style="width: #{component.attributes['inputWidth']};" readonly="readonly"
cdk:passThrough="tabIndex">
@@ -58,18 +58,18 @@
<c:if test="#{component.attributes['showControls']}">
<span class="rf-is-btn-prepos">
<span class="rf-is-btn-pos">
- <span id="#{clientId}:btnshadow" class="rf-is-shdw">
+ <span id="#{clientId}Btnshadow" class="rf-is-shdw">
<span class="rf-is-shdw-t"></span>
<span class="rf-is-shdw-l"></span>
<span class="rf-is-shdw-r"></span>
<span class="rf-is-shdw-b"></span>
- <span id="#{clientId}:btn" style="position : relative;">
- <input type="image" id="#{clientId}:okbtn"
+ <span id="#{clientId}Btn" style="position : relative;">
+ <input type="image" id="#{clientId}Okbtn"
src="#{getResourcePath(facesContext, 'org.richfaces/ico_ok.gif')}"
class="rf-is-btn" onmousedown="this.className='rf-is-btn-press'"
onmouseout="this.className='rf-is-btn'" onmouseup="this.className='rf-is-btn'" />
- <input type="image" id="#{clientId}:cancelbtn"
+ <input type="image" id="#{clientId}Cancelbtn"
src="#{getResourcePath(facesContext,'org.richfaces/ico_cancel.gif')}"
class="rf-is-btn" onmousedown="this.className='rf-is-btn-press'"
onmouseout="this.className='rf-is-btn'" onmouseup="this.className='rf-is-btn'" />
Modified: trunk/ui/input/ui/src/main/templates/select.template.xml
===================================================================
--- trunk/ui/input/ui/src/main/templates/select.template.xml 2010-10-18 16:19:23 UTC (rev 19598)
+++ trunk/ui/input/ui/src/main/templates/select.template.xml 2010-10-18 17:56:04 UTC (rev 19599)
@@ -21,10 +21,10 @@
<div id="#{clientId}" class="rf-sel-fld">
<div style="position : relative; overflow : hidden; text-align : left; padding-right : 21px;">
- <input id="#{clientId}selValue" name="#{clientId}" type="hidden" value="#{getValue(facesContext, component)}"/>
+ <input id="#{clientId}selValue" name="#{clientId}" type="hidden" value="#{getInputValue(facesContext, component)}"/>
<input cdk:passThroughWithExclusions="class autocomplete id value disabled name type readonly"
id="#{clientId}Input"
- value="#{getSelectInputLabel(facesContext, component)}"
+ value="#{getSelectLabel(facesContext, component)}"
disabled="#{disabled}"
type="text"
class="rf-sel-fnt rf-sel-inp"
13 years, 8 months
JBoss Rich Faces SVN: r19598 - in sandbox/trunk/examples/fileupload-demo: src and 4 other directories.
by richfaces-svn-commits@lists.jboss.org
Author: konstantin.mishin
Date: 2010-10-18 12:19:23 -0400 (Mon, 18 Oct 2010)
New Revision: 19598
Added:
sandbox/trunk/examples/fileupload-demo/pom.xml
sandbox/trunk/examples/fileupload-demo/src/
sandbox/trunk/examples/fileupload-demo/src/main/
sandbox/trunk/examples/fileupload-demo/src/main/java/
sandbox/trunk/examples/fileupload-demo/src/main/webapp/
sandbox/trunk/examples/fileupload-demo/src/main/webapp/META-INF/
sandbox/trunk/examples/fileupload-demo/src/main/webapp/META-INF/MANIFEST.MF
sandbox/trunk/examples/fileupload-demo/src/main/webapp/WEB-INF/
sandbox/trunk/examples/fileupload-demo/src/main/webapp/WEB-INF/web.xml
sandbox/trunk/examples/fileupload-demo/src/main/webapp/fileupload.xhtml
sandbox/trunk/examples/fileupload-demo/src/main/webapp/index.jsp
Modified:
sandbox/trunk/examples/fileupload-demo/
Log:
RF-9501
Property changes on: sandbox/trunk/examples/fileupload-demo
___________________________________________________________________
Name: svn:ignore
+ .settings
target
.classpath
.project
Added: sandbox/trunk/examples/fileupload-demo/pom.xml
===================================================================
--- sandbox/trunk/examples/fileupload-demo/pom.xml (rev 0)
+++ sandbox/trunk/examples/fileupload-demo/pom.xml 2010-10-18 16:19:23 UTC (rev 19598)
@@ -0,0 +1,167 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ JBoss, Home of Professional Open Source Copyright 2010, Red Hat,
+ Inc. and individual contributors by the @authors tag. See the
+ copyright.txt in the distribution for a full listing of
+ individual contributors. This is free software; you can
+ redistribute it and/or modify it under the terms of the GNU
+ Lesser General Public License as published by the Free Software
+ Foundation; either version 2.1 of the License, or (at your
+ option) any later version. This software 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 software; if not,
+ write to the Free Software Foundation, Inc., 51 Franklin St,
+ Fifth Floor, Boston, MA 02110-1301 USA, or see the FSF site:
+ http://www.fsf.org.
+-->
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+
+ <parent>
+ <groupId>org.richfaces.examples</groupId>
+ <artifactId>richfaces-example-parent</artifactId>
+ <version>4.0.0-SNAPSHOT</version>
+ </parent>
+
+ <modelVersion>4.0.0</modelVersion>
+
+ <groupId>org.richfaces.examples</groupId>
+ <artifactId>fileupload-demo</artifactId>
+ <version>4.0.0-SNAPSHOT</version>
+ <name>Richfaces Examples: FileUpload</name>
+ <packaging>war</packaging>
+
+ <build>
+ <finalName>${artifactId}-${project.version}</finalName>
+ <plugins>
+ <plugin>
+ <artifactId>maven-war-plugin</artifactId>
+ <version>2.1-beta-1</version>
+ <configuration>
+ <webResources>
+ <resource>
+ <directory>${basedir}/src/main/java</directory>
+ <targetPath>/WEB-INF/src</targetPath>
+ </resource>
+ </webResources>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+
+ <profiles>
+ <profile>
+ <id>jee6</id>
+ <build>
+ <plugins>
+ <plugin>
+ <artifactId>maven-war-plugin</artifactId>
+ <version>2.1-alpha-1</version>
+ <configuration>
+ <webappDirectory>${project.build.directory}/${project.build.finalName}-jee6</webappDirectory>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+
+ <dependencies>
+ <!-- JSF impl should be switchable in example specific parent -->
+ <dependency>
+ <groupId>com.sun.faces</groupId>
+ <artifactId>jsf-api</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>com.sun.faces</groupId>
+ <artifactId>jsf-impl</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>javax.transaction</groupId>
+ <artifactId>jta</artifactId>
+ <version>1.1</version>
+ <scope>provided</scope>
+ </dependency>
+ </dependencies>
+ </profile>
+ <profile>
+ <id>release</id>
+ <build>
+ <plugins>
+ <plugin>
+ <artifactId>maven-war-plugin</artifactId>
+ <executions>
+ <execution>
+ <id>jee6</id>
+ <phase>package</phase>
+ <goals>
+ <goal>war</goal>
+ </goals>
+ <configuration>
+ <webappDirectory>${project.build.directory}/${project.build.finalName}-jee6</webappDirectory>
+ <classifier>jee6</classifier>
+ <packagingExcludes>WEB-INF/lib/jsf-api*,WEB-INF/lib/jsf-impl*</packagingExcludes>
+ <warSourceExcludes>WEB-INF/lib/jsf-api*,WEB-INF/lib/jsf-impl*</warSourceExcludes>
+ </configuration>
+ </execution>
+ </executions>
+ <configuration>
+ <webResources>
+ <resource>
+ <directory>${basedir}/src/main/java</directory>
+ <targetPath>/WEB-INF/src</targetPath>
+ </resource>
+ </webResources>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+ </profile>
+ </profiles>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.richfaces.ui.fileupload</groupId>
+ <artifactId>richfaces-ui-fileupload-ui</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.richfaces.ui.core</groupId>
+ <artifactId>richfaces-ui-core-ui</artifactId>
+ </dependency>
+
+ <dependency>
+ <groupId>javax.servlet</groupId>
+ <artifactId>servlet-api</artifactId>
+ <scope>provided</scope>
+ </dependency>
+ <dependency>
+ <groupId>javax.servlet.jsp</groupId>
+ <artifactId>jsp-api</artifactId>
+ <scope>provided</scope>
+ </dependency>
+ <dependency>
+ <groupId>javax.el</groupId>
+ <artifactId>el-api</artifactId>
+ <scope>provided</scope>
+ </dependency>
+ <dependency>
+ <groupId>javax.servlet</groupId>
+ <artifactId>jstl</artifactId>
+ </dependency>
+
+ <dependency>
+ <groupId>net.sf.ehcache</groupId>
+ <artifactId>ehcache</artifactId>
+ </dependency>
+
+ <!-- Tests -->
+ <dependency>
+ <groupId>org.testng</groupId>
+ <artifactId>testng</artifactId>
+ <version>5.10</version>
+ <classifier>jdk15</classifier>
+ <scope>test</scope>
+ </dependency>
+ </dependencies>
+</project>
Added: sandbox/trunk/examples/fileupload-demo/src/main/webapp/META-INF/MANIFEST.MF
===================================================================
--- sandbox/trunk/examples/fileupload-demo/src/main/webapp/META-INF/MANIFEST.MF (rev 0)
+++ sandbox/trunk/examples/fileupload-demo/src/main/webapp/META-INF/MANIFEST.MF 2010-10-18 16:19:23 UTC (rev 19598)
@@ -0,0 +1,2 @@
+Manifest-Version: 1.0
+
Added: sandbox/trunk/examples/fileupload-demo/src/main/webapp/WEB-INF/web.xml
===================================================================
--- sandbox/trunk/examples/fileupload-demo/src/main/webapp/WEB-INF/web.xml (rev 0)
+++ sandbox/trunk/examples/fileupload-demo/src/main/webapp/WEB-INF/web.xml 2010-10-18 16:19:23 UTC (rev 19598)
@@ -0,0 +1,108 @@
+<?xml version='1.0' encoding='UTF-8'?>
+
+ <!--
+ DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. Copyright
+ 1997-2007 Sun Microsystems, Inc. All rights reserved. The contents of
+ this file are subject to the terms of either the GNU General Public
+ License Version 2 only ("GPL") or the Common Development and
+ Distribution License("CDDL") (collectively, the "License"). You may
+ not use this file except in compliance with the License. You can
+ obtain a copy of the License at
+ https://glassfish.dev.java.net/public/CDDL+GPL.html or
+ glassfish/bootstrap/legal/LICENSE.txt. See the License for the
+ specific language governing permissions and limitations under the
+ License. When distributing the software, include this License Header
+ Notice in each file and include the License file at
+ glassfish/bootstrap/legal/LICENSE.txt. Sun designates this particular
+ file as subject to the "Classpath" exception as provided by Sun in the
+ GPL Version 2 section of the License file that accompanied this code.
+ If applicable, add the following below the License Header, with the
+ fields enclosed by brackets [] replaced by your own identifying
+ information: "Portions Copyrighted [year] [name of copyright owner]"
+
+ Contributor(s): If you wish your version of this file to be governed
+ by only the CDDL or only the GPL Version 2, indicate your decision by
+ adding "[Contributor] elects to include this software in this
+ distribution under the [CDDL or GPL Version 2] license." If you don't
+ indicate a single choice of license, a recipient has the option to
+ distribute your version of this file under either the CDDL, the GPL
+ Version 2 or to extend the choice of license to its licensees as
+ provided above. However, if you add GPL Version 2 code and therefore,
+ elected the GPL Version 2 license, then the option applies only if the
+ new code is made subject to such option by the copyright holder.
+ -->
+
+<web-app version="2.5" xmlns="http://java.sun.com/xml/ns/javaee"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd">
+
+ <display-name></display-name>
+ <description></description>
+ <context-param>
+ <param-name>org.richfaces.skin</param-name>
+ <param-value>#{skinBean.skin}</param-value>
+ </context-param>
+
+ <context-param>
+ <param-name>javax.faces.PROJECT_STAGE</param-name>
+ <param-value>Development</param-value>
+ </context-param>
+
+ <context-param>
+ <param-name>org.richfaces.enableControlSkinning</param-name>
+ <param-value>true</param-value>
+ </context-param>
+ <context-param>
+ <param-name>org.richfaces.enableControlSkinningClasses</param-name>
+ <param-value>true</param-value>
+ </context-param>
+
+
+ <context-param>
+ <param-name>javax.faces.STATE_SAVING_METHOD</param-name>
+ <param-value>server</param-value>
+ </context-param>
+
+ <context-param>
+ <param-name>javax.faces.DEFAULT_SUFFIX</param-name>
+ <param-value>.xhtml</param-value>
+ </context-param>
+ <context-param>
+ <param-name>facelets.DEVELOPMENT</param-name>
+ <param-value>true</param-value>
+ </context-param>
+
+ <context-param>
+ <description>
+ Set this flag to true if you want the JavaServer Faces
+ Reference Implementation to validate the XML in your
+ faces-config.xml resources against the DTD. Default
+ value is false.
+ </description>
+ <param-name>com.sun.faces.validateXml</param-name>
+ <param-value>true</param-value>
+ </context-param>
+
+ <!-- Faces Servlet -->
+ <servlet>
+ <servlet-name>Faces Servlet</servlet-name>
+ <servlet-class>javax.faces.webapp.FacesServlet</servlet-class>
+ <load-on-startup>1</load-on-startup>
+ </servlet>
+
+
+ <!-- Faces Servlet Mapping -->
+ <!--
+
+ This mapping identifies a jsp page as having JSF content. If a request
+ comes to the server for foo.faces, the container will send the request
+ to the FacesServlet, which will expect a corresponding foo.jsp page to
+ exist containing the content.
+ -->
+ <servlet-mapping>
+ <servlet-name>Faces Servlet</servlet-name>
+ <url-pattern>/faces/*</url-pattern>
+ <url-pattern>*.jsf</url-pattern>
+ </servlet-mapping>
+
+</web-app>
Added: sandbox/trunk/examples/fileupload-demo/src/main/webapp/fileupload.xhtml
===================================================================
--- sandbox/trunk/examples/fileupload-demo/src/main/webapp/fileupload.xhtml (rev 0)
+++ sandbox/trunk/examples/fileupload-demo/src/main/webapp/fileupload.xhtml 2010-10-18 16:19:23 UTC (rev 19598)
@@ -0,0 +1,45 @@
+<?xml version='1.0' encoding='UTF-8'?>
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml"
+ xmlns:h="http://java.sun.com/jsf/html"
+ xmlns:f="http://java.sun.com/jsf/core"
+ xmlns:ui="http://java.sun.com/jsf/facelets"
+ xmlns:fu="http://richfaces.org/fileupload">
+<!--
+JBoss, Home of Professional Open Source
+Copyright ${year}, Red Hat, Inc. and individual contributors
+by the @authors tag. See the copyright.txt in the distribution for a
+full listing of individual contributors.
+
+
+This is free software; you can redistribute it and/or modify it
+under the terms of the GNU Lesser General Public License as
+published by the Free Software Foundation; either version 2.1 of
+the License, or (at your option) any later version.
+
+
+This software 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 software; if not, write to the Free
+Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+02110-1301 USA, or see the FSF site: http://www.fsf.org.
+-->
+ <h:head>
+ <title>Richfaces FileUpload Demo</title>
+ </h:head>
+ <h:body>
+ <h:form id="form">
+ <h:outputText value="Skin: "/>
+ <h:selectOneMenu value="#{skinBean.skin}" onchange="submit();">
+ <f:selectItems value="#{skinBean.skins}"/>
+ </h:selectOneMenu>
+ <br />
+ <fu:fileupload />
+ </h:form>
+ </h:body>
+</html>
Added: sandbox/trunk/examples/fileupload-demo/src/main/webapp/index.jsp
===================================================================
--- sandbox/trunk/examples/fileupload-demo/src/main/webapp/index.jsp (rev 0)
+++ sandbox/trunk/examples/fileupload-demo/src/main/webapp/index.jsp 2010-10-18 16:19:23 UTC (rev 19598)
@@ -0,0 +1,4 @@
+<html>
+<body>
+ <jsp:forward page="fileupload.jsf" /></body>
+</html>
13 years, 8 months
JBoss Rich Faces SVN: r19597 - in sandbox/trunk/ui/fileupload/ui: src and 4 other directories.
by richfaces-svn-commits@lists.jboss.org
Author: konstantin.mishin
Date: 2010-10-18 12:17:19 -0400 (Mon, 18 Oct 2010)
New Revision: 19597
Added:
sandbox/trunk/ui/fileupload/ui/pom.xml
sandbox/trunk/ui/fileupload/ui/src/
sandbox/trunk/ui/fileupload/ui/src/main/
sandbox/trunk/ui/fileupload/ui/src/main/config/
sandbox/trunk/ui/fileupload/ui/src/main/java/
sandbox/trunk/ui/fileupload/ui/src/main/resources/
sandbox/trunk/ui/fileupload/ui/src/main/resources/META-INF/
sandbox/trunk/ui/fileupload/ui/src/main/resources/META-INF/resources/
sandbox/trunk/ui/fileupload/ui/src/main/resources/META-INF/resources/org.richfaces/
sandbox/trunk/ui/fileupload/ui/src/main/templates/
Modified:
sandbox/trunk/ui/fileupload/ui/
Log:
RF-9495
Property changes on: sandbox/trunk/ui/fileupload/ui
___________________________________________________________________
Name: svn:ignore
+ .settings
target
.classpath
.project
Added: sandbox/trunk/ui/fileupload/ui/pom.xml
===================================================================
--- sandbox/trunk/ui/fileupload/ui/pom.xml (rev 0)
+++ sandbox/trunk/ui/fileupload/ui/pom.xml 2010-10-18 16:17:19 UTC (rev 19597)
@@ -0,0 +1,59 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!--
+ JBoss, Home of Professional Open Source Copyright 2010, Red Hat,
+ Inc. and individual contributors by the @authors tag. See the
+ copyright.txt in the distribution for a full listing of
+ individual contributors. This is free software; you can
+ redistribute it and/or modify it under the terms of the GNU
+ Lesser General Public License as published by the Free Software
+ Foundation; either version 2.1 of the License, or (at your
+ option) any later version. This software 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 software; if not,
+ write to the Free Software Foundation, Inc., 51 Franklin St,
+ Fifth Floor, Boston, MA 02110-1301 USA, or see the FSF site:
+ http://www.fsf.org.
+-->
+
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+
+ <modelVersion>4.0.0</modelVersion>
+
+ <parent>
+ <groupId>org.richfaces.ui</groupId>
+ <artifactId>richfaces-ui-parent</artifactId>
+ <version>4.0.0-SNAPSHOT</version>
+ </parent>
+
+ <groupId>org.richfaces.ui.fileupload</groupId>
+ <artifactId>richfaces-ui-fileupload-ui</artifactId>
+ <name>Richfaces UI Components: FileUpload UI</name>
+ <packaging>jar</packaging>
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.richfaces.cdk</groupId>
+ <artifactId>maven-cdk-plugin</artifactId>
+ </plugin>
+ <plugin>
+ <artifactId>maven-checkstyle-plugin</artifactId>
+ </plugin>
+ </plugins>
+ </build>
+
+ <dependencies>
+ <!-- runtime -->
+ <dependency>
+ <groupId>org.richfaces.core</groupId>
+ <artifactId>richfaces-core-api</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.richfaces.ui.common</groupId>
+ <artifactId>richfaces-ui-common-ui</artifactId>
+ </dependency>
+ </dependencies>
+</project>
13 years, 8 months