[richfaces-svn-commits] JBoss Rich Faces SVN: r2477 - in trunk/ui/simpleTogglePanel/src/main: java/org/richfaces and 1 other directories.

richfaces-svn-commits at lists.jboss.org richfaces-svn-commits at lists.jboss.org
Fri Aug 24 10:00:50 EDT 2007


Author: a.izobov
Date: 2007-08-24 10:00:50 -0400 (Fri, 24 Aug 2007)
New Revision: 2477

Added:
   trunk/ui/simpleTogglePanel/src/main/java/org/richfaces/taglib/
   trunk/ui/simpleTogglePanel/src/main/java/org/richfaces/taglib/SimpleTogglePanelListenerTagHandler.java
Modified:
   trunk/ui/simpleTogglePanel/src/main/config/component/simpleTogglePanel.xml
Log:
http://jira.jboss.com/jira/browse/RF-682

Modified: trunk/ui/simpleTogglePanel/src/main/config/component/simpleTogglePanel.xml
===================================================================
--- trunk/ui/simpleTogglePanel/src/main/config/component/simpleTogglePanel.xml	2007-08-24 13:34:04 UTC (rev 2476)
+++ trunk/ui/simpleTogglePanel/src/main/config/component/simpleTogglePanel.xml	2007-08-24 14:00:50 UTC (rev 2477)
@@ -26,6 +26,12 @@
                 org.ajax4jsf.webapp.taglib.HtmlComponentTagBase
             </superclass>
         </tag>
+		<taghandler generate="true">
+			<classname>org.richfaces.taglib.SimpleTogglePanelTagHandler</classname>
+			<superclass>
+				org.richfaces.taglib.SimpleTogglePanelListenerTagHandler
+			</superclass>
+		</taghandler>
 
         &ui_component_attributes;
         &html_events;

Added: trunk/ui/simpleTogglePanel/src/main/java/org/richfaces/taglib/SimpleTogglePanelListenerTagHandler.java
===================================================================
--- trunk/ui/simpleTogglePanel/src/main/java/org/richfaces/taglib/SimpleTogglePanelListenerTagHandler.java	                        (rev 0)
+++ trunk/ui/simpleTogglePanel/src/main/java/org/richfaces/taglib/SimpleTogglePanelListenerTagHandler.java	2007-08-24 14:00:50 UTC (rev 2477)
@@ -0,0 +1,67 @@
+/**
+ * License Agreement.
+ *
+ *  JBoss RichFaces - Ajax4jsf Component Library
+ *
+ * Copyright (C) 2007  Exadel, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1 as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301  USA
+ */
+
+package org.richfaces.taglib;
+
+import javax.faces.component.UIComponent;
+import javax.faces.el.MethodBinding;
+
+import org.richfaces.event.SimpleToggleEvent;
+
+import com.sun.facelets.FaceletContext;
+import com.sun.facelets.tag.MetaRule;
+import com.sun.facelets.tag.MetaRuleset;
+import com.sun.facelets.tag.Metadata;
+import com.sun.facelets.tag.MetadataTarget;
+import com.sun.facelets.tag.TagAttribute;
+import com.sun.facelets.tag.jsf.ComponentConfig;
+import com.sun.facelets.tag.jsf.ComponentHandler;
+
+public class SimpleTogglePanelListenerTagHandler extends ComponentHandler {
+	private final static String COLLAPSED_EXPANDED_LISTENER = "collapsedExpandedListener";
+	
+	public SimpleTogglePanelListenerTagHandler(ComponentConfig config) {
+		super(config);
+	}
+
+	protected MetaRuleset createMetaRuleset(Class clazz) {
+		MetaRuleset ruleset = super.createMetaRuleset(clazz);
+		
+		ruleset.addRule(new MetaRule() {
+
+			public Metadata applyRule(String name, final TagAttribute attribute, MetadataTarget metadataTarget) {
+				if (COLLAPSED_EXPANDED_LISTENER.equals(name)) {
+					return new Metadata() {
+						public void applyMetadata(FaceletContext context, Object object) {
+							MethodBinding binding = context.getFacesContext().getApplication().createMethodBinding(attribute.getValue(), new Class[] {SimpleToggleEvent.class});
+							((UIComponent) object).getAttributes().put(COLLAPSED_EXPANDED_LISTENER, binding);
+						}
+					};
+				}
+				return null;
+			}
+		});
+		
+		return ruleset;
+	}
+
+}
+




More information about the richfaces-svn-commits mailing list