JBoss Rich Faces SVN: r21045 - trunk/ui/output/ui/src/main/resources/META-INF/resources/org.richfaces.
by richfaces-svn-commits@lists.jboss.org
Author: abelevich
Date: 2011-01-17 07:31:59 -0500 (Mon, 17 Jan 2011)
New Revision: 21045
Removed:
trunk/ui/output/ui/src/main/resources/META-INF/resources/org.richfaces/popupList.js
Log:
RF-10214 inplaceSelect: select: popup appears in wrong place
Deleted: trunk/ui/output/ui/src/main/resources/META-INF/resources/org.richfaces/popupList.js
===================================================================
--- trunk/ui/output/ui/src/main/resources/META-INF/resources/org.richfaces/popupList.js 2011-01-17 12:27:38 UTC (rev 21044)
+++ trunk/ui/output/ui/src/main/resources/META-INF/resources/org.richfaces/popupList.js 2011-01-17 12:31:59 UTC (rev 21045)
@@ -1,219 +0,0 @@
-(function($, rf) {
-
- rf.ui = rf.ui || {};
-
- rf.ui.PopupList = function(id, listener, options) {
- var mergedOptions = $.extend({},
- defaultOptions, options);
- $super.constructor.call(this, id, mergedOptions);
- this.selectListener = listener;
- this.selectItemCss = mergedOptions.selectItemCss;
- this.scrollContainer = $(mergedOptions.scrollContainer);
- this.itemCss = mergedOptions.itemCss;
- this.listCss = mergedOptions.listCss;
- this.index = -1;
- this.id = id;
-
- this.__updateItemsList();
-
- //for (var i in this.items){
- // rf.Event.bindById(this.items[i].id, "mouseenter", $.proxy(this.__onMouseOver, this), this );
- // rf.Event.bindById(this.items[i].id, "click", $.proxy(this.__onClick, this), this );
- //}
- rf.Event.bindById(this.id, "mouseover", $.proxy(this.__onMouseOver, this), this );
- rf.Event.bindById(this.id, "click", $.proxy(this.__onClick, this), this );
-
- //this.popup.bind("mouseover", $.proxy(this.__onMouseOver, this));
- //this.popup.bind("click", $.proxy(this.__onClick, this));
-
-
- };
-
- rf.ui.Popup.extend(rf.ui.PopupList);
- var $super = rf.ui.PopupList.$super;
-
- var defaultOptions = {
- attachToBody: true,
- positionType: "DROPDOWN",
- positionOffset: [0, 20],
- positionTo: "AA",
- potiosionFrom: "AA"
- };
-
- $.extend(rf.ui.PopupList.prototype, (function() {
-
- return {
-
- name: "popupList",
-
- processItem: function(item) {
- if (this.selectListener.processItem && typeof this.selectListener.processItem == 'function') {
- this.selectListener.processItem(item);
- }
- },
-
- selectItem: function(item) {
- if (this.selectListener.selectItem && typeof this.selectListener.selectItem == 'function') {
- this.selectListener.selectItem(item);
- } else {
- item.addClass(this.selectItemCss);
- }
- this.__scrollToSelectedItem(this);
- },
-
- unselectItem: function(item) {
- if (this.selectListener.unselectItem && typeof this.selectListener.unselectItem == 'function') {
- this.selectListener.unselectItem(item);
- } else {
- item.removeClass(this.selectItemCss);
- }
- },
-
- nextSelectItem: function() {
- var item = this.items.eq(this.nextSelectItemIndex);
- if (item){
- return item;
- }
-
- },
-
- currentSelectItem: function() {
- if (this.items && this.index != -1) {
- return this.items[this.index];
- }
- },
-
- getSelectedItemIndex: function() {
- return this.index;
- },
-
- getItemByIndex: function(i) {
- if (i >= 0 && i <= this.items.length) {
- return this.items[i];
- }
- },
-
- resetItemsSelection: function() {
- if (this.items) {
- var popup = this;
- this.items.each(function(i, item) {
- popup.unselectItem($(item));
- });
- }
- },
-
- isPopupList: function(target) {
- var parentId = target.parents("." + this.listCss).attr("id");
- return (parentId && (parentId == this.getId()));
- },
-
- __updateItemsList: function() {
- return (this.items = this.popup.find("." + this.itemCss));
- },
-
- __select: function(item) {
- var index = this.items.index(item);
- this.__selectByIndex(index);
- },
-
- __selectByIndex: function(index, isOffset) {
- if (this.items.length == 0 || (!isOffset && this.index == index)) return;
-
- var item;
-
- if (this.index != -1) {
- item = this.items.eq(this.index);
- this.nextSelectItemIndex=index;
- this.unselectItem(item);
- }
-
- if (index == undefined) {
- this.index = -1;
- return;
- }
-
- if (isOffset) {
- this.index += index;
- if (this.index < 0) {
- this.index = this.items.length - 1;
- } else if (this.index >= this.items.length) {
- this.index = 0;
- }
- } else {
- if (index < 0) {
- index = 0;
- } else if (index >= this.items.length) {
- index = this.items.length - 1;
- }
- this.index = index;
- }
-
- item = this.items.eq(this.index);
-
- this.selectItem(item);
- },
-
- __selectCurrent: function() {
- var item;
- if (this.items && this.index >= 0) {
- item = this.items.eq(this.index);
- this.processItem(item);
- }
- },
-
- __selectPrev: function() {
- this.__selectByIndex( - 1, true);
- },
-
- __selectNext: function() {
- this.__selectByIndex(1, true);
- },
-
- __onMouseOver: function(e) {
- var item = this.__getItem(e);
- if (item) {
- this.__select(item);
- }
- },
-
- __onClick: function(e) {
- var item = this.__getItem(e);
- this.processItem($(item));
- this.__select(item);
- },
-
- __getItem: function(e) {
- return $(e.target).closest("." + this.itemCss, e.currentTarget).get(0);
- },
-
- __getItems: function() {
- return this.items;
- },
-
- __setItems: function(items) {
- this.items = items;
- },
-
- __scrollToSelectedItem: function() {
- if (this.scrollContainer && this.scrollContainer.lenght < 1) {
- var offset = 0;
-
- this.items.slice(0, this.index).each(function() {
- offset += this.offsetHeight;
- });
-
- var parentContainer = this.scrollContainer;
- if (offset < parentContainer.scrollTop()) {
- parentContainer.scrollTop(offset);
- } else {
- offset += this.items.get(this.index).offsetHeight;
- if (offset - parentContainer.scrollTop() > parentContainer.get(0).clientHeight) {
- parentContainer.scrollTop(offset - parentContainer.innerHeight());
- }
- }
- }
- }
- }
- })());
-
-})(jQuery, window.RichFaces);
\ No newline at end of file
13 years, 11 months
JBoss Rich Faces SVN: r21044 - trunk/ui/output/ui/src/main/resources/META-INF/resources/org.richfaces.
by richfaces-svn-commits@lists.jboss.org
Author: abelevich
Date: 2011-01-17 07:27:38 -0500 (Mon, 17 Jan 2011)
New Revision: 21044
Modified:
trunk/ui/output/ui/src/main/resources/META-INF/resources/org.richfaces/menu-base.js
trunk/ui/output/ui/src/main/resources/META-INF/resources/org.richfaces/menuKeyNavigation.js
Log:
https://issues.jboss.org/browse/RF-10219 dropDownMenu: need to make visual and behavior corrections. appearance and custor.
Modified: trunk/ui/output/ui/src/main/resources/META-INF/resources/org.richfaces/menu-base.js
===================================================================
--- trunk/ui/output/ui/src/main/resources/META-INF/resources/org.richfaces/menu-base.js 2011-01-17 10:58:01 UTC (rev 21043)
+++ trunk/ui/output/ui/src/main/resources/META-INF/resources/org.richfaces/menu-base.js 2011-01-17 12:27:38 UTC (rev 21044)
@@ -125,9 +125,13 @@
this.displayed = false;
this.__deselectCurrentItem();
this.currentSelectedItemIndex = -1;
+ jqueryParentMenu=this.__getParentMenu();
parentMenu = rf.$(this.__getParentMenu());
- parentMenu.popupElement.focus();
- rf.ui.MenuManager.setActiveSubMenu(parentMenu);
+ if (this.id != parentMenu.id)
+ {
+ parentMenu.popupElement.focus();
+ rf.ui.MenuManager.setActiveSubMenu(parentMenu);
+ }
}
},
Modified: trunk/ui/output/ui/src/main/resources/META-INF/resources/org.richfaces/menuKeyNavigation.js
===================================================================
--- trunk/ui/output/ui/src/main/resources/META-INF/resources/org.richfaces/menuKeyNavigation.js 2011-01-17 10:58:01 UTC (rev 21043)
+++ trunk/ui/output/ui/src/main/resources/META-INF/resources/org.richfaces/menuKeyNavigation.js 2011-01-17 12:27:38 UTC (rev 21044)
@@ -91,10 +91,8 @@
var item = this.__getItemByIndex(this.currentSelectedItemIndex);
var menu;
menu = this.__getParentMenu()||this.__getParentMenuFromItem(item);
- if (menu != null){
+ if (menu != null && this.id != rf.$(menu).id){
this.hide();
-// this.active=false;
-// rf.$(menu).active=true;
rf.$(menu).popupElement.focus();
} else {
this.hide();
13 years, 11 months
JBoss Rich Faces SVN: r21043 - modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richMenuGroup.
by richfaces-svn-commits@lists.jboss.org
Author: ppitonak(a)redhat.com
Date: 2011-01-17 05:58:01 -0500 (Mon, 17 Jan 2011)
New Revision: 21043
Modified:
modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richMenuGroup/TestRichMenuGroup.java
Log:
* added issue tracking information
Modified: modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richMenuGroup/TestRichMenuGroup.java
===================================================================
--- modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richMenuGroup/TestRichMenuGroup.java 2011-01-17 08:33:08 UTC (rev 21042)
+++ modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richMenuGroup/TestRichMenuGroup.java 2011-01-17 10:58:01 UTC (rev 21043)
@@ -37,6 +37,7 @@
import org.jboss.test.selenium.locator.JQueryLocator;
import org.jboss.test.selenium.waiting.EventFiredCondition;
import org.richfaces.tests.metamer.ftest.AbstractMetamerTest;
+import org.richfaces.tests.metamer.ftest.annotations.IssueTracking;
import org.testng.annotations.Test;
/**
@@ -121,6 +122,7 @@
// fail("not implemented in RichFaces");
// }
@Test
+ @IssueTracking("https://issues.jboss.org/browse/RF-9989")
public void testIcon() {
AttributeLocator attr = icon.getAttribute(Attribute.SRC);
@@ -139,6 +141,7 @@
}
@Test
+ @IssueTracking("https://issues.jboss.org/browse/RF-9989")
public void testIconDisabled() {
selenium.click(pjq("input[type=radio][name$=disabledInput][value=true]"));
selenium.waitForPageToLoad();
13 years, 11 months
JBoss Rich Faces SVN: r21042 - trunk/examples/output-demo/src/main/webapp/examples.
by richfaces-svn-commits@lists.jboss.org
Author: abelevich
Date: 2011-01-17 03:33:08 -0500 (Mon, 17 Jan 2011)
New Revision: 21042
Modified:
trunk/examples/output-demo/src/main/webapp/examples/dropDownMenu.xhtml
Log:
Drop Down Menu developer demo update
Modified: trunk/examples/output-demo/src/main/webapp/examples/dropDownMenu.xhtml
===================================================================
--- trunk/examples/output-demo/src/main/webapp/examples/dropDownMenu.xhtml 2011-01-15 00:56:14 UTC (rev 21041)
+++ trunk/examples/output-demo/src/main/webapp/examples/dropDownMenu.xhtml 2011-01-17 08:33:08 UTC (rev 21042)
@@ -46,7 +46,7 @@
<h:outputText style="font-weight:bold" value="#{menuBean.current}"></h:outputText>
</a4j:outputPanel>
<br />
- <ddm:dropDownMenu id="ddmenu" disabled="#{menuBean.disabled}" mode="#{menuBean.mode}">
+ <ddm:dropDownMenu hideDelay="600" showEvent="click" jointPoint="bottomLeft" direction="autoRight" id="ddmenu" disabled="#{menuBean.disabled}" mode="#{menuBean.mode}">
<f:facet name="label">
<h:panelGroup>
<h:graphicImage value="/images/ddmenu/copy.gif" styleClass="pic"/>
@@ -59,7 +59,7 @@
<h:outputText value="(disabled)File"/>
</h:panelGroup>
</f:facet>
- <ddm:menuItem id="menuNew" label="New" icon="/images/ddmenu/create_doc.gif"
+ <ddm:menuItem id="menuNew1" label="New" icon="/images/ddmenu/create_doc.gif"
action="#{menuBean.doNew}" execute="@form">
<f:facet name="icon">
<h:selectBooleanCheckbox id="checkbox" value="#{menuBean.checkbox}"/>
@@ -91,6 +91,25 @@
<ddm:menuItem label="Save All 2" icon="/images/ddmenu/save_all.gif" >
<f:setPropertyActionListener target="#{menuBean.value}" value="Save All 2" />
</ddm:menuItem>
+ <ddm:menuGroup label="Deep1" icon="/images/ddmenu/save.gif" >
+ <ddm:menuItem label="Deep All 1" icon="/images/ddmenu/save_all.gif">
+ <f:setPropertyActionListener target="#{menuBean.value}" value="Deep All 1" />
+ </ddm:menuItem>
+ <ddm:menuItem label="Deep All 2" icon="/images/ddmenu/save_all.gif">
+ <f:setPropertyActionListener target="#{menuBean.value}" value="Deep All 2" />
+ </ddm:menuItem>
+ <ddm:menuGroup label="Deep2" icon="/images/ddmenu/save.gif" >
+ <ddm:menuItem label="Deep2 All 1" icon="/images/ddmenu/save_all.gif">
+ <f:setPropertyActionListener target="#{menuBean.value}" value="Deep2 All 1" />
+ </ddm:menuItem>
+ <ddm:menuItem label="Deep2 All 2" icon="/images/ddmenu/save_all.gif">
+ <f:setPropertyActionListener target="#{menuBean.value}" value="Deep2 All 2" />
+ </ddm:menuItem>
+
+
+ </ddm:menuGroup>
+
+ </ddm:menuGroup>
</ddm:menuGroup>
</ddm:menuGroup>
<ddm:menuItem label="Close" action="#{menuBean.doClose}"/>
@@ -99,10 +118,16 @@
<ddm:menuItem label="Exit" action="#{menuBean.doExit}"/>
<ddm:menuItem action="#{menuBean.doExit}">
<h:inputText />
- </ddm:menuItem>
+ </ddm:menuItem>
+ <ddm:menuItem label="Add user!" mode="client">
+ <a4j:ajax event="click" execute="menuNew1" render="@this ddmenu2" oncomplete="alert('addUser()!')"></a4j:ajax>
+ </ddm:menuItem>
</ddm:dropDownMenu>
</h:panelGroup>
+
+
+
<h:panelGrid columns="2">
<h:outputText value="Disabled" />
@@ -120,6 +145,103 @@
</h:panelGrid>
</h:form>
+ <br/>
+ <br/>
+ <br/>
+ <br/>
+ <br/>
+ <h:form id="form2">
+ <h:panelGroup>
+ <ddm:dropDownMenu id="ddmenu2">
+ <f:facet name="label">
+ <h:panelGroup>
+ <h:graphicImage value="/images/ddmenu/copy.gif" styleClass="pic"/>
+ <h:outputText value="File"/>
+ </h:panelGroup>
+ </f:facet>
+ <f:facet name="labelDisabled">
+ <h:panelGroup>
+ <h:graphicImage value="/images/ddmenu/copy.gif" styleClass="pic"/>
+ <h:outputText value="(disabled)File"/>
+ </h:panelGroup>
+ </f:facet>
+ <ddm:menuItem id="menuNew2" label="New" icon="/images/ddmenu/create_doc.gif"
+ action="#{menuBean.doNew}" execute="@form">
+ <f:facet name="icon">
+ <h:selectBooleanCheckbox id="checkbox" value="#{menuBean.checkbox}"/>
+ </f:facet>
+ </ddm:menuItem>
+ <ddm:menuItem label="Open" action="#{menuBean.doOpen}">
+ <f:facet name="icon">
+ <h:graphicImage value="/images/ddmenu/open.gif" />
+ </f:facet>
+ </ddm:menuItem>
+ </ddm:dropDownMenu>
+ <ddm:dropDownMenu id="ddmenu3">
+ <f:facet name="label">
+ <h:panelGroup>
+ <h:graphicImage value="/images/ddmenu/copy.gif" styleClass="pic"/>
+ <h:outputText value="File"/>
+ </h:panelGroup>
+ </f:facet>
+ <f:facet name="labelDisabled">
+ <h:panelGroup>
+ <h:graphicImage value="/images/ddmenu/copy.gif" styleClass="pic"/>
+ <h:outputText value="(disabled)File"/>
+ </h:panelGroup>
+ </f:facet>
+ <ddm:menuItem id="menuNew3" label="New" icon="/images/ddmenu/create_doc.gif"
+ action="#{menuBean.doNew}" execute="@form">
+
+ </ddm:menuItem>
+ <ddm:menuItem label="Open" action="#{menuBean.doOpen}">
+ <f:facet name="icon">
+ <h:graphicImage value="/images/ddmenu/open.gif" />
+ </f:facet>
+ </ddm:menuItem>
+ </ddm:dropDownMenu>
+ <ddm:dropDownMenu id="ddmenu4">
+ <f:facet name="label">
+ <h:panelGroup>
+ <h:graphicImage value="/images/ddmenu/copy.gif" styleClass="pic"/>
+ <h:outputText value="File"/>
+ </h:panelGroup>
+ </f:facet>
+ <f:facet name="labelDisabled">
+ <h:panelGroup>
+ <h:graphicImage value="/images/ddmenu/copy.gif" styleClass="pic"/>
+ <h:outputText value="(disabled)File"/>
+ </h:panelGroup>
+ </f:facet>
+ <ddm:menuItem id="menuNew" label="New" icon="/images/ddmenu/create_doc.gif"
+ action="#{menuBean.doNew}" execute="@form">
+ </ddm:menuItem>
+ <ddm:menuItem label="Open" action="#{menuBean.doOpen}">
+ <f:facet name="icon">
+ <h:graphicImage value="/images/ddmenu/open.gif" />
+ </f:facet>
+ </ddm:menuItem>
+ </ddm:dropDownMenu>
+
+ <br/>
+ <br/>
+ <br/>
+ <ddm:toolbar >
+ ` <ddm:menuItem id="menuItemToolbar1"/>
+ <ddm:menuItem id="menuItemFacet1" label="Open" action="#{menuBean.doOpen}">
+ <f:facet name="icon">
+ <h:graphicImage value="/images/ddmenu/open.gif" />
+ </f:facet>
+ </ddm:menuItem>
+
+ </ddm:toolbar>
+
+
+
+
+ </h:panelGroup>
+ </h:form>
+
</ui:define>
</ui:composition>
</body>
13 years, 11 months
JBoss Rich Faces SVN: r21041 - in branches/RF-9797: ui/validator/api/src/main/java/org/richfaces/javascript and 2 other directories.
by richfaces-svn-commits@lists.jboss.org
Author: alexsmirnov
Date: 2011-01-14 19:56:14 -0500 (Fri, 14 Jan 2011)
New Revision: 21041
Modified:
branches/RF-9797/core/api/src/main/java/org/ajax4jsf/javascript/JSFunctionDefinition.java
branches/RF-9797/ui/validator/api/src/main/java/org/richfaces/javascript/Message.java
branches/RF-9797/ui/validator/ui/src/main/java/org/richfaces/renderkit/html/AjaxOnlyScript.java
branches/RF-9797/ui/validator/ui/src/main/java/org/richfaces/renderkit/html/ClientAndAjaxScript.java
branches/RF-9797/ui/validator/ui/src/main/java/org/richfaces/renderkit/html/ClientOnlyScript.java
branches/RF-9797/ui/validator/ui/src/main/java/org/richfaces/renderkit/html/ClientValidatorRenderer.java
branches/RF-9797/ui/validator/ui/src/main/java/org/richfaces/renderkit/html/LibraryScriptFunction.java
branches/RF-9797/ui/validator/ui/src/main/java/org/richfaces/renderkit/html/ValidatorScriptBase.java
branches/RF-9797/ui/validator/ui/src/main/resources/META-INF/resources/org.richfaces/richfaces-csv.js
Log:
CODING IN PROGRESS - issue RF-9797: CSV: make client code compatible with the current wiki document
https://issues.jboss.org/browse/RF-9797
Modified: branches/RF-9797/core/api/src/main/java/org/ajax4jsf/javascript/JSFunctionDefinition.java
===================================================================
--- branches/RF-9797/core/api/src/main/java/org/ajax4jsf/javascript/JSFunctionDefinition.java 2011-01-14 19:38:59 UTC (rev 21040)
+++ branches/RF-9797/core/api/src/main/java/org/ajax4jsf/javascript/JSFunctionDefinition.java 2011-01-15 00:56:14 UTC (rev 21041)
@@ -79,9 +79,14 @@
first = false;
}
- target.append("){").append(body).append("}");
+ target.append("){");appendBody(target);
+ target.append("}");
}
+ protected void appendBody(Appendable target) throws IOException {
+ target.append(body);
+ }
+
/**
* @return the name
*/
Modified: branches/RF-9797/ui/validator/api/src/main/java/org/richfaces/javascript/Message.java
===================================================================
--- branches/RF-9797/ui/validator/api/src/main/java/org/richfaces/javascript/Message.java 2011-01-14 19:38:59 UTC (rev 21040)
+++ branches/RF-9797/ui/validator/api/src/main/java/org/richfaces/javascript/Message.java 2011-01-15 00:56:14 UTC (rev 21041)
@@ -43,5 +43,51 @@
public String getSummary() {
return summary;
}
+ /* (non-Javadoc)
+ * @see java.lang.Object#hashCode()
+ */
+ @Override
+ public int hashCode() {
+ final int prime = 31;
+ int result = 1;
+ result = prime * result + ((this.detail == null) ? 0 : this.detail.hashCode());
+ result = prime * result + this.severity;
+ result = prime * result + ((this.summary == null) ? 0 : this.summary.hashCode());
+ return result;
+ }
+ /* (non-Javadoc)
+ * @see java.lang.Object#equals(java.lang.Object)
+ */
+ @Override
+ public boolean equals(Object obj) {
+ if (this == obj) {
+ return true;
+ }
+ if (obj == null) {
+ return false;
+ }
+ if (getClass() != obj.getClass()) {
+ return false;
+ }
+ Message other = (Message) obj;
+ if (this.detail == null) {
+ if (other.detail != null) {
+ return false;
+ }
+ } else if (!this.detail.equals(other.detail)) {
+ return false;
+ }
+ if (this.severity != other.severity) {
+ return false;
+ }
+ if (this.summary == null) {
+ if (other.summary != null) {
+ return false;
+ }
+ } else if (!this.summary.equals(other.summary)) {
+ return false;
+ }
+ return true;
+ }
}
Modified: branches/RF-9797/ui/validator/ui/src/main/java/org/richfaces/renderkit/html/AjaxOnlyScript.java
===================================================================
--- branches/RF-9797/ui/validator/ui/src/main/java/org/richfaces/renderkit/html/AjaxOnlyScript.java 2011-01-14 19:38:59 UTC (rev 21040)
+++ branches/RF-9797/ui/validator/ui/src/main/java/org/richfaces/renderkit/html/AjaxOnlyScript.java 2011-01-15 00:56:14 UTC (rev 21041)
@@ -1,32 +1,30 @@
package org.richfaces.renderkit.html;
+import java.io.IOException;
import java.util.Collections;
import org.richfaces.resource.ResourceKey;
public class AjaxOnlyScript extends ValidatorScriptBase {
+ public static final Iterable<ResourceKey> AJAX_LIBRARIES = Collections.singleton(ResourceKey.create("ajax.reslib",
+ "org.richfaces"));
- public static final Iterable<ResourceKey> AJAX_LIBRARIES=Collections.singleton(ResourceKey.create("ajax.reslib", "org.richfaces"));
-
private final String ajaxScript;
public AjaxOnlyScript(String ajaxScript) {
super();
this.ajaxScript = ajaxScript;
-
+
}
public Iterable<ResourceKey> getResources() {
return AJAX_LIBRARIES;
}
- @Override
- protected Object buildBody() {
- return ajaxScript;
- }
-
- /* (non-Javadoc)
+ /*
+ * (non-Javadoc)
+ *
* @see java.lang.Object#hashCode()
*/
@Override
@@ -37,7 +35,9 @@
return result;
}
- /* (non-Javadoc)
+ /*
+ * (non-Javadoc)
+ *
* @see java.lang.Object#equals(java.lang.Object)
*/
@Override
@@ -61,5 +61,12 @@
}
return true;
}
-
+
+ @Override
+ protected void appendBody(Appendable target) throws IOException {
+ target.append("if(!").append(DISABLE_AJAX).append("){(");
+ appendAjaxFunction(target, ajaxScript);
+ target.append(").call(").append(ELEMENT).append(",").append(EVENT).append(",").append(CLIENT_ID).append(");");
+ target.append(("}"));
+ }
}
Modified: branches/RF-9797/ui/validator/ui/src/main/java/org/richfaces/renderkit/html/ClientAndAjaxScript.java
===================================================================
--- branches/RF-9797/ui/validator/ui/src/main/java/org/richfaces/renderkit/html/ClientAndAjaxScript.java 2011-01-14 19:38:59 UTC (rev 21040)
+++ branches/RF-9797/ui/validator/ui/src/main/java/org/richfaces/renderkit/html/ClientAndAjaxScript.java 2011-01-15 00:56:14 UTC (rev 21041)
@@ -1,5 +1,6 @@
package org.richfaces.renderkit.html;
+import java.io.IOException;
import java.util.Collection;
import org.richfaces.resource.ResourceKey;
@@ -11,26 +12,27 @@
- final String ajaxScript;
+ private final String ajaxScript;
+ private final Iterable<ResourceKey> resources;
public ClientAndAjaxScript(LibraryScriptFunction clientSideConverterScript,
Collection<? extends LibraryScriptFunction> validatorScripts, String ajaxScript) {
super(clientSideConverterScript,validatorScripts);
this.ajaxScript = ajaxScript;
+ resources = Iterables.concat(AjaxOnlyScript.AJAX_LIBRARIES,super.getResources());
}
@Override
public Iterable<ResourceKey> getResources() {
- return Iterables.concat(AjaxOnlyScript.AJAX_LIBRARIES,super.getResources());
+ return resources;
}
- protected void finishValidation(StringBuilder body) {
- // AJAX callback
- body.append("if(!").append(DISABLE_AJAX).append("){\n");
- body.append(ajaxScript).append(EOL).append("}\n");
+
+ @Override
+ protected void appendAjaxParameter(Appendable target) throws IOException {
+ appendAjaxParameter(target, ajaxScript);
}
-
/* (non-Javadoc)
* @see java.lang.Object#hashCode()
*/
Modified: branches/RF-9797/ui/validator/ui/src/main/java/org/richfaces/renderkit/html/ClientOnlyScript.java
===================================================================
--- branches/RF-9797/ui/validator/ui/src/main/java/org/richfaces/renderkit/html/ClientOnlyScript.java 2011-01-14 19:38:59 UTC (rev 21040)
+++ branches/RF-9797/ui/validator/ui/src/main/java/org/richfaces/renderkit/html/ClientOnlyScript.java 2011-01-15 00:56:14 UTC (rev 21041)
@@ -1,29 +1,31 @@
package org.richfaces.renderkit.html;
-import java.util.Arrays;
+import java.io.IOException;
import java.util.Collection;
import java.util.LinkedHashSet;
import java.util.Map;
-import org.ajax4jsf.javascript.JSFunction;
-import org.ajax4jsf.javascript.JSReference;
+import org.ajax4jsf.javascript.ScriptUtils;
import org.richfaces.resource.ResourceKey;
+import com.google.common.collect.ImmutableList;
import com.google.common.collect.ImmutableSet;
import com.google.common.collect.Iterables;
import com.google.common.collect.Sets;
+import com.google.common.collect.UnmodifiableIterator;
public class ClientOnlyScript extends ValidatorScriptBase {
+ private static final ResourceKey CSV_RESOURCE = ResourceKey.create("csv.reslib", "org.richfaces");
protected final LibraryScriptFunction converter;
- protected final Collection<? extends LibraryScriptFunction> validators;
+ protected final ImmutableList<? extends LibraryScriptFunction> validators;
private final ImmutableSet<ResourceKey> resources;
public ClientOnlyScript(LibraryScriptFunction clientSideConverterScript,
Collection<? extends LibraryScriptFunction> validatorScripts) {
super();
this.converter = clientSideConverterScript;
- this.validators = validatorScripts;
+ this.validators = ImmutableList.copyOf(validatorScripts);
LinkedHashSet<ResourceKey> resources = Sets.newLinkedHashSet();
if (null != converter) {
Iterables.addAll(resources, converter.getResources());
@@ -31,6 +33,7 @@
for (LibraryScriptFunction scriptString : validators) {
Iterables.addAll(resources, scriptString.getResources());
}
+ resources.add(CSV_RESOURCE);
this.resources = ImmutableSet.copyOf(resources);
}
@@ -39,51 +42,47 @@
}
@Override
- protected Object buildBody() {
- StringBuilder body = new StringBuilder();
- // Get component value by clientId.
- /*
- * body.append("var ").append(ClientValidatorRenderer.VALUE_VAR).append("=");
- * GET_VALUE_FUNCTION.appendScriptToStringBuilder(body); body.append(EOL); // Try client-side validation
- * body.append("try {\n"); // convert value
- * body.append("var ").append(ClientValidatorRenderer.CONVERTED_VALUE_VAR).append("=");
- * converter.appendScriptToStringBuilder(body); body.append(EOL); // call validators for (ScriptWithDependencies
- * validatorScript : validators) { validatorScript.appendScriptToStringBuilder(body); body.append(EOL); }
- * finishValidation(body); body.append("return true;\n"); // Catch errors body.append("} catch(e) {\n");
- * SEND_ERROR_FUNCTION.appendScriptToStringBuilder(body);body.append(EOL); body.append("return false;\n}");
- */
- body.append("var c;");
- if (null!=converter) {
- body.append("c=");
- body.append(converter.getClientScript());
- body.append("EOL");
+ protected void appendParameters(Appendable target) throws IOException {
+ if (null != converter) {
+ target.append(CONVERTER).append(":");
+ appendConverter(target, converter);
+ target.append(",");
}
- body.append("var v=[");
-
- int i = validators.size();
- for (LibraryScriptFunction validatorScript : validators) {
- body.append(validatorScript.getClientScript());
- if (--i>0) {
- body.append(",");
- }
+ target.append(VALIDATORS).append(":[");
+
+ UnmodifiableIterator<? extends LibraryScriptFunction> iterator = validators.iterator();
+ while (iterator.hasNext()) {
+ LibraryScriptFunction validatorScript = (LibraryScriptFunction) iterator.next();
+ appendValidator(target, validatorScript);
+ if (iterator.hasNext()) {
+ target.append(",");
+ }
}
- body.append("];");
-
- JSFunction callValidator =
- new JSFunction("RichFaces.csv.validate", new JSReference("event"), new JSReference("id"), new JSReference(
- "element"), new JSReference("c"), new JSReference("v"));
- body.append(callValidator);
- body.append(EOL);
- return body;
+ target.append("]");
+ appendAjaxParameter(target);
}
- protected void finishValidation(StringBuilder body) {
- // clear messages after successful validation
- body.append("if(!").append(DISABLE_AJAX).append("){\n");
- CLEAR_ERROR_FUNCTION.appendScriptToStringBuilder(body);
- body.append(EOL).append("}\n");
+ protected void appendValidator(Appendable target, LibraryScriptFunction validatorScript) throws IOException {
+ appendConverter(target, validatorScript);
}
+ protected void appendConverter(Appendable target, LibraryScriptFunction converter) throws IOException {
+ target.append('{').append("f").append(':').append(converter.getName()).append(',');
+ target.append(PARAMS).append(':').append('{');
+ target.append(MESSAGE).append(':');ScriptUtils.appendScript(target, converter.getMessage());
+ for(Map.Entry<String, ? extends Object> entry: converter.getParameters().entrySet()){
+ target.append(',');
+ target.append(entry.getKey()).append(':');
+ ScriptUtils.appendScript(target, entry.getValue());
+ }
+ target.append('}');
+ target.append('}');
+ }
+
+ protected void appendAjaxParameter(Appendable target) throws IOException {
+ // This is client-only validation script.
+ }
+
/*
* (non-Javadoc)
*
Modified: branches/RF-9797/ui/validator/ui/src/main/java/org/richfaces/renderkit/html/ClientValidatorRenderer.java
===================================================================
--- branches/RF-9797/ui/validator/ui/src/main/java/org/richfaces/renderkit/html/ClientValidatorRenderer.java 2011-01-14 19:38:59 UTC (rev 21040)
+++ branches/RF-9797/ui/validator/ui/src/main/java/org/richfaces/renderkit/html/ClientValidatorRenderer.java 2011-01-15 00:56:14 UTC (rev 21041)
@@ -193,11 +193,11 @@
private String createAjaxScript(ClientBehaviorContext behaviorContext, ClientValidatorBehavior behavior) {
String ajaxScript = behavior.getAjaxScript(behaviorContext);
- ajaxScript = ajaxScript.replace("this", ValidatorScriptBase.ELEMENT);
String clientId = getComponentClientId(behaviorContext);
ajaxScript = replaceTextToVariable(ajaxScript, clientId, ValidatorScriptBase.CLIENT_ID);
String sourceId = behaviorContext.getSourceId();
if (null != sourceId) {
+ // TODO - send sourceId as separate parameter.
ajaxScript = replaceTextToVariable(ajaxScript, sourceId, ValidatorScriptBase.ELEMENT);
}
return ajaxScript;
Modified: branches/RF-9797/ui/validator/ui/src/main/java/org/richfaces/renderkit/html/LibraryScriptFunction.java
===================================================================
--- branches/RF-9797/ui/validator/ui/src/main/java/org/richfaces/renderkit/html/LibraryScriptFunction.java 2011-01-14 19:38:59 UTC (rev 21040)
+++ branches/RF-9797/ui/validator/ui/src/main/java/org/richfaces/renderkit/html/LibraryScriptFunction.java 2011-01-15 00:56:14 UTC (rev 21041)
@@ -23,18 +23,14 @@
package org.richfaces.renderkit.html;
-import java.util.HashMap;
import java.util.Map;
-import org.ajax4jsf.javascript.JSReference;
-import org.ajax4jsf.javascript.ScriptUtils;
import org.richfaces.javascript.LibraryFunction;
import org.richfaces.javascript.Message;
import org.richfaces.resource.ResourceKey;
import org.richfaces.resource.ResourceLibrary;
import com.google.common.collect.ImmutableSet;
-import com.google.common.collect.Maps;
/**
* <p class="changed_added_4_0">
@@ -49,9 +45,9 @@
private final ImmutableSet<ResourceKey> resources;
private final String name;
private final Message message;
- private final Object parameters;
+ private final Map<String, ? extends Object> parameters;
- public LibraryScriptFunction(LibraryFunction libraryScript, Message message, Object parameters) {
+ public LibraryScriptFunction(LibraryFunction libraryScript, Message message, Map<String, ? extends Object> parameters) {
this.message = message;
this.parameters = parameters;
this.resources = ImmutableSet.copyOf(libraryScript.getResources());
@@ -87,19 +83,10 @@
*
* @return the parameters
*/
- public Object getParameters() {
+ public Map<String, ? extends Object> getParameters() {
return this.parameters;
}
- public String getClientScript() {
- Map <String, Object> hash = Maps.newHashMap();
- hash.put("f", new JSReference(name));
- HashMap <String, Object> params = new HashMap<String, Object>((Map <String, Object>) parameters);
- params.put("customMessage", message.getSummary());
- hash.put("params", params);
- return ScriptUtils.toScript(hash);
- }
-
/*
* (non-Javadoc)
*
Modified: branches/RF-9797/ui/validator/ui/src/main/java/org/richfaces/renderkit/html/ValidatorScriptBase.java
===================================================================
--- branches/RF-9797/ui/validator/ui/src/main/java/org/richfaces/renderkit/html/ValidatorScriptBase.java 2011-01-14 19:38:59 UTC (rev 21040)
+++ branches/RF-9797/ui/validator/ui/src/main/java/org/richfaces/renderkit/html/ValidatorScriptBase.java 2011-01-15 00:56:14 UTC (rev 21041)
@@ -6,46 +6,80 @@
import org.ajax4jsf.javascript.JSFunctionDefinition;
import org.ajax4jsf.javascript.JSReference;
-public abstract class ValidatorScriptBase extends JSFunctionDefinition implements ComponentValidatorScript {
+public abstract class ValidatorScriptBase extends JSFunctionDefinition implements ComponentValidatorScript {
- public static final String ELEMENT = "element";
- public static final JSReference ELEMENT_LITERAL = new JSReference(ELEMENT);
+ public static final String ELEMENT = "e";
+ public static final JSReference ELEMENT_REF = new JSReference(ELEMENT);
public static final String EVENT = "event";
- public static final JSReference EVENT_LITERAL = new JSReference(EVENT);
- public static final String DISABLE_AJAX = "disableAjax";
+ public static final JSReference EVENT_REF = new JSReference(EVENT);
+ public static final String DISABLE_AJAX = "da";
+ public static final JSReference DISABLE_AJAX_REF = new JSReference(DISABLE_AJAX);
public static final String EOL = ";\n";
public static final String CLIENT_ID = "id";
- public static final JSReference CLIENT_ID_LITERAL = new JSReference(CLIENT_ID);
- public static final String SOURCE_ID = "sourceId";
- public static final JSReference SOURCE_ID_LITERAL = new JSReference(SOURCE_ID);
+ public static final JSReference CLIENT_ID_REF = new JSReference(CLIENT_ID);
+ public static final String SOURCE_ID = "sid";
+ public static final JSReference SOURCE_ID_REF = new JSReference(SOURCE_ID);
+ public static final String CONVERTER = "c";
+ public static final JSReference CONVERTER_REF = new JSReference(CONVERTER);
+ public static final String VALIDATORS = "v";
+ public static final JSReference VALIDATORS_REF = new JSReference(VALIDATORS);
+ public static final String AJAX = "a";
+ public static final JSReference AJAX_REF = new JSReference(AJAX);
+ public static final String PARAMS = "p";
+ public static final JSReference PARAMS_REF = new JSReference(PARAMS);
+ public static final String MESSAGE = "m";
+ public static final JSReference MESSAGE_REF = new JSReference(MESSAGE);
+
public static final NullConverterScript NULL_CONVERTER_SCRIPT = new NullConverterScript();
public static final String CSV_NAMESPACE = "RichFaces.csv.";
- public static final String VALUE_FUNCTION_NAME = CSV_NAMESPACE+"getValue";
- public static final JSFunction GET_VALUE_FUNCTION = new JSFunction(VALUE_FUNCTION_NAME,CLIENT_ID_LITERAL,ELEMENT_LITERAL);
- public static final JSFunction SEND_ERROR_FUNCTION = new JSFunction(CSV_NAMESPACE+"sendMessage",CLIENT_ID_LITERAL,new JSReference("e"));
- public static final JSFunction CLEAR_ERROR_FUNCTION = new JSFunction(CSV_NAMESPACE+"clearMessage",CLIENT_ID_LITERAL);
-
- private boolean bodyProcessed = false;
+ public static final String VALUE_FUNCTION_NAME = CSV_NAMESPACE + "getValue";
+ public static final JSFunction GET_VALUE_FUNCTION = new JSFunction(VALUE_FUNCTION_NAME, CLIENT_ID_REF, ELEMENT_REF);
+ public static final String VALIDATE_FUNCTION_NAME = CSV_NAMESPACE + "validate";
+ public static final JSFunction VALIDATE_FUNCTION = new JSFunction(VALIDATE_FUNCTION_NAME, CLIENT_ID_REF,
+ ELEMENT_REF);
public ValidatorScriptBase() {
- super(CLIENT_ID,ELEMENT,EVENT);
+ super(EVENT, CLIENT_ID, ELEMENT, DISABLE_AJAX);
}
- public void appendScript(Appendable target) throws IOException {
- if(!bodyProcessed){
- // pending RF-9565
- addToBody(buildBody());
- bodyProcessed = true;
- }
- super.appendScript(target);
+ public String createCallScript(String clientId, String sourceId) {
+ JSFunction callFunction =
+ new JSFunction(getName(), EVENT_REF, clientId, null != sourceId ? sourceId : JSReference.THIS);
+ return callFunction.toScript();
}
- protected abstract Object buildBody();
+ protected void appendParameters(Appendable target) throws IOException {
+ }
- public String createCallScript(String clientId,String sourceId) {
- JSFunction callFunction = new JSFunction(getName(),clientId,null!=sourceId?sourceId:JSReference.THIS,EVENT_LITERAL);
- return callFunction.toScript();
+ @Override
+ protected void appendBody(Appendable target) throws IOException {
+ appendParametersDefinition(target);
+ appendValidatorCall(target);
}
+ private void appendParametersDefinition(Appendable target) throws IOException {
+ target.append("var ").append(PARAMS).append("={");
+ target.append(DISABLE_AJAX).append(':').append(DISABLE_AJAX).append(',');
+ appendParameters(target);
+ target.append("}").append(EOL);
+ }
+ protected void appendValidatorCall(Appendable target) throws IOException {
+ JSFunction callValidator =
+ new JSFunction(VALIDATE_FUNCTION_NAME, EVENT_REF, CLIENT_ID_REF, ELEMENT_REF, PARAMS_REF);
+ callValidator.appendScript(target);
+ target.append(EOL);
+ }
+
+ protected void appendAjaxParameter(Appendable target, String ajaxScript) throws IOException {
+ target.append(AJAX).append(':');
+ appendAjaxFunction(target, ajaxScript);
+ }
+
+ protected void appendAjaxFunction(Appendable target, String ajaxScript) throws IOException {
+ JSFunctionDefinition ajaxFunction = new JSFunctionDefinition(EVENT, CLIENT_ID);
+ ajaxFunction.addToBody(ajaxScript);
+ ajaxFunction.appendScript(target);
+ }
+
}
\ No newline at end of file
Modified: branches/RF-9797/ui/validator/ui/src/main/resources/META-INF/resources/org.richfaces/richfaces-csv.js
===================================================================
--- branches/RF-9797/ui/validator/ui/src/main/resources/META-INF/resources/org.richfaces/richfaces-csv.js 2011-01-14 19:38:59 UTC (rev 21040)
+++ branches/RF-9797/ui/validator/ui/src/main/resources/META-INF/resources/org.richfaces/richfaces-csv.js 2011-01-15 00:56:14 UTC (rev 21041)
@@ -22,6 +22,16 @@
return message;
}
+ var _interpolateFacesMessage = function(msg,id,value){
+ var d = msg.detail?_substitute(msg.detail,id,value):"";
+ var s = msg.summary?_substitute(msg.summary,id,value):"";
+ return {detail:d,summary:s};
+ }
+
+ var _substitute = function(msg,id,value){
+ return msg.replace("{id}",id).replace("{value}",value);
+ }
+
var __getValue = function(id) {
var value;
var element = rf.getDomElement(id);
@@ -49,32 +59,41 @@
sendMessage: function (componentId, message) {
rf.Event.fire(window.document, rf.Event.MESSAGE_EVENT_TYPE, {'sourceId':componentId, 'message':message});
},
- validate: function (event, id, element, converter, validators, params) {
+ validate: function (event, id, element, params) {
var value = __getValue(element || id);
+ var convertedValue;
+ var converter = params.c;
if (converter) {
try {
- converter.options.componentId = id;
if (converter.f)
- value = converter.f(value, converter.params);
+ convertedValue = converter.f(value, converter.p);
} catch (e){
- rf.csv.sendMessage(id, e);
+ rf.csv.sendMessage(id, _interpolateFacesMessage(e,id,value));
return false;
}
+ } else {
+ convertedValue = value;
}
+ var validators = params.v;
if (validators) {
var validatorFunction;
try {
for (i=0;i<validators.length;i++) {
validatorFunction = validators[i].f;
if (validatorFunction) {
- validatorFunction(id, value, validators[i].params);
+ validatorFunction(convertedValue, validators[i].p);
}
}
} catch (e) {
- rf.csv.sendMessage(id, e);
+ rf.csv.sendMessage(id, _interpolateFacesMessage(e,id,value));
return false;
}
}
+ if(!params.da && params.a){
+ params.a.call(element,event,id);
+ } else {
+ rf.csv.sendMessage(id, "");
+ }
return true;
},
/*
@@ -113,14 +132,14 @@
"convertByte": function (value, params) {
var result; value = $.trim(value);
if (!rf.csv.RE_DIGITS.test(value) || (result=parseInt(value,10))<-128 || result>127) {
- throw rf.csv.getMessage(params.customMessage, 'BYTE_CONVERTER_BYTE', [value, 0, params.componentId]);
+ throw rf.csv.getMessage(params.m, 'BYTE_CONVERTER_BYTE', [value, 0, params.componentId]);
}
return result;
},
"convertNumber": function (value, params) {
var result; value=$.trim(value);
if (isNaN(value)) {
- throw rf.csv.getMessage(params.customMessage, 'NUMBER_CONVERTER_NUMBER', [value, 0, params.componentId]);
+ throw rf.csv.getMessage(params.m, 'NUMBER_CONVERTER_NUMBER', [value, 0, params.componentId]);
} else {
result = parseInt(value, 10);
}
@@ -129,7 +148,7 @@
"convertShort": function (value, params) {
var result; value = $.trim(value);
if (!rf.csv.RE_DIGITS.test(value) || (result=parseInt(value,10))<-32768 || result>32767) {
- throw rf.csv.getMessage(params.customMessage, 'SHORT_CONVERTER_SHORT', [value, 0, params.componentId]);
+ throw rf.csv.getMessage(params.m, 'SHORT_CONVERTER_SHORT', [value, 0, params.componentId]);
}
return result;
}
@@ -139,15 +158,15 @@
* Validators implementation
*/
$.extend(rf.csv, {
- "validateLongRange": function (componentId, value, params) {
+ "validateLongRange": function (value, params) {
var type = typeof value;
if (type != "number") {
if (type != "string") {
- throw rf.csv.getMessage(params.customMessage, 'LONG_RANGE_VALIDATOR_TYPE', [componentId, ""]);
+ throw rf.csv.getMessage(params.m, 'LONG_RANGE_VALIDATOR_TYPE', [componentId, ""]);
} else {
value = $.trim(value);
if (!rf.csv.RE_DIGITS.test(value) || (value = parseInt(value, 10))==NaN) {
- throw rf.csv.getMessage(params.customMessage, 'LONG_RANGE_VALIDATOR_TYPE', [componentId, ""]);
+ throw rf.csv.getMessage(params.m, 'LONG_RANGE_VALIDATOR_TYPE', [componentId, ""]);
}
}
}
@@ -157,28 +176,28 @@
if (isMaxSet && value > params.maximum) {
if (isMinSet) {
- throw rf.csv.getMessage(params.customMessage, 'LONG_RANGE_VALIDATOR_NOT_IN_RANGE', [params.minimum, params.maximum, componentId]);
+ throw rf.csv.getMessage(params.m, 'LONG_RANGE_VALIDATOR_NOT_IN_RANGE', [params.minimum, params.maximum, componentId]);
} else {
- throw rf.csv.getMessage(params.customMessage, 'LONG_RANGE_VALIDATOR_MAXIMUM', [params.maximum, componentId]);
+ throw rf.csv.getMessage(params.m, 'LONG_RANGE_VALIDATOR_MAXIMUM', [params.maximum, componentId]);
}
}
if (isMinSet && value < params.minimum) {
if (isMaxSet) {
- throw rf.csv.getMessage(params.customMessage, 'LONG_RANGE_VALIDATOR_NOT_IN_RANGE', [params.minimum, params.maximum, componentId]);
+ throw rf.csv.getMessage(params.m, 'LONG_RANGE_VALIDATOR_NOT_IN_RANGE', [params.minimum, params.maximum, componentId]);
} else {
- throw rf.csv.getMessage(params.customMessage, 'LONG_RANGE_VALIDATOR_MINIMUM', [params.minimum, componentId]);
+ throw rf.csv.getMessage(params.m, 'LONG_RANGE_VALIDATOR_MINIMUM', [params.minimum, componentId]);
}
}
},
- "validateDoubleRange": function (componentId, value, params) {
+ "validateDoubleRange": function (value, params) {
var type = typeof value;
if (type != "number") {
if (type != "string") {
- throw rf.csv.getMessage(params.customMessage, 'DOUBLE_RANGE_VALIDATOR_TYPE', [componentId, ""]);
+ throw rf.csv.getMessage(params.m, 'DOUBLE_RANGE_VALIDATOR_TYPE', [componentId, ""]);
} else {
value = $.trim(value);
if (!rf.csv.RE_FLOAT.test(value) || (value = parseFloat(value))==NaN) {
- throw rf.csv.getMessage(params.customMessage, 'DOUBLE_RANGE_VALIDATOR_TYPE', [componentId, ""]);
+ throw rf.csv.getMessage(params.m, 'DOUBLE_RANGE_VALIDATOR_TYPE', [componentId, ""]);
}
}
}
@@ -188,45 +207,45 @@
if (isMaxSet && value > params.maximum) {
if (isMinSet) {
- throw rf.csv.getMessage(params.customMessage, 'DOUBLE_RANGE_VALIDATOR_NOT_IN_RANGE', [params.minimum, params.maximum, componentId]);
+ throw rf.csv.getMessage(params.m, 'DOUBLE_RANGE_VALIDATOR_NOT_IN_RANGE', [params.minimum, params.maximum, componentId]);
} else {
- throw rf.csv.getMessage(params.customMessage, 'DOUBLE_RANGE_VALIDATOR_MAXIMUM', [params.maximum, componentId]);
+ throw rf.csv.getMessage(params.m, 'DOUBLE_RANGE_VALIDATOR_MAXIMUM', [params.maximum, componentId]);
}
}
if (isMinSet && value < params.minimum) {
if (isMaxSet) {
- throw rf.csv.getMessage(params.customMessage, 'DOUBLE_RANGE_VALIDATOR_NOT_IN_RANGE', [params.minimum, params.maximum, componentId]);
+ throw rf.csv.getMessage(params.m, 'DOUBLE_RANGE_VALIDATOR_NOT_IN_RANGE', [params.minimum, params.maximum, componentId]);
} else {
- throw rf.csv.getMessage(params.customMessage, 'DOUBLE_RANGE_VALIDATOR_MINIMUM', [params.minimum, componentId]);
+ throw rf.csv.getMessage(params.m, 'DOUBLE_RANGE_VALIDATOR_MINIMUM', [params.minimum, componentId]);
}
}
},
- "validateLength": function (componentId, value, params) {
+ "validateLength": function (value, params) {
if (params.maximum && value.length > params.maximum) {
- throw rf.csv.getMessage(params.customMessage, 'LENGTH_VALIDATOR_MAXIMUM', [params.maximum, componentId]);
+ throw params.m;
}
if (params.minimum && value.length < params.minimum) {
- throw rf.csv.getMessage(params.customMessage, 'LENGTH_VALIDATOR_MINIMUM', [params.minimum, componentId]);
+ throw params.m
}
},
- "validateRegex": function (componentId, value, params) {
+ "validateRegex": function (value, params) {
if (typeof params.pattern != "string" || params.pattern.length == 0) {
- throw rf.csv.getMessage(params.customMessage, 'REGEX_VALIDATOR_PATTERN_NOT_SET', []);
+ throw rf.csv.getMessage(params.m, 'REGEX_VALIDATOR_PATTERN_NOT_SET', []);
}
var re;
try {
re = new RegExp(params.pattern);
} catch (e) {
- throw rf.csv.getMessage(params.customMessage, 'REGEX_VALIDATOR_MATCH_EXCEPTION', []);
+ throw rf.csv.getMessage(params.m, 'REGEX_VALIDATOR_MATCH_EXCEPTION', []);
}
if (!re.test(value)){
- throw rf.csv.getMessage(params.customMessage, 'REGEX_VALIDATOR_NOT_MATCHED', [params.pattern]);
+ throw rf.csv.getMessage(params.m, 'REGEX_VALIDATOR_NOT_MATCHED', [params.pattern]);
}
},
- "validateRequired": function (componentId, value, params) {
+ "validateRequired": function (value, params) {
if (value.length==0) {
- throw rf.csv.getMessage(params.customMessage, 'UIINPUT_REQUIRED', [componentId]);
+ throw rf.csv.getMessage(params.m, 'UIINPUT_REQUIRED', [componentId]);
}
}
});
13 years, 11 months
JBoss Rich Faces SVN: r21040 - in trunk: ui/core/ui/src/main/java/org/richfaces/renderkit/html and 1 other directories.
by richfaces-svn-commits@lists.jboss.org
Author: konstantin.mishin
Date: 2011-01-14 14:38:59 -0500 (Fri, 14 Jan 2011)
New Revision: 21040
Added:
trunk/ui/core/ui/src/main/resources/META-INF/resources/org.richfaces/status.js
Modified:
trunk/core/impl/src/main/resources/META-INF/resources/richfaces.js
trunk/ui/core/ui/src/main/java/org/richfaces/renderkit/html/AjaxStatusRenderer.java
Log:
RF-7821
Modified: trunk/core/impl/src/main/resources/META-INF/resources/richfaces.js
===================================================================
--- trunk/core/impl/src/main/resources/META-INF/resources/richfaces.js 2011-01-14 19:09:58 UTC (rev 21039)
+++ trunk/core/impl/src/main/resources/META-INF/resources/richfaces.js 2011-01-14 19:38:59 UTC (rev 21040)
@@ -398,7 +398,7 @@
};
};
- var setGlobalStatusNameVariable = function(statusName) {
+ richfaces.setGlobalStatusNameVariable = function(statusName) {
//TODO: parallel requests
if (statusName) {
richfaces['statusName'] = statusName;
@@ -413,10 +413,6 @@
}
};
- var getGlobalStatusNameVariable = function() {
- return richfaces.statusName;
- }
-
var chain = function() {
var functions = arguments;
if (functions.length == 1) {
@@ -518,7 +514,7 @@
}
if (options.status) {
- var namedStatusEventHandler = function() { setGlobalStatusNameVariable(options.status); };
+ var namedStatusEventHandler = function() { richfaces.setGlobalStatusNameVariable(options.status); };
//TODO add support for options.submit
eventHandlers = eventHandlers || {};
@@ -546,159 +542,7 @@
jsf.ajax.request(source, event, parameters);
};
- var RICHFACES_AJAX_STATUS = "richfaces:ajaxStatus";
- var getStatusDataAttributeName = function(statusName) {
- return statusName ? (RICHFACES_AJAX_STATUS + "@" + statusName) : RICHFACES_AJAX_STATUS;
- };
-
- var statusAjaxEventHandler = function(data, methodName) {
- if (methodName) {
- //global status name
- var statusName = getGlobalStatusNameVariable();
- var source = data.source;
-
- var statusApplied = false;
- var statusDataAttribute = getStatusDataAttributeName(statusName);
-
- var statusContainers;
- if (statusName) {
- statusContainers = [jQuery(document)];
- } else {
- statusContainers = [jQuery(source).parents('form'), jQuery(document)];
- }
-
- for (var containerIdx = 0; containerIdx < statusContainers.length && !statusApplied;
- containerIdx++) {
-
- var statusContainer = statusContainers[containerIdx];
- var statuses = statusContainer.data(statusDataAttribute);
- if (statuses) {
- for (var statusId in statuses) {
- var status = statuses[statusId];
- var result = status[methodName].apply(status, arguments);
- if (result) {
- statusApplied = true;
- } else {
- delete statuses[statusId];
- }
- }
-
- if (!statusApplied) {
- statusContainer.removeData(statusDataAttribute);
- }
- }
- }
- }
- };
-
- var initializeStatuses = function() {
- var thisFunction = arguments.callee;
- if (!thisFunction.initialized) {
- thisFunction.initialized = true;
-
- var jsfEventsListener = richfaces.createJSFEventsAdapter({
- begin: function(event) { statusAjaxEventHandler(event, 'start'); },
- error: function(event) { statusAjaxEventHandler(event, 'error'); },
- success: function(event) { statusAjaxEventHandler(event, 'success'); },
- complete: function() { setGlobalStatusNameVariable(null); }
- });
-
- jsf.ajax.addOnEvent(jsfEventsListener);
- //TODO blocks default alert error handler
- jsf.ajax.addOnError(jsfEventsListener);
- }
- };
-
- richfaces.status = function(statusId, options) {
- this.statusId = statusId;
- this.options = options || {};
- this.register();
- };
-
- jQuery.extend(richfaces.status.prototype, (function() {
- //TODO - support for parallel requests
-
- var getElement = function() {
- var elt = document.getElementById(this.statusId);
- return elt ? jQuery(elt) : null;
- };
-
- var showHide = function(selector) {
- var element = getElement.call(this);
- if (element) {
- var statusElts = element.children();
- statusElts.each(function() {
- var t = jQuery(this);
- t.css('display', t.is(selector) ? '': 'none');
- });
-
- return true;
- }
-
- return false;
- };
-
- return {
- register: function() {
- initializeStatuses();
-
- var statusName = this.options.statusName;
- var dataStatusAttribute = getStatusDataAttributeName(statusName);
-
- var container;
- if (statusName) {
- container = jQuery(document);
- } else {
- container = getElement.call(this).parents('form');
- if (container.length == 0) {
- container = jQuery(document);
- };
- }
-
- var statuses = container.data(dataStatusAttribute);
- if (!statuses) {
- statuses = {};
- container.data(dataStatusAttribute, statuses);
- }
-
- statuses[this.statusId] = this;
- },
-
- start: function() {
- if (this.options.onstart) {
- this.options.onstart.apply(this, arguments);
- }
-
- return showHide.call(this, '.rich-status-start');
- },
-
- stop: function() {
- if (this.options.onstop) {
- this.options.onstop.apply(this, arguments);
- }
- },
-
- success: function() {
- if (this.options.onsuccess) {
- this.options.onsuccess.apply(this, arguments);
- }
- this.stop();
-
- return showHide.call(this, '.rich-status-stop');
- },
-
- error: function() {
- if (this.options.onerror) {
- this.options.onerror.apply(this, arguments);
- }
- this.stop();
-
- return showHide.call(this, ':not(.rich-status-error) + .rich-status-stop, .rich-status-error');
- }
- };
- }()));
-
//keys codes
richfaces.KEYS = {
BACKSPACE: 8,
Modified: trunk/ui/core/ui/src/main/java/org/richfaces/renderkit/html/AjaxStatusRenderer.java
===================================================================
--- trunk/ui/core/ui/src/main/java/org/richfaces/renderkit/html/AjaxStatusRenderer.java 2011-01-14 19:09:58 UTC (rev 21039)
+++ trunk/ui/core/ui/src/main/java/org/richfaces/renderkit/html/AjaxStatusRenderer.java 2011-01-14 19:38:59 UTC (rev 21040)
@@ -28,6 +28,7 @@
import java.util.HashMap;
import java.util.Map;
+import javax.faces.application.ResourceDependencies;
import javax.faces.application.ResourceDependency;
import javax.faces.component.UIComponent;
import javax.faces.context.FacesContext;
@@ -45,7 +46,9 @@
/**
* @author Nick Belaevski
*/
-@ResourceDependency(library = "org.richfaces", name = "ajax.reslib")
+@ResourceDependencies({@ResourceDependency(library = "org.richfaces", name = "ajax.reslib"),
+ @ResourceDependency(library = "org.richfaces", name = "base-component.reslib"),
+ @ResourceDependency(library = "org.richfaces", name = "status.js")})
@JsfRenderer(type = "org.richfaces.StatusRenderer", family = AbstractAjaxStatus.COMPONENT_FAMILY)
public class AjaxStatusRenderer extends RendererBase {
@@ -189,7 +192,7 @@
writer.startElement(HtmlConstants.SCRIPT_ELEM, component);
writer.writeAttribute(HtmlConstants.TYPE_ATTR, HtmlConstants.TEXT_JAVASCRIPT_TYPE, null);
- JSFunction statusConstructor = new JSFunction("new RichFaces.status",
+ JSFunction statusConstructor = new JSFunction("new RichFaces.ui.Status",
clientId);
Map<String, Object> options = new HashMap<String, Object>();
Added: trunk/ui/core/ui/src/main/resources/META-INF/resources/org.richfaces/status.js
===================================================================
--- trunk/ui/core/ui/src/main/resources/META-INF/resources/org.richfaces/status.js (rev 0)
+++ trunk/ui/core/ui/src/main/resources/META-INF/resources/org.richfaces/status.js 2011-01-14 19:38:59 UTC (rev 21040)
@@ -0,0 +1,177 @@
+/*
+ * 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.
+ */
+(function(richfaces, jQuery) {
+
+ var getGlobalStatusNameVariable = function() {
+ return richfaces.statusName;
+ }
+
+ var RICHFACES_AJAX_STATUS = "richfaces:ajaxStatus";
+
+ var getStatusDataAttributeName = function(statusName) {
+ return statusName ? (RICHFACES_AJAX_STATUS + "@" + statusName) : RICHFACES_AJAX_STATUS;
+ };
+
+ var statusAjaxEventHandler = function(data, methodName) {
+ if (methodName) {
+ //global status name
+ var statusName = getGlobalStatusNameVariable();
+ var source = data.source;
+
+ var statusApplied = false;
+ var statusDataAttribute = getStatusDataAttributeName(statusName);
+
+ var statusContainers;
+ if (statusName) {
+ statusContainers = [jQuery(document)];
+ } else {
+ statusContainers = [jQuery(source).parents('form'), jQuery(document)];
+ }
+
+ for (var containerIdx = 0; containerIdx < statusContainers.length && !statusApplied;
+ containerIdx++) {
+
+ var statusContainer = statusContainers[containerIdx];
+ var statuses = statusContainer.data(statusDataAttribute);
+ if (statuses) {
+ for (var statusId in statuses) {
+ var status = statuses[statusId];
+ var result = status[methodName].apply(status, arguments);
+ if (result) {
+ statusApplied = true;
+ } else {
+ delete statuses[statusId];
+ }
+ }
+
+ if (!statusApplied) {
+ statusContainer.removeData(statusDataAttribute);
+ }
+ }
+ }
+ }
+ };
+
+ var initializeStatuses = function() {
+ var thisFunction = arguments.callee;
+ if (!thisFunction.initialized) {
+ thisFunction.initialized = true;
+
+ var jsfEventsListener = richfaces.createJSFEventsAdapter({
+ begin: function(event) { statusAjaxEventHandler(event, 'start'); },
+ error: function(event) { statusAjaxEventHandler(event, 'error'); },
+ success: function(event) { statusAjaxEventHandler(event, 'success'); },
+ complete: function() { richfaces.setGlobalStatusNameVariable(null); }
+ });
+
+ jsf.ajax.addOnEvent(jsfEventsListener);
+ //TODO blocks default alert error handler
+ jsf.ajax.addOnError(jsfEventsListener);
+ }
+ };
+
+ richfaces.ui = richfaces.ui || {};
+
+ richfaces.ui.Status = richfaces.BaseComponent.extendClass({
+
+ name: "Status",
+
+ //TODO - support for parallel requests
+ init: function(id, options) {
+ this.id = id;
+ this.attachToDom();
+ this.options = options || {};
+ this.register();
+ },
+
+ register: function() {
+ initializeStatuses();
+
+ var statusName = this.options.statusName;
+ var dataStatusAttribute = getStatusDataAttributeName(statusName);
+
+ var container;
+ if (statusName) {
+ container = jQuery(document);
+ } else {
+ container = jQuery(richfaces.getDomElement(this.id)).parents('form');
+ if (container.length == 0) {
+ container = jQuery(document);
+ };
+ }
+
+ var statuses = container.data(dataStatusAttribute);
+ if (!statuses) {
+ statuses = {};
+ container.data(dataStatusAttribute, statuses);
+ }
+
+ statuses[this.id] = this;
+ },
+
+ start: function() {
+ if (this.options.onstart) {
+ this.options.onstart.apply(this, arguments);
+ }
+
+ return this.__showHide('.rich-status-start');
+ },
+
+ stop: function() {
+ if (this.options.onstop) {
+ this.options.onstop.apply(this, arguments);
+ }
+ },
+
+ success: function() {
+ if (this.options.onsuccess) {
+ this.options.onsuccess.apply(this, arguments);
+ }
+ this.stop();
+
+ return this.__showHide('.rich-status-stop');
+ },
+
+ error: function() {
+ if (this.options.onerror) {
+ this.options.onerror.apply(this, arguments);
+ }
+ this.stop();
+
+ return this.__showHide(':not(.rich-status-error) + .rich-status-stop, .rich-status-error');
+ },
+
+ __showHide: function(selector) {
+ var element = jQuery(richfaces.getDomElement(this.id));
+ if (element) {
+ var statusElts = element.children();
+ statusElts.each(function() {
+ var t = jQuery(this);
+ t.css('display', t.is(selector) ? '': 'none');
+ });
+
+ return true;
+ }
+ return false;
+ }
+ });
+}(window.RichFaces, jQuery));
13 years, 11 months
JBoss Rich Faces SVN: r21039 - trunk/ui/core/ui/src/main/java/org/ajax4jsf/component/behavior.
by richfaces-svn-commits@lists.jboss.org
Author: abelevich
Date: 2011-01-14 14:09:58 -0500 (Fri, 14 Jan 2011)
New Revision: 21039
Modified:
trunk/ui/core/ui/src/main/java/org/ajax4jsf/component/behavior/AjaxBehavior.java
Log:
RF-10175 Ajax: incorrect parsing of execute/render attribute
Modified: trunk/ui/core/ui/src/main/java/org/ajax4jsf/component/behavior/AjaxBehavior.java
===================================================================
--- trunk/ui/core/ui/src/main/java/org/ajax4jsf/component/behavior/AjaxBehavior.java 2011-01-14 17:52:23 UTC (rev 21038)
+++ trunk/ui/core/ui/src/main/java/org/ajax4jsf/component/behavior/AjaxBehavior.java 2011-01-14 19:09:58 UTC (rev 21039)
@@ -127,16 +127,10 @@
private Set<String> toSet(Serializable propertyName, Object value) {
Set<String> result = null;
+
+ result = CoreAjaxRendererUtils.asIdsSet(value);
- if (value instanceof String) {
- result = toSingletonSet(propertyName.toString(), (String) value);
- }
-
if (result == null) {
- result = CoreAjaxRendererUtils.asIdsSet(value);
- }
-
- if (result == null) {
throw new FacesException(
propertyName.toString()
+ "' attribute value must be Collection, List, array, String, comma-separated String, whitespace-separate String'");
13 years, 11 months
JBoss Rich Faces SVN: r21038 - 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: 2011-01-14 12:52:23 -0500 (Fri, 14 Jan 2011)
New Revision: 21038
Modified:
trunk/ui/input/ui/src/main/java/org/richfaces/component/AbstractAutocomplete.java
trunk/ui/input/ui/src/main/java/org/richfaces/component/AbstractCalendar.java
trunk/ui/input/ui/src/main/java/org/richfaces/renderkit/AutocompleteRendererBase.java
trunk/ui/input/ui/src/main/java/org/richfaces/renderkit/CalendarRendererBase.java
trunk/ui/input/ui/src/main/java/org/richfaces/utils/CalendarHelper.java
trunk/ui/input/ui/src/main/templates/autocomplete.template.xml
trunk/ui/input/ui/src/main/templates/calendar.template.xml
Log:
RF-10094 Inline default values: input components I
Modified: trunk/ui/input/ui/src/main/java/org/richfaces/component/AbstractAutocomplete.java
===================================================================
--- trunk/ui/input/ui/src/main/java/org/richfaces/component/AbstractAutocomplete.java 2011-01-14 17:40:58 UTC (rev 21037)
+++ trunk/ui/input/ui/src/main/java/org/richfaces/component/AbstractAutocomplete.java 2011-01-14 17:52:23 UTC (rev 21038)
@@ -77,13 +77,13 @@
@Attribute(literal = false)
public abstract Object getFetchValue();
- @Attribute(defaultValue = "1")
+ @Attribute
public abstract int getMinChars();
@Attribute
public abstract String getFilterFunction();
- @Attribute(defaultValue = "rf-au-sel")
+ @Attribute
public abstract String getSelectedItemClass();
@Attribute
@@ -101,10 +101,10 @@
@Attribute(defaultValue = "true")
public abstract boolean isAutofill();
- @Attribute(defaultValue = "false")
+ @Attribute
public abstract boolean isDisabled();
- @Attribute(defaultValue = "false")
+ @Attribute
public abstract boolean isShowButton();
@Attribute(defaultValue = "true")
Modified: trunk/ui/input/ui/src/main/java/org/richfaces/component/AbstractCalendar.java
===================================================================
--- trunk/ui/input/ui/src/main/java/org/richfaces/component/AbstractCalendar.java 2011-01-14 17:40:58 UTC (rev 21037)
+++ trunk/ui/input/ui/src/main/java/org/richfaces/component/AbstractCalendar.java 2011-01-14 17:52:23 UTC (rev 21038)
@@ -88,26 +88,26 @@
locale
}
- public enum Modes {
+ public enum Mode {
client,
ajax
}
private Object submittedCurrentDate = null;
- @Attribute(defaultValue = "MMM d, yyyy")
+ @Attribute
public abstract String getDatePattern();
- @Attribute(defaultValue = "TimeZone.getDefault()")
+ @Attribute
public abstract TimeZone getTimeZone();
- @Attribute(defaultValue = "Integer.MIN_VALUE")
+ @Attribute
public abstract int getFirstWeekDay();
- @Attribute(defaultValue = "Integer.MIN_VALUE")
+ @Attribute
public abstract int getMinDaysInFirstWeek();
- @Attribute(defaultValue = "select")
+ @Attribute
public abstract String getTodayControlMode();
@Attribute(defaultValue = "true")
@@ -129,43 +129,43 @@
public abstract boolean isPopup();
@Attribute(defaultValue = "true")
- public abstract String getHidePopupOnScroll();
+ public abstract boolean isHidePopupOnScroll();
- @Attribute(defaultValue = "false")
+ @Attribute
public abstract boolean isDisabled();
- @Attribute(defaultValue = "false")
+ @Attribute
public abstract boolean isEnableManualInput();
@Attribute
public abstract String getDayDisableFunction();
- @Attribute(defaultValue = "false")
+ @Attribute
public abstract boolean isShowApplyButton();
- @Attribute(defaultValue = "false")
+ @Attribute
public abstract boolean isResetTimeOnDateSelect();
- @Attribute(defaultValue = "AA")
+ @Attribute
public abstract String getJointPoint();
- @Attribute(defaultValue = "AA")
+ @Attribute
public abstract String getDirection();
- @Attribute(defaultValue = "inactive")
+ @Attribute
public abstract String getBoundaryDatesMode();
- @Attribute(defaultValue = "0")
+ @Attribute
public abstract int getHorizontalOffset();
- @Attribute(defaultValue = "0")
+ @Attribute
public abstract int getVerticalOffset();
- @Attribute(defaultValue = "3")
+ @Attribute
public abstract int getZindex();
- @Attribute(defaultValue = "client")
- public abstract String getMode();
+ @Attribute
+ public abstract Mode getMode();
@Attribute
public abstract String getDefaultLabel();
@@ -218,15 +218,15 @@
@Attribute
public abstract String getButtonIconDisabled();
- @Attribute(defaultValue = "getDefaultValueOfDefaultTime(null,null)")
+ @Attribute
public abstract Object getDefaultTime();
- @Attribute(defaultValue = "getDefaultPreloadBegin(getCurrentDateOrDefault())")
+ @Attribute
public abstract Object getPreloadDateRangeBegin();
public abstract void setPreloadDateRangeBegin(Object date);
- @Attribute(defaultValue = "getDefaultPreloadEnd(getCurrentDateOrDefault())")
+ @Attribute
public abstract Object getPreloadDateRangeEnd();
public abstract void setPreloadDateRangeEnd(Object date);
@@ -387,7 +387,7 @@
if (ve.getType(elContext).equals(String.class)) {
DateTimeConverter convert = new DateTimeConverter();
convert.setLocale(CalendarHelper.getAsLocale(facesContext, this, getLocale()));
- convert.setPattern(getDatePattern());
+ convert.setPattern(CalendarHelper.getDatePatternOrDefault(this));
ve.setValue(facesContext.getELContext(), convert.getAsString(facesContext, this, currentDate));
return;
} else if (ve.getType(elContext).equals(Calendar.class)) {
@@ -442,7 +442,7 @@
protected Date getDefaultPreloadBegin(Date date) {
FacesContext facesContext = FacesContext.getCurrentInstance();
- Calendar calendar = Calendar.getInstance(getTimeZone(),
+ Calendar calendar = Calendar.getInstance(CalendarHelper.getTimeZoneOrDefault(this),
CalendarHelper.getAsLocale(facesContext, this, getLocale()));
calendar.setTime(date);
calendar.set(Calendar.DATE, calendar.getActualMinimum(Calendar.DATE));
@@ -451,7 +451,7 @@
protected Date getDefaultPreloadEnd(Date date) {
FacesContext facesContext = FacesContext.getCurrentInstance();
- Calendar calendar = Calendar.getInstance(getTimeZone(),
+ Calendar calendar = Calendar.getInstance(CalendarHelper.getTimeZoneOrDefault(this),
CalendarHelper.getAsLocale(facesContext, this, getLocale()));
calendar.setTime(date);
calendar.set(Calendar.DATE, calendar.getActualMaximum(Calendar.DATE));
@@ -474,7 +474,7 @@
if (value != null) {
return value;
} else {
- return java.util.Calendar.getInstance(getTimeZone()).getTime();
+ return java.util.Calendar.getInstance(CalendarHelper.getTimeZoneOrDefault(this)).getTime();
}
}
}
@@ -592,14 +592,29 @@
Date dateRangeBegin = null;
Date dateRangeEnd = null;
- if (Modes.ajax.toString().equalsIgnoreCase(getMode())) {
+ Mode mode = getMode();
+ if (mode == null) {
+ mode = Mode.client;
+ }
+
+ if (Mode.ajax.equals(mode)) {
dateRangeBegin = CalendarHelper.getAsDate(facesContext, this,
getDefaultPreloadBegin((Date) getCurrentDateOrDefault()));
dateRangeEnd = CalendarHelper.getAsDate(facesContext, this,
getDefaultPreloadEnd((Date) getCurrentDateOrDefault()));
} else {
- dateRangeBegin = CalendarHelper.getAsDate(facesContext, this, getPreloadDateRangeBegin());
- dateRangeEnd = CalendarHelper.getAsDate(facesContext, this, getPreloadDateRangeEnd());
+
+ Object date = getPreloadDateRangeBegin();
+ if (date == null) {
+ date = getDefaultPreloadBegin(getCurrentDateOrDefault());
+ }
+ dateRangeBegin = CalendarHelper.getAsDate(facesContext, this, date);
+
+ date = getPreloadDateRangeEnd();
+ if (date == null) {
+ date = getDefaultPreloadEnd(getCurrentDateOrDefault());
+ }
+ dateRangeEnd = CalendarHelper.getAsDate(facesContext, this, date);
}
if (dateRangeBegin == null && dateRangeEnd == null) {
@@ -616,7 +631,7 @@
List<Date> dates = new ArrayList<Date>();
- Calendar calendar = Calendar.getInstance(this.getTimeZone(), CalendarHelper.getAsLocale(facesContext, this, this.getLocale()));
+ Calendar calendar = Calendar.getInstance(CalendarHelper.getTimeZoneOrDefault(this), CalendarHelper.getAsLocale(facesContext, this, this.getLocale()));
Calendar calendar2 = (Calendar) calendar.clone();
calendar.setTime(dateRangeBegin);
calendar2.setTime(dateRangeEnd);
Modified: trunk/ui/input/ui/src/main/java/org/richfaces/renderkit/AutocompleteRendererBase.java
===================================================================
--- trunk/ui/input/ui/src/main/java/org/richfaces/renderkit/AutocompleteRendererBase.java 2011-01-14 17:40:58 UTC (rev 21037)
+++ trunk/ui/input/ui/src/main/java/org/richfaces/renderkit/AutocompleteRendererBase.java 2011-01-14 17:52:23 UTC (rev 21038)
@@ -307,4 +307,26 @@
public void decodeMetaComponent(FacesContext context, UIComponent component, String metaComponentId) {
throw new UnsupportedOperationException();
}
+
+ protected String getSelectedItemClassOrDefault(UIComponent component) {
+ String value = "";
+ if (component instanceof AbstractAutocomplete) {
+ value = ((AbstractAutocomplete) component).getSelectedItemClass();
+ if (value == null || value.length() == 0) {
+ value = "rf-au-sel";
+ }
+ }
+ return value;
+ }
+
+ protected int getMinCharsOrDefault(UIComponent component) {
+ int value = 1;
+ if (component instanceof AbstractAutocomplete) {
+ value = ((AbstractAutocomplete) component).getMinChars();
+ if (value < 1) {
+ value = 1;
+ }
+ }
+ return value;
+ }
}
Modified: trunk/ui/input/ui/src/main/java/org/richfaces/renderkit/CalendarRendererBase.java
===================================================================
--- trunk/ui/input/ui/src/main/java/org/richfaces/renderkit/CalendarRendererBase.java 2011-01-14 17:40:58 UTC (rev 21037)
+++ trunk/ui/input/ui/src/main/java/org/richfaces/renderkit/CalendarRendererBase.java 2011-01-14 17:52:23 UTC (rev 21038)
@@ -266,7 +266,7 @@
Object value = calendar.getValue();
date = CalendarHelper.getAsDate(facesContext, calendar, value);
if (date != null) {
- returnValue = formatSelectedDate(calendar.getTimeZone(), date);
+ returnValue = formatSelectedDate(CalendarHelper.getTimeZoneOrDefault(calendar), date);
}
}
return returnValue;
@@ -471,7 +471,8 @@
RenderKitUtils.addToScriptHash(map, MONTH_LABELS_SHORT, monthLabelsShort);
int minDaysInFirstWeek = calendarComponent.getMinDaysInFirstWeek();
- if (minDaysInFirstWeek == Integer.MIN_VALUE) {
+
+ if (1 > minDaysInFirstWeek || minDaysInFirstWeek > 7) {
minDaysInFirstWeek = calendar.getMinimalDaysInFirstWeek();
}
@@ -480,8 +481,7 @@
}
int day = calendarComponent.getFirstWeekDay();
- if (day == Integer.MIN_VALUE) {
- day = calendar.getFirstDayOfWeek();
+ if (day < 0 || 6 < day) {
day = calendar.getFirstDayOfWeek() - calendar.getActualMinimum(Calendar.DAY_OF_WEEK);
}
@@ -507,7 +507,12 @@
public String getStyleWithZindex(FacesContext facesContext, UIComponent component) {
AbstractCalendar calendar = (AbstractCalendar) component;
- String style = HtmlUtil.concatStyles("z-index: " + calendar.getZindex(), calendar.getStyle());
+ int zindex = calendar.getZindex();
+ if (zindex < 0) {
+ zindex = 3;
+ }
+
+ String style = HtmlUtil.concatStyles("z-index: " + zindex, calendar.getStyle());
return style;
}
@@ -541,9 +546,9 @@
if (converter instanceof DateTimeConverter) {
DateTimeConverter defaultConverter = (DateTimeConverter) converter;
- defaultConverter.setPattern(calendar.getDatePattern());
+ defaultConverter.setPattern(CalendarHelper.getDatePatternOrDefault(calendar));
defaultConverter.setLocale( CalendarHelper.getAsLocale(facesContext, calendar));
- defaultConverter.setTimeZone(calendar.getTimeZone());
+ defaultConverter.setTimeZone(CalendarHelper.getTimeZoneOrDefault(calendar));
}
return converter;
}
@@ -564,4 +569,48 @@
public void decodeMetaComponent(FacesContext context, UIComponent component, String metaComponentId) {
throw new UnsupportedOperationException();
}
+
+ protected String getTodayControlModeOrDefault(UIComponent component) {
+ String value = "";
+ if (component instanceof AbstractCalendar) {
+ value = ((AbstractCalendar) component).getTodayControlMode();
+ if (value == null || value.length() == 0) {
+ value = "select";
+ }
+ }
+ return value;
+ }
+
+ protected String getJointPointOrDefault(UIComponent component) {
+ String value = "";
+ if (component instanceof AbstractCalendar) {
+ value = ((AbstractCalendar) component).getJointPoint();
+ if (value == null || value.length() == 0) {
+ value = "AA";
+ }
+ }
+ return value;
+ }
+
+ protected String getDirectionOrDefault(UIComponent component) {
+ String value = "";
+ if (component instanceof AbstractCalendar) {
+ value = ((AbstractCalendar) component).getDirection();
+ if (value == null || value.length() == 0) {
+ value = "AA";
+ }
+ }
+ return value;
+ }
+
+ protected String getBoundaryDatesModeOrDefault(UIComponent component) {
+ String value = "";
+ if (component instanceof AbstractCalendar) {
+ value = ((AbstractCalendar) component).getBoundaryDatesMode();
+ if (value == null || value.length() == 0) {
+ value = "inactive";
+ }
+ }
+ return value;
+ }
}
\ No newline at end of file
Modified: trunk/ui/input/ui/src/main/java/org/richfaces/utils/CalendarHelper.java
===================================================================
--- trunk/ui/input/ui/src/main/java/org/richfaces/utils/CalendarHelper.java 2011-01-14 17:40:58 UTC (rev 21037)
+++ trunk/ui/input/ui/src/main/java/org/richfaces/utils/CalendarHelper.java 2011-01-14 17:52:23 UTC (rev 21038)
@@ -28,6 +28,7 @@
import java.util.Calendar;
import java.util.Date;
import java.util.Locale;
+import java.util.TimeZone;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
@@ -80,6 +81,9 @@
}
Object defaultTime = calendar.getDefaultTime();
+ if (defaultTime == null) {
+ defaultTime = AbstractCalendar.getDefaultValueOfDefaultTime(null,null);
+ }
Date result = null;
if (defaultTime instanceof Calendar) {
@@ -90,7 +94,7 @@
} else {
String defaultTimeString = defaultTime.toString();
- String datePattern = calendar.getDatePattern();
+ String datePattern = getDatePatternOrDefault(calendar);
Pattern pattern = Pattern.compile(AbstractCalendar.SUB_TIME_PATTERN);
Matcher matcher = pattern.matcher(datePattern);
@@ -194,14 +198,14 @@
if (calendar == null || facesContext == null) {
return Calendar.getInstance();
}
- return Calendar.getInstance(calendar.getTimeZone(), getAsLocale(facesContext, calendar));
+ return Calendar.getInstance(getTimeZoneOrDefault(calendar), getAsLocale(facesContext, calendar));
}
public static Date convertStringToDate(FacesContext facesContext, AbstractCalendar calendar, String date) {
DateTimeConverter converter = new DateTimeConverter();
- converter.setPattern(calendar.getDatePattern());
+ converter.setPattern(getDatePatternOrDefault(calendar));
converter.setLocale(getAsLocale(facesContext, calendar));
- converter.setTimeZone(calendar.getTimeZone());
+ converter.setTimeZone(getTimeZoneOrDefault(calendar));
return (Date) converter.getAsObject(facesContext, calendar, date);
}
@@ -220,4 +224,20 @@
}
return date;
}
+
+ public static TimeZone getTimeZoneOrDefault(AbstractCalendar calendar) {
+ TimeZone value = calendar.getTimeZone();
+ if (value == null) {
+ value = TimeZone.getDefault();
+ }
+ return value;
+ }
+
+ public static String getDatePatternOrDefault(AbstractCalendar calendar) {
+ String value = calendar.getDatePattern();
+ if (value == null || "".equals(value)) {
+ value = "MMM d, yyyy";
+ }
+ return value;
+ }
}
Modified: trunk/ui/input/ui/src/main/templates/autocomplete.template.xml
===================================================================
--- trunk/ui/input/ui/src/main/templates/autocomplete.template.xml 2011-01-14 17:40:58 UTC (rev 21037)
+++ trunk/ui/input/ui/src/main/templates/autocomplete.template.xml 2011-01-14 17:52:23 UTC (rev 21038)
@@ -74,8 +74,10 @@
<cdk:object name="mode" type="Object" value="#{component.attributes['mode']}" />
<cdk:scriptObject name="options">
<cdk:scriptOption name="buttonId" value="#{clientId}Button" />
- <cdk:scriptOption attributes="selectedItemClass minChars filterFunction autofill disabled selectFirst tokens" />
- <cdk:scriptOption attributes="onbegin oncomplete onerror onbeforedomupdate onchange onselectitem onfocus onblur" wrapper="eventHandler"/>
+ <cdk:scriptOption attributes="filterFunction autofill disabled selectFirst tokens" />
+ <cdk:scriptOption attributes="onbegin oncomplete onerror onbeforedomupdate onchange onselectitem onfocus onblur" wrapper="eventHandler"/>
+ <cdk:scriptOption name="minChars" value="#{getMinCharsOrDefault(component)}" />
+ <cdk:scriptOption name="selectedItemClass" value="#{getSelectedItemClassOrDefault(component)}" />
<cdk:scriptOption name="filterFunction" value="#{getClientFilterFunction(component)}" />
<cdk:scriptOption name="isCachedAjax" value="#{'ajax'==mode ? false : true}" defaultValue="true" />
<cdk:scriptOption name="ajaxMode" value="#{'client'==mode||'lazyClient'==mode ? false : true}" defaultValue="true" />
Modified: trunk/ui/input/ui/src/main/templates/calendar.template.xml
===================================================================
--- trunk/ui/input/ui/src/main/templates/calendar.template.xml 2011-01-14 17:40:58 UTC (rev 21037)
+++ trunk/ui/input/ui/src/main/templates/calendar.template.xml 2011-01-14 17:52:23 UTC (rev 21038)
@@ -69,8 +69,12 @@
<script type="text/javascript">
<cdk:scriptObject name="options">
- <cdk:scriptOption attributes="enableManualInput disabled readonly resetTimeOnDateSelect showApplyButton popup showInput showHeader showFooter showWeeksBar todayControlMode datePattern jointPoint direction boundaryDatesMode horizontalOffset verticalOffset hidePopupOnScrol showWeekDaysBar styleClass mode defaultLabel" />
- <cdk:scriptOption attributes="onchange ondateselect onbeforedateselect onbeforecurrentdateselect onhide onshow ondatemouseover ondatemouseout onclean ontimeselect onbeforetimeselect" wrapper="eventHandler" />
+ <cdk:scriptOption attributes="enableManualInput disabled readonly resetTimeOnDateSelect showApplyButton popup showInput showHeader showFooter showWeeksBar datePattern horizontalOffset verticalOffset hidePopupOnScrol showWeekDaysBar styleClass mode defaultLabel" />
+ <cdk:scriptOption attributes="onchange ondateselect onbeforedateselect onbeforecurrentdateselect onhide onshow ondatemouseover ondatemouseout onclean ontimeselect onbeforetimeselect" wrapper="eventHandler" />
+ <cdk:scriptOption name="todayControlMode" value="#{getTodayControlModeOrDefault(component)}" />
+ <cdk:scriptOption name="jointPoint" value="#{getJointPointOrDefault(component)}" />
+ <cdk:scriptOption name="direction" value="#{getDirectionOrDefault(component)}" />
+ <cdk:scriptOption name="boundaryDatesMode" value="#{getBoundaryDatesModeOrDefault(component)}" />
<cdk:scriptOption name="currentDate" value="#{getCurrentDate(facesContext, component)}" />
<cdk:scriptOption name="selectedDate" value="#{getSelectedDate(facesContext, component)}" />
<cdk:scriptOption name="dayCellClass" value="#{getDayCellClass(facesContext, component)}" />
13 years, 11 months
JBoss Rich Faces SVN: r21037 - in modules/tests/metamer/trunk: application/src/main/webapp/components/a4jCommandLink and 2 other directories.
by richfaces-svn-commits@lists.jboss.org
Author: ppitonak(a)redhat.com
Date: 2011-01-14 12:40:58 -0500 (Fri, 14 Jan 2011)
New Revision: 21037
Removed:
modules/tests/metamer/trunk/application/src/main/webapp/resources/css/a4jCommandLink.css
Modified:
modules/tests/metamer/trunk/application/src/main/resources/org/richfaces/tests/metamer/bean/A4JCommandLinkBean.properties
modules/tests/metamer/trunk/application/src/main/webapp/components/a4jCommandLink/simple.xhtml
modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/a4jCommandLink/TestA4JCommandLink.java
Log:
* sample for a4j:commandLink updated
* added 15 new tests for command link
* old tests refactored
Modified: modules/tests/metamer/trunk/application/src/main/resources/org/richfaces/tests/metamer/bean/A4JCommandLinkBean.properties
===================================================================
--- modules/tests/metamer/trunk/application/src/main/resources/org/richfaces/tests/metamer/bean/A4JCommandLinkBean.properties 2011-01-14 17:23:26 UTC (rev 21036)
+++ modules/tests/metamer/trunk/application/src/main/resources/org/richfaces/tests/metamer/bean/A4JCommandLinkBean.properties 2011-01-14 17:40:58 UTC (rev 21037)
@@ -1,6 +1,3 @@
-#testapp.help.action=#{a4jLinkBean.first6CharsAction} #{a4jLinkBean.doubleStringAction} #{a4jLinkBean.toUpperCaseAction}
-#testapp.help.actionListener=#{a4jLinkBean.first6CharsActionListener} #{a4jLinkBean.doubleStringActionListener} #{a4jLinkBean.toUpperCaseActionListener}
-
attr.action.first6CharsAction=first6CharsAction
attr.action.doubleStringAction=doubleStringAction
attr.action.toUpperCaseAction=toUpperCaseAction
@@ -8,7 +5,3 @@
attr.actionListener.first6CharsActionListener=first6CharsActionListener
attr.actionListener.doubleStringActionListener=doubleStringActionListener
attr.actionListener.toUpperCaseActionListener=toUpperCaseActionListener
-
-attr.styleClass.bold=bold
-attr.styleClass.strike=strike
-attr.styleClass.none=
\ No newline at end of file
Modified: modules/tests/metamer/trunk/application/src/main/webapp/components/a4jCommandLink/simple.xhtml
===================================================================
--- modules/tests/metamer/trunk/application/src/main/webapp/components/a4jCommandLink/simple.xhtml 2011-01-14 17:23:26 UTC (rev 21036)
+++ modules/tests/metamer/trunk/application/src/main/webapp/components/a4jCommandLink/simple.xhtml 2011-01-14 17:40:58 UTC (rev 21037)
@@ -6,7 +6,7 @@
<!--
JBoss, Home of Professional Open Source
-Copyright 2010, Red Hat, Inc. and individual contributors
+Copyright 2010-2011, Red Hat, Inc. and individual contributors
by the @authors tag. See the copyright.txt in the distribution for a
full listing of individual contributors.
@@ -34,8 +34,6 @@
<f:converter converterId="templatesListConverter" />
</f:viewParam>
</f:metadata>
-
- <h:outputStylesheet library="css" name="a4jCommandLink.css"/>
</ui:define>
<ui:define name="outOfTemplateBefore">
Deleted: modules/tests/metamer/trunk/application/src/main/webapp/resources/css/a4jCommandLink.css
===================================================================
--- modules/tests/metamer/trunk/application/src/main/webapp/resources/css/a4jCommandLink.css 2011-01-14 17:23:26 UTC (rev 21036)
+++ modules/tests/metamer/trunk/application/src/main/webapp/resources/css/a4jCommandLink.css 2011-01-14 17:40:58 UTC (rev 21037)
@@ -1,7 +0,0 @@
-.bold {
- font-weight: bold;
-}
-
-.strike {
- text-decoration: line-through;
-}
Modified: modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/a4jCommandLink/TestA4JCommandLink.java
===================================================================
--- modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/a4jCommandLink/TestA4JCommandLink.java 2011-01-14 17:23:26 UTC (rev 21036)
+++ modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/a4jCommandLink/TestA4JCommandLink.java 2011-01-14 17:40:58 UTC (rev 21037)
@@ -1,6 +1,6 @@
/*******************************************************************************
* JBoss, Home of Professional Open Source
- * Copyright 2010, Red Hat, Inc. and individual contributors
+ * Copyright 2010-2011, Red Hat, Inc. and individual contributors
* by the @authors tag. See the copyright.txt in the distribution for a
* full listing of individual contributors.
*
@@ -19,19 +19,22 @@
* 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.tests.metamer.ftest.a4jCommandLink;
+import static org.jboss.test.selenium.guard.request.RequestTypeGuardFactory.guardNoRequest;
+import static org.jboss.test.selenium.guard.request.RequestTypeGuardFactory.guardXhr;
+import static org.jboss.test.selenium.locator.LocatorFactory.jq;
import static org.jboss.test.selenium.utils.URLUtils.buildUrl;
import static org.testng.Assert.assertEquals;
import static org.testng.Assert.assertFalse;
import static org.testng.Assert.assertTrue;
+import static org.testng.Assert.fail;
import java.net.URL;
+import javax.faces.event.PhaseId;
import org.jboss.test.selenium.dom.Event;
-import org.jboss.test.selenium.locator.Attribute;
-import org.jboss.test.selenium.locator.AttributeLocator;
+import org.jboss.test.selenium.encapsulated.JavaScript;
import org.jboss.test.selenium.locator.JQueryLocator;
import org.richfaces.tests.metamer.ftest.AbstractMetamerTest;
import org.richfaces.tests.metamer.ftest.annotations.IssueTracking;
@@ -58,8 +61,8 @@
@Test(groups = "client-side-perf")
public void testSimpleClick() {
- selenium.typeKeys(input, "RichFaces 4");
- selenium.click(link);
+ guardNoRequest(selenium).typeKeys(input, "RichFaces 4");
+ guardXhr(selenium).click(link);
waitGui.until(textEquals.locator(output1).text("RichFaces 4"));
@@ -76,8 +79,8 @@
@Test
@IssueTracking("https://issues.jboss.org/browse/RF-9665")
public void testSimpleClickUnicode() {
- selenium.typeKeys(input, "ľščťžýáíéňô");
- selenium.click(link);
+ guardNoRequest(selenium).typeKeys(input, "ľščťžýáíéňô");
+ guardXhr(selenium).click(link);
waitGui.until(textEquals.locator(output1).text("ľščťžýáíéňô"));
@@ -93,85 +96,195 @@
@Test
public void testAction() {
- JQueryLocator doubleStringAction = pjq("input[value=doubleStringAction]");
- JQueryLocator first6CharsAction = pjq("input[value=first6CharsAction]");
- JQueryLocator toUpperCaseAction = pjq("input[value=toUpperCaseAction]");
-
- selenium.click(doubleStringAction);
- selenium.waitForPageToLoad(TIMEOUT);
+ selenium.click(pjq("input[name$=actionInput][value=doubleStringAction]"));
+ selenium.waitForPageToLoad();
selenium.typeKeys(input, "RichFaces 4");
- selenium.click(link);
+ guardXhr(selenium).click(link);
waitGui.until(textEquals.locator(output1).text("RichFaces 4"));
- String output = selenium.getText(output2);
- assertEquals(output, "RichFaces 4RichFaces 4",
- "output2 when 'RichFaces 4' in input and doubleStringAction selected");
+ assertEquals(selenium.getText(output2), "RichFaces 4RichFaces 4", "output2 when 'RichFaces 4' in input and doubleStringAction selected");
- selenium.click(first6CharsAction);
- selenium.waitForPageToLoad(TIMEOUT);
+ selenium.click(pjq("input[name$=actionInput][value=first6CharsAction]"));
+ selenium.waitForPageToLoad();
selenium.typeKeys(input, "RichFaces 4ň");
- selenium.click(link);
+ guardXhr(selenium).click(link);
waitGui.until(textEquals.locator(output1).text("RichFaces 4ň"));
- output = selenium.getText(output2);
- assertEquals(output, "RichFa", "output2 when 'RichFaces 4ň' in input and first6CharsAction selected");
+ assertEquals(selenium.getText(output2), "RichFa", "output2 when 'RichFaces 4ň' in input and first6CharsAction selected");
- selenium.click(toUpperCaseAction);
- selenium.waitForPageToLoad(TIMEOUT);
+ selenium.click(pjq("input[name$=actionInput][value=toUpperCaseAction]"));
+ selenium.waitForPageToLoad();
selenium.typeKeys(input, "RichFaces 4ě");
- selenium.click(link);
+ guardXhr(selenium).click(link);
waitGui.until(textEquals.locator(output1).text("RichFaces 4ě"));
- output = selenium.getText(output2);
- assertEquals(output, "RICHFACES 4Ě", "output2 when 'RichFaces 4ě' in input and toUpperCaseAction selected");
+ assertEquals(selenium.getText(output2), "RICHFACES 4Ě", "output2 when 'RichFaces 4ě' in input and toUpperCaseAction selected");
}
@Test
public void testActionListener() {
- JQueryLocator doubleStringActionListener = pjq("input[value=doubleStringActionListener]");
- JQueryLocator first6CharsActionListener = pjq("input[value=first6CharsActionListener]");
- JQueryLocator toUpperCaseActionListener = pjq("input[value=toUpperCaseActionListener]");
-
- selenium.click(doubleStringActionListener);
- selenium.waitForPageToLoad(TIMEOUT);
+ selenium.click(pjq("input[name$=actionListenerInput][value=doubleStringActionListener]"));
+ selenium.waitForPageToLoad();
selenium.typeKeys(input, "RichFaces 4");
- selenium.click(link);
+ guardXhr(selenium).click(link);
waitGui.until(textEquals.locator(output1).text("RichFaces 4"));
- String output = selenium.getText(output3);
- assertEquals(output, "RichFaces 4RichFaces 4",
- "output2 when 'RichFaces 4' in input and doubleStringActionListener selected");
+ assertEquals(selenium.getText(output3), "RichFaces 4RichFaces 4",
+ "output3 when 'RichFaces 4' in input and doubleStringActionListener selected");
- selenium.click(first6CharsActionListener);
- selenium.waitForPageToLoad(TIMEOUT);
+ selenium.click(pjq("input[name$=actionListenerInput][value=first6CharsActionListener]"));
+ selenium.waitForPageToLoad();
selenium.typeKeys(input, "RichFaces 4ň");
- selenium.click(link);
+ guardXhr(selenium).click(link);
waitGui.until(textEquals.locator(output1).text("RichFaces 4ň"));
- output = selenium.getText(output3);
- assertEquals(output, "RichFa", "output2 when 'RichFaces 4ň' in input and first6CharsActionListener selected");
+ assertEquals(selenium.getText(output3), "RichFa", "output3 when 'RichFaces 4ň' in input and first6CharsActionListener selected");
- selenium.click(toUpperCaseActionListener);
- selenium.waitForPageToLoad(TIMEOUT);
+ selenium.click(pjq("input[name$=actionListenerInput][value=toUpperCaseActionListener]"));
+ selenium.waitForPageToLoad();
selenium.typeKeys(input, "RichFaces 4ě");
- selenium.click(link);
+ guardXhr(selenium).click(link);
waitGui.until(textEquals.locator(output1).text("RichFaces 4ě"));
- output = selenium.getText(output3);
- assertEquals(output, "RICHFACES 4Ě",
- "output2 when 'RichFaces 4ě' in input and toUpperCaseActionListener selected");
+ assertEquals(selenium.getText(output3), "RICHFACES 4Ě", "output3 when 'RichFaces 4ě' in input and toUpperCaseActionListener selected");
}
@Test
+ public void testBypassUpdates() {
+ selenium.click(pjq("input[type=radio][name$=bypassUpdatesInput][value=true]"));
+ selenium.waitForPageToLoad();
+
+ String reqTime = selenium.getText(time);
+ guardXhr(selenium).click(link);
+ waitGui.failWith("Page was not updated").waitForChange(reqTime, retrieveText.locator(time));
+
+ assertEquals(selenium.getText(output1), "", "Output 1 should not change");
+ assertEquals(selenium.getText(output2), "", "Output 2 should not change");
+ assertEquals(selenium.getText(output3), "", "Output 3 should not change");
+ assertPhases(PhaseId.RESTORE_VIEW, PhaseId.APPLY_REQUEST_VALUES, PhaseId.PROCESS_VALIDATIONS,
+ PhaseId.RENDER_RESPONSE);
+
+ String listenerOutput = selenium.getText(jq("div#phasesPanel li:eq(3)"));
+ assertEquals(listenerOutput, "* action listener invoked", "Action listener's output");
+ listenerOutput = selenium.getText(jq("div#phasesPanel li:eq(4)"));
+ assertEquals(listenerOutput, "* action invoked", "Action's output");
+ }
+
+ @Test
+ public void testCharset() {
+ testHtmlAttribute(link, "charset", "utf-8");
+ }
+
+ @Test
+ public void testCoords() {
+ testHtmlAttribute(link, "coords", "circle: 150, 60, 60");
+ }
+
+ @Test
+ public void testData() {
+ selenium.type(pjq("input[type=text][id$=dataInput]"), "RichFaces 4");
+ selenium.waitForPageToLoad();
+
+ selenium.type(pjq("input[type=text][id$=oncompleteInput]"), "data = event.data");
+ selenium.waitForPageToLoad();
+
+ String reqTime = selenium.getText(time);
+
+ selenium.type(input, "some input text");
+ guardXhr(selenium).click(link);
+ waitGui.failWith("Page was not updated").waitForChange(reqTime, retrieveText.locator(time));
+
+ String data = selenium.getEval(new JavaScript("window.data"));
+ assertEquals(data, "RichFaces 4", "Data sent with ajax request");
+ }
+
+ @Test
public void testDisabled() {
- JQueryLocator disabledCheckbox = pjq("input[type=radio][name$=disabledInput][value=true]");
JQueryLocator newLink = pjq("span[id$=a4jCommandLink]");
- selenium.click(disabledCheckbox);
- selenium.waitForPageToLoad(TIMEOUT);
+ selenium.click(pjq("input[name$=disabledInput][value=true]"));
+ selenium.waitForPageToLoad();
- assertFalse(selenium.isElementPresent(link), link.getAsString()
- + " should not be on page when the link is disabled");
- assertTrue(selenium.isElementPresent(newLink), newLink.getAsString()
- + " should be on page when the link is disabled");
+ assertFalse(selenium.isElementPresent(link), link.getAsString() + " should not be on page when the link is disabled");
+ assertTrue(selenium.isElementPresent(newLink), newLink.getAsString() + " should be on page when the link is disabled");
+ }
+ @Test
+ public void testExecute() {
+ selenium.type(pjq("input[type=text][id$=executeInput]"), "input executeChecker");
+ selenium.waitForPageToLoad();
+
+ selenium.type(input, "RichFaces 4");
+ guardXhr(selenium).click(link);
+ waitGui.failWith("Page was not updated").waitForChangeAndReturn("", retrieveText.locator(output1));
+
+ JQueryLocator logItems = jq("ul.phases-list li:eq({0})");
+ for (int i = 0; i < 6; i++) {
+ if ("* executeChecker".equals(selenium.getText(logItems.format(i)))) {
+ return;
+ }
+ }
+
+ fail("Attribute execute does not work");
}
@Test
+ public void testHreflang() {
+ testHtmlAttribute(link, "hreflang", "sk");
+ }
+
+ @Test
+ public void testImmediate() {
+ selenium.click(pjq("input[type=radio][name$=immediateInput][value=true]"));
+ selenium.waitForPageToLoad();
+
+ String reqTime = selenium.getText(time);
+ guardXhr(selenium).click(link);
+ waitGui.failWith("Page was not updated").waitForChange(reqTime, retrieveText.locator(time));
+
+ assertEquals(selenium.getText(output1), "", "Output 1 should not change");
+ assertEquals(selenium.getText(output2), "", "Output 2 should not change");
+ assertEquals(selenium.getText(output3), "", "Output 3 should not change");
+ assertPhases(PhaseId.RESTORE_VIEW, PhaseId.APPLY_REQUEST_VALUES, PhaseId.RENDER_RESPONSE);
+
+ String listenerOutput = selenium.getText(jq("div#phasesPanel li:eq(2)"));
+ assertEquals(listenerOutput, "* action listener invoked", "Action listener's output");
+ listenerOutput = selenium.getText(jq("div#phasesPanel li:eq(3)"));
+ assertEquals(listenerOutput, "* action invoked", "Action's output");
+ }
+
+ @Test
+ public void testLimitRender() {
+ selenium.click(pjq("input[type=radio][name$=limitRenderInput][value=true]"));
+ selenium.waitForPageToLoad();
+
+ String timeValue = selenium.getText(time);
+
+ selenium.type(input, "RichFaces 4");
+ guardXhr(selenium).click(link);
+ waitGui.failWith("Page was not updated").waitForChange("", retrieveText.locator(output1));
+
+ assertEquals(selenium.getText(time), timeValue, "Ajax-rendered a4j:outputPanel shouldn't change");
+ }
+
+ @Test
+ public void testEvents() {
+ selenium.type(pjq("input[type=text][id$=onbeginInput]"), "metamerEvents += \"begin \"");
+ selenium.waitForPageToLoad();
+ selenium.type(pjq("input[type=text][id$=onbeforedomupdateInput]"), "metamerEvents += \"beforedomupdate \"");
+ selenium.waitForPageToLoad();
+ selenium.type(pjq("input[type=text][id$=oncompleteInput]"), "metamerEvents += \"complete \"");
+ selenium.waitForPageToLoad();
+
+ selenium.getEval(new JavaScript("window.metamerEvents = \"\";"));
+
+ selenium.type(input, "RichFaces 4");
+ guardXhr(selenium).click(link);
+ waitGui.failWith("Page was not updated").waitForChange("", retrieveText.locator(output1));
+
+ String[] events = selenium.getEval(new JavaScript("window.metamerEvents")).split(" ");
+
+ assertEquals(events.length, 3, "3 events should be fired.");
+ assertEquals(events[0], "begin", "Attribute onbegin doesn't work");
+ assertEquals(events[1], "beforedomupdate", "Attribute onbeforedomupdate doesn't work");
+ assertEquals(events[2], "complete", "Attribute oncomplete doesn't work");
+ }
+
+ @Test
public void testOnclick() {
testFireEvent(Event.CLICK, link);
}
@@ -222,14 +335,19 @@
}
@Test
+ public void testRel() {
+ testHtmlAttribute(link, "rel", "metamer");
+ }
+
+ @Test
public void testRender() {
JQueryLocator renderInput = pjq("input[name$=renderInput]");
selenium.type(renderInput, "output1");
- selenium.waitForPageToLoad(TIMEOUT);
+ selenium.waitForPageToLoad();
selenium.typeKeys(input, "aaa");
- selenium.click(link);
+ guardXhr(selenium).click(link);
waitGui.until(textEquals.locator(output1).text("aaa"));
@@ -243,10 +361,10 @@
assertEquals(output, "", "output3 when 'aaa' in input and 'output1' set to be rerendered");
selenium.type(renderInput, "output2 output3");
- selenium.waitForPageToLoad(TIMEOUT);
+ selenium.waitForPageToLoad();
selenium.typeKeys(input, "bbb");
- selenium.click(link);
+ guardXhr(selenium).click(link);
waitGui.until(textEquals.locator(output2).text("bbb"));
@@ -258,60 +376,57 @@
output = selenium.getText(output3);
assertEquals(output, "BBB", "output3 when 'bbb' in input and 'output2 output3' set to be rerendered");
-
}
@Test
public void testRendered() {
- JQueryLocator renderedCheckbox = pjq("input[name$=renderedInput]");
+ selenium.click(pjq("input[name$=renderedInput][value=false]"));
+ selenium.waitForPageToLoad();
+ assertFalse(selenium.isElementPresent(link), "Link should not be displayed");
+ }
- selenium.click(renderedCheckbox);
- selenium.waitForPageToLoad(TIMEOUT);
- assertFalse(selenium.isElementPresent(link), "Button should not be displayed");
+ @Test
+ public void testRev() {
+ testHtmlAttribute(link, "rev", "metamer");
}
@Test
+ public void testShape() {
+ testHtmlAttribute(link, "shape", "default");
+ }
+
+ @Test
+ public void testStyle() {
+ testStyle(link, "style");
+ }
+
+ @Test
@IssueTracking("https://issues.jboss.org/browse/RF-9307")
public void testStyleClass() {
- JQueryLocator bold = pjq("input[name$=styleClassInput][value=bold]");
- JQueryLocator strike = pjq("input[name$=styleClassInput][value=strike]");
- JQueryLocator none = pjq("input[name$=styleClassInput][value=]");
+ testStyleClass(link, "styleClass");
+ }
- final AttributeLocator<?> classAttribute = link.getAttribute(new Attribute("class"));
+ @Test
+ @IssueTracking("https://issues.jboss.org/browse/RF-10222")
+ public void testTarget() {
+ testHtmlAttribute(link, "target", "_blank");
+ }
- selenium.click(bold);
- selenium.waitForPageToLoad(TIMEOUT);
- assertTrue(selenium.belongsClass(link, "bold"), "Button's class was not changed to 'bold'");
-
- selenium.click(strike);
- selenium.waitForPageToLoad(TIMEOUT);
- assertTrue(selenium.belongsClass(link, "strike"), "Button's class was not changed to 'strike'");
-
- selenium.click(none);
- selenium.waitForPageToLoad(TIMEOUT);
- assertFalse(selenium.isAttributePresent(classAttribute), "Button's class was not removed.");
+ @Test
+ public void testTitle() {
+ testTitle(link);
}
@Test
- public void testStyle() {
- JQueryLocator styleInput = pjq("input[id$=styleInput]");
- final AttributeLocator<?> attribute = link.getAttribute(new Attribute("style"));
- final String value = "font-size: 20px;";
-
- selenium.type(styleInput, value);
- selenium.waitForPageToLoad(TIMEOUT);
-
- assertEquals(selenium.getAttribute(attribute), value, "Style of the button did not change");
+ public void testType() {
+ testHtmlAttribute(link, "type", "metamer");
}
@Test
public void testValue() {
- JQueryLocator valueInput = pjq("input[id$=valueInput]");
- final String value = "new label";
+ selenium.type(pjq("input[id$=valueInput]"), "new label");
+ selenium.waitForPageToLoad();
- selenium.type(valueInput, value);
- selenium.waitForPageToLoad(TIMEOUT);
-
- assertEquals(selenium.getText(link), value, "Value of the button did not change");
+ assertEquals(selenium.getText(link), "new label", "Value of the button did not change");
}
}
13 years, 11 months
JBoss Rich Faces SVN: r21036 - in branches/RF-9797/ui/validator/ui/src/main: java/org/richfaces/validator and 1 other directories.
by richfaces-svn-commits@lists.jboss.org
Author: pyaschenko
Date: 2011-01-14 12:23:26 -0500 (Fri, 14 Jan 2011)
New Revision: 21036
Modified:
branches/RF-9797/ui/validator/ui/src/main/java/org/richfaces/renderkit/html/ClientOnlyScript.java
branches/RF-9797/ui/validator/ui/src/main/java/org/richfaces/renderkit/html/LibraryScriptFunction.java
branches/RF-9797/ui/validator/ui/src/main/java/org/richfaces/validator/FacesValidatorServiceImpl.java
branches/RF-9797/ui/validator/ui/src/main/resources/META-INF/resources/org.richfaces/richfaces-csv.js
Log:
RF-9797
validators and converter hash script rendering were added
validators and converters were moved to RichFaces.csv container
bugfix
Modified: branches/RF-9797/ui/validator/ui/src/main/java/org/richfaces/renderkit/html/ClientOnlyScript.java
===================================================================
--- branches/RF-9797/ui/validator/ui/src/main/java/org/richfaces/renderkit/html/ClientOnlyScript.java 2011-01-14 17:05:06 UTC (rev 21035)
+++ branches/RF-9797/ui/validator/ui/src/main/java/org/richfaces/renderkit/html/ClientOnlyScript.java 2011-01-14 17:23:26 UTC (rev 21036)
@@ -1,7 +1,9 @@
package org.richfaces.renderkit.html;
+import java.util.Arrays;
import java.util.Collection;
import java.util.LinkedHashSet;
+import java.util.Map;
import org.ajax4jsf.javascript.JSFunction;
import org.ajax4jsf.javascript.JSReference;
@@ -50,10 +52,28 @@
* finishValidation(body); body.append("return true;\n"); // Catch errors body.append("} catch(e) {\n");
* SEND_ERROR_FUNCTION.appendScriptToStringBuilder(body);body.append(EOL); body.append("return false;\n}");
*/
+ body.append("var c;");
+ if (null!=converter) {
+ body.append("c=");
+ body.append(converter.getClientScript());
+ body.append("EOL");
+ }
+ body.append("var v=[");
+
+ int i = validators.size();
+ for (LibraryScriptFunction validatorScript : validators) {
+ body.append(validatorScript.getClientScript());
+ if (--i>0) {
+ body.append(",");
+ }
+ }
+ body.append("];");
+
JSFunction callValidator =
new JSFunction("RichFaces.csv.validate", new JSReference("event"), new JSReference("id"), new JSReference(
- "element"), new JSReference("c"), new JSReference("v"), new JSReference("p"));
+ "element"), new JSReference("c"), new JSReference("v"));
body.append(callValidator);
+ body.append(EOL);
return body;
}
Modified: branches/RF-9797/ui/validator/ui/src/main/java/org/richfaces/renderkit/html/LibraryScriptFunction.java
===================================================================
--- branches/RF-9797/ui/validator/ui/src/main/java/org/richfaces/renderkit/html/LibraryScriptFunction.java 2011-01-14 17:05:06 UTC (rev 21035)
+++ branches/RF-9797/ui/validator/ui/src/main/java/org/richfaces/renderkit/html/LibraryScriptFunction.java 2011-01-14 17:23:26 UTC (rev 21036)
@@ -23,12 +23,18 @@
package org.richfaces.renderkit.html;
+import java.util.HashMap;
+import java.util.Map;
+
+import org.ajax4jsf.javascript.JSReference;
+import org.ajax4jsf.javascript.ScriptUtils;
import org.richfaces.javascript.LibraryFunction;
import org.richfaces.javascript.Message;
import org.richfaces.resource.ResourceKey;
import org.richfaces.resource.ResourceLibrary;
import com.google.common.collect.ImmutableSet;
+import com.google.common.collect.Maps;
/**
* <p class="changed_added_4_0">
@@ -84,6 +90,15 @@
public Object getParameters() {
return this.parameters;
}
+
+ public String getClientScript() {
+ Map <String, Object> hash = Maps.newHashMap();
+ hash.put("f", new JSReference(name));
+ HashMap <String, Object> params = new HashMap<String, Object>((Map <String, Object>) parameters);
+ params.put("customMessage", message.getSummary());
+ hash.put("params", params);
+ return ScriptUtils.toScript(hash);
+ }
/*
* (non-Javadoc)
Modified: branches/RF-9797/ui/validator/ui/src/main/java/org/richfaces/validator/FacesValidatorServiceImpl.java
===================================================================
--- branches/RF-9797/ui/validator/ui/src/main/java/org/richfaces/validator/FacesValidatorServiceImpl.java 2011-01-14 17:05:06 UTC (rev 21035)
+++ branches/RF-9797/ui/validator/ui/src/main/java/org/richfaces/validator/FacesValidatorServiceImpl.java 2011-01-14 17:23:26 UTC (rev 21036)
@@ -35,11 +35,12 @@
@Override
protected String getMessageId(Validator component) {
+ // TODO: all messages should be passed to client side using js function RichFaces.csv.addMessage
String messageId;
if (component instanceof DoubleRangeValidator) {
messageId = DoubleRangeValidator.NOT_IN_RANGE_MESSAGE_ID;
} else if (component instanceof LengthValidator) {
- messageId = DoubleRangeValidator.NOT_IN_RANGE_MESSAGE_ID;
+ messageId = LengthValidator.MAXIMUM_MESSAGE_ID;
} else if (component instanceof LongRangeValidator) {
messageId = LongRangeValidator.NOT_IN_RANGE_MESSAGE_ID;
} else if (component instanceof RegexValidator) {
Modified: branches/RF-9797/ui/validator/ui/src/main/resources/META-INF/resources/org.richfaces/richfaces-csv.js
===================================================================
--- branches/RF-9797/ui/validator/ui/src/main/resources/META-INF/resources/org.richfaces/richfaces-csv.js 2011-01-14 17:05:06 UTC (rev 21035)
+++ branches/RF-9797/ui/validator/ui/src/main/resources/META-INF/resources/org.richfaces/richfaces-csv.js 2011-01-14 17:23:26 UTC (rev 21036)
@@ -49,28 +49,15 @@
sendMessage: function (componentId, message) {
rf.Event.fire(window.document, rf.Event.MESSAGE_EVENT_TYPE, {'sourceId':componentId, 'message':message});
},
- // Converters API
- addConverter: function (converterFunctions) {
- $.extend(_converters, converterFunctions);
- },
- getConverter: function (name) {
- return _converters[name];
- },
- // Validators API
- addValidator: function (validatorFunctions) {
- $.extend(_validators, validatorFunctions);
- },
- getValidator: function (name) {
- return _validators[name];
- },
validate: function (event, id, element, converter, validators, params) {
var value = __getValue(element || id);
if (converter) {
try {
converter.options.componentId = id;
- value = getConverter([converter.name])(value, converter.options);
+ if (converter.f)
+ value = converter.f(value, converter.params);
} catch (e){
- sendMessage(id, e.message);
+ rf.csv.sendMessage(id, e);
return false;
}
}
@@ -78,13 +65,13 @@
var validatorFunction;
try {
for (i=0;i<validators.length;i++) {
- validatorFunction = getValidator(validators[i].type);
+ validatorFunction = validators[i].f;
if (validatorFunction) {
- validatorFunction(id, value, validators[i]);
+ validatorFunction(id, value, validators[i].params);
}
}
} catch (e) {
- sendMessage(id, result);
+ rf.csv.sendMessage(id, e);
return false;
}
}
@@ -105,38 +92,32 @@
}}
*/
/*
- * c: {name:, options:}
- v: [{type:, customMessage:, [validator params]}]
+ * c: {name:, params:}
+ v: [{f:, customMessage:, [validator params]}]
function form_3Atext_3Av(id, el, e, c, v, p) {
RichFaces.csv.validate(e, id, el, c, v, p);
}
*/
- addFormValidators: function (formId, callValidatorFunctions) {
-
- }
});
-})(jQuery, window.RichFaces || (window.RichFaces={}));
-
-/*
- * Converters implementation
- */
-(function($, rf) {
- RichFaces.csv.addConverter({
- "boolean": function (value, params) {
+ /*
+ * Converters implementation
+ */
+ $.extend(rf.csv, {
+ "convertBoolean": function (value, params) {
var result; value = $.trim(value).toLowerCase();
result = value=='true' ? true : value.length<1 ? null : false;
return result;
},
- "byte": function (value, params) {
+ "convertByte": function (value, params) {
var result; value = $.trim(value);
if (!rf.csv.RE_DIGITS.test(value) || (result=parseInt(value,10))<-128 || result>127) {
throw rf.csv.getMessage(params.customMessage, 'BYTE_CONVERTER_BYTE', [value, 0, params.componentId]);
}
return result;
},
- "number": function (value, params) {
+ "convertNumber": function (value, params) {
var result; value=$.trim(value);
if (isNaN(value)) {
throw rf.csv.getMessage(params.customMessage, 'NUMBER_CONVERTER_NUMBER', [value, 0, params.componentId]);
@@ -145,7 +126,7 @@
}
return result;
},
- "short": function (value, params) {
+ "convertShort": function (value, params) {
var result; value = $.trim(value);
if (!rf.csv.RE_DIGITS.test(value) || (result=parseInt(value,10))<-32768 || result>32767) {
throw rf.csv.getMessage(params.customMessage, 'SHORT_CONVERTER_SHORT', [value, 0, params.componentId]);
@@ -153,14 +134,12 @@
return result;
}
});
-})(jQuery, window.RichFaces || (window.RichFaces={}));
-
-/*
- * Validators implementation
- */
-(function($, rf) {
- RichFaces.csv.addValidator({
- "long-range": function (componentId, value, params) {
+
+ /*
+ * Validators implementation
+ */
+ $.extend(rf.csv, {
+ "validateLongRange": function (componentId, value, params) {
var type = typeof value;
if (type != "number") {
if (type != "string") {
@@ -191,7 +170,7 @@
}
}
},
- "double-range": function (componentId, value, params) {
+ "validateDoubleRange": function (componentId, value, params) {
var type = typeof value;
if (type != "number") {
if (type != "string") {
@@ -222,7 +201,7 @@
}
}
},
- "length": function (componentId, value, params) {
+ "validateLength": function (componentId, value, params) {
if (params.maximum && value.length > params.maximum) {
throw rf.csv.getMessage(params.customMessage, 'LENGTH_VALIDATOR_MAXIMUM', [params.maximum, componentId]);
}
@@ -230,7 +209,7 @@
throw rf.csv.getMessage(params.customMessage, 'LENGTH_VALIDATOR_MINIMUM', [params.minimum, componentId]);
}
},
- "regex": function (componentId, value, params) {
+ "validateRegex": function (componentId, value, params) {
if (typeof params.pattern != "string" || params.pattern.length == 0) {
throw rf.csv.getMessage(params.customMessage, 'REGEX_VALIDATOR_PATTERN_NOT_SET', []);
}
@@ -245,10 +224,11 @@
throw rf.csv.getMessage(params.customMessage, 'REGEX_VALIDATOR_NOT_MATCHED', [params.pattern]);
}
},
- "required": function (componentId, value, params) {
+ "validateRequired": function (componentId, value, params) {
if (value.length==0) {
throw rf.csv.getMessage(params.customMessage, 'UIINPUT_REQUIRED', [componentId]);
}
}
});
+
})(jQuery, window.RichFaces || (window.RichFaces={}));
\ No newline at end of file
13 years, 11 months