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 2012/03/30 20:14:26 UTC
svn commit: r1307565 [5/6] - in
/myfaces/shared/trunk/core/src/main/java/org/apache/myfaces/shared:
application/ renderkit/ renderkit/html/ resource/ taglib/ taglib/core/
util/ util/io/ util/renderkit/
Modified: myfaces/shared/trunk/core/src/main/java/org/apache/myfaces/shared/util/TagUtils.java
URL: http://svn.apache.org/viewvc/myfaces/shared/trunk/core/src/main/java/org/apache/myfaces/shared/util/TagUtils.java?rev=1307565&r1=1307564&r2=1307565&view=diff
==============================================================================
--- myfaces/shared/trunk/core/src/main/java/org/apache/myfaces/shared/util/TagUtils.java (original)
+++ myfaces/shared/trunk/core/src/main/java/org/apache/myfaces/shared/util/TagUtils.java Fri Mar 30 18:14:25 2012
@@ -1,407 +1,407 @@
-/*
- * 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.shared.util;
-
-
-import java.text.DateFormat;
-import java.text.ParseException;
-import java.text.SimpleDateFormat;
-import java.util.ArrayList;
-import java.util.Date;
-import java.util.Locale;
-import java.util.logging.Level;
-import java.util.logging.Logger;
-
-import javax.el.ELContext;
-import javax.el.ExpressionFactory;
-import javax.el.ValueExpression;
-import javax.faces.context.FacesContext;
-
-/**
- * Utility class for Tag classes
- *
- * @version $Name: $ ($Revision: adfrt/faces/adf-faces-impl/src/main/java/oracle/adfinternal/view/faces/taglib/util/TagUtils.java#1 $) $Date: 11-nov-2005.14:59:38 $
- *
- */
-public final class TagUtils
-{
- //private static final Log LOG = LogFactory.getLog(TagUtils.class);
- private static final Logger LOG = Logger.getLogger(TagUtils.class.getName());
-
- private TagUtils()
- {
- }
-
- public static ValueExpression getValueExpression(String valueExpression, Class<?> expectedType)
- {
- FacesContext context = FacesContext.getCurrentInstance();
- ELContext elContext = context.getELContext();
- ExpressionFactory fact = context.getApplication().getExpressionFactory();
-
- return fact.createValueExpression(elContext, valueExpression, expectedType);
- }
-
- public static void assertNotNull(Object object)
- {
- if (null == object)
- {
- throw new NullPointerException();
- }
- }
-
- // Helpful with tag auto generation. Though this isn't really required.
- /**
- * Return the same string. It is there for convenience and makes life easy
- * while auto generating tags.
- * @param value
- * @return
- */
- public static String getString(
- Object value)
- {
- if (value == null)
- {
- return null;
- }
-
- return value.toString();
- }
-
- /**
- * String --> boolean
- * @param value
- * @return
- */
- public static boolean getBoolean(
- Object value)
- {
- if (value == null)
- {
- return false;
- }
-
- if (value instanceof Boolean)
- {
- return ((Boolean) value).booleanValue();
- }
-
- return Boolean.valueOf(value.toString()).booleanValue();
- }
-
- /**
- * String --> int
- * @param value
- * @return
- */
- public static int getInteger(
- Object value)
- {
- if (value == null)
- {
- return 0;
- }
-
- if (value instanceof Number)
- {
- return ((Number) value).intValue();
- }
-
- return Integer.valueOf(value.toString()).intValue();
-
- }
-
- /**
- * String --> long
- * @param value
- * @return
- */
- public static long getLong(
- Object value)
- {
- if (value == null)
- {
- return 0;
- }
-
- return Long.valueOf(value.toString()).longValue();
- }
-
- /**
- * String --> long
- * @param value
- * @return
- */
- public static double getDouble(
- Object value)
- {
- if (value == null)
- {
- return 0;
- }
-
- return Double.valueOf(value.toString()).doubleValue();
-
- }
-
- /**
- * String --> long
- * @param value
- * @return
- */
- public static float getFloat(
- Object value)
- {
- if (value == null)
- {
- return 0;
- }
-
- return Float.valueOf(value.toString()).floatValue();
- }
-
- /**
- * These are normally NMTOKEN type in attributes
- * String --> String[]
- * @param value
- * @return
- */
- /**
- * These are normally NMTOKEN type in attributes
- * String --> String[]
- * @param value
- * @return
- */
- public static String[] getStringArray(
- Object value) throws ParseException
- {
- if (value == null)
- {
- return null;
- }
-
- return getTokensArray(value.toString());
- }
-
- /**
- * ISO Date String --> Date
- * @param value
- * @return
- */
- public static Date getDate(
- Object value)
- {
- if (value == null)
- {
- return null;
- }
-
- if (value instanceof Date)
- {
- return ((Date) value);
- }
-
- return parseISODate(value.toString());
- }
-
- /**
- * String --> Locale
- * @param value
- * @return
- */
- public static Locale getLocale(
- Object value)
- {
- if (value == null)
- {
- return null;
- }
-
- if (value instanceof Locale)
- {
- return ((Locale) value);
- }
-
- return getLocaleInternal(value.toString());
- }
-
- /**
- * String --> TimeZone
- * @param value
- * @return
-
- public static TimeZone getTimeZone(
- String value)
- {
- return DateUtils.getSupportedTimeZone(value);
- }
- */
-
- public static boolean isValueReference(String expression)
- {
- if (null != expression)
- {
- int start = expression.indexOf("#{");
- if ((start >= 0) && (expression.indexOf('}', start + 1) >= 0))
- {
- return true;
- }
- }
-
- return false;
- }
-
-
-
- /**
- * Takes a string that is a composite of tokens, extracts tokens delimited
- * by any whitespace character sequence combination and returns a String
- * array of such tokens.
- * @throws ParseException In case of invalid character in the specified
- * composite. The only invalid character is a comma (',').
- */
- private static String[] getTokensArray(String tokenComposite)
- throws ParseException
- {
- if (tokenComposite == null || "".equals(tokenComposite))
- {
- return null;
- }
-
- return parseNameTokens(tokenComposite);
- }
-
- /**
- * Parse a string into a java.util.Date object. The
- * string must be in ISO 9601 format (yyyy-MM-dd).
- * @todo why not throw the exception in a different format?
- * why do we kill it here and return null?
- */
- static private final Date parseISODate(String stringValue)
- {
- try
- {
- return getDateFormat().parse(stringValue);
- }
- catch (ParseException pe)
- {
- if (LOG.isLoggable(Level.INFO))
- {
- LOG.log(Level.INFO, "CANNOT_PARSE_VALUE_INTO_DATE_WITH_YYYY_MM_DD_PATTERN "+ stringValue, pe);
- }
- return null;
- }
- }
-
- /**
- * Parses a whitespace separated series of name tokens.
- * @param stringValue the full string
- * @return an array of each constituent value, or null
- * if there are no tokens (that is, the string is empty or
- * all whitespace)
- */
- static public String[] parseNameTokens(String stringValue)
- {
- if (stringValue == null)
- {
- return null;
- }
-
- ArrayList<String> list = new ArrayList<String>(5);
-
- int length = stringValue.length();
- boolean inSpace = true;
- int start = 0;
- for (int i = 0; i < length; i++)
- {
- char ch = stringValue.charAt(i);
-
- // We're in whitespace; if we've just departed
- // a run of non-whitespace, append a string.
- // Now, why do we use the supposedly deprecated "Character.isSpace()"
- // function instead of "isWhitespace"? We're following XML rules
- // here for the meaning of whitespace, which specifically
- // EXCLUDES general Unicode spaces.
- if (Character.isWhitespace(ch))
- {
- if (!inSpace)
- {
- list.add(stringValue.substring(start, i));
- inSpace = true;
- }
- }
- // We're out of whitespace; if we've just departed
- // a run of whitespace, start keeping track of this string
- else
- {
- if (inSpace)
- {
- start = i;
- inSpace = false;
- }
- }
- }
-
- if (!inSpace)
- {
- list.add(stringValue.substring(start));
- }
-
- if (list.isEmpty())
- {
- return null;
- }
-
- return list.toArray(new String[list.size()]);
- }
-
-
- private static Locale getLocaleInternal(String locale)
- {
- String localeStr = locale.replace('-','_');
- String[] tokens = localeStr.split("[_]", 3);
- Locale locl = null;
-
- if ( tokens.length == 1)
- {
- locl = new Locale(tokens[0]); //lang
- }
- else if (tokens.length == 2)
- {
- locl = new Locale(tokens[0], tokens[1]); // lang + country
- }
- else if (tokens.length == 3 )
- {
- locl = new Locale(tokens[0], tokens[1], tokens[2]); // lang + country + variant
- }
- else
- {
- if(LOG.isLoggable(Level.WARNING))
- {
- LOG.log(Level.WARNING, "tokens length should not be greater than 3.");
- }
- }
- return locl;
- }
-
- // We rely strictly on ISO 8601 formats
- private static DateFormat getDateFormat()
- {
- return new SimpleDateFormat("yyyy-MM-dd");
- }
-}
+/*
+ * 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.shared.util;
+
+
+import java.text.DateFormat;
+import java.text.ParseException;
+import java.text.SimpleDateFormat;
+import java.util.ArrayList;
+import java.util.Date;
+import java.util.Locale;
+import java.util.logging.Level;
+import java.util.logging.Logger;
+
+import javax.el.ELContext;
+import javax.el.ExpressionFactory;
+import javax.el.ValueExpression;
+import javax.faces.context.FacesContext;
+
+/**
+ * Utility class for Tag classes
+ *
+ * @version $Name: $ ($Revision: adfrt/faces/adf-faces-impl/src/main/java/oracle/adfinternal/view/faces/taglib/util/TagUtils.java#1 $) $Date: 11-nov-2005.14:59:38 $
+ *
+ */
+public final class TagUtils
+{
+ //private static final Log LOG = LogFactory.getLog(TagUtils.class);
+ private static final Logger LOG = Logger.getLogger(TagUtils.class.getName());
+
+ private TagUtils()
+ {
+ }
+
+ public static ValueExpression getValueExpression(String valueExpression, Class<?> expectedType)
+ {
+ FacesContext context = FacesContext.getCurrentInstance();
+ ELContext elContext = context.getELContext();
+ ExpressionFactory fact = context.getApplication().getExpressionFactory();
+
+ return fact.createValueExpression(elContext, valueExpression, expectedType);
+ }
+
+ public static void assertNotNull(Object object)
+ {
+ if (null == object)
+ {
+ throw new NullPointerException();
+ }
+ }
+
+ // Helpful with tag auto generation. Though this isn't really required.
+ /**
+ * Return the same string. It is there for convenience and makes life easy
+ * while auto generating tags.
+ * @param value
+ * @return
+ */
+ public static String getString(
+ Object value)
+ {
+ if (value == null)
+ {
+ return null;
+ }
+
+ return value.toString();
+ }
+
+ /**
+ * String --> boolean
+ * @param value
+ * @return
+ */
+ public static boolean getBoolean(
+ Object value)
+ {
+ if (value == null)
+ {
+ return false;
+ }
+
+ if (value instanceof Boolean)
+ {
+ return ((Boolean) value).booleanValue();
+ }
+
+ return Boolean.valueOf(value.toString()).booleanValue();
+ }
+
+ /**
+ * String --> int
+ * @param value
+ * @return
+ */
+ public static int getInteger(
+ Object value)
+ {
+ if (value == null)
+ {
+ return 0;
+ }
+
+ if (value instanceof Number)
+ {
+ return ((Number) value).intValue();
+ }
+
+ return Integer.valueOf(value.toString()).intValue();
+
+ }
+
+ /**
+ * String --> long
+ * @param value
+ * @return
+ */
+ public static long getLong(
+ Object value)
+ {
+ if (value == null)
+ {
+ return 0;
+ }
+
+ return Long.valueOf(value.toString()).longValue();
+ }
+
+ /**
+ * String --> long
+ * @param value
+ * @return
+ */
+ public static double getDouble(
+ Object value)
+ {
+ if (value == null)
+ {
+ return 0;
+ }
+
+ return Double.valueOf(value.toString()).doubleValue();
+
+ }
+
+ /**
+ * String --> long
+ * @param value
+ * @return
+ */
+ public static float getFloat(
+ Object value)
+ {
+ if (value == null)
+ {
+ return 0;
+ }
+
+ return Float.valueOf(value.toString()).floatValue();
+ }
+
+ /**
+ * These are normally NMTOKEN type in attributes
+ * String --> String[]
+ * @param value
+ * @return
+ */
+ /**
+ * These are normally NMTOKEN type in attributes
+ * String --> String[]
+ * @param value
+ * @return
+ */
+ public static String[] getStringArray(
+ Object value) throws ParseException
+ {
+ if (value == null)
+ {
+ return null;
+ }
+
+ return getTokensArray(value.toString());
+ }
+
+ /**
+ * ISO Date String --> Date
+ * @param value
+ * @return
+ */
+ public static Date getDate(
+ Object value)
+ {
+ if (value == null)
+ {
+ return null;
+ }
+
+ if (value instanceof Date)
+ {
+ return ((Date) value);
+ }
+
+ return parseISODate(value.toString());
+ }
+
+ /**
+ * String --> Locale
+ * @param value
+ * @return
+ */
+ public static Locale getLocale(
+ Object value)
+ {
+ if (value == null)
+ {
+ return null;
+ }
+
+ if (value instanceof Locale)
+ {
+ return ((Locale) value);
+ }
+
+ return getLocaleInternal(value.toString());
+ }
+
+ /**
+ * String --> TimeZone
+ * @param value
+ * @return
+
+ public static TimeZone getTimeZone(
+ String value)
+ {
+ return DateUtils.getSupportedTimeZone(value);
+ }
+ */
+
+ public static boolean isValueReference(String expression)
+ {
+ if (null != expression)
+ {
+ int start = expression.indexOf("#{");
+ if ((start >= 0) && (expression.indexOf('}', start + 1) >= 0))
+ {
+ return true;
+ }
+ }
+
+ return false;
+ }
+
+
+
+ /**
+ * Takes a string that is a composite of tokens, extracts tokens delimited
+ * by any whitespace character sequence combination and returns a String
+ * array of such tokens.
+ * @throws ParseException In case of invalid character in the specified
+ * composite. The only invalid character is a comma (',').
+ */
+ private static String[] getTokensArray(String tokenComposite)
+ throws ParseException
+ {
+ if (tokenComposite == null || "".equals(tokenComposite))
+ {
+ return null;
+ }
+
+ return parseNameTokens(tokenComposite);
+ }
+
+ /**
+ * Parse a string into a java.util.Date object. The
+ * string must be in ISO 9601 format (yyyy-MM-dd).
+ * @todo why not throw the exception in a different format?
+ * why do we kill it here and return null?
+ */
+ static private final Date parseISODate(String stringValue)
+ {
+ try
+ {
+ return getDateFormat().parse(stringValue);
+ }
+ catch (ParseException pe)
+ {
+ if (LOG.isLoggable(Level.INFO))
+ {
+ LOG.log(Level.INFO, "CANNOT_PARSE_VALUE_INTO_DATE_WITH_YYYY_MM_DD_PATTERN "+ stringValue, pe);
+ }
+ return null;
+ }
+ }
+
+ /**
+ * Parses a whitespace separated series of name tokens.
+ * @param stringValue the full string
+ * @return an array of each constituent value, or null
+ * if there are no tokens (that is, the string is empty or
+ * all whitespace)
+ */
+ static public String[] parseNameTokens(String stringValue)
+ {
+ if (stringValue == null)
+ {
+ return null;
+ }
+
+ ArrayList<String> list = new ArrayList<String>(5);
+
+ int length = stringValue.length();
+ boolean inSpace = true;
+ int start = 0;
+ for (int i = 0; i < length; i++)
+ {
+ char ch = stringValue.charAt(i);
+
+ // We're in whitespace; if we've just departed
+ // a run of non-whitespace, append a string.
+ // Now, why do we use the supposedly deprecated "Character.isSpace()"
+ // function instead of "isWhitespace"? We're following XML rules
+ // here for the meaning of whitespace, which specifically
+ // EXCLUDES general Unicode spaces.
+ if (Character.isWhitespace(ch))
+ {
+ if (!inSpace)
+ {
+ list.add(stringValue.substring(start, i));
+ inSpace = true;
+ }
+ }
+ // We're out of whitespace; if we've just departed
+ // a run of whitespace, start keeping track of this string
+ else
+ {
+ if (inSpace)
+ {
+ start = i;
+ inSpace = false;
+ }
+ }
+ }
+
+ if (!inSpace)
+ {
+ list.add(stringValue.substring(start));
+ }
+
+ if (list.isEmpty())
+ {
+ return null;
+ }
+
+ return list.toArray(new String[list.size()]);
+ }
+
+
+ private static Locale getLocaleInternal(String locale)
+ {
+ String localeStr = locale.replace('-','_');
+ String[] tokens = localeStr.split("[_]", 3);
+ Locale locl = null;
+
+ if ( tokens.length == 1)
+ {
+ locl = new Locale(tokens[0]); //lang
+ }
+ else if (tokens.length == 2)
+ {
+ locl = new Locale(tokens[0], tokens[1]); // lang + country
+ }
+ else if (tokens.length == 3 )
+ {
+ locl = new Locale(tokens[0], tokens[1], tokens[2]); // lang + country + variant
+ }
+ else
+ {
+ if(LOG.isLoggable(Level.WARNING))
+ {
+ LOG.log(Level.WARNING, "tokens length should not be greater than 3.");
+ }
+ }
+ return locl;
+ }
+
+ // We rely strictly on ISO 8601 formats
+ private static DateFormat getDateFormat()
+ {
+ return new SimpleDateFormat("yyyy-MM-dd");
+ }
+}
Modified: myfaces/shared/trunk/core/src/main/java/org/apache/myfaces/shared/util/io/DynamicPushbackInputStream.java
URL: http://svn.apache.org/viewvc/myfaces/shared/trunk/core/src/main/java/org/apache/myfaces/shared/util/io/DynamicPushbackInputStream.java?rev=1307565&r1=1307564&r2=1307565&view=diff
==============================================================================
--- myfaces/shared/trunk/core/src/main/java/org/apache/myfaces/shared/util/io/DynamicPushbackInputStream.java (original)
+++ myfaces/shared/trunk/core/src/main/java/org/apache/myfaces/shared/util/io/DynamicPushbackInputStream.java Fri Mar 30 18:14:25 2012
@@ -1,154 +1,154 @@
-/*
- * 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.shared.util.io;
-
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.PushbackInputStream;
-
-/**
- * NOTE: Copy of org.apache.abdera.i18n.text.io.DynamicPushbackInputStream
- *
- * PushbackInputStream implementation that performs dynamic resizing of the unread buffer
- */
-public class DynamicPushbackInputStream extends PushbackInputStream
-{
-
- private final int origsize;
-
- public DynamicPushbackInputStream(InputStream in)
- {
- super(in);
- this.origsize = 1;
- }
-
- public DynamicPushbackInputStream(InputStream in, int initialSize)
- {
- super(in, initialSize);
- this.origsize = initialSize;
- }
-
- /**
- * Clear the buffer
- */
- public int clear()
- {
- int m = buf.length;
- buf = new byte[origsize];
- pos = origsize;
- return m;
- }
-
- /**
- * Shrink the buffer. This will reclaim currently unused space in the buffer, reducing memory but potentially
- * increasing the cost of resizing the buffer
- */
- public int shrink()
- {
- byte[] old = buf;
- if (pos == 0)
- {
- return 0; // nothing to do
- }
- int n = old.length - pos;
- int m;
- int p;
- int s;
- int l;
- if (n < origsize)
- {
- buf = new byte[origsize];
- p = pos;
- s = origsize - n;
- l = old.length - p;
- m = old.length - origsize;
- pos = s;
- }
- else
- {
- buf = new byte[n];
- p = pos;
- s = 0;
- l = n;
- m = old.length - l;
- pos = 0;
- }
- System.arraycopy(old, p, buf, s, l);
- return m;
- }
-
- private void resize(int len)
- {
- byte[] old = buf;
- buf = new byte[old.length + len];
- System.arraycopy(old, 0, buf, len, old.length);
- }
-
- public void unread(byte[] b, int off, int len) throws IOException
- {
- if (len > pos && pos + len > buf.length)
- {
- resize(len - pos);
- pos += len - pos;
- }
- super.unread(b, off, len);
- }
-
- public void unread(int b) throws IOException
- {
- if (pos == 0)
- {
- resize(1);
- pos++;
- }
- super.unread(b);
- }
-
- public int read() throws IOException
- {
- int m = super.read();
- if (pos >= buf.length && buf.length > origsize)
- {
- shrink();
- }
- return m;
- }
-
- public int read(byte[] b, int off, int len) throws IOException
- {
- this.available(); // workaround for a problem in PushbackInputStream, without this, the amount of bytes read
- // from some streams will be incorrect
- int r = super.read(b, off, len);
- if (pos >= buf.length && buf.length > origsize)
- {
- shrink();
- }
- return r;
- }
-
- public long skip(long n) throws IOException
- {
- long r = super.skip(n);
- if (pos >= buf.length && buf.length > origsize)
- {
- shrink();
- }
- return r;
- }
-}
+/*
+ * 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.shared.util.io;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.PushbackInputStream;
+
+/**
+ * NOTE: Copy of org.apache.abdera.i18n.text.io.DynamicPushbackInputStream
+ *
+ * PushbackInputStream implementation that performs dynamic resizing of the unread buffer
+ */
+public class DynamicPushbackInputStream extends PushbackInputStream
+{
+
+ private final int origsize;
+
+ public DynamicPushbackInputStream(InputStream in)
+ {
+ super(in);
+ this.origsize = 1;
+ }
+
+ public DynamicPushbackInputStream(InputStream in, int initialSize)
+ {
+ super(in, initialSize);
+ this.origsize = initialSize;
+ }
+
+ /**
+ * Clear the buffer
+ */
+ public int clear()
+ {
+ int m = buf.length;
+ buf = new byte[origsize];
+ pos = origsize;
+ return m;
+ }
+
+ /**
+ * Shrink the buffer. This will reclaim currently unused space in the buffer, reducing memory but potentially
+ * increasing the cost of resizing the buffer
+ */
+ public int shrink()
+ {
+ byte[] old = buf;
+ if (pos == 0)
+ {
+ return 0; // nothing to do
+ }
+ int n = old.length - pos;
+ int m;
+ int p;
+ int s;
+ int l;
+ if (n < origsize)
+ {
+ buf = new byte[origsize];
+ p = pos;
+ s = origsize - n;
+ l = old.length - p;
+ m = old.length - origsize;
+ pos = s;
+ }
+ else
+ {
+ buf = new byte[n];
+ p = pos;
+ s = 0;
+ l = n;
+ m = old.length - l;
+ pos = 0;
+ }
+ System.arraycopy(old, p, buf, s, l);
+ return m;
+ }
+
+ private void resize(int len)
+ {
+ byte[] old = buf;
+ buf = new byte[old.length + len];
+ System.arraycopy(old, 0, buf, len, old.length);
+ }
+
+ public void unread(byte[] b, int off, int len) throws IOException
+ {
+ if (len > pos && pos + len > buf.length)
+ {
+ resize(len - pos);
+ pos += len - pos;
+ }
+ super.unread(b, off, len);
+ }
+
+ public void unread(int b) throws IOException
+ {
+ if (pos == 0)
+ {
+ resize(1);
+ pos++;
+ }
+ super.unread(b);
+ }
+
+ public int read() throws IOException
+ {
+ int m = super.read();
+ if (pos >= buf.length && buf.length > origsize)
+ {
+ shrink();
+ }
+ return m;
+ }
+
+ public int read(byte[] b, int off, int len) throws IOException
+ {
+ this.available(); // workaround for a problem in PushbackInputStream, without this, the amount of bytes read
+ // from some streams will be incorrect
+ int r = super.read(b, off, len);
+ if (pos >= buf.length && buf.length > origsize)
+ {
+ shrink();
+ }
+ return r;
+ }
+
+ public long skip(long n) throws IOException
+ {
+ long r = super.skip(n);
+ if (pos >= buf.length && buf.length > origsize)
+ {
+ shrink();
+ }
+ return r;
+ }
+}
Modified: myfaces/shared/trunk/core/src/main/java/org/apache/myfaces/shared/util/renderkit/ClientBehaviorEvents.java
URL: http://svn.apache.org/viewvc/myfaces/shared/trunk/core/src/main/java/org/apache/myfaces/shared/util/renderkit/ClientBehaviorEvents.java?rev=1307565&r1=1307564&r2=1307565&view=diff
==============================================================================
--- myfaces/shared/trunk/core/src/main/java/org/apache/myfaces/shared/util/renderkit/ClientBehaviorEvents.java (original)
+++ myfaces/shared/trunk/core/src/main/java/org/apache/myfaces/shared/util/renderkit/ClientBehaviorEvents.java Fri Mar 30 18:14:25 2012
@@ -1,45 +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.shared.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";
-
-}
+/*
+ * 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.shared.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";
+
+}
Modified: myfaces/shared/trunk/core/src/main/java/org/apache/myfaces/shared/util/renderkit/HTML.java
URL: http://svn.apache.org/viewvc/myfaces/shared/trunk/core/src/main/java/org/apache/myfaces/shared/util/renderkit/HTML.java?rev=1307565&r1=1307564&r2=1307565&view=diff
==============================================================================
--- myfaces/shared/trunk/core/src/main/java/org/apache/myfaces/shared/util/renderkit/HTML.java (original)
+++ myfaces/shared/trunk/core/src/main/java/org/apache/myfaces/shared/util/renderkit/HTML.java Fri Mar 30 18:14:25 2012
@@ -1,613 +1,613 @@
-/*
- * 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.shared.util.renderkit;
-
-import org.apache.myfaces.shared.util.ArrayUtils;
-
-
-/**
- * Constant declarations for HTML rendering.
- * @author Manfred Geiler
- * @author Anton Koinov
- * @version $Revision: 938289 $ $Date: 2010-04-26 20:35:24 -0500 (Lun, 26 Abr 2010) $
- */
-public final class HTML
-{
-
- // Common attributes
- public static final String ALIGN_ATTR = "align";
- public static final String BORDER_ATTR = "border";
- public static final String WIDTH_ATTR = "width";
- public static final String READONLY_ATTR = "readonly";
- public static final String FILE_ATTR = "file";
- public static final String ACCEPT_ATTR = "accept";
-
- // Common event handler attributes
- public static final String ONCLICK_ATTR = "onclick";
- public static final String ONDBLCLICK_ATTR = "ondblclick";
- public static final String ONMOUSEDOWN_ATTR = "onmousedown";
- public static final String ONMOUSEUP_ATTR = "onmouseup";
- public static final String ONMOUSEOVER_ATTR = "onmouseover";
- public static final String ONMOUSEMOVE_ATTR = "onmousemove";
- public static final String ONMOUSEOUT_ATTR = "onmouseout";
- public static final String ONKEYPRESS_ATTR = "onkeypress";
- public static final String ONKEYDOWN_ATTR = "onkeydown";
- public static final String ONKEYUP_ATTR = "onkeyup";
- public static final String ONFOCUS_ATTR = "onfocus";
- public static final String ONBLUR_ATTR = "onblur";
- public static final String[] EVENT_HANDLER_ATTRIBUTES_WITHOUT_ONCLICK =
- {
- ONDBLCLICK_ATTR,
- ONMOUSEDOWN_ATTR,
- ONMOUSEUP_ATTR,
- ONMOUSEOVER_ATTR,
- ONMOUSEMOVE_ATTR,
- ONMOUSEOUT_ATTR,
- ONKEYPRESS_ATTR,
- ONKEYDOWN_ATTR,
- ONKEYUP_ATTR
- };
- public static final String[] EVENT_HANDLER_ATTRIBUTES_WITHOUT_ONMOUSEOVER_AND_ONMOUSEOUT =
- {
- ONDBLCLICK_ATTR,
- ONMOUSEDOWN_ATTR,
- ONMOUSEUP_ATTR,
- ONMOUSEMOVE_ATTR,
- ONKEYPRESS_ATTR,
- ONKEYDOWN_ATTR,
- ONKEYUP_ATTR,
- ONCLICK_ATTR
- };
- public static final String[] EVENT_HANDLER_ATTRIBUTES =
- (String[]) ArrayUtils.concat(
- EVENT_HANDLER_ATTRIBUTES_WITHOUT_ONCLICK,
- new String[] {ONCLICK_ATTR});
-
- // Input field event handler attributes
- public static final String ONSELECT_ATTR = "onselect";
- public static final String ONCHANGE_ATTR = "onchange";
- public static final String[] COMMON_FIELD_EVENT_ATTRIBUTES =
- {
- ONFOCUS_ATTR,
- ONBLUR_ATTR,
- ONSELECT_ATTR,
- ONCHANGE_ATTR
- };
-
- public static final String[] COMMON_FIELD_EVENT_ATTRIBUTES_WITHOUT_ONFOCUS =
- {
- ONBLUR_ATTR,
- ONSELECT_ATTR,
- ONCHANGE_ATTR
- };
-
- public static final String[] COMMON_FIELD_EVENT_ATTRIBUTES_WITHOUT_ONSELECT_AND_ONCHANGE =
- {
- ONFOCUS_ATTR,
- ONBLUR_ATTR
- };
-
- // universal attributes
- public static final String DIR_ATTR = "dir";
- public static final String LANG_ATTR = "lang";
- public static final String STYLE_ATTR = "style";
- public static final String TITLE_ATTR = "title";
- public static final String STYLE_CLASS_ATTR = "styleClass"; //"class" cannot be used as property name
-
- public static final String[] UNIVERSAL_ATTRIBUTES_WITHOUT_STYLE =
- {
- DIR_ATTR,
- LANG_ATTR,
- TITLE_ATTR,
-
- //NOTE: if changed, please verify universal attributes in HtmlMessageRenderer !
- };
- public static final String[] UNIVERSAL_ATTRIBUTES_WITHOUT_STYLE_AND_TITLE =
- {
- DIR_ATTR,
- LANG_ATTR,
- };
- public static final String[] UNIVERSAL_ATTRIBUTES =
- (String[]) ArrayUtils.concat(
- UNIVERSAL_ATTRIBUTES_WITHOUT_STYLE,
- new String[] {STYLE_ATTR, STYLE_CLASS_ATTR});
-
- //universal, but not the same property-name -
- //styleClass attribute is rendered as such
- public static final String CLASS_ATTR = "class";
-
- // common form field attributes
- public static final String ACCESSKEY_ATTR = "accesskey";
- public static final String TABINDEX_ATTR = "tabindex";
- public static final String DISABLED_ATTR = "disabled";
- public static final String[] COMMON_FIELD_ATTRIBUTES_WITHOUT_DISABLED =
- {
- ACCESSKEY_ATTR,
- TABINDEX_ATTR
- };
- public static final String[] COMMON_FIELD_ATTRIBUTES =
- (String[]) ArrayUtils.concat(
- COMMON_FIELD_ATTRIBUTES_WITHOUT_DISABLED,
- new String[] {DISABLED_ATTR});
-
- // Common Attributes
- public static final String[] COMMON_PASSTROUGH_ATTRIBUTES =
- (String[]) ArrayUtils.concat(
- EVENT_HANDLER_ATTRIBUTES,
- UNIVERSAL_ATTRIBUTES);
- public static final String[] COMMON_PASSTROUGH_ATTRIBUTES_WITHOUT_STYLE =
- (String[]) ArrayUtils.concat(
- EVENT_HANDLER_ATTRIBUTES,
- UNIVERSAL_ATTRIBUTES_WITHOUT_STYLE);
- public static final String[] COMMON_PASSTROUGH_ATTRIBUTES_WITHOUT_ONCLICK =
- (String[]) ArrayUtils.concat(
- EVENT_HANDLER_ATTRIBUTES_WITHOUT_ONCLICK,
- UNIVERSAL_ATTRIBUTES);
- public static final String[] COMMON_PASSTROUGH_ATTRIBUTES_WITHOUT_ONCLICK_WITHOUT_STYLE =
- (String[]) ArrayUtils.concat(
- EVENT_HANDLER_ATTRIBUTES_WITHOUT_ONCLICK,
- UNIVERSAL_ATTRIBUTES_WITHOUT_STYLE);
- public static final String[] COMMON_FIELD_PASSTROUGH_ATTRIBUTES_WITHOUT_DISABLED =
- (String[]) ArrayUtils.concat(
- COMMON_PASSTROUGH_ATTRIBUTES,
- COMMON_FIELD_ATTRIBUTES_WITHOUT_DISABLED,
- COMMON_FIELD_EVENT_ATTRIBUTES);
- public static final String[] COMMON_FIELD_PASSTROUGH_ATTRIBUTES_WITHOUT_DISABLED_AND_STYLE =
- (String[]) ArrayUtils.concat(
- COMMON_PASSTROUGH_ATTRIBUTES_WITHOUT_STYLE,
- COMMON_FIELD_ATTRIBUTES_WITHOUT_DISABLED,
- COMMON_FIELD_EVENT_ATTRIBUTES);
- public static final String[] COMMON_FIELD_PASSTROUGH_ATTRIBUTES_WITHOUT_DISABLED_AND_ONFOCUS =
- (String[]) ArrayUtils.concat(
- COMMON_PASSTROUGH_ATTRIBUTES,
- COMMON_FIELD_ATTRIBUTES_WITHOUT_DISABLED,
- COMMON_FIELD_EVENT_ATTRIBUTES_WITHOUT_ONFOCUS);
- public static final String[] COMMON_FIELD_PASSTROUGH_ATTRIBUTES_WITHOUT_DISABLED_AND_ONFOCUS_AND_ONCLICK =
- (String[]) ArrayUtils.concat(
- COMMON_PASSTROUGH_ATTRIBUTES_WITHOUT_ONCLICK,
- COMMON_FIELD_ATTRIBUTES_WITHOUT_DISABLED,
- COMMON_FIELD_EVENT_ATTRIBUTES_WITHOUT_ONFOCUS);
- public static final String[] COMMON_FIELD_PASSTROUGH_ATTRIBUTES_WITHOUT_DISABLED_AND_ONCLICK =
- (String[]) ArrayUtils.concat(
- COMMON_PASSTROUGH_ATTRIBUTES_WITHOUT_ONCLICK,
- COMMON_FIELD_ATTRIBUTES_WITHOUT_DISABLED,
- COMMON_FIELD_EVENT_ATTRIBUTES);
- public static final String[] COMMON_PASSTROUGH_ATTRIBUTES_WITHOUT_ONMOUSEOVER_AND_ONMOUSEOUT =
- (String[]) ArrayUtils.concat(
- EVENT_HANDLER_ATTRIBUTES_WITHOUT_ONMOUSEOVER_AND_ONMOUSEOUT,
- UNIVERSAL_ATTRIBUTES);
- public static final String[] COMMON_FIELD_PASSTROUGH_ATTRIBUTES_WITHOUT_DISABLED_AND_EVENTS =
- (String[]) ArrayUtils.concat(
- UNIVERSAL_ATTRIBUTES,
- COMMON_FIELD_ATTRIBUTES_WITHOUT_DISABLED);
- public static final String[] COMMON_FIELD_PASSTROUGH_ATTRIBUTES_WITHOUT_DISABLED_AND_STYLE_AND_EVENTS =
- (String[]) ArrayUtils.concat(
- UNIVERSAL_ATTRIBUTES_WITHOUT_STYLE,
- COMMON_FIELD_ATTRIBUTES_WITHOUT_DISABLED);
-
- // <a>
- public static final String TARGET_ATTR = "target"; //used by <a> and <form>
- public static final String CHARSET_ATTR = "charset";
- public static final String COORDS_ATTR = "coords";
- public static final String HREF_ATTR = "href";
- public static final String HREFLANG_ATTR = "hreflang";
- public static final String REL_ATTR = "rel";
- public static final String REV_ATTR = "rev";
- public static final String SHAPE_ATTR = "shape";
- public static final String TYPE_ATTR = "type";
- public static final String[] ANCHOR_ATTRIBUTES =
- {
- ACCESSKEY_ATTR,
- CHARSET_ATTR,
- COORDS_ATTR,
- HREFLANG_ATTR,
- REL_ATTR,
- REV_ATTR,
- SHAPE_ATTR,
- TABINDEX_ATTR,
- TARGET_ATTR,
- TYPE_ATTR
- };
- public static final String[] ANCHOR_PASSTHROUGH_ATTRIBUTES =
- (String[]) ArrayUtils.concat(
- ANCHOR_ATTRIBUTES,
- COMMON_PASSTROUGH_ATTRIBUTES,
- COMMON_FIELD_EVENT_ATTRIBUTES_WITHOUT_ONSELECT_AND_ONCHANGE);
- public static final String[] ANCHOR_PASSTHROUGH_ATTRIBUTES_WITHOUT_STYLE =
- (String[]) ArrayUtils.concat(
- ANCHOR_ATTRIBUTES,
- COMMON_PASSTROUGH_ATTRIBUTES_WITHOUT_STYLE,
- COMMON_FIELD_EVENT_ATTRIBUTES_WITHOUT_ONSELECT_AND_ONCHANGE);
- public static final String[] ANCHOR_PASSTHROUGH_ATTRIBUTES_WITHOUT_ONCLICK_WITHOUT_STYLE =
- (String[]) ArrayUtils.concat(
- ANCHOR_ATTRIBUTES,
- COMMON_PASSTROUGH_ATTRIBUTES_WITHOUT_ONCLICK_WITHOUT_STYLE,
- COMMON_FIELD_EVENT_ATTRIBUTES_WITHOUT_ONSELECT_AND_ONCHANGE);
- public static final String[] ANCHOR_PASSTHROUGH_ATTRIBUTES_WITHOUT_EVENTS =
- (String[]) ArrayUtils.concat(
- ANCHOR_ATTRIBUTES,
- UNIVERSAL_ATTRIBUTES);
- public static final String[] ANCHOR_PASSTHROUGH_ATTRIBUTES_WITHOUT_STYLE_AND_EVENTS =
- (String[]) ArrayUtils.concat(
- ANCHOR_ATTRIBUTES,
- UNIVERSAL_ATTRIBUTES_WITHOUT_STYLE);
-
- // <form>
- public static final String ACCEPT_CHARSET_ATTR = "accept-charset";
- public static final String ENCTYPE_ATTR = "enctype";
- public static final String ONRESET_ATTR = "onreset";
- public static final String ONSUMBIT_ATTR = "onsubmit";
- public static final String[] FORM_ATTRIBUTES =
- {
- ACCEPT_ATTR,
- ACCEPT_CHARSET_ATTR,
- ENCTYPE_ATTR,
- ONRESET_ATTR,
- ONSUMBIT_ATTR,
- TARGET_ATTR,
- };
- public static final String[] FORM_PASSTHROUGH_ATTRIBUTES =
- (String[]) ArrayUtils.concat(
- FORM_ATTRIBUTES,
- COMMON_PASSTROUGH_ATTRIBUTES);
- public static final String[] FORM_PASSTHROUGH_ATTRIBUTES_WITHOUT_EVENTS =
- (String[]) ArrayUtils.concat(
- FORM_ATTRIBUTES,
- UNIVERSAL_ATTRIBUTES);
- // <img>
- public static final String SRC_ATTR = "src";
- public static final String ALT_ATTR = "alt";
- public static final String HEIGHT_ATTR = "height";
- public static final String HSPACE_ATTR = "hspace";
- public static final String ISMAP_ATTR = "ismap";
- public static final String LONGDESC_ATTR = "longdesc";
- public static final String USEMAP_ATTR = "usemap";
- public static final String VSPACE_ATTR = "vspace";
-
- public static final String[] IMG_ATTRIBUTES =
- {
- ALIGN_ATTR,
- ALT_ATTR,
- BORDER_ATTR,
- HEIGHT_ATTR,
- HSPACE_ATTR,
- ISMAP_ATTR,
- LONGDESC_ATTR,
- USEMAP_ATTR,
- VSPACE_ATTR,
- WIDTH_ATTR
- };
- public static final String[] IMG_PASSTHROUGH_ATTRIBUTES =
- (String[]) ArrayUtils.concat(
- IMG_ATTRIBUTES,
- COMMON_PASSTROUGH_ATTRIBUTES);
- public static final String[] IMG_PASSTHROUGH_ATTRIBUTES_WITHOUT_ONMOUSEOVER_AND_ONMOUSEOUT =
- (String[]) ArrayUtils.concat(
- IMG_ATTRIBUTES,
- COMMON_PASSTROUGH_ATTRIBUTES_WITHOUT_ONMOUSEOVER_AND_ONMOUSEOUT);
- public static final String[] IMG_PASSTHROUGH_ATTRIBUTES_WITHOUT_EVENTS =
- (String[]) ArrayUtils.concat(
- IMG_ATTRIBUTES,
- UNIVERSAL_ATTRIBUTES);
- // <input>
- public static final String SIZE_ATTR = "size";
- public static final String AUTOCOMPLETE_ATTR = "autocomplete";
- public static final String CHECKED_ATTR = "checked";
- public static final String MAXLENGTH_ATTR = "maxlength";
-
- public static final String[] INPUT_ATTRIBUTES = {
- ALIGN_ATTR,
- ALT_ATTR,
- CHECKED_ATTR,
- MAXLENGTH_ATTR,
- READONLY_ATTR,
- SIZE_ATTR
- };
- public static final String[] INPUT_PASSTHROUGH_ATTRIBUTES_WITHOUT_DISABLED =
- (String[]) ArrayUtils.concat(
- INPUT_ATTRIBUTES,
- COMMON_FIELD_PASSTROUGH_ATTRIBUTES_WITHOUT_DISABLED);
- public static final String[] INPUT_PASSTHROUGH_ATTRIBUTES_WITHOUT_DISABLED_AND_STYLE =
- (String[]) ArrayUtils.concat(
- INPUT_ATTRIBUTES,
- COMMON_FIELD_PASSTROUGH_ATTRIBUTES_WITHOUT_DISABLED_AND_STYLE);
-
- public static final String[] INPUT_PASSTHROUGH_ATTRIBUTES_WITHOUT_DISABLED_AND_ONFOCUS_AND_ONCLICK =
- (String[]) ArrayUtils.concat(
- INPUT_ATTRIBUTES,
- COMMON_FIELD_PASSTROUGH_ATTRIBUTES_WITHOUT_DISABLED_AND_ONFOCUS_AND_ONCLICK);
-
- public static final String[] INPUT_PASSTHROUGH_ATTRIBUTES_WITHOUT_DISABLED_AND_EVENTS =
- (String[]) ArrayUtils.concat(
- INPUT_ATTRIBUTES,
- COMMON_FIELD_PASSTROUGH_ATTRIBUTES_WITHOUT_DISABLED_AND_EVENTS);
-
- public static final String[] INPUT_PASSTHROUGH_ATTRIBUTES_WITHOUT_DISABLED_AND_STYLE_AND_EVENTS =
- (String[]) ArrayUtils.concat(
- INPUT_ATTRIBUTES,
- COMMON_FIELD_PASSTROUGH_ATTRIBUTES_WITHOUT_DISABLED_AND_STYLE_AND_EVENTS);
-
- //values for input-type attribute
- public static final String INPUT_TYPE_SUBMIT = "submit";
- public static final String INPUT_TYPE_IMAGE = "image";
- public static final String INPUT_TYPE_HIDDEN = "hidden";
- public static final String INPUT_TYPE_CHECKBOX = "checkbox";
- public static final String INPUT_TYPE_PASSWORD = "password";
- public static final String INPUT_TYPE_TEXT = "text";
- public static final String INPUT_TYPE_RADIO = "radio";
- public static final String INPUT_TYPE_BUTTON = "button";
-
- // <button>
- public static final String[] BUTTON_ATTRIBUTES =
- {
- ALIGN_ATTR,
- ALT_ATTR,
- };
- public static final String[] BUTTON_PASSTHROUGH_ATTRIBUTES_WITHOUT_DISABLED =
- (String[]) ArrayUtils.concat(
- BUTTON_ATTRIBUTES,
- COMMON_FIELD_PASSTROUGH_ATTRIBUTES_WITHOUT_DISABLED);
- public static final String[] BUTTON_PASSTHROUGH_ATTRIBUTES_WITHOUT_DISABLED_AND_ONCLICK =
- (String[]) ArrayUtils.concat(
- BUTTON_ATTRIBUTES,
- COMMON_FIELD_PASSTROUGH_ATTRIBUTES_WITHOUT_DISABLED_AND_ONCLICK);
- public static final String[] BUTTON_PASSTHROUGH_ATTRIBUTES_WITHOUT_DISABLED_AND_EVENTS =
- (String[]) ArrayUtils.concat(
- BUTTON_ATTRIBUTES,
- COMMON_FIELD_PASSTROUGH_ATTRIBUTES_WITHOUT_DISABLED_AND_EVENTS);
-
- // <iframe>
- public static final String FRAMEBORDER_ATTR = "frameborder";
- public static final String SCROLLING_ATTR = "scrolling";
-
- // <label>
- public static final String FOR_ATTR = "for";
- public static final String[] LABEL_ATTRIBUTES =
- {
- ACCESSKEY_ATTR,
- ONBLUR_ATTR,
- ONFOCUS_ATTR
- //FOR_ATTR is no pass through !
- };
- public static final String[] LABEL_ATTRIBUTES_WITHOUT_EVENTS =
- {
- ACCESSKEY_ATTR
- };
- public static final String[] LABEL_PASSTHROUGH_ATTRIBUTES =
- (String[]) ArrayUtils.concat(
- LABEL_ATTRIBUTES,
- COMMON_PASSTROUGH_ATTRIBUTES);
- public static final String[] LABEL_PASSTHROUGH_ATTRIBUTES_WITHOUT_EVENTS =
- (String[]) ArrayUtils.concat(
- LABEL_ATTRIBUTES_WITHOUT_EVENTS,
- UNIVERSAL_ATTRIBUTES);
-
- // <select>
- public static final String MULTIPLE_ATTR = "multiple";
-
- public static final String[] SELECT_PASSTHROUGH_ATTRIBUTES_WITHOUT_DISABLED =
- COMMON_FIELD_PASSTROUGH_ATTRIBUTES_WITHOUT_DISABLED;
- public static final String[] SELECT_PASSTHROUGH_ATTRIBUTES_WITHOUT_DISABLED_AND_EVENTS =
- COMMON_FIELD_PASSTROUGH_ATTRIBUTES_WITHOUT_DISABLED_AND_EVENTS;
-
- // <table>
- public static final String BGCOLOR_ATTR = "bgcolor";
- public static final String CELLPADDING_ATTR = "cellpadding";
- public static final String CELLSPACING_ATTR = "cellspacing";
- public static final String FRAME_ATTR = "frame";
- public static final String RULES_ATTR = "rules";
- public static final String SUMMARY_ATTR = "summary";
- public static final String[] TABLE_ATTRIBUTES = {
- ALIGN_ATTR,
- BGCOLOR_ATTR,
- BORDER_ATTR,
- CELLPADDING_ATTR,
- CELLSPACING_ATTR,
- FRAME_ATTR,
- RULES_ATTR,
- SUMMARY_ATTR,
- WIDTH_ATTR
- };
- public static final String[] TABLE_PASSTHROUGH_ATTRIBUTES =
- (String[]) ArrayUtils.concat(
- TABLE_ATTRIBUTES,
- COMMON_PASSTROUGH_ATTRIBUTES);
- public static final String[] TABLE_PASSTHROUGH_ATTRIBUTES_WITHOUT_EVENTS =
- (String[]) ArrayUtils.concat(
- TABLE_ATTRIBUTES,
- UNIVERSAL_ATTRIBUTES);
-
- // <textarea>
- public static final String COLS_ATTR = "cols";
- public static final String ROWS_ATTR = "rows";
- public static final String WRAP_ATTR = "wrap";
- public static final String[] TEXTAREA_ATTRIBUTES =
- {
- COLS_ATTR,
- READONLY_ATTR,
- ROWS_ATTR,
- WRAP_ATTR
- };
- public static final String[] TEXTAREA_PASSTHROUGH_ATTRIBUTES_WITHOUT_DISABLED =
- (String[]) ArrayUtils.concat(
- TEXTAREA_ATTRIBUTES,
- COMMON_FIELD_PASSTROUGH_ATTRIBUTES_WITHOUT_DISABLED);
- public static final String[] TEXTAREA_PASSTHROUGH_ATTRIBUTES_WITHOUT_DISABLED_AND_EVENTS =
- (String[]) ArrayUtils.concat(
- TEXTAREA_ATTRIBUTES,
- COMMON_FIELD_PASSTROUGH_ATTRIBUTES_WITHOUT_DISABLED_AND_EVENTS);
-
- // <input type=file>
- public static final String[] INPUT_FILE_UPLOAD_ATTRIBUTES =
- {
- ACCEPT_ATTR
- };
- public static final String[] INPUT_FILE_PASSTHROUGH_ATTRIBUTES_WITHOUT_DISABLED =
- (String[]) ArrayUtils.concat(
- INPUT_FILE_UPLOAD_ATTRIBUTES,
- INPUT_PASSTHROUGH_ATTRIBUTES_WITHOUT_DISABLED);
- public static final String[] INPUT_FILE_PASSTHROUGH_ATTRIBUTES_WITHOUT_DISABLED_AND_EVENTS =
- (String[]) ArrayUtils.concat(
- INPUT_FILE_UPLOAD_ATTRIBUTES,
- INPUT_PASSTHROUGH_ATTRIBUTES_WITHOUT_DISABLED_AND_EVENTS);
-
- /*
- String[] MESSAGE_PASSTHROUGH_ATTRIBUTES =
- (String[]) ArrayUtils.concat(
- new String[] {DIR_ATTR, LANG_ATTR, TITLE_ATTR, STYLE_ATTR, STYLE_CLASS_ATTR},
- EVENT_HANDLER_ATTRIBUTES);
- */
-
- public static final String[] MESSAGE_PASSTHROUGH_ATTRIBUTES_WITHOUT_TITLE_STYLE_AND_STYLE_CLASS =
- (String[]) ArrayUtils.concat(
- new String[] {DIR_ATTR, LANG_ATTR},
- EVENT_HANDLER_ATTRIBUTES);
-
-
- // selectOne/Many table
- public static final String[] SELECT_TABLE_PASSTHROUGH_ATTRIBUTES =
- new String[] {STYLE_ATTR, STYLE_CLASS_ATTR, BORDER_ATTR};
-
- public static final String COMPACT_ATTR = "compact";
- public static final String[] UL_ATTRIBUTES = {
- COMPACT_ATTR,
- TYPE_ATTR
- };
- public static final String[] UL_PASSTHROUGH_ATTRIBUTES =
- (String[]) ArrayUtils.concat(
- UL_ATTRIBUTES,
- COMMON_PASSTROUGH_ATTRIBUTES);
- public static final String[] UL_PASSTHROUGH_ATTRIBUTES_WITHOUT_EVENTS =
- (String[]) ArrayUtils.concat(
- UL_ATTRIBUTES,
- UNIVERSAL_ATTRIBUTES);
-
- //body
- public static final String BODY_ELEM = "body";
- public static final String BODY_TARGET = BODY_ELEM;
-
- public static final String ONLOAD_ATTR = "onload";
- public static final String ONUNLOAD_ATTR = "onunload";
- public static final String ALINK_ATTR = "alink";
- public static final String VLINK_ATTR = "vlink";
- public static final String LINK_ATTR = "link";
- public static final String TEXT_ATTR = "text";
- public static final String BACKGROUND_ATTR = "background";
-
- public static final String[] BODY_ATTRIBUTES =
- {
- ONLOAD_ATTR,
- ONUNLOAD_ATTR,
- ALINK_ATTR,
- VLINK_ATTR,
- LINK_ATTR,
- TEXT_ATTR,
- BACKGROUND_ATTR,
- BGCOLOR_ATTR
- };
-
- public static final String[] BODY_ATTRIBUTES_WITHOUT_EVENTS =
- {
- ALINK_ATTR,
- VLINK_ATTR,
- LINK_ATTR,
- TEXT_ATTR,
- BACKGROUND_ATTR,
- BGCOLOR_ATTR
- };
-
- public static final String[] BODY_PASSTHROUGH_ATTRIBUTES =
- (String[]) ArrayUtils.concat(
- COMMON_PASSTROUGH_ATTRIBUTES,
- BODY_ATTRIBUTES);
- public static final String[] BODY_PASSTHROUGH_ATTRIBUTES_WITHOUT_EVENTS =
- (String[]) ArrayUtils.concat(
- UNIVERSAL_ATTRIBUTES,
- BODY_ATTRIBUTES_WITHOUT_EVENTS);
- //HTML attributes needed for renderding only
- public static final String ID_ATTR = "id";
- public static final String NAME_ATTR = "name";
- public static final String VALUE_ATTR = "value";
- public static final String METHOD_ATTR = "method";
- public static final String ACTION_ATTR = "action";
- public static final String COLSPAN_ATTR = "colspan";
- public static final String SCOPE_ATTR = "scope";
- public static final String LABEL_ATTR = "label";
- public static final String SELECTED_ATTR = "selected";
-
- //HTML attributes values
- public static final String SCOPE_COLGROUP_VALUE = "colgroup";
- public static final String SCOPE_ROW_VALUE = "row";
-
- //HTML element constants
- public static final String SPAN_ELEM = "span";
- public static final String DIV_ELEM = "div";
- public static final String INPUT_ELEM = "input";
- public static final String BUTTON_ELEM = "button";
- public static final String SELECT_ELEM = "select";
- public static final String OPTION_ELEM = "option";
- public static final String OPTGROUP_ELEM = "optgroup";
- public static final String TEXTAREA_ELEM = "textarea";
- public static final String FORM_ELEM = "form";
- public static final String ANCHOR_ELEM = "a";
- public static final String H1_ELEM = "h1";
- public static final String H2_ELEM = "h2";
- public static final String H3_ELEM = "h3";
- public static final String H4_ELEM = "h4";
- public static final String H5_ELEM = "h5";
- public static final String H6_ELEM = "h6";
- public static final String IFRAME_ELEM = "iframe";
- public static final String IMG_ELEM = "img";
- public static final String LABEL_ELEM = "label";
- public static final String TABLE_ELEM = "table";
- public static final String CAPTION_ELEM = "caption";
- public static final String TR_ELEM = "tr";
- public static final String TH_ELEM = "th";
- public static final String TD_ELEM = "td";
- public static final String TBODY_ELEM = "tbody";
- public static final String TFOOT_ELEM = "tfoot";
- public static final String THEAD_ELEM = "thead";
- public static final String STYLE_ELEM = "style";
- public static final String SCRIPT_ELEM = "script";
- public static final String SCRIPT_TYPE_ATTR = "type";
- public static final String SCRIPT_TYPE_TEXT_JAVASCRIPT = "text/javascript";
- public static final String STYLE_TYPE_TEXT_CSS = "text/css";
- public static final String SCRIPT_LANGUAGE_ATTR = "language";
- public static final String SCRIPT_LANGUAGE_JAVASCRIPT = "JavaScript";
- public static final String SCRIPT_ELEM_DEFER_ATTR = "defer";
- public static final String LINK_ELEM = "link";
- public static final String STYLESHEET_VALUE = "stylesheet";
- public static final String UL_ELEM = "ul";
- public static final String OL_ELEM = "ol";
- public static final String LI_ELEM = "li";
-
-
- //HTML simple element constants
- public static final String BR_ELEM = "br";
-
-
- //HTML entities
- public static final String NBSP_ENTITY = " ";
-
- public static final String HREF_PATH_SEPARATOR = "/";
- public static final String HREF_PATH_FROM_PARAM_SEPARATOR = "?";
- //removed because wrong for XHTML and not used anyway: String HREF_PARAM_SEPARATOR = "&";
- public static final String HREF_PARAM_NAME_FROM_VALUE_SEPARATOR = "=";
-
-}
+/*
+ * 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.shared.util.renderkit;
+
+import org.apache.myfaces.shared.util.ArrayUtils;
+
+
+/**
+ * Constant declarations for HTML rendering.
+ * @author Manfred Geiler
+ * @author Anton Koinov
+ * @version $Revision: 938289 $ $Date: 2010-04-26 20:35:24 -0500 (Lun, 26 Abr 2010) $
+ */
+public final class HTML
+{
+
+ // Common attributes
+ public static final String ALIGN_ATTR = "align";
+ public static final String BORDER_ATTR = "border";
+ public static final String WIDTH_ATTR = "width";
+ public static final String READONLY_ATTR = "readonly";
+ public static final String FILE_ATTR = "file";
+ public static final String ACCEPT_ATTR = "accept";
+
+ // Common event handler attributes
+ public static final String ONCLICK_ATTR = "onclick";
+ public static final String ONDBLCLICK_ATTR = "ondblclick";
+ public static final String ONMOUSEDOWN_ATTR = "onmousedown";
+ public static final String ONMOUSEUP_ATTR = "onmouseup";
+ public static final String ONMOUSEOVER_ATTR = "onmouseover";
+ public static final String ONMOUSEMOVE_ATTR = "onmousemove";
+ public static final String ONMOUSEOUT_ATTR = "onmouseout";
+ public static final String ONKEYPRESS_ATTR = "onkeypress";
+ public static final String ONKEYDOWN_ATTR = "onkeydown";
+ public static final String ONKEYUP_ATTR = "onkeyup";
+ public static final String ONFOCUS_ATTR = "onfocus";
+ public static final String ONBLUR_ATTR = "onblur";
+ public static final String[] EVENT_HANDLER_ATTRIBUTES_WITHOUT_ONCLICK =
+ {
+ ONDBLCLICK_ATTR,
+ ONMOUSEDOWN_ATTR,
+ ONMOUSEUP_ATTR,
+ ONMOUSEOVER_ATTR,
+ ONMOUSEMOVE_ATTR,
+ ONMOUSEOUT_ATTR,
+ ONKEYPRESS_ATTR,
+ ONKEYDOWN_ATTR,
+ ONKEYUP_ATTR
+ };
+ public static final String[] EVENT_HANDLER_ATTRIBUTES_WITHOUT_ONMOUSEOVER_AND_ONMOUSEOUT =
+ {
+ ONDBLCLICK_ATTR,
+ ONMOUSEDOWN_ATTR,
+ ONMOUSEUP_ATTR,
+ ONMOUSEMOVE_ATTR,
+ ONKEYPRESS_ATTR,
+ ONKEYDOWN_ATTR,
+ ONKEYUP_ATTR,
+ ONCLICK_ATTR
+ };
+ public static final String[] EVENT_HANDLER_ATTRIBUTES =
+ (String[]) ArrayUtils.concat(
+ EVENT_HANDLER_ATTRIBUTES_WITHOUT_ONCLICK,
+ new String[] {ONCLICK_ATTR});
+
+ // Input field event handler attributes
+ public static final String ONSELECT_ATTR = "onselect";
+ public static final String ONCHANGE_ATTR = "onchange";
+ public static final String[] COMMON_FIELD_EVENT_ATTRIBUTES =
+ {
+ ONFOCUS_ATTR,
+ ONBLUR_ATTR,
+ ONSELECT_ATTR,
+ ONCHANGE_ATTR
+ };
+
+ public static final String[] COMMON_FIELD_EVENT_ATTRIBUTES_WITHOUT_ONFOCUS =
+ {
+ ONBLUR_ATTR,
+ ONSELECT_ATTR,
+ ONCHANGE_ATTR
+ };
+
+ public static final String[] COMMON_FIELD_EVENT_ATTRIBUTES_WITHOUT_ONSELECT_AND_ONCHANGE =
+ {
+ ONFOCUS_ATTR,
+ ONBLUR_ATTR
+ };
+
+ // universal attributes
+ public static final String DIR_ATTR = "dir";
+ public static final String LANG_ATTR = "lang";
+ public static final String STYLE_ATTR = "style";
+ public static final String TITLE_ATTR = "title";
+ public static final String STYLE_CLASS_ATTR = "styleClass"; //"class" cannot be used as property name
+
+ public static final String[] UNIVERSAL_ATTRIBUTES_WITHOUT_STYLE =
+ {
+ DIR_ATTR,
+ LANG_ATTR,
+ TITLE_ATTR,
+
+ //NOTE: if changed, please verify universal attributes in HtmlMessageRenderer !
+ };
+ public static final String[] UNIVERSAL_ATTRIBUTES_WITHOUT_STYLE_AND_TITLE =
+ {
+ DIR_ATTR,
+ LANG_ATTR,
+ };
+ public static final String[] UNIVERSAL_ATTRIBUTES =
+ (String[]) ArrayUtils.concat(
+ UNIVERSAL_ATTRIBUTES_WITHOUT_STYLE,
+ new String[] {STYLE_ATTR, STYLE_CLASS_ATTR});
+
+ //universal, but not the same property-name -
+ //styleClass attribute is rendered as such
+ public static final String CLASS_ATTR = "class";
+
+ // common form field attributes
+ public static final String ACCESSKEY_ATTR = "accesskey";
+ public static final String TABINDEX_ATTR = "tabindex";
+ public static final String DISABLED_ATTR = "disabled";
+ public static final String[] COMMON_FIELD_ATTRIBUTES_WITHOUT_DISABLED =
+ {
+ ACCESSKEY_ATTR,
+ TABINDEX_ATTR
+ };
+ public static final String[] COMMON_FIELD_ATTRIBUTES =
+ (String[]) ArrayUtils.concat(
+ COMMON_FIELD_ATTRIBUTES_WITHOUT_DISABLED,
+ new String[] {DISABLED_ATTR});
+
+ // Common Attributes
+ public static final String[] COMMON_PASSTROUGH_ATTRIBUTES =
+ (String[]) ArrayUtils.concat(
+ EVENT_HANDLER_ATTRIBUTES,
+ UNIVERSAL_ATTRIBUTES);
+ public static final String[] COMMON_PASSTROUGH_ATTRIBUTES_WITHOUT_STYLE =
+ (String[]) ArrayUtils.concat(
+ EVENT_HANDLER_ATTRIBUTES,
+ UNIVERSAL_ATTRIBUTES_WITHOUT_STYLE);
+ public static final String[] COMMON_PASSTROUGH_ATTRIBUTES_WITHOUT_ONCLICK =
+ (String[]) ArrayUtils.concat(
+ EVENT_HANDLER_ATTRIBUTES_WITHOUT_ONCLICK,
+ UNIVERSAL_ATTRIBUTES);
+ public static final String[] COMMON_PASSTROUGH_ATTRIBUTES_WITHOUT_ONCLICK_WITHOUT_STYLE =
+ (String[]) ArrayUtils.concat(
+ EVENT_HANDLER_ATTRIBUTES_WITHOUT_ONCLICK,
+ UNIVERSAL_ATTRIBUTES_WITHOUT_STYLE);
+ public static final String[] COMMON_FIELD_PASSTROUGH_ATTRIBUTES_WITHOUT_DISABLED =
+ (String[]) ArrayUtils.concat(
+ COMMON_PASSTROUGH_ATTRIBUTES,
+ COMMON_FIELD_ATTRIBUTES_WITHOUT_DISABLED,
+ COMMON_FIELD_EVENT_ATTRIBUTES);
+ public static final String[] COMMON_FIELD_PASSTROUGH_ATTRIBUTES_WITHOUT_DISABLED_AND_STYLE =
+ (String[]) ArrayUtils.concat(
+ COMMON_PASSTROUGH_ATTRIBUTES_WITHOUT_STYLE,
+ COMMON_FIELD_ATTRIBUTES_WITHOUT_DISABLED,
+ COMMON_FIELD_EVENT_ATTRIBUTES);
+ public static final String[] COMMON_FIELD_PASSTROUGH_ATTRIBUTES_WITHOUT_DISABLED_AND_ONFOCUS =
+ (String[]) ArrayUtils.concat(
+ COMMON_PASSTROUGH_ATTRIBUTES,
+ COMMON_FIELD_ATTRIBUTES_WITHOUT_DISABLED,
+ COMMON_FIELD_EVENT_ATTRIBUTES_WITHOUT_ONFOCUS);
+ public static final String[] COMMON_FIELD_PASSTROUGH_ATTRIBUTES_WITHOUT_DISABLED_AND_ONFOCUS_AND_ONCLICK =
+ (String[]) ArrayUtils.concat(
+ COMMON_PASSTROUGH_ATTRIBUTES_WITHOUT_ONCLICK,
+ COMMON_FIELD_ATTRIBUTES_WITHOUT_DISABLED,
+ COMMON_FIELD_EVENT_ATTRIBUTES_WITHOUT_ONFOCUS);
+ public static final String[] COMMON_FIELD_PASSTROUGH_ATTRIBUTES_WITHOUT_DISABLED_AND_ONCLICK =
+ (String[]) ArrayUtils.concat(
+ COMMON_PASSTROUGH_ATTRIBUTES_WITHOUT_ONCLICK,
+ COMMON_FIELD_ATTRIBUTES_WITHOUT_DISABLED,
+ COMMON_FIELD_EVENT_ATTRIBUTES);
+ public static final String[] COMMON_PASSTROUGH_ATTRIBUTES_WITHOUT_ONMOUSEOVER_AND_ONMOUSEOUT =
+ (String[]) ArrayUtils.concat(
+ EVENT_HANDLER_ATTRIBUTES_WITHOUT_ONMOUSEOVER_AND_ONMOUSEOUT,
+ UNIVERSAL_ATTRIBUTES);
+ public static final String[] COMMON_FIELD_PASSTROUGH_ATTRIBUTES_WITHOUT_DISABLED_AND_EVENTS =
+ (String[]) ArrayUtils.concat(
+ UNIVERSAL_ATTRIBUTES,
+ COMMON_FIELD_ATTRIBUTES_WITHOUT_DISABLED);
+ public static final String[] COMMON_FIELD_PASSTROUGH_ATTRIBUTES_WITHOUT_DISABLED_AND_STYLE_AND_EVENTS =
+ (String[]) ArrayUtils.concat(
+ UNIVERSAL_ATTRIBUTES_WITHOUT_STYLE,
+ COMMON_FIELD_ATTRIBUTES_WITHOUT_DISABLED);
+
+ // <a>
+ public static final String TARGET_ATTR = "target"; //used by <a> and <form>
+ public static final String CHARSET_ATTR = "charset";
+ public static final String COORDS_ATTR = "coords";
+ public static final String HREF_ATTR = "href";
+ public static final String HREFLANG_ATTR = "hreflang";
+ public static final String REL_ATTR = "rel";
+ public static final String REV_ATTR = "rev";
+ public static final String SHAPE_ATTR = "shape";
+ public static final String TYPE_ATTR = "type";
+ public static final String[] ANCHOR_ATTRIBUTES =
+ {
+ ACCESSKEY_ATTR,
+ CHARSET_ATTR,
+ COORDS_ATTR,
+ HREFLANG_ATTR,
+ REL_ATTR,
+ REV_ATTR,
+ SHAPE_ATTR,
+ TABINDEX_ATTR,
+ TARGET_ATTR,
+ TYPE_ATTR
+ };
+ public static final String[] ANCHOR_PASSTHROUGH_ATTRIBUTES =
+ (String[]) ArrayUtils.concat(
+ ANCHOR_ATTRIBUTES,
+ COMMON_PASSTROUGH_ATTRIBUTES,
+ COMMON_FIELD_EVENT_ATTRIBUTES_WITHOUT_ONSELECT_AND_ONCHANGE);
+ public static final String[] ANCHOR_PASSTHROUGH_ATTRIBUTES_WITHOUT_STYLE =
+ (String[]) ArrayUtils.concat(
+ ANCHOR_ATTRIBUTES,
+ COMMON_PASSTROUGH_ATTRIBUTES_WITHOUT_STYLE,
+ COMMON_FIELD_EVENT_ATTRIBUTES_WITHOUT_ONSELECT_AND_ONCHANGE);
+ public static final String[] ANCHOR_PASSTHROUGH_ATTRIBUTES_WITHOUT_ONCLICK_WITHOUT_STYLE =
+ (String[]) ArrayUtils.concat(
+ ANCHOR_ATTRIBUTES,
+ COMMON_PASSTROUGH_ATTRIBUTES_WITHOUT_ONCLICK_WITHOUT_STYLE,
+ COMMON_FIELD_EVENT_ATTRIBUTES_WITHOUT_ONSELECT_AND_ONCHANGE);
+ public static final String[] ANCHOR_PASSTHROUGH_ATTRIBUTES_WITHOUT_EVENTS =
+ (String[]) ArrayUtils.concat(
+ ANCHOR_ATTRIBUTES,
+ UNIVERSAL_ATTRIBUTES);
+ public static final String[] ANCHOR_PASSTHROUGH_ATTRIBUTES_WITHOUT_STYLE_AND_EVENTS =
+ (String[]) ArrayUtils.concat(
+ ANCHOR_ATTRIBUTES,
+ UNIVERSAL_ATTRIBUTES_WITHOUT_STYLE);
+
+ // <form>
+ public static final String ACCEPT_CHARSET_ATTR = "accept-charset";
+ public static final String ENCTYPE_ATTR = "enctype";
+ public static final String ONRESET_ATTR = "onreset";
+ public static final String ONSUMBIT_ATTR = "onsubmit";
+ public static final String[] FORM_ATTRIBUTES =
+ {
+ ACCEPT_ATTR,
+ ACCEPT_CHARSET_ATTR,
+ ENCTYPE_ATTR,
+ ONRESET_ATTR,
+ ONSUMBIT_ATTR,
+ TARGET_ATTR,
+ };
+ public static final String[] FORM_PASSTHROUGH_ATTRIBUTES =
+ (String[]) ArrayUtils.concat(
+ FORM_ATTRIBUTES,
+ COMMON_PASSTROUGH_ATTRIBUTES);
+ public static final String[] FORM_PASSTHROUGH_ATTRIBUTES_WITHOUT_EVENTS =
+ (String[]) ArrayUtils.concat(
+ FORM_ATTRIBUTES,
+ UNIVERSAL_ATTRIBUTES);
+ // <img>
+ public static final String SRC_ATTR = "src";
+ public static final String ALT_ATTR = "alt";
+ public static final String HEIGHT_ATTR = "height";
+ public static final String HSPACE_ATTR = "hspace";
+ public static final String ISMAP_ATTR = "ismap";
+ public static final String LONGDESC_ATTR = "longdesc";
+ public static final String USEMAP_ATTR = "usemap";
+ public static final String VSPACE_ATTR = "vspace";
+
+ public static final String[] IMG_ATTRIBUTES =
+ {
+ ALIGN_ATTR,
+ ALT_ATTR,
+ BORDER_ATTR,
+ HEIGHT_ATTR,
+ HSPACE_ATTR,
+ ISMAP_ATTR,
+ LONGDESC_ATTR,
+ USEMAP_ATTR,
+ VSPACE_ATTR,
+ WIDTH_ATTR
+ };
+ public static final String[] IMG_PASSTHROUGH_ATTRIBUTES =
+ (String[]) ArrayUtils.concat(
+ IMG_ATTRIBUTES,
+ COMMON_PASSTROUGH_ATTRIBUTES);
+ public static final String[] IMG_PASSTHROUGH_ATTRIBUTES_WITHOUT_ONMOUSEOVER_AND_ONMOUSEOUT =
+ (String[]) ArrayUtils.concat(
+ IMG_ATTRIBUTES,
+ COMMON_PASSTROUGH_ATTRIBUTES_WITHOUT_ONMOUSEOVER_AND_ONMOUSEOUT);
+ public static final String[] IMG_PASSTHROUGH_ATTRIBUTES_WITHOUT_EVENTS =
+ (String[]) ArrayUtils.concat(
+ IMG_ATTRIBUTES,
+ UNIVERSAL_ATTRIBUTES);
+ // <input>
+ public static final String SIZE_ATTR = "size";
+ public static final String AUTOCOMPLETE_ATTR = "autocomplete";
+ public static final String CHECKED_ATTR = "checked";
+ public static final String MAXLENGTH_ATTR = "maxlength";
+
+ public static final String[] INPUT_ATTRIBUTES = {
+ ALIGN_ATTR,
+ ALT_ATTR,
+ CHECKED_ATTR,
+ MAXLENGTH_ATTR,
+ READONLY_ATTR,
+ SIZE_ATTR
+ };
+ public static final String[] INPUT_PASSTHROUGH_ATTRIBUTES_WITHOUT_DISABLED =
+ (String[]) ArrayUtils.concat(
+ INPUT_ATTRIBUTES,
+ COMMON_FIELD_PASSTROUGH_ATTRIBUTES_WITHOUT_DISABLED);
+ public static final String[] INPUT_PASSTHROUGH_ATTRIBUTES_WITHOUT_DISABLED_AND_STYLE =
+ (String[]) ArrayUtils.concat(
+ INPUT_ATTRIBUTES,
+ COMMON_FIELD_PASSTROUGH_ATTRIBUTES_WITHOUT_DISABLED_AND_STYLE);
+
+ public static final String[] INPUT_PASSTHROUGH_ATTRIBUTES_WITHOUT_DISABLED_AND_ONFOCUS_AND_ONCLICK =
+ (String[]) ArrayUtils.concat(
+ INPUT_ATTRIBUTES,
+ COMMON_FIELD_PASSTROUGH_ATTRIBUTES_WITHOUT_DISABLED_AND_ONFOCUS_AND_ONCLICK);
+
+ public static final String[] INPUT_PASSTHROUGH_ATTRIBUTES_WITHOUT_DISABLED_AND_EVENTS =
+ (String[]) ArrayUtils.concat(
+ INPUT_ATTRIBUTES,
+ COMMON_FIELD_PASSTROUGH_ATTRIBUTES_WITHOUT_DISABLED_AND_EVENTS);
+
+ public static final String[] INPUT_PASSTHROUGH_ATTRIBUTES_WITHOUT_DISABLED_AND_STYLE_AND_EVENTS =
+ (String[]) ArrayUtils.concat(
+ INPUT_ATTRIBUTES,
+ COMMON_FIELD_PASSTROUGH_ATTRIBUTES_WITHOUT_DISABLED_AND_STYLE_AND_EVENTS);
+
+ //values for input-type attribute
+ public static final String INPUT_TYPE_SUBMIT = "submit";
+ public static final String INPUT_TYPE_IMAGE = "image";
+ public static final String INPUT_TYPE_HIDDEN = "hidden";
+ public static final String INPUT_TYPE_CHECKBOX = "checkbox";
+ public static final String INPUT_TYPE_PASSWORD = "password";
+ public static final String INPUT_TYPE_TEXT = "text";
+ public static final String INPUT_TYPE_RADIO = "radio";
+ public static final String INPUT_TYPE_BUTTON = "button";
+
+ // <button>
+ public static final String[] BUTTON_ATTRIBUTES =
+ {
+ ALIGN_ATTR,
+ ALT_ATTR,
+ };
+ public static final String[] BUTTON_PASSTHROUGH_ATTRIBUTES_WITHOUT_DISABLED =
+ (String[]) ArrayUtils.concat(
+ BUTTON_ATTRIBUTES,
+ COMMON_FIELD_PASSTROUGH_ATTRIBUTES_WITHOUT_DISABLED);
+ public static final String[] BUTTON_PASSTHROUGH_ATTRIBUTES_WITHOUT_DISABLED_AND_ONCLICK =
+ (String[]) ArrayUtils.concat(
+ BUTTON_ATTRIBUTES,
+ COMMON_FIELD_PASSTROUGH_ATTRIBUTES_WITHOUT_DISABLED_AND_ONCLICK);
+ public static final String[] BUTTON_PASSTHROUGH_ATTRIBUTES_WITHOUT_DISABLED_AND_EVENTS =
+ (String[]) ArrayUtils.concat(
+ BUTTON_ATTRIBUTES,
+ COMMON_FIELD_PASSTROUGH_ATTRIBUTES_WITHOUT_DISABLED_AND_EVENTS);
+
+ // <iframe>
+ public static final String FRAMEBORDER_ATTR = "frameborder";
+ public static final String SCROLLING_ATTR = "scrolling";
+
+ // <label>
+ public static final String FOR_ATTR = "for";
+ public static final String[] LABEL_ATTRIBUTES =
+ {
+ ACCESSKEY_ATTR,
+ ONBLUR_ATTR,
+ ONFOCUS_ATTR
+ //FOR_ATTR is no pass through !
+ };
+ public static final String[] LABEL_ATTRIBUTES_WITHOUT_EVENTS =
+ {
+ ACCESSKEY_ATTR
+ };
+ public static final String[] LABEL_PASSTHROUGH_ATTRIBUTES =
+ (String[]) ArrayUtils.concat(
+ LABEL_ATTRIBUTES,
+ COMMON_PASSTROUGH_ATTRIBUTES);
+ public static final String[] LABEL_PASSTHROUGH_ATTRIBUTES_WITHOUT_EVENTS =
+ (String[]) ArrayUtils.concat(
+ LABEL_ATTRIBUTES_WITHOUT_EVENTS,
+ UNIVERSAL_ATTRIBUTES);
+
+ // <select>
+ public static final String MULTIPLE_ATTR = "multiple";
+
+ public static final String[] SELECT_PASSTHROUGH_ATTRIBUTES_WITHOUT_DISABLED =
+ COMMON_FIELD_PASSTROUGH_ATTRIBUTES_WITHOUT_DISABLED;
+ public static final String[] SELECT_PASSTHROUGH_ATTRIBUTES_WITHOUT_DISABLED_AND_EVENTS =
+ COMMON_FIELD_PASSTROUGH_ATTRIBUTES_WITHOUT_DISABLED_AND_EVENTS;
+
+ // <table>
+ public static final String BGCOLOR_ATTR = "bgcolor";
+ public static final String CELLPADDING_ATTR = "cellpadding";
+ public static final String CELLSPACING_ATTR = "cellspacing";
+ public static final String FRAME_ATTR = "frame";
+ public static final String RULES_ATTR = "rules";
+ public static final String SUMMARY_ATTR = "summary";
+ public static final String[] TABLE_ATTRIBUTES = {
+ ALIGN_ATTR,
+ BGCOLOR_ATTR,
+ BORDER_ATTR,
+ CELLPADDING_ATTR,
+ CELLSPACING_ATTR,
+ FRAME_ATTR,
+ RULES_ATTR,
+ SUMMARY_ATTR,
+ WIDTH_ATTR
+ };
+ public static final String[] TABLE_PASSTHROUGH_ATTRIBUTES =
+ (String[]) ArrayUtils.concat(
+ TABLE_ATTRIBUTES,
+ COMMON_PASSTROUGH_ATTRIBUTES);
+ public static final String[] TABLE_PASSTHROUGH_ATTRIBUTES_WITHOUT_EVENTS =
+ (String[]) ArrayUtils.concat(
+ TABLE_ATTRIBUTES,
+ UNIVERSAL_ATTRIBUTES);
+
+ // <textarea>
+ public static final String COLS_ATTR = "cols";
+ public static final String ROWS_ATTR = "rows";
+ public static final String WRAP_ATTR = "wrap";
+ public static final String[] TEXTAREA_ATTRIBUTES =
+ {
+ COLS_ATTR,
+ READONLY_ATTR,
+ ROWS_ATTR,
+ WRAP_ATTR
+ };
+ public static final String[] TEXTAREA_PASSTHROUGH_ATTRIBUTES_WITHOUT_DISABLED =
+ (String[]) ArrayUtils.concat(
+ TEXTAREA_ATTRIBUTES,
+ COMMON_FIELD_PASSTROUGH_ATTRIBUTES_WITHOUT_DISABLED);
+ public static final String[] TEXTAREA_PASSTHROUGH_ATTRIBUTES_WITHOUT_DISABLED_AND_EVENTS =
+ (String[]) ArrayUtils.concat(
+ TEXTAREA_ATTRIBUTES,
+ COMMON_FIELD_PASSTROUGH_ATTRIBUTES_WITHOUT_DISABLED_AND_EVENTS);
+
+ // <input type=file>
+ public static final String[] INPUT_FILE_UPLOAD_ATTRIBUTES =
+ {
+ ACCEPT_ATTR
+ };
+ public static final String[] INPUT_FILE_PASSTHROUGH_ATTRIBUTES_WITHOUT_DISABLED =
+ (String[]) ArrayUtils.concat(
+ INPUT_FILE_UPLOAD_ATTRIBUTES,
+ INPUT_PASSTHROUGH_ATTRIBUTES_WITHOUT_DISABLED);
+ public static final String[] INPUT_FILE_PASSTHROUGH_ATTRIBUTES_WITHOUT_DISABLED_AND_EVENTS =
+ (String[]) ArrayUtils.concat(
+ INPUT_FILE_UPLOAD_ATTRIBUTES,
+ INPUT_PASSTHROUGH_ATTRIBUTES_WITHOUT_DISABLED_AND_EVENTS);
+
+ /*
+ String[] MESSAGE_PASSTHROUGH_ATTRIBUTES =
+ (String[]) ArrayUtils.concat(
+ new String[] {DIR_ATTR, LANG_ATTR, TITLE_ATTR, STYLE_ATTR, STYLE_CLASS_ATTR},
+ EVENT_HANDLER_ATTRIBUTES);
+ */
+
+ public static final String[] MESSAGE_PASSTHROUGH_ATTRIBUTES_WITHOUT_TITLE_STYLE_AND_STYLE_CLASS =
+ (String[]) ArrayUtils.concat(
+ new String[] {DIR_ATTR, LANG_ATTR},
+ EVENT_HANDLER_ATTRIBUTES);
+
+
+ // selectOne/Many table
+ public static final String[] SELECT_TABLE_PASSTHROUGH_ATTRIBUTES =
+ new String[] {STYLE_ATTR, STYLE_CLASS_ATTR, BORDER_ATTR};
+
+ public static final String COMPACT_ATTR = "compact";
+ public static final String[] UL_ATTRIBUTES = {
+ COMPACT_ATTR,
+ TYPE_ATTR
+ };
+ public static final String[] UL_PASSTHROUGH_ATTRIBUTES =
+ (String[]) ArrayUtils.concat(
+ UL_ATTRIBUTES,
+ COMMON_PASSTROUGH_ATTRIBUTES);
+ public static final String[] UL_PASSTHROUGH_ATTRIBUTES_WITHOUT_EVENTS =
+ (String[]) ArrayUtils.concat(
+ UL_ATTRIBUTES,
+ UNIVERSAL_ATTRIBUTES);
+
+ //body
+ public static final String BODY_ELEM = "body";
+ public static final String BODY_TARGET = BODY_ELEM;
+
+ public static final String ONLOAD_ATTR = "onload";
+ public static final String ONUNLOAD_ATTR = "onunload";
+ public static final String ALINK_ATTR = "alink";
+ public static final String VLINK_ATTR = "vlink";
+ public static final String LINK_ATTR = "link";
+ public static final String TEXT_ATTR = "text";
+ public static final String BACKGROUND_ATTR = "background";
+
+ public static final String[] BODY_ATTRIBUTES =
+ {
+ ONLOAD_ATTR,
+ ONUNLOAD_ATTR,
+ ALINK_ATTR,
+ VLINK_ATTR,
+ LINK_ATTR,
+ TEXT_ATTR,
+ BACKGROUND_ATTR,
+ BGCOLOR_ATTR
+ };
+
+ public static final String[] BODY_ATTRIBUTES_WITHOUT_EVENTS =
+ {
+ ALINK_ATTR,
+ VLINK_ATTR,
+ LINK_ATTR,
+ TEXT_ATTR,
+ BACKGROUND_ATTR,
+ BGCOLOR_ATTR
+ };
+
+ public static final String[] BODY_PASSTHROUGH_ATTRIBUTES =
+ (String[]) ArrayUtils.concat(
+ COMMON_PASSTROUGH_ATTRIBUTES,
+ BODY_ATTRIBUTES);
+ public static final String[] BODY_PASSTHROUGH_ATTRIBUTES_WITHOUT_EVENTS =
+ (String[]) ArrayUtils.concat(
+ UNIVERSAL_ATTRIBUTES,
+ BODY_ATTRIBUTES_WITHOUT_EVENTS);
+ //HTML attributes needed for renderding only
+ public static final String ID_ATTR = "id";
+ public static final String NAME_ATTR = "name";
+ public static final String VALUE_ATTR = "value";
+ public static final String METHOD_ATTR = "method";
+ public static final String ACTION_ATTR = "action";
+ public static final String COLSPAN_ATTR = "colspan";
+ public static final String SCOPE_ATTR = "scope";
+ public static final String LABEL_ATTR = "label";
+ public static final String SELECTED_ATTR = "selected";
+
+ //HTML attributes values
+ public static final String SCOPE_COLGROUP_VALUE = "colgroup";
+ public static final String SCOPE_ROW_VALUE = "row";
+
+ //HTML element constants
+ public static final String SPAN_ELEM = "span";
+ public static final String DIV_ELEM = "div";
+ public static final String INPUT_ELEM = "input";
+ public static final String BUTTON_ELEM = "button";
+ public static final String SELECT_ELEM = "select";
+ public static final String OPTION_ELEM = "option";
+ public static final String OPTGROUP_ELEM = "optgroup";
+ public static final String TEXTAREA_ELEM = "textarea";
+ public static final String FORM_ELEM = "form";
+ public static final String ANCHOR_ELEM = "a";
+ public static final String H1_ELEM = "h1";
+ public static final String H2_ELEM = "h2";
+ public static final String H3_ELEM = "h3";
+ public static final String H4_ELEM = "h4";
+ public static final String H5_ELEM = "h5";
+ public static final String H6_ELEM = "h6";
+ public static final String IFRAME_ELEM = "iframe";
+ public static final String IMG_ELEM = "img";
+ public static final String LABEL_ELEM = "label";
+ public static final String TABLE_ELEM = "table";
+ public static final String CAPTION_ELEM = "caption";
+ public static final String TR_ELEM = "tr";
+ public static final String TH_ELEM = "th";
+ public static final String TD_ELEM = "td";
+ public static final String TBODY_ELEM = "tbody";
+ public static final String TFOOT_ELEM = "tfoot";
+ public static final String THEAD_ELEM = "thead";
+ public static final String STYLE_ELEM = "style";
+ public static final String SCRIPT_ELEM = "script";
+ public static final String SCRIPT_TYPE_ATTR = "type";
+ public static final String SCRIPT_TYPE_TEXT_JAVASCRIPT = "text/javascript";
+ public static final String STYLE_TYPE_TEXT_CSS = "text/css";
+ public static final String SCRIPT_LANGUAGE_ATTR = "language";
+ public static final String SCRIPT_LANGUAGE_JAVASCRIPT = "JavaScript";
+ public static final String SCRIPT_ELEM_DEFER_ATTR = "defer";
+ public static final String LINK_ELEM = "link";
+ public static final String STYLESHEET_VALUE = "stylesheet";
+ public static final String UL_ELEM = "ul";
+ public static final String OL_ELEM = "ol";
+ public static final String LI_ELEM = "li";
+
+
+ //HTML simple element constants
+ public static final String BR_ELEM = "br";
+
+
+ //HTML entities
+ public static final String NBSP_ENTITY = " ";
+
+ public static final String HREF_PATH_SEPARATOR = "/";
+ public static final String HREF_PATH_FROM_PARAM_SEPARATOR = "?";
+ //removed because wrong for XHTML and not used anyway: String HREF_PARAM_SEPARATOR = "&";
+ public static final String HREF_PARAM_NAME_FROM_VALUE_SEPARATOR = "=";
+
+}