You are viewing a plain text version of this content. The canonical link for it is here.
Posted to adffaces-commits@incubator.apache.org by aw...@apache.org on 2006/07/19 17:14:47 UTC
svn commit: r423531 - in /incubator/adffaces/trunk/adf-faces:
adf-faces-api/src/main/java/org/apache/myfaces/adf/bean/
adf-faces-api/src/main/java/org/apache/myfaces/adf/util/
adf-faces-api/src/main/java/org/apache/myfaces/adf/validator/
adf-faces-impl...
Author: awiner
Date: Wed Jul 19 10:14:46 2006
New Revision: 423531
URL: http://svn.apache.org/viewvc?rev=423531&view=rev
Log:
ADFFACES-44: <af:validateRegExp/> does not allow EL for noMatchMessageDetail. Patch from Simon Lessard
Modified:
incubator/adffaces/trunk/adf-faces/adf-faces-api/src/main/java/org/apache/myfaces/adf/bean/FacesBean.java
incubator/adffaces/trunk/adf-faces/adf-faces-api/src/main/java/org/apache/myfaces/adf/bean/FacesBeanImpl.java
incubator/adffaces/trunk/adf-faces/adf-faces-api/src/main/java/org/apache/myfaces/adf/util/MessageFactory.java
incubator/adffaces/trunk/adf-faces/adf-faces-api/src/main/java/org/apache/myfaces/adf/validator/ByteLengthValidator.java
incubator/adffaces/trunk/adf-faces/adf-faces-api/src/main/java/org/apache/myfaces/adf/validator/DateTimeRangeValidator.java
incubator/adffaces/trunk/adf-faces/adf-faces-api/src/main/java/org/apache/myfaces/adf/validator/RegExpValidator.java
incubator/adffaces/trunk/adf-faces/adf-faces-impl/src/main/java/org/apache/myfaces/adfinternal/renderkit/htmlBasic/ComponentFacesBean.java
incubator/adffaces/trunk/adf-faces/adf-faces-impl/src/main/java/org/apache/myfaces/adfinternal/validator/RegExpValidator.java
Modified: incubator/adffaces/trunk/adf-faces/adf-faces-api/src/main/java/org/apache/myfaces/adf/bean/FacesBean.java
URL: http://svn.apache.org/viewvc/incubator/adffaces/trunk/adf-faces/adf-faces-api/src/main/java/org/apache/myfaces/adf/bean/FacesBean.java?rev=423531&r1=423530&r2=423531&view=diff
==============================================================================
--- incubator/adffaces/trunk/adf-faces/adf-faces-api/src/main/java/org/apache/myfaces/adf/bean/FacesBean.java (original)
+++ incubator/adffaces/trunk/adf-faces/adf-faces-api/src/main/java/org/apache/myfaces/adf/bean/FacesBean.java Wed Jul 19 10:14:46 2006
@@ -1,431 +1,469 @@
-/*
- * Copyright 2004-2006 The Apache Software Foundation.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.myfaces.adf.bean;
-
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.Map;
-import java.util.Set;
-
-import javax.faces.context.FacesContext;
-import javax.faces.el.ValueBinding;
-
-/**
- * Base interface for FacesBean storage objects.
- *
- * @author The Oracle ADF Faces Team
- */
-public interface FacesBean
-{
- /**
- * Returns the Type of this bean.
- */
- public Type getType();
-
- /**
- * Returns a property. If the property has not been explicitly
- * set, and the key supports bindings, and a ValueBinding has
- * been set for this key, that ValueBinding will be evaluated.
- *
- * @param key the property key
- * @todo Additional version that takes a FacesContext?
- * @exception IllegalArgumentException if key is a list key
- */
- public Object getProperty(PropertyKey key);
-
- /**
- * Set a property.
- * @exception IllegalArgumentException if key is a list key
- */
- public void setProperty(PropertyKey key, Object value);
-
- /**
- * Return a property, ignoring any value bindings.
- *
- * @exception IllegalArgumentException if key is a list key
- */
- public Object getLocalProperty(PropertyKey key);
-
- /**
- * Return the value binding for a key.
- * @exception IllegalArgumentException if the property does
- * not support value bindings.
- */
- public ValueBinding getValueBinding(PropertyKey key);
-
- /**
- * Set the value binding for a key.
- * @exception IllegalArgumentException if the property does
- * not support value bindings.
- */
- public void setValueBinding(PropertyKey key, ValueBinding binding);
-
- /**
- * Add an entry to a list. The same value may be added
- * repeatedly; null is also a legal value. (Consumers of
- * this API can apply more stringent rules to specific keys
- * in cover functions.)
- * @exception IllegalArgumentException if the key is not a list key.
- */
- public void addEntry(PropertyKey listKey, Object value);
-
- /**
- * Remove an entry from a list.
- * @exception IllegalArgumentException if the key is not a list key.
- */
- public void removeEntry(PropertyKey listKey, Object value);
-
- /**
- * Return as an array all elements of this key that
- * are instances of the specified class.
- * @return an array whose instance type is the class
- * @todo This can, of course, be implemented on top of entries();
- * consider moving to a utility function; however, it's
- * universally needed by all consumers, so...
- * @exception IllegalArgumentException if the key is not a list key.
- */
- public Object[] getEntries(PropertyKey listKey, Class clazz);
-
- /**
- * Return true if at least one element of the list identified by
- * this key is an instance of the specified class.
- * @exception IllegalArgumentException if the key is not a list key.
- */
- public boolean containsEntry(PropertyKey listKey, Class clazz);
-
- /**
- * Returns an iterator over all entries at this key.
- * @todo is this iterator read-only or read-write?
- * @exception IllegalArgumentException if the key is not a list key.
- */
- public Iterator entries(PropertyKey listKey);
-
- /**
- * Copies all properties, bindings, and list entries from
- * one bean to another. If the beans are of different types,
- * properties will be copied by name. Incompatible properties will be
- * ignored; specifically, properties that are lists on only one
- * of the beans or ValueBindings on the original bean that
- * are not allowed on the target bean.
- */
- public void addAll(FacesBean from);
-
- /**
- * Returns a Set of all PropertyKeys that have either lists
- * or values attached.
- */
- public Set keySet();
-
- /**
- * Returns a Set of all PropertyKeys that have ValueBindings attached.
- */
- public Set bindingKeySet();
-
- public void markInitialState();
-
- /**
- * Saves the state of a FacesBean.
- */
- public Object saveState(FacesContext context);
-
- /**
- * Restores the state of a FacesBean.
- */
- public void restoreState(FacesContext context, Object state);
-
- /**
- * @todo Extract as interface?
- */
- public static class Type
- {
- public Type()
- {
- this(null);
- }
-
- public Type(Type superType)
- {
- _superType = superType;
- _init();
- }
-
- /**
- * Find an existing key by name.
- */
- public PropertyKey findKey(String name)
- {
- return _keyMap.get(name);
- }
-
- /**
- * Find an existing key by index.
- */
- public PropertyKey findKey(int index)
- {
- if ((index < 0) || (index >= _keyList.size()))
- return null;
-
- return _keyList.get(index);
- }
-
- /**
- * Register a new key.
- * @exception IllegalStateException if the type is already locked,
- * or the key does not already exists.
- */
- public final PropertyKey registerKey(
- String name,
- Class type,
- Object defaultValue)
- {
- return registerKey(name, type, defaultValue, 0);
- }
-
- /**
- * Register a new key.
- * @exception IllegalStateException if the type is already locked,
- * or the key does not already exists.
- */
- public final PropertyKey registerKey(
- String name,
- Class type)
- {
- return registerKey(name, type, null, 0);
- }
-
- /**
- * Register a new key.
- * @exception IllegalStateException if the type is already locked,
- * or the key does not already exists.
- */
- public final PropertyKey registerKey(
- String name)
- {
- return registerKey(name, Object.class, null, 0);
- }
-
- /**
- * Register a new key.
- * @exception IllegalStateException if the type is already locked,
- * or the key does not already exists.
- */
- public final PropertyKey registerKey(
- String name,
- int capabilities)
- {
- return registerKey(name, Object.class, null, capabilities);
- }
-
- /**
- * Register a new key.
- * @exception IllegalStateException if the type is already locked,
- * or the key does not already exists.
- */
- public final PropertyKey registerKey(
- String name,
- Class type,
- int capabilities)
- {
- return registerKey(name, type, null, capabilities);
- }
-
- /**
- * Add an alias to an existing PropertyKey.
- * @exception IllegalStateException if the type is already locked,
- * or a key already exists at the alias.
- */
- public PropertyKey registerAlias(PropertyKey key, String alias)
- {
- _checkLocked();
-
- if (findKey(alias) != null)
- throw new IllegalStateException();
-
- _keyMap.put(alias, key);
- return key;
- }
-
-
- /**
- * Register a new key with a set of capabilities.
- * @exception IllegalStateException if the type is already locked,
- * or the key already exists.
- */
- public PropertyKey registerKey(
- String name,
- Class type,
- Object defaultValue,
- int capabilities)
- {
- _checkLocked();
-
- PropertyKey key = createPropertyKey(name,
- type,
- defaultValue,
- capabilities,
- getNextIndex());
- addKey(key);
- return key;
- }
-
-
- /**
- * Locks the type object, preventing further changes.
- */
- public void lock()
- {
- _isLocked = true;
- }
-
- /**
- * Locks the type object, preventing further changes.
- */
- public void lockAndRegister(
- /*String renderKitId,*/
- String componentFamily,
- String rendererType)
- {
- lock();
- // =-=AEW We don't yet have the renderKitId available here yet
- TypeRepository.registerType(/*renderKitId, */
- componentFamily,
- rendererType,
- this);
- }
-
- /**
- * Returns the iterator of registered property keys, excluding aliases.
- */
- public Iterator<PropertyKey> keys()
- {
- return _keyList.iterator();
- }
-
- protected PropertyKey createPropertyKey(
- String name,
- Class type,
- Object defaultValue,
- int capabilities,
- int index)
- {
- if (_superType != null)
- {
- return _superType.createPropertyKey(name, type, defaultValue,
- capabilities, index);
- }
-
- return new PropertyKey(name, type, defaultValue, capabilities, index);
- }
-
- /**
- * Return the next available index.
- */
- protected int getNextIndex()
- {
- int index = _index;
- _index = index + 1;
- return index;
- }
-
-
- /**
- * Add a key to the type.
- * @exception IllegalStateException if the type is already locked,
- * or a key with that name or index already exists.
- */
- protected void addKey(PropertyKey key)
- {
- _checkLocked();
-
- // Restore the old key
- PropertyKey oldValue = _keyMap.put(key.getName(), key);
- if (oldValue != null)
- {
- _keyMap.put(key.getName(), oldValue);
- throw new IllegalStateException(
- "Name \"" + key.getName() + "\" had already been registered.");
- }
-
- int index = key.getIndex();
- if (index >= 0)
- {
- _expandListToIndex(_keyList, index);
- oldValue = _keyList.set(index, key);
- if (oldValue != null)
- {
- _keyList.set(index, oldValue);
- throw new IllegalStateException(
- "Index \"" + index + "\" had already been registered.");
- }
- }
-
- // Set the backpointer
- key.__setOwner(this);
- }
-
-
- static private void _expandListToIndex(ArrayList list, int count)
- {
- list.ensureCapacity(count + 1);
- int addCount = (count + 1) - list.size();
- for (int i = 0; i < addCount; i++)
- list.add(null);
- }
-
- /**
- * @todo initial size of map, and type of map
- * @todo initial size of list, and type of list
- * @todo build combined data structure
- */
- private void _init()
- {
- _keyMap = new HashMap<String, PropertyKey>();
- _keyList = new ArrayList<PropertyKey>();
-
- if (_superType != null)
- {
- _keyMap.putAll(_superType._keyMap);
- _keyList.addAll(_superType._keyList);
- _index = _superType._index;
- _superType.lock();
- }
- }
-
-
- private void _checkName(String name)
- {
- if (findKey(name) != null)
- {
- throw new IllegalStateException(
- "Name \"" + name + "\" has already been registered.");
- }
- }
-
- private void _checkLocked()
- {
- if (_isLocked)
- throw new IllegalStateException("Type is already locked");
- }
-
- private Map<String, PropertyKey> _keyMap;
- private ArrayList<PropertyKey> _keyList;
- private boolean _isLocked;
- private int _index;
- private Type _superType;
- }
-
-}
+/*
+ * Copyright 2004-2006 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.myfaces.adf.bean;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.Map;
+import java.util.Set;
+
+import javax.faces.context.FacesContext;
+import javax.faces.el.ValueBinding;
+
+/**
+ * Base interface for FacesBean storage objects.
+ *
+ * @author The Oracle ADF Faces Team
+ */
+public interface FacesBean
+{
+ /**
+ * Returns the Type of this bean.
+ */
+ public Type getType();
+
+ /**
+ * Returns a property. If the property has not been explicitly
+ * set, and the key supports bindings, and a ValueBinding has
+ * been set for this key, that ValueBinding will be evaluated.
+ *
+ * @param key the property key
+ * @todo Additional version that takes a FacesContext?
+ * @exception IllegalArgumentException if key is a list key
+ */
+ public Object getProperty(PropertyKey key);
+
+ /**
+ * Set a property.
+ * @exception IllegalArgumentException if key is a list key
+ */
+ public void setProperty(PropertyKey key, Object value);
+
+ /**
+ * Return a property, ignoring any value bindings.
+ *
+ * @exception IllegalArgumentException if key is a list key
+ */
+ public Object getLocalProperty(PropertyKey key);
+
+ /**
+ * Return the value binding for a key.
+ * @exception IllegalArgumentException if the property does
+ * not support value bindings.
+ */
+ public ValueBinding getValueBinding(PropertyKey key);
+
+ /**
+ * Gets the current unevaluated value for the specified property key.
+ * <p>The method will first look for a local value. If it exists, it will
+ * be returned. If it does not and the bean supports value bindings, the
+ * method will look for a binding with the specified key and return it
+ * directly if it exists without evaluatig its value.</p>
+ * <p>This method is mainly used when:</p>
+ * <ul>
+ * <li>The caller cannot ensure that FacesContext exists at the time
+ * of the call</li>
+ * <li>The FacesContext does not yet contains the managed bean
+ * referenced by the value binding</li>
+ * <li>The managed bean referenced by the value binding is not yet
+ * in a coherent state to evaluate the expression</li>
+ * </ul>
+ * <p>The most common use case of this method is for message attributes
+ * set on converters and validators using a value binding referencing
+ * a managed bean created by <code><f:loadBundle/><code>. Since
+ * loadBundle only creates its bean during the render response phase
+ * while converter and validators take action during process validation
+ * phase, the message property's value binding must be stored in a
+ * special <code>FacesMessage</code> implementation that will evaluate
+ * the binding only during render response.</p>
+ *
+ * @param key the parameter key of the raw property value to get.
+ *
+ * @return the local value of the specified key if it exists, a
+ * <code>ValueBinding</code> object if the specified key
+ * supports bindings and a binding was specified for that
+ * property, <code>null</code> otherwise.
+ *
+ * @throws IllegalArgumentException if the specified key is a list key.
+ *
+ * @see #getLocalProperty(PropertyKey)
+ * @see #getValueBinding(PropertyKey)
+ */
+ public Object getRawProperty(PropertyKey key);
+
+ /**
+ * Set the value binding for a key.
+ * @exception IllegalArgumentException if the property does
+ * not support value bindings.
+ */
+ public void setValueBinding(PropertyKey key, ValueBinding binding);
+
+ /**
+ * Add an entry to a list. The same value may be added
+ * repeatedly; null is also a legal value. (Consumers of
+ * this API can apply more stringent rules to specific keys
+ * in cover functions.)
+ * @exception IllegalArgumentException if the key is not a list key.
+ */
+ public void addEntry(PropertyKey listKey, Object value);
+
+ /**
+ * Remove an entry from a list.
+ * @exception IllegalArgumentException if the key is not a list key.
+ */
+ public void removeEntry(PropertyKey listKey, Object value);
+
+ /**
+ * Return as an array all elements of this key that
+ * are instances of the specified class.
+ * @return an array whose instance type is the class
+ * @todo This can, of course, be implemented on top of entries();
+ * consider moving to a utility function; however, it's
+ * universally needed by all consumers, so...
+ * @exception IllegalArgumentException if the key is not a list key.
+ */
+ public Object[] getEntries(PropertyKey listKey, Class clazz);
+
+ /**
+ * Return true if at least one element of the list identified by
+ * this key is an instance of the specified class.
+ * @exception IllegalArgumentException if the key is not a list key.
+ */
+ public boolean containsEntry(PropertyKey listKey, Class clazz);
+
+ /**
+ * Returns an iterator over all entries at this key.
+ * @todo is this iterator read-only or read-write?
+ * @exception IllegalArgumentException if the key is not a list key.
+ */
+ public Iterator entries(PropertyKey listKey);
+
+ /**
+ * Copies all properties, bindings, and list entries from
+ * one bean to another. If the beans are of different types,
+ * properties will be copied by name. Incompatible properties will be
+ * ignored; specifically, properties that are lists on only one
+ * of the beans or ValueBindings on the original bean that
+ * are not allowed on the target bean.
+ */
+ public void addAll(FacesBean from);
+
+ /**
+ * Returns a Set of all PropertyKeys that have either lists
+ * or values attached.
+ */
+ public Set keySet();
+
+ /**
+ * Returns a Set of all PropertyKeys that have ValueBindings attached.
+ */
+ public Set bindingKeySet();
+
+ public void markInitialState();
+
+ /**
+ * Saves the state of a FacesBean.
+ */
+ public Object saveState(FacesContext context);
+
+ /**
+ * Restores the state of a FacesBean.
+ */
+ public void restoreState(FacesContext context, Object state);
+
+ /**
+ * @todo Extract as interface?
+ */
+ public static class Type
+ {
+ public Type()
+ {
+ this(null);
+ }
+
+ public Type(Type superType)
+ {
+ _superType = superType;
+ _init();
+ }
+
+ /**
+ * Find an existing key by name.
+ */
+ public PropertyKey findKey(String name)
+ {
+ return _keyMap.get(name);
+ }
+
+ /**
+ * Find an existing key by index.
+ */
+ public PropertyKey findKey(int index)
+ {
+ if ((index < 0) || (index >= _keyList.size()))
+ return null;
+
+ return _keyList.get(index);
+ }
+
+ /**
+ * Register a new key.
+ * @exception IllegalStateException if the type is already locked,
+ * or the key does not already exists.
+ */
+ public final PropertyKey registerKey(
+ String name,
+ Class type,
+ Object defaultValue)
+ {
+ return registerKey(name, type, defaultValue, 0);
+ }
+
+ /**
+ * Register a new key.
+ * @exception IllegalStateException if the type is already locked,
+ * or the key does not already exists.
+ */
+ public final PropertyKey registerKey(
+ String name,
+ Class type)
+ {
+ return registerKey(name, type, null, 0);
+ }
+
+ /**
+ * Register a new key.
+ * @exception IllegalStateException if the type is already locked,
+ * or the key does not already exists.
+ */
+ public final PropertyKey registerKey(
+ String name)
+ {
+ return registerKey(name, Object.class, null, 0);
+ }
+
+ /**
+ * Register a new key.
+ * @exception IllegalStateException if the type is already locked,
+ * or the key does not already exists.
+ */
+ public final PropertyKey registerKey(
+ String name,
+ int capabilities)
+ {
+ return registerKey(name, Object.class, null, capabilities);
+ }
+
+ /**
+ * Register a new key.
+ * @exception IllegalStateException if the type is already locked,
+ * or the key does not already exists.
+ */
+ public final PropertyKey registerKey(
+ String name,
+ Class type,
+ int capabilities)
+ {
+ return registerKey(name, type, null, capabilities);
+ }
+
+ /**
+ * Add an alias to an existing PropertyKey.
+ * @exception IllegalStateException if the type is already locked,
+ * or a key already exists at the alias.
+ */
+ public PropertyKey registerAlias(PropertyKey key, String alias)
+ {
+ _checkLocked();
+
+ if (findKey(alias) != null)
+ throw new IllegalStateException();
+
+ _keyMap.put(alias, key);
+ return key;
+ }
+
+
+ /**
+ * Register a new key with a set of capabilities.
+ * @exception IllegalStateException if the type is already locked,
+ * or the key already exists.
+ */
+ public PropertyKey registerKey(
+ String name,
+ Class type,
+ Object defaultValue,
+ int capabilities)
+ {
+ _checkLocked();
+ _checkName(name);
+
+ PropertyKey key = createPropertyKey(name,
+ type,
+ defaultValue,
+ capabilities,
+ getNextIndex());
+ addKey(key);
+ return key;
+ }
+
+
+ /**
+ * Locks the type object, preventing further changes.
+ */
+ public void lock()
+ {
+ _isLocked = true;
+ }
+
+ /**
+ * Locks the type object, preventing further changes.
+ */
+ public void lockAndRegister(
+ /*String renderKitId,*/
+ String componentFamily,
+ String rendererType)
+ {
+ lock();
+ // =-=AEW We don't yet have the renderKitId available here yet
+ TypeRepository.registerType(/*renderKitId, */
+ componentFamily,
+ rendererType,
+ this);
+ }
+
+ /**
+ * Returns the iterator of registered property keys, excluding aliases.
+ */
+ public Iterator<PropertyKey> keys()
+ {
+ return _keyList.iterator();
+ }
+
+ protected PropertyKey createPropertyKey(
+ String name,
+ Class type,
+ Object defaultValue,
+ int capabilities,
+ int index)
+ {
+ if (_superType != null)
+ {
+ return _superType.createPropertyKey(name, type, defaultValue,
+ capabilities, index);
+ }
+
+ return new PropertyKey(name, type, defaultValue, capabilities, index);
+ }
+
+ /**
+ * Return the next available index.
+ */
+ protected int getNextIndex()
+ {
+ int index = _index;
+ _index = index + 1;
+ return index;
+ }
+
+
+ /**
+ * Add a key to the type.
+ * @exception IllegalStateException if the type is already locked,
+ * or a key with that name or index already exists.
+ */
+ protected void addKey(PropertyKey key)
+ {
+ _checkLocked();
+
+ // Restore the old key
+ PropertyKey oldValue = _keyMap.put(key.getName(), key);
+ if (oldValue != null)
+ {
+ _keyMap.put(key.getName(), oldValue);
+ throw new IllegalStateException(
+ "Name \"" + key.getName() + "\" had already been registered.");
+ }
+
+ int index = key.getIndex();
+ if (index >= 0)
+ {
+ _expandListToIndex(_keyList, index);
+ oldValue = _keyList.set(index, key);
+ if (oldValue != null)
+ {
+ _keyList.set(index, oldValue);
+ throw new IllegalStateException(
+ "Index \"" + index + "\" had already been registered.");
+ }
+ }
+
+ // Set the backpointer
+ key.__setOwner(this);
+ }
+
+
+ static private void _expandListToIndex(ArrayList<?> list, int count)
+ {
+ list.ensureCapacity(count + 1);
+ int addCount = (count + 1) - list.size();
+ for (int i = 0; i < addCount; i++)
+ list.add(null);
+ }
+
+ /**
+ * @todo initial size of map, and type of map
+ * @todo initial size of list, and type of list
+ * @todo build combined data structure
+ */
+ private void _init()
+ {
+ _keyMap = new HashMap<String, PropertyKey>();
+ _keyList = new ArrayList<PropertyKey>();
+
+ if (_superType != null)
+ {
+ _keyMap.putAll(_superType._keyMap);
+ _keyList.addAll(_superType._keyList);
+ _index = _superType._index;
+ _superType.lock();
+ }
+ }
+
+ private void _checkLocked()
+ {
+ if (_isLocked)
+ throw new IllegalStateException("Type is already locked");
+ }
+
+ private void _checkName(String name)
+ {
+ if (findKey(name) != null)
+ {
+ throw new IllegalStateException(
+ "Name \"" + name + "\" has already been registered.");
+ }
+ }
+
+ private Map<String, PropertyKey> _keyMap;
+ private ArrayList<PropertyKey> _keyList;
+ private boolean _isLocked;
+ private int _index;
+ private Type _superType;
+ }
+
+}
Modified: incubator/adffaces/trunk/adf-faces/adf-faces-api/src/main/java/org/apache/myfaces/adf/bean/FacesBeanImpl.java
URL: http://svn.apache.org/viewvc/incubator/adffaces/trunk/adf-faces/adf-faces-api/src/main/java/org/apache/myfaces/adf/bean/FacesBeanImpl.java?rev=423531&r1=423530&r2=423531&view=diff
==============================================================================
--- incubator/adffaces/trunk/adf-faces/adf-faces-api/src/main/java/org/apache/myfaces/adf/bean/FacesBeanImpl.java (original)
+++ incubator/adffaces/trunk/adf-faces/adf-faces-api/src/main/java/org/apache/myfaces/adf/bean/FacesBeanImpl.java Wed Jul 19 10:14:46 2006
@@ -69,6 +69,24 @@
return null;
}
+
+
+ /**
+ * {@inheritDoc}
+ */
+ final public Object getRawProperty(PropertyKey key)
+ {
+ _checkNotListKey(key);
+
+ Object local = getLocalProperty(key);
+ if (local != null)
+ return local;
+
+ // Look for a binding if and only if the key supports bindings
+ return key.getSupportsBinding() ? getValueBinding(key) : null;
+ }
+
+
/**
* @todo Need *good* way of hooking property-sets; it's
* currently not called from state restoring, so really, it shouldn't
@@ -123,6 +141,7 @@
}
+ @SuppressWarnings("unchecked")
final public void addEntry(PropertyKey listKey, Object value)
{
_checkListKey(listKey);
@@ -158,16 +177,17 @@
setPropertyImpl(listKey, l);
}
+ @SuppressWarnings("unchecked")
final public Object[] getEntries(PropertyKey listKey, Class clazz)
{
_checkListKey(listKey);
- List l = (List) getLocalPropertyImpl(listKey);
+ List<Object> l = (List<Object>) getLocalPropertyImpl(listKey);
if (l == null)
return (Object[]) Array.newInstance(clazz, 0);
int size = l.size();
- ArrayList tempList = new ArrayList(size);
+ ArrayList<Object> tempList = new ArrayList<Object>(size);
for (int i = 0; i < size; i++)
{
Object o = l.get(i);
@@ -342,6 +362,7 @@
return propertyState;
}
+ @Override
public String toString()
{
String className = getClass().getName();
Modified: incubator/adffaces/trunk/adf-faces/adf-faces-api/src/main/java/org/apache/myfaces/adf/util/MessageFactory.java
URL: http://svn.apache.org/viewvc/incubator/adffaces/trunk/adf-faces/adf-faces-api/src/main/java/org/apache/myfaces/adf/util/MessageFactory.java?rev=423531&r1=423530&r2=423531&view=diff
==============================================================================
--- incubator/adffaces/trunk/adf-faces/adf-faces-api/src/main/java/org/apache/myfaces/adf/util/MessageFactory.java (original)
+++ incubator/adffaces/trunk/adf-faces/adf-faces-api/src/main/java/org/apache/myfaces/adf/util/MessageFactory.java Wed Jul 19 10:14:46 2006
@@ -1,658 +1,672 @@
-/*
- * Copyright 2000-2006 The Apache Software Foundation.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.myfaces.adf.util;
-
-import javax.faces.application.FacesMessage;
-import javax.faces.component.UIComponent;
-import javax.faces.context.FacesContext;
-import javax.faces.el.ValueBinding;
-import org.apache.myfaces.adf.logging.ADFLogger;
-
-/**
- * Factory class to return {@link FacesMessage} objects.
- * @version $Name: $ ($Revision: adfrt/faces/adf-faces-api/src/main/java/oracle/adf/view/faces/util/MessageFactory.java#0 $) $Date: 30-nov-2005.11:48:33 $
- * @author The Oracle ADF Faces Team
- */
-public class MessageFactory
-{
- private MessageFactory()
- {
- }
-
- /**
- * Creates a FacesMessage for the given Throwable.
- * The severity is {@link FacesMessage#SEVERITY_ERROR}
- * @param error The root cause of this Exception will be used.
- */
- public static FacesMessage getMessage(Throwable error)
- {
- _LOG.fine(error);
-
- Throwable unwrap = ComponentUtils.unwrap(error);
- String detail = unwrap.getLocalizedMessage();
- if (detail == null)
- {
- // this is unusual. It is probably an unexpected RT error
- // in the framework. log at warning level:
- detail = unwrap.getClass().getName();
- _LOG.warning(error);
- }
- // bug 4733165:
- FacesMessage message =
- new FacesMessage(FacesMessage.SEVERITY_ERROR, detail, detail);
- return message;
- }
-
- /**
- * Creates a FacesMessage containing formatted text and
- * a severity of SEVERITY_ERROR.
- *
- * @param context faces context
- * @param messageId the bundle key for the translated string
- * @param parameters parameters to be substituted in the placeholders
- * of the translated string.
- * @return a FacesMessage object
- */
- public static FacesMessage getMessage(
- FacesContext context,
- String messageId,
- Object[] parameters
- )
- {
- return getMessage(context, FacesMessage.SEVERITY_ERROR,
- messageId, parameters, null);
- }
-
- /**
- * Creates a FacesMessage containing formatted text and
- * a severity of SEVERITY_ERROR.
- *
- * @param context faces context
- * @param messageId the bundle key for the translated string
- * @param parameters parameters to be substituted in the placeholders
- * of the translated string.
- * @param component The component generating the message
- * (allows label tracking)
- * @return a FacesMessage object
- */
- public static FacesMessage getMessage(
- FacesContext context,
- String messageId,
- Object[] parameters,
- UIComponent component
- )
- {
- return _createFacesMessage(context, FacesMessage.SEVERITY_ERROR, messageId,
- parameters, _getLabel(component));
- }
-
-
- /**
- * Creates a FacesMessage containing formatted text and
- * a severity of SEVERITY_ERROR.
- *
- * @param context faces context
- * @param messageId the bundle key for the translated string
- * @param parameters parameters to be substituted in the placeholders
- * of the translated string.
- * @param label The label of the component generating the message
- * @return a FacesMessage object
- */
- public static FacesMessage getMessage(
- FacesContext context,
- String messageId,
- Object[] parameters,
- Object label
- )
- {
- return _createFacesMessage(context, FacesMessage.SEVERITY_ERROR, messageId,
- parameters, label);
- }
-
- /**
- * Creates a FacesMessage containing formatted text.
- *
- * @param context faces context
- * @param severity the message severity
- * @param messageId the bundle key for the translated string
- * @param parameters parameters to be substituted in the placeholders
- * of the translated string.
- * @return a FacesMessage object
- */
- public static FacesMessage getMessage(
- FacesContext context,
- FacesMessage.Severity severity,
- String messageId,
- Object[] parameters
- )
- {
- return getMessage(context, severity,
- messageId, parameters, null);
- }
-
- /**
- * Creates a FacesMessage containing formatted text.
- *
- * @param context faces context
- * @param severity the message severity
- * @param messageId the bundle key for the translated string
- * @param parameters parameters to be substituted in the placeholders
- * of the translated string.
- * @param component The component generating the message
- * (allows label tracking)
- * @return a FacesMessage object
- */
- public static FacesMessage getMessage(
- FacesContext context,
- FacesMessage.Severity severity,
- String messageId,
- Object[] parameters,
- UIComponent component
- )
- {
- return _createFacesMessage(context, severity, messageId,
- parameters, _getLabel(component));
- }
-
-
- /**
- * Creates a FacesMessage without any parameters, and
- * a severity of SEVERITY_ERROR.
- *
- * @param context faces context
- * @param messageId the bundle key for the translated string
- * @return a FacesMessage object
- */
- public static FacesMessage getMessage(
- FacesContext context,
- String messageId
- )
- {
- return getMessage(context, messageId, (Object[]) null, (UIComponent) null);
- }
-
- /**
- * Returns the localized string
- * @param context
- * @param messageId
- * @return String
- */
- public static String getString(
- FacesContext context,
- String messageId
- )
- {
- return LocaleUtils.__getSummaryString(context, messageId);
- }
-
-
- /**
- * Creates a FacesMessage without any parameters, and
- * a severity of SEVERITY_ERROR.
- *
- * @param context faces context
- * @param messageId the bundle key for the translated string
- * @param component The component generating the message
- * (allows label tracking)
- * @return a FacesMessage object
- */
- public static FacesMessage getMessage(
- FacesContext context,
- String messageId,
- UIComponent component
- )
- {
- return getMessage(context, messageId, (Object[]) null, component);
- }
-
- /**
- * Creates a FacesMessage using a single parameter.
- *
- * @param context faces context
- * @param messageId the bundle key for the translated string
- * @param parameter parameter to be substituted for "{0}"
- * @param label the label of the creating component
- * @return a FacesMessage object
- */
- public static FacesMessage getMessage(
- FacesContext context,
- String messageId,
- Object parameter,
- Object label
- )
- {
- return getMessage(context, messageId, new Object[]{parameter}, label);
- }
-
- /**
- * Creates a FacesMessage using a single parameter.
- *
- * @param context faces context
- * @param messageId the bundle key for the translated string
- * @param parameter parameter to be substituted for "{0}"
- * @return a FacesMessage object
- */
- public static FacesMessage getMessage(
- FacesContext context,
- String messageId,
- Object parameter
- )
- {
- return getMessage(context, messageId, new Object[]{parameter});
- }
-
- /**
- * <p>Gets the translation summary and detail text from the message bundle.
- * If <code>customMessagePattern</code> is set, then it is used as the
- * detail part of the faces message. The summary and detail string are
- * formatted based on the supplied <code>parameters</code>. Returns a
- * FacesMessage using the formatted summary and detail message with
- * severity set to error.</p>
- *
- * @param context faces context
- * @param messageId the bundle key for the translated string
- * @param customMessagePattern Custom error message. It can also contain
- * placeholders which will be formatted with the supplied parameters.
- * This customizes the detail part of the {@link FacesMessage}.
- * If value is null. Then picksup translation summary and detail from
- * the bundle, which is then formatted and used in construction of faces
- * message.
- * @param parameters parameters to be substituted in the placeholders
- * of the translated string.
- * @return a FacesMessage object
- */
- public static FacesMessage getMessage(
- FacesContext context,
- String messageId,
- Object customMessagePattern,
- Object[] parameters)
- {
- return getMessage(context, messageId, customMessagePattern,
- parameters, null);
- }
-
- /**
- * <p>Gets the translation summary and detail text from the message bundle.
- * If <code>customMessagePattern</code> is set, then it is used as the
- * detail part of the faces message. The summary and detail string are
- * formatted based on the supplied <code>parameters</code>. Returns a
- * FacesMessage using the formatted summary and detail message with
- * severity set to error.</p>
- *
- * @param context faces context
- * @param messageId the bundle key for the translated string
- * @param customMessagePattern Custom error message. It can also contain
- * placeholders which will be formatted with the supplied parameters.
- * This customizes the detail part of the {@link FacesMessage}.
- * If value is null. Then picksup translation summary and detail from
- * the bundle, which is then formatted and used in construction of faces
- * message.
- * @param parameters parameters to be substituted in the placeholders
- * of the translated string.
- * @param component The component generating the message
- * (allows label tracking)
- * @return a FacesMessage object
- */
- public static FacesMessage getMessage(
- FacesContext context,
- String messageId,
- Object customMessagePattern,
- Object[] parameters,
- UIComponent component)
- {
- return getMessage(context, messageId, customMessagePattern,
- parameters, _getLabel(component));
- }
-
- /**
- * <p>Gets the translation summary and detail text from the message bundle.
- * If <code>customMessagePattern</code> is set, then it is used as the
- * detail part of the faces message. The summary and detail string are
- * formatted based on the supplied <code>parameters</code>. Returns a
- * FacesMessage using the formatted summary and detail message with
- * severity set to error.</p>
- *
- * @param context faces context
- * @param messageId the bundle key for the translated string
- * @param customMessagePattern Custom error message. It can also contain
- * placeholders which will be formatted with the supplied parameters.
- * This customizes the detail part of the {@link FacesMessage}.
- * If value is null. Then picksup translation summary and detail from
- * the bundle, which is then formatted and used in construction of faces
- * message.
- * @param parameters parameters to be substituted in the placeholders
- * of the translated string.
- * @param label the label of the creating component
- * @return a FacesMessage object
- */
- public static FacesMessage getMessage(
- FacesContext context,
- String messageId,
- Object customMessagePattern,
- Object[] parameters,
- Object label)
- {
- if (null != customMessagePattern)
- {
- String summary = LocaleUtils.__getSummaryString(context, messageId);
-
- ErrorMessages msgs = _getErrorMessage(summary, customMessagePattern,
- parameters);
-
- return _createFacesMessage(FacesMessage.SEVERITY_ERROR, msgs, label);
- }
-
- return _createFacesMessage(context, FacesMessage.SEVERITY_ERROR, messageId,
- parameters, label);
- }
-
- private static FacesMessage _createFacesMessage(
- FacesContext context,
- FacesMessage.Severity severity,
- String messageId,
- Object[] parameters,
- Object label
- )
- {
- ErrorMessages errMsgs
- = LocaleUtils.__getErrorMessages(context, messageId);
-
- ErrorMessages formattedErrMsgs
- = _getBindingOrFormattedErrorMessages(errMsgs, parameters);
- return _createFacesMessage(severity, formattedErrMsgs, label);
- }
-
-// private static FacesMessage _createFacesMessage(
-// FacesMessage.Severity severity,
-// ErrorMessages messageStrings,
-// UIComponent component
-// )
-// {
-// return _createFacesMessage(severity, messageStrings, _getLabel(component));
-// }
-
- private static FacesMessage _createFacesMessage(
- FacesMessage.Severity severity,
- ErrorMessages messageStrings,
- Object label
- )
- {
- if (messageStrings instanceof BindingErrorMessages)
- {
- return new BindingFacesMessage(severity, messageStrings, label);
- }
-
- String summary = messageStrings.getMessage();
- String detail = messageStrings.getDetailMessage();
-
- return new LabeledFacesMessage(severity, summary, detail, label);
- }
-
- private static Object[] _getProcessedBindings(
- FacesContext facesContext,
- Object[] parameters)
- {
- FacesContext context = facesContext;
- Object[] resolvedParameters = new Object[parameters.length];
- for (int i = 0; i < parameters.length; i++)
- {
- Object o = parameters[i];
- if (o instanceof ValueBinding)
- {
- if (context == null)
- context = FacesContext.getCurrentInstance();
- o = ((ValueBinding) o).getValue(context);
- }
- resolvedParameters[i] = o;
- }
- return resolvedParameters;
- }
-
- private static String _getFormattedString(String pattern, Object parameters[])
- {
- if (parameters == null)
- return pattern;
-
- FastMessageFormat formatter = new FastMessageFormat(pattern);
- String fmtedMsgStr = formatter.format(parameters);
- return fmtedMsgStr;
- }
-
- private static boolean _containsBinding(Object[] parameters)
- {
- if (parameters == null)
- return false;
-
- for (int i = 0; i < parameters.length; i++)
- {
- if (parameters[i] instanceof ValueBinding)
- return true;
- }
-
- return false;
- }
-
- //A Factory
- private static ErrorMessages _getErrorMessage(
- String summary,
- Object customMessagePattern,
- Object[] parameters)
- {
- _assertIsValidCustomMessageType(customMessagePattern);
- boolean isCustomMsgValueBound = (customMessagePattern instanceof ValueBinding);
- boolean containsBinding = _containsBinding(parameters);
- if (isCustomMsgValueBound || containsBinding)
- {
- if (!(isCustomMsgValueBound))
- {
- String customMesg = (String)customMessagePattern;
- return new BindingErrorMessages(summary, customMesg, parameters);
- }
- else
- {
- ValueBinding customMessage = (ValueBinding)customMessagePattern;
- return new CustomDetailErrorMessage(summary, customMessage,
- parameters, containsBinding);
- }
- }
- else
- {
- String detailMsgPattern = (String)customMessagePattern;
- ErrorMessages errorMsg = new FormattedErrorMessages(summary,
- detailMsgPattern,
- parameters);
- return errorMsg;
- }
- }
-
- private static Object _getLabel(UIComponent component)
- {
- Object o = null;
- if (component != null)
- {
- o = component.getAttributes().get("label");
- if (o == null)
- o = component.getValueBinding("label");
- }
- return o;
- }
-
- private static void _assertIsValidCustomMessageType(Object customMessagePattern)
- {
- if (!(customMessagePattern instanceof ValueBinding ||
- customMessagePattern instanceof String))
- throw new IllegalArgumentException("custom message should be of type ValueBinding or String");
- }
-
- private static ErrorMessages _getBindingOrFormattedErrorMessages(
- ErrorMessages unFormattedErrorMessages,
- Object[] parameters)
- {
-
- if (!_containsBinding(parameters))
- return new FormattedErrorMessages(unFormattedErrorMessages.getMessage(),
- unFormattedErrorMessages.getDetailMessage(),
- parameters);
- else
- return new BindingErrorMessages(unFormattedErrorMessages.getMessage(),
- unFormattedErrorMessages.getDetailMessage(),
- parameters);
- }
-
- private static class BindingFacesMessage extends LabeledFacesMessage
- {
- public BindingFacesMessage(FacesMessage.Severity severity,
- ErrorMessages messageStrings,
- Object label)
- {
- super(severity, null, null, label);
- _messageStrings = messageStrings;
- }
-
- public String getDetail()
- {
- return _messageStrings.getDetailMessage();
- }
-
- public String getSummary()
- {
- return _messageStrings.getMessage();
- }
-
- public void setDetail()
- {
- throw new UnsupportedOperationException();
- }
-
- public void setSummary()
- {
- throw new UnsupportedOperationException();
- }
-
- private final ErrorMessages _messageStrings;
- }
-
- private static class BindingErrorMessages extends ErrorMessages
- {
- BindingErrorMessages(
- String messageFormat, String detailMessageFormat, Object[] parameters)
- {
- super(messageFormat, detailMessageFormat);
- _parameters = parameters;
- if (parameters == null)
- throw new NullPointerException();
- }
-
- public String getMessage()
- {
- String pattern = super.getMessage();
- _resolveBindings();
- return _getFormattedString(pattern, _resolvedParameters);
- }
-
- public String getDetailMessage()
- {
- String pattern = super.getDetailMessage();
- _resolveBindings();
- return _getFormattedString(pattern, _resolvedParameters);
- }
-
- private void _resolveBindings()
- {
- if (_resolvedParameters == null)
- {
- _resolvedParameters = _getProcessedBindings(null, _parameters);
- }
- }
-
- protected final Object[] getResolvedParameters()
- {
- _resolveBindings();
- return _resolvedParameters;
- }
-
- protected final Object[] getParameters()
- {
- return _parameters;
- }
-
- private Object[] _parameters;
- private Object[] _resolvedParameters;
- }
-
- // Though it may not be exactly correct to extend BindingErrorMessages
- // as parameters might not have value binding. This inheritance keeps
- // it simple.
- private static class CustomDetailErrorMessage extends BindingErrorMessages
- {
-
- CustomDetailErrorMessage(
- String messageFormat,
- ValueBinding customDetailErrorMessage,
- Object[] parameters,
- boolean hasBoundParameters
- )
- {
- super(messageFormat, null, parameters);
- _customDetailErrorMessage = customDetailErrorMessage;
- _hasBoundParameters = hasBoundParameters;
- }
-
- // Currently only detail message can be customized. So we override the
- // detail message. If summary is to be overridden we have to do the
- // same to it also.
- public String getDetailMessage()
- {
-
- FacesContext context = FacesContext.getCurrentInstance();
- String detailMsgPattern = (String)_customDetailErrorMessage.getValue(context);
-
- Object[] params = super.getParameters();
-
- if (_hasBoundParameters)
- params = getResolvedParameters();
-
- return _getFormattedString(detailMsgPattern, params);
- }
-
- private ValueBinding _customDetailErrorMessage;
- private boolean _hasBoundParameters;
- }
-
- private static class FormattedErrorMessages extends ErrorMessages
- {
- FormattedErrorMessages(String summary, String detail, Object[] parameters)
- {
- super(summary, detail);
- _parameters = parameters;
- }
-
- public String getMessage()
- {
- return _getFormattedString(super.getMessage(), _parameters);
- }
-
- public String getDetailMessage()
- {
- return _getFormattedString(super.getDetailMessage(), _parameters);
- }
-
- Object[] _parameters;
- }
-
- private static final ADFLogger _LOG = ADFLogger.createADFLogger(MessageFactory.class);
-}
+/*
+ * Copyright 2000-2006 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.myfaces.adf.util;
+
+import javax.faces.application.FacesMessage;
+import javax.faces.component.UIComponent;
+import javax.faces.context.FacesContext;
+import javax.faces.el.ValueBinding;
+import org.apache.myfaces.adf.logging.ADFLogger;
+
+/**
+ * Factory class to return {@link FacesMessage} objects.
+ * @version $Name: $ ($Revision: adfrt/faces/adf-faces-api/src/main/java/oracle/adf/view/faces/util/MessageFactory.java#0 $) $Date: 30-nov-2005.11:48:33 $
+ * @author The Oracle ADF Faces Team
+ */
+public class MessageFactory
+{
+ private MessageFactory()
+ {
+ }
+
+ /**
+ * Creates a FacesMessage for the given Throwable.
+ * The severity is {@link FacesMessage#SEVERITY_ERROR}
+ * @param error The root cause of this Exception will be used.
+ */
+ public static FacesMessage getMessage(Throwable error)
+ {
+ _LOG.fine(error);
+
+ Throwable unwrap = ComponentUtils.unwrap(error);
+ String detail = unwrap.getLocalizedMessage();
+ if (detail == null)
+ {
+ // this is unusual. It is probably an unexpected RT error
+ // in the framework. log at warning level:
+ detail = unwrap.getClass().getName();
+ _LOG.warning(error);
+ }
+ // bug 4733165:
+ FacesMessage message =
+ new FacesMessage(FacesMessage.SEVERITY_ERROR, detail, detail);
+ return message;
+ }
+
+ /**
+ * Creates a FacesMessage containing formatted text and
+ * a severity of SEVERITY_ERROR.
+ *
+ * @param context faces context
+ * @param messageId the bundle key for the translated string
+ * @param parameters parameters to be substituted in the placeholders
+ * of the translated string.
+ * @return a FacesMessage object
+ */
+ public static FacesMessage getMessage(
+ FacesContext context,
+ String messageId,
+ Object[] parameters
+ )
+ {
+ return getMessage(context, FacesMessage.SEVERITY_ERROR,
+ messageId, parameters, null);
+ }
+
+ /**
+ * Creates a FacesMessage containing formatted text and
+ * a severity of SEVERITY_ERROR.
+ *
+ * @param context faces context
+ * @param messageId the bundle key for the translated string
+ * @param parameters parameters to be substituted in the placeholders
+ * of the translated string.
+ * @param component The component generating the message
+ * (allows label tracking)
+ * @return a FacesMessage object
+ */
+ public static FacesMessage getMessage(
+ FacesContext context,
+ String messageId,
+ Object[] parameters,
+ UIComponent component
+ )
+ {
+ return _createFacesMessage(context, FacesMessage.SEVERITY_ERROR, messageId,
+ parameters, _getLabel(component));
+ }
+
+
+ /**
+ * Creates a FacesMessage containing formatted text and
+ * a severity of SEVERITY_ERROR.
+ *
+ * @param context faces context
+ * @param messageId the bundle key for the translated string
+ * @param parameters parameters to be substituted in the placeholders
+ * of the translated string.
+ * @param label The label of the component generating the message
+ * @return a FacesMessage object
+ */
+ public static FacesMessage getMessage(
+ FacesContext context,
+ String messageId,
+ Object[] parameters,
+ Object label
+ )
+ {
+ return _createFacesMessage(context, FacesMessage.SEVERITY_ERROR, messageId,
+ parameters, label);
+ }
+
+ /**
+ * Creates a FacesMessage containing formatted text.
+ *
+ * @param context faces context
+ * @param severity the message severity
+ * @param messageId the bundle key for the translated string
+ * @param parameters parameters to be substituted in the placeholders
+ * of the translated string.
+ * @return a FacesMessage object
+ */
+ public static FacesMessage getMessage(
+ FacesContext context,
+ FacesMessage.Severity severity,
+ String messageId,
+ Object[] parameters
+ )
+ {
+ return getMessage(context, severity,
+ messageId, parameters, null);
+ }
+
+ /**
+ * Creates a FacesMessage containing formatted text.
+ *
+ * @param context faces context
+ * @param severity the message severity
+ * @param messageId the bundle key for the translated string
+ * @param parameters parameters to be substituted in the placeholders
+ * of the translated string.
+ * @param component The component generating the message
+ * (allows label tracking)
+ * @return a FacesMessage object
+ */
+ public static FacesMessage getMessage(
+ FacesContext context,
+ FacesMessage.Severity severity,
+ String messageId,
+ Object[] parameters,
+ UIComponent component
+ )
+ {
+ return _createFacesMessage(context, severity, messageId,
+ parameters, _getLabel(component));
+ }
+
+
+ /**
+ * Creates a FacesMessage without any parameters, and
+ * a severity of SEVERITY_ERROR.
+ *
+ * @param context faces context
+ * @param messageId the bundle key for the translated string
+ * @return a FacesMessage object
+ */
+ public static FacesMessage getMessage(
+ FacesContext context,
+ String messageId
+ )
+ {
+ return getMessage(context, messageId, (Object[]) null, (UIComponent) null);
+ }
+
+ /**
+ * Returns the localized string
+ * @param context
+ * @param messageId
+ * @return String
+ */
+ public static String getString(
+ FacesContext context,
+ String messageId
+ )
+ {
+ return LocaleUtils.__getSummaryString(context, messageId);
+ }
+
+
+ /**
+ * Creates a FacesMessage without any parameters, and
+ * a severity of SEVERITY_ERROR.
+ *
+ * @param context faces context
+ * @param messageId the bundle key for the translated string
+ * @param component The component generating the message
+ * (allows label tracking)
+ * @return a FacesMessage object
+ */
+ public static FacesMessage getMessage(
+ FacesContext context,
+ String messageId,
+ UIComponent component
+ )
+ {
+ return getMessage(context, messageId, (Object[]) null, component);
+ }
+
+ /**
+ * Creates a FacesMessage using a single parameter.
+ *
+ * @param context faces context
+ * @param messageId the bundle key for the translated string
+ * @param parameter parameter to be substituted for "{0}"
+ * @param label the label of the creating component
+ * @return a FacesMessage object
+ */
+ public static FacesMessage getMessage(
+ FacesContext context,
+ String messageId,
+ Object parameter,
+ Object label
+ )
+ {
+ return getMessage(context, messageId, new Object[]{parameter}, label);
+ }
+
+ /**
+ * Creates a FacesMessage using a single parameter.
+ *
+ * @param context faces context
+ * @param messageId the bundle key for the translated string
+ * @param parameter parameter to be substituted for "{0}"
+ * @return a FacesMessage object
+ */
+ public static FacesMessage getMessage(
+ FacesContext context,
+ String messageId,
+ Object parameter
+ )
+ {
+ return getMessage(context, messageId, new Object[]{parameter});
+ }
+
+ /**
+ * <p>Gets the translation summary and detail text from the message bundle.
+ * If <code>customMessagePattern</code> is set, then it is used as the
+ * detail part of the faces message. The summary and detail string are
+ * formatted based on the supplied <code>parameters</code>. Returns a
+ * FacesMessage using the formatted summary and detail message with
+ * severity set to error.</p>
+ *
+ * @param context faces context
+ * @param messageId the bundle key for the translated string
+ * @param customMessagePattern Custom error message. It can also contain
+ * placeholders which will be formatted with the supplied parameters.
+ * This customizes the detail part of the {@link FacesMessage}.
+ * If value is null. Then picksup translation summary and detail from
+ * the bundle, which is then formatted and used in construction of faces
+ * message.
+ * @param parameters parameters to be substituted in the placeholders
+ * of the translated string.
+ * @return a FacesMessage object
+ */
+ public static FacesMessage getMessage(
+ FacesContext context,
+ String messageId,
+ Object customMessagePattern,
+ Object[] parameters)
+ {
+ return getMessage(context, messageId, customMessagePattern,
+ parameters, null);
+ }
+
+ /**
+ * <p>Gets the translation summary and detail text from the message bundle.
+ * If <code>customMessagePattern</code> is set, then it is used as the
+ * detail part of the faces message. The summary and detail string are
+ * formatted based on the supplied <code>parameters</code>. Returns a
+ * FacesMessage using the formatted summary and detail message with
+ * severity set to error.</p>
+ *
+ * @param context faces context
+ * @param messageId the bundle key for the translated string
+ * @param customMessagePattern Custom error message. It can also contain
+ * placeholders which will be formatted with the supplied parameters.
+ * This customizes the detail part of the {@link FacesMessage}.
+ * If value is null. Then picksup translation summary and detail from
+ * the bundle, which is then formatted and used in construction of faces
+ * message.
+ * @param parameters parameters to be substituted in the placeholders
+ * of the translated string.
+ * @param component The component generating the message
+ * (allows label tracking)
+ * @return a FacesMessage object
+ */
+ public static FacesMessage getMessage(
+ FacesContext context,
+ String messageId,
+ Object customMessagePattern,
+ Object[] parameters,
+ UIComponent component)
+ {
+ return getMessage(context, messageId, customMessagePattern,
+ parameters, _getLabel(component));
+ }
+
+ /**
+ * <p>Gets the translation summary and detail text from the message bundle.
+ * If <code>customMessagePattern</code> is set, then it is used as the
+ * detail part of the faces message. The summary and detail string are
+ * formatted based on the supplied <code>parameters</code>. Returns a
+ * FacesMessage using the formatted summary and detail message with
+ * severity set to error.</p>
+ *
+ * @param context faces context
+ * @param messageId the bundle key for the translated string
+ * @param customMessagePattern Custom error message. It can also contain
+ * placeholders which will be formatted with the supplied parameters.
+ * This customizes the detail part of the {@link FacesMessage}.
+ * If value is null. Then picksup translation summary and detail from
+ * the bundle, which is then formatted and used in construction of faces
+ * message.
+ * @param parameters parameters to be substituted in the placeholders
+ * of the translated string.
+ * @param label the label of the creating component
+ * @return a FacesMessage object
+ */
+ public static FacesMessage getMessage(
+ FacesContext context,
+ String messageId,
+ Object customMessagePattern,
+ Object[] parameters,
+ Object label)
+ {
+ if (null != customMessagePattern)
+ {
+ String summary = LocaleUtils.__getSummaryString(context, messageId);
+
+ ErrorMessages msgs = _getErrorMessage(summary, customMessagePattern,
+ parameters);
+
+ return _createFacesMessage(FacesMessage.SEVERITY_ERROR, msgs, label);
+ }
+
+ return _createFacesMessage(context, FacesMessage.SEVERITY_ERROR, messageId,
+ parameters, label);
+ }
+
+ private static FacesMessage _createFacesMessage(
+ FacesContext context,
+ FacesMessage.Severity severity,
+ String messageId,
+ Object[] parameters,
+ Object label
+ )
+ {
+ ErrorMessages errMsgs
+ = LocaleUtils.__getErrorMessages(context, messageId);
+
+ ErrorMessages formattedErrMsgs
+ = _getBindingOrFormattedErrorMessages(errMsgs, parameters);
+ return _createFacesMessage(severity, formattedErrMsgs, label);
+ }
+
+// private static FacesMessage _createFacesMessage(
+// FacesMessage.Severity severity,
+// ErrorMessages messageStrings,
+// UIComponent component
+// )
+// {
+// return _createFacesMessage(severity, messageStrings, _getLabel(component));
+// }
+
+ private static FacesMessage _createFacesMessage(
+ FacesMessage.Severity severity,
+ ErrorMessages messageStrings,
+ Object label
+ )
+ {
+ if (messageStrings instanceof BindingErrorMessages)
+ {
+ return new BindingFacesMessage(severity, messageStrings, label);
+ }
+
+ String summary = messageStrings.getMessage();
+ String detail = messageStrings.getDetailMessage();
+
+ return new LabeledFacesMessage(severity, summary, detail, label);
+ }
+
+ private static Object[] _getProcessedBindings(
+ FacesContext facesContext,
+ Object[] parameters)
+ {
+ FacesContext context = facesContext;
+ Object[] resolvedParameters = new Object[parameters.length];
+ for (int i = 0; i < parameters.length; i++)
+ {
+ Object o = parameters[i];
+ if (o instanceof ValueBinding)
+ {
+ if (context == null)
+ context = FacesContext.getCurrentInstance();
+ o = ((ValueBinding) o).getValue(context);
+ }
+
+ resolvedParameters[i] = o;
+ }
+ return resolvedParameters;
+ }
+
+ private static String _getFormattedString(String pattern, Object parameters[])
+ {
+ if (parameters == null)
+ return pattern;
+
+ FastMessageFormat formatter = new FastMessageFormat(pattern);
+ String fmtedMsgStr = formatter.format(parameters);
+ return fmtedMsgStr;
+ }
+
+ private static boolean _containsBinding(Object[] parameters)
+ {
+ if (parameters == null)
+ return false;
+
+ for (int i = 0; i < parameters.length; i++)
+ {
+ if (parameters[i] instanceof ValueBinding)
+ return true;
+ }
+
+ return false;
+ }
+
+ //A Factory
+ private static ErrorMessages _getErrorMessage(
+ String summary,
+ Object customMessagePattern,
+ Object[] parameters)
+ {
+ _assertIsValidCustomMessageType(customMessagePattern);
+ boolean isCustomMsgValueBound = (customMessagePattern instanceof ValueBinding);
+ boolean containsBinding = _containsBinding(parameters);
+ if (isCustomMsgValueBound || containsBinding)
+ {
+ if (!(isCustomMsgValueBound))
+ {
+ String customMesg = (String)customMessagePattern;
+ return new BindingErrorMessages(summary, customMesg, parameters);
+ }
+ else
+ {
+ ValueBinding customMessage = (ValueBinding)customMessagePattern;
+ return new CustomDetailErrorMessage(summary, customMessage,
+ parameters, containsBinding);
+ }
+ }
+ else
+ {
+ String detailMsgPattern = (String)customMessagePattern;
+ ErrorMessages errorMsg = new FormattedErrorMessages(summary,
+ detailMsgPattern,
+ parameters);
+ return errorMsg;
+ }
+ }
+
+ private static Object _getLabel(UIComponent component)
+ {
+ Object o = null;
+ if (component != null)
+ {
+ o = component.getAttributes().get("label");
+ if (o == null)
+ o = component.getValueBinding("label");
+ }
+ return o;
+ }
+
+ private static void _assertIsValidCustomMessageType(Object customMessagePattern)
+ {
+ if (!(customMessagePattern instanceof ValueBinding ||
+ customMessagePattern instanceof String))
+ throw new IllegalArgumentException("custom message should be of type ValueBinding or String");
+ }
+
+ private static ErrorMessages _getBindingOrFormattedErrorMessages(
+ ErrorMessages unFormattedErrorMessages,
+ Object[] parameters)
+ {
+
+ if (!_containsBinding(parameters))
+ return new FormattedErrorMessages(unFormattedErrorMessages.getMessage(),
+ unFormattedErrorMessages.getDetailMessage(),
+ parameters);
+ else
+ return new BindingErrorMessages(unFormattedErrorMessages.getMessage(),
+ unFormattedErrorMessages.getDetailMessage(),
+ parameters);
+ }
+
+ private static class BindingFacesMessage extends LabeledFacesMessage
+ {
+ public BindingFacesMessage(FacesMessage.Severity severity,
+ ErrorMessages messageStrings,
+ Object label)
+ {
+ super(severity, null, null, label);
+ _messageStrings = messageStrings;
+ }
+
+ public String getDetail()
+ {
+ return _messageStrings.getDetailMessage();
+ }
+
+ public String getSummary()
+ {
+ return _messageStrings.getMessage();
+ }
+
+ public void setDetail()
+ {
+ throw new UnsupportedOperationException();
+ }
+
+ public void setSummary()
+ {
+ throw new UnsupportedOperationException();
+ }
+
+ private final ErrorMessages _messageStrings;
+ }
+
+ private static class BindingErrorMessages extends ErrorMessages
+ {
+ BindingErrorMessages(
+ String messageFormat, String detailMessageFormat, Object[] parameters)
+ {
+ super(messageFormat, detailMessageFormat);
+ _parameters = parameters;
+ if (parameters == null)
+ throw new NullPointerException();
+ }
+
+ public String getMessage()
+ {
+ String pattern = super.getMessage();
+ _resolveBindings();
+ return _getFormattedString(pattern, _resolvedParameters);
+ }
+
+ public String getDetailMessage()
+ {
+ String pattern = super.getDetailMessage();
+ _resolveBindings();
+ return _getFormattedString(pattern, _resolvedParameters);
+ }
+
+ private void _resolveBindings()
+ {
+ if (_resolvedParameters == null)
+ {
+ _resolvedParameters = _getProcessedBindings(null, _parameters);
+ }
+ }
+
+ protected final Object[] getResolvedParameters()
+ {
+ _resolveBindings();
+ return _resolvedParameters;
+ }
+
+ protected final Object[] getParameters()
+ {
+ return _parameters;
+ }
+
+ private Object[] _parameters;
+ private Object[] _resolvedParameters;
+ }
+
+ // Though it may not be exactly correct to extend BindingErrorMessages
+ // as parameters might not have value binding. This inheritance keeps
+ // it simple.
+ private static class CustomDetailErrorMessage extends BindingErrorMessages
+ {
+
+ CustomDetailErrorMessage(
+ String messageFormat,
+ ValueBinding customDetailErrorMessage,
+ Object[] parameters,
+ boolean hasBoundParameters
+ )
+ {
+ super(messageFormat, null, parameters);
+ _customDetailErrorMessage = customDetailErrorMessage;
+ _hasBoundParameters = hasBoundParameters;
+ }
+
+ // Currently only detail message can be customized. So we override the
+ // detail message. If summary is to be overridden we have to do the
+ // same to it also.
+ public String getDetailMessage()
+ {
+ FacesContext context = FacesContext.getCurrentInstance();
+ String detailMsgPattern = (String)_customDetailErrorMessage.getValue(context);
+ if(detailMsgPattern == null)
+ {
+ // Set a default message that might get used by FacesException
+ // constructor for example. This will often happen because
+ // ValidatorException constructor will call this method to
+ // get the exception message for its parent. So by default
+ // we'll use the EL String.
+ // Note that by default
+ detailMsgPattern = _customDetailErrorMessage.getExpressionString();
+
+ // Since that string will get parsed by FastMessageFormat, the { }
+ // of the EL must be escaped
+ detailMsgPattern = '\'' + detailMsgPattern + '\'';
+ }
+
+ Object[] params = super.getParameters();
+
+ if (_hasBoundParameters)
+ params = getResolvedParameters();
+
+ return _getFormattedString(detailMsgPattern, params);
+ }
+
+ private ValueBinding _customDetailErrorMessage;
+ private boolean _hasBoundParameters;
+ }
+
+ private static class FormattedErrorMessages extends ErrorMessages
+ {
+ FormattedErrorMessages(String summary, String detail, Object[] parameters)
+ {
+ super(summary, detail);
+ _parameters = parameters;
+ }
+
+ public String getMessage()
+ {
+ return _getFormattedString(super.getMessage(), _parameters);
+ }
+
+ public String getDetailMessage()
+ {
+ return _getFormattedString(super.getDetailMessage(), _parameters);
+ }
+
+ Object[] _parameters;
+ }
+
+ private static final ADFLogger _LOG = ADFLogger.createADFLogger(MessageFactory.class);
+}
Modified: incubator/adffaces/trunk/adf-faces/adf-faces-api/src/main/java/org/apache/myfaces/adf/validator/ByteLengthValidator.java
URL: http://svn.apache.org/viewvc/incubator/adffaces/trunk/adf-faces/adf-faces-api/src/main/java/org/apache/myfaces/adf/validator/ByteLengthValidator.java?rev=423531&r1=423530&r2=423531&view=diff
==============================================================================
--- incubator/adffaces/trunk/adf-faces/adf-faces-api/src/main/java/org/apache/myfaces/adf/validator/ByteLengthValidator.java (original)
+++ incubator/adffaces/trunk/adf-faces/adf-faces-api/src/main/java/org/apache/myfaces/adf/validator/ByteLengthValidator.java Wed Jul 19 10:14:46 2006
@@ -340,7 +340,7 @@
{
Object label = ValidatorUtils.getComponentLabel(component);
- String maxMesgDetail = getMaximumMessageDetail();
+ Object maxMesgDetail = _getRawMaximumMessageDetail();
String maximumBytes = String.valueOf(getMaximum());
Object[] params = { label, value, maximumBytes};
@@ -351,6 +351,11 @@
params,
component);
return msg;
+ }
+
+ private Object _getRawMaximumMessageDetail()
+ {
+ return _facesBean.getRawProperty(_MAXIMUM_MESSAGE_DETAIL_KEY);
}
private static final FacesBean.Type _TYPE = new FacesBean.Type();
Modified: incubator/adffaces/trunk/adf-faces/adf-faces-api/src/main/java/org/apache/myfaces/adf/validator/DateTimeRangeValidator.java
URL: http://svn.apache.org/viewvc/incubator/adffaces/trunk/adf-faces/adf-faces-api/src/main/java/org/apache/myfaces/adf/validator/DateTimeRangeValidator.java?rev=423531&r1=423530&r2=423531&view=diff
==============================================================================
--- incubator/adffaces/trunk/adf-faces/adf-faces-api/src/main/java/org/apache/myfaces/adf/validator/DateTimeRangeValidator.java (original)
+++ incubator/adffaces/trunk/adf-faces/adf-faces-api/src/main/java/org/apache/myfaces/adf/validator/DateTimeRangeValidator.java Wed Jul 19 10:14:46 2006
@@ -448,7 +448,7 @@
Object cMin = _getConvertedValue(context, component, converter, min);
Object cMax = _getConvertedValue(context, component, converter, max);
- Object msg = getNotInRangeMessageDetail();
+ Object msg = _getRawNotInRangeMessageDetail();
Object label = ValidatorUtils.getComponentLabel(component);
Object[] params = {label, cValue, cMin, cMax};
@@ -458,6 +458,13 @@
}
+
+ private Object _getRawNotInRangeMessageDetail()
+ {
+ return _facesBean.getRawProperty(_NOT_IN_RANGE_MESSAGE_DETAIL_KEY);
+ }
+
+
private FacesMessage _getMaximumMessage(
FacesContext context,
UIComponent component,
@@ -469,7 +476,7 @@
Object cValue = _getConvertedValue(context, component, converter, value);
Object cMax = _getConvertedValue(context, component, converter, max);
- Object msg = getMaximumMessageDetail();
+ Object msg = _getRawMaximumMessageDetail();
Object label = ValidatorUtils.getComponentLabel(component);
Object[] params = {label, cValue, cMax};
@@ -481,6 +488,11 @@
component);
}
+ private Object _getRawMaximumMessageDetail()
+ {
+ return _facesBean.getRawProperty(_MAXIMUM_MESSAGE_DETAIL_KEY);
+ }
+
private FacesMessage _getMinimumMessage(
FacesContext context,
UIComponent component,
@@ -493,13 +505,18 @@
Object cMin = _getConvertedValue(context, component, converter, min);
- Object msg = getMinimumMessageDetail();
+ Object msg = _getRawMinimumMessageDetail();
Object label = ValidatorUtils.getComponentLabel(component);
Object[] params = {label, cValue, cMin};
return MessageFactory.getMessage(context, MINIMUM_MESSAGE_ID,
msg, params, component);
+ }
+
+ private Object _getRawMinimumMessageDetail()
+ {
+ return _facesBean.getRawProperty(_MINIMUM_MESSAGE_DETAIL_KEY);
}
private Converter _getConverter(
Modified: incubator/adffaces/trunk/adf-faces/adf-faces-api/src/main/java/org/apache/myfaces/adf/validator/RegExpValidator.java
URL: http://svn.apache.org/viewvc/incubator/adffaces/trunk/adf-faces/adf-faces-api/src/main/java/org/apache/myfaces/adf/validator/RegExpValidator.java?rev=423531&r1=423530&r2=423531&view=diff
==============================================================================
--- incubator/adffaces/trunk/adf-faces/adf-faces-api/src/main/java/org/apache/myfaces/adf/validator/RegExpValidator.java (original)
+++ incubator/adffaces/trunk/adf-faces/adf-faces-api/src/main/java/org/apache/myfaces/adf/validator/RegExpValidator.java Wed Jul 19 10:14:46 2006
@@ -217,8 +217,8 @@
if ( this.isTransient() == other.isTransient() &&
ValidatorUtils.equals(getPattern(), other.getPattern()) &&
- ValidatorUtils.equals(getNoMatchMessageDetatil(),
- other.getNoMatchMessageDetatil())
+ ValidatorUtils.equals(getNoMatchMessageDetail(),
+ other.getNoMatchMessageDetail())
)
{
return true;
@@ -235,7 +235,7 @@
{
int result = 17;
String pattern = getPattern();
- String noMesgDetail = getNoMatchMessageDetatil();
+ String noMesgDetail = getNoMatchMessageDetail();
result = 37 * result + (pattern == null? 0 : pattern.hashCode());
result = 37 * result + (isTransient() ? 0 : 1);
result = 37 * result + (noMesgDetail == null ? 0 : noMesgDetail.hashCode());
@@ -286,7 +286,7 @@
* @return Custom error message
* @see #setNoMatchMessageDetail(String)
*/
- public String getNoMatchMessageDetatil()
+ public String getNoMatchMessageDetail()
{
Object obj = _facesBean.getProperty(_NO_MATCH_MESSAGE_DETAIL_KEY);
return ComponentUtils.resolveString(obj);
@@ -301,15 +301,21 @@
UIComponent component,
String value)
{
- String noMatchMesgDet = getNoMatchMessageDetatil();
+ Object noMatchMsgDet = _getRawNoMatchMessageDetail();
Object label = ValidatorUtils.getComponentLabel(component);
Object[] params = {label, value, getPattern()};
FacesMessage msg =
MessageFactory.getMessage(context, NO_MATCH_MESSAGE_ID,
- noMatchMesgDet, params, label);
+ noMatchMsgDet, params, label);
return msg;
}
+
+ private Object _getRawNoMatchMessageDetail()
+ {
+ return _facesBean.getRawProperty(_NO_MATCH_MESSAGE_DETAIL_KEY);
+ }
+
private static final FacesBean.Type _TYPE = new FacesBean.Type();
Modified: incubator/adffaces/trunk/adf-faces/adf-faces-impl/src/main/java/org/apache/myfaces/adfinternal/renderkit/htmlBasic/ComponentFacesBean.java
URL: http://svn.apache.org/viewvc/incubator/adffaces/trunk/adf-faces/adf-faces-impl/src/main/java/org/apache/myfaces/adfinternal/renderkit/htmlBasic/ComponentFacesBean.java?rev=423531&r1=423530&r2=423531&view=diff
==============================================================================
--- incubator/adffaces/trunk/adf-faces/adf-faces-impl/src/main/java/org/apache/myfaces/adfinternal/renderkit/htmlBasic/ComponentFacesBean.java (original)
+++ incubator/adffaces/trunk/adf-faces/adf-faces-impl/src/main/java/org/apache/myfaces/adfinternal/renderkit/htmlBasic/ComponentFacesBean.java Wed Jul 19 10:14:46 2006
@@ -71,6 +71,11 @@
return _component.getValueBinding(key.getName());
}
+ final public Object getRawProperty(PropertyKey key)
+ {
+ throw new UnsupportedOperationException();
+ }
+
final public void setValueBinding(PropertyKey key, ValueBinding binding)
{
throw new UnsupportedOperationException();
Modified: incubator/adffaces/trunk/adf-faces/adf-faces-impl/src/main/java/org/apache/myfaces/adfinternal/validator/RegExpValidator.java
URL: http://svn.apache.org/viewvc/incubator/adffaces/trunk/adf-faces/adf-faces-impl/src/main/java/org/apache/myfaces/adfinternal/validator/RegExpValidator.java?rev=423531&r1=423530&r2=423531&view=diff
==============================================================================
--- incubator/adffaces/trunk/adf-faces/adf-faces-impl/src/main/java/org/apache/myfaces/adfinternal/validator/RegExpValidator.java (original)
+++ incubator/adffaces/trunk/adf-faces/adf-faces-impl/src/main/java/org/apache/myfaces/adfinternal/validator/RegExpValidator.java Wed Jul 19 10:14:46 2006
@@ -135,7 +135,7 @@
private String _getNoMatchMessageDetail(
FacesContext context)
{
- String noMatchMsg = getNoMatchMessageDetatil();
+ String noMatchMsg = getNoMatchMessageDetail();
String label = "{0}"; // this will get substituted on the client
Object[] params = new Object[] {label, "{1}", "{2}"};