Author: alexsmirnov
Date: 2009-12-28 20:12:10 -0500 (Mon, 28 Dec 2009)
New Revision: 16216
Added:
root/cdk/trunk/plugins/maven-cdk-plugin/src/it/annotated-component/src/main/java/org/richfaces/cdk/test/event/
root/cdk/trunk/plugins/maven-cdk-plugin/src/it/annotated-component/src/main/java/org/richfaces/cdk/test/event/TestEvent.java
Modified:
root/cdk/trunk/plugins/maven-cdk-plugin/src/it/annotated-component/src/main/java/org/ajax4jsf/renderkit/RendererUtils.java
root/cdk/trunk/plugins/maven-cdk-plugin/src/it/annotated-component/src/main/java/org/richfaces/cdk/test/component/AbstractTestComponent.java
root/cdk/trunk/plugins/maven-cdk-plugin/src/it/annotated-component/src/main/java/org/richfaces/cdk/test/component/UITestCommand.java
root/cdk/trunk/plugins/maven-cdk-plugin/src/it/xml-configured-component/src/main/java/org/ajax4jsf/renderkit/RendererUtils.java
Log:
set proper order of faces-config elements.
Modified:
root/cdk/trunk/plugins/maven-cdk-plugin/src/it/annotated-component/src/main/java/org/ajax4jsf/renderkit/RendererUtils.java
===================================================================
---
root/cdk/trunk/plugins/maven-cdk-plugin/src/it/annotated-component/src/main/java/org/ajax4jsf/renderkit/RendererUtils.java 2009-12-29
01:11:58 UTC (rev 16215)
+++
root/cdk/trunk/plugins/maven-cdk-plugin/src/it/annotated-component/src/main/java/org/ajax4jsf/renderkit/RendererUtils.java 2009-12-29
01:12:10 UTC (rev 16216)
@@ -19,15 +19,10 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
-
-
package org.ajax4jsf.renderkit;
-
import java.io.IOException;
-
import java.lang.reflect.Array;
-
import java.util.Arrays;
import java.util.Collection;
import java.util.HashMap;
@@ -44,22 +39,19 @@
import javax.faces.component.NamingContainer;
import javax.faces.component.UIComponent;
import javax.faces.component.UIForm;
-import javax.faces.component.UIParameter;
import javax.faces.component.UIViewRoot;
import javax.faces.component.ValueHolder;
-import javax.faces.component.behavior.ClientBehaviorContext.Parameter;
import javax.faces.component.behavior.ClientBehaviorHolder;
import javax.faces.context.FacesContext;
import javax.faces.context.ResponseWriter;
import javax.faces.convert.Converter;
/**
- * Util class for common render operations - render passthru html attributes,
- * iterate over child components etc.
- *
+ * Util class for common render operations - render passthru html attributes, iterate
over child components etc.
+ *
* @author asmirnov(a)exadel.com (latest modification by $Author: alexsmirnov $)
* @version $Revision: 1.1.2.6 $ $Date: 2007/02/08 19:07:16 $
- *
+ *
*/
public class RendererUtils {
public static final String DUMMY_FORM_ID = ":_form";
@@ -90,6 +82,7 @@
/**
* Use this method to get singleton instance of RendererUtils
+ *
* @return singleton instance
*/
public static RendererUtils getInstance() {
@@ -98,7 +91,7 @@
/**
* Encode id attribute with clientId component property
- *
+ *
* @param context
* @param component
* @throws IOException
@@ -109,7 +102,7 @@
/**
* Encode clientId to custom attribute ( for example, to control name )
- *
+ *
* @param context
* @param component
* @param attribute
@@ -127,14 +120,13 @@
if (null != clientId) {
context.getResponseWriter().writeAttribute(attribute, clientId,
- (String) getComponentAttributeName(attribute));
+ (String) getComponentAttributeName(attribute));
}
}
/**
- * Encode id attribute with clientId component property. Encoded only if id
- * not auto generated.
- *
+ * Encode id attribute with clientId component property. Encoded only if id not auto
generated.
+ *
* @param context
* @param component
* @throws IOException
@@ -142,32 +134,29 @@
public void encodeCustomId(FacesContext context, UIComponent component) throws
IOException {
if ((component.getId() != null) &&
!component.getId().startsWith(UIViewRoot.UNIQUE_ID_PREFIX)) {
context.getResponseWriter().writeAttribute(HTML.ID_ATTRIBUTE,
component.getClientId(context),
- HTML.ID_ATTRIBUTE);
+ HTML.ID_ATTRIBUTE);
}
}
public Map<String, Object> createParametersMap(FacesContext context,
UIComponent component) {
Map<String, Object> parameters = new LinkedHashMap<String,
Object>();
-
return parameters;
}
private void encodeBehaviors(FacesContext context, ClientBehaviorHolder
behaviorHolder,
- String defaultHtmlEventName, String[]
attributesExclusions)
- throws IOException {
+ String defaultHtmlEventName, String[] attributesExclusions) throws IOException {
}
/**
* Encode common pass-thru html attributes.
- *
+ *
* @param context
* @param component
* @throws IOException
*/
- public void encodePassThru(FacesContext context, UIComponent component, String
defaultHtmlEvent)
- throws IOException {
+ public void encodePassThru(FacesContext context, UIComponent component, String
defaultHtmlEvent) throws IOException {
encodeAttributesFromArray(context, component, HTML.PASS_THRU);
@@ -182,15 +171,15 @@
/**
* Encode pass-through attributes except specified ones
- *
+ *
* @param context
* @param component
* @param exclusions
* @throws IOException
*/
public void encodePassThruWithExclusions(FacesContext context, UIComponent component,
String exclusions,
- String defaultHtmlEvent) throws IOException {
-
+ String defaultHtmlEvent) throws IOException {
+
if (null != exclusions) {
String[] exclusionsArray = exclusions.split(",");
@@ -199,8 +188,8 @@
}
public void encodePassThruWithExclusionsArray(FacesContext context, UIComponent
component, String[] exclusions,
- String defaultHtmlEvent) throws IOException {
-
+ String defaultHtmlEvent) throws IOException {
+
ResponseWriter writer = context.getResponseWriter();
Map<String, Object> attributes = component.getAttributes();
@@ -230,16 +219,15 @@
}
/**
- * Encode one pass-thru attribute, with plain/boolean/url value, got from
- * properly component attribute.
- *
+ * Encode one pass-thru attribute, with plain/boolean/url value, got from properly
component attribute.
+ *
* @param context
* @param writer
* @param attribute
* @throws IOException
*/
public void encodePassThruAttribute(FacesContext context, Map<String, Object>
attributes, ResponseWriter writer,
- String attribute) throws IOException {
+ String attribute) throws IOException {
Object value = attributeValue(attribute,
attributes.get(getComponentAttributeName(attribute)));
@@ -257,7 +245,7 @@
public void encodeAttributesFromArray(FacesContext context, UIComponent component,
String[] attrs)
throws IOException {
-
+
ResponseWriter writer = context.getResponseWriter();
Map<String, Object> attributes = component.getAttributes();
@@ -270,7 +258,7 @@
/**
* Encode attributes given by comma-separated string list.
- *
+ *
* @param context
* current JSF context
* @param component
@@ -292,12 +280,12 @@
* @param component
* @param property
* @param attributeName
- *
+ *
* @throws IOException
*/
public void encodeAttribute(FacesContext context, UIComponent component, Object
property, String attributeName)
throws IOException {
-
+
ResponseWriter writer = context.getResponseWriter();
Object value = component.getAttributes().get(property);
@@ -311,14 +299,14 @@
}
public void writeText(ResponseWriter writer, Object value, String property) throws
IOException {
- if (value != null) {
- writer.writeText(value, property);
- }
+ if (value != null) {
+ writer.writeText(value, property);
+ }
}
-
+
/**
* Write html-attribute
- *
+ *
* @param writer
* @param attribute
* @param value
@@ -331,15 +319,14 @@
}
/**
- * @return true if and only if the argument <code>attributeVal</code> is
- * an instance of a wrapper for a primitive type and its value is
- * equal to the default value for that type as given in the spec.
+ * @return true if and only if the argument <code>attributeVal</code> is
an instance of a wrapper for a primitive
+ * type and its value is equal to the default value for that type as given in
the spec.
*/
public boolean shouldRenderAttribute(Object attributeVal) {
if (null == attributeVal) {
return false;
} else if ((attributeVal instanceof Boolean)
- && ((Boolean) attributeVal).booleanValue() ==
Boolean.FALSE.booleanValue()) {
+ && ((Boolean) attributeVal).booleanValue() ==
Boolean.FALSE.booleanValue()) {
return false;
} else if (attributeVal.toString().length() == 0) {
return false;
@@ -361,12 +348,11 @@
}
/**
- * Test for valid value of property. by default, for non-setted properties
- * with Java primitive types of JSF component return appropriate MIN_VALUE .
- *
- * @param property -
- * value of property returned from
- * {@link UIComponent#getAttributes()}
+ * Test for valid value of property. by default, for non-setted properties with Java
primitive types of JSF
+ * component return appropriate MIN_VALUE .
+ *
+ * @param property
+ * - value of property returned from {@link UIComponent#getAttributes()}
* @return true for setted property, false otherthise.
*/
public boolean isValidProperty(Object property) {
@@ -392,15 +378,15 @@
}
/**
- * Checks if the argument passed in is empty or not.
- * Object is empty if it is: <br />
- * - <code>null<code><br />
+ * Checks if the argument passed in is empty or not. Object is empty if it is: <br
/>
+ * - <code>null<code><br />
* - zero-length string<br />
* - empty collection<br />
* - empty map<br />
* - zero-length array<br />
- *
- * @param o object to check for emptiness
+ *
+ * @param o
+ * object to check for emptiness
* @since 3.3.2
* @return <code>true</code> if the argument is empty,
<code>false</code> otherwise
*/
@@ -430,7 +416,7 @@
/**
* Convert HTML attribute name to component property name.
- *
+ *
* @param key
* @return
*/
@@ -445,10 +431,9 @@
}
/**
- * Convert attribute value to proper object. For known html boolean
- * attributes return name for true value, otherthise - null. For non-boolean
- * attributes return same value.
- *
+ * Convert attribute value to proper object. For known html boolean attributes return
name for true value,
+ * otherthise - null. For non-boolean attributes return same value.
+ *
* @param name
* attribute name.
* @param value
@@ -472,12 +457,11 @@
/**
* Get boolean value of logical attribute
- *
+ *
* @param component
* @param name
* attribute name
- * @return true if attribute is equals Boolean.TRUE or String "true" ,
false
- * otherwise.
+ * @return true if attribute is equals Boolean.TRUE or String "true" ,
false otherwise.
*/
public boolean isBooleanAttribute(UIComponent component, String name) {
Object attrValue = component.getAttributes().get(name);
@@ -495,9 +479,8 @@
}
/**
- * Return converted value for {@link javax.faces.component.ValueHolder} as
- * String, perform nessesary convertions.
- *
+ * Return converted value for {@link javax.faces.component.ValueHolder} as String,
perform nessesary convertions.
+ *
* @param context
* @param component
* @return
@@ -523,10 +506,9 @@
}
/**
- * Convert any object value to string. If component instance of
- * {@link ValueHolder } got {@link Converter} for formatting. If not,
- * attempt to use converter based on value type.
- *
+ * Convert any object value to string. If component instance of {@link ValueHolder }
got {@link Converter} for
+ * formatting. If not, attempt to use converter based on value type.
+ *
* @param context
* @param component
* @return
@@ -570,9 +552,9 @@
/**
* formats given value to
- *
+ *
* @param value
- *
+ *
* @return
*/
public String encodePctOrPx(String value) {
@@ -585,7 +567,7 @@
/**
* Find nested form for given component
- *
+ *
* @param component
* @return nested <code>UIForm</code> component, or
<code>null</code>
*/
@@ -636,7 +618,7 @@
*/
public void encodeBeginForm(FacesContext context, UIComponent component,
ResponseWriter writer, String clientId)
throws IOException {
-
+
String actionURL = getActionUrl(context);
String encodeActionURL =
context.getExternalContext().encodeActionURL(actionURL);
@@ -685,7 +667,7 @@
/**
* Simplified version of {@link encodeId}
- *
+ *
* @param context
* @param component
* @return client id of current component
@@ -705,7 +687,7 @@
/**
* Wtrie JavaScript with start/end elements and type.
- *
+ *
* @param context
* @param component
* @param script
@@ -727,15 +709,15 @@
* @return
*/
private static boolean checkKeyword(Collection<String> ids, String keyword) {
- if (ids.contains(keyword)) {
- if (ids.size() != 1) {
- //TODO log
- }
-
- return true;
- }
-
- return false;
+ if (ids.contains(keyword)) {
+ if (ids.size() != 1) {
+ // TODO log
+ }
+
+ return true;
+ }
+
+ return false;
}
/**
@@ -745,14 +727,12 @@
* @since 4.0
* @return
*/
- public Collection<String> findComponentsFor(FacesContext context, UIComponent
component,
- Collection<String> shortIds) {
+ public Collection<String> findComponentsFor(FacesContext context, UIComponent
component, Collection<String> shortIds) {
// TODO - implement
// TODO add support for @*
Set<String> result = new LinkedHashSet<String>(shortIds.size());
-
return result;
}
@@ -793,9 +773,10 @@
/**
* If target component contains generated id and for doesn't, correct for id
+ *
* @param forAttr
* @param component
- *
+ *
*/
public String correctForIdReference(String forAttr, UIComponent component) {
int contains = forAttr.indexOf(UIViewRoot.UNIQUE_ID_PREFIX);
@@ -815,7 +796,7 @@
private UIComponent findUIComponentBelow(UIComponent root, String id) {
UIComponent target = null;
- for (Iterator<UIComponent> iter = root.getFacetsAndChildren();
iter.hasNext(); ) {
+ for (Iterator<UIComponent> iter = root.getFacetsAndChildren();
iter.hasNext();) {
UIComponent child = (UIComponent) iter.next();
if (child instanceof NamingContainer) {
@@ -842,15 +823,15 @@
public static void writeEventHandlerFunction(FacesContext context, UIComponent
component, String eventName)
throws IOException {
-
+
}
/**
* Common HTML elements and attributes names.
- *
+ *
* @author asmirnov(a)exadel.com (latest modification by $Author: alexsmirnov $)
* @version $Revision: 1.1.2.6 $ $Date: 2007/02/08 19:07:16 $
- *
+ *
*/
public interface HTML {
public static final String ACCEPT_ATTRIBUTE = "accept";
@@ -931,29 +912,23 @@
"accesskey", "alt", "cols", "height",
"lang", "longdesc", "maxlength", "rows",
"size", "tabindex", "title",
"width", "dir", "rules", "frame",
"border", "cellspacing", "cellpadding", "summary",
"bgcolor", "usemap",
"enctype", "accept-charset", "accept",
"target", "charset", "coords", "hreflang",
"rel", "rev", "shape",
- "disabled", "readonly", "ismap",
"align"
- };
+ "disabled", "readonly", "ismap",
"align" };
/**
* HTML attributes allowed boolean-values only
*/
- public static final String[] PASS_THRU_BOOLEAN = {
- "disabled", "declare", "readonly",
"compact", "ismap", "selected", "checked",
"nowrap", "noresize",
- "nohref", "noshade", "multiple"
- };
- public static final String[] PASS_THRU_EVENTS = {
- "onblur", "onchange", "onclick",
"ondblclick", "onfocus", "onkeydown",
"onkeypress", "onkeyup", "onload",
- "onmousedown", "onmousemove", "onmouseout",
"onmouseover", "onmouseup", "onreset", "onselect",
"onsubmit",
- "onunload"
- };
- public static final String[] PASS_THRU_STYLES = {"style",
"class", };
+ public static final String[] PASS_THRU_BOOLEAN = { "disabled",
"declare", "readonly", "compact", "ismap",
+ "selected", "checked", "nowrap",
"noresize", "nohref", "noshade", "multiple" };
+ public static final String[] PASS_THRU_EVENTS = { "onblur",
"onchange", "onclick", "ondblclick", "onfocus",
+ "onkeydown", "onkeypress", "onkeyup",
"onload", "onmousedown", "onmousemove",
"onmouseout", "onmouseover",
+ "onmouseup", "onreset", "onselect",
"onsubmit", "onunload" };
+ public static final String[] PASS_THRU_STYLES = { "style",
"class", };
/**
* all HTML attributes with URI value.
*/
- public static final String[] PASS_THRU_URI = {
- "usemap", "background", "codebase",
"cite", "data", "classid", "href",
"longdesc", "profile", "src"
- };
+ public static final String[] PASS_THRU_URI = { "usemap",
"background", "codebase", "cite", "data",
"classid",
+ "href", "longdesc", "profile", "src"
};
public static final String READONLY_ATTRIBUTE = "readonly";
public static final String REL_ATTR = "rel";
public static final String REV_ATTR = "rev";
Modified:
root/cdk/trunk/plugins/maven-cdk-plugin/src/it/annotated-component/src/main/java/org/richfaces/cdk/test/component/AbstractTestComponent.java
===================================================================
---
root/cdk/trunk/plugins/maven-cdk-plugin/src/it/annotated-component/src/main/java/org/richfaces/cdk/test/component/AbstractTestComponent.java 2009-12-29
01:11:58 UTC (rev 16215)
+++
root/cdk/trunk/plugins/maven-cdk-plugin/src/it/annotated-component/src/main/java/org/richfaces/cdk/test/component/AbstractTestComponent.java 2009-12-29
01:12:10 UTC (rev 16216)
@@ -21,28 +21,32 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
+package org.richfaces.cdk.test.component;
+import java.util.List;
-package org.richfaces.cdk.test.component;
+import javax.faces.component.UIComponentBase;
import org.richfaces.cdk.annotations.Attribute;
import org.richfaces.cdk.annotations.Component;
import org.richfaces.cdk.annotations.Family;
+import org.richfaces.cdk.annotations.Fires;
import org.richfaces.cdk.annotations.Generate;
+import org.richfaces.cdk.annotations.Tag;
+import org.richfaces.cdk.test.event.TestEvent;
-import java.util.List;
-
-import javax.faces.component.UIComponentBase;
-import javax.faces.component.ValueHolder;
-
/**
- * <p class="changed_added_4_0"></p>
+ * <p class="changed_added_4_0">
+ * </p>
+ *
* @author asmirnov(a)exadel.com
- *
+ *
*/
@Component("org.richfaces.cdk.test.TestComponent")
@Generate("org.richfaces.cdk.test.UITestComponent")
@Family("org.richfaces.cdk.test.Test")
+(a)Fires(TestEvent.class)
+@Tag(name = "test")
public abstract class AbstractTestComponent extends UIComponentBase {
@Attribute
private int foo;
Modified:
root/cdk/trunk/plugins/maven-cdk-plugin/src/it/annotated-component/src/main/java/org/richfaces/cdk/test/component/UITestCommand.java
===================================================================
---
root/cdk/trunk/plugins/maven-cdk-plugin/src/it/annotated-component/src/main/java/org/richfaces/cdk/test/component/UITestCommand.java 2009-12-29
01:11:58 UTC (rev 16215)
+++
root/cdk/trunk/plugins/maven-cdk-plugin/src/it/annotated-component/src/main/java/org/richfaces/cdk/test/component/UITestCommand.java 2009-12-29
01:12:10 UTC (rev 16216)
@@ -21,12 +21,9 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
-
-
package org.richfaces.cdk.test.component;
import javax.el.MethodExpression;
-
import javax.faces.component.ActionSource2;
import javax.faces.component.FacesComponent;
import javax.faces.component.UIComponentBase;
@@ -34,16 +31,19 @@
import javax.faces.event.ActionListener;
/**
- * <p class="changed_added_4_0"></p>
+ * <p class="changed_added_4_0">
+ * </p>
+ *
* @author asmirnov(a)exadel.com
- *
+ *
*/
@FacesComponent("cdk.TestCommand")
public class UITestCommand extends UIComponentBase implements ActionSource2 {
private static final String COMPONENT_FAMILY = "cdk.TestFamily";
/*
- * (non-Javadoc)
+ * (non-Javadoc)
+ *
* @see javax.faces.component.UIComponent#getFamily()
*/
@Override
@@ -52,7 +52,8 @@
}
/*
- * (non-Javadoc)
+ * (non-Javadoc)
+ *
* @see
javax.faces.component.ActionSource#addActionListener(javax.faces.event.ActionListener)
*/
public void addActionListener(ActionListener listener) {
@@ -61,7 +62,8 @@
}
/*
- * (non-Javadoc)
+ * (non-Javadoc)
+ *
* @see javax.faces.component.ActionSource#getAction()
*/
public MethodBinding getAction() {
@@ -71,7 +73,8 @@
}
/*
- * (non-Javadoc)
+ * (non-Javadoc)
+ *
* @see javax.faces.component.ActionSource#getActionListener()
*/
public MethodBinding getActionListener() {
@@ -81,7 +84,8 @@
}
/*
- * (non-Javadoc)
+ * (non-Javadoc)
+ *
* @see javax.faces.component.ActionSource#getActionListeners()
*/
public ActionListener[] getActionListeners() {
@@ -91,7 +95,8 @@
}
/*
- * (non-Javadoc)
+ * (non-Javadoc)
+ *
* @see javax.faces.component.ActionSource#isImmediate()
*/
public boolean isImmediate() {
@@ -101,7 +106,8 @@
}
/*
- * (non-Javadoc)
+ * (non-Javadoc)
+ *
* @see
javax.faces.component.ActionSource#removeActionListener(javax.faces.event.ActionListener)
*/
public void removeActionListener(ActionListener listener) {
@@ -110,7 +116,8 @@
}
/*
- * (non-Javadoc)
+ * (non-Javadoc)
+ *
* @see javax.faces.component.ActionSource#setAction(javax.faces.el.MethodBinding)
*/
public void setAction(MethodBinding action) {
@@ -119,7 +126,8 @@
}
/*
- * (non-Javadoc)
+ * (non-Javadoc)
+ *
* @see
javax.faces.component.ActionSource#setActionListener(javax.faces.el.MethodBinding)
*/
public void setActionListener(MethodBinding actionListener) {
@@ -133,7 +141,8 @@
}
/*
- * (non-Javadoc)
+ * (non-Javadoc)
+ *
* @see javax.faces.component.ActionSource#setImmediate(boolean)
*/
public void setImmediate(boolean immediate) {
Added:
root/cdk/trunk/plugins/maven-cdk-plugin/src/it/annotated-component/src/main/java/org/richfaces/cdk/test/event/TestEvent.java
===================================================================
---
root/cdk/trunk/plugins/maven-cdk-plugin/src/it/annotated-component/src/main/java/org/richfaces/cdk/test/event/TestEvent.java
(rev 0)
+++
root/cdk/trunk/plugins/maven-cdk-plugin/src/it/annotated-component/src/main/java/org/richfaces/cdk/test/event/TestEvent.java 2009-12-29
01:12:10 UTC (rev 16216)
@@ -0,0 +1,77 @@
+/*
+ * $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.test.event;
+
+import javax.faces.component.UIComponent;
+import javax.faces.event.FacesEvent;
+import javax.faces.event.FacesListener;
+
+/**
+ * <p class="changed_added_4_0">
+ * </p>
+ *
+ * @author asmirnov(a)exadel.com
+ *
+ */
+public class TestEvent extends FacesEvent {
+
+ /**
+ * <p class="changed_added_4_0">
+ * </p>
+ */
+ private static final long serialVersionUID = -2659567077711540715L;
+
+ /**
+ * <p class="changed_added_4_0">
+ * </p>
+ *
+ * @param component
+ */
+ public TestEvent(UIComponent component) {
+ super(component);
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see
javax.faces.event.FacesEvent#isAppropriateListener(javax.faces.event.FacesListener)
+ */
+ @Override
+ public boolean isAppropriateListener(FacesListener listener) {
+ // TODO Auto-generated method stub
+ return false;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see
javax.faces.event.FacesEvent#processListener(javax.faces.event.FacesListener)
+ */
+ @Override
+ public void processListener(FacesListener listener) {
+ // TODO Auto-generated method stub
+
+ }
+
+}
Property changes on:
root/cdk/trunk/plugins/maven-cdk-plugin/src/it/annotated-component/src/main/java/org/richfaces/cdk/test/event/TestEvent.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Modified:
root/cdk/trunk/plugins/maven-cdk-plugin/src/it/xml-configured-component/src/main/java/org/ajax4jsf/renderkit/RendererUtils.java
===================================================================
---
root/cdk/trunk/plugins/maven-cdk-plugin/src/it/xml-configured-component/src/main/java/org/ajax4jsf/renderkit/RendererUtils.java 2009-12-29
01:11:58 UTC (rev 16215)
+++
root/cdk/trunk/plugins/maven-cdk-plugin/src/it/xml-configured-component/src/main/java/org/ajax4jsf/renderkit/RendererUtils.java 2009-12-29
01:12:10 UTC (rev 16216)
@@ -19,15 +19,10 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
-
-
package org.ajax4jsf.renderkit;
-
import java.io.IOException;
-
import java.lang.reflect.Array;
-
import java.util.Arrays;
import java.util.Collection;
import java.util.HashMap;
@@ -44,22 +39,19 @@
import javax.faces.component.NamingContainer;
import javax.faces.component.UIComponent;
import javax.faces.component.UIForm;
-import javax.faces.component.UIParameter;
import javax.faces.component.UIViewRoot;
import javax.faces.component.ValueHolder;
-import javax.faces.component.behavior.ClientBehaviorContext.Parameter;
import javax.faces.component.behavior.ClientBehaviorHolder;
import javax.faces.context.FacesContext;
import javax.faces.context.ResponseWriter;
import javax.faces.convert.Converter;
/**
- * Util class for common render operations - render passthru html attributes,
- * iterate over child components etc.
- *
+ * Util class for common render operations - render passthru html attributes, iterate
over child components etc.
+ *
* @author asmirnov(a)exadel.com (latest modification by $Author: alexsmirnov $)
* @version $Revision: 1.1.2.6 $ $Date: 2007/02/08 19:07:16 $
- *
+ *
*/
public class RendererUtils {
public static final String DUMMY_FORM_ID = ":_form";
@@ -90,6 +82,7 @@
/**
* Use this method to get singleton instance of RendererUtils
+ *
* @return singleton instance
*/
public static RendererUtils getInstance() {
@@ -98,7 +91,7 @@
/**
* Encode id attribute with clientId component property
- *
+ *
* @param context
* @param component
* @throws IOException
@@ -109,7 +102,7 @@
/**
* Encode clientId to custom attribute ( for example, to control name )
- *
+ *
* @param context
* @param component
* @param attribute
@@ -127,14 +120,13 @@
if (null != clientId) {
context.getResponseWriter().writeAttribute(attribute, clientId,
- (String) getComponentAttributeName(attribute));
+ (String) getComponentAttributeName(attribute));
}
}
/**
- * Encode id attribute with clientId component property. Encoded only if id
- * not auto generated.
- *
+ * Encode id attribute with clientId component property. Encoded only if id not auto
generated.
+ *
* @param context
* @param component
* @throws IOException
@@ -142,32 +134,29 @@
public void encodeCustomId(FacesContext context, UIComponent component) throws
IOException {
if ((component.getId() != null) &&
!component.getId().startsWith(UIViewRoot.UNIQUE_ID_PREFIX)) {
context.getResponseWriter().writeAttribute(HTML.ID_ATTRIBUTE,
component.getClientId(context),
- HTML.ID_ATTRIBUTE);
+ HTML.ID_ATTRIBUTE);
}
}
public Map<String, Object> createParametersMap(FacesContext context,
UIComponent component) {
Map<String, Object> parameters = new LinkedHashMap<String,
Object>();
-
return parameters;
}
private void encodeBehaviors(FacesContext context, ClientBehaviorHolder
behaviorHolder,
- String defaultHtmlEventName, String[]
attributesExclusions)
- throws IOException {
+ String defaultHtmlEventName, String[] attributesExclusions) throws IOException {
}
/**
* Encode common pass-thru html attributes.
- *
+ *
* @param context
* @param component
* @throws IOException
*/
- public void encodePassThru(FacesContext context, UIComponent component, String
defaultHtmlEvent)
- throws IOException {
+ public void encodePassThru(FacesContext context, UIComponent component, String
defaultHtmlEvent) throws IOException {
encodeAttributesFromArray(context, component, HTML.PASS_THRU);
@@ -182,15 +171,15 @@
/**
* Encode pass-through attributes except specified ones
- *
+ *
* @param context
* @param component
* @param exclusions
* @throws IOException
*/
public void encodePassThruWithExclusions(FacesContext context, UIComponent component,
String exclusions,
- String defaultHtmlEvent) throws IOException {
-
+ String defaultHtmlEvent) throws IOException {
+
if (null != exclusions) {
String[] exclusionsArray = exclusions.split(",");
@@ -199,8 +188,8 @@
}
public void encodePassThruWithExclusionsArray(FacesContext context, UIComponent
component, String[] exclusions,
- String defaultHtmlEvent) throws IOException {
-
+ String defaultHtmlEvent) throws IOException {
+
ResponseWriter writer = context.getResponseWriter();
Map<String, Object> attributes = component.getAttributes();
@@ -230,16 +219,15 @@
}
/**
- * Encode one pass-thru attribute, with plain/boolean/url value, got from
- * properly component attribute.
- *
+ * Encode one pass-thru attribute, with plain/boolean/url value, got from properly
component attribute.
+ *
* @param context
* @param writer
* @param attribute
* @throws IOException
*/
public void encodePassThruAttribute(FacesContext context, Map<String, Object>
attributes, ResponseWriter writer,
- String attribute) throws IOException {
+ String attribute) throws IOException {
Object value = attributeValue(attribute,
attributes.get(getComponentAttributeName(attribute)));
@@ -257,7 +245,7 @@
public void encodeAttributesFromArray(FacesContext context, UIComponent component,
String[] attrs)
throws IOException {
-
+
ResponseWriter writer = context.getResponseWriter();
Map<String, Object> attributes = component.getAttributes();
@@ -270,7 +258,7 @@
/**
* Encode attributes given by comma-separated string list.
- *
+ *
* @param context
* current JSF context
* @param component
@@ -292,12 +280,12 @@
* @param component
* @param property
* @param attributeName
- *
+ *
* @throws IOException
*/
public void encodeAttribute(FacesContext context, UIComponent component, Object
property, String attributeName)
throws IOException {
-
+
ResponseWriter writer = context.getResponseWriter();
Object value = component.getAttributes().get(property);
@@ -311,14 +299,14 @@
}
public void writeText(ResponseWriter writer, Object value, String property) throws
IOException {
- if (value != null) {
- writer.writeText(value, property);
- }
+ if (value != null) {
+ writer.writeText(value, property);
+ }
}
-
+
/**
* Write html-attribute
- *
+ *
* @param writer
* @param attribute
* @param value
@@ -331,15 +319,14 @@
}
/**
- * @return true if and only if the argument <code>attributeVal</code> is
- * an instance of a wrapper for a primitive type and its value is
- * equal to the default value for that type as given in the spec.
+ * @return true if and only if the argument <code>attributeVal</code> is
an instance of a wrapper for a primitive
+ * type and its value is equal to the default value for that type as given in
the spec.
*/
public boolean shouldRenderAttribute(Object attributeVal) {
if (null == attributeVal) {
return false;
} else if ((attributeVal instanceof Boolean)
- && ((Boolean) attributeVal).booleanValue() ==
Boolean.FALSE.booleanValue()) {
+ && ((Boolean) attributeVal).booleanValue() ==
Boolean.FALSE.booleanValue()) {
return false;
} else if (attributeVal.toString().length() == 0) {
return false;
@@ -361,12 +348,11 @@
}
/**
- * Test for valid value of property. by default, for non-setted properties
- * with Java primitive types of JSF component return appropriate MIN_VALUE .
- *
- * @param property -
- * value of property returned from
- * {@link UIComponent#getAttributes()}
+ * Test for valid value of property. by default, for non-setted properties with Java
primitive types of JSF
+ * component return appropriate MIN_VALUE .
+ *
+ * @param property
+ * - value of property returned from {@link UIComponent#getAttributes()}
* @return true for setted property, false otherthise.
*/
public boolean isValidProperty(Object property) {
@@ -392,15 +378,15 @@
}
/**
- * Checks if the argument passed in is empty or not.
- * Object is empty if it is: <br />
- * - <code>null<code><br />
+ * Checks if the argument passed in is empty or not. Object is empty if it is: <br
/>
+ * - <code>null<code><br />
* - zero-length string<br />
* - empty collection<br />
* - empty map<br />
* - zero-length array<br />
- *
- * @param o object to check for emptiness
+ *
+ * @param o
+ * object to check for emptiness
* @since 3.3.2
* @return <code>true</code> if the argument is empty,
<code>false</code> otherwise
*/
@@ -430,7 +416,7 @@
/**
* Convert HTML attribute name to component property name.
- *
+ *
* @param key
* @return
*/
@@ -445,10 +431,9 @@
}
/**
- * Convert attribute value to proper object. For known html boolean
- * attributes return name for true value, otherthise - null. For non-boolean
- * attributes return same value.
- *
+ * Convert attribute value to proper object. For known html boolean attributes return
name for true value,
+ * otherthise - null. For non-boolean attributes return same value.
+ *
* @param name
* attribute name.
* @param value
@@ -472,12 +457,11 @@
/**
* Get boolean value of logical attribute
- *
+ *
* @param component
* @param name
* attribute name
- * @return true if attribute is equals Boolean.TRUE or String "true" ,
false
- * otherwise.
+ * @return true if attribute is equals Boolean.TRUE or String "true" ,
false otherwise.
*/
public boolean isBooleanAttribute(UIComponent component, String name) {
Object attrValue = component.getAttributes().get(name);
@@ -495,9 +479,8 @@
}
/**
- * Return converted value for {@link javax.faces.component.ValueHolder} as
- * String, perform nessesary convertions.
- *
+ * Return converted value for {@link javax.faces.component.ValueHolder} as String,
perform nessesary convertions.
+ *
* @param context
* @param component
* @return
@@ -523,10 +506,9 @@
}
/**
- * Convert any object value to string. If component instance of
- * {@link ValueHolder } got {@link Converter} for formatting. If not,
- * attempt to use converter based on value type.
- *
+ * Convert any object value to string. If component instance of {@link ValueHolder }
got {@link Converter} for
+ * formatting. If not, attempt to use converter based on value type.
+ *
* @param context
* @param component
* @return
@@ -570,9 +552,9 @@
/**
* formats given value to
- *
+ *
* @param value
- *
+ *
* @return
*/
public String encodePctOrPx(String value) {
@@ -585,7 +567,7 @@
/**
* Find nested form for given component
- *
+ *
* @param component
* @return nested <code>UIForm</code> component, or
<code>null</code>
*/
@@ -636,7 +618,7 @@
*/
public void encodeBeginForm(FacesContext context, UIComponent component,
ResponseWriter writer, String clientId)
throws IOException {
-
+
String actionURL = getActionUrl(context);
String encodeActionURL =
context.getExternalContext().encodeActionURL(actionURL);
@@ -685,7 +667,7 @@
/**
* Simplified version of {@link encodeId}
- *
+ *
* @param context
* @param component
* @return client id of current component
@@ -705,7 +687,7 @@
/**
* Wtrie JavaScript with start/end elements and type.
- *
+ *
* @param context
* @param component
* @param script
@@ -727,15 +709,15 @@
* @return
*/
private static boolean checkKeyword(Collection<String> ids, String keyword) {
- if (ids.contains(keyword)) {
- if (ids.size() != 1) {
- //TODO log
- }
-
- return true;
- }
-
- return false;
+ if (ids.contains(keyword)) {
+ if (ids.size() != 1) {
+ // TODO log
+ }
+
+ return true;
+ }
+
+ return false;
}
/**
@@ -745,14 +727,12 @@
* @since 4.0
* @return
*/
- public Collection<String> findComponentsFor(FacesContext context, UIComponent
component,
- Collection<String> shortIds) {
+ public Collection<String> findComponentsFor(FacesContext context, UIComponent
component, Collection<String> shortIds) {
// TODO - implement
// TODO add support for @*
Set<String> result = new LinkedHashSet<String>(shortIds.size());
-
return result;
}
@@ -793,9 +773,10 @@
/**
* If target component contains generated id and for doesn't, correct for id
+ *
* @param forAttr
* @param component
- *
+ *
*/
public String correctForIdReference(String forAttr, UIComponent component) {
int contains = forAttr.indexOf(UIViewRoot.UNIQUE_ID_PREFIX);
@@ -815,7 +796,7 @@
private UIComponent findUIComponentBelow(UIComponent root, String id) {
UIComponent target = null;
- for (Iterator<UIComponent> iter = root.getFacetsAndChildren();
iter.hasNext(); ) {
+ for (Iterator<UIComponent> iter = root.getFacetsAndChildren();
iter.hasNext();) {
UIComponent child = (UIComponent) iter.next();
if (child instanceof NamingContainer) {
@@ -842,15 +823,15 @@
public static void writeEventHandlerFunction(FacesContext context, UIComponent
component, String eventName)
throws IOException {
-
+
}
/**
* Common HTML elements and attributes names.
- *
+ *
* @author asmirnov(a)exadel.com (latest modification by $Author: alexsmirnov $)
* @version $Revision: 1.1.2.6 $ $Date: 2007/02/08 19:07:16 $
- *
+ *
*/
public interface HTML {
public static final String ACCEPT_ATTRIBUTE = "accept";
@@ -931,29 +912,23 @@
"accesskey", "alt", "cols", "height",
"lang", "longdesc", "maxlength", "rows",
"size", "tabindex", "title",
"width", "dir", "rules", "frame",
"border", "cellspacing", "cellpadding", "summary",
"bgcolor", "usemap",
"enctype", "accept-charset", "accept",
"target", "charset", "coords", "hreflang",
"rel", "rev", "shape",
- "disabled", "readonly", "ismap",
"align"
- };
+ "disabled", "readonly", "ismap",
"align" };
/**
* HTML attributes allowed boolean-values only
*/
- public static final String[] PASS_THRU_BOOLEAN = {
- "disabled", "declare", "readonly",
"compact", "ismap", "selected", "checked",
"nowrap", "noresize",
- "nohref", "noshade", "multiple"
- };
- public static final String[] PASS_THRU_EVENTS = {
- "onblur", "onchange", "onclick",
"ondblclick", "onfocus", "onkeydown",
"onkeypress", "onkeyup", "onload",
- "onmousedown", "onmousemove", "onmouseout",
"onmouseover", "onmouseup", "onreset", "onselect",
"onsubmit",
- "onunload"
- };
- public static final String[] PASS_THRU_STYLES = {"style",
"class", };
+ public static final String[] PASS_THRU_BOOLEAN = { "disabled",
"declare", "readonly", "compact", "ismap",
+ "selected", "checked", "nowrap",
"noresize", "nohref", "noshade", "multiple" };
+ public static final String[] PASS_THRU_EVENTS = { "onblur",
"onchange", "onclick", "ondblclick", "onfocus",
+ "onkeydown", "onkeypress", "onkeyup",
"onload", "onmousedown", "onmousemove",
"onmouseout", "onmouseover",
+ "onmouseup", "onreset", "onselect",
"onsubmit", "onunload" };
+ public static final String[] PASS_THRU_STYLES = { "style",
"class", };
/**
* all HTML attributes with URI value.
*/
- public static final String[] PASS_THRU_URI = {
- "usemap", "background", "codebase",
"cite", "data", "classid", "href",
"longdesc", "profile", "src"
- };
+ public static final String[] PASS_THRU_URI = { "usemap",
"background", "codebase", "cite", "data",
"classid",
+ "href", "longdesc", "profile", "src"
};
public static final String READONLY_ATTRIBUTE = "readonly";
public static final String REL_ATTR = "rel";
public static final String REV_ATTR = "rev";