Home » tomahawk-1.1.6-src » org.apache.myfaces.shared_tomahawk » renderkit » html » [javadoc | source]

    1   /*
    2    * Licensed to the Apache Software Foundation (ASF) under one
    3    * or more contributor license agreements.  See the NOTICE file
    4    * distributed with this work for additional information
    5    * regarding copyright ownership.  The ASF licenses this file
    6    * to you under the Apache License, Version 2.0 (the
    7    * "License"); you may not use this file except in compliance
    8    * with the License.  You may obtain a copy of the License at
    9    *
   10    *   http://www.apache.org/licenses/LICENSE-2.0
   11    *
   12    * Unless required by applicable law or agreed to in writing,
   13    * software distributed under the License is distributed on an
   14    * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
   15    * KIND, either express or implied.  See the License for the
   16    * specific language governing permissions and limitations
   17    * under the License.
   18    */
   19   package org.apache.myfaces.shared_tomahawk.renderkit.html;
   20   
   21   import org.apache.myfaces.shared_tomahawk.util.ArrayUtils;
   22   
   23   
   24   /**
   25    * Constant declarations for HTML rendering.
   26    * @author Manfred Geiler
   27    * @author Anton Koinov
   28    * @version $Revision: 472618 $ $Date: 2006-11-08 21:06:54 +0100 (Mi, 08 Nov 2006) $
   29    */
   30   public interface HTML
   31   {
   32   
   33       // Common attributes
   34       String ALIGN_ATTR = "align";
   35       String DATAFLD_ATTR = "datafld";
   36       String DATASRC_ATTR = "datasrc";
   37       String DATAFORMATAS_ATTR = "dataformatas";
   38       String BORDER_ATTR = "border";
   39       String WIDTH_ATTR = "width";
   40       String READONLY_ATTR = "readonly";
   41       String FILE_ATTR = "file";
   42       String ACCEPT_ATTR = "accept";
   43   
   44       // Common event handler attributes
   45       String ONCLICK_ATTR     = "onclick";
   46       String ONDBLCLICK_ATTR  = "ondblclick";
   47       String ONMOUSEDOWN_ATTR = "onmousedown";
   48       String ONMOUSEUP_ATTR   = "onmouseup";
   49       String ONMOUSEOVER_ATTR = "onmouseover";
   50       String ONMOUSEMOVE_ATTR = "onmousemove";
   51       String ONMOUSEOUT_ATTR  = "onmouseout";
   52       String ONKEYPRESS_ATTR  = "onkeypress";
   53       String ONKEYDOWN_ATTR   = "onkeydown";
   54       String ONKEYUP_ATTR     = "onkeyup";
   55       String[] EVENT_HANDLER_ATTRIBUTES_WITHOUT_ONCLICK =
   56       {
   57           ONDBLCLICK_ATTR,
   58           ONMOUSEDOWN_ATTR,
   59           ONMOUSEUP_ATTR,
   60           ONMOUSEOVER_ATTR,
   61           ONMOUSEMOVE_ATTR,
   62           ONMOUSEOUT_ATTR,
   63           ONKEYPRESS_ATTR,
   64           ONKEYDOWN_ATTR,
   65           ONKEYUP_ATTR
   66       };
   67       String[] EVENT_HANDLER_ATTRIBUTES =
   68               (String[]) org.apache.myfaces.shared_tomahawk.util.ArrayUtils.concat(
   69                   EVENT_HANDLER_ATTRIBUTES_WITHOUT_ONCLICK,
   70                   new String[] {ONCLICK_ATTR});
   71   
   72       // Input field event handler attributes
   73       String ONFOCUS_ATTR = "onfocus";
   74       String ONBLUR_ATTR = "onblur";
   75       String ONSELECT_ATTR = "onselect";
   76       String ONCHANGE_ATTR = "onchange";
   77       String[] COMMON_FIELD_EVENT_ATTRIBUTES =
   78       {
   79           ONFOCUS_ATTR,
   80           ONBLUR_ATTR,
   81           ONSELECT_ATTR,
   82           ONCHANGE_ATTR
   83       };
   84   
   85       String[] COMMON_FIELD_EVENT_ATTRIBUTES_WITHOUT_ONFOCUS =
   86       {
   87           ONBLUR_ATTR,
   88           ONSELECT_ATTR,
   89           ONCHANGE_ATTR
   90       };
   91   
   92       // universal attributes
   93       String DIR_ATTR   = "dir";
   94       String LANG_ATTR  = "lang";
   95       String STYLE_ATTR = "style";
   96       String TITLE_ATTR = "title";
   97       String STYLE_CLASS_ATTR = "styleClass"; //"class" cannot be used as property name
   98        
   99       String[] UNIVERSAL_ATTRIBUTES_WITHOUT_STYLE =
  100       {
  101           DIR_ATTR,
  102           LANG_ATTR,
  103           TITLE_ATTR,
  104   
  105           //NOTE: if changed, please verify universal attributes in HtmlMessageRenderer !
  106       };
  107       String[] UNIVERSAL_ATTRIBUTES =
  108               (String[]) org.apache.myfaces.shared_tomahawk.util.ArrayUtils.concat(
  109                   UNIVERSAL_ATTRIBUTES_WITHOUT_STYLE,
  110                   new String[] {STYLE_ATTR, STYLE_CLASS_ATTR});
  111   
  112       //universal, but not the same property-name -
  113       //styleClass attribute is rendered as such
  114       String CLASS_ATTR = "class";
  115   
  116       // common form field attributes
  117       String ACCESSKEY_ATTR   = "accesskey";
  118       String TABINDEX_ATTR    = "tabindex";
  119       String DISABLED_ATTR = "disabled";
  120       String[] COMMON_FIELD_ATTRIBUTES_WITHOUT_DISABLED =
  121       {
  122           ACCESSKEY_ATTR,
  123           TABINDEX_ATTR
  124       };
  125       String[] COMMON_FIELD_ATTRIBUTES =
  126           (String[]) ArrayUtils.concat(
  127               COMMON_FIELD_ATTRIBUTES_WITHOUT_DISABLED,
  128               new String[] {DISABLED_ATTR});
  129   
  130       // Common Attributes
  131       String[] COMMON_PASSTROUGH_ATTRIBUTES =
  132           (String[]) org.apache.myfaces.shared_tomahawk.util.ArrayUtils.concat(
  133               EVENT_HANDLER_ATTRIBUTES,
  134               UNIVERSAL_ATTRIBUTES);
  135       String[] COMMON_PASSTROUGH_ATTRIBUTES_WITHOUT_STYLE =
  136           (String[]) org.apache.myfaces.shared_tomahawk.util.ArrayUtils.concat(
  137               EVENT_HANDLER_ATTRIBUTES,
  138               UNIVERSAL_ATTRIBUTES_WITHOUT_STYLE);
  139       String[] COMMON_PASSTROUGH_ATTRIBUTES_WITHOUT_ONCLICK =
  140           (String[]) ArrayUtils.concat(
  141               EVENT_HANDLER_ATTRIBUTES_WITHOUT_ONCLICK,
  142               UNIVERSAL_ATTRIBUTES);
  143       String[] COMMON_PASSTROUGH_ATTRIBUTES_WITHOUT_ONCLICK_WITHOUT_STYLE =
  144           (String[]) ArrayUtils.concat(
  145               EVENT_HANDLER_ATTRIBUTES_WITHOUT_ONCLICK,
  146               UNIVERSAL_ATTRIBUTES_WITHOUT_STYLE);
  147       String[] COMMON_FIELD_PASSTROUGH_ATTRIBUTES_WITHOUT_DISABLED =
  148           (String[]) ArrayUtils.concat(
  149               COMMON_PASSTROUGH_ATTRIBUTES,
  150               COMMON_FIELD_ATTRIBUTES_WITHOUT_DISABLED,
  151               COMMON_FIELD_EVENT_ATTRIBUTES);
  152       String[] COMMON_FIELD_PASSTROUGH_ATTRIBUTES_WITHOUT_DISABLED_AND_ONFOCUS =
  153           (String[]) org.apache.myfaces.shared_tomahawk.util.ArrayUtils.concat(
  154               COMMON_PASSTROUGH_ATTRIBUTES,
  155               COMMON_FIELD_ATTRIBUTES_WITHOUT_DISABLED,
  156               COMMON_FIELD_EVENT_ATTRIBUTES_WITHOUT_ONFOCUS);
  157       String[] COMMON_FIELD_PASSTROUGH_ATTRIBUTES_WITHOUT_DISABLED_AND_ONFOCUS_AND_ONCLICK =
  158           (String[]) ArrayUtils.concat(
  159               COMMON_PASSTROUGH_ATTRIBUTES_WITHOUT_ONCLICK,
  160               COMMON_FIELD_ATTRIBUTES_WITHOUT_DISABLED,
  161               COMMON_FIELD_EVENT_ATTRIBUTES_WITHOUT_ONFOCUS);
  162       String[] COMMON_FIELD_PASSTROUGH_ATTRIBUTES_WITHOUT_DISABLED_AND_ONCLICK =
  163           (String[]) org.apache.myfaces.shared_tomahawk.util.ArrayUtils.concat(
  164               COMMON_PASSTROUGH_ATTRIBUTES_WITHOUT_ONCLICK,
  165               COMMON_FIELD_ATTRIBUTES_WITHOUT_DISABLED,
  166               COMMON_FIELD_EVENT_ATTRIBUTES);
  167   
  168       // <a>
  169       String TARGET_ATTR = "target";  //used by <a> and <form>
  170       String CHARSET_ATTR     = "charset";
  171       String COORDS_ATTR      = "coords";
  172       String HREF_ATTR    = "href";
  173       String HREFLANG_ATTR    = "hreflang";
  174       String REL_ATTR         = "rel";
  175       String REV_ATTR         = "rev";
  176       String SHAPE_ATTR       = "shape";
  177       String TYPE_ATTR        = "type";
  178       String[] ANCHOR_ATTRIBUTES =
  179       {
  180           ACCESSKEY_ATTR,
  181           CHARSET_ATTR,
  182           COORDS_ATTR,
  183           HREFLANG_ATTR,
  184           REL_ATTR,
  185           REV_ATTR,
  186           SHAPE_ATTR,
  187           TABINDEX_ATTR,
  188           TARGET_ATTR,
  189           TYPE_ATTR
  190       };
  191       String[] ANCHOR_PASSTHROUGH_ATTRIBUTES =
  192           (String[]) ArrayUtils.concat(
  193               ANCHOR_ATTRIBUTES,
  194               COMMON_PASSTROUGH_ATTRIBUTES);
  195       String[] ANCHOR_PASSTHROUGH_ATTRIBUTES_WITHOUT_STYLE =
  196           (String[]) org.apache.myfaces.shared_tomahawk.util.ArrayUtils.concat(
  197               ANCHOR_ATTRIBUTES,
  198               COMMON_PASSTROUGH_ATTRIBUTES_WITHOUT_STYLE);
  199       String[] ANCHOR_PASSTHROUGH_ATTRIBUTES_WITHOUT_ONCLICK_WITHOUT_STYLE =
  200           (String[]) org.apache.myfaces.shared_tomahawk.util.ArrayUtils.concat(
  201               ANCHOR_ATTRIBUTES,
  202               COMMON_PASSTROUGH_ATTRIBUTES_WITHOUT_ONCLICK_WITHOUT_STYLE);
  203   
  204       // <form>
  205       String ACCEPT_CHARSET_ATTR = "accept-charset";
  206       String ENCTYPE_ATTR = "enctype";
  207       String ONRESET_ATTR = "onreset";
  208       String ONSUMBIT_ATTR = "onsubmit";
  209       String[] FORM_ATTRIBUTES =
  210       {
  211           ACCEPT_ATTR,
  212           ACCEPT_CHARSET_ATTR,
  213           ENCTYPE_ATTR,
  214           ONRESET_ATTR,
  215           ONSUMBIT_ATTR,
  216           TARGET_ATTR,
  217       };
  218       String[] FORM_PASSTHROUGH_ATTRIBUTES =
  219           (String[]) ArrayUtils.concat(
  220               FORM_ATTRIBUTES,
  221               COMMON_PASSTROUGH_ATTRIBUTES);
  222   
  223       // <img>
  224       String SRC_ATTR = "src";
  225       String ALT_ATTR = "alt";
  226       String HEIGHT_ATTR = "height";
  227       String HSPACE_ATTR = "hspace";
  228       String ISMAP_ATTR = "ismap";
  229       String LONGDESC_ATTR = "longdesc";
  230       String USEMAP_ATTR = "usemap";
  231       String VSPACE_ATTR = "vspace";
  232   
  233       String[] IMG_ATTRIBUTES =
  234       {
  235           ALIGN_ATTR,
  236           ALT_ATTR,
  237           BORDER_ATTR,
  238           HEIGHT_ATTR,
  239           HSPACE_ATTR,
  240           ISMAP_ATTR,
  241           LONGDESC_ATTR,
  242           USEMAP_ATTR,
  243           VSPACE_ATTR,
  244           WIDTH_ATTR
  245       };
  246       String[] IMG_PASSTHROUGH_ATTRIBUTES =
  247           (String[]) ArrayUtils.concat(
  248              IMG_ATTRIBUTES,
  249              COMMON_PASSTROUGH_ATTRIBUTES);
  250   
  251       // <input>
  252       String SIZE_ATTR = "size";
  253       String AUTOCOMPLETE_ATTR = "autocomplete";
  254       String CHECKED_ATTR = "checked";
  255       String MAXLENGTH_ATTR = "maxlength";
  256   
  257       String[] INPUT_ATTRIBUTES = {
  258           ALIGN_ATTR,
  259           ALT_ATTR,
  260           CHECKED_ATTR,
  261           DATAFLD_ATTR,
  262           DATASRC_ATTR,
  263           DATAFORMATAS_ATTR,
  264           MAXLENGTH_ATTR,
  265           READONLY_ATTR,
  266           SIZE_ATTR,
  267           AUTOCOMPLETE_ATTR
  268       };
  269       String[] INPUT_PASSTHROUGH_ATTRIBUTES_WITHOUT_DISABLED =
  270           (String[]) ArrayUtils.concat(
  271                   INPUT_ATTRIBUTES,
  272                   COMMON_FIELD_PASSTROUGH_ATTRIBUTES_WITHOUT_DISABLED);
  273   
  274       String[] INPUT_PASSTHROUGH_ATTRIBUTES_WITHOUT_DISABLED_AND_ONFOCUS_AND_ONCLICK =
  275           (String[]) org.apache.myfaces.shared_tomahawk.util.ArrayUtils.concat(
  276                   INPUT_ATTRIBUTES,
  277                   COMMON_FIELD_PASSTROUGH_ATTRIBUTES_WITHOUT_DISABLED_AND_ONFOCUS_AND_ONCLICK);
  278   
  279       //values for input-type attribute
  280       String INPUT_TYPE_SUBMIT = "submit";
  281       String INPUT_TYPE_IMAGE = "image";
  282       String INPUT_TYPE_HIDDEN = "hidden";
  283       String INPUT_TYPE_CHECKBOX = "checkbox";
  284       String INPUT_TYPE_PASSWORD = "password";
  285       String INPUT_TYPE_TEXT = "text";
  286       String INPUT_TYPE_RADIO = "radio";
  287       String INPUT_TYPE_BUTTON = "button";
  288   
  289       // <button>
  290       String[] BUTTON_ATTRIBUTES =
  291       {
  292           ALIGN_ATTR,
  293           ALT_ATTR,
  294           DATAFLD_ATTR,
  295           DATASRC_ATTR,
  296           DATAFORMATAS_ATTR,
  297       };
  298       String[] BUTTON_PASSTHROUGH_ATTRIBUTES_WITHOUT_DISABLED =
  299           (String[]) org.apache.myfaces.shared_tomahawk.util.ArrayUtils.concat(
  300               BUTTON_ATTRIBUTES,
  301               COMMON_FIELD_PASSTROUGH_ATTRIBUTES_WITHOUT_DISABLED);
  302       String[] BUTTON_PASSTHROUGH_ATTRIBUTES_WITHOUT_DISABLED_AND_ONCLICK =
  303           (String[]) org.apache.myfaces.shared_tomahawk.util.ArrayUtils.concat(
  304               BUTTON_ATTRIBUTES,
  305               COMMON_FIELD_PASSTROUGH_ATTRIBUTES_WITHOUT_DISABLED_AND_ONCLICK);
  306   
  307       // <iframe>
  308       String FRAMEBORDER_ATTR = "frameborder";
  309       String SCROLLING_ATTR = "scrolling";
  310   
  311       // <label>
  312       String FOR_ATTR = "for";
  313       String[] LABEL_ATTRIBUTES =
  314       {
  315           ACCESSKEY_ATTR,
  316           ONBLUR_ATTR,
  317           ONFOCUS_ATTR
  318           //FOR_ATTR is no pass through !
  319       };
  320       String[] LABEL_PASSTHROUGH_ATTRIBUTES =
  321           (String[]) org.apache.myfaces.shared_tomahawk.util.ArrayUtils.concat(
  322               LABEL_ATTRIBUTES,
  323               COMMON_PASSTROUGH_ATTRIBUTES);
  324   
  325       // <select>
  326       String MULTIPLE_ATTR = "multiple";
  327   
  328       String[] SELECT_ATTRIBUTES =
  329       {
  330           DATAFLD_ATTR,
  331           DATASRC_ATTR,
  332           DATAFORMATAS_ATTR,
  333       };
  334       String[] SELECT_PASSTHROUGH_ATTRIBUTES_WITHOUT_DISABLED =
  335           (String[]) ArrayUtils.concat(
  336               SELECT_ATTRIBUTES,
  337               COMMON_FIELD_PASSTROUGH_ATTRIBUTES_WITHOUT_DISABLED);
  338   
  339       // <table>
  340       String BGCOLOR_ATTR = "bgcolor";
  341       String CELLPADDING_ATTR = "cellpadding";
  342       String CELLSPACING_ATTR = "cellspacing";
  343       String FRAME_ATTR = "frame";
  344       String RULES_ATTR = "rules";
  345       String SUMMARY_ATTR = "summary";
  346       String[] TABLE_ATTRIBUTES = {
  347           ALIGN_ATTR,
  348           BGCOLOR_ATTR,
  349           BORDER_ATTR,
  350           CELLPADDING_ATTR,
  351           CELLSPACING_ATTR,
  352           DATAFLD_ATTR,
  353           DATASRC_ATTR,
  354           DATAFORMATAS_ATTR,
  355           FRAME_ATTR,
  356           RULES_ATTR,
  357           SUMMARY_ATTR,
  358           WIDTH_ATTR
  359       };
  360       String[] TABLE_PASSTHROUGH_ATTRIBUTES =
  361           (String[]) ArrayUtils.concat(
  362               TABLE_ATTRIBUTES,
  363               COMMON_PASSTROUGH_ATTRIBUTES);
  364   
  365       // <textarea>
  366       String COLS_ATTR = "cols";
  367       String ROWS_ATTR = "rows";
  368       String WRAP_ATTR = "wrap";
  369       String[] TEXTAREA_ATTRIBUTES =
  370       {
  371           COLS_ATTR,
  372           DATAFLD_ATTR,
  373           DATASRC_ATTR,
  374           DATAFORMATAS_ATTR,
  375           READONLY_ATTR,
  376           ROWS_ATTR,
  377           WRAP_ATTR
  378       };
  379       String[] TEXTAREA_PASSTHROUGH_ATTRIBUTES_WITHOUT_DISABLED =
  380           (String[]) ArrayUtils.concat(
  381               TEXTAREA_ATTRIBUTES,
  382               COMMON_FIELD_PASSTROUGH_ATTRIBUTES_WITHOUT_DISABLED);
  383   
  384       // <input type=file>
  385       String[] INPUT_FILE_UPLOAD_ATTRIBUTES =
  386       {
  387           ACCEPT_ATTR
  388       };
  389       String[] INPUT_FILE_PASSTHROUGH_ATTRIBUTES_WITHOUT_DISABLED =
  390           (String[]) ArrayUtils.concat(
  391               INPUT_FILE_UPLOAD_ATTRIBUTES,
  392               INPUT_PASSTHROUGH_ATTRIBUTES_WITHOUT_DISABLED);
  393   
  394   
  395       /*
  396       String[] MESSAGE_PASSTHROUGH_ATTRIBUTES =
  397           (String[]) ArrayUtils.concat(
  398               new String[] {DIR_ATTR, LANG_ATTR, TITLE_ATTR, STYLE_ATTR, STYLE_CLASS_ATTR},
  399               EVENT_HANDLER_ATTRIBUTES);
  400               */
  401   
  402       String[] MESSAGE_PASSTHROUGH_ATTRIBUTES_WITHOUT_TITLE_STYLE_AND_STYLE_CLASS =
  403           (String[]) org.apache.myfaces.shared_tomahawk.util.ArrayUtils.concat(
  404               new String[] {DIR_ATTR, LANG_ATTR},
  405               EVENT_HANDLER_ATTRIBUTES);
  406   
  407   
  408       // selectOne/Many table
  409       String[] SELECT_TABLE_PASSTHROUGH_ATTRIBUTES =
  410           new String[] {STYLE_ATTR, STYLE_CLASS_ATTR, BORDER_ATTR};
  411   
  412       String COMPACT_ATTR = "compact";
  413       String[] UL_ATTRIBUTES = {
  414           COMPACT_ATTR,
  415           TYPE_ATTR
  416       };
  417       String[] UL_PASSTHROUGH_ATTRIBUTES =
  418           (String[]) ArrayUtils.concat(
  419               UL_ATTRIBUTES,
  420               COMMON_PASSTROUGH_ATTRIBUTES);
  421   
  422   
  423       //HTML attributes needed for renderding only
  424       String ID_ATTR = "id";
  425       String NAME_ATTR = "name";
  426       String VALUE_ATTR = "value";
  427       String METHOD_ATTR = "method";
  428       String ACTION_ATTR = "action";
  429       String COLSPAN_ATTR = "colspan";
  430       String SCOPE_ATTR = "scope";
  431       String LABEL_ATTR = "label";
  432       String SELECTED_ATTR = "selected";
  433   
  434       //HTML attributes values
  435       String SCOPE_COLGROUP_VALUE = "colgroup";
  436   
  437       //HTML element constants
  438       String SPAN_ELEM = "span";
  439       String DIV_ELEM = "div";
  440       String INPUT_ELEM = "input";
  441       String BUTTON_ELEM = "button";
  442       String SELECT_ELEM = "select";
  443       String OPTION_ELEM = "option";
  444       String OPTGROUP_ELEM = "optgroup";
  445       String TEXTAREA_ELEM = "textarea";
  446       String FORM_ELEM = "form";
  447       String ANCHOR_ELEM = "a";
  448       String H1_ELEM = "h1";
  449       String H2_ELEM = "h2";
  450       String H3_ELEM = "h3";
  451       String H4_ELEM = "h4";
  452       String H5_ELEM = "h5";
  453       String H6_ELEM = "h6";
  454       String IFRAME_ELEM = "iframe";
  455       String IMG_ELEM = "img";
  456       String LABEL_ELEM = "label";
  457       String TABLE_ELEM = "table";
  458       String TR_ELEM = "tr";
  459       String TH_ELEM = "th";
  460       String TD_ELEM = "td";
  461       String TBODY_ELEM = "tbody";
  462       String TFOOT_ELEM = "tfoot";
  463       String THEAD_ELEM = "thead";
  464       String STYLE_ELEM = "style";
  465       String SCRIPT_ELEM = "script";
  466       String SCRIPT_TYPE_ATTR = "type";
  467       String SCRIPT_TYPE_TEXT_JAVASCRIPT = "text/javascript";
  468       String STYLE_TYPE_TEXT_CSS = "text/css";
  469       String SCRIPT_LANGUAGE_ATTR = "language";
  470       String SCRIPT_LANGUAGE_JAVASCRIPT = "JavaScript";
  471       String SCRIPT_ELEM_DEFER_ATTR = "defer";
  472       String LINK_ELEM = "link";
  473       String STYLESHEET_VALUE = "stylesheet";
  474       String UL_ELEM = "ul";
  475       String OL_ELEM = "ol";
  476       String LI_ELEM = "li";
  477   
  478   
  479       //HTML simple element constants
  480       String BR_ELEM = "br";
  481   
  482   
  483       //HTML entities
  484       String NBSP_ENTITY = "&#160;";
  485   
  486       String HREF_PATH_SEPARATOR = "/";
  487       String HREF_PATH_FROM_PARAM_SEPARATOR = "?";
  488       String HREF_PARAM_SEPARATOR = "&";
  489       String HREF_PARAM_NAME_FROM_VALUE_SEPARATOR = "=";
  490   
  491   }

Home » tomahawk-1.1.6-src » org.apache.myfaces.shared_tomahawk » renderkit » html » [javadoc | source]