You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@myfaces.apache.org by lu...@apache.org on 2011/08/29 21:41:11 UTC
svn commit: r1162956 - in
/myfaces/commons/branches/jsf_20/myfaces-commons-utils/src/main/java/org/apache/myfaces/commons/util:
./ renderkit/
Author: lu4242
Date: Mon Aug 29 19:41:11 2011
New Revision: 1162956
URL: http://svn.apache.org/viewvc?rev=1162956&view=rev
Log:
MFCOMMONS-35 Move some utility methods from shared to commons
Added:
myfaces/commons/branches/jsf_20/myfaces-commons-utils/src/main/java/org/apache/myfaces/commons/util/ComponentUtils.java
myfaces/commons/branches/jsf_20/myfaces-commons-utils/src/main/java/org/apache/myfaces/commons/util/DebugUtils.java
myfaces/commons/branches/jsf_20/myfaces-commons-utils/src/main/java/org/apache/myfaces/commons/util/SelectItemsIterator.java
myfaces/commons/branches/jsf_20/myfaces-commons-utils/src/main/java/org/apache/myfaces/commons/util/_EmptyIterator.java
myfaces/commons/branches/jsf_20/myfaces-commons-utils/src/main/java/org/apache/myfaces/commons/util/renderkit/ClientBehaviorEvents.java
myfaces/commons/branches/jsf_20/myfaces-commons-utils/src/main/java/org/apache/myfaces/commons/util/renderkit/JsfProperties.java
Added: myfaces/commons/branches/jsf_20/myfaces-commons-utils/src/main/java/org/apache/myfaces/commons/util/ComponentUtils.java
URL: http://svn.apache.org/viewvc/myfaces/commons/branches/jsf_20/myfaces-commons-utils/src/main/java/org/apache/myfaces/commons/util/ComponentUtils.java?rev=1162956&view=auto
==============================================================================
--- myfaces/commons/branches/jsf_20/myfaces-commons-utils/src/main/java/org/apache/myfaces/commons/util/ComponentUtils.java (added)
+++ myfaces/commons/branches/jsf_20/myfaces-commons-utils/src/main/java/org/apache/myfaces/commons/util/ComponentUtils.java Mon Aug 29 19:41:11 2011
@@ -0,0 +1,77 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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.commons.util;
+
+import javax.faces.component.NamingContainer;
+import javax.faces.component.UIComponent;
+
+/**
+ *
+ * @since 1.0.2
+ */
+public class ComponentUtils
+{
+
+ /**
+ * Return the parent NamingContainer of the component passed as argument.
+ *
+ * @param component
+ * @return
+ */
+ public static UIComponent findParentNamingContainer(UIComponent component)
+ {
+ return findParentNamingContainer(component, true);
+ }
+
+ /**
+ * Return the parent NamingContainer of the component passed as argument.
+ *
+ * @param component
+ * @param returnRootIfNotFound
+ * @return
+ */
+ public static UIComponent findParentNamingContainer(UIComponent component, boolean returnRootIfNotFound)
+ {
+ UIComponent parent = component.getParent();
+ if (returnRootIfNotFound && parent == null)
+ {
+ return component;
+ }
+ while (parent != null)
+ {
+ if (parent instanceof NamingContainer)
+ return parent;
+ if (returnRootIfNotFound)
+ {
+ UIComponent nextParent = parent.getParent();
+ if (nextParent == null)
+ {
+ return parent; // Root
+ }
+ parent = nextParent;
+ }
+ else
+ {
+ parent = parent.getParent();
+ }
+ }
+ return null;
+ }
+}
Added: myfaces/commons/branches/jsf_20/myfaces-commons-utils/src/main/java/org/apache/myfaces/commons/util/DebugUtils.java
URL: http://svn.apache.org/viewvc/myfaces/commons/branches/jsf_20/myfaces-commons-utils/src/main/java/org/apache/myfaces/commons/util/DebugUtils.java?rev=1162956&view=auto
==============================================================================
--- myfaces/commons/branches/jsf_20/myfaces-commons-utils/src/main/java/org/apache/myfaces/commons/util/DebugUtils.java (added)
+++ myfaces/commons/branches/jsf_20/myfaces-commons-utils/src/main/java/org/apache/myfaces/commons/util/DebugUtils.java Mon Aug 29 19:41:11 2011
@@ -0,0 +1,83 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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.commons.util;
+
+import javax.faces.component.UIComponent;
+import javax.faces.component.UIViewRoot;
+
+/**
+ *
+ * @author Leonardo Uribe
+ * @since 1.0.2
+ *
+ */
+public class DebugUtils
+{
+ /**
+ * Provide debug information about the path of a component
+ *
+ * @param component
+ * @return
+ */
+ public static String getPathToComponent(UIComponent component)
+ {
+ StringBuffer buf = new StringBuffer();
+
+ if(component == null)
+ {
+ buf.append("{Component-Path : ");
+ buf.append("[null]}");
+ return buf.toString();
+ }
+
+ getPathToComponent(component,buf);
+
+ buf.insert(0,"{Component-Path : ");
+ buf.append("}");
+
+ return buf.toString();
+ }
+
+ private static void getPathToComponent(UIComponent component, StringBuffer buf)
+ {
+ if(component == null)
+ return;
+
+ StringBuffer intBuf = new StringBuffer();
+
+ intBuf.append("[Class: ");
+ intBuf.append(component.getClass().getName());
+ if(component instanceof UIViewRoot)
+ {
+ intBuf.append(",ViewId: ");
+ intBuf.append(((UIViewRoot) component).getViewId());
+ }
+ else
+ {
+ intBuf.append(",Id: ");
+ intBuf.append(component.getId());
+ }
+ intBuf.append("]");
+
+ buf.insert(0,intBuf.toString());
+
+ getPathToComponent(component.getParent(), buf);
+ }
+
+}
Added: myfaces/commons/branches/jsf_20/myfaces-commons-utils/src/main/java/org/apache/myfaces/commons/util/SelectItemsIterator.java
URL: http://svn.apache.org/viewvc/myfaces/commons/branches/jsf_20/myfaces-commons-utils/src/main/java/org/apache/myfaces/commons/util/SelectItemsIterator.java?rev=1162956&view=auto
==============================================================================
--- myfaces/commons/branches/jsf_20/myfaces-commons-utils/src/main/java/org/apache/myfaces/commons/util/SelectItemsIterator.java (added)
+++ myfaces/commons/branches/jsf_20/myfaces-commons-utils/src/main/java/org/apache/myfaces/commons/util/SelectItemsIterator.java Mon Aug 29 19:41:11 2011
@@ -0,0 +1,325 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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.commons.util;
+
+import java.lang.reflect.Array;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Iterator;
+import java.util.Map;
+import java.util.NoSuchElementException;
+import java.util.logging.Level;
+import java.util.logging.Logger;
+
+import javax.el.ValueExpression;
+import javax.faces.application.ProjectStage;
+import javax.faces.component.UIComponent;
+import javax.faces.component.UISelectItem;
+import javax.faces.component.UISelectItems;
+import javax.faces.context.FacesContext;
+import javax.faces.model.SelectItem;
+
+import org.apache.myfaces.commons.util.renderkit.JsfProperties;
+
+// ATTENTION
+// This class is associated with javax.faces.component._SelectItemsIterator.
+// Changes here should also be applied to this class.
+
+/**
+ * @author Mathias Broekelmann (latest modification by $Author$)
+ * @author Jakob Korherr (jsf 2.0)
+ * @version $Revision$ $Date$
+ */
+public class SelectItemsIterator implements Iterator<SelectItem>
+{
+ private static final Logger log = Logger.getLogger(SelectItemsIterator.class.getName());
+
+ private static final String VAR_PROP = JsfProperties.VAR_PROP;
+ private static final String ITEM_VALUE_PROP = JsfProperties.ITEM_VALUE_PROP;
+ private static final String ITEM_LABEL_PROP = JsfProperties.ITEM_LABEL_PROP;
+ private static final String ITEM_DESCRIPTION_PROP = JsfProperties.ITEM_DESCRIPTION_PROP;
+ private static final String ITEM_DISABLED_PROP = JsfProperties.ITEM_DISABLED_PROP;
+ private static final String ITEM_LABEL_ESCAPED_PROP = JsfProperties.ITEM_LABEL_ESCAPED_PROP;
+ private static final String NO_SELECTION_VALUE_PROP = JsfProperties.NO_SELECTION_VALUE_PROP;
+
+ private static final Iterator<UIComponent> _EMPTY_UICOMPONENT_ITERATOR = new _EmptyIterator<UIComponent>();
+
+ private final Iterator<UIComponent> _children;
+ private Iterator<? extends Object> _nestedItems;
+ private SelectItem _nextItem;
+ private UISelectItems _currentUISelectItems;
+ private FacesContext _facesContext;
+
+ public SelectItemsIterator(UIComponent selectItemsParent, FacesContext facesContext)
+ {
+ _children = selectItemsParent.getChildCount() > 0 ? selectItemsParent.getChildren().iterator() : _EMPTY_UICOMPONENT_ITERATOR;
+ _facesContext = facesContext;
+ }
+
+ @SuppressWarnings("unchecked")
+ public boolean hasNext()
+ {
+ if (_nextItem != null)
+ {
+ return true;
+ }
+ if (_nestedItems != null)
+ {
+ if (_nestedItems.hasNext())
+ {
+ return true;
+ }
+ _nestedItems = null;
+ }
+ if (_children.hasNext())
+ {
+ UIComponent child = _children.next();
+ // When there is other components nested that does
+ // not extends from UISelectItem or UISelectItems
+ // the behavior for this iterator is just skip this
+ // element(s) until an element that extends from these
+ // classes are found. If there is no more elements
+ // that conform this condition, just return false.
+ while (!(child instanceof UISelectItem) && !(child instanceof UISelectItems))
+ {
+ // Try to skip it
+ if (_children.hasNext())
+ {
+ // Skip and do the same check
+ child = _children.next();
+ }
+ else
+ {
+ // End loop, so the final result is return false,
+ // since there are no more components to iterate.
+ return false;
+ }
+ }
+ if (child instanceof UISelectItem)
+ {
+ UISelectItem uiSelectItem = (UISelectItem) child;
+ Object item = uiSelectItem.getValue();
+ if (item == null)
+ {
+ // no value attribute --> create the SelectItem out of the other attributes
+ Object itemValue = uiSelectItem.getItemValue();
+ String label = uiSelectItem.getItemLabel();
+ String description = uiSelectItem.getItemDescription();
+ boolean disabled = uiSelectItem.isItemDisabled();
+ boolean escape = uiSelectItem.isItemEscaped();
+ boolean noSelectionOption = uiSelectItem.isNoSelectionOption();
+ if (label == null)
+ {
+ label = itemValue.toString();
+ }
+ item = new SelectItem(itemValue, label, description, disabled, escape, noSelectionOption);
+ }
+ else if (!(item instanceof SelectItem))
+ {
+ ValueExpression expression = uiSelectItem.getValueExpression("value");
+ throw new IllegalArgumentException("ValueExpression '"
+ + (expression == null ? null : expression.getExpressionString()) + "' of UISelectItem : "
+ + DebugUtils.getPathToComponent(child) + " does not reference an Object of type SelectItem");
+ }
+ _nextItem = (SelectItem) item;
+ return true;
+ }
+ else if (child instanceof UISelectItems)
+ {
+ _currentUISelectItems = ((UISelectItems) child);
+ Object value = _currentUISelectItems.getValue();
+
+ if (value instanceof SelectItem)
+ {
+ _nextItem = (SelectItem) value;
+ return true;
+ }
+ else if (value != null && value.getClass().isArray())
+ {
+ // value is any kind of array (primitive or non-primitive)
+ // --> we have to use class Array to get the values
+ final int length = Array.getLength(value);
+ Collection<Object> items = new ArrayList<Object>(length);
+ for (int i = 0; i < length; i++)
+ {
+ items.add(Array.get(value, i));
+ }
+ _nestedItems = items.iterator();
+ return hasNext();
+ }
+ else if (value instanceof Iterable)
+ {
+ // value is Iterable --> Collection, DataModel,...
+ _nestedItems = ((Iterable<?>) value).iterator();
+ return hasNext();
+ }
+ else if (value instanceof Map)
+ {
+ Map<Object, Object> map = ((Map<Object, Object>) value);
+ Collection<SelectItem> items = new ArrayList<SelectItem>(map.size());
+ for (Map.Entry<Object, Object> entry : map.entrySet())
+ {
+ items.add(new SelectItem(entry.getValue(), entry.getKey().toString()));
+ }
+
+ _nestedItems = items.iterator();
+ return hasNext();
+ }
+ else
+ {
+ Level level = Level.FINE;
+ if (!_facesContext.isProjectStage(ProjectStage.Production))
+ {
+ level = Level.WARNING;
+ }
+
+ if (log.isLoggable(level))
+ {
+ ValueExpression expression = _currentUISelectItems.getValueExpression("value");
+ log.log(level, "ValueExpression {0} of UISelectItems with component-path {1}"
+ + " does not reference an Object of type SelectItem,"
+ + " array, Iterable or Map, but of type: {2}",
+ new Object[] {
+ (expression == null ? null : expression.getExpressionString()),
+ DebugUtils.getPathToComponent(child),
+ (value == null ? null : value.getClass().getName())
+ });
+ }
+ }
+ }
+ }
+ return false;
+ }
+
+ public SelectItem next()
+ {
+ if (!hasNext())
+ {
+ throw new NoSuchElementException();
+ }
+ if (_nextItem != null)
+ {
+ SelectItem value = _nextItem;
+ _nextItem = null;
+ return value;
+ }
+ if (_nestedItems != null)
+ {
+ Object item = _nestedItems.next();
+
+ if (!(item instanceof SelectItem))
+ {
+ // check new params of SelectItems (since 2.0): itemValue, itemLabel, itemDescription,...
+ // Note that according to the spec UISelectItems does not provide Getter and Setter
+ // methods for this values, so we have to use the attribute map
+ Map<String, Object> attributeMap = _currentUISelectItems.getAttributes();
+
+ // write the current item into the request map under the key listed in var, if available
+ boolean wroteRequestMapVarValue = false;
+ Object oldRequestMapVarValue = null;
+ final String var = (String) attributeMap.get(VAR_PROP);
+ if(var != null && !"".equals(var))
+ {
+ // save the current value of the key listed in var from the request map
+ oldRequestMapVarValue = _facesContext.getExternalContext().getRequestMap().put(var, item);
+ wroteRequestMapVarValue = true;
+ }
+
+ // check the itemValue attribute
+ Object itemValue = attributeMap.get(ITEM_VALUE_PROP);
+ if (itemValue == null)
+ {
+ // the itemValue attribute was not provided
+ // --> use the current item as the itemValue
+ itemValue = item;
+ }
+
+ // Spec: When iterating over the select items, toString()
+ // must be called on the string rendered attribute values
+ Object itemLabel = attributeMap.get(ITEM_LABEL_PROP);
+ if (itemLabel == null)
+ {
+ itemLabel = itemValue.toString();
+ }
+ else
+ {
+ itemLabel = itemLabel.toString();
+ }
+ Object itemDescription = attributeMap.get(ITEM_DESCRIPTION_PROP);
+ if (itemDescription != null)
+ {
+ itemDescription = itemDescription.toString();
+ }
+ Boolean itemDisabled = getBooleanAttribute(_currentUISelectItems, ITEM_DISABLED_PROP, false);
+ Boolean itemLabelEscaped = getBooleanAttribute(_currentUISelectItems, ITEM_LABEL_ESCAPED_PROP, true);
+ Object noSelectionValue = attributeMap.get(NO_SELECTION_VALUE_PROP);
+ item = new SelectItem(itemValue,
+ (String) itemLabel,
+ (String) itemDescription,
+ itemDisabled,
+ itemLabelEscaped,
+ itemValue.equals(noSelectionValue));
+
+ // remove the value with the key from var from the request map, if previously written
+ if(wroteRequestMapVarValue)
+ {
+ // If there was a previous value stored with the key from var in the request map, restore it
+ if (oldRequestMapVarValue != null)
+ {
+ _facesContext.getExternalContext()
+ .getRequestMap().put(var, oldRequestMapVarValue);
+ }
+ else
+ {
+ _facesContext.getExternalContext()
+ .getRequestMap().remove(var);
+ }
+ }
+ }
+ return (SelectItem) item;
+ }
+ throw new NoSuchElementException();
+ }
+
+ public void remove()
+ {
+ throw new UnsupportedOperationException();
+ }
+
+ private boolean getBooleanAttribute(UIComponent component, String attrName, boolean defaultValue)
+ {
+ Object value = component.getAttributes().get(attrName);
+ if (value == null)
+ {
+ return defaultValue;
+ }
+ else if (value instanceof Boolean)
+ {
+ return (Boolean) value;
+ }
+ else
+ {
+ // If the value is a String, parse the boolean.
+ // This makes the following code work: <tag attribute="true" />,
+ // otherwise you would have to write <tag attribute="#{true}" />.
+ return Boolean.valueOf(value.toString());
+ }
+ }
+
+}
Added: myfaces/commons/branches/jsf_20/myfaces-commons-utils/src/main/java/org/apache/myfaces/commons/util/_EmptyIterator.java
URL: http://svn.apache.org/viewvc/myfaces/commons/branches/jsf_20/myfaces-commons-utils/src/main/java/org/apache/myfaces/commons/util/_EmptyIterator.java?rev=1162956&view=auto
==============================================================================
--- myfaces/commons/branches/jsf_20/myfaces-commons-utils/src/main/java/org/apache/myfaces/commons/util/_EmptyIterator.java (added)
+++ myfaces/commons/branches/jsf_20/myfaces-commons-utils/src/main/java/org/apache/myfaces/commons/util/_EmptyIterator.java Mon Aug 29 19:41:11 2011
@@ -0,0 +1,41 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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.commons.util;
+
+import java.util.Iterator;
+import java.util.NoSuchElementException;
+
+class _EmptyIterator<T> implements Iterator<T>
+{
+
+ public boolean hasNext()
+ {
+ return false;
+ }
+
+ public T next()
+ {
+ throw new NoSuchElementException();
+ }
+
+ public void remove()
+ {
+ throw new UnsupportedOperationException();
+ }
+}
Added: myfaces/commons/branches/jsf_20/myfaces-commons-utils/src/main/java/org/apache/myfaces/commons/util/renderkit/ClientBehaviorEvents.java
URL: http://svn.apache.org/viewvc/myfaces/commons/branches/jsf_20/myfaces-commons-utils/src/main/java/org/apache/myfaces/commons/util/renderkit/ClientBehaviorEvents.java?rev=1162956&view=auto
==============================================================================
--- myfaces/commons/branches/jsf_20/myfaces-commons-utils/src/main/java/org/apache/myfaces/commons/util/renderkit/ClientBehaviorEvents.java (added)
+++ myfaces/commons/branches/jsf_20/myfaces-commons-utils/src/main/java/org/apache/myfaces/commons/util/renderkit/ClientBehaviorEvents.java Mon Aug 29 19:41:11 2011
@@ -0,0 +1,45 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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.commons.util.renderkit;
+
+/**
+ * Holds the client behavior events.
+ *
+ * @author Ali Ok
+ */
+public final class ClientBehaviorEvents
+{
+ // Events that are NOT new with Html5
+ public static final String BLUR_EVENT = "blur";
+ public static final String CLICK_EVENT = "click";
+ public static final String DBLCLICK_EVENT = "dblclick";
+ public static final String FOCUS_EVENT = "focus";
+ public static final String KEYDOWN_EVENT = "keydown";
+ public static final String KEYPRESS_EVENT = "keypress";
+ public static final String KEYUP_EVENT = "keyup";
+ public static final String MOUSEDOWN_EVENT = "mousedown";
+ public static final String MOUSEMOVE_EVENT = "mousemove";
+ public static final String MOUSEOUT_EVENT = "mouseout";
+ public static final String MOUSEOVER_EVENT = "mouseover";
+ public static final String MOUSEUP_EVENT = "mouseup";
+ public static final String CHANGE_EVENT = "change";
+ public static final String SELECT_EVENT = "select";
+ public static final String VALUECHANGE_EVENT= "valueChange";
+
+}
Added: myfaces/commons/branches/jsf_20/myfaces-commons-utils/src/main/java/org/apache/myfaces/commons/util/renderkit/JsfProperties.java
URL: http://svn.apache.org/viewvc/myfaces/commons/branches/jsf_20/myfaces-commons-utils/src/main/java/org/apache/myfaces/commons/util/renderkit/JsfProperties.java?rev=1162956&view=auto
==============================================================================
--- myfaces/commons/branches/jsf_20/myfaces-commons-utils/src/main/java/org/apache/myfaces/commons/util/renderkit/JsfProperties.java (added)
+++ myfaces/commons/branches/jsf_20/myfaces-commons-utils/src/main/java/org/apache/myfaces/commons/util/renderkit/JsfProperties.java Mon Aug 29 19:41:11 2011
@@ -0,0 +1,169 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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.commons.util.renderkit;
+
+
+/**
+ * Constant declarations for JSF tags
+ * @author Anton Koinov (latest modification by $Author: jakobk $)
+ * @version $Revision: 939498 $ $Date: 2010-04-29 17:27:30 -0500 (Jue, 29 Abr 2010) $
+ */
+public final class JsfProperties
+{
+ //~ Static fields/initializers -----------------------------------------------------------------
+
+ // Common Attributes
+ public static final String ID_PROP = "id";
+ public static final String VALUE_PROP = "value";
+ public static final String BINDING_PROP = "binding";
+ public static final String STYLE_PROP = "style";
+ public static final String STYLE_CLASS_PROP = "styleClass";
+ public static final String ESCAPE_PROP = "escape";
+ public static final String FORCE_ID_PROP = "forceId";
+ public static final String FORCE_ID_INDEX_PROP = "forceIdIndex";
+ public static final String RENDERED_PROP = "rendered";
+
+ // Common Output Attributes
+ public static final String FOR_PROP = "for";
+ public static final String CONVERTER_PROP = "converter";
+
+ // Ouput_Time Attributes
+ public static final String TIME_STYLE_PROP = "timeStyle";
+ public static final String TIMEZONE_PROP = "timezone";
+
+ // Common Input Attributes
+ public static final String REQUIRED_PROP = "required";
+ public static final String VALIDATOR_PROP = "validator";
+ public static final String DISABLED_PROP = "disabled";
+ public static final String READONLY_PROP = "readonly";
+
+ // Input_Secret Attributes
+ public static final String REDISPLAY_PROP = "redisplay";
+
+ // Input_Checkbox Attributes
+ public static final String LAYOUT_PROP = "layout";
+
+ // Select_Menu Attributes
+ public static final String SIZE_PROP = "size";
+
+ // SelectMany Checkbox List/ Select One Radio Attributes
+ public static final String BORDER_PROP = "border";
+ public static final String DISABLED_CLASS_PROP = "disabledClass";
+ public static final String ENABLED_CLASS_PROP = "enabledClass";
+ public static final String SELECTED_CLASS_PROP = "selectedClass";
+ public static final String UNSELECTED_CLASS_PROP = "unselectedClass";
+ public static final String HIDE_NO_SELECTION_OPTION_PROP = "hideNoSelectionOption";
+
+ // Common Command Attributes
+ /**@deprecated */
+ public static final String COMMAND_CLASS_PROP = "commandClass";
+ public static final String LABEL_PROP = "label";
+ public static final String IMAGE_PROP = "image";
+ public static final String ACTION_PROP = "action";
+ public static final String IMMEDIATE_PROP = "immediate";
+
+
+ // Command_Button Attributes
+ public static final String TYPE_PROP = "type";
+
+ // Common Panel Attributes
+ /**@deprecated */
+ public static final String PANEL_CLASS_PROP = "panelClass";
+ public static final String FOOTER_CLASS_PROP = "footerClass";
+ public static final String HEADER_CLASS_PROP = "headerClass";
+ public static final String COLUMN_CLASSES_PROP = "columnClasses";
+ public static final String ROW_CLASSES_PROP = "rowClasses";
+ public static final String BODYROWS_PROP = "bodyrows";
+
+ // Panel_Grid Attributes
+ public static final String COLUMNS_PROP = "columns";
+ public static final String COLSPAN_PROP = "colspan"; // extension
+ public static final String CAPTION_CLASS_PROP = "captionClass";
+ public static final String CAPTION_STYLE_PROP = "captionStyle";
+
+ // UIMessage and UIMessages attributes
+ public static final String SHOW_SUMMARY_PROP = "showSummary";
+ public static final String SHOW_DETAIL_PROP = "showDetail";
+ public static final String GLOBAL_ONLY_PROP = "globalOnly";
+
+ // HtmlOutputMessage attributes
+ public static final String ERROR_CLASS_PROP = "errorClass";
+ public static final String ERROR_STYLE_PROP = "errorStyle";
+ public static final String FATAL_CLASS_PROP = "fatalClass";
+ public static final String FATAL_STYLE_PROP = "fatalStyle";
+ public static final String INFO_CLASS_PROP = "infoClass";
+ public static final String INFO_STYLE_PROP = "infoStyle";
+ public static final String WARN_CLASS_PROP = "warnClass";
+ public static final String WARN_STYLE_PROP = "warnStyle";
+ public static final String TITLE_PROP = "title";
+ public static final String TOOLTIP_PROP = "tooltip";
+
+ // HtmlOutputLink Attributes
+ public static final String FRAGMENT_PROP = "fragment";
+
+ // GraphicImage attributes
+ public static final String NAME_PROP = "name";
+ public static final String URL_PROP = "url";
+ public static final String LIBRARY_PROP = "library";
+
+ // HtmlOutputScript (missing) attributes
+ public static final String TARGET_PROP = "target";
+
+ // UISelectItem attributes
+ public static final String ITEM_DISABLED_PROP = "itemDisabled";
+ public static final String ITEM_DESCRIPTION_PROP = "itemDescription";
+ public static final String ITEM_LABEL_PROP = "itemLabel";
+ public static final String ITEM_VALUE_PROP = "itemValue";
+ public static final String ITEM_ESCAPED_PROP = "itemEscaped";
+ public static final String NO_SELECTION_OPTION_PROP = "noSelectionOption";
+
+ // UISelectItems attributes
+ public static final String ITEM_LABEL_ESCAPED_PROP = "itemLabelEscaped";
+ public static final String NO_SELECTION_VALUE_PROP = "noSelectionValue";
+
+ // UIData attributes
+ public static final String ROWS_PROP = "rows";
+ public static final String VAR_PROP = "var";
+ public static final String FIRST_PROP = "first";
+
+ // dataTable (extended) attributes
+ public static final String ROW_ID_PROP = "rowId";
+ public static final String ROW_STYLECLASS_PROP = "rowStyleClass";
+ public static final String ROW_STYLE_PROP = "rowStyle";
+
+ // HtmlColumn attributes
+ public static final String ROW_HEADER_PROP = "rowHeader";
+
+ // Alternate locations (instead of using AddResource)
+ public static final String JAVASCRIPT_LOCATION_PROP = "javascriptLocation";
+ public static final String IMAGE_LOCATION_PROP = "imageLocation";
+ public static final String STYLE_LOCATION_PROP = "styleLocation";
+
+ public static final String ACCEPTCHARSET_PROP = "acceptcharset";
+
+ //~ Myfaces Extensions -------------------------------------------------------------------------------
+
+ // UISortData attributes
+ public static final String COLUMN_PROP = "column";
+ public static final String ASCENDING_PROP = "ascending";
+
+ // HtmlSelectManyCheckbox attributes
+ public static final String LAYOUT_WIDTH_PROP = "layoutWidth";
+
+}