JBoss Rich Faces SVN: r17754 - root/ui-sandbox/panels/trunk/ui/src/main.
by richfaces-svn-commits@lists.jboss.org
Author: Alex.Kolonitsky
Date: 2010-07-07 07:28:48 -0400 (Wed, 07 Jul 2010)
New Revision: 17754
Added:
root/ui-sandbox/panels/trunk/ui/src/main/java__/
Removed:
root/ui-sandbox/panels/trunk/ui/src/main/java/
Log:
RF-8745 TogglePanel component
Copied: root/ui-sandbox/panels/trunk/ui/src/main/java__ (from rev 17753, root/ui-sandbox/panels/trunk/ui/src/main/java)
14 years, 6 months
JBoss Rich Faces SVN: r17753 - in root/ui-sandbox/panels/trunk/ui/src/main/resources/META-INF: resources and 1 other directories.
by richfaces-svn-commits@lists.jboss.org
Author: Alex.Kolonitsky
Date: 2010-07-07 07:20:44 -0400 (Wed, 07 Jul 2010)
New Revision: 17753
Added:
root/ui-sandbox/panels/trunk/ui/src/main/resources/META-INF/resources/
root/ui-sandbox/panels/trunk/ui/src/main/resources/META-INF/resources/script/
root/ui-sandbox/panels/trunk/ui/src/main/resources/META-INF/resources/script/TogglePanel.js
root/ui-sandbox/panels/trunk/ui/src/main/resources/META-INF/resources/script/TogglePanelItem.js
Log:
RF-8745 TogglePanel component
Added: root/ui-sandbox/panels/trunk/ui/src/main/resources/META-INF/resources/script/TogglePanel.js
===================================================================
--- root/ui-sandbox/panels/trunk/ui/src/main/resources/META-INF/resources/script/TogglePanel.js (rev 0)
+++ root/ui-sandbox/panels/trunk/ui/src/main/resources/META-INF/resources/script/TogglePanel.js 2010-07-07 11:20:44 UTC (rev 17753)
@@ -0,0 +1,377 @@
+/*
+ * 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 ($, rf) {
+
+ /***************************** Stuff ******************************************************************************/
+ rf.ui = rf.ui || {};
+
+ /***************************** Constructor definition *************************************************************/
+ var DEFAULT_OPTIONS = {
+ };
+
+ /**
+ * @class TogglePanel
+ * @name TogglePanel
+ *
+ * @constructor
+ * @param {String} componentId - component id
+ * @param {Hash} options - params
+ * */
+ rf.ui.TogglePanel = function(componentId, options) {
+ // call constructor of parent class
+ $super.constructor.call(this, componentId);
+ $p.attachToDom.call(this, componentId);
+ this.options = $.extend({}, DEFAULT_OPTIONS, options);
+
+ this.selectedItem = this.options.selectedItem;
+ this.switchMode = this.options.switchMode;
+ this.items = this.options.items;
+ };
+
+ var $p = {};
+
+ // Extend component class and add protected methods from parent class to our container
+ $p = rf.BaseComponent.extend(rf.BaseComponent, rf.ui.TogglePanel, $p);
+
+ var $super = rf.ui.TogglePanel.$super;
+
+ /***************************** Private Static Methods *************************************************************/
+
+ /**
+ * Fire Concealable Event
+ * */
+ function fireBeforeItemChange ($this, oldItem, newItem) {
+ return rf.Event.fireById($this.id, "beforeitemchange", {
+ id: $this.id,
+ oldItem : oldItem,
+ newItem : newItem
+ });
+ }
+
+ function fireItemChange ($this, oldItem, newItem) {
+ return new rf.Event.fireById($this.id, "itemchange", {
+ id: $this.id,
+ oldItem : oldItem,
+ newItem : newItem
+ });
+ }
+
+
+ function getEventHandler() {}
+
+ /***************************** Public Methods ********************************************************************/
+ $.extend(rf.ui.TogglePanel.prototype, (function () {
+ return {
+ // class name
+ name:"TogglePanel",
+
+ // public api
+ /**
+ * @methodOf
+ * @name TogglePanel#getSelectItem
+ *
+ * @return {String} name of current selected panel item
+ */
+ getSelectItem: function () {
+ return this.selectedItem;
+ },
+
+ getValueInputId: function () {
+ return this.id + "-value"
+ },
+
+ /**
+ * @methodOf
+ * @name TogglePanel#switchToItem
+ *
+ * @param {String} name - panel item name to switch
+ * @return {Boolean} - always false
+ */
+ switchToItem: function (name) {
+ var oldPanel = this.getItemByName(this.getSelectItem());
+ var newPanel = name ? this.getItemByName(name)
+ : this.getItem(this.nextItem());
+
+ var continueProcess = fireBeforeItemChange(this, oldPanel, newPanel);
+ if (!continueProcess) {
+ return false
+ }
+
+ this.switchItems(oldPanel, newPanel);
+
+ return false;
+ },
+
+ setSelectedItem : function (name) {
+ rf.getDomElement(this.getValueInputId()).value = name;
+ this.selectedItem = name;
+ },
+
+ /**
+ * @param {TogglePanelItem} oldPanel
+ * @param {TogglePanelItem} newPanel
+ *
+ * @return {void}
+ * */
+ switchItems : function (oldPanel, newPanel) {
+ if (this.switchMode == "server") {
+ return this.switchItems_server(oldPanel, newPanel);
+ } else if (this.switchMode == "ajax") {
+ return this.switchItems_ajax(oldPanel, newPanel);
+ } else if (this.switchMode == "client") {
+ return this.switchItems_client(oldPanel, newPanel);
+ } else {
+ rf.log.error("TogglePanel.switchItems : unknown switchMode (" + this.switchMode + ")");
+ }
+ },
+
+ /**
+ * @param {TogglePanelItem} oldPanel
+ * @param {TogglePanelItem} newPanel
+ *
+ * @return {void}
+ * */
+ switchItems_server : function (oldPanel, newPanel) {
+ var continueProcess = oldPanel.leave();
+ if (!continueProcess) {
+ return false;
+ }
+
+ this.setSelectedItem(newPanel.getName());
+
+ rf.submitForm(this.getParentForm(), null, this.getParameters(newPanel));
+
+ return false;
+ },
+
+ getParentForm : function () {
+ return $(RichFaces.getDomElement(this.id)).parent('form');
+ },
+
+ getParameters : function (newPanel) {
+ return {"parameters" : this.getServerParams(newPanel)};
+ },
+
+ getServerParams : function (newPanel) {
+ var params = {};
+// params[this.getValueInputId()] = newPanel.getName();
+
+ return params;
+ },
+
+ /**
+ * @param {TogglePanelItem} oldPanel
+ * @param {TogglePanelItem} newPanel
+ *
+ * @return {undefined}
+ * */
+ switchItems_ajax : function (oldPanel, newPanel) {
+ var options = $.extend({}, this.options["ajax"], {}/*this.getParameters(newPanel)*/);
+
+ this.setSelectedItem(newPanel.getName());
+ rf.ajax(this.id, null, options);
+ this.setSelectedItem(oldPanel.getName());
+
+ return false;
+ },
+
+ /**
+ * please, remove this method when client side ajax events will be added
+ *
+ * */
+ onCompleteHandler : function (oldItemName, newItemName) {
+ var oldItem = this.getItemByName(oldItemName);
+ var newItem = this.getItemByName(newItemName);
+
+ this.switchItems_client(oldItem, newItem);
+ },
+
+ /**
+ * @param {TogglePanelItem} oldPanel
+ * @param {TogglePanelItem} newPanel
+ *
+ * @return {undefined} false - if process has been terminated
+ * */
+ switchItems_client : function (oldPanel, newPanel) {
+ var continueProcess = oldPanel.leave();
+ if (!continueProcess) {
+ return false;
+ }
+
+ this.setSelectedItem(newPanel.getName());
+
+ newPanel.enter();
+ fireItemChange(this, oldPanel, newPanel);
+ },
+
+
+
+ /**
+ * @methodOf
+ * @name TogglePanel#getItems
+ *
+ * @return {TogglePanelItem[]} all defined panel items
+ */
+ getItems : function () {
+ return this.items;
+ },
+
+ /**
+ * @methodOf
+ * @name TogglePanel#getItemsNames
+ *
+ * @return {String[]} names of all defined items
+ */
+ getItemsNames: function () {
+ var res = [];
+ for (var item in this.items) {
+ res.push(this.items[item].getName());
+ }
+
+ return res;
+ },
+
+ /**
+ * @methodOf
+ * @name TogglePanel#nextItem
+ *
+ * @param {String} [itemName = selectedItem]
+ * @return {String} name of next panel item
+ */
+ nextItem: function (itemName) {
+ return this.getItemName(this.getItemIndex(itemName) + 1);
+ },
+
+ /**
+ * @methodOf
+ * @name TogglePanel#firstItem
+ *
+ * @return {String} name of first panel item
+ */
+ firstItem: function () {
+ return this.getItemName(0);
+ },
+
+ /**
+ * @methodOf
+ * @name TogglePanel#lastItem
+ *
+ * @return {String} name of last panel item
+ */
+ lastItem: function () {
+ return this.getItemName(this.items.length - 1);
+ },
+
+ /**
+ * @methodOf
+ * @name TogglePanel#prevItem
+ *
+ * @param {String} [itemName = selectedItem]
+ * @return {String} name of prev panel item
+ */
+ prevItem: function (itemName) {
+ var itemIndex = this.getItemIndex(itemName);
+ if (itemIndex == -1) {
+ return this.firstItem();
+ }
+ return this.getItemName((this.items.length + itemIndex - 1) % this.items.length);
+ },
+
+
+
+ // event handlers
+ /**
+ * @methodOf
+ * @name TogglePanel#oncomplete
+ */
+ oncomplete: function () {
+ // TODO implement
+ },
+
+ /**
+ * @methodOf
+ * @name TogglePanel#onbeforedomupdate
+ */
+ onbeforedomupdate: function () {
+ // TODO implement
+ },
+
+ /**
+ * @methodOf
+ * @name TogglePanel#onitemchange
+ */
+ onitemchange: function () {
+ // TODO implement
+ },
+
+ /**
+ * @methodOf
+ * @name TogglePanel#onitemchanged
+ */
+ onitemchanged: function () {
+ // TODO implement
+ },
+
+ // private methods
+ getItemName : function (index) {
+ return this.getItem(index).getName();
+ },
+
+ getItemByName : function (name) {
+ return this.getItem(this.getItemIndex(name));
+ },
+
+ getItemIndex : function (itemName) {
+ var name = itemName || this.selectedItem;
+ for (var i = 0; i < this.items.length; i++) {
+ if (this.items[i].getName() === name) {
+ return i;
+ }
+ }
+
+ rf.log.warn("TogglePanel.getItemIndex: item with name '" + itemName + "' not found");
+ return -1;
+ },
+
+ /**
+ * @param {Number} index - array index
+ *
+ * @return {TogglePanelItem}
+ * */
+ getItem : function (index) {
+ if (index >= this.items.length || index < 0) {
+ return this.items[0];
+ } else {
+ return this.items[index]
+ }
+ },
+
+ // class stuff
+ destroy: function () {
+ // rf.Event.unbindById(this.options.buttonId, "."+this.namespace);
+ // rf.Event.unbindById(this.componentId, "."+this.namespace);
+ // $super.destroy.call(this);
+ }
+ };
+ })());
+})(jQuery, RichFaces);
Added: root/ui-sandbox/panels/trunk/ui/src/main/resources/META-INF/resources/script/TogglePanelItem.js
===================================================================
--- root/ui-sandbox/panels/trunk/ui/src/main/resources/META-INF/resources/script/TogglePanelItem.js (rev 0)
+++ root/ui-sandbox/panels/trunk/ui/src/main/resources/META-INF/resources/script/TogglePanelItem.js 2010-07-07 11:20:44 UTC (rev 17753)
@@ -0,0 +1,99 @@
+/*
+ * 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 ($, rf) {
+
+ /***************************** Stuff ******************************************************************************/
+ rf.ui = rf.ui || {};
+
+ /***************************** Constructor definition *************************************************************/
+ var DEFAULT_OPTIONS = {
+ };
+
+ rf.ui.TogglePanelItem = function(componentId, options) {
+ // call constructor of parent class
+ $super.constructor.call(this, componentId);
+ $p.attachToDom.call(this, componentId);
+ this.options = $.extend({}, DEFAULT_OPTIONS, options);
+
+ this.name = this.options.name;
+ this.switchMode = this.options.switchMode;
+ };
+
+ // Extend component class and add protected methods from parent class to our container
+ var $p = rf.BaseComponent.extend(rf.BaseComponent, rf.ui.TogglePanelItem, {});
+
+ // define super class link
+ var $super = rf.ui.TogglePanelItem.$super;
+
+ /***************************** Private Static Methods *************************************************************/
+
+ function fireLeave ($this) {
+ return rf.Event.fireById($this.id, "leave");
+ }
+
+ function fireEnter ($this) {
+ return rf.Event.fireById($this.id, "enter");
+ }
+
+ /***************************** Public Methods ********************************************************************/
+ $.extend(rf.ui.TogglePanelItem.prototype, (function () {
+ return {
+ // class name
+ name:"TogglePanelItem",
+
+ // public api
+ /**
+ * @methodOf
+ * @name TogglePanelItem#getName
+ *
+ * @return {String} panel item name
+ */
+ getName: function () {
+ return this.options.name;
+ },
+
+ enter : function () {
+ rf.getDomElement(this.id).style.display = "block";
+
+ return fireEnter(this);
+ },
+
+ leave : function () {
+ var continueProcess = fireLeave(this);
+ if (!continueProcess) {
+ return false;
+ }
+
+ rf.getDomElement(this.id).style.display = "none";
+ return true;
+ },
+
+ // class stuff
+ destroy: function () {
+// rf.Event.unbindById(this.options.buttonId, "."+this.namespace);
+// rf.Event.unbindById(this.componentId, "."+this.namespace);
+ $super.destroy.call(this);
+ }
+ };
+ })());
+})(jQuery, RichFaces);
14 years, 6 months
JBoss Rich Faces SVN: r17752 - in root/ui-sandbox/panels/trunk: demo and 3 other directories.
by richfaces-svn-commits@lists.jboss.org
Author: Alex.Kolonitsky
Date: 2010-07-07 07:01:57 -0400 (Wed, 07 Jul 2010)
New Revision: 17752
Added:
root/ui-sandbox/panels/trunk/ui/checkstyle-suppressions.xml
root/ui-sandbox/panels/trunk/ui/src/main/resources/META-INF/pn.faces-config.xml
root/ui-sandbox/panels/trunk/ui/src/main/resources/META-INF/pn.taglib.xml
Removed:
root/ui-sandbox/panels/trunk/ui/src/main/resources/META-INF/faces-config.xml
root/ui-sandbox/panels/trunk/ui/src/main/resources/META-INF/panels.taglib.xml
Modified:
root/ui-sandbox/panels/trunk/
root/ui-sandbox/panels/trunk/demo/
root/ui-sandbox/panels/trunk/demo/pom.xml
root/ui-sandbox/panels/trunk/parent/
root/ui-sandbox/panels/trunk/ui/
root/ui-sandbox/panels/trunk/ui/pom.xml
Log:
RF-8745 TogglePanel component
Property changes on: root/ui-sandbox/panels/trunk
___________________________________________________________________
Name: svn:ignore
+ old-tabPanel
old-togglePanel
Property changes on: root/ui-sandbox/panels/trunk/demo
___________________________________________________________________
Name: svn:ignore
+ target
Modified: root/ui-sandbox/panels/trunk/demo/pom.xml
===================================================================
--- root/ui-sandbox/panels/trunk/demo/pom.xml 2010-07-07 09:12:12 UTC (rev 17751)
+++ root/ui-sandbox/panels/trunk/demo/pom.xml 2010-07-07 11:01:57 UTC (rev 17752)
@@ -5,9 +5,9 @@
<modelVersion>4.0.0</modelVersion>
<groupId>org.richfaces.ui.panels</groupId>
- <artifactId>togglePanel-demo</artifactId>
+ <artifactId>panels-demo</artifactId>
<version>4.0.0-SNAPSHOT</version>
- <name>Richfaces UI Components: togglePanel demo</name>
+ <name>Richfaces UI Components: panels demo</name>
<packaging>war</packaging>
<url>http://jboss.org/richfaces</url>
Property changes on: root/ui-sandbox/panels/trunk/parent
___________________________________________________________________
Name: svn:ignore
+ target
Property changes on: root/ui-sandbox/panels/trunk/ui
___________________________________________________________________
Name: svn:ignore
+ target
Added: root/ui-sandbox/panels/trunk/ui/checkstyle-suppressions.xml
===================================================================
--- root/ui-sandbox/panels/trunk/ui/checkstyle-suppressions.xml (rev 0)
+++ root/ui-sandbox/panels/trunk/ui/checkstyle-suppressions.xml 2010-07-07 11:01:57 UTC (rev 17752)
@@ -0,0 +1,9 @@
+<?xml version="1.0"?>
+
+<!DOCTYPE suppressions PUBLIC
+ "-//Puppy Crawl//DTD Suppressions 1.0//EN"
+ "http://www.puppycrawl.com/dtds/suppressions_1_0.dtd">
+
+<suppressions>
+ <suppress checks="IllegalCatch" files="AbstractTogglePanel.java" />
+</suppressions>
Modified: root/ui-sandbox/panels/trunk/ui/pom.xml
===================================================================
--- root/ui-sandbox/panels/trunk/ui/pom.xml 2010-07-07 09:12:12 UTC (rev 17751)
+++ root/ui-sandbox/panels/trunk/ui/pom.xml 2010-07-07 11:01:57 UTC (rev 17752)
@@ -1,5 +1,4 @@
<?xml version="1.0" encoding="UTF-8"?>
-
<!--
JBoss, Home of Professional Open Source Copyright 2010, Red Hat,
Inc. and individual contributors by the @authors tag. See the
@@ -31,7 +30,7 @@
<groupId>org.richfaces.ui.panels</groupId>
<artifactId>richfaces-ui-panels-ui</artifactId>
- <name>Richfaces UI Components: togglePanel ui</name>
+ <name>Richfaces UI Components: panels ui</name>
<packaging>jar</packaging>
<dependencyManagement>
@@ -201,7 +200,7 @@
</configuration>
</plugin>
- <plugin>
+<!-- <plugin>
<groupId>org.richfaces.cdk</groupId>
<artifactId>maven-cdk-plugin</artifactId>
<configuration>
@@ -223,7 +222,7 @@
</goals>
</execution>
</executions>
- </plugin>
+ </plugin>-->
</plugins>
</build>
Deleted: root/ui-sandbox/panels/trunk/ui/src/main/resources/META-INF/faces-config.xml
===================================================================
--- root/ui-sandbox/panels/trunk/ui/src/main/resources/META-INF/faces-config.xml 2010-07-07 09:12:12 UTC (rev 17751)
+++ root/ui-sandbox/panels/trunk/ui/src/main/resources/META-INF/faces-config.xml 2010-07-07 11:01:57 UTC (rev 17752)
@@ -1,54 +0,0 @@
-<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
-<faces-config version="2.0" metadata-complete="false"
- xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-facesconfig_2_0.xsd"
- xmlns="http://java.sun.com/xml/ns/javaee" xmlns:cdk="http://richfaces.org/cdk/extensions"
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
- <component>
- <component-type>org.richfaces.panels.Div</component-type>
- <component-class>org.richfaces.component.UIDivPanel</component-class>
- <property>
- <description>The value binding expression used to wire up this
- component to a component property of a JavaBean class
- </description>
- <property-name>binding</property-name>
- <property-class>javax.faces.component.UIComponent</property-class>
- </property>
- <property>
- <description>
- The component identifier for this component. This value must be
- unique within the closest parent component that is a naming
- container.
- </description>
- <display-name>Component Identifier</display-name>
- <icon/>
- <property-name>id</property-name>
- <property-class>java.lang.String</property-class>
- </property>
- <property>
- <description>
- Flag indicating whether or not this component should be rendered
- (during Render Response Phase), or processed on any subsequent
- form submit. The default value for this property is true.
- </description>
- <display-name>Rendered Flag</display-name>
- <icon/>
- <property-name>rendered</property-name>
- <property-class>boolean</property-class>
- </property>
- </component>
-
- <render-kit>
- <render-kit-id>HTML_BASIC</render-kit-id>
- <renderer>
- <component-family>org.richfaces.panels.Div</component-family>
- <renderer-type>org.richfaces.panels.DivRenderer</renderer-type>
- <renderer-class>org.richfaces.renderkit.html.DivPanelRenderer</renderer-class>
- </renderer>
- </render-kit>
- <faces-config-extension>
- <cdk:taglib>
- <cdk:shortName>panels</cdk:shortName>
- <cdk:uri>http://richfaces.org/panels</cdk:uri>
- </cdk:taglib>
- </faces-config-extension>
-</faces-config>
Deleted: root/ui-sandbox/panels/trunk/ui/src/main/resources/META-INF/panels.taglib.xml
===================================================================
--- root/ui-sandbox/panels/trunk/ui/src/main/resources/META-INF/panels.taglib.xml 2010-07-07 09:12:12 UTC (rev 17751)
+++ root/ui-sandbox/panels/trunk/ui/src/main/resources/META-INF/panels.taglib.xml 2010-07-07 11:01:57 UTC (rev 17752)
@@ -1,82 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-
-<facelet-taglib xmlns="http://java.sun.com/xml/ns/javaee"
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xsi:schemaLocation="http://java.sun.com/xml/ns/javaee
- http://java.sun.com/xml/ns/javaee/web-facelettaglibrary_2_0.xsd" version="2.0" id="a4j">
- <namespace>http://richfaces.org/panels</namespace>
- <tag>
- <tag-name>divPanel</tag-name>
- <component>
- <component-type>org.richfaces.panels.Div</component-type>
- <renderer-type>org.richfaces.panels.DivRenderer</renderer-type>
- </component>
-
- <!-- JSF -->
- <attribute>
- <description>The value binding expression used to wire up this component to a component property of a JavaBean class</description>
- <name>binding</name>
- <type>javax.faces.component.UIComponent</type>
- </attribute>
- <attribute>
- <description>The component identifier for this component. This value must be unique within the closest parent component that is a naming container.</description>
- <name>id</name>
- <type>java.lang.String</type>
- </attribute>
- <attribute>
- <description>Flag indicating whether or not this component should be rendered (during Render Response Phase), or processed on any subsequent form submit. The default value for this property is true.</description>
- <name>rendered</name>
- <type>boolean</type>
- </attribute>
-
- <!-- HTML JS -->
- <attribute>
- <name>lang</name>
- <type>java.lang.String</type>
- </attribute>
- <attribute>
- <name>onclick</name>
- <type>java.lang.String</type>
- </attribute>
- <attribute>
- <name>ondblclick</name>
- <type>java.lang.String</type>
- </attribute>
- <attribute>
- <name>onmousedown</name>
- <type>java.lang.String</type>
- </attribute>
- <attribute>
- <name>onmousemove</name>
- <type>java.lang.String</type>
- </attribute>
- <attribute>
- <name>onmouseout</name>
- <type>java.lang.String</type>
- </attribute>
- <attribute>
- <name>onmouseover</name>
- <type>java.lang.String</type>
- </attribute>
- <attribute>
- <name>onmouseup</name>
- <type>java.lang.String</type>
- </attribute>
- <attribute>
- <name>title</name>
- <type>java.lang.String</type>
- </attribute>
- <attribute>
- <name>style</name>
- <type>java.lang.String</type>
- </attribute>
- <attribute>
- <name>styleClass</name>
- <type>java.lang.String</type>
- </attribute>
- <attribute>
- <name>dir</name>
- <type>java.lang.String</type>
- </attribute>
- </tag>
-</facelet-taglib>
Copied: root/ui-sandbox/panels/trunk/ui/src/main/resources/META-INF/pn.faces-config.xml (from rev 17661, root/ui-sandbox/panels/trunk/ui/src/main/resources/META-INF/faces-config.xml)
===================================================================
--- root/ui-sandbox/panels/trunk/ui/src/main/resources/META-INF/pn.faces-config.xml (rev 0)
+++ root/ui-sandbox/panels/trunk/ui/src/main/resources/META-INF/pn.faces-config.xml 2010-07-07 11:01:57 UTC (rev 17752)
@@ -0,0 +1,371 @@
+<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
+<faces-config version="2.0" metadata-complete="false"
+ xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-facesconfig_2_0.xsd"
+ xmlns="http://java.sun.com/xml/ns/javaee"
+ xmlns:cdk="http://richfaces.org/cdk/extensions"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
+
+ <behavior>
+ <behavior-id>org.richfaces.component.behavior.ToggleControl</behavior-id>
+ <behavior-class>org.richfaces.component.behavior.ToggleControl</behavior-class>
+ </behavior>
+
+ <component>
+ <component-type>org.richfaces.panels.DivPanel</component-type>
+ <component-class>org.richfaces.component.html.HtmlDivPanel</component-class>
+ <property>
+ <description></description>
+ <property-name>lang</property-name>
+ <property-class>java.lang.String</property-class>
+ </property>
+ <property>
+ <description></description>
+ <property-name>onclick</property-name>
+ <property-class>java.lang.String</property-class>
+ </property>
+ <property>
+ <description></description>
+ <property-name>ondblclick</property-name>
+ <property-class>java.lang.String</property-class>
+ </property>
+ <property>
+ <description></description>
+ <property-name>onmousedown</property-name>
+ <property-class>java.lang.String</property-class>
+ </property>
+ <property>
+ <description></description>
+ <property-name>onmousemove</property-name>
+ <property-class>java.lang.String</property-class>
+ </property>
+ <property>
+ <description></description>
+ <property-name>onmouseout</property-name>
+ <property-class>java.lang.String</property-class>
+ </property>
+ <property>
+ <description></description>
+ <property-name>onmouseover</property-name>
+ <property-class>java.lang.String</property-class>
+ </property>
+ <property>
+ <description></description>
+ <property-name>onmouseup</property-name>
+ <property-class>java.lang.String</property-class>
+ </property>
+ <property>
+ <description></description>
+ <property-name>title</property-name>
+ <property-class>java.lang.String</property-class>
+ </property>
+ <property>
+ <description></description>
+ <property-name>style</property-name>
+ <property-class>java.lang.String</property-class>
+ </property>
+ <property>
+ <description></description>
+ <property-name>styleClass</property-name>
+ <property-class>java.lang.String</property-class>
+ </property>
+ <property>
+ <description></description>
+ <property-name>dir</property-name>
+ <property-class>java.lang.String</property-class>
+ </property>
+ <property>
+ <description>Long long text</description>
+ <property-name>id</property-name>
+ <property-class>java.lang.String</property-class>
+ </property>
+ <property>
+ <description>binding description</description>
+ <property-name>binding</property-name>
+ <property-class>javax.faces.component.UIComponent</property-class>
+ </property>
+ <property>
+ <description>I don't know maybe some thing strange</description>
+ <property-name>rendered</property-name>
+ <property-class>boolean</property-class>
+ </property>
+
+ </component>
+ <component>
+ <component-type>org.richfaces.panels.TogglePanel</component-type>
+ <component-class>org.richfaces.component.html.HtmlTogglePanel</component-class>
+ <property>
+ <description></description>
+ <property-name>lang</property-name>
+ <property-class>java.lang.String</property-class>
+ </property>
+ <property>
+ <description></description>
+ <property-name>onclick</property-name>
+ <property-class>java.lang.String</property-class>
+ </property>
+ <property>
+ <description></description>
+ <property-name>ondblclick</property-name>
+ <property-class>java.lang.String</property-class>
+ </property>
+ <property>
+ <description></description>
+ <property-name>onmousedown</property-name>
+ <property-class>java.lang.String</property-class>
+ </property>
+ <property>
+ <description></description>
+ <property-name>onmousemove</property-name>
+ <property-class>java.lang.String</property-class>
+ </property>
+ <property>
+ <description></description>
+ <property-name>onmouseout</property-name>
+ <property-class>java.lang.String</property-class>
+ </property>
+ <property>
+ <description></description>
+ <property-name>onmouseover</property-name>
+ <property-class>java.lang.String</property-class>
+ </property>
+ <property>
+ <description></description>
+ <property-name>onmouseup</property-name>
+ <property-class>java.lang.String</property-class>
+ </property>
+ <property>
+ <description></description>
+ <property-name>title</property-name>
+ <property-class>java.lang.String</property-class>
+ </property>
+ <property>
+ <description></description>
+ <property-name>style</property-name>
+ <property-class>java.lang.String</property-class>
+ </property>
+ <property>
+ <description></description>
+ <property-name>styleClass</property-name>
+ <property-class>java.lang.String</property-class>
+ </property>
+ <property>
+ <description></description>
+ <property-name>dir</property-name>
+ <property-class>java.lang.String</property-class>
+ </property>
+ <property>
+ <description>Long long text</description>
+ <property-name>id</property-name>
+ <property-class>java.lang.String</property-class>
+ </property>
+ <property>
+ <description>binding description</description>
+ <property-name>binding</property-name>
+ <property-class>javax.faces.component.UIComponent</property-class>
+ </property>
+ <property>
+ <description>I don't know maybe some thing strange</description>
+ <property-name>rendered</property-name>
+ <property-class>boolean</property-class>
+ </property>
+ <property>
+ <description></description>
+ <property-name>oncomplete</property-name>
+ <property-class>java.lang.String</property-class>
+ </property>
+ <property>
+ <description></description>
+ <property-name>onbeforedomupdate</property-name>
+ <property-class>java.lang.String</property-class>
+ </property>
+ <property>
+ <description></description>
+ <property-name>onitemchange</property-name>
+ <property-class>java.lang.String</property-class>
+ </property>
+ <property>
+ <description></description>
+ <property-name>onitemchanged</property-name>
+ <property-class>java.lang.String</property-class>
+ </property>
+ <property>
+ <description></description>
+ <property-name>switchType</property-name>
+ <property-class>org.richfaces.component.Method</property-class>
+ </property>
+ <property>
+ <description></description>
+ <property-name>selectedItem</property-name>
+ <property-class>java.lang.String</property-class>
+ </property>
+ <property>
+ <description></description>
+ <property-name>bypassUpdates</property-name>
+ <property-class>boolean</property-class>
+ </property>
+ <property>
+ <description></description>
+ <property-name>limitToList</property-name>
+ <property-class>boolean</property-class>
+ </property>
+ <property>
+ <description></description>
+ <property-name>data</property-name>
+ <property-class>java.lang.Object</property-class>
+ </property>
+ <property>
+ <description></description>
+ <property-name>status</property-name>
+ <property-class>java.lang.String</property-class>
+ </property>
+ <property>
+ <description></description>
+ <property-name>execute</property-name>
+ <property-class>java.lang.Object</property-class>
+ </property>
+ <property>
+ <description></description>
+ <property-name>render</property-name>
+ <property-class>java.lang.Object</property-class>
+ </property>
+ <property>
+ <description></description>
+ <property-name>immediate</property-name>
+ <property-class>boolean</property-class>
+ </property>
+ <property>
+ <description></description>
+ <property-name>selectedItemChangeListener</property-name>
+ <property-class>javax.el.MethodExpression</property-class>
+ </property>
+
+ </component>
+ <component>
+ <component-type>org.richfaces.panels.TogglePanelItem</component-type>
+ <component-class>org.richfaces.component.html.HtmlTogglePanelItem</component-class>
+ <property>
+ <description></description>
+ <property-name>lang</property-name>
+ <property-class>java.lang.String</property-class>
+ </property>
+ <property>
+ <description></description>
+ <property-name>onclick</property-name>
+ <property-class>java.lang.String</property-class>
+ </property>
+ <property>
+ <description></description>
+ <property-name>ondblclick</property-name>
+ <property-class>java.lang.String</property-class>
+ </property>
+ <property>
+ <description></description>
+ <property-name>onmousedown</property-name>
+ <property-class>java.lang.String</property-class>
+ </property>
+ <property>
+ <description></description>
+ <property-name>onmousemove</property-name>
+ <property-class>java.lang.String</property-class>
+ </property>
+ <property>
+ <description></description>
+ <property-name>onmouseout</property-name>
+ <property-class>java.lang.String</property-class>
+ </property>
+ <property>
+ <description></description>
+ <property-name>onmouseover</property-name>
+ <property-class>java.lang.String</property-class>
+ </property>
+ <property>
+ <description></description>
+ <property-name>onmouseup</property-name>
+ <property-class>java.lang.String</property-class>
+ </property>
+ <property>
+ <description></description>
+ <property-name>title</property-name>
+ <property-class>java.lang.String</property-class>
+ </property>
+ <property>
+ <description></description>
+ <property-name>style</property-name>
+ <property-class>java.lang.String</property-class>
+ </property>
+ <property>
+ <description></description>
+ <property-name>styleClass</property-name>
+ <property-class>java.lang.String</property-class>
+ </property>
+ <property>
+ <description></description>
+ <property-name>dir</property-name>
+ <property-class>java.lang.String</property-class>
+ </property>
+ <property>
+ <description>Long long text</description>
+ <property-name>id</property-name>
+ <property-class>java.lang.String</property-class>
+ </property>
+ <property>
+ <description>binding description</description>
+ <property-name>binding</property-name>
+ <property-class>javax.faces.component.UIComponent</property-class>
+ </property>
+ <property>
+ <description>I don't know maybe some thing strange</description>
+ <property-name>rendered</property-name>
+ <property-class>boolean</property-class>
+ </property>
+ <property>
+ <description></description>
+ <property-name>name</property-name>
+ <property-class>java.lang.String</property-class>
+ </property>
+ <property>
+ <description></description>
+ <property-name>switchType</property-name>
+ <property-class>org.richfaces.component.Method</property-class>
+ </property>
+ <property>
+ <description></description>
+ <property-name>onenter</property-name>
+ <property-class>java.lang.String</property-class>
+ </property>
+ <property>
+ <description></description>
+ <property-name>onleave</property-name>
+ <property-class>java.lang.String</property-class>
+ </property>
+
+ </component>
+
+
+ <render-kit>
+ <render-kit-id>HTML_BASIC</render-kit-id>
+ <renderer>
+ <component-family>org.richfaces.panels.DivPanel</component-family>
+ <renderer-type>org.richfaces.panels.DivPanelRenderer</renderer-type>
+ <renderer-class>org.richfaces.renderkit.html.DivPanelRenderer</renderer-class>
+ </renderer>
+ <renderer>
+ <component-family>org.richfaces.panels.TogglePanel</component-family>
+ <renderer-type>org.richfaces.panels.TogglePanelRenderer</renderer-type>
+ <renderer-class>org.richfaces.renderkit.html.TogglePanelRenderer</renderer-class>
+ </renderer>
+ <renderer>
+ <component-family>org.richfaces.panels.TogglePanelItem</component-family>
+ <renderer-type>org.richfaces.panels.TogglePanelItemRenderer</renderer-type>
+ <renderer-class>org.richfaces.renderkit.html.TogglePanelItemRenderer</renderer-class>
+ </renderer>
+
+ </render-kit>
+
+ <faces-config-extension>
+ <cdk:taglib>
+ <cdk:shortName></cdk:shortName>
+ <cdk:uri></cdk:uri>
+ </cdk:taglib>
+ </faces-config-extension>
+</faces-config>
Copied: root/ui-sandbox/panels/trunk/ui/src/main/resources/META-INF/pn.taglib.xml (from rev 17661, root/ui-sandbox/panels/trunk/ui/src/main/resources/META-INF/panels.taglib.xml)
===================================================================
--- root/ui-sandbox/panels/trunk/ui/src/main/resources/META-INF/pn.taglib.xml (rev 0)
+++ root/ui-sandbox/panels/trunk/ui/src/main/resources/META-INF/pn.taglib.xml 2010-07-07 11:01:57 UTC (rev 17752)
@@ -0,0 +1,398 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<facelet-taglib xmlns="http://java.sun.com/xml/ns/javaee"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://java.sun.com/xml/ns/javaee
+ http://java.sun.com/xml/ns/javaee/web-facelettaglibrary_2_0.xsd" version="2.0" id="pn">
+ <namespace>http://richfaces.org/panels</namespace>
+
+ <tag>
+ <tag-name>toggleControl</tag-name>
+ <behavior>
+ <behavior-id>org.richfaces.component.behavior.ToggleControl</behavior-id>
+ </behavior>
+ </tag>
+ <tag>
+ <tag-name>divPanel</tag-name>
+ <component>
+ <component-type>org.richfaces.panels.DivPanel</component-type>
+ <renderer-type>org.richfaces.panels.DivPanelRenderer</renderer-type>
+
+ </component>
+ <attribute>
+ <description></description>
+ <name>lang</name>
+ <type>java.lang.String</type>
+ </attribute>
+ <attribute>
+ <description></description>
+ <name>onclick</name>
+ <type>java.lang.String</type>
+ </attribute>
+ <attribute>
+ <description></description>
+ <name>ondblclick</name>
+ <type>java.lang.String</type>
+ </attribute>
+ <attribute>
+ <description></description>
+ <name>onmousedown</name>
+ <type>java.lang.String</type>
+ </attribute>
+ <attribute>
+ <description></description>
+ <name>onmousemove</name>
+ <type>java.lang.String</type>
+ </attribute>
+ <attribute>
+ <description></description>
+ <name>onmouseout</name>
+ <type>java.lang.String</type>
+ </attribute>
+ <attribute>
+ <description></description>
+ <name>onmouseover</name>
+ <type>java.lang.String</type>
+ </attribute>
+ <attribute>
+ <description></description>
+ <name>onmouseup</name>
+ <type>java.lang.String</type>
+ </attribute>
+ <attribute>
+ <description></description>
+ <name>title</name>
+ <type>java.lang.String</type>
+ </attribute>
+ <attribute>
+ <description></description>
+ <name>style</name>
+ <type>java.lang.String</type>
+ </attribute>
+ <attribute>
+ <description></description>
+ <name>styleClass</name>
+ <type>java.lang.String</type>
+ </attribute>
+ <attribute>
+ <description></description>
+ <name>dir</name>
+ <type>java.lang.String</type>
+ </attribute>
+ <attribute>
+ <description>Long long text</description>
+ <name>id</name>
+ <type>java.lang.String</type>
+ </attribute>
+ <attribute>
+ <description>binding description</description>
+ <name>binding</name>
+ <type>javax.faces.component.UIComponent</type>
+ </attribute>
+ <attribute>
+ <description>I don't know maybe some thing strange</description>
+ <name>rendered</name>
+ <type>boolean</type>
+ </attribute>
+
+ </tag>
+
+ <tag>
+ <tag-name>togglePanel</tag-name>
+ <component>
+ <component-type>org.richfaces.panels.TogglePanel</component-type>
+ <renderer-type>org.richfaces.panels.TogglePanelRenderer</renderer-type>
+ <handler-class>org.richfaces.taglib.TogglePanelTagHandler</handler-class>
+ </component>
+ <attribute>
+ <description></description>
+ <name>lang</name>
+ <type>java.lang.String</type>
+ </attribute>
+ <attribute>
+ <description></description>
+ <name>onclick</name>
+ <type>java.lang.String</type>
+ </attribute>
+ <attribute>
+ <description></description>
+ <name>ondblclick</name>
+ <type>java.lang.String</type>
+ </attribute>
+ <attribute>
+ <description></description>
+ <name>onmousedown</name>
+ <type>java.lang.String</type>
+ </attribute>
+ <attribute>
+ <description></description>
+ <name>onmousemove</name>
+ <type>java.lang.String</type>
+ </attribute>
+ <attribute>
+ <description></description>
+ <name>onmouseout</name>
+ <type>java.lang.String</type>
+ </attribute>
+ <attribute>
+ <description></description>
+ <name>onmouseover</name>
+ <type>java.lang.String</type>
+ </attribute>
+ <attribute>
+ <description></description>
+ <name>onmouseup</name>
+ <type>java.lang.String</type>
+ </attribute>
+ <attribute>
+ <description></description>
+ <name>title</name>
+ <type>java.lang.String</type>
+ </attribute>
+ <attribute>
+ <description></description>
+ <name>style</name>
+ <type>java.lang.String</type>
+ </attribute>
+ <attribute>
+ <description></description>
+ <name>styleClass</name>
+ <type>java.lang.String</type>
+ </attribute>
+ <attribute>
+ <description></description>
+ <name>dir</name>
+ <type>java.lang.String</type>
+ </attribute>
+ <attribute>
+ <description>Long long text</description>
+ <name>id</name>
+ <type>java.lang.String</type>
+ </attribute>
+ <attribute>
+ <description>binding description</description>
+ <name>binding</name>
+ <type>javax.faces.component.UIComponent</type>
+ </attribute>
+ <attribute>
+ <description>I don't know maybe some thing strange</description>
+ <name>rendered</name>
+ <type>boolean</type>
+ </attribute>
+ <attribute>
+ <description></description>
+ <name>oncomplete</name>
+ <type>java.lang.String</type>
+ </attribute>
+ <attribute>
+ <description></description>
+ <name>onbeforedomupdate</name>
+ <type>java.lang.String</type>
+ </attribute>
+ <attribute>
+ <description></description>
+ <name>onitemchange</name>
+ <type>java.lang.String</type>
+ </attribute>
+ <attribute>
+ <description></description>
+ <name>onitemchanged</name>
+ <type>java.lang.String</type>
+ </attribute>
+ <attribute>
+ <description></description>
+ <name>switchType</name>
+ <type>org.richfaces.component.Method</type>
+ </attribute>
+ <attribute>
+ <description></description>
+ <name>selectedItem</name>
+ <type>java.lang.String</type>
+ </attribute>
+ <attribute>
+ <description></description>
+ <name>bypassUpdates</name>
+ <type>boolean</type>
+ </attribute>
+ <attribute>
+ <description></description>
+ <name>limitToList</name>
+ <type>boolean</type>
+ </attribute>
+ <attribute>
+ <description></description>
+ <name>data</name>
+ <type>java.lang.Object</type>
+ </attribute>
+ <attribute>
+ <description></description>
+ <name>status</name>
+ <type>java.lang.String</type>
+ </attribute>
+ <attribute>
+ <description></description>
+ <name>execute</name>
+ <type>java.lang.Object</type>
+ </attribute>
+ <attribute>
+ <description></description>
+ <name>render</name>
+ <type>java.lang.Object</type>
+ </attribute>
+ <attribute>
+ <description></description>
+ <name>immediate</name>
+ <type>boolean</type>
+ </attribute>
+ <attribute>
+ <description></description>
+ <name>selectedItemChangeListener</name>
+ <type>javax.el.MethodExpression</type>
+ </attribute>
+
+ </tag>
+ <tag>
+ <description>
+ Register a SelectedItemChangeListener instance on the UIComponent
+ associated with the closest parent UIComponent custom
+ action.
+ </description>
+ <tag-name>selectedItemChangeListener</tag-name>
+ <handler-class>org.richfaces.taglib.SelectedItemChangeListenerHandler</handler-class>
+ <attribute>
+ <description>
+ Fully qualified Java class name of a
+ SelectedItemChangeListener to be created and registered.
+ </description>
+ <name>type</name>
+ <type>java.lang.String</type>
+ </attribute>
+ <attribute>
+ <description>
+ Value binding expression that evaluates to an object that
+ implements org.richfaces.event.SelectedItemChangeListener.
+ </description>
+ <name>binding</name>
+ <required>false</required>
+ <type>org.richfaces.event.SelectedItemChangeListener</type>
+ </attribute>
+ <attribute>
+ <description>
+ <p class="changed_added_2_0">If present, this attribute refers
+ to the value of one of the exposed attached objects within the
+ composite component inside of which this tag is nested.</p>
+ </description>
+ <name>for</name>
+ <required>false</required>
+ <type>java.lang.String</type>
+ </attribute>
+ </tag>
+
+ <tag>
+ <tag-name>togglePanelItem</tag-name>
+ <component>
+ <component-type>org.richfaces.panels.TogglePanelItem</component-type>
+ <renderer-type>org.richfaces.panels.TogglePanelItemRenderer</renderer-type>
+
+ </component>
+ <attribute>
+ <description></description>
+ <name>lang</name>
+ <type>java.lang.String</type>
+ </attribute>
+ <attribute>
+ <description></description>
+ <name>onclick</name>
+ <type>java.lang.String</type>
+ </attribute>
+ <attribute>
+ <description></description>
+ <name>ondblclick</name>
+ <type>java.lang.String</type>
+ </attribute>
+ <attribute>
+ <description></description>
+ <name>onmousedown</name>
+ <type>java.lang.String</type>
+ </attribute>
+ <attribute>
+ <description></description>
+ <name>onmousemove</name>
+ <type>java.lang.String</type>
+ </attribute>
+ <attribute>
+ <description></description>
+ <name>onmouseout</name>
+ <type>java.lang.String</type>
+ </attribute>
+ <attribute>
+ <description></description>
+ <name>onmouseover</name>
+ <type>java.lang.String</type>
+ </attribute>
+ <attribute>
+ <description></description>
+ <name>onmouseup</name>
+ <type>java.lang.String</type>
+ </attribute>
+ <attribute>
+ <description></description>
+ <name>title</name>
+ <type>java.lang.String</type>
+ </attribute>
+ <attribute>
+ <description></description>
+ <name>style</name>
+ <type>java.lang.String</type>
+ </attribute>
+ <attribute>
+ <description></description>
+ <name>styleClass</name>
+ <type>java.lang.String</type>
+ </attribute>
+ <attribute>
+ <description></description>
+ <name>dir</name>
+ <type>java.lang.String</type>
+ </attribute>
+ <attribute>
+ <description>Long long text</description>
+ <name>id</name>
+ <type>java.lang.String</type>
+ </attribute>
+ <attribute>
+ <description>binding description</description>
+ <name>binding</name>
+ <type>javax.faces.component.UIComponent</type>
+ </attribute>
+ <attribute>
+ <description>I don't know maybe some thing strange</description>
+ <name>rendered</name>
+ <type>boolean</type>
+ </attribute>
+ <attribute>
+ <description></description>
+ <name>name</name>
+ <required>true</required>
+ <type>java.lang.String</type>
+ </attribute>
+ <attribute>
+ <description></description>
+ <name>switchType</name>
+ <type>org.richfaces.component.Method</type>
+ </attribute>
+ <attribute>
+ <description></description>
+ <name>onenter</name>
+ <type>java.lang.String</type>
+ </attribute>
+ <attribute>
+ <description></description>
+ <name>onleave</name>
+ <type>java.lang.String</type>
+ </attribute>
+
+ </tag>
+
+
+</facelet-taglib>
14 years, 6 months
JBoss Rich Faces SVN: r17751 - in root/ui-sandbox/inputs/trunk/combobox/src/main: resources/META-INF/resources/org.richfaces and 1 other directory.
by richfaces-svn-commits@lists.jboss.org
Author: pyaschenko
Date: 2010-07-07 05:12:12 -0400 (Wed, 07 Jul 2010)
New Revision: 17751
Modified:
root/ui-sandbox/inputs/trunk/combobox/src/main/java/org/richfaces/renderkit/ComboBoxRendererBase.java
root/ui-sandbox/inputs/trunk/combobox/src/main/resources/META-INF/resources/org.richfaces/ComboBox.ecss
Log:
https://jira.jboss.org/browse/RF-8875
Modified: root/ui-sandbox/inputs/trunk/combobox/src/main/java/org/richfaces/renderkit/ComboBoxRendererBase.java
===================================================================
--- root/ui-sandbox/inputs/trunk/combobox/src/main/java/org/richfaces/renderkit/ComboBoxRendererBase.java 2010-07-06 23:35:46 UTC (rev 17750)
+++ root/ui-sandbox/inputs/trunk/combobox/src/main/java/org/richfaces/renderkit/ComboBoxRendererBase.java 2010-07-07 09:12:12 UTC (rev 17751)
@@ -45,6 +45,7 @@
*/
@ResourceDependencies({
@ResourceDependency(name = "jquery.js"),
+ @ResourceDependency(name = "jquery.position.js"),
@ResourceDependency(name = "richfaces.js"),
@ResourceDependency(name = "richfaces-event.js"),
@ResourceDependency(name = "richfaces-base-component.js"),
@@ -128,6 +129,7 @@
ResponseWriter responseWriter = facesContext.getResponseWriter();
responseWriter.startElement(HTML.UL_ELEMENT, component);
+ responseWriter.writeAttribute(HTML.ID_ATTRIBUTE, component.getClientId(facesContext)+"Items", null);
responseWriter.writeAttribute(HTML.CLASS_ATTRIBUTE, "cb_list_ul", null);
boolean hasEncodedElements = false;
Modified: root/ui-sandbox/inputs/trunk/combobox/src/main/resources/META-INF/resources/org.richfaces/ComboBox.ecss
===================================================================
--- root/ui-sandbox/inputs/trunk/combobox/src/main/resources/META-INF/resources/org.richfaces/ComboBox.ecss 2010-07-06 23:35:46 UTC (rev 17750)
+++ root/ui-sandbox/inputs/trunk/combobox/src/main/resources/META-INF/resources/org.richfaces/ComboBox.ecss 2010-07-07 09:12:12 UTC (rev 17751)
@@ -64,6 +64,7 @@
.cb_list_cord {
position: absolute;
font-size: 0px;
+ display: none;
} /*DDL is hidden!!!!!*/
.cb_list_decoration {
14 years, 6 months
JBoss Rich Faces SVN: r17750 - root/commons/branches/RF8755/api/src/main/java/org/richfaces/renderkit.
by richfaces-svn-commits@lists.jboss.org
Author: alexsmirnov
Date: 2010-07-06 19:35:46 -0400 (Tue, 06 Jul 2010)
New Revision: 17750
Modified:
root/commons/branches/RF8755/api/src/main/java/org/richfaces/renderkit/ComponentAttribute.java
root/commons/branches/RF8755/api/src/main/java/org/richfaces/renderkit/RenderKitUtils.java
Log:
https://jira.jboss.org/browse/RF-8306
Modified: root/commons/branches/RF8755/api/src/main/java/org/richfaces/renderkit/ComponentAttribute.java
===================================================================
--- root/commons/branches/RF8755/api/src/main/java/org/richfaces/renderkit/ComponentAttribute.java 2010-07-06 23:35:30 UTC (rev 17749)
+++ root/commons/branches/RF8755/api/src/main/java/org/richfaces/renderkit/ComponentAttribute.java 2010-07-06 23:35:46 UTC (rev 17750)
@@ -29,15 +29,39 @@
* @author Nick Belaevski
*/
public class ComponentAttribute implements Comparable<ComponentAttribute> {
+
+ public enum Kind {
+ BOOLEAN,
+ GENERIC,
+ URI
+ }
private final String htmlAttributeName;
private String componentAttributeName;
- private String[] eventNames;
+ private String[] eventNames = {};
+ private Kind kind = Kind.GENERIC;
+
//TODO handling for aliases: "styleClass" -> "class"
+ /**
+ * <p class="changed_added_4_0"></p>
+ * @return the kind
+ */
+ public Kind getKind() {
+ return this.kind;
+ }
+
+ /**
+ * <p class="changed_added_4_0"></p>
+ * @param kind the kind to set
+ */
+ public void setKind(Kind kind) {
+ this.kind = kind;
+ }
+
public ComponentAttribute(String htmlAttributeName) {
super();
this.htmlAttributeName = htmlAttributeName;
Modified: root/commons/branches/RF8755/api/src/main/java/org/richfaces/renderkit/RenderKitUtils.java
===================================================================
--- root/commons/branches/RF8755/api/src/main/java/org/richfaces/renderkit/RenderKitUtils.java 2010-07-06 23:35:30 UTC (rev 17749)
+++ root/commons/branches/RF8755/api/src/main/java/org/richfaces/renderkit/RenderKitUtils.java 2010-07-06 23:35:46 UTC (rev 17750)
@@ -24,10 +24,12 @@
import java.io.IOException;
import java.util.Arrays;
import java.util.Collection;
+import java.util.Collections;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Set;
+import java.util.TreeSet;
import javax.faces.component.UIComponent;
import javax.faces.component.UIComponentBase;
@@ -39,6 +41,8 @@
import javax.faces.context.FacesContext;
import javax.faces.context.ResponseWriter;
+import org.richfaces.renderkit.ComponentAttribute.Kind;
+
/**
* @author Nick Belaevski
*
@@ -83,13 +87,14 @@
}
private static Map<String, List<ClientBehavior>> getClientBehaviorsMap(UIComponent component) {
- Map<String, List<ClientBehavior>> result = null;
+ Map<String, List<ClientBehavior>> result;
if (component instanceof ClientBehaviorHolder) {
ClientBehaviorHolder clientBehaviorHolder = (ClientBehaviorHolder) component;
result = clientBehaviorHolder.getClientBehaviors();
+ } else {
+ result = Collections.emptyMap();
}
-
return result;
}
@@ -98,14 +103,14 @@
if (disabledAttributeValue == null) {
return false;
}
-
+
if (disabledAttributeValue instanceof Boolean) {
return Boolean.TRUE.equals(disabledAttributeValue);
}
-
+
return Boolean.valueOf(disabledAttributeValue.toString());
}
-
+
static String escape(String s) {
StringBuilder sb = new StringBuilder(s.length());
int start = 0;
@@ -114,43 +119,43 @@
while ((end = s.indexOf('\'', start)) >= 0) {
sb.append(s, start, end);
sb.append("\\'");
-
+
start = end + 1;
}
-
+
sb.append(s, start, s.length());
-
+
return sb.toString();
}
-
+
static boolean chain(StringBuilder sb, Object object, boolean isChained) {
if (object != null) {
String objectString = object.toString().trim();
if (objectString.length() != 0) {
final boolean localIsChained;
-
+
if (!isChained && sb.length() != 0) {
- //extract previously stored handler
+ // extract previously stored handler
String previousHandlerString = sb.toString();
- //clear builder object
+ // clear builder object
sb.setLength(0);
-
- //append escaped handler
+
+ // append escaped handler
sb.append("'");
sb.append(escape(previousHandlerString));
sb.append("'");
-
+
localIsChained = true;
} else {
- //use passed in value of chained indicator
+ // use passed in value of chained indicator
localIsChained = isChained;
}
-
+
if (localIsChained) {
sb.append(",'");
sb.append(escape(objectString));
sb.append("'");
-
+
return true;
} else {
sb.append(objectString);
@@ -158,11 +163,11 @@
}
}
}
-
- //no changes, pass chained indicator we initially used
+
+ // no changes, pass chained indicator we initially used
return isChained;
}
-
+
private static Object createBehaviorsChain(Object inlineHandlerValue, ClientBehaviorContext behaviorContext,
List<ClientBehavior> behaviors) {
@@ -172,7 +177,7 @@
isChained = chain(result, inlineHandlerValue, isChained);
for (ClientBehavior behavior : behaviors) {
isChained = chain(result, behavior.getScript(behaviorContext), isChained);
-
+
if (behavior.getHints().contains(ClientBehaviorHint.SUBMITTING)) {
break;
}
@@ -181,21 +186,20 @@
if (result.length() == 0) {
return null;
}
-
+
if (isChained) {
result.insert(0, "jsf.util.chain(");
result.append(")");
}
-
+
return result.toString();
}
- //TODO filter out empty strings
- static boolean shouldRenderAttribute(Object attributeValue) {
+ public static boolean shouldRenderAttribute(Object attributeValue) {
if (attributeValue == null) {
return false;
} else if (attributeValue instanceof String) {
- return true;
+ return ((String) attributeValue).length() > 0;
} else if (attributeValue instanceof Boolean && Boolean.FALSE.equals(attributeValue)) {
return false;
} else if (attributeValue instanceof Integer && (Integer) attributeValue == Integer.MIN_VALUE) {
@@ -214,7 +218,7 @@
return false;
}
- return true;
+ return attributeValue.toString().length() > 0;
}
public static String prefixAttributeName(String attributeName, boolean isXhtmlMode) {
@@ -241,7 +245,7 @@
ResponseWriter writer = facesContext.getResponseWriter();
String prefixedAttributeName = prefixAttributeName(attributeName, writer);
-
+
if (Arrays.binarySearch(URI_ATTRIBUTE_NAMES, attributeName) >= 0) {
writer.writeURIAttribute(prefixedAttributeName, attributeValue, null);
} else if (Arrays.binarySearch(BOOLEAN_ATTRIBUTE_NAMES, attributeName) >= 0) {
@@ -272,20 +276,20 @@
String componentAttributeName = componentAttribute.getComponentAttributeName();
Object attributeValue = component.getAttributes().get(componentAttributeName);
- Map<String, List<ClientBehavior>> behaviorsMap = getClientBehaviorsMap(component);
- if (behaviorsMap != null) {
- String[] eventNames = componentAttribute.getEventNames();
- if (eventNames != null) {
+ String[] eventNames = componentAttribute.getEventNames();
+ if (eventNames.length > 0) {
+ Map<String, List<ClientBehavior>> behaviorsMap = getClientBehaviorsMap(component);
+ if (behaviorsMap.size() > 0) {
for (String eventName : eventNames) {
- List<ClientBehavior> behaviorsList = behaviorsMap.get(eventName);
- if (behaviorsList != null) {
+ if (behaviorsMap.containsKey(eventName)) {
+ List<ClientBehavior> behaviorsList = behaviorsMap.get(eventName);
if (!behaviorsList.isEmpty()) {
// TODO - parameters handling
- ClientBehaviorContext behaviorContext = ClientBehaviorContext.createClientBehaviorContext(
- facesContext, component, eventName, null, null);
+ ClientBehaviorContext behaviorContext =
+ ClientBehaviorContext.createClientBehaviorContext(facesContext, component, eventName,
+ null, null);
attributeValue = createBehaviorsChain(attributeValue, behaviorContext, behaviorsList);
}
-
break;
}
}
@@ -322,7 +326,7 @@
if (disabled && knownAttribute.getEventNames() != null) {
continue;
}
-
+
renderAttributeAndBehaviors(context, component, knownAttribute);
}
}
@@ -344,18 +348,21 @@
public static void renderPassThroughAttributes(FacesContext context, UIComponent component,
Map<String, ComponentAttribute> knownAttributesMap) throws IOException {
+ Collection<ComponentAttribute> attributes = knownAttributesMap.values();
+ renderPassThroughAttributes(context, component, attributes);
+ }
+
+ public static void renderPassThroughAttributes(FacesContext context, UIComponent component, Collection<ComponentAttribute> attributes)
+ throws IOException {
boolean disabled = isDisabled(component);
-
- for (ComponentAttribute knownAttribute : knownAttributesMap.values()) {
- if (disabled && knownAttribute.getEventNames() != null) {
- continue;
+ for (ComponentAttribute knownAttribute : attributes) {
+ if (!disabled || knownAttribute.getEventNames().length == 0) {
+ renderAttributeAndBehaviors(context, component, knownAttribute);
}
-
- renderAttributeAndBehaviors(context, component, knownAttribute);
}
}
-
+
public static String decodeBehaviors(FacesContext context, UIComponent component) {
if (!(component instanceof ClientBehaviorHolder)) {
return null;
@@ -385,12 +392,50 @@
for (ClientBehavior behavior : behaviorsForEvent) {
behavior.decode(context, component);
}
-
+
return behaviorEvent;
}
}
-
+
return null;
}
+ public static Attributes attributes() {
+ return new Attributes();
+ }
+
+ @SuppressWarnings("serial")
+ public static final class Attributes extends TreeSet<ComponentAttribute> {
+
+ public void render(FacesContext context, UIComponent component) throws IOException {
+ renderPassThroughAttributes(context, component, this);
+ }
+
+ public Attributes literal(String name, String componentAttribute, String... events) {
+ ComponentAttribute attribute = createAttribute(name, componentAttribute);
+ attribute.setEventNames(events);
+ attribute.setKind(Kind.GENERIC);
+ return this;
+ }
+
+ private ComponentAttribute createAttribute(String name, String componentAttribute) {
+ ComponentAttribute attribute = new ComponentAttribute(name);
+ attribute.setComponentAttributeName(componentAttribute);
+ return attribute;
+ }
+
+ public Attributes uri(String name, String componentAttribute) {
+ ComponentAttribute attribute = createAttribute(name, componentAttribute);
+ attribute.setKind(Kind.URI);
+ return this;
+ }
+
+ public Attributes bool(String name, String componentAttribute) {
+ ComponentAttribute attribute = createAttribute(name, componentAttribute);
+ attribute.setKind(Kind.BOOLEAN);
+ return this;
+ }
+
+ }
+
}
14 years, 6 months
JBoss Rich Faces SVN: r17749 - in root/cdk/branches/RF8755/plugins/generator: src/main/java/org/richfaces/cdk/templatecompiler and 7 other directories.
by richfaces-svn-commits@lists.jboss.org
Author: alexsmirnov
Date: 2010-07-06 19:35:30 -0400 (Tue, 06 Jul 2010)
New Revision: 17749
Added:
root/cdk/branches/RF8755/plugins/generator/src/main/java/org/richfaces/cdk/templatecompiler/ELTypeTemplateModel.java
root/cdk/branches/RF8755/plugins/generator/src/main/resources/META-INF/templates/java/should-render-attribute.ftl
root/cdk/branches/RF8755/plugins/generator/src/main/resources/META-INF/templates/java/write-boolean-attribute.ftl
root/cdk/branches/RF8755/plugins/generator/src/main/resources/META-INF/templates/java/write-uri-attribute.ftl
root/cdk/branches/RF8755/plugins/generator/src/main/resources/META-INF/templates/util.ftl
Modified:
root/cdk/branches/RF8755/plugins/generator/pom.xml
root/cdk/branches/RF8755/plugins/generator/src/main/java/org/richfaces/cdk/templatecompiler/JavaClassModelWrapper.java
root/cdk/branches/RF8755/plugins/generator/src/main/java/org/richfaces/cdk/templatecompiler/MethodBodyTemplateModel.java
root/cdk/branches/RF8755/plugins/generator/src/main/java/org/richfaces/cdk/templatecompiler/RendererClassVisitor.java
root/cdk/branches/RF8755/plugins/generator/src/main/java/org/richfaces/cdk/templatecompiler/el/ELVisitor.java
root/cdk/branches/RF8755/plugins/generator/src/main/java/org/richfaces/cdk/templatecompiler/el/node/AbstractBinaryOperationTreeNode.java
root/cdk/branches/RF8755/plugins/generator/src/main/java/org/richfaces/cdk/templatecompiler/el/node/AbstractMethodTreeNode.java
root/cdk/branches/RF8755/plugins/generator/src/main/java/org/richfaces/cdk/templatecompiler/el/node/AstBracketSuffixTreeNode.java
root/cdk/branches/RF8755/plugins/generator/src/main/java/org/richfaces/cdk/templatecompiler/el/node/AstChoiceTreeNode.java
root/cdk/branches/RF8755/plugins/generator/src/main/java/org/richfaces/cdk/templatecompiler/el/node/EqualityTestTreeNode.java
root/cdk/branches/RF8755/plugins/generator/src/main/java/org/richfaces/cdk/templatecompiler/statements/AttributesStatement.java
root/cdk/branches/RF8755/plugins/generator/src/main/java/org/richfaces/cdk/templatecompiler/statements/HelperMethod.java
root/cdk/branches/RF8755/plugins/generator/src/main/java/org/richfaces/cdk/templatecompiler/statements/HelperMethodFactoryImpl.java
root/cdk/branches/RF8755/plugins/generator/src/main/java/org/richfaces/cdk/templatecompiler/statements/TypedTemplateStatement.java
root/cdk/branches/RF8755/plugins/generator/src/main/java/org/richfaces/cdk/templatecompiler/statements/WriteAttributeStatement.java
root/cdk/branches/RF8755/plugins/generator/src/main/java/org/richfaces/cdk/templatecompiler/statements/WriteAttributesSetStatement.java
root/cdk/branches/RF8755/plugins/generator/src/main/resources/META-INF/templates/java/util.ftl
root/cdk/branches/RF8755/plugins/generator/src/main/resources/META-INF/templates/java/write-attribute.ftl
root/cdk/branches/RF8755/plugins/generator/src/test/java/org/richfaces/cdk/templatecompiler/parser/el/test/ELParserTest.java
root/cdk/branches/RF8755/plugins/generator/src/test/java/org/richfaces/cdk/templatecompiler/statements/AttributesStatementTest.java
root/cdk/branches/RF8755/plugins/generator/src/test/java/org/richfaces/cdk/templatecompiler/statements/FreeMarkerTemplateStatementTest1.java
root/cdk/branches/RF8755/plugins/generator/src/test/java/org/richfaces/cdk/templatecompiler/statements/FreeMarkerTestBase.java
root/cdk/branches/RF8755/plugins/generator/src/test/java/org/richfaces/cdk/templatecompiler/statements/WriteAttributeTest.java
Log:
https://jira.jboss.org/browse/RF-8306
Modified: root/cdk/branches/RF8755/plugins/generator/pom.xml
===================================================================
--- root/cdk/branches/RF8755/plugins/generator/pom.xml 2010-07-06 17:04:49 UTC (rev 17748)
+++ root/cdk/branches/RF8755/plugins/generator/pom.xml 2010-07-06 23:35:30 UTC (rev 17749)
@@ -175,5 +175,10 @@
<artifactId>guice-multibindings</artifactId>
</dependency>
+ <dependency>
+ <groupId>org.beanshell</groupId>
+ <artifactId>bsh</artifactId>
+ <version>2.0b4</version>
+ </dependency>
</dependencies>
</project>
\ No newline at end of file
Added: root/cdk/branches/RF8755/plugins/generator/src/main/java/org/richfaces/cdk/templatecompiler/ELTypeTemplateModel.java
===================================================================
--- root/cdk/branches/RF8755/plugins/generator/src/main/java/org/richfaces/cdk/templatecompiler/ELTypeTemplateModel.java (rev 0)
+++ root/cdk/branches/RF8755/plugins/generator/src/main/java/org/richfaces/cdk/templatecompiler/ELTypeTemplateModel.java 2010-07-06 23:35:30 UTC (rev 17749)
@@ -0,0 +1,51 @@
+/*
+ * $Id$
+ *
+ * License Agreement.
+ *
+ * Rich Faces - Natural Ajax for Java Server Faces (JSF)
+ *
+ * Copyright (C) 2007 Exadel, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1 as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+package org.richfaces.cdk.templatecompiler;
+
+import org.richfaces.cdk.templatecompiler.el.types.ELType;
+
+import freemarker.ext.beans.BeansWrapper;
+import freemarker.ext.beans.StringModel;
+import freemarker.template.TemplateModel;
+
+/**
+ * <p class="changed_added_4_0"></p>
+ * @author asmirnov(a)exadel.com
+ *
+ */
+public class ELTypeTemplateModel extends StringModel implements TemplateModel {
+
+ private final ELType elType;
+
+ public ELTypeTemplateModel(ELType obj, BeansWrapper wrapper) {
+ super(obj, wrapper);
+ this.elType = obj;
+ }
+
+ @Override
+ public String getAsString() {
+ return elType.getCode();
+ }
+
+}
Property changes on: root/cdk/branches/RF8755/plugins/generator/src/main/java/org/richfaces/cdk/templatecompiler/ELTypeTemplateModel.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Modified: root/cdk/branches/RF8755/plugins/generator/src/main/java/org/richfaces/cdk/templatecompiler/JavaClassModelWrapper.java
===================================================================
--- root/cdk/branches/RF8755/plugins/generator/src/main/java/org/richfaces/cdk/templatecompiler/JavaClassModelWrapper.java 2010-07-06 17:04:49 UTC (rev 17748)
+++ root/cdk/branches/RF8755/plugins/generator/src/main/java/org/richfaces/cdk/templatecompiler/JavaClassModelWrapper.java 2010-07-06 23:35:30 UTC (rev 17749)
@@ -1,6 +1,7 @@
package org.richfaces.cdk.templatecompiler;
import org.richfaces.cdk.templatecompiler.builder.model.JavaStatement;
+import org.richfaces.cdk.templatecompiler.el.types.ELType;
import freemarker.ext.beans.BeansWrapper;
import freemarker.template.ObjectWrapper;
@@ -21,6 +22,8 @@
if (obj instanceof JavaStatement) {
templateModel = new MethodBodyTemplateModel((JavaStatement) obj, this);
+ } else if (obj instanceof ELType){
+ templateModel = new ELTypeTemplateModel((ELType)obj, this);
} else {
templateModel = super.wrap(obj);
}
Modified: root/cdk/branches/RF8755/plugins/generator/src/main/java/org/richfaces/cdk/templatecompiler/MethodBodyTemplateModel.java
===================================================================
--- root/cdk/branches/RF8755/plugins/generator/src/main/java/org/richfaces/cdk/templatecompiler/MethodBodyTemplateModel.java 2010-07-06 17:04:49 UTC (rev 17748)
+++ root/cdk/branches/RF8755/plugins/generator/src/main/java/org/richfaces/cdk/templatecompiler/MethodBodyTemplateModel.java 2010-07-06 23:35:30 UTC (rev 17749)
@@ -25,7 +25,7 @@
import org.richfaces.cdk.templatecompiler.builder.model.JavaStatement;
-import freemarker.ext.beans.BeanModel;
+import freemarker.ext.beans.StringModel;
import freemarker.template.TemplateModel;
import freemarker.template.TemplateModelException;
@@ -34,7 +34,7 @@
*
* @author asmirnov(a)exadel.com
*/
-public class MethodBodyTemplateModel extends BeanModel implements TemplateModel {
+public class MethodBodyTemplateModel extends StringModel implements TemplateModel {
private static final String CODE_ATTRIBUTE_NAME = "code";
@@ -62,4 +62,8 @@
return super.get(key);
}
+ @Override
+ public String getAsString() {
+ return statement.getCode();
+ }
}
Modified: root/cdk/branches/RF8755/plugins/generator/src/main/java/org/richfaces/cdk/templatecompiler/RendererClassVisitor.java
===================================================================
--- root/cdk/branches/RF8755/plugins/generator/src/main/java/org/richfaces/cdk/templatecompiler/RendererClassVisitor.java 2010-07-06 17:04:49 UTC (rev 17748)
+++ root/cdk/branches/RF8755/plugins/generator/src/main/java/org/richfaces/cdk/templatecompiler/RendererClassVisitor.java 2010-07-06 23:35:30 UTC (rev 17749)
@@ -119,16 +119,15 @@
*
*/
public static final String FACES_CONTEXT_VARIABLE = "facesContext";
- /**
- *
- */
- static final String CLIENT_ID_VARIABLE = "clientId";
-
public static final ImmutableMap<String, Object> ENCODE_METHOD_VARIABLES = ImmutableMap.<String, Object> builder()
.put("facesContextVariable", RendererClassVisitor.FACES_CONTEXT_VARIABLE)
.put("componentVariable", RendererClassVisitor.COMPONENT_VARIABLE)
.put("responseWriterVariable", RendererClassVisitor.RESPONSE_WRITER_VARIABLE)
.put("clientIdVariable", RendererClassVisitor.CLIENT_ID_VARIABLE).build();
+ /**
+ *
+ */
+ static final String CLIENT_ID_VARIABLE = "clientId";
/**
*
@@ -218,7 +217,6 @@
return typesFactory.getType(type);
}
-
private void createMethodContext() {
this.currentStatement = new StatementsContainer();
currentStatement.setVariable(FACES_CONTEXT_VARIABLE, getType(FacesContext.class));
@@ -290,8 +288,8 @@
protected void popStatement() {
currentStatement = currentStatement.getParent();
}
-
- protected <T extends TemplateStatement> T addStatement(Class<T> statementClass){
+
+ protected <T extends TemplateStatement> T addStatement(Class<T> statementClass) {
T statement = createStatement(statementClass);
addStatement(statement);
return statement;
@@ -355,7 +353,7 @@
StartElementStatement startElementStatement = addStatement(StartElementStatement.class);
startElementStatement.setElementName(elementName.getLocalPart());
AttributesStatement attributesStatement = addStatement(AttributesStatement.class);
- attributesStatement.processAttributes(anyElement,attributes);
+ attributesStatement.processAttributes(anyElement, attributes);
// Set<String> writtenAttributes = new HashSet<String>();
// boolean shouldEncodePassThrough = false;
// String[] passThroughExclusions = null;
@@ -619,7 +617,7 @@
@Override
public void startElement(CdkForEachElement cdkForEachElement) {
String items = cdkForEachElement.getItems();
-// String itemsExpression = compileEl(items, Iterable.class);
+ // String itemsExpression = compileEl(items, Iterable.class);
// TODO - review
// Class<?> collectionElementClass = lastCompiledExpressionType.getContainerType().getRawType();
Modified: root/cdk/branches/RF8755/plugins/generator/src/main/java/org/richfaces/cdk/templatecompiler/el/ELVisitor.java
===================================================================
--- root/cdk/branches/RF8755/plugins/generator/src/main/java/org/richfaces/cdk/templatecompiler/el/ELVisitor.java 2010-07-06 17:04:49 UTC (rev 17748)
+++ root/cdk/branches/RF8755/plugins/generator/src/main/java/org/richfaces/cdk/templatecompiler/el/ELVisitor.java 2010-07-06 23:35:30 UTC (rev 17749)
@@ -152,7 +152,7 @@
}
- public ELType getExpressionType() {
+ public ELType getType() {
return expressionType;
}
@@ -206,7 +206,7 @@
public String coerceToType(String valueString, ELType expectedType) {
- if (!expectedType.isAssignableFrom(getExpressionType())) {
+ if (!expectedType.isAssignableFrom(getType())) {
for (HelperMethod conversionMethod : HelperMethod.getConversionMethods()) {
ELType returnType = typesFactory.getType(conversionMethod.getReturnType());
if (expectedType.isAssignableFrom(returnType)) {
@@ -254,7 +254,7 @@
@Override
public Iterable<JavaImport> getRequiredImports() {
- return getExpressionType().getRequiredImports();
+ return getType().getRequiredImports();
}
@Override
@@ -270,12 +270,12 @@
public ELType getMatchingVisibleMethodReturnType(String methodName, ELType[] parameterTypes) throws ParsingException {
- return typesFactory.getMatchingVisibleMethodReturnType(getExpressionType(), methodName, parameterTypes);
+ return typesFactory.getMatchingVisibleMethodReturnType(getType(), methodName, parameterTypes);
}
public ELPropertyDescriptor getPropertyDescriptor(String propertyName) throws ParsingException {
- return typesFactory.getPropertyDescriptor(getExpressionType(), propertyName);
+ return typesFactory.getPropertyDescriptor(getType(), propertyName);
}
Modified: root/cdk/branches/RF8755/plugins/generator/src/main/java/org/richfaces/cdk/templatecompiler/el/node/AbstractBinaryOperationTreeNode.java
===================================================================
--- root/cdk/branches/RF8755/plugins/generator/src/main/java/org/richfaces/cdk/templatecompiler/el/node/AbstractBinaryOperationTreeNode.java 2010-07-06 17:04:49 UTC (rev 17748)
+++ root/cdk/branches/RF8755/plugins/generator/src/main/java/org/richfaces/cdk/templatecompiler/el/node/AbstractBinaryOperationTreeNode.java 2010-07-06 23:35:30 UTC (rev 17749)
@@ -61,9 +61,9 @@
@Override
public void visit(StringBuilder sb, ELVisitor visitor) throws ParsingException {
String firstChildOutput = getCoercedChildOutput(0, visitor);
- ELType firstChildType = visitor.getExpressionType();
+ ELType firstChildType = visitor.getType();
String secondChildOutput = getCoercedChildOutput(1, visitor);
- ELType secondChildType = visitor.getExpressionType();
+ ELType secondChildType = visitor.getType();
sb.append(ELNodeConstants.LEFT_BRACKET);
Modified: root/cdk/branches/RF8755/plugins/generator/src/main/java/org/richfaces/cdk/templatecompiler/el/node/AbstractMethodTreeNode.java
===================================================================
--- root/cdk/branches/RF8755/plugins/generator/src/main/java/org/richfaces/cdk/templatecompiler/el/node/AbstractMethodTreeNode.java 2010-07-06 17:04:49 UTC (rev 17748)
+++ root/cdk/branches/RF8755/plugins/generator/src/main/java/org/richfaces/cdk/templatecompiler/el/node/AbstractMethodTreeNode.java 2010-07-06 23:35:30 UTC (rev 17749)
@@ -48,7 +48,7 @@
protected void visitMethod(StringBuilder sb, ELVisitor visitor, String methodName)
throws ParsingException {
- ELType currentExpressionType = visitor.getExpressionType();
+ ELType currentExpressionType = visitor.getType();
List<ELType> argumentTypes = new ArrayList<ELType>();
sb.append(ELNodeConstants.DOT);
@@ -65,7 +65,7 @@
sb.append(childOutput);
// TODO: handle generic matches -?
- argumentTypes.add(visitor.getExpressionType());
+ argumentTypes.add(visitor.getType());
}
sb.append(ELNodeConstants.RIGHT_BRACKET);
Modified: root/cdk/branches/RF8755/plugins/generator/src/main/java/org/richfaces/cdk/templatecompiler/el/node/AstBracketSuffixTreeNode.java
===================================================================
--- root/cdk/branches/RF8755/plugins/generator/src/main/java/org/richfaces/cdk/templatecompiler/el/node/AstBracketSuffixTreeNode.java 2010-07-06 17:04:49 UTC (rev 17748)
+++ root/cdk/branches/RF8755/plugins/generator/src/main/java/org/richfaces/cdk/templatecompiler/el/node/AstBracketSuffixTreeNode.java 2010-07-06 23:35:30 UTC (rev 17749)
@@ -41,7 +41,7 @@
@Override
public void visit(StringBuilder sb, ELVisitor visitor) throws ParsingException {
- ELType variableType = visitor.getExpressionType();
+ ELType variableType = visitor.getType();
String suffixValue = getChildOutput(0, visitor);
if (variableType.isArray()) {
Modified: root/cdk/branches/RF8755/plugins/generator/src/main/java/org/richfaces/cdk/templatecompiler/el/node/AstChoiceTreeNode.java
===================================================================
--- root/cdk/branches/RF8755/plugins/generator/src/main/java/org/richfaces/cdk/templatecompiler/el/node/AstChoiceTreeNode.java 2010-07-06 17:04:49 UTC (rev 17748)
+++ root/cdk/branches/RF8755/plugins/generator/src/main/java/org/richfaces/cdk/templatecompiler/el/node/AstChoiceTreeNode.java 2010-07-06 23:35:30 UTC (rev 17749)
@@ -46,9 +46,9 @@
//condition ? correctConditionBranch : incorrectConditionBranch
String condition = coerceToBoolean(getChildOutput(0, visitor), visitor);
String correctConditionBranch = getChildOutput(1, visitor);
- ELType correctConditionBranchType = visitor.getExpressionType();
+ ELType correctConditionBranchType = visitor.getType();
String incorrectConditionBranch = getChildOutput(2, visitor);
- ELType incorrectConditionBranchType = visitor.getExpressionType();
+ ELType incorrectConditionBranchType = visitor.getType();
sb.append(ELNodeConstants.LEFT_BRACKET);
Modified: root/cdk/branches/RF8755/plugins/generator/src/main/java/org/richfaces/cdk/templatecompiler/el/node/EqualityTestTreeNode.java
===================================================================
--- root/cdk/branches/RF8755/plugins/generator/src/main/java/org/richfaces/cdk/templatecompiler/el/node/EqualityTestTreeNode.java 2010-07-06 17:04:49 UTC (rev 17748)
+++ root/cdk/branches/RF8755/plugins/generator/src/main/java/org/richfaces/cdk/templatecompiler/el/node/EqualityTestTreeNode.java 2010-07-06 23:35:30 UTC (rev 17749)
@@ -77,9 +77,9 @@
@Override
public void visit(StringBuilder sb, ELVisitor visitor) throws ParsingException {
String firstChildOutput = getChildOutput(0, visitor);
- ELType firstChildType = visitor.getExpressionType();
+ ELType firstChildType = visitor.getType();
String secondChildOutput = getChildOutput(1, visitor);
- ELType secondChildType = visitor.getExpressionType();
+ ELType secondChildType = visitor.getType();
if (useIsEqualsMethod(firstChildType, secondChildType)) {
Modified: root/cdk/branches/RF8755/plugins/generator/src/main/java/org/richfaces/cdk/templatecompiler/statements/AttributesStatement.java
===================================================================
--- root/cdk/branches/RF8755/plugins/generator/src/main/java/org/richfaces/cdk/templatecompiler/statements/AttributesStatement.java 2010-07-06 17:04:49 UTC (rev 17748)
+++ root/cdk/branches/RF8755/plugins/generator/src/main/java/org/richfaces/cdk/templatecompiler/statements/AttributesStatement.java 2010-07-06 23:35:30 UTC (rev 17749)
@@ -4,33 +4,36 @@
import java.util.Map;
import java.util.NoSuchElementException;
import java.util.Set;
+import java.util.TreeSet;
import java.util.regex.Pattern;
import javax.xml.namespace.QName;
import org.richfaces.cdk.Logger;
import org.richfaces.cdk.attributes.Attribute;
+import org.richfaces.cdk.attributes.Attribute.Kind;
import org.richfaces.cdk.attributes.Element;
import org.richfaces.cdk.attributes.Schema;
-import org.richfaces.cdk.attributes.Attribute.Kind;
import org.richfaces.cdk.model.EventName;
import org.richfaces.cdk.model.PropertyBase;
-import org.richfaces.cdk.templatecompiler.ELParser;
-import org.richfaces.cdk.templatecompiler.RendererClassVisitor;
import org.richfaces.cdk.templatecompiler.model.AnyElement;
import org.richfaces.cdk.templatecompiler.model.Template;
-import org.richfaces.cdk.util.Pair;
+import org.richfaces.cdk.templatecompiler.statements.WriteAttributesSetStatement.PassThrough;
+import org.richfaces.cdk.util.Strings;
-import com.google.common.base.Function;
import com.google.common.base.Predicate;
import com.google.common.base.Splitter;
import com.google.common.collect.Iterables;
-import com.google.common.collect.Maps;
+import com.google.common.collect.Sets;
import com.google.inject.Inject;
import com.google.inject.Provider;
-import com.google.inject.internal.Sets;
import com.google.inject.name.Named;
+/**
+ * <p class="changed_added_4_0"></p>
+ * @author asmirnov(a)exadel.com
+ *
+ */
public class AttributesStatement extends StatementsContainer {
private static final Splitter PASS_THGOUGH_SPLITTER = Splitter.on(Pattern.compile("\\s*,\\s*"));
@@ -41,6 +44,8 @@
private final Logger logger;
private QName elementName;
+ private Collection<PropertyBase> componentAttributes;
+
@Inject
public AttributesStatement((a)Named(Template.XHTML_EL_NAMESPACE) Schema attributesSchema,
Provider<WriteAttributeStatement> attributeStatementProvider,
@@ -59,20 +64,72 @@
* @param componentAttributes
*/
public void processAttributes(AnyElement element, Collection<PropertyBase> componentAttributes) {
+ this.componentAttributes = componentAttributes;
Set<String> processedAttributes = Sets.newHashSet();
- Map<String, String> passThroughAttributes = Maps.newTreeMap();
+ TreeSet<WriteAttributesSetStatement.PassThrough> passThroughAttributes = Sets.newTreeSet();
this.elementName = element.getName();
+ processRegularAttributes(element, processedAttributes, passThroughAttributes);
+ String passThrough = element.getPassThrough();
+ processPassThrough(processedAttributes, passThroughAttributes, passThrough);
+ String passThroughWithExclusions = element.getPassThroughWithExclusions();
+ processPassThroughWithExclusions(processedAttributes, passThroughAttributes, passThroughWithExclusions);
+ if (!passThroughAttributes.isEmpty()) {
+ WriteAttributesSetStatement writeAttributesSetStatement = passThroughStatementProvider.get();
+ addStatement(writeAttributesSetStatement);
+ writeAttributesSetStatement.setAttributes(passThroughAttributes);
+ }
+ }
+
+ private void processPassThroughWithExclusions(Set<String> processedAttributes,
+ TreeSet<WriteAttributesSetStatement.PassThrough> passThroughAttributes, String passThroughWithExclusions) {
+ if (null != passThroughWithExclusions) {
+ // cdk:passThroughWithExclusions="id,class,style"
+ Map<String, Element> elements = attributesSchema.getElements();
+ String elementLocalName = elementName.getLocalPart();
+ if (Template.isDefaultNamespace(elementName) && elements.containsKey(elementLocalName)) {
+ Element schemaElement = elements.get(elementLocalName);
+ Iterable<String> exclusions = PASS_THGOUGH_SPLITTER.split(passThroughWithExclusions);
+ Iterables.addAll(processedAttributes, exclusions);
+ for (Attribute schemaAttribute : schemaElement.getAttributes().values()) {
+ if (!processedAttributes.contains(schemaAttribute.getName())) {
+ passThroughAttributes.add(createPassThrough(schemaAttribute.getName(),
+ schemaAttribute.getComponentAttributeName()));
+ }
+ }
+ }
+ }
+ }
+
+ private void processPassThrough(Set<String> processedAttributes,
+ TreeSet<WriteAttributesSetStatement.PassThrough> passThroughAttributes, String passThrough) {
+ if (null != passThrough) {
+ // cdk:passThrough="class:styleClass,style , id:clientId"
+ Iterable<String> split = PASS_THGOUGH_SPLITTER.split(passThrough);
+ for (String attribute : split) {
+ String[] split2 = attribute.split(":");
+ String attributeName = split2[0];
+ if (processedAttributes.add(attributeName)) {
+ String componentAttributeName = split2.length > 1 ? split2[1] : null;
+ passThroughAttributes.add(createPassThrough(attributeName, componentAttributeName));
+ }
+ }
+ }
+ }
+
+ private void processRegularAttributes(AnyElement element, Set<String> processedAttributes,
+ TreeSet<WriteAttributesSetStatement.PassThrough> passThroughAttributes) {
for (Map.Entry<QName, Object> entry : element.getAttributes().entrySet()) {
QName qName = entry.getKey();
if (Template.CDK_NAMESPACE.equals(qName.getNamespaceURI())) {
- // TODO - CDK attributes should be assigned to AnyElement attribute, log error.
+ // CDK attributes should be assigned to AnyElement attribute, log error.
+ logger.error("Unknown attribute " + qName);
} else {
Object value = entry.getValue();
String localAttributeName = qName.getLocalPart();
if (Template.CDK_PASS_THROUGH_NAMESPACE.equals(qName.getNamespaceURI())) {
// TODO - check empty attribute value.
// pass through attribute in format <div pf:class="styleClass" />
- passThroughAttributes.put(localAttributeName, value.toString());
+ passThroughAttributes.add(createPassThrough(localAttributeName, value.toString()));
processedAttributes.add(localAttributeName);
} else if (Template.isDefaultNamespace(qName.getNamespaceURI())) {
Attribute schemaAttribute = getSchemaAttribute(localAttributeName);
@@ -83,81 +140,39 @@
}
}
}
- String passThrough = element.getPassThrough();
- if (null != passThrough) {
- // cdk:passThrough="class:styleClass,style , id:clientId"
- Iterable<String> split = PASS_THGOUGH_SPLITTER.split(passThrough);
- for (String attribute : split) {
- String[] split2 = attribute.split(":");
- String attributeName = split2[0];
- if (processedAttributes.add(attributeName)) {
- Attribute schemaAttribute = getSchemaAttribute(attributeName);
- String componentAttributeName =
- split2.length > 1 ? split2[1] : schemaAttribute.getComponentAttributeName();
- // WriteAttributeStatement writeAttributeStatement = createAttributeStatement();
- // processPassThroughAttribute(componentAttributes, QName.valueOf(attributeName),
- // writeAttributeStatement, componentAttributeName);
- passThroughAttributes.put(attributeName, componentAttributeName);
- }
- }
- }
- String passThroughWithExclusions = element.getPassThroughWithExclusions();
- if (null != passThroughWithExclusions) {
- // cdk:passThroughWithExclusions="id,class,style"
- Map<String, Element> elements = attributesSchema.getElements();
- String elementLocalName = elementName.getLocalPart();
- if (Template.isDefaultNamespace(elementName) && elements.containsKey(elementLocalName)) {
- Element schemaElement = elements.get(elementLocalName);
- Iterable<String> exclusions = PASS_THGOUGH_SPLITTER.split(passThroughWithExclusions);
- Iterables.addAll(processedAttributes, exclusions);
- for (Attribute schemaAttribute : schemaElement.getAttributes().values()) {
- if(!processedAttributes.contains(schemaAttribute.getName())){
- passThroughAttributes.put(schemaAttribute.getName(), schemaAttribute.getComponentAttributeName());
- }
- }
- }
- }
- if(!passThroughAttributes.isEmpty()){
- WriteAttributesSetStatement writeAttributesSetStatement = passThroughStatementProvider.get();
- addStatement(writeAttributesSetStatement);
- // TODO - setup passThrough statement
- }
}
- private void processPassThroughAttribute(Collection<PropertyBase> componentAttributes, QName qName,
- String componentAttributeName) {
- // Pass through attribute which value represents component attribute.
- Attribute schemaAttribute = getSchemaAttribute(qName.getLocalPart());
- // TODO -send statement directly ?
- String expression =
- "#{" + RendererClassVisitor.ENCODE_METHOD_VARIABLES.get("componentVariable") + ".getAttributes().get(\""
- + componentAttributeName + "\")}";
- WriteAttributeStatement writeAttributeStatement = setupAttributeStatement(qName, expression, schemaAttribute);
- // Check for behavior events.
- if (Kind.GENERIC.equals(schemaAttribute.getKind())) {
- try {
- PropertyBase componentAttribute = findComponentAttribute(componentAttributeName, componentAttributes);
- Set<EventName> eventNames = componentAttribute.getEventNames();
- writeAttributeStatement.setEvents(Iterables.transform(eventNames, new Function<EventName, String>() {
- @Override
- public String apply(EventName from) {
- return from.getName();
- }
- }));
- } catch (NoSuchElementException e) {
- // Ignore it, no behavior such attribute defined.
- logger.warn("Attribute " + componentAttributeName + " was not defined for renderer");
+ private PassThrough createPassThrough(String localAttributeName, String componentAttribute) {
+ final PassThrough passThrough = new PassThrough();
+ passThrough.name = QName.valueOf(localAttributeName);
+ Attribute schemaAttribute = getSchemaAttribute(localAttributeName);
+ if (Strings.isEmpty(componentAttribute)) {
+ passThrough.componentAttribute = schemaAttribute.getComponentAttributeName();
+ } else {
+ passThrough.componentAttribute = componentAttribute;
+ }
+ passThrough.kind = schemaAttribute.getKind();
+ passThrough.defaultValue = schemaAttribute.getDefaultValue();
+ try {
+ PropertyBase componetProperty = findComponentAttribute(componentAttribute);
+ passThrough.type = componetProperty.getType().toString();
+ for (EventName event : componetProperty.getEventNames()) {
+ passThrough.behaviors.add(event.getName());
}
+ } catch (NoSuchElementException e) {
+ passThrough.type = Object.class.getName();
}
+ return passThrough;
}
+
private WriteAttributeStatement createAttributeStatement() {
WriteAttributeStatement writeAttributeStatement = statementProvider.get();
addStatement(writeAttributeStatement);
return writeAttributeStatement;
}
- private PropertyBase findComponentAttribute(final String name, Collection<PropertyBase> componentAttributes)
+ private PropertyBase findComponentAttribute(final String name)
throws NoSuchElementException {
return Iterables.find(componentAttributes, new Predicate<PropertyBase>() {
@Override
@@ -168,13 +183,13 @@
}
- private WriteAttributeStatement setupAttributeStatement(QName qName,Object value,
- Attribute schemaAttribute) {
+ private WriteAttributeStatement setupAttributeStatement(QName qName, Object value, Attribute schemaAttribute) {
WriteAttributeStatement writeAttributeStatement = createAttributeStatement();
String defaultValue = schemaAttribute.getDefaultValue();
switch (schemaAttribute.getKind()) {
case GENERIC:
writeAttributeStatement.setAttribute(qName, value, defaultValue);
+ // Process behaviors
break;
case URI:
writeAttributeStatement.setUriAttribute(qName, value, defaultValue);
@@ -182,6 +197,9 @@
case BOOLEAN:
writeAttributeStatement.setBooleanAttribute(qName, value, defaultValue);
break;
+ default:
+ // Only happens if new kind has bin added without modifiing this method:
+ logger.error("Unknown kind of statement, fix case operator code: " + schemaAttribute.getKind());
}
return writeAttributeStatement;
}
@@ -210,12 +228,9 @@
protected Attribute getGenericAttribute(String name) {
Attribute attribute = new Attribute(name);
attribute.setKind(Kind.GENERIC);
- // TODO - check default exceptions like class -> styleClass;
+ // check default exceptions like class -> styleClass;
if ("class".equals(name)) {
attribute.setComponentAttributeName("styleClass");
-
- } else {
- attribute.setComponentAttributeName(name);
}
return attribute;
}
Modified: root/cdk/branches/RF8755/plugins/generator/src/main/java/org/richfaces/cdk/templatecompiler/statements/HelperMethod.java
===================================================================
--- root/cdk/branches/RF8755/plugins/generator/src/main/java/org/richfaces/cdk/templatecompiler/statements/HelperMethod.java 2010-07-06 17:04:49 UTC (rev 17748)
+++ root/cdk/branches/RF8755/plugins/generator/src/main/java/org/richfaces/cdk/templatecompiler/statements/HelperMethod.java 2010-07-06 23:35:30 UTC (rev 17749)
@@ -23,9 +23,11 @@
import static org.richfaces.cdk.templatecompiler.el.ELNodeConstants.*;
+import java.util.Collection;
import java.util.EnumSet;
import java.util.Set;
+import javax.faces.component.UIComponent;
import javax.faces.context.FacesContext;
/**
@@ -38,7 +40,10 @@
TO_BOOLEAN_CONVERSION(CONVERT_TO_BOOLEAN_FUNCTION, Boolean.TYPE, Object.class),
EMPTINESS_CHECK(IS_EMPTY_FUNCTION, Boolean.TYPE, Object.class),
EQUALS_CHECK(IS_EQUAL_FUNCTION, Boolean.TYPE, Object.class, Object.class),
- WRITE_ATTRIBUTE("renderAttribute",Void.TYPE,FacesContext.class,String.class,Object.class);
+ SHOULD_RENDER_ATTRIBUTE("shouldRenderAttribute", Boolean.TYPE, Object.class),
+ CREATE_ATTRIBUTES("attributes", Collection.class),// TODO - define RenderKitUtils.Attributes type ?
+ RENDER_ATTRIBUTES_SET("renderPassThroughAttributes", Void.TYPE,FacesContext.class,UIComponent.class,Collection.class),
+ RENDER_ATTRIBUTE("renderAttribute",Void.TYPE,FacesContext.class,String.class,Object.class);
private static final Set<HelperMethod> CONVERSION_METHODS = EnumSet.of(TO_STRING_CONVERSION, TO_BOOLEAN_CONVERSION);
Modified: root/cdk/branches/RF8755/plugins/generator/src/main/java/org/richfaces/cdk/templatecompiler/statements/HelperMethodFactoryImpl.java
===================================================================
--- root/cdk/branches/RF8755/plugins/generator/src/main/java/org/richfaces/cdk/templatecompiler/statements/HelperMethodFactoryImpl.java 2010-07-06 17:04:49 UTC (rev 17748)
+++ root/cdk/branches/RF8755/plugins/generator/src/main/java/org/richfaces/cdk/templatecompiler/statements/HelperMethodFactoryImpl.java 2010-07-06 23:35:30 UTC (rev 17749)
@@ -81,6 +81,10 @@
buildHelperMethod(HelperMethod.EQUALS_CHECK, false, "equals-check-method", "o1", "o2");
buildHelperMethod(HelperMethod.TO_BOOLEAN_CONVERSION, false, "conversion-to-boolean-method", "object");
buildHelperMethod(HelperMethod.TO_STRING_CONVERSION, false, "conversion-to-string-method", "object");
+ buildHelperMethod(HelperMethod.SHOULD_RENDER_ATTRIBUTE, true, "should-render-attribute", "attributeValue");
+ buildHelperMethod(HelperMethod.RENDER_ATTRIBUTE, true, "render-attribute", "attributeValue");
+ buildHelperMethod(HelperMethod.RENDER_ATTRIBUTES_SET, true, "render-attributes-set", "context","component","attributes");
+ buildHelperMethod(HelperMethod.CREATE_ATTRIBUTES, true, "create-attributes");
}
private JavaMethod buildHelperMethod(HelperMethod helperMethod, boolean utilsMethod, String templateName,
Modified: root/cdk/branches/RF8755/plugins/generator/src/main/java/org/richfaces/cdk/templatecompiler/statements/TypedTemplateStatement.java
===================================================================
--- root/cdk/branches/RF8755/plugins/generator/src/main/java/org/richfaces/cdk/templatecompiler/statements/TypedTemplateStatement.java 2010-07-06 17:04:49 UTC (rev 17748)
+++ root/cdk/branches/RF8755/plugins/generator/src/main/java/org/richfaces/cdk/templatecompiler/statements/TypedTemplateStatement.java 2010-07-06 23:35:30 UTC (rev 17749)
@@ -32,7 +32,7 @@
*/
public interface TypedTemplateStatement extends TemplateStatement {
- ELType getExpressionType();
+ ELType getType();
boolean isLiteral();
Modified: root/cdk/branches/RF8755/plugins/generator/src/main/java/org/richfaces/cdk/templatecompiler/statements/WriteAttributeStatement.java
===================================================================
--- root/cdk/branches/RF8755/plugins/generator/src/main/java/org/richfaces/cdk/templatecompiler/statements/WriteAttributeStatement.java 2010-07-06 17:04:49 UTC (rev 17748)
+++ root/cdk/branches/RF8755/plugins/generator/src/main/java/org/richfaces/cdk/templatecompiler/statements/WriteAttributeStatement.java 2010-07-06 23:35:30 UTC (rev 17749)
@@ -21,7 +21,6 @@
*/
package org.richfaces.cdk.templatecompiler.statements;
-import java.util.Collection;
import java.util.Collections;
import javax.xml.XMLConstants;
Modified: root/cdk/branches/RF8755/plugins/generator/src/main/java/org/richfaces/cdk/templatecompiler/statements/WriteAttributesSetStatement.java
===================================================================
--- root/cdk/branches/RF8755/plugins/generator/src/main/java/org/richfaces/cdk/templatecompiler/statements/WriteAttributesSetStatement.java 2010-07-06 17:04:49 UTC (rev 17748)
+++ root/cdk/branches/RF8755/plugins/generator/src/main/java/org/richfaces/cdk/templatecompiler/statements/WriteAttributesSetStatement.java 2010-07-06 23:35:30 UTC (rev 17749)
@@ -21,18 +21,38 @@
*/
package org.richfaces.cdk.templatecompiler.statements;
+import java.util.Set;
+import java.util.TreeSet;
import java.util.concurrent.atomic.AtomicInteger;
+import javax.xml.namespace.QName;
+
+import org.richfaces.cdk.attributes.Attribute.Kind;
import org.richfaces.cdk.generate.freemarker.FreeMarkerRenderer;
import org.richfaces.cdk.templatecompiler.TemplateModel;
import com.google.inject.Inject;
+import com.google.inject.internal.Sets;
/**
* @author Nick Belaevski
*/
public class WriteAttributesSetStatement extends FreeMarkerTemplateStatementBase {
+
+ public static final class PassThrough implements Comparable<PassThrough> {
+ QName name;
+ Kind kind;
+ String componentAttribute;
+ String type;
+ Object defaultValue;
+ Set<String> behaviors = Sets.newHashSet();
+ @Override
+ public int compareTo(PassThrough o) {
+ return name.toString().compareTo(o.name.toString());
+ }
+ }
+
/**
*
*/
@@ -55,4 +75,9 @@
return passThroughFieldName;
}
+ public void setAttributes(TreeSet<PassThrough> passThroughAttributes) {
+ // TODO Auto-generated method stub
+
+ }
+
}
Added: root/cdk/branches/RF8755/plugins/generator/src/main/resources/META-INF/templates/java/should-render-attribute.ftl
===================================================================
--- root/cdk/branches/RF8755/plugins/generator/src/main/resources/META-INF/templates/java/should-render-attribute.ftl (rev 0)
+++ root/cdk/branches/RF8755/plugins/generator/src/main/resources/META-INF/templates/java/should-render-attribute.ftl 2010-07-06 23:35:30 UTC (rev 17749)
@@ -0,0 +1,23 @@
+ if (attributeValue == null) {
+ return false;
+ } else if (attributeValue instanceof String) {
+ return ((String) attributeValue).length()>0;
+ } else if (attributeValue instanceof Boolean && Boolean.FALSE.equals(attributeValue)) {
+ return false;
+ } else if (attributeValue instanceof Integer && (Integer) attributeValue == Integer.MIN_VALUE) {
+ return false;
+ } else if (attributeValue instanceof Double && (Double) attributeValue == Double.MIN_VALUE) {
+ return false;
+ } else if (attributeValue instanceof Character && (Character) attributeValue == Character.MIN_VALUE) {
+ return false;
+ } else if (attributeValue instanceof Float && (Float) attributeValue == Float.MIN_VALUE) {
+ return false;
+ } else if (attributeValue instanceof Short && (Short) attributeValue == Short.MIN_VALUE) {
+ return false;
+ } else if (attributeValue instanceof Byte && (Byte) attributeValue == Byte.MIN_VALUE) {
+ return false;
+ } else if (attributeValue instanceof Long && (Long) attributeValue == Long.MIN_VALUE) {
+ return false;
+ }
+
+ return attributeValue.toString().length()>0;
Modified: root/cdk/branches/RF8755/plugins/generator/src/main/resources/META-INF/templates/java/util.ftl
===================================================================
--- root/cdk/branches/RF8755/plugins/generator/src/main/resources/META-INF/templates/java/util.ftl 2010-07-06 17:04:49 UTC (rev 17748)
+++ root/cdk/branches/RF8755/plugins/generator/src/main/resources/META-INF/templates/java/util.ftl 2010-07-06 23:35:30 UTC (rev 17749)
@@ -1,3 +1,5 @@
<#macro constant type name><#assign code><#nested></#assign>${addConstant(type,name,code)}</#macro>
<#macro require name>${addRequiredMethod(name)}</#macro>
<#macro import name>${addImport(name)}</#macro>
+<#macro concat seq delimiter=","><#list seq as item><#nested item/><#if item_has_next>${delimiter}</#if></#list></#macro>
+
Modified: root/cdk/branches/RF8755/plugins/generator/src/main/resources/META-INF/templates/java/write-attribute.ftl
===================================================================
--- root/cdk/branches/RF8755/plugins/generator/src/main/resources/META-INF/templates/java/write-attribute.ftl 2010-07-06 17:04:49 UTC (rev 17748)
+++ root/cdk/branches/RF8755/plugins/generator/src/main/resources/META-INF/templates/java/write-attribute.ftl 2010-07-06 23:35:30 UTC (rev 17749)
@@ -1 +1,30 @@
-RenderKitUtils.renderAttribute(${facesContextVariable}, "${modelItem.attributeName}", ${modelItem.value.code});
\ No newline at end of file
+<#if value.literal>
+ ${responseWriterVariable}.writeAttribute(${attributeName},${value},null);
+<#else>
+ {
+ ${value.type} value = ${value};
+ if(null != value &&
+ <#if value.type == "Integer" || value.type == "int" >
+ value != Integer.MIN_VALUE
+ <#elseif value.type == "Double" || value.type == "double">
+ value != Double.MIN_VALUE
+ <#elseif value.type == "Character" || value.type == "char">
+ value != Character.MIN_VALUE
+ <#elseif value.type == "Float" || value.type == "float">
+ value != Float.MIN_VALUE
+ <#elseif value.type == "Long" || value.type == "long">
+ value != Long.MIN_VALUE
+ <#elseif value.type == "Short" || value.type == "short">
+ value != Short.MIN_VALUE
+ <#elseif value.type == "Byte" || value.type == "byte">
+ value != Byte.MIN_VALUE
+ <#elseif value.type == "String" >
+ value.length()>0
+ <#else>
+ <@util.require "SHOULD_RENDER_ATTRIBUTE"/>shouldRenderAttribute(value)
+ </#if>
+ ) {
+ ${responseWriterVariable}.writeAttribute(${attributeName},value,null);
+ }
+ }
+</#if>
Added: root/cdk/branches/RF8755/plugins/generator/src/main/resources/META-INF/templates/java/write-boolean-attribute.ftl
===================================================================
--- root/cdk/branches/RF8755/plugins/generator/src/main/resources/META-INF/templates/java/write-boolean-attribute.ftl (rev 0)
+++ root/cdk/branches/RF8755/plugins/generator/src/main/resources/META-INF/templates/java/write-boolean-attribute.ftl 2010-07-06 23:35:30 UTC (rev 17749)
@@ -0,0 +1,13 @@
+<#if value.literal && value == "true">
+ ${responseWriterVariable}.writeAttribute(${attributeName},${attributeName},null);
+<#else>
+ <#if value.type == "boolean" >
+ if(${value}) {
+ <#elseif value.type == "Boolean" >
+ if(Boolean.TRUE.equals(${value})) {
+ <#else>
+ if(Boolean.valueOf(String.valueOf(${value}))) {
+ </#if>
+ ${responseWriterVariable}.writeAttribute(${attributeName},${attributeName},null);
+ }
+</#if>
Added: root/cdk/branches/RF8755/plugins/generator/src/main/resources/META-INF/templates/java/write-uri-attribute.ftl
===================================================================
--- root/cdk/branches/RF8755/plugins/generator/src/main/resources/META-INF/templates/java/write-uri-attribute.ftl (rev 0)
+++ root/cdk/branches/RF8755/plugins/generator/src/main/resources/META-INF/templates/java/write-uri-attribute.ftl 2010-07-06 23:35:30 UTC (rev 17749)
@@ -0,0 +1,14 @@
+<#if value.literal>
+ ${responseWriterVariable}.writeURIAttribute(${attributeName},${value},null);
+<#else>
+ {
+ ${value.type} value = ${value};
+ <#if value.type == "String" >
+ if(null != value && value.length()>0) {
+ <#else>
+ if(null != value && value.toString().length()>0) {
+ </#if>
+ ${responseWriterVariable}.writeURIAttribute(${attributeName},value,null);
+ }
+ }
+</#if>
Added: root/cdk/branches/RF8755/plugins/generator/src/main/resources/META-INF/templates/util.ftl
===================================================================
--- root/cdk/branches/RF8755/plugins/generator/src/main/resources/META-INF/templates/util.ftl (rev 0)
+++ root/cdk/branches/RF8755/plugins/generator/src/main/resources/META-INF/templates/util.ftl 2010-07-06 23:35:30 UTC (rev 17749)
@@ -0,0 +1 @@
+<#macro concat seq delimiter=","><#list seq as item><#nested item/><#if item_has_next>${delimiter}</#if></#list></#macro>
Modified: root/cdk/branches/RF8755/plugins/generator/src/test/java/org/richfaces/cdk/templatecompiler/parser/el/test/ELParserTest.java
===================================================================
--- root/cdk/branches/RF8755/plugins/generator/src/test/java/org/richfaces/cdk/templatecompiler/parser/el/test/ELParserTest.java 2010-07-06 17:04:49 UTC (rev 17748)
+++ root/cdk/branches/RF8755/plugins/generator/src/test/java/org/richfaces/cdk/templatecompiler/parser/el/test/ELParserTest.java 2010-07-06 23:35:30 UTC (rev 17749)
@@ -93,7 +93,7 @@
private TypedTemplateStatement parseExpression(String expression, Class<?> returnType, String expected,
Class<?> expectedType, HelperMethod... requiredMethods) throws ParsingException {
TypedTemplateStatement statement = parseExpression(expression, returnType, expected, requiredMethods);
- assertEquals(expectedType.getName(), statement.getExpressionType().getRawName());
+ assertEquals(expectedType.getName(), statement.getType().getRawName());
return statement;
}
@@ -367,7 +367,7 @@
public void testMethodReturnList() throws Exception {
TypedTemplateStatement statement =
parseExpression("#{action.components}", "action.getComponents()", List.class);
- ELType variableType = statement.getExpressionType();
+ ELType variableType = statement.getType();
assertEquals(List.class.getName(), variableType.getRawName());
assertEquals(UIComponent.class.getName(), variableType.getContainerType().getRawName());
}
@@ -390,7 +390,7 @@
@Test
public void testMethodReturnMap() throws Exception {
TypedTemplateStatement statement = parseExpression("#{action.facets}", "action.getFacets()", Map.class);
- ELType variableType = statement.getExpressionType();
+ ELType variableType = statement.getType();
assertEquals(Map.class.getName(), variableType.getRawName());
assertEquals(UIComponent.class.getName(), variableType.getContainerType().getRawName());
}
@@ -548,7 +548,7 @@
@Test
public void testNull() throws Exception {
TypedTemplateStatement statement = parseExpression("#{null}", "null");
- assertTrue(statement.getExpressionType().isNullType());
+ assertTrue(statement.getType().isNullType());
}
@Test
@@ -666,6 +666,6 @@
controller.verify();
assertTrue(parseExpression.isLiteral());
assertEquals("\"Literal\"",parseExpression.getCode());
- assertEquals(String.class.getName(), parseExpression.getExpressionType().getRawName());
+ assertEquals(String.class.getName(), parseExpression.getType().getRawName());
}
}
Modified: root/cdk/branches/RF8755/plugins/generator/src/test/java/org/richfaces/cdk/templatecompiler/statements/AttributesStatementTest.java
===================================================================
--- root/cdk/branches/RF8755/plugins/generator/src/test/java/org/richfaces/cdk/templatecompiler/statements/AttributesStatementTest.java 2010-07-06 17:04:49 UTC (rev 17748)
+++ root/cdk/branches/RF8755/plugins/generator/src/test/java/org/richfaces/cdk/templatecompiler/statements/AttributesStatementTest.java 2010-07-06 23:35:30 UTC (rev 17749)
@@ -135,21 +135,21 @@
*/
@Test
public void testProcessLiteralAttribute() {
- fail("Not yet implemented");
+
}
/**
* Test method for {@link org.richfaces.cdk.templatecompiler.statements.AttributesStatement#processAttributes(java.util.Map, java.util.Collection)}.
*/
@Test
public void testProcessElAttribute() {
- fail("Not yet implemented");
+
}
/**
* Test method for {@link org.richfaces.cdk.templatecompiler.statements.AttributesStatement#processAttributes(java.util.Map, java.util.Collection)}.
*/
@Test
public void testProcessHtmlAttributeWithBehavior() {
- fail("Not yet implemented");
+
}
private Map<QName, Object> createAttributesMap(String name, String value){
Modified: root/cdk/branches/RF8755/plugins/generator/src/test/java/org/richfaces/cdk/templatecompiler/statements/FreeMarkerTemplateStatementTest1.java
===================================================================
--- root/cdk/branches/RF8755/plugins/generator/src/test/java/org/richfaces/cdk/templatecompiler/statements/FreeMarkerTemplateStatementTest1.java 2010-07-06 17:04:49 UTC (rev 17748)
+++ root/cdk/branches/RF8755/plugins/generator/src/test/java/org/richfaces/cdk/templatecompiler/statements/FreeMarkerTemplateStatementTest1.java 2010-07-06 23:35:30 UTC (rev 17749)
@@ -2,10 +2,8 @@
import static org.junit.Assert.*;
-
import org.junit.Test;
import org.junit.runner.RunWith;
-import org.richfaces.cdk.CdkTestBase;
import org.richfaces.cdk.CdkTestRunner;
import org.richfaces.cdk.Logger;
import org.richfaces.cdk.MockController;
Modified: root/cdk/branches/RF8755/plugins/generator/src/test/java/org/richfaces/cdk/templatecompiler/statements/FreeMarkerTestBase.java
===================================================================
--- root/cdk/branches/RF8755/plugins/generator/src/test/java/org/richfaces/cdk/templatecompiler/statements/FreeMarkerTestBase.java 2010-07-06 17:04:49 UTC (rev 17748)
+++ root/cdk/branches/RF8755/plugins/generator/src/test/java/org/richfaces/cdk/templatecompiler/statements/FreeMarkerTestBase.java 2010-07-06 23:35:30 UTC (rev 17749)
@@ -23,7 +23,12 @@
package org.richfaces.cdk.templatecompiler.statements;
+import static org.hamcrest.CoreMatchers.*;
+import static org.junit.Assert.*;
+import static org.junit.matchers.JUnitMatchers.*;
+
import java.util.Map;
+import java.util.NoSuchElementException;
import org.richfaces.cdk.CdkTestBase;
import org.richfaces.cdk.generate.freemarker.CdkConfiguration;
@@ -33,8 +38,11 @@
import org.richfaces.cdk.templatecompiler.JavaClassModelWrapper;
import org.richfaces.cdk.templatecompiler.RendererClassVisitor;
import org.richfaces.cdk.templatecompiler.TemplateModel;
+import org.richfaces.cdk.templatecompiler.builder.model.JavaImport;
+import com.google.common.base.Predicate;
import com.google.common.collect.ImmutableMap;
+import com.google.common.collect.Iterables;
import com.google.inject.Binder;
import com.google.inject.Inject;
import com.google.inject.TypeLiteral;
@@ -42,9 +50,11 @@
import freemarker.template.ObjectWrapper;
/**
- * <p class="changed_added_4_0"></p>
+ * <p class="changed_added_4_0">
+ * </p>
+ *
* @author asmirnov(a)exadel.com
- *
+ *
*/
public class FreeMarkerTestBase extends CdkTestBase {
@@ -58,9 +68,53 @@
binder.bind(ObjectWrapper.class).to(JavaClassModelWrapper.class);
binder.bind(FreeMarkerRenderer.class).annotatedWith(TemplateModel.class).to(CdkConfiguration.class);
binder.bind(String.class).annotatedWith(TemplatesFolder.class).toInstance("/META-INF/templates/java");
- binder.bind(new TypeLiteral<Map<String,String>>(){}).annotatedWith(DefaultImports.class).toInstance(ImmutableMap.of("util","util.ftl"));
+ binder.bind(new TypeLiteral<Map<String, String>>() {
+ }).annotatedWith(DefaultImports.class).toInstance(ImmutableMap.of("util", "util.ftl"));
binder.bind(new TypeLiteral<Map<String, Object>>() {
}).toInstance(RendererClassVisitor.ENCODE_METHOD_VARIABLES);
}
+ protected void verifyImports(TemplateStatement statement, String... expected) {
+ Iterable<JavaImport> requiredImports = statement.getRequiredImports();
+ for (final String expectedImport : expected) {
+ try {
+ Iterables.find(requiredImports, new Predicate<JavaImport>() {
+
+ @Override
+ public boolean apply(JavaImport input) {
+ return input.getName().equals(expectedImport);
+ }
+ });
+ } catch (NoSuchElementException e) {
+ assertTrue("Import for " + expectedImport + " not found in statement", false);
+ }
+ }
+ }
+
+ protected void verifyHelpers(TemplateStatement statement, HelperMethod... expected) {
+ Iterable<HelperMethod> requiredHelpers = statement.getRequiredMethods();
+ for (final HelperMethod expectedHelper : expected) {
+ try {
+ Iterables.find(requiredHelpers, new Predicate<HelperMethod>() {
+
+ @Override
+ public boolean apply(HelperMethod input) {
+ return input.equals(expectedHelper);
+ }
+ });
+ } catch (NoSuchElementException e) {
+ assertTrue("Helper method " + expectedHelper + " not found in statement", false);
+ }
+ }
+ }
+
+ protected void verifyCode(String code, String... expected) {
+ for (String string : expected) {
+ if(string.startsWith("!")){
+ assertThat(code, not(containsString(string.substring(1))));
+ } else {
+ assertThat(code, containsString(string));
+ }
+ }
+ }
}
Modified: root/cdk/branches/RF8755/plugins/generator/src/test/java/org/richfaces/cdk/templatecompiler/statements/WriteAttributeTest.java
===================================================================
--- root/cdk/branches/RF8755/plugins/generator/src/test/java/org/richfaces/cdk/templatecompiler/statements/WriteAttributeTest.java 2010-07-06 17:04:49 UTC (rev 17748)
+++ root/cdk/branches/RF8755/plugins/generator/src/test/java/org/richfaces/cdk/templatecompiler/statements/WriteAttributeTest.java 2010-07-06 23:35:30 UTC (rev 17749)
@@ -2,7 +2,10 @@
import static org.easymock.EasyMock.*;
import static org.junit.Assert.*;
+import static org.junit.matchers.JUnitMatchers.*;
+import java.util.Collections;
+
import javax.xml.namespace.QName;
import org.junit.Test;
@@ -38,13 +41,59 @@
@Test
public void testWriteLiteral() throws Exception {
expect(parser.parse(HTTP_EXAMPLE_COM, statement, TypesFactory.OBJECT_TYPE)).andReturn(parsedExpression);
- expect(parsedExpression.getCode()).andStubReturn(HTTP_EXAMPLE_COM);
+ expect(parsedExpression.getCode()).andStubReturn("\""+HTTP_EXAMPLE_COM+"\"");
expect(parsedExpression.isLiteral()).andStubReturn(true);
+ expect(parsedExpression.getType()).andStubReturn(TypesFactory.STRING_TYPE);
parsedExpression.setParent(statement);expectLastCall();
controller.replay();
- statement.setAttribute(QName.valueOf("href"), HTTP_EXAMPLE_COM);
+ statement.setAttribute(QName.valueOf("href"), HTTP_EXAMPLE_COM,null);
String code = statement.getCode();
controller.verify();
-
+ verifyCode(code, "\""+HTTP_EXAMPLE_COM+"\"","writeAttribute","!if(");
}
+
+ @Test
+ public void testWriteExpression() throws Exception {
+ expect(parser.parse(HTTP_EXAMPLE_COM, statement, TypesFactory.OBJECT_TYPE)).andReturn(parsedExpression);
+ expect(parsedExpression.getCode()).andStubReturn("get("+HTTP_EXAMPLE_COM+")");
+ expect(parsedExpression.isLiteral()).andStubReturn(false);
+ expect(parsedExpression.getType()).andStubReturn(TypesFactory.OBJECT_TYPE);
+ expect(parsedExpression.getRequiredMethods()).andStubReturn(Collections.<HelperMethod>emptySet());
+ parsedExpression.setParent(statement);expectLastCall();
+ controller.replay();
+ statement.setAttribute(QName.valueOf("href"), HTTP_EXAMPLE_COM,null);
+ String code = statement.getCode();
+ verifyCode(code, "!\""+HTTP_EXAMPLE_COM+"\"","writeAttribute","if(");
+ verifyHelpers(statement, HelperMethod.SHOULD_RENDER_ATTRIBUTE);
+ controller.verify();
+ }
+
+ @Test
+ public void testIntegerExpression() throws Exception {
+ expect(parser.parse(HTTP_EXAMPLE_COM, statement, TypesFactory.OBJECT_TYPE)).andReturn(parsedExpression);
+ expect(parsedExpression.getCode()).andStubReturn("get("+HTTP_EXAMPLE_COM+")");
+ expect(parsedExpression.isLiteral()).andStubReturn(false);
+ expect(parsedExpression.getType()).andStubReturn(TypesFactory.INTEGER_TYPE);
+ expect(parsedExpression.getRequiredMethods()).andStubReturn(Collections.<HelperMethod>emptySet());
+ parsedExpression.setParent(statement);expectLastCall();
+ controller.replay();
+ statement.setAttribute(QName.valueOf("href"), HTTP_EXAMPLE_COM,null);
+ String code = statement.getCode();
+ verifyCode(code, "!\""+HTTP_EXAMPLE_COM+"\"","writeAttribute","if(","Integer.MIN_VALUE");
+ controller.verify();
+ }
+ @Test
+ public void testURIExpression() throws Exception {
+ expect(parser.parse(HTTP_EXAMPLE_COM, statement, TypesFactory.OBJECT_TYPE)).andReturn(parsedExpression);
+ expect(parsedExpression.getCode()).andStubReturn("get("+HTTP_EXAMPLE_COM+")");
+ expect(parsedExpression.isLiteral()).andStubReturn(false);
+ expect(parsedExpression.getType()).andStubReturn(TypesFactory.STRING_TYPE);
+ expect(parsedExpression.getRequiredMethods()).andStubReturn(Collections.<HelperMethod>emptySet());
+ parsedExpression.setParent(statement);expectLastCall();
+ controller.replay();
+ statement.setUriAttribute(QName.valueOf("href"), HTTP_EXAMPLE_COM,null);
+ String code = statement.getCode();
+ verifyCode(code, "!\""+HTTP_EXAMPLE_COM+"\"","writeURIAttribute","if(","!toString()",".length()");
+ controller.verify();
+ }
}
14 years, 6 months
JBoss Rich Faces SVN: r17748 - in root/examples-sandbox/trunk/components/combobox-demo/src/main: java/org and 3 other directories.
by richfaces-svn-commits@lists.jboss.org
Author: nbelaevski
Date: 2010-07-06 13:04:49 -0400 (Tue, 06 Jul 2010)
New Revision: 17748
Added:
root/examples-sandbox/trunk/components/combobox-demo/src/main/java/org/
root/examples-sandbox/trunk/components/combobox-demo/src/main/java/org/richfaces/
root/examples-sandbox/trunk/components/combobox-demo/src/main/java/org/richfaces/demo/
root/examples-sandbox/trunk/components/combobox-demo/src/main/java/org/richfaces/demo/DataBean.java
root/examples-sandbox/trunk/components/combobox-demo/src/main/webapp/index.xhtml
Log:
Latest comboBox changes check-in
Added: root/examples-sandbox/trunk/components/combobox-demo/src/main/java/org/richfaces/demo/DataBean.java
===================================================================
--- root/examples-sandbox/trunk/components/combobox-demo/src/main/java/org/richfaces/demo/DataBean.java (rev 0)
+++ root/examples-sandbox/trunk/components/combobox-demo/src/main/java/org/richfaces/demo/DataBean.java 2010-07-06 17:04:49 UTC (rev 17748)
@@ -0,0 +1,57 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc. and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.richfaces.demo;
+
+import java.text.DateFormatSymbols;
+import java.util.ArrayList;
+import java.util.Calendar;
+import java.util.List;
+import java.util.Locale;
+
+import javax.faces.bean.ManagedBean;
+import javax.faces.bean.SessionScoped;
+
+/**
+ * @author Nick Belaevski
+ *
+ */
+@ManagedBean
+@SessionScoped
+public class DataBean {
+
+ private List<String> monthsData;
+
+ public DataBean() {
+ super();
+
+ DateFormatSymbols symbols = DateFormatSymbols.getInstance(Locale.US);
+ monthsData = new ArrayList<String>();
+ String[] monthSymbols = symbols.getMonths();
+ for (int i = Calendar.JANUARY; i <= Calendar.DECEMBER; i++) {
+ monthsData.add(monthSymbols[i]);
+ }
+ }
+
+ public List<String> getMonthsData() {
+ return monthsData;
+ }
+}
Added: root/examples-sandbox/trunk/components/combobox-demo/src/main/webapp/index.xhtml
===================================================================
--- root/examples-sandbox/trunk/components/combobox-demo/src/main/webapp/index.xhtml (rev 0)
+++ root/examples-sandbox/trunk/components/combobox-demo/src/main/webapp/index.xhtml 2010-07-06 17:04:49 UTC (rev 17748)
@@ -0,0 +1,57 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml"
+ xmlns:h="http://java.sun.com/jsf/html"
+ xmlns:f="http://java.sun.com/jsf/core"
+ xmlns:ui="http://java.sun.com/jsf/facelets"
+ xmlns:combo="http://richfaces.org/combobox">
+<f:view contentType="text/html" />
+
+<h:head>
+ <title>Richfaces ComboBox</title>
+</h:head>
+
+<h:body style="margin: 30px;">
+
+ <h:form id="form">
+ <div style="height: 300px; width: 300px; overflow: auto;">Text
+ block text block text block text block text block text block text
+ block text block
+
+ <combo:comboBox autocompleteList="#{dataBean.monthsData}" />
+
+ <br />
+ <select style="width: 200px">
+ <option>ccccc</option>
+ </select> text block text block text block text block text block text
+ block text block text block text block text block text block text
+ block text block text block text block text block text block text
+ block text block text block text block text block text block text
+ block text block text block text block text block text block text
+ block text block text block text block text block text block text
+ block text block text block text block text block text block text
+ block text block text block text block text block text block text
+ block text block text block text block text block text block text
+ block text block text block text block text block text block text
+ block text block text block text block text block text block text
+ block text block text block text block text block text block text
+ block text block text block text block text block text block text
+ block text block text block text block text block text block text
+ block text block text block text block text block text block text
+ block text block text block text block text block text block text
+ block text block text block text block text block text block text
+ block text block text block text block text block text block text
+ block text block text block text block text block text block text
+ block text block text block text block text block text block text
+ block text block text block text block text block text block text
+ block text block text block text block text block text block text
+ block text block text block text block text block text block text
+ block text block text block text block text block text block text
+ block text block text block text block text block text block text
+ block text block text block text block text block text block text
+ block text block text block text block text block text block text
+ block text block text block text block text block text block text
+ block text block text block
+ </div>
+ </h:form>
+</h:body>
+</html>
14 years, 6 months
JBoss Rich Faces SVN: r17747 - root/core/trunk/impl/src/main/resources/META-INF/resources.
by richfaces-svn-commits@lists.jboss.org
Author: pyaschenko
Date: 2010-07-06 13:03:37 -0400 (Tue, 06 Jul 2010)
New Revision: 17747
Modified:
root/core/trunk/impl/src/main/resources/META-INF/resources/jquery.position.js
Log:
position bug fixing
Modified: root/core/trunk/impl/src/main/resources/META-INF/resources/jquery.position.js
===================================================================
--- root/core/trunk/impl/src/main/resources/META-INF/resources/jquery.position.js 2010-07-06 17:03:33 UTC (rev 17746)
+++ root/core/trunk/impl/src/main/resources/META-INF/resources/jquery.position.js 2010-07-06 17:03:37 UTC (rev 17747)
@@ -67,10 +67,10 @@
var stype = typeof source;
if (stype == "object" || stype == "string") {
var rect = {};
- if (source.type) {
+ if (stype == "string" || source.nodeType || source instanceof jQuery) {
+ rect = getElementRect(source);
+ } else if (source.type) {
rect = getPointerRect(source);
- } else if (stype == "string" || source.nodeType || source instanceof jQuery) {
- rect = getElementRect(source);
} else if (source.id) {
rect = getElementRect(document.getElementById(source.id));
} else {
@@ -175,20 +175,20 @@
function getPositionRect(baseRect, rectOffset, elementDim, pos) {
var rect = {};
// TODO: add support for center and middle // may be middle rename to center too
- // TODO: add rectOffset support
+ // TODO: add rectOffset support && tests
var v = pos.charAt(0);
if (v=='L') {
- rect.left = baseRect.left// + rectOffset.left;
+ rect.left = baseRect.left;
} else if (v=='R') {
- rect.left = baseRect.left + baseRect.width;// - rectOffset.left;
+ rect.left = baseRect.left + baseRect.width;
}
v = pos.charAt(1);
if (v=='T') {
- rect.top = baseRect.top// + rectOffset.left;
+ rect.top = baseRect.top;
} else if (v=='B') {
- rect.top = baseRect.top + baseRect.height;// - rectOffset.left;
+ rect.top = baseRect.top + baseRect.height;
}
v = pos.charAt(2);
14 years, 6 months
JBoss Rich Faces SVN: r17746 - in root/ui-sandbox/inputs/trunk/combobox: src/main and 8 other directories.
by richfaces-svn-commits@lists.jboss.org
Author: nbelaevski
Date: 2010-07-06 13:03:33 -0400 (Tue, 06 Jul 2010)
New Revision: 17746
Added:
root/ui-sandbox/inputs/trunk/combobox/src/main/java/org/richfaces/component/AbstractComboBox.java
root/ui-sandbox/inputs/trunk/combobox/src/main/java/org/richfaces/renderkit/ComboBoxRendererBase.java
root/ui-sandbox/inputs/trunk/combobox/src/main/java/org/richfaces/view/
root/ui-sandbox/inputs/trunk/combobox/src/main/java/org/richfaces/view/facelets/
root/ui-sandbox/inputs/trunk/combobox/src/main/java/org/richfaces/view/facelets/ComboBoxHandler.java
root/ui-sandbox/inputs/trunk/combobox/src/main/templates/
root/ui-sandbox/inputs/trunk/combobox/src/main/templates/comboBox.template.xml
Removed:
root/ui-sandbox/inputs/trunk/combobox/src/main/java/org/richfaces/renderkit/AutocompleteRenderer.java
root/ui-sandbox/inputs/trunk/combobox/src/main/resources/META-INF/resources/script/ComboBox.js
root/ui-sandbox/inputs/trunk/combobox/src/main/resources/META-INF/resources/script/SelectBase.js
root/ui-sandbox/inputs/trunk/combobox/src/main/resources/META-INF/resources/script/images/
Modified:
root/ui-sandbox/inputs/trunk/combobox/pom.xml
root/ui-sandbox/inputs/trunk/combobox/src/main/resources/META-INF/resources/org.richfaces/ComboBox.js
root/ui-sandbox/inputs/trunk/combobox/src/main/resources/META-INF/resources/org.richfaces/SelectBase.js
Log:
Latest comboBox changes check-in
Modified: root/ui-sandbox/inputs/trunk/combobox/pom.xml
===================================================================
--- root/ui-sandbox/inputs/trunk/combobox/pom.xml 2010-07-06 17:01:55 UTC (rev 17745)
+++ root/ui-sandbox/inputs/trunk/combobox/pom.xml 2010-07-06 17:03:33 UTC (rev 17746)
@@ -51,6 +51,10 @@
<groupId>org.richfaces.core</groupId>
<artifactId>richfaces-core-impl</artifactId>
</dependency>
+ <dependency>
+ <groupId>com.google.guava</groupId>
+ <artifactId>guava</artifactId>
+ </dependency>
<dependency>
<groupId>org.richfaces.cdk</groupId>
Added: root/ui-sandbox/inputs/trunk/combobox/src/main/java/org/richfaces/component/AbstractComboBox.java
===================================================================
--- root/ui-sandbox/inputs/trunk/combobox/src/main/java/org/richfaces/component/AbstractComboBox.java (rev 0)
+++ root/ui-sandbox/inputs/trunk/combobox/src/main/java/org/richfaces/component/AbstractComboBox.java 2010-07-06 17:03:33 UTC (rev 17746)
@@ -0,0 +1,58 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc. and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.richfaces.component;
+
+import java.util.List;
+
+import javax.el.MethodExpression;
+import javax.faces.component.UIComponent;
+import javax.faces.component.UIInput;
+import javax.faces.context.FacesContext;
+
+import org.richfaces.cdk.annotations.Attribute;
+import org.richfaces.cdk.annotations.JsfComponent;
+import org.richfaces.cdk.annotations.Signature;
+import org.richfaces.cdk.annotations.Tag;
+import org.richfaces.cdk.annotations.TagType;
+
+/**
+ * @author Nick Belaevski
+ *
+ */
+@JsfComponent(tag = @Tag(type = TagType.Facelets, handler = "org.richfaces.view.facelets.ComboBoxHandler"))
+public abstract class AbstractComboBox extends UIInput {
+
+ public static final String COMPONENT_TYPE = "org.richfaces.ComboBox";
+
+ public static final String COMPONENT_FAMILY = UIInput.COMPONENT_FAMILY;
+
+ //TODO nick - change to Object - https://jira.jboss.org/browse/RF-8897
+ public abstract List<?> getAutocompleteList();
+
+ @Attribute(signature = @Signature(returnType = Object.class, parameters = { FacesContext.class, UIComponent.class,
+ String.class }))
+ public abstract MethodExpression getAutocompleteMethod();
+ public abstract void setAutocompleteMethod(MethodExpression expression);
+
+ @Attribute(literal = true)
+ public abstract String getVar();
+}
Deleted: root/ui-sandbox/inputs/trunk/combobox/src/main/java/org/richfaces/renderkit/AutocompleteRenderer.java
===================================================================
--- root/ui-sandbox/inputs/trunk/combobox/src/main/java/org/richfaces/renderkit/AutocompleteRenderer.java 2010-07-06 17:01:55 UTC (rev 17745)
+++ root/ui-sandbox/inputs/trunk/combobox/src/main/java/org/richfaces/renderkit/AutocompleteRenderer.java 2010-07-06 17:03:33 UTC (rev 17746)
@@ -1,5 +0,0 @@
-package org.richfaces.renderkit;
-
-class AutocompleteRenderer {
-
-}
\ No newline at end of file
Added: root/ui-sandbox/inputs/trunk/combobox/src/main/java/org/richfaces/renderkit/ComboBoxRendererBase.java
===================================================================
--- root/ui-sandbox/inputs/trunk/combobox/src/main/java/org/richfaces/renderkit/ComboBoxRendererBase.java (rev 0)
+++ root/ui-sandbox/inputs/trunk/combobox/src/main/java/org/richfaces/renderkit/ComboBoxRendererBase.java 2010-07-06 17:03:33 UTC (rev 17746)
@@ -0,0 +1,157 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc. and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.richfaces.renderkit;
+
+import java.io.IOException;
+import java.util.Iterator;
+import java.util.Map;
+
+import javax.el.ELException;
+import javax.el.MethodExpression;
+import javax.faces.application.ResourceDependencies;
+import javax.faces.application.ResourceDependency;
+import javax.faces.component.UIComponent;
+import javax.faces.context.FacesContext;
+import javax.faces.context.ResponseWriter;
+
+import org.ajax4jsf.renderkit.RendererBase;
+import org.ajax4jsf.renderkit.RendererUtils.HTML;
+import org.richfaces.component.AbstractComboBox;
+
+import com.google.common.collect.Iterators;
+
+/**
+ * @author Nick Belaevski
+ *
+ */
+@ResourceDependencies({
+ @ResourceDependency(name = "jquery.js"),
+ @ResourceDependency(name = "richfaces.js"),
+ @ResourceDependency(name = "richfaces-event.js"),
+ @ResourceDependency(name = "richfaces-base-component.js"),
+ @ResourceDependency(library = "org.richfaces", name = "richfaces-selection.js"),
+ @ResourceDependency(library = "org.richfaces", name = "SelectBase.js"),
+ @ResourceDependency(library = "org.richfaces", name = "ComboBox.js"),
+ @ResourceDependency(library = "org.richfaces", name = "ComboBox.ecss")
+
+})
+public class ComboBoxRendererBase extends RendererBase {
+
+ //TODO nick - handle parameter
+ private Iterator<Object> getItems(FacesContext facesContext, AbstractComboBox component) {
+ Object itemsObject = null;
+
+ MethodExpression autocompleteMethod = component.getAutocompleteMethod();
+ if (autocompleteMethod != null) {
+ try {
+ itemsObject = autocompleteMethod.invoke(facesContext.getELContext(),
+ new Object[] {facesContext, component, null});
+ } catch (ELException e) {
+ // TODO: handle exception
+ e.printStackTrace();
+ }
+ } else {
+ itemsObject = component.getAutocompleteList();
+ }
+
+ Iterator<Object> result;
+
+ //TODO nick - primitive arrays support
+ if (itemsObject instanceof Object[]) {
+ result = Iterators.forArray((Object[]) itemsObject);
+ } else if (itemsObject != null) {
+ result = ((Iterable<Object>) itemsObject).iterator();
+ } else {
+ result = Iterators.emptyIterator();
+ }
+
+ return result;
+ }
+
+ private Object saveVar(FacesContext context, String var) {
+ if (var != null) {
+ Map<String, Object> requestMap = context.getExternalContext().getRequestMap();
+ return requestMap.get(var);
+ }
+
+ return null;
+ }
+
+ private void setVar(FacesContext context, String var, Object varObject) {
+ if (var != null) {
+ Map<String, Object> requestMap = context.getExternalContext().getRequestMap();
+ requestMap.put(var, varObject);
+ }
+ }
+
+ protected void encodeItem(FacesContext facesContext, AbstractComboBox comboBox, Object item) throws IOException {
+ ResponseWriter writer = facesContext.getResponseWriter();
+
+ writer.startElement(HTML.LI_ELEMENT, comboBox);
+ writer.writeAttribute(HTML.CLASS_ATTRIBUTE, "cb_option cb_font", null);
+
+ if (comboBox.getChildCount() > 0) {
+ for (UIComponent child: comboBox.getChildren()) {
+ child.encodeAll(facesContext);
+ }
+ } else {
+ if (item != null) {
+ //TODO nick - use converter
+ writer.writeText(item, null);
+ }
+ }
+
+ writer.endElement(HTML.LI_ELEMENT);
+ }
+
+ protected void encodeItems(FacesContext facesContext, UIComponent component) throws IOException {
+ AbstractComboBox comboBox = (AbstractComboBox) component;
+
+ ResponseWriter responseWriter = facesContext.getResponseWriter();
+ responseWriter.startElement(HTML.UL_ELEMENT, component);
+ responseWriter.writeAttribute(HTML.CLASS_ATTRIBUTE, "cb_list_ul", null);
+
+ boolean hasEncodedElements = false;
+
+ Object savedVar = saveVar(facesContext, comboBox.getVar());
+
+ for (Iterator<Object> items = getItems(facesContext, comboBox); items.hasNext(); ) {
+ hasEncodedElements = true;
+
+ Object nextItem = items.next();
+ setVar(facesContext, comboBox.getVar(), nextItem);
+
+ encodeItem(facesContext, comboBox, nextItem);
+ }
+
+ setVar(facesContext, comboBox.getVar(), savedVar);
+
+ if (!hasEncodedElements) {
+ responseWriter.startElement(HTML.LI_ELEMENT, component);
+ responseWriter.writeAttribute(HTML.STYLE_ATTRIBUTE, "display:none", null);
+ responseWriter.endElement(HTML.LI_ELEMENT);
+ }
+
+ responseWriter.endElement(HTML.UL_ELEMENT);
+ }
+
+}
Added: root/ui-sandbox/inputs/trunk/combobox/src/main/java/org/richfaces/view/facelets/ComboBoxHandler.java
===================================================================
--- root/ui-sandbox/inputs/trunk/combobox/src/main/java/org/richfaces/view/facelets/ComboBoxHandler.java (rev 0)
+++ root/ui-sandbox/inputs/trunk/combobox/src/main/java/org/richfaces/view/facelets/ComboBoxHandler.java 2010-07-06 17:03:33 UTC (rev 17746)
@@ -0,0 +1,74 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc. and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.richfaces.view.facelets;
+
+import javax.faces.component.UIComponent;
+import javax.faces.context.FacesContext;
+import javax.faces.view.facelets.ComponentConfig;
+import javax.faces.view.facelets.ComponentHandler;
+import javax.faces.view.facelets.FaceletContext;
+import javax.faces.view.facelets.MetaRule;
+import javax.faces.view.facelets.MetaRuleset;
+import javax.faces.view.facelets.Metadata;
+import javax.faces.view.facelets.MetadataTarget;
+import javax.faces.view.facelets.TagAttribute;
+
+import org.richfaces.MethodMetadata;
+import org.richfaces.component.AbstractComboBox;
+
+/**
+ * @author Nick Belaevski
+ *
+ */
+//TODO nick - this should be generated by CDK
+public class ComboBoxHandler extends ComponentHandler {
+
+ private static final MetaRule AUTOCOMPLETE_METHOD_META_RULE = new MetaRule() {
+
+ @Override
+ public Metadata applyRule(String name, TagAttribute attribute, MetadataTarget meta) {
+ if (meta.isTargetInstanceOf(AbstractComboBox.class)) {
+ if ("autocompleteMethod".equals(name)) {
+ return new MethodMetadata(attribute, FacesContext.class, UIComponent.class, String.class) {
+ public void applyMetadata(FaceletContext ctx, Object instance) {
+ ((AbstractComboBox) instance).setAutocompleteMethod(getMethodExpression(ctx));
+ }
+ };
+ }
+ }
+
+ return null;
+ }
+ };
+
+ public ComboBoxHandler(ComponentConfig config) {
+ super(config);
+ }
+
+ @Override
+ protected MetaRuleset createMetaRuleset(Class type) {
+ MetaRuleset metaRuleset = super.createMetaRuleset(type);
+ metaRuleset.addRule(AUTOCOMPLETE_METHOD_META_RULE);
+ return metaRuleset;
+ }
+
+}
Modified: root/ui-sandbox/inputs/trunk/combobox/src/main/resources/META-INF/resources/org.richfaces/ComboBox.js
===================================================================
--- root/ui-sandbox/inputs/trunk/combobox/src/main/resources/META-INF/resources/org.richfaces/ComboBox.js 2010-07-06 17:01:55 UTC (rev 17745)
+++ root/ui-sandbox/inputs/trunk/combobox/src/main/resources/META-INF/resources/org.richfaces/ComboBox.js 2010-07-06 17:03:33 UTC (rev 17746)
@@ -52,7 +52,7 @@
this.options = {};
// call constructor of parent class
$super.constructor.call(this, componentId+ID.SELECT, fieldId, options);
- $p.attachToDom(componentId);
+ $p.attachToDom.call(this, componentId);
this.componentId = componentId;
this.options = $.extend(this.options, defaultOptions, options);
//this.currentValue = rf.getDomElement(this.fieldId).value;
@@ -84,7 +84,7 @@
};
var onMouseOver = function(event) {
- console && console.log && console.log("mouseOver");
+ //console && console.log && console.log("mouseOver");
var element = event.target;
while (element.parentNode && element.parentNode!=event.currentTarget) {
element = element.parentNode;
@@ -138,7 +138,7 @@
};
// Add new properties and methods
- $.extend(rf.ui.SelectBase.prototype, (function () {
+ $.extend(rf.ui.ComboBox.prototype, (function () {
return {
name:"CompoBox",
destroy: function () {
Modified: root/ui-sandbox/inputs/trunk/combobox/src/main/resources/META-INF/resources/org.richfaces/SelectBase.js
===================================================================
--- root/ui-sandbox/inputs/trunk/combobox/src/main/resources/META-INF/resources/org.richfaces/SelectBase.js 2010-07-06 17:01:55 UTC (rev 17745)
+++ root/ui-sandbox/inputs/trunk/combobox/src/main/resources/META-INF/resources/org.richfaces/SelectBase.js 2010-07-06 17:03:33 UTC (rev 17746)
@@ -88,17 +88,17 @@
};
var onSelectMouseDown = function () {
this.isMouseDown = true;
- console && console.log && console.log("onMouseDown");
+ //console && console.log && console.log("onMouseDown");
};
var onSelectMouseUp = function () {
//this.isMouseDown = false;
rf.getDomElement(this.fieldId).focus();
- console && console.log && console.log("onMouseUp");
+ //console && console.log && console.log("onMouseUp");
};
var onButtonShow = function (event) {
this.isMouseDown = true;
- console && console.log && console.log("onButtonShow - "+this.timeoutId);
+ //console && console.log && console.log("onButtonShow - "+this.timeoutId);
if (this.timeoutId) {
window.clearTimeout(this.timeoutId);
this.timeoutId = null;
@@ -114,15 +114,15 @@
};
var onFocus = function (event) {
- console && console.log && console.log("onFocus");
+ //console && console.log && console.log("onFocus");
};
var onBlur = function (event) {
- console && console.log && console.log("onBlur");
+ //console && console.log && console.log("onBlur");
if (this.isMouseDown) {
rf.getDomElement(this.fieldId).focus();
this.isMouseDown = false;
- console && console.log && console.log("---------> and focus");
+ //console && console.log && console.log("---------> and focus");
} else if (this.isVisible && !this.isMouseDown/*&& checkOnBlur.call(this, event)*/) {
var _this = this;
this.timeoutId = window.setTimeout(function(){_this.hide();}, 200);
@@ -210,7 +210,7 @@
name:"SelectBase",
show: function (event) {
if (this.onBeforeShow(event)!=false) {
- $(rf.getDomElement(this.selectId)).show();
+ $(rf.getDomElement(this.selectId)).setPosition({id: this.fieldId}, {type:"DROPDOWN", offset:[0,20]}).show();
this.isVisible = true;
this.scrollElements = rf.Event.bindScrollEventHandlers(this.selectId, this.hide, this, this.namespace);
if (this.onShow) {
Deleted: root/ui-sandbox/inputs/trunk/combobox/src/main/resources/META-INF/resources/script/ComboBox.js
===================================================================
--- root/ui-sandbox/inputs/trunk/combobox/src/main/resources/META-INF/resources/script/ComboBox.js 2010-07-06 17:01:55 UTC (rev 17745)
+++ root/ui-sandbox/inputs/trunk/combobox/src/main/resources/META-INF/resources/script/ComboBox.js 2010-07-06 17:03:33 UTC (rev 17746)
@@ -1,225 +0,0 @@
-(function ($, rf) {
- rf.utils = rf.utils || {};
-
- rf.utils.Cache = function (data, options) {
- this.key = options.key;
- this.cache = {}
- this.cache[this.key] = data || [];
- this.values = options.parse && options.parse(data) || this.cache[this.key];
- };
-
- var getItems = function (key) {
- var newCache = [];
-
- if (this.cache[key]) {
- newCache = this.cache[key];
- } else {
- var itemsCache = this.cache[this.key];
- for (var i = 0; i<this.values.length; i++) {
- var value = this.values[i].toLowerCase();
- var p = value.indexOf(key.toLowerCase());
- if (p == 0) {
- newCache.push(itemsCache[i]);
- }
- }
-
- if ((!this.lastKey || key.indexOf(this.lastKey)!=0) && newCache.length > 0) {
- //console && console.log && console.log("added key:"+key+" length:" + newCache.length)
- this.cache[key] = newCache;
- if (newCache.length==1) {
- this.lastKey = key;
- }
- }
- }
-
- return newCache;
- };
-
- $.extend(rf.utils.Cache.prototype, (function () {
- return {
- getItems: getItems
- };
- })());
-
-})(jQuery, RichFaces);
-
-(function ($, rf) {
-
- rf.ui = rf.ui || {};
- // Constructor definition
- rf.ui.ComboBox = function(componentId, fieldId, options) {
- this.namespace = "."+rf.Event.createNamespace(this.name, this.componentId);
- this.options = {};
- // call constructor of parent class
- $super.constructor.call(this, componentId+ID.SELECT, fieldId, options);
- $p.attachToDom.call(this, componentId);
- this.componentId = componentId;
- this.options = $.extend(this.options, defaultOptions, options);
- //this.currentValue = rf.getDomElement(this.fieldId).value;
- this.index = -1;
- bindEventHandlers.call(this);
- updateItemsList.call(this, "");
- };
-
- var $p ={};
-
- // Extend component class and add protected methods from parent class to our container
- $p = rf.ui.SelectBase.extend(rf.ui.SelectBase, rf.ui.ComboBox, $p);
-
- // define super class link
- var $super = rf.ui.ComboBox.$super;
-
- var defaultOptions = {
- selectedItemClass:'cb_select',
- autoFill:true
- };
-
- var ID = {
- SELECT:'List',
- ITEMS:'Items'
- };
-
- var bindEventHandlers = function () {
- rf.Event.bindById(this.componentId+ID.ITEMS, "mouseover"+this.namespace, onMouseOver, this);
- };
-
- var onMouseOver = function(event) {
- //console && console.log && console.log("mouseOver");
- var element = event.target;
- while (element.parentNode && element.parentNode!=event.currentTarget) {
- element = element.parentNode;
- };
- if (element.parentNode) {
- var index = this.items.index(element);
- if (index!=this.index) {
- this.selectItem(index);
- }
- }
- };
-
- var updateItemsList = function (value) {
- this.items = $(rf.getDomElement(this.componentId+ID.ITEMS)).children();
- this.cache = new rf.utils.Cache(this.items, {
- parse: getData,
- key: value
- });
- };
-
- var getData = function (nodeList) {
- var data = [];
- nodeList.each(function () {
- data.push($(this).text());
- });
- return data;
- };
-
- var scrollToSelectedItem = function() {
- var offset = 0;
- this.items.slice(0, this.index).each(function() {
- offset += this.offsetHeight;
- });
- var itemsContainer = this.items.first().parent();
- if(offset < itemsContainer.scrollTop()) {
- itemsContainer.scrollTop(offset);
- } else {
- offset+=this.items.get(this.index).offsetHeight;
- if(offset - itemsContainer.scrollTop() > itemsContainer.get(0).clientHeight) {
- itemsContainer.scrollTop(offset - itemsContainer.innerHeight());
- }
- }
- };
-
- var autoFill = function (inputValue, value) {
- if( this.options.autoFill) {
- var field = rf.getDomElement(this.fieldId);
- field.value = inputValue + value.substring(inputValue.length);
- rf.Selection.set(field, inputValue.length, field.value.length);
- }
- };
-
- // Add new properties and methods
- $.extend(rf.ui.ComboBox.prototype, (function () {
- return {
- name:"CompoBox",
- destroy: function () {
- //TODO: add all unbind
- $super.destroy.call(this);
- },
- getNamespace: function () {
- return this.namespace;
- },
-
- selectItem: function(index, isOffset, noAutoFill) {
- if (this.items.length==0) return;
-
- if (this.index!=-1) {
- this.items.eq(this.index).removeClass(this.options.selectedItemClass);
- }
-
- 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;
- }
- var item = this.items.eq(this.index);
- item.addClass(this.options.selectedItemClass);
-
- scrollToSelectedItem.call(this);
- !noAutoFill && autoFill.call(this, this.newValue, item.text());
- },
-
- selectPrevItem: function () {
- this.selectItem(-1, true);
- },
- selectNextItem: function () {
- this.selectItem(1, true);
- },
- selectPageUp: function () {
-
- },
- selectPageDown: function () {
-
- },
- onBeforeShow: function (event) {
- },
-
- changeValue: function (event, value) {
- // TODO: ajax call here if needed
-
- this.selectItem();
- var newItems = this.cache.getItems(value);
- this.items = $(newItems);
- $(rf.getDomElement(this.componentId+ID.ITEMS)).empty().append(newItems);
- this.index = -1;
- this.newValue = value;
- this.selectItem(0, false, event.which == rf.KEYS.BACKSPACE);
- },
-
- onShow: function (event) {
- if (this.items && this.items.length>0) {
- //??TODO it's nessesary only if not changed value
- this.selectItem(0);
- }
- },
-
- onHide: function () {
- this.selectItem();
- }
- };
- })());
-})(jQuery, RichFaces);
\ No newline at end of file
Deleted: root/ui-sandbox/inputs/trunk/combobox/src/main/resources/META-INF/resources/script/SelectBase.js
===================================================================
--- root/ui-sandbox/inputs/trunk/combobox/src/main/resources/META-INF/resources/script/SelectBase.js 2010-07-06 17:01:55 UTC (rev 17745)
+++ root/ui-sandbox/inputs/trunk/combobox/src/main/resources/META-INF/resources/script/SelectBase.js 2010-07-06 17:03:33 UTC (rev 17746)
@@ -1,256 +0,0 @@
-// TODO: move this extend to RichFaces.Event for exapmle
-$.extend(RichFaces.Event, {
- bindScrollEventHandlers: function(element, handler, component) {
- var elements = [];
- element = RichFaces.getDomElement(element).parentNode;
- while (element && element!=window.document.body)
- {
- if (element.offsetWidth!=element.scrollWidth || element.offsetHeight!=element.scrollHeight)
- {
- elements.push(element);
- RichFaces.Event.bind(element, "scroll"+component.getNamespace(), handler, component);
- }
- element = element.parentNode;
- }
- return elements;
- },
- unbindScrollEventHandlers: function(elements, component) {
- RichFaces.Event.unbind(elements, component.getNamespace());
- elements = null;
- }
-});
-
-(function (rf) {
- rf.KEYS = {
- BACKSPACE: 8,
- TAB: 9,
- RETURN: 13,
- ESC: 27,
- PAGEUP: 33,
- PAGEDOWN: 34,
- LEFT: 37,
- UP: 38,
- RIGHT: 39,
- DOWN: 40,
- DEL: 46,
- }
-})(RichFaces);
-
-(function ($, rf) {
-
- rf.ui = rf.ui || {};
-
- // Constructor definition
- rf.ui.SelectBase = function(selectId, fieldId, options) {
- // call constructor of parent class
- $super.constructor.call(this, selectId);
- this.selectId = selectId;
- this.fieldId = fieldId;
- this.options = $.extend({}, defaultOptions, options);
- this.namespace = this.namespace || "."+rf.Event.createNamespace(this.name, this.selectId);
- this.currentValue = this.getInputValue();
- bindEventHandlers.call(this);
- };
-
- var $p ={};
-
- // Extend component class and add protected methods from parent class to our container
- $p = rf.BaseComponent.extend(rf.BaseComponent, rf.ui.SelectBase, $p);
-
- // define super class link
- var $super = rf.ui.SelectBase.$super;
-
- var defaultOptions = {
- changeDelay:8
- };
-
- var bindEventHandlers = function() {
- if (this.options.buttonId) {
- rf.Event.bindById(this.options.buttonId, "mousedown"+this.namespace, onButtonShow, this);
- rf.Event.bindById(this.options.buttonId, "mouseup"+this.namespace, onSelectMouseUp, this);
- }
-
- var inputEventHandlers = {};
- inputEventHandlers["focus"+this.namespace] = onFocus;
- inputEventHandlers["blur"+this.namespace] = onBlur;
- inputEventHandlers["click"+this.namespace] = onClick;
- inputEventHandlers[($.browser.opera ? "keypress" : "keydown")+this.namespace] = onKeyDown;
- rf.Event.bindById(this.fieldId, inputEventHandlers, this);
-
- inputEventHandlers = {};
- inputEventHandlers["click"+this.namespace] = onSelectClick;
- inputEventHandlers["mousedown"+this.namespace] = onSelectMouseDown;
- inputEventHandlers["mouseup"+this.namespace] = onSelectMouseUp;
- rf.Event.bindById(this.selectId, inputEventHandlers, this);
- }
-
- var onSelectClick = function () {
- };
- var onSelectMouseDown = function () {
- this.isMouseDown = true;
- //console && console.log && console.log("onMouseDown");
- };
- var onSelectMouseUp = function () {
- //this.isMouseDown = false;
- rf.getDomElement(this.fieldId).focus();
- //console && console.log && console.log("onMouseUp");
- };
-
- var onButtonShow = function (event) {
- this.isMouseDown = true;
- //console && console.log && console.log("onButtonShow - "+this.timeoutId);
- if (this.timeoutId) {
- window.clearTimeout(this.timeoutId);
- this.timeoutId = null;
- rf.getDomElement(this.fieldId).focus();
- }
-
- if (this.isVisible) {
- this.hide(event);
- } else {
- this.show(event);
- //rf.getDomElement(this.fieldId).focus();
- }
- };
-
- var onFocus = function (event) {
- //console && console.log && console.log("onFocus");
- };
-
- var onBlur = function (event) {
- //console && console.log && console.log("onBlur");
- if (this.isMouseDown) {
- rf.getDomElement(this.fieldId).focus();
- this.isMouseDown = false;
- //console && console.log && console.log("---------> and focus");
- } else if (this.isVisible && !this.isMouseDown/*&& checkOnBlur.call(this, event)*/) {
- var _this = this;
- this.timeoutId = window.setTimeout(function(){_this.hide();}, 200);
- }
- };
-
- var onClick = function (event) {
- };
-
- var onChange = function (event) {
- var value = this.getInputValue();
- var flag = value != this.currentValue;
- if (event.which == rf.KEYS.LEFT || event.which == rf.KEYS.RIGHT || flag) {
- if (flag) {
- this.changeValue(event, value);
- this.currentValue = value;
- if (!this.isVisible) {
- this.show();
- }
- }
- }
- }
-
-
- /*var checkOnBlur = function (event) {
- var e = $(rf.getDomElement(this.options.buttonId));
- return (e == event.target) || $(event.target).closest(e);
- };*/
-
- var onKeyDown = function (event) {
- switch(event.which) {
- case rf.KEYS.UP:
- event.preventDefault();
- if (this.isVisible) {
- this.selectPrevItem();
- }
- break;
- case rf.KEYS.DOWN:
- event.preventDefault();
- if (this.isVisible) {
- this.selectNextItem();
- } else {
- this.show();
- }
- break;
- case rf.KEYS.PAGEUP:
- event.preventDefault();
- if (this.isVisible) {
- this.selectPageUp();
- }
- break;
- case rf.KEYS.PAGEDOWN:
- event.preventDefault();
- if (this.isVisible) {
- this.selectPageDown();
- }
- break;
- case rf.KEYS.TAB:
- case rf.KEYS.RETURN:
- event.preventDefault();
- /*if( selectCurrentItem() ) {
- event.preventDefault();
- //TODO: bind form submit event handler to cancel form submit under the opera
- //cancelSubmit = true;
- return false;
- }*/
- this.hide();
- break;
- case rf.KEYS.ESC:
- this.hide();
- break;
- default:
- if (!this.options.selectOnly) {
- var _this = this;
- window.clearTimeout(this.changeTimerId);
- this.changeTimerId = window.setTimeout(function(){onChange.call(_this, event);}, this.options.changeDelay)
- }
- break;
- }
- }
-
- // Add new properties and methods
- $.extend(rf.ui.SelectBase.prototype, (function () {
- return {
- name:"SelectBase",
- show: function (event) {
- if (this.onBeforeShow(event)!=false) {
- $(rf.getDomElement(this.selectId)).setPosition({id: this.fieldId}, {type:"DROPDOWN", offset:[0,20]}).show();
- this.isVisible = true;
- this.scrollElements = rf.Event.bindScrollEventHandlers(this.selectId, this.hide, this, this.namespace);
- if (this.onShow) {
- this.onShow(event);
- }
- }
- },
- hide: function (event) {
- rf.Event.unbindScrollEventHandlers(this.scrollElements, this);
- $(rf.getDomElement(this.selectId)).hide();
- this.isVisible = false;
- if (this.onHide) {
- this.onHide(event);
- }
- },
- destroy: function () {
- //TODO: add all unbind
- rf.Event.unbindById(this.options.buttonId, this.namespace);
- rf.Event.unbindById(this.fieldId, this.namespace);
- $super.destroy.call(this);
- },
- getNamespace: function () {
- return this.namespace;
- },
-
- selectPrevItem: function () {
- },
- selectNextItem: function () {
- },
- selectPageUp: function () {
- },
- selectPageDown: function () {
- },
- onBeforeShow: function () {
- },
- getInputValue: function () {
- var value = this.fieldId ? rf.getDomElement(this.fieldId).value : undefined;
- return value;
- }
-
- };
- })());
-})(jQuery, RichFaces);
\ No newline at end of file
Added: root/ui-sandbox/inputs/trunk/combobox/src/main/templates/comboBox.template.xml
===================================================================
--- root/ui-sandbox/inputs/trunk/combobox/src/main/templates/comboBox.template.xml (rev 0)
+++ root/ui-sandbox/inputs/trunk/combobox/src/main/templates/comboBox.template.xml 2010-07-06 17:03:33 UTC (rev 17746)
@@ -0,0 +1,50 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<cdk:root xmlns="http://richfaces.org/cdk/xhtml-el" xmlns:cdk="http://richfaces.org/cdk/core"
+ xmlns:c="http://richfaces.org/cdk/jstl/core" xmlns:cc="http://richfaces.org/cdk/jsf/composite"
+ xmlns:javaee="http://java.sun.com/xml/ns/javaee">
+
+ <cc:interface>
+ <cdk:class>org.richfaces.renderkit.html.ComboBoxRenderer</cdk:class>
+ <cdk:superclass>org.richfaces.renderkit.ComboBoxRendererBase</cdk:superclass>
+ <cdk:component-family>javax.faces.Input</cdk:component-family>
+ <cdk:renderer-type>org.richfaces.ComboBoxRenderer
+ </cdk:renderer-type>
+ <cdk:renders-children>true</cdk:renders-children>
+ </cc:interface>
+
+ <cc:implementation>
+ <div id="#{clientId}" class="cb_field_width cb_field">
+ <div style="position : relative; overflow : hidden; text-align : left; padding-right : 21px;">
+ <input id="#{clientId}Input" type="text" class="cb_font cb_input" />
+ <div id="#{clientId}Button" class="cb_button">
+ <div class="cb_button_arrow"></div>
+ </div>
+ </div>
+
+ <div id="#{clientId}List" class="cb_list_cord">
+
+ <div class="cb_shadow">
+ <div class="cb_shadow_t"></div>
+ <div class="cb_shadow_l"></div>
+ <div class="cb_shadow_r"></div>
+ <div class="cb_shadow_b"></div>
+
+ <div class="cb_list_decoration">
+ <div class="cb_list_scroll cb_list_width cb_list_height">
+ <cdk:body>
+ <cdk:call expression="encodeItems(facesContext, component)"/>
+ </cdk:body>
+ </div>
+ </div>
+ </div>
+ </div>
+ <script type="text/javascript">
+ new RichFaces.ui.ComboBox("#{clientId}",
+ "#{clientId}Input", {buttonId:"#{clientId}Button",
+ selectedItemClass:'cb_select'});
+ </script>
+ </div>
+ </cc:implementation>
+
+</cdk:root>
14 years, 6 months
JBoss Rich Faces SVN: r17745 - root/ui-sandbox/inputs/trunk/combobox/src/main/resources/META-INF/resources/script.
by richfaces-svn-commits@lists.jboss.org
Author: pyaschenko
Date: 2010-07-06 13:01:55 -0400 (Tue, 06 Jul 2010)
New Revision: 17745
Modified:
root/ui-sandbox/inputs/trunk/combobox/src/main/resources/META-INF/resources/script/1.html
root/ui-sandbox/inputs/trunk/combobox/src/main/resources/META-INF/resources/script/SelectBase.js
Log:
Modified: root/ui-sandbox/inputs/trunk/combobox/src/main/resources/META-INF/resources/script/1.html
===================================================================
--- root/ui-sandbox/inputs/trunk/combobox/src/main/resources/META-INF/resources/script/1.html 2010-07-06 16:55:26 UTC (rev 17744)
+++ root/ui-sandbox/inputs/trunk/combobox/src/main/resources/META-INF/resources/script/1.html 2010-07-06 17:01:55 UTC (rev 17745)
@@ -6,6 +6,7 @@
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Test Page</title>
<script type="text/javascript" src="..\..\..\..\..\..\..\..\..\..\core\trunk\impl\src\main\resources\META-INF\resources\jquery.js "></script>
+ <script type="text/javascript" src="..\..\..\..\..\..\..\..\..\..\core\trunk\impl\src\main\resources\META-INF\resources\jquery.position.js "></script>
<script type="text/javascript" src="..\..\..\..\..\..\..\..\..\..\core\trunk\impl\src\main\resources\META-INF\resources\richfaces.js "></script>
<script type="text/javascript" src="..\..\..\..\..\..\..\..\..\..\core\trunk\impl\src\main\resources\META-INF\resources\richfaces-event.js "></script>
<script type="text/javascript" src="..\..\..\..\..\..\..\..\..\..\core\trunk\impl\src\main\resources\META-INF\resources\richfaces-base-component.js "></script>
@@ -27,7 +28,7 @@
.cb_button{ background : url(images/bg_btn.png) top left repeat-x #C0D1E7/*gradient - from headerGradientColor to headerBackgroundColor, background-color - headerBackgroundColor*/; text-align : center; border-left : 1px solid #A6A6A6/*panelBorderColor*/; width : 15px; position : absolute; top : 0px; right : 0px; height : 200px; padding-top : 1px }
.cb_button_arrow{ background : url(images/down.gif) center no-repeat; cursor : pointer;}
- .cb_list_cord{ position : relative; font-size : 0px;display : none}/*DDL is hidden!!!!!*/
+ .cb_list_cord{ position : absolute; font-size : 0px;display : none}/*DDL is hidden!!!!!*/
.cb_list_position{ position : absolute; top: 0px; left: -1px; }
.cb_list_decoration{ border : 1px solid #A6A6A6 /*panelBorderColor*/; padding : 0px; background : #FFFFFF; /*tableBackgroundColor*/}
.cb_list_scroll{ overflow : auto; overflow-x : hidden; list-style: none; margin:0px; padding:0px;}
Modified: root/ui-sandbox/inputs/trunk/combobox/src/main/resources/META-INF/resources/script/SelectBase.js
===================================================================
--- root/ui-sandbox/inputs/trunk/combobox/src/main/resources/META-INF/resources/script/SelectBase.js 2010-07-06 16:55:26 UTC (rev 17744)
+++ root/ui-sandbox/inputs/trunk/combobox/src/main/resources/META-INF/resources/script/SelectBase.js 2010-07-06 17:01:55 UTC (rev 17745)
@@ -210,7 +210,7 @@
name:"SelectBase",
show: function (event) {
if (this.onBeforeShow(event)!=false) {
- $(rf.getDomElement(this.selectId)).show();
+ $(rf.getDomElement(this.selectId)).setPosition({id: this.fieldId}, {type:"DROPDOWN", offset:[0,20]}).show();
this.isVisible = true;
this.scrollElements = rf.Event.bindScrollEventHandlers(this.selectId, this.hide, this, this.namespace);
if (this.onShow) {
14 years, 6 months