myfaces-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From to...@apache.org
Subject svn commit: r434574 [2/2] - in /myfaces: shared/trunk/core/src/main/java/org/apache/myfaces/shared/renderkit/ shared/trunk/core/src/main/java/org/apache/myfaces/shared/renderkit/html/ tomahawk/trunk/core/src/main/java/org/apache/myfaces/custom/navmenu/...
Date Thu, 24 Aug 2006 23:52:10 GMT
Modified: myfaces/shared/trunk/core/src/main/java/org/apache/myfaces/shared/renderkit/html/HtmlRendererUtils.java
URL: http://svn.apache.org/viewvc/myfaces/shared/trunk/core/src/main/java/org/apache/myfaces/shared/renderkit/html/HtmlRendererUtils.java?rev=434574&r1=434573&r2=434574&view=diff
==============================================================================
--- myfaces/shared/trunk/core/src/main/java/org/apache/myfaces/shared/renderkit/html/HtmlRendererUtils.java (original)
+++ myfaces/shared/trunk/core/src/main/java/org/apache/myfaces/shared/renderkit/html/HtmlRendererUtils.java Thu Aug 24 16:52:09 2006
@@ -23,6 +23,7 @@
 import org.apache.myfaces.shared.renderkit.RendererUtils;
 import org.apache.myfaces.shared.renderkit.html.util.HTMLEncoder;
 import org.apache.myfaces.shared.renderkit.html.util.JavascriptUtils;
+import org.apache.myfaces.shared.renderkit.html.util.FormInfo;
 
 import javax.faces.FacesException;
 import javax.faces.component.*;
@@ -43,12 +44,13 @@
 
     //private static final String[] EMPTY_STRING_ARRAY = new String[0];
     private static final String LINE_SEPARATOR = System.getProperty(
-            "line.separator", "\r\n");
+        "line.separator", "\r\n");
 
     public static final String HIDDEN_COMMANDLINK_FIELD_NAME = "_idcl";
+    public static final String HIDDEN_COMMANDLINK_FIELD_NAME_TRINIDAD = "source";
 
     public static final String CLEAR_HIDDEN_FIELD_FN_NAME =
-         "clearFormHiddenParams";
+        "clearFormHiddenParams";
 
     private HtmlRendererUtils() {
         // utility class, do not instantiate
@@ -57,7 +59,7 @@
     /**
      * Utility to set the submitted value of the provided component from the
      * data in the current request object.
-     * <p>
+     * <p/>
      * Param component is required to be an EditableValueHolder. On return
      * from this method, the component's submittedValue property will be
      * set if the submitted form contained that component.
@@ -66,28 +68,26 @@
                                      UIComponent component) {
         if (!(component instanceof EditableValueHolder)) {
             throw new IllegalArgumentException("Component "
-                                               + component.getClientId(facesContext)
-                                               + " is not an EditableValueHolder");
+                + component.getClientId(facesContext)
+                + " is not an EditableValueHolder");
         }
         Map paramMap = facesContext.getExternalContext()
-                .getRequestParameterMap();
+            .getRequestParameterMap();
         String clientId = component.getClientId(facesContext);
 
-        if(isDisabledOrReadOnly(component))
+        if (isDisabledOrReadOnly(component))
             return;
 
-        if(paramMap.containsKey(clientId))
-        {
+        if (paramMap.containsKey(clientId)) {
             ((EditableValueHolder) component).setSubmittedValue(paramMap
-                    .get(clientId));
+                .get(clientId));
         }
-        else
-        {
+        else {
             log.warn(
                 "There should always be a submitted value for an input if it"
-                + " is rendered, its form is submitted, and it is not disabled"
-                + " or read-only. Component : "+
-                RendererUtils.getPathToComponent(component));
+                    + " is rendered, its form is submitted, and it is not disabled"
+                    + " or read-only. Component : " +
+                    RendererUtils.getPathToComponent(component));
         }
     }
 
@@ -101,43 +101,43 @@
                                              UIComponent component) {
         if (!(component instanceof EditableValueHolder)) {
             throw new IllegalArgumentException("Component "
-                                               + component.getClientId(facesContext)
-                                               + " is not an EditableValueHolder");
+                + component.getClientId(facesContext)
+                + " is not an EditableValueHolder");
         }
 
-        if(isDisabledOrReadOnly(component))
+        if (isDisabledOrReadOnly(component))
             return;
 
         Map paramMap = facesContext.getExternalContext()
-                .getRequestParameterMap();
+            .getRequestParameterMap();
         String clientId = component.getClientId(facesContext);
         if (paramMap.containsKey(clientId)) {
             String reqValue = (String) paramMap.get(clientId);
             if ((reqValue.equalsIgnoreCase("on")
-                 || reqValue.equalsIgnoreCase("yes") || reqValue
-                    .equalsIgnoreCase("true"))) {
+                || reqValue.equalsIgnoreCase("yes") || reqValue
+                .equalsIgnoreCase("true"))) {
                 ((EditableValueHolder) component)
-                        .setSubmittedValue(Boolean.TRUE);
-            } else {
+                    .setSubmittedValue(Boolean.TRUE);
+            }
+            else {
                 ((EditableValueHolder) component)
-                        .setSubmittedValue(Boolean.FALSE);
+                    .setSubmittedValue(Boolean.FALSE);
             }
-        } else {
+        }
+        else {
             ((EditableValueHolder) component)
-                    .setSubmittedValue(Boolean.FALSE);
+                .setSubmittedValue(Boolean.FALSE);
         }
     }
 
-    public static boolean isDisabledOrReadOnly(UIComponent component)
-    {
+    public static boolean isDisabledOrReadOnly(UIComponent component) {
         return isDisplayValueOnly(component) ||
-               isTrue(component.getAttributes().get("disabled")) ||
-               isTrue(component.getAttributes().get("readonly"));
+            isTrue(component.getAttributes().get("disabled")) ||
+            isTrue(component.getAttributes().get("readonly"));
     }
 
-    private static boolean isTrue(Object obj)
-    {
-        if(!(obj instanceof Boolean))
+    private static boolean isTrue(Object obj) {
+        if (!(obj instanceof Boolean))
             return false;
 
         return ((Boolean) obj).booleanValue();
@@ -153,27 +153,28 @@
                                           UIComponent component) {
         if (!(component instanceof EditableValueHolder)) {
             throw new IllegalArgumentException("Component "
-                                               + component.getClientId(facesContext)
-                                               + " is not an EditableValueHolder");
+                + component.getClientId(facesContext)
+                + " is not an EditableValueHolder");
         }
         Map paramValuesMap = facesContext.getExternalContext()
-                .getRequestParameterValuesMap();
+            .getRequestParameterValuesMap();
         String clientId = component.getClientId(facesContext);
 
-        if(isDisabledOrReadOnly(component))
+        if (isDisabledOrReadOnly(component))
             return;
 
         if (paramValuesMap.containsKey(clientId)) {
             String[] reqValues = (String[]) paramValuesMap.get(clientId);
             ((EditableValueHolder) component).setSubmittedValue(reqValues);
-        } else {
+        }
+        else {
             /* request parameter not found, nothing to decode - set submitted value to an empty array
                as we should get here only if the component is on a submitted form, is rendered
                and if the component is not readonly or has not been disabled.
 
                So in fact, there must be component value at this location, but for listboxes, comboboxes etc.
                the submitted value is not posted if no item is selected. */
-            ((EditableValueHolder) component).setSubmittedValue( new String[]{});
+            ((EditableValueHolder) component).setSubmittedValue(new String[]{});
         }
     }
 
@@ -187,23 +188,24 @@
                                          UIComponent component) {
         if (!(component instanceof EditableValueHolder)) {
             throw new IllegalArgumentException("Component "
-                                               + component.getClientId(facesContext)
-                                               + " is not an EditableValueHolder");
+                + component.getClientId(facesContext)
+                + " is not an EditableValueHolder");
         }
 
-        if(isDisabledOrReadOnly(component))
+        if (isDisabledOrReadOnly(component))
             return;
 
         Map paramMap = facesContext.getExternalContext()
-                .getRequestParameterMap();
+            .getRequestParameterMap();
         String clientId = component.getClientId(facesContext);
         if (paramMap.containsKey(clientId)) {
             //request parameter found, set submitted value
             ((EditableValueHolder) component).setSubmittedValue(paramMap
-                    .get(clientId));
-        } else {
+                .get(clientId));
+        }
+        else {
             //see reason for this action at decodeUISelectMany
-            ((EditableValueHolder) component).setSubmittedValue( RendererUtils.NOTHING );
+            ((EditableValueHolder) component).setSubmittedValue(RendererUtils.NOTHING);
         }
     }
 
@@ -237,13 +239,13 @@
 
     public static void renderListbox(FacesContext facesContext,
                                      UISelectOne selectOne, boolean disabled, int size)
-            throws IOException {
+        throws IOException {
         internalRenderSelect(facesContext, selectOne, disabled, size, false);
     }
 
     public static void renderListbox(FacesContext facesContext,
                                      UISelectMany selectMany, boolean disabled, int size)
-            throws IOException {
+        throws IOException {
         internalRenderSelect(facesContext, selectMany, disabled, size, true);
     }
 
@@ -265,26 +267,28 @@
         writer.startElement(HTML.SELECT_ELEM, uiComponent);
         HtmlRendererUtils.writeIdIfNecessary(writer, uiComponent, facesContext);
         writer.writeAttribute(HTML.NAME_ATTR, uiComponent
-                .getClientId(facesContext), null);
+            .getClientId(facesContext), null);
 
         List selectItemList;
         Converter converter;
         if (selectMany) {
             writer.writeAttribute(HTML.MULTIPLE_ATTR, HTML.MULTIPLE_ATTR, null);
             selectItemList = org.apache.myfaces.shared.renderkit.RendererUtils
-                    .getSelectItemList((UISelectMany) uiComponent);
+                .getSelectItemList((UISelectMany) uiComponent);
             converter = findUISelectManyConverterFailsafe(facesContext, uiComponent);
-        } else {
+        }
+        else {
             selectItemList = RendererUtils
-                    .getSelectItemList((UISelectOne) uiComponent);
+                .getSelectItemList((UISelectOne) uiComponent);
             converter = findUIOutputConverterFailSafe(facesContext, uiComponent);
         }
 
         if (size == 0) {
             //No size given (Listbox) --> size is number of select items
             writer.writeAttribute(HTML.SIZE_ATTR, Integer
-                    .toString(selectItemList.size()), null);
-        } else {
+                .toString(selectItemList.size()), null);
+        }
+        else {
             writer.writeAttribute(HTML.SIZE_ATTR, Integer.toString(size), null);
         }
         renderHTMLAttributes(writer, uiComponent,
@@ -308,25 +312,22 @@
         if (selectMany) {
             UISelectMany uiSelectMany = (UISelectMany) uiComponent;
             lookupSet = RendererUtils.getSubmittedValuesAsSet(facesContext, uiComponent, converter, uiSelectMany);
-            if (lookupSet == null)
-            {
+            if (lookupSet == null) {
                 lookupSet = RendererUtils.getSelectedValuesAsSet(facesContext, uiComponent, converter, uiSelectMany);
             }
-        } else {
+        }
+        else {
             UISelectOne uiSelectOne = (UISelectOne) uiComponent;
             Object lookup = uiSelectOne.getSubmittedValue();
-            if (lookup == null)
-            {
+            if (lookup == null) {
                 lookup = uiSelectOne.getValue();
                 String lookupString = RendererUtils.getConvertedStringValue(facesContext, uiComponent, converter, lookup);
                 lookupSet = Collections.singleton(lookupString);
             }
-            else if(org.apache.myfaces.shared.renderkit.RendererUtils.NOTHING.equals(lookup))
-            {
+            else if (org.apache.myfaces.shared.renderkit.RendererUtils.NOTHING.equals(lookup)) {
                 lookupSet = Collections.EMPTY_SET;
             }
-            else
-            {
+            else {
                 lookupSet = Collections.singleton(lookup);
             }
         }
@@ -337,10 +338,11 @@
         Converter converter;
         try {
             converter = RendererUtils.findUISelectManyConverter(
-                    facesContext, (UISelectMany) uiComponent);
-        } catch (FacesException e) {
+                facesContext, (UISelectMany) uiComponent);
+        }
+        catch (FacesException e) {
             log.error("Error finding Converter for component with id "
-                      + uiComponent.getClientId(facesContext));
+                + uiComponent.getClientId(facesContext));
             converter = null;
         }
         return converter;
@@ -351,9 +353,10 @@
         try {
             converter = RendererUtils.findUIOutputConverter(facesContext,
                                                             (UIOutput) uiComponent);
-        } catch (FacesException e) {
+        }
+        catch (FacesException e) {
             log.error("Error finding Converter for component with id "
-                      + uiComponent.getClientId(facesContext));
+                + uiComponent.getClientId(facesContext));
             converter = null;
         }
         return converter;
@@ -363,18 +366,13 @@
      * Renders the select options for a <code>UIComponent</code> that is
      * rendered as an HTML select element.
      *
-     * @param context
-     *            the current <code>FacesContext</code>.
-     * @param component
-     *            the <code>UIComponent</code> whose options need to be
-     *            rendered.
-     * @param converter
-     *            <code>component</code>'s converter
-     * @param lookupSet
-     *            the <code>Set</code> to use to look up selected options
-     * @param selectItemList
-     *            the <code>List</code> of <code>SelectItem</code> s to be
-     *            rendered as HTML option elements.
+     * @param context        the current <code>FacesContext</code>.
+     * @param component      the <code>UIComponent</code> whose options need to be
+     *                       rendered.
+     * @param converter      <code>component</code>'s converter
+     * @param lookupSet      the <code>Set</code> to use to look up selected options
+     * @param selectItemList the <code>List</code> of <code>SelectItem</code> s to be
+     *                       rendered as HTML option elements.
      * @throws IOException
      */
     public static void renderSelectOptions(FacesContext context,
@@ -390,13 +388,14 @@
                 writer.writeAttribute(HTML.LABEL_ATTR, selectItem.getLabel(),
                                       null);
                 SelectItem[] selectItems = ((SelectItemGroup) selectItem)
-                        .getSelectItems();
+                    .getSelectItems();
                 renderSelectOptions(context, component, converter, lookupSet,
                                     Arrays.asList(selectItems));
                 writer.endElement(HTML.OPTGROUP_ELEM);
-            } else {
+            }
+            else {
                 String itemStrValue = org.apache.myfaces.shared.renderkit.RendererUtils.getConvertedStringValue(context, component,
-                                                                            converter, selectItem);
+                                                                                                                converter, selectItem);
 
                 writer.write("\t");
                 writer.startElement(HTML.OPTION_ELEM, component);
@@ -404,7 +403,8 @@
                     writer.writeAttribute(HTML.VALUE_ATTR, itemStrValue, null);
                 }
 
-                if (lookupSet.contains(itemStrValue)) {  //TODO/FIX: we always compare the String vales, better fill lookupSet with Strings only when useSubmittedValue==true, else use the real item value Objects
+                if (lookupSet.contains(itemStrValue))
+                {  //TODO/FIX: we always compare the String vales, better fill lookupSet with Strings only when useSubmittedValue==true, else use the real item value Objects
                     writer.writeAttribute(HTML.SELECTED_ATTR,
                                           HTML.SELECTED_ATTR, null);
                 }
@@ -420,7 +420,8 @@
 
                 if (componentDisabled || disabled) {
                     labelClass = (String) component.getAttributes().get(JSFAttr.DISABLED_CLASS_ATTR);
-                } else {
+                }
+                else {
                     labelClass = (String) component.getAttributes().get(JSFAttr.ENABLED_CLASS_ATTR);
                 }
                 if (labelClass != null) {
@@ -428,21 +429,18 @@
                 }
 
                 boolean escape;
-                if (component instanceof EscapeCapable)
-                {
-                    escape = ((EscapeCapable)component).isEscape();
+                if (component instanceof EscapeCapable) {
+                    escape = ((EscapeCapable) component).isEscape();
                 }
-                else
-                {
+                else {
                     escape = RendererUtils.getBooleanAttribute(component, JSFAttr.ESCAPE_ATTR,
                                                                true); //default is to escape
                 }
 
-                if (escape)
-                {
+                if (escape) {
                     writer.writeText(selectItem.getLabel(), null);
-                } else
-                {
+                }
+                else {
                     writer.write(selectItem.getLabel());
                 }
 
@@ -480,17 +478,17 @@
      */
 
     public static void writePrettyLineSeparator(FacesContext facesContext)
-            throws IOException {
+        throws IOException {
         if (org.apache.myfaces.shared.config.MyfacesConfig.getCurrentInstance(facesContext.getExternalContext())
-                .isPrettyHtml()) {
+            .isPrettyHtml()) {
             facesContext.getResponseWriter().write(LINE_SEPARATOR);
         }
     }
 
     public static void writePrettyIndent(FacesContext facesContext)
-            throws IOException {
+        throws IOException {
         if (org.apache.myfaces.shared.config.MyfacesConfig.getCurrentInstance(facesContext.getExternalContext())
-                .isPrettyHtml()) {
+            .isPrettyHtml()) {
             facesContext.getResponseWriter().write('\t');
         }
     }
@@ -501,11 +499,11 @@
      */
     public static boolean renderHTMLAttribute(ResponseWriter writer,
                                               String componentProperty, String attrName, Object value)
-            throws IOException {
+        throws IOException {
         if (!RendererUtils.isDefaultAttributeValue(value)) {
             // render JSF "styleClass" and "itemStyleClass" attributes as "class"
             String htmlAttrName =
-                    attrName.equals(HTML.STYLE_CLASS_ATTR) ?
+                attrName.equals(HTML.STYLE_CLASS_ATTR) ?
                     HTML.CLASS_ATTR : attrName;
             writer.writeAttribute(htmlAttrName, value, componentProperty);
             return true;
@@ -520,7 +518,7 @@
      */
     public static boolean renderHTMLAttribute(ResponseWriter writer,
                                               UIComponent component, String componentProperty, String htmlAttrName)
-            throws IOException {
+        throws IOException {
         Object value = component.getAttributes().get(componentProperty);
         return renderHTMLAttribute(writer, componentProperty, htmlAttrName,
                                    value);
@@ -543,9 +541,9 @@
     }
 
     public static boolean renderHTMLAttributeWithOptionalStartElement(
-            ResponseWriter writer, UIComponent component, String elementName,
-            String attrName, Object value, boolean startElementWritten)
-            throws IOException {
+        ResponseWriter writer, UIComponent component, String elementName,
+        String attrName, Object value, boolean startElementWritten)
+        throws IOException {
         if (!org.apache.myfaces.shared.renderkit.RendererUtils.isDefaultAttributeValue(value)) {
             if (!startElementWritten) {
                 writer.startElement(elementName, component);
@@ -557,8 +555,8 @@
     }
 
     public static boolean renderHTMLAttributesWithOptionalStartElement(
-            ResponseWriter writer, UIComponent component, String elementName,
-            String[] attributes) throws IOException {
+        ResponseWriter writer, UIComponent component, String elementName,
+        String[] attributes) throws IOException {
         boolean startElementWritten = false;
         for (int i = 0, len = attributes.length; i < len; i++) {
             String attrName = attributes[i];
@@ -576,7 +574,7 @@
 
     public static boolean renderOptionalEndElement(ResponseWriter writer,
                                                    UIComponent component, String elementName, String[] attributes)
-            throws IOException {
+        throws IOException {
         boolean endElementNeeded = false;
         for (int i = 0, len = attributes.length; i < len; i++) {
             String attrName = attributes[i];
@@ -596,47 +594,43 @@
 
     public static void writeIdIfNecessary(ResponseWriter writer, UIComponent component,
                                           FacesContext facesContext)
-            throws IOException
-    {
-        if(component.getId()!=null && !component.getId().startsWith(UIViewRoot.UNIQUE_ID_PREFIX))
-        {
-            writer.writeAttribute(HTML.ID_ATTR, component.getClientId(facesContext),null);
+        throws IOException {
+        if (component.getId() != null && !component.getId().startsWith(UIViewRoot.UNIQUE_ID_PREFIX)) {
+            writer.writeAttribute(HTML.ID_ATTR, component.getClientId(facesContext), null);
         }
     }
 
     public static void renderDisplayValueOnlyForSelects(FacesContext facesContext, UIComponent
-            uiComponent)
-            throws IOException
-    {
+        uiComponent)
+        throws IOException {
         ResponseWriter writer = facesContext.getResponseWriter();
 
-        List selectItemList=null;
-        Converter converter=null;
-        boolean isSelectOne=false;
+        List selectItemList = null;
+        Converter converter = null;
+        boolean isSelectOne = false;
 
-        if(uiComponent instanceof UISelectBoolean)
-        {
+        if (uiComponent instanceof UISelectBoolean) {
             converter = findUIOutputConverterFailSafe(facesContext, uiComponent);
 
             writer.startElement(HTML.SPAN_ELEM, uiComponent);
             writeIdIfNecessary(writer, uiComponent, facesContext);
             renderDisplayValueOnlyAttributes(uiComponent, writer);
-            writer.writeText(RendererUtils.getConvertedStringValue(facesContext,uiComponent,
-                                                                   converter,((UISelectBoolean) uiComponent).getValue()),JSFAttr.VALUE_ATTR);
+            writer.writeText(RendererUtils.getConvertedStringValue(facesContext, uiComponent,
+                                                                   converter, ((UISelectBoolean) uiComponent).getValue()), JSFAttr.VALUE_ATTR);
             writer.endElement(HTML.SPAN_ELEM);
 
         }
-        else
-        {
+        else {
             if (uiComponent instanceof UISelectMany) {
                 isSelectOne = false;
                 selectItemList = RendererUtils
-                        .getSelectItemList((UISelectMany) uiComponent);
+                    .getSelectItemList((UISelectMany) uiComponent);
                 converter = findUISelectManyConverterFailsafe(facesContext, uiComponent);
-            } else if(uiComponent instanceof UISelectOne){
+            }
+            else if (uiComponent instanceof UISelectOne) {
                 isSelectOne = true;
                 selectItemList = RendererUtils
-                        .getSelectItemList((UISelectOne) uiComponent);
+                    .getSelectItemList((UISelectOne) uiComponent);
                 converter = findUIOutputConverterFailSafe(facesContext, uiComponent);
             }
 
@@ -646,8 +640,8 @@
             renderDisplayValueOnlyAttributes(uiComponent, writer);
 
             Set lookupSet = getSubmittedOrSelectedValuesAsSet(
-                    uiComponent instanceof UISelectMany,
-                    uiComponent, facesContext, converter);
+                uiComponent instanceof UISelectMany,
+                uiComponent, facesContext, converter);
 
             renderSelectOptionsAsText(facesContext, uiComponent, converter, lookupSet,
                                       selectItemList, isSelectOne);
@@ -660,8 +654,7 @@
     }
 
     public static void renderDisplayValueOnlyAttributes(UIComponent uiComponent, ResponseWriter writer) throws IOException {
-        if(!(uiComponent instanceof org.apache.myfaces.shared.component.DisplayValueOnlyCapable))
-        {
+        if (!(uiComponent instanceof org.apache.myfaces.shared.component.DisplayValueOnlyCapable)) {
             log.error("Wrong type of uiComponent. needs DisplayValueOnlyCapable.");
             renderHTMLAttributes(writer, uiComponent,
                                  HTML.COMMON_PASSTROUGH_ATTRIBUTES);
@@ -669,31 +662,25 @@
             return;
         }
 
-        if(getDisplayValueOnlyStyle(uiComponent) != null || getDisplayValueOnlyStyleClass(uiComponent)!=null)
-        {
-            if(getDisplayValueOnlyStyle(uiComponent) != null )
-            {
+        if (getDisplayValueOnlyStyle(uiComponent) != null || getDisplayValueOnlyStyleClass(uiComponent) != null) {
+            if (getDisplayValueOnlyStyle(uiComponent) != null) {
                 writer.writeAttribute(HTML.STYLE_ATTR, getDisplayValueOnlyStyle(uiComponent), null);
             }
-            else if(uiComponent.getAttributes().get("style")!=null)
-            {
+            else if (uiComponent.getAttributes().get("style") != null) {
                 writer.writeAttribute(HTML.STYLE_ATTR, uiComponent.getAttributes().get("style"), null);
             }
 
-            if(getDisplayValueOnlyStyleClass(uiComponent) != null )
-            {
+            if (getDisplayValueOnlyStyleClass(uiComponent) != null) {
                 writer.writeAttribute(HTML.CLASS_ATTR, getDisplayValueOnlyStyleClass(uiComponent), null);
             }
-            else if(uiComponent.getAttributes().get("styleClass")!=null)
-            {
+            else if (uiComponent.getAttributes().get("styleClass") != null) {
                 writer.writeAttribute(HTML.CLASS_ATTR, uiComponent.getAttributes().get("styleClass"), null);
             }
 
             renderHTMLAttributes(writer, uiComponent,
                                  HTML.COMMON_PASSTROUGH_ATTRIBUTES_WITHOUT_STYLE);
         }
-        else
-        {
+        else {
             renderHTMLAttributes(writer, uiComponent,
                                  HTML.COMMON_PASSTROUGH_ATTRIBUTES);
         }
@@ -709,23 +696,24 @@
 
             if (selectItem instanceof SelectItemGroup) {
                 SelectItem[] selectItems = ((SelectItemGroup) selectItem)
-                        .getSelectItems();
+                    .getSelectItems();
                 renderSelectOptionsAsText(context, component, converter, lookupSet,
                                           Arrays.asList(selectItems), isSelectOne);
-            } else {
+            }
+            else {
                 String itemStrValue = RendererUtils.getConvertedStringValue(context, component,
                                                                             converter, selectItem);
 
-                if (lookupSet.contains(itemStrValue)) {  //TODO/FIX: we always compare the String vales, better fill lookupSet with Strings only when useSubmittedValue==true, else use the real item value Objects
+                if (lookupSet.contains(itemStrValue))
+                {  //TODO/FIX: we always compare the String vales, better fill lookupSet with Strings only when useSubmittedValue==true, else use the real item value Objects
 
-                    if( ! isSelectOne )
+                    if (! isSelectOne)
                         writer.startElement(HTML.LI_ELEM, component);
                     writer.writeText(selectItem.getLabel(), null);
-                    if( ! isSelectOne )
+                    if (! isSelectOne)
                         writer.endElement(HTML.LI_ELEM);
 
-                    if( isSelectOne )
-                    {
+                    if (isSelectOne) {
                         //take care of several choices with the same value; use only the first one
                         return;
                     }
@@ -736,17 +724,15 @@
 
     public static String getDisplayValueOnlyStyleClass(UIComponent component) {
 
-        if(component instanceof org.apache.myfaces.shared.component.DisplayValueOnlyCapable)
-        {
-            if(((org.apache.myfaces.shared.component.DisplayValueOnlyCapable) component).getDisplayValueOnlyStyleClass()!=null)
+        if (component instanceof org.apache.myfaces.shared.component.DisplayValueOnlyCapable) {
+            if (((org.apache.myfaces.shared.component.DisplayValueOnlyCapable) component).getDisplayValueOnlyStyleClass() != null)
                 return ((org.apache.myfaces.shared.component.DisplayValueOnlyCapable) component).getDisplayValueOnlyStyleClass();
 
-            UIComponent parent=component;
+            UIComponent parent = component;
 
-            while((parent = parent.getParent())!=null)
-            {
-                if(parent instanceof org.apache.myfaces.shared.component.DisplayValueOnlyCapable &&
-                   ((org.apache.myfaces.shared.component.DisplayValueOnlyCapable) parent).getDisplayValueOnlyStyleClass()!=null)
+            while ((parent = parent.getParent()) != null) {
+                if (parent instanceof org.apache.myfaces.shared.component.DisplayValueOnlyCapable &&
+                    ((org.apache.myfaces.shared.component.DisplayValueOnlyCapable) parent).getDisplayValueOnlyStyleClass() != null)
                 {
                     return ((org.apache.myfaces.shared.component.DisplayValueOnlyCapable) parent).getDisplayValueOnlyStyleClass();
                 }
@@ -758,18 +744,15 @@
 
     public static String getDisplayValueOnlyStyle(UIComponent component) {
 
-        if(component instanceof DisplayValueOnlyCapable)
-        {
-            if(((org.apache.myfaces.shared.component.DisplayValueOnlyCapable) component).getDisplayValueOnlyStyle()!=null)
+        if (component instanceof DisplayValueOnlyCapable) {
+            if (((org.apache.myfaces.shared.component.DisplayValueOnlyCapable) component).getDisplayValueOnlyStyle() != null)
                 return ((org.apache.myfaces.shared.component.DisplayValueOnlyCapable) component).getDisplayValueOnlyStyle();
 
-            UIComponent parent=component;
+            UIComponent parent = component;
 
-            while((parent = parent.getParent())!=null)
-            {
-                if(parent instanceof org.apache.myfaces.shared.component.DisplayValueOnlyCapable &&
-                   ((DisplayValueOnlyCapable) parent).getDisplayValueOnlyStyle()!=null)
-                {
+            while ((parent = parent.getParent()) != null) {
+                if (parent instanceof org.apache.myfaces.shared.component.DisplayValueOnlyCapable &&
+                    ((DisplayValueOnlyCapable) parent).getDisplayValueOnlyStyle() != null) {
                     return ((DisplayValueOnlyCapable) parent).getDisplayValueOnlyStyle();
                 }
             }
@@ -780,18 +763,15 @@
 
     public static boolean isDisplayValueOnly(UIComponent component) {
 
-        if(component instanceof DisplayValueOnlyCapable)
-        {
-            if(((DisplayValueOnlyCapable) component).isSetDisplayValueOnly())
+        if (component instanceof DisplayValueOnlyCapable) {
+            if (((DisplayValueOnlyCapable) component).isSetDisplayValueOnly())
                 return ((org.apache.myfaces.shared.component.DisplayValueOnlyCapable) component).isDisplayValueOnly();
 
-            UIComponent parent=component;
+            UIComponent parent = component;
 
-            while((parent = parent.getParent())!=null)
-            {
-                if(parent instanceof DisplayValueOnlyCapable &&
-                   ((DisplayValueOnlyCapable) parent).isSetDisplayValueOnly())
-                {
+            while ((parent = parent.getParent()) != null) {
+                if (parent instanceof DisplayValueOnlyCapable &&
+                    ((DisplayValueOnlyCapable) parent).isSetDisplayValueOnly()) {
                     return ((org.apache.myfaces.shared.component.DisplayValueOnlyCapable) parent).isDisplayValueOnly();
                 }
             }
@@ -809,13 +789,12 @@
         renderDisplayValueOnlyAttributes(input, writer);
 
         String strValue = RendererUtils.getStringValue(facesContext, input);
-        writer.write( HTMLEncoder.encode(strValue, true, true) );
+        writer.write(HTMLEncoder.encode(strValue, true, true));
 
         writer.endElement(HTML.SPAN_ELEM);
     }
 
-    public static void appendClearHiddenCommandFormParamsFunctionCall(StringBuffer onClick, String formName)
-    {
+    public static void appendClearHiddenCommandFormParamsFunctionCall(StringBuffer onClick, String formName) {
         onClick.append("if(window.");
         onClick.append(HtmlRendererUtils.getClearHiddenCommandFormParamsFunctionName(formName));
         onClick.append("!=undefined) {");
@@ -855,14 +834,12 @@
     }
 
     public static void renderHiddenInputField(ResponseWriter writer, Object name, Object value)
-            throws IOException
-    {
+        throws IOException {
         writer.startElement(HTML.INPUT_ELEM, null);
         writer.writeAttribute(HTML.TYPE_ATTR, HTML.INPUT_TYPE_HIDDEN, null);
         writer.writeAttribute(HTML.NAME_ATTR, name, null);
-        if(value!=null)
-        {
-            writer.writeAttribute(HTML.VALUE_ATTR,value,null);
+        if (value != null) {
+            writer.writeAttribute(HTML.VALUE_ATTR, value, null);
         }
         writer.endElement(HTML.INPUT_ELEM);
     }
@@ -880,8 +857,8 @@
      * @throws IOException
      */
     public static void renderClearHiddenCommandFormParamsFunction(
-            ResponseWriter writer, String formName, Set dummyFormParams,
-            String formTarget) throws IOException {
+        ResponseWriter writer, String formName, Set dummyFormParams,
+        String formTarget) throws IOException {
         //render the clear hidden inputs javascript function
         String functionName = getClearHiddenCommandFormParamsFunctionName(formName);
         writer.startElement(HTML.SCRIPT_ELEM, null);
@@ -911,7 +888,8 @@
             //desired effect, but once again IE is different...
             //Setting target to null causes IE to open a new window!
             script.append("'';");
-        } else {
+        }
+        else {
             script.append("'");
             script.append(formTarget);
             script.append("';");
@@ -925,7 +903,7 @@
         script.append(functionName);
         script.append("();");
 
-        writer.writeText(script.toString(),null);
+        writer.writeText(script.toString(), null);
         writer.endElement(HTML.SCRIPT_ELEM);
     }
 
@@ -936,32 +914,35 @@
      * @return String
      */
     public static String getClearHiddenCommandFormParamsFunctionName(
-            String formName) {
+        String formName) {
         return JavascriptUtils.getValidJavascriptNameAsInRI(CLEAR_HIDDEN_FIELD_FN_NAME
-                                             + "_"
-                                             + formName
-                    .replace(NamingContainer.SEPARATOR_CHAR, '_'));
+            + "_"
+            + formName
+            .replace(NamingContainer.SEPARATOR_CHAR, '_'));
     }
 
     /**
      * Get the name of the request parameter that holds the id of the
      * link-type component that caused the form to be submitted.
-     * <p>
+     * <p/>
      * Within each page there may be multiple "link" type components that
      * cause page submission. On the server it is necessary to know which
      * of these actually caused the submit, in order to invoke the correct
      * listeners. Such components therefore store their id into the
-     * "hidden command link field" in their associated form before 
-     * submitting it. 
-     * <p>
+     * "hidden command link field" in their associated form before
+     * submitting it.
+     * <p/>
      * The field is always a direct child of each form, and has the same
      * <i>name</i> in each form. The id of the form component is therefore
      * both necessary and sufficient to determine the full name of the
      * field.
      */
-    public static String getHiddenCommandLinkFieldName(String formName) {
-        return formName + NamingContainer.SEPARATOR_CHAR
-               + HIDDEN_COMMANDLINK_FIELD_NAME;
+    public static String getHiddenCommandLinkFieldName(FormInfo formInfo) {
+        if (RendererUtils.isAdfOrTrinidadForm(formInfo.getForm())) {
+            return HIDDEN_COMMANDLINK_FIELD_NAME_TRINIDAD;
+        }
+        return formInfo.getFormName() + NamingContainer.SEPARATOR_CHAR
+            + HIDDEN_COMMANDLINK_FIELD_NAME;
     }
 
     private static String HTML_CONTENT_TYPE = "text/html";
@@ -973,19 +954,15 @@
     private static String TEXT_XML_CONTENT_TYPE = "text/xml";
 
 
-    public static String selectContentType(String contentTypeListString)
-    {
-        if (contentTypeListString == null)
-        {
+    public static String selectContentType(String contentTypeListString) {
+        if (contentTypeListString == null) {
             FacesContext context = FacesContext.getCurrentInstance();
-            if(context != null)
-            {
+            if (context != null) {
                 contentTypeListString = (String)
-					context.getExternalContext().getRequestHeaderMap().get("Accept");
+                    context.getExternalContext().getRequestHeaderMap().get("Accept");
             }
 
-            if(contentTypeListString == null)
-            {
+            if (contentTypeListString == null) {
                 if (log.isDebugEnabled())
                     log.debug("No content type list given, creating HtmlResponseWriterImpl with default content type.");
 
@@ -998,16 +975,13 @@
 
         String selectedContentType = null;
 
-        for (int i = 0; i < supportedContentTypeArray.length; i++)
-        {
+        for (int i = 0; i < supportedContentTypeArray.length; i++) {
             String supportedContentType = supportedContentTypeArray[i].trim();
 
-            for (int j = 0; j < contentTypeList.size(); j++)
-            {
+            for (int j = 0; j < contentTypeList.size(); j++) {
                 String contentType = (String) contentTypeList.get(j);
 
-                if (contentType.indexOf(supportedContentType) != -1)
-                {
+                if (contentType.indexOf(supportedContentType) != -1) {
                     if (isHTMLContentType(contentType)) {
                         selectedContentType = HTML_CONTENT_TYPE;
                     }
@@ -1018,55 +992,47 @@
                     break;
                 }
             }
-            if (selectedContentType!=null)
-            {
+            if (selectedContentType != null) {
                 break;
             }
         }
 
-        if(selectedContentType==null)
-        {
+        if (selectedContentType == null) {
             throw new IllegalArgumentException("ContentTypeList does not contain a supported content type: " +
-                                               contentTypeListString);
+                contentTypeListString);
         }
         return selectedContentType;
     }
 
-    public static String[] getSupportedContentTypes()
-    {
+    public static String[] getSupportedContentTypes() {
         //noinspection UnnecessaryLocalVariable
-        String[] supportedContentTypeArray = new String[]{HTML_CONTENT_TYPE,ANY_CONTENT_TYPE,
-                                                          XHTML_CONTENT_TYPE,APPLICATION_XML_CONTENT_TYPE,TEXT_XML_CONTENT_TYPE};
+        String[] supportedContentTypeArray = new String[]{HTML_CONTENT_TYPE, ANY_CONTENT_TYPE,
+                                                          XHTML_CONTENT_TYPE, APPLICATION_XML_CONTENT_TYPE, TEXT_XML_CONTENT_TYPE};
         return supportedContentTypeArray;
     }
 
-    private static boolean isHTMLContentType(String contentType)
-    {
+    private static boolean isHTMLContentType(String contentType) {
         return contentType.indexOf(HTML_CONTENT_TYPE) != -1 ||
-               contentType.indexOf(ANY_CONTENT_TYPE) != -1;
+            contentType.indexOf(ANY_CONTENT_TYPE) != -1;
     }
 
-    public static boolean isXHTMLContentType(String contentType)
-    {
+    public static boolean isXHTMLContentType(String contentType) {
         return contentType.indexOf(XHTML_CONTENT_TYPE) != -1 ||
-               contentType.indexOf(APPLICATION_XML_CONTENT_TYPE) != -1 ||
-               contentType.indexOf(TEXT_XML_CONTENT_TYPE) != -1;
+            contentType.indexOf(APPLICATION_XML_CONTENT_TYPE) != -1 ||
+            contentType.indexOf(TEXT_XML_CONTENT_TYPE) != -1;
     }
 
-    private static List splitContentTypeListString(String contentTypeListString)
-    {
+    private static List splitContentTypeListString(String contentTypeListString) {
         List contentTypeList = new ArrayList();
 
         StringTokenizer st = new StringTokenizer(contentTypeListString, ",");
-        while (st.hasMoreTokens())
-        {
+        while (st.hasMoreTokens()) {
             String contentType = st.nextToken().trim();
 
             int semicolonIndex = contentType.indexOf(";");
 
-            if (semicolonIndex!=-1)
-            {
-                contentType = contentType.substring(0,semicolonIndex);
+            if (semicolonIndex != -1) {
+                contentType = contentType.substring(0, semicolonIndex);
             }
 
             contentTypeList.add(contentType);
@@ -1075,27 +1041,24 @@
         return contentTypeList;
     }
 
-    public static String getJavascriptLocation(UIComponent component)
-    {
-        if(component==null)
+    public static String getJavascriptLocation(UIComponent component) {
+        if (component == null)
             return null;
 
-        return (String)component.getAttributes().get(JSFAttr.JAVASCRIPT_LOCATION);
+        return (String) component.getAttributes().get(JSFAttr.JAVASCRIPT_LOCATION);
     }
 
-    public static String getImageLocation(UIComponent component)
-    {
-        if(component==null)
+    public static String getImageLocation(UIComponent component) {
+        if (component == null)
             return null;
 
-        return (String)component.getAttributes().get(JSFAttr.IMAGE_LOCATION);
+        return (String) component.getAttributes().get(JSFAttr.IMAGE_LOCATION);
     }
 
-    public static String getStyleLocation(UIComponent component)
-    {
-        if(component==null)
+    public static String getStyleLocation(UIComponent component) {
+        if (component == null)
             return null;
 
-        return (String)component.getAttributes().get(JSFAttr.STYLE_LOCATION);
+        return (String) component.getAttributes().get(JSFAttr.STYLE_LOCATION);
     }
 }

Modified: myfaces/tomahawk/trunk/core/src/main/java/org/apache/myfaces/custom/navmenu/jscookmenu/HtmlJSCookMenuRenderer.java
URL: http://svn.apache.org/viewvc/myfaces/tomahawk/trunk/core/src/main/java/org/apache/myfaces/custom/navmenu/jscookmenu/HtmlJSCookMenuRenderer.java?rev=434574&r1=434573&r2=434574&view=diff
==============================================================================
--- myfaces/tomahawk/trunk/core/src/main/java/org/apache/myfaces/custom/navmenu/jscookmenu/HtmlJSCookMenuRenderer.java (original)
+++ myfaces/tomahawk/trunk/core/src/main/java/org/apache/myfaces/custom/navmenu/jscookmenu/HtmlJSCookMenuRenderer.java Thu Aug 24 16:52:09 2006
@@ -51,8 +51,7 @@
  * @version $Revision$ $Date$
  */
 public class HtmlJSCookMenuRenderer
-    extends HtmlRenderer
-{
+    extends HtmlRenderer {
     private static final String MYFACES_HACK_SCRIPT = "MyFacesHack.js";
 
     private static final String JSCOOK_MENU_SCRIPT = "JSCookMenu.js";
@@ -63,6 +62,7 @@
     private static final Class[] ACTION_LISTENER_ARGS = {ActionEvent.class};
 
     private static final Map builtInThemes = new java.util.HashMap();
+
     static {
         builtInThemes.put("ThemeOffice", "ThemeOffice/");
         builtInThemes.put("ThemeMiniBlack", "ThemeMiniBlack/");
@@ -70,19 +70,16 @@
         builtInThemes.put("ThemePanel", "ThemePanel/");
     }
 
-    public void decode(FacesContext context, UIComponent component)
-    {
+    public void decode(FacesContext context, UIComponent component) {
         RendererUtils.checkParamValidity(context, component, HtmlCommandJSCookMenu.class);
 
         Map parameter = context.getExternalContext().getRequestParameterMap();
-        String actionParam = (String)parameter.get(JSCOOK_ACTION_PARAM);
+        String actionParam = (String) parameter.get(JSCOOK_ACTION_PARAM);
         if (actionParam != null && !actionParam.trim().equals("") &&
-            !actionParam.trim().equals("null"))
-        {
-            String compId = getMenuId(context,component);
+            !actionParam.trim().equals("null")) {
+            String compId = getMenuId(context, component);
             StringTokenizer tokenizer = new StringTokenizer(actionParam, ":");
-            if (tokenizer.countTokens() > 1)
-            {
+            if (tokenizer.countTokens() > 1) {
                 String actionId = tokenizer.nextToken();
                 if (! compId.equals(actionId)) {
                     return;
@@ -90,7 +87,7 @@
                 while (tokenizer.hasMoreTokens()) {
                     String action = tokenizer.nextToken();
                     if (action.startsWith("A]")) {
-                        action  = action.substring(2, action.length());
+                        action = action.substring(2, action.length());
                         action = decodeValueBinding(action, context);
                         MethodBinding mb;
                         if (NavigationMenuUtils.isValueReference(action)) {
@@ -99,23 +96,23 @@
                         else {
                             mb = new SimpleActionMethodBinding(action);
                         }
-                        ((HtmlCommandJSCookMenu)component).setAction(mb);
+                        ((HtmlCommandJSCookMenu) component).setAction(mb);
                     }
                     else if (action.startsWith("L]")) {
-                        action  = action.substring(2, action.length());
+                        action = action.substring(2, action.length());
                         String value = null;
                         int idx = action.indexOf(";");
-                        if (idx > 0 && idx < action.length()-1) {
+                        if (idx > 0 && idx < action.length() - 1) {
                             value = action.substring(idx + 1, action.length());
                             action = action.substring(0, idx);
-                            ((HtmlCommandJSCookMenu)component).setValue(value);
+                            ((HtmlCommandJSCookMenu) component).setValue(value);
                         }
                         MethodBinding mb;
                         if (NavigationMenuUtils.isValueReference(action)) {
                             mb = context.getApplication().createMethodBinding(action, ACTION_LISTENER_ARGS);
-                            ((HtmlCommandJSCookMenu)component).setActionListener(mb);
+                            ((HtmlCommandJSCookMenu) component).setActionListener(mb);
                             if (value != null)
-                                ((HtmlCommandJSCookMenu)component).setValue(value);
+                                ((HtmlCommandJSCookMenu) component).setValue(value);
                         }
                     }
                 }
@@ -124,8 +121,7 @@
         }
     }
 
-    private String decodeValueBinding(String actionParam, FacesContext context)
-    {
+    private String decodeValueBinding(String actionParam, FacesContext context) {
         int idx = actionParam.indexOf(";#{");
         if (idx == -1) {
             return actionParam;
@@ -148,21 +144,19 @@
         return newActionParam;
     }
 
-    public boolean getRendersChildren()
-    {
+    public boolean getRendersChildren() {
         return true;
     }
 
-    public void encodeChildren(FacesContext context, UIComponent component) throws IOException
-    {
+    public void encodeChildren(FacesContext context, UIComponent component) throws IOException {
         RendererUtils.checkParamValidity(context, component, HtmlCommandJSCookMenu.class);
 
         List list = NavigationMenuUtils.getNavigationMenuItemList(component);
-        if (list.size() > 0)
-        {
+        if (list.size() > 0) {
             FormInfo parentFormInfo = RendererUtils.findNestingForm(component, context);
+            ResponseWriter writer = context.getResponseWriter();
 
-            if(parentFormInfo == null)
+            if (parentFormInfo == null)
                 throw new FacesException("jscook menu is not embedded in a form.");
             String formName = parentFormInfo.getFormName();
             List uiNavMenuItemList = component.getChildren();
@@ -174,15 +168,22 @@
                 formName = DummyFormUtils.getDummyFormName();
             }
             else {*/
-                HtmlFormRendererBase.addHiddenCommandParameter(context,parentFormInfo.getForm(),JSCOOK_ACTION_PARAM);
+            if (RendererUtils.isAdfOrTrinidadForm(parentFormInfo.getForm())) {
+                // need to add hidden input, cause MyFaces form is missing hence will not render hidden inputs
+                writer.write("<input type=\"hidden\" name=\"");
+                writer.write(JSCOOK_ACTION_PARAM);
+                writer.write("\" />");
+            }
+            else {
+                HtmlFormRendererBase.addHiddenCommandParameter(context, parentFormInfo.getForm(), JSCOOK_ACTION_PARAM);
+            }
+
             //}
 
             String myId = getMenuId(context, component);
 
-            ResponseWriter writer = context.getResponseWriter();
-
-            writer.startElement(HTML.SCRIPT_ELEM,component);
-            writer.writeAttribute(HTML.SCRIPT_TYPE_ATTR,HTML.SCRIPT_TYPE_TEXT_JAVASCRIPT, null);
+            writer.startElement(HTML.SCRIPT_ELEM, component);
+            writer.writeAttribute(HTML.SCRIPT_TYPE_ATTR, HTML.SCRIPT_TYPE_TEXT_JAVASCRIPT, null);
             StringBuffer script = new StringBuffer();
             script.append("var ").append(getMenuId(context, component)).append(" =\n[");
             encodeNavigationMenuItems(context, script,
@@ -191,7 +192,7 @@
                                       myId, formName);
 
             script.append("];");
-            writer.writeText(script.toString(),null);
+            writer.writeText(script.toString(), null);
             writer.endElement(HTML.SCRIPT_ELEM);
         }
     }
@@ -201,10 +202,8 @@
                                            NavigationMenuItem[] items,
                                            List uiNavMenuItemList,
                                            String menuId, String formName)
-        throws IOException
-    {
-        for (int i = 0; i < items.length; i++)
-        {
+        throws IOException {
+        for (int i = 0; i < items.length; i++) {
             NavigationMenuItem item = items[i];
             Object tempObj = null;
             UINavigationMenuItem uiNavMenuItem = null;
@@ -221,60 +220,50 @@
                 continue;
             }
 
-            if (i > 0)
-            {
+            if (i > 0) {
                 writer.append(",\n");
             }
 
-            if (item.isSplit())
-            {
+            if (item.isSplit()) {
                 writer.append("_cmSplit,");
 
-                if (item.getLabel().equals("0"))
-                {
+                if (item.getLabel().equals("0")) {
                     continue;
                 }
             }
 
             writer.append("[");
-            if (item.getIcon() != null)
-            {
+            if (item.getIcon() != null) {
                 String iconSrc = context.getApplication().getViewHandler().getResourceURL(context, item.getIcon());
                 writer.append("'<img src=\"");
                 writer.append(context.getExternalContext().encodeResourceURL(iconSrc));
                 writer.append("\"/>'");
             }
-            else
-            {
+            else {
                 writer.append("null");
             }
             writer.append(", '");
-            if( item.getLabel() != null ) {
-                writer.append(getString(context,item.getLabel()));
+            if (item.getLabel() != null) {
+                writer.append(getString(context, item.getLabel()));
             }
             writer.append("', ");
             StringBuffer actionStr = new StringBuffer();
-            if ((item.getAction() != null || item.getActionListener() != null) && ! item.isDisabled())
-            {
+            if ((item.getAction() != null || item.getActionListener() != null) && ! item.isDisabled()) {
                 actionStr.append("'");
                 actionStr.append(menuId);
-                if (item.getActionListener() != null)
-                {
+                if (item.getActionListener() != null) {
                     actionStr.append(":L]");
                     actionStr.append(item.getActionListener());
-                    if (uiNavMenuItem != null && uiNavMenuItem.getItemValue() != null)
-                    {
+                    if (uiNavMenuItem != null && uiNavMenuItem.getItemValue() != null) {
                         actionStr.append(';');
-                        actionStr.append(getString(context,uiNavMenuItem.getItemValue()));
+                        actionStr.append(getString(context, uiNavMenuItem.getItemValue()));
                     }
-                    else if (item.getValue() != null)
-                    {
+                    else if (item.getValue() != null) {
                         actionStr.append(';');
-                        actionStr.append(getString(context,item.getValue()));
+                        actionStr.append(getString(context, item.getValue()));
                     }
                 }
-                if (item.getAction() != null)
-                {
+                if (item.getAction() != null) {
                     actionStr.append(":A]");
                     actionStr.append(item.getAction());
                     if (uiNavMenuItem != null) {
@@ -284,8 +273,7 @@
                 actionStr.append("'");
                 writer.append(actionStr.toString());
             }
-            else
-            {
+            else {
                 writer.append("null");
             }
             writer.append(", '");
@@ -296,14 +284,13 @@
             if (item.isRendered() && ! item.isDisabled()) {
                 // render children only if parent is visible/enabled
                 NavigationMenuItem[] menuItems = item.getNavigationMenuItems();
-                if (menuItems != null && menuItems.length > 0)
-                {
+                if (menuItems != null && menuItems.length > 0) {
                     writer.append(",");
-                    if (uiNavMenuItem != null)
-                    {
+                    if (uiNavMenuItem != null) {
                         encodeNavigationMenuItems(context, writer, menuItems,
                                                   uiNavMenuItem.getChildren(), menuId, formName);
-                    } else {
+                    }
+                    else {
                         encodeNavigationMenuItems(context, writer, menuItems,
                                                   new ArrayList(1), menuId, formName);
                     }
@@ -313,25 +300,20 @@
         }
     }
 
-    private String getString(FacesContext facesContext, Object value)
-    {
+    private String getString(FacesContext facesContext, Object value) {
         String str = "";
 
-        if(value!=null)
-        {
+        if (value != null) {
             str = value.toString();
         }
 
-        if(NavigationMenuUtils.isValueReference(str))
-        {
+        if (NavigationMenuUtils.isValueReference(str)) {
             value = facesContext.getApplication().createValueBinding(str).getValue(facesContext);
 
-            if(value != null)
-            {
+            if (value != null) {
                 str = value.toString();
             }
-            else
-            {
+            else {
                 str = "";
             }
         }
@@ -340,8 +322,7 @@
     }
 
     private void encodeValueBinding(StringBuffer writer, UINavigationMenuItem uiNavMenuItem,
-                                    NavigationMenuItem item)
-    {
+                                    NavigationMenuItem item) {
         ValueBinding vb = uiNavMenuItem.getValueBinding("NavMenuItemValue");
         if (vb == null) {
             return;
@@ -361,22 +342,20 @@
         writer.append(tempObj.toString());
     }
 
-    public void encodeBegin(FacesContext context, UIComponent component) throws IOException
-    {
-        HtmlCommandJSCookMenu menu = (HtmlCommandJSCookMenu)component;
+    public void encodeBegin(FacesContext context, UIComponent component) throws IOException {
+        HtmlCommandJSCookMenu menu = (HtmlCommandJSCookMenu) component;
         String theme = menu.getTheme();
         if (theme == null) {
-                // should never happen; theme is a required attribute in the jsp tag definition
+            // should never happen; theme is a required attribute in the jsp tag definition
             throw new IllegalArgumentException("theme name is mandatory for a jscookmenu.");
         }
 
-        addResourcesToHeader(theme,menu,context);
+        addResourcesToHeader(theme, menu, context);
     }
 
-    public void encodeEnd(FacesContext context, UIComponent component) throws IOException
-    {
+    public void encodeEnd(FacesContext context, UIComponent component) throws IOException {
         RendererUtils.checkParamValidity(context, component, HtmlCommandJSCookMenu.class);
-        HtmlCommandJSCookMenu menu = (HtmlCommandJSCookMenu)component;
+        HtmlCommandJSCookMenu menu = (HtmlCommandJSCookMenu) component;
         String theme = menu.getTheme();
 
 
@@ -387,41 +366,38 @@
         writer.write("<div id=\"");
         writer.write(menuId);
         writer.write("\"></div>\n");
-        writer.startElement(HTML.SCRIPT_ELEM,menu);
-        writer.writeAttribute(HTML.SCRIPT_TYPE_ATTR,HTML.SCRIPT_TYPE_TEXT_JAVASCRIPT,null);
+        writer.startElement(HTML.SCRIPT_ELEM, menu);
+        writer.writeAttribute(HTML.SCRIPT_TYPE_ATTR, HTML.SCRIPT_TYPE_TEXT_JAVASCRIPT, null);
 
         StringBuffer buf = new StringBuffer();
         buf.append("\tif(window.cmDraw!=undefined) { cmDraw ('").
-                append(menuId).
-                append("', ").
-                append(menuId).
-                append(", '").
-                append(menu.getLayout()).
-                append("', cm").
-                append(theme).
-                append(", '").
-                append(theme).
-                append("');}");
+            append(menuId).
+            append("', ").
+            append(menuId).
+            append(", '").
+            append(menu.getLayout()).
+            append("', cm").
+            append(theme).
+            append(", '").
+            append(theme).
+            append("');}");
 
-        writer.writeText(buf.toString(),null);
+        writer.writeText(buf.toString(), null);
         writer.endElement(HTML.SCRIPT_ELEM);
     }
 
-    private void addResourcesToHeader(String themeName, HtmlCommandJSCookMenu menu, FacesContext context)
-    {
+    private void addResourcesToHeader(String themeName, HtmlCommandJSCookMenu menu, FacesContext context) {
         String javascriptLocation = (String) menu.getAttributes().get(JSFAttr.JAVASCRIPT_LOCATION);
         String imageLocation = (String) menu.getAttributes().get(JSFAttr.IMAGE_LOCATION);
         String styleLocation = (String) menu.getAttributes().get(JSFAttr.STYLE_LOCATION);
 
         AddResource addResource = AddResourceFactory.getInstance(context);
 
-        if(javascriptLocation != null)
-        {
+        if (javascriptLocation != null) {
             addResource.addJavaScriptAtPosition(context, AddResource.HEADER_BEGIN, javascriptLocation + "/" + JSCOOK_MENU_SCRIPT);
             addResource.addJavaScriptAtPosition(context, AddResource.HEADER_BEGIN, javascriptLocation + "/" + MYFACES_HACK_SCRIPT);
         }
-        else
-        {
+        else {
             addResource.addJavaScriptAtPosition(context, AddResource.HEADER_BEGIN, HtmlJSCookMenuRenderer.class, JSCOOK_MENU_SCRIPT);
             addResource.addJavaScriptAtPosition(context, AddResource.HEADER_BEGIN, HtmlJSCookMenuRenderer.class, MYFACES_HACK_SCRIPT);
         }
@@ -432,50 +408,43 @@
     /**
      * A theme for a menu requires a number of external files; this method
      * outputs those into the page head section.
-     * 
-     * @param themeName is the name of the theme for this menu. It is never
-     * null. It may match one of the built-in theme names or may be a custom
-     * theme defined by the application.
      *
-     * @param styleLocation is the URL of a directory containing a 
-     * "theme.css" file. A stylesheet link tag will be inserted into
-     * the page header referencing that file. If null then if the
-     * themeName is a built-in one then a reference to the appropriate
-     * built-in stylesheet is generated (requires the ExtensionsFilter).
-     * If null and a custom theme is used then no stylesheet link will be 
-     * generated here.
-     * 
-     * @param javascriptLocation is the URL of a directory containing a 
-     * "theme.js" file. A script tag will be inserted into the page header
-     * referencing that file. If null then if the themeName is a built-in
-     * one then a reference to the built-in stylesheet is generated (requires
-     * the ExtensionsFilter). If null and a custom theme is used then no
-     * stylesheet link will be generated here.
-     * 
-     * @param imageLocation is the URL of a directory containing files
-     * (esp. image files) used by the theme.js file to define the menu
-     * theme. A javascript variable of name "my{themeName}Base" is
-     * generated in the page header containing this URL, so that the
-     * theme.js script can locate the files. If null then if the themeName
-     * is a built-in one then the URL to the appropriate resource directory
-     * is generated (requires the ExtensionsFilter). If null and a custom
-     * theme is used then no javascript variable will be generated here.
-     * 
-     * @param context is the current faces context.
+     * @param themeName          is the name of the theme for this menu. It is never
+     *                           null. It may match one of the built-in theme names or may be a custom
+     *                           theme defined by the application.
+     * @param styleLocation      is the URL of a directory containing a
+     *                           "theme.css" file. A stylesheet link tag will be inserted into
+     *                           the page header referencing that file. If null then if the
+     *                           themeName is a built-in one then a reference to the appropriate
+     *                           built-in stylesheet is generated (requires the ExtensionsFilter).
+     *                           If null and a custom theme is used then no stylesheet link will be
+     *                           generated here.
+     * @param javascriptLocation is the URL of a directory containing a
+     *                           "theme.js" file. A script tag will be inserted into the page header
+     *                           referencing that file. If null then if the themeName is a built-in
+     *                           one then a reference to the built-in stylesheet is generated (requires
+     *                           the ExtensionsFilter). If null and a custom theme is used then no
+     *                           stylesheet link will be generated here.
+     * @param imageLocation      is the URL of a directory containing files
+     *                           (esp. image files) used by the theme.js file to define the menu
+     *                           theme. A javascript variable of name "my{themeName}Base" is
+     *                           generated in the page header containing this URL, so that the
+     *                           theme.js script can locate the files. If null then if the themeName
+     *                           is a built-in one then the URL to the appropriate resource directory
+     *                           is generated (requires the ExtensionsFilter). If null and a custom
+     *                           theme is used then no javascript variable will be generated here.
+     * @param context            is the current faces context.
      */
     private void addThemeSpecificResources(String themeName, String styleLocation,
-                                           String javascriptLocation, String imageLocation, FacesContext context)
-    {
+                                           String javascriptLocation, String imageLocation, FacesContext context) {
         String themeLocation = (String) builtInThemes.get(themeName);
-        if(themeLocation == null)
-        {
+        if (themeLocation == null) {
             log.debug("Unknown theme name '" + themeName + "' specified.");
         }
 
         AddResource addResource = AddResourceFactory.getInstance(context);
 
-        if ((imageLocation != null) || (themeLocation != null))
-        {
+        if ((imageLocation != null) || (themeLocation != null)) {
             // Generate a javascript variable containing a reference to the
             // directory containing theme image files, for use by the theme
             // javascript file. If neither of these is defined (ie a custom
@@ -487,13 +456,11 @@
             buf.append(themeName);
             buf.append("Base='");
             ExternalContext externalContext = context.getExternalContext();
-            if (imageLocation != null)
-            {
+            if (imageLocation != null) {
                 buf.append(externalContext.encodeResourceURL(addResource.getResourceUri(context,
                                                                                         imageLocation + "/" + themeName)));
             }
-            else
-            {
+            else {
                 buf.append(externalContext.encodeResourceURL(addResource.getResourceUri(context,
                                                                                         HtmlJSCookMenuRenderer.class, themeLocation)));
             }
@@ -502,57 +469,50 @@
         }
 
 
-        if ((javascriptLocation != null) || (themeLocation != null))
-        {
+        if ((javascriptLocation != null) || (themeLocation != null)) {
             // Generate a <script> tag in the page header pointing to the
             // theme.js file for this theme. If neither of these is defined
             // then presumably the theme.js file is referenced by a <script>
             // tag hard-wired into the page or inserted via some other means.
-            if (javascriptLocation != null)
-            {
+            if (javascriptLocation != null) {
                 // For now, assume that if the user specified a location for a custom
                 // version of the jscookMenu.js file then the theme.js file can be found
                 // in the same location.
                 addResource.addJavaScriptAtPosition(context, AddResource.HEADER_BEGIN, javascriptLocation + "/" + themeName
-                                                                                       + "/theme.js");
+                    + "/theme.js");
             }
-            else
-            {
+            else {
                 // Using a built-in theme, so we know where the theme.js file is.
                 addResource.addJavaScriptAtPosition(context, AddResource.HEADER_BEGIN, HtmlJSCookMenuRenderer.class, themeName
-                                                                                                                     + "/theme.js");
+                    + "/theme.js");
             }
         }
 
-        if ((styleLocation != null) || (themeLocation != null))
-        {
+        if ((styleLocation != null) || (themeLocation != null)) {
             // Generate a <link type="text/css"> tag in the page header pointing to
             // the theme stylesheet. If neither of these is defined then presumably
             // the stylesheet is referenced by a <link> tag hard-wired into the page
             // or inserted via some other means.
-            if (styleLocation != null)
-            {
+            if (styleLocation != null) {
                 addResource.addStyleSheet(context, AddResource.HEADER_BEGIN, styleLocation + "/" + themeName + "/theme.css");
             }
-            else
-            {
+            else {
                 addResource.addStyleSheet(context, AddResource.HEADER_BEGIN, HtmlJSCookMenuRenderer.class, themeName
-                                                                                                           + "/theme.css");
+                    + "/theme.css");
             }
         }
     }
 
     /**
      * Fetch the very last part of the menu id.
-     * 
+     *
      * @param context
      * @param component
      * @return String id of the menu
      */
     private String getMenuId(FacesContext context, UIComponent component) {
-        String menuId = component.getClientId(context).replaceAll(":","_") + "_menu";
-        while(menuId.startsWith("_"))
-        {
+        String menuId = component.getClientId(context).replaceAll(":", "_") + "_menu";
+        while (menuId.startsWith("_")) {
             menuId = menuId.substring(1);
         }
         return menuId;

Modified: myfaces/tomahawk/trunk/sandbox/core/src/main/java/org/apache/myfaces/custom/fisheye/HtmlFishEyeNavigationMenuRenderer.java
URL: http://svn.apache.org/viewvc/myfaces/tomahawk/trunk/sandbox/core/src/main/java/org/apache/myfaces/custom/fisheye/HtmlFishEyeNavigationMenuRenderer.java?rev=434574&r1=434573&r2=434574&view=diff
==============================================================================
--- myfaces/tomahawk/trunk/sandbox/core/src/main/java/org/apache/myfaces/custom/fisheye/HtmlFishEyeNavigationMenuRenderer.java (original)
+++ myfaces/tomahawk/trunk/sandbox/core/src/main/java/org/apache/myfaces/custom/fisheye/HtmlFishEyeNavigationMenuRenderer.java Thu Aug 24 16:52:09 2006
@@ -35,12 +35,11 @@
 
 /**
  * Renderer for the FishEyeList component
- * 
+ *
  * @author Jurgen Lust (latest modification by $Author$)
  * @version $Revision$ $Date$
  */
-public class HtmlFishEyeNavigationMenuRenderer extends HtmlLinkRenderer
-{
+public class HtmlFishEyeNavigationMenuRenderer extends HtmlLinkRenderer {
     public static final String ATTACH_EDGE_ATTR = "dojo:attachEdge";
 
     public static final String CAPTION_ATTR = "caption";
@@ -61,63 +60,58 @@
     /**
      * @see javax.faces.render.Renderer#decode(javax.faces.context.FacesContext, javax.faces.component.UIComponent)
      */
-    public void decode(FacesContext context, UIComponent component)
-    {
+    public void decode(FacesContext context, UIComponent component) {
         FormInfo nestingForm = findNestingForm(component, context);
-        if (nestingForm != null)
-        {
-            String fieldName = HtmlRendererUtils.getHiddenCommandLinkFieldName(nestingForm.getFormName());
+        if (nestingForm != null) {
+            String fieldName = HtmlRendererUtils.getHiddenCommandLinkFieldName(nestingForm);
             String reqValue = (String) context.getExternalContext()
-            .getRequestParameterMap().get(fieldName);
+                .getRequestParameterMap().get(fieldName);
             UIComponent source = context.getViewRoot().findComponent(reqValue);
-            if (source instanceof UINavigationMenuItem)
-            {
+            if (source instanceof UINavigationMenuItem) {
                 UINavigationMenuItem item = (UINavigationMenuItem) source;
                 item.queueEvent(new ActionEvent(item));
             }
         }
-        
+
     }
 
     /**
      * @see javax.faces.render.Renderer#encodeBegin(javax.faces.context.FacesContext, javax.faces.component.UIComponent)
      */
     public void encodeBegin(FacesContext context, UIComponent component)
-            throws IOException
-    {
-        if (component.isRendered())
-        {
+        throws IOException {
+        if (component.isRendered()) {
             HtmlFishEyeNavigationMenu fisheye = (HtmlFishEyeNavigationMenu) component;
             ResponseWriter writer = context.getResponseWriter();
             //initialize DOJO
             String javascriptLocation = (String) component.getAttributes().get(
-                    JSFAttr.JAVASCRIPT_LOCATION);
+                JSFAttr.JAVASCRIPT_LOCATION);
             DojoUtils.addMainInclude(context, component, javascriptLocation,
-                    DojoUtils.getDjConfigInstance(context));
+                                     DojoUtils.getDjConfigInstance(context));
             DojoUtils.addRequire(context, component, "dojo.widget.FisheyeList");
 
             writer.startElement(HTML.DIV_ELEM, fisheye);
             writer.writeAttribute(HTML.CLASS_ATTR, DOJO_STYLE_CLASS, null);
             writeAttribute(writer, fisheye, ITEM_WIDTH_ATTR, fisheye
-                    .getItemWidth());
+                .getItemWidth());
             writeAttribute(writer, fisheye, ITEM_HEIGHT_ATTR, fisheye
-                    .getItemHeight());
+                .getItemHeight());
             writeAttribute(writer, fisheye, ITEM_MAX_WIDTH_ATTR, fisheye
-                    .getItemMaxWidth());
+                .getItemMaxWidth());
             writeAttribute(writer, fisheye, ITEM_MAX_HEIGHT_ATTR, fisheye
-                    .getItemMaxHeight());
+                .getItemMaxHeight());
             writeAttribute(writer, fisheye, ORIENTATION_ATTR, fisheye
-                    .getOrientation());
+                .getOrientation());
             writeAttribute(writer, fisheye, EFFECT_UNITS_ATTR, fisheye
-                    .getEffectUnits());
+                .getEffectUnits());
             writeAttribute(writer, fisheye, ITEM_PADDING_ATTR, fisheye
-                    .getItemPadding());
+                .getItemPadding());
             writeAttribute(writer, fisheye, ATTACH_EDGE_ATTR, fisheye
-                    .getAttachEdge());
+                .getAttachEdge());
             writeAttribute(writer, fisheye, LABEL_EDGE_ATTR, fisheye
-                    .getLabelEdge());
+                .getLabelEdge());
             writeAttribute(writer, fisheye, CONSERVATIVE_TRIGGER_ATTR, fisheye
-                    .getConservativeTrigger());
+                .getConservativeTrigger());
         }
     }
 
@@ -125,17 +119,14 @@
      * @see javax.faces.render.Renderer#encodeChildren(javax.faces.context.FacesContext, javax.faces.component.UIComponent)
      */
     public void encodeChildren(FacesContext context, UIComponent component)
-            throws IOException
-    {
+        throws IOException {
         ResponseWriter writer = context.getResponseWriter();
         List children = component.getChildren();
-        for (Iterator cit = children.iterator(); cit.hasNext();)
-        {
+        for (Iterator cit = children.iterator(); cit.hasNext();) {
             UIComponent child = (UIComponent) cit.next();
             if (!child.isRendered())
                 continue;
-            if (child instanceof UINavigationMenuItem)
-            {
+            if (child instanceof UINavigationMenuItem) {
                 renderMenuItem(context, writer, (UINavigationMenuItem) child);
             }
         }
@@ -145,10 +136,8 @@
      * @see javax.faces.render.Renderer#encodeEnd(javax.faces.context.FacesContext, javax.faces.component.UIComponent)
      */
     public void encodeEnd(FacesContext context, UIComponent component)
-            throws IOException
-    {
-        if (component.isRendered())
-        {
+        throws IOException {
+        if (component.isRendered()) {
             ResponseWriter writer = context.getResponseWriter();
             writer.endElement(HTML.DIV_ELEM);
         }
@@ -157,22 +146,19 @@
     /**
      * @see javax.faces.render.Renderer#getRendersChildren()
      */
-    public boolean getRendersChildren()
-    {
+    public boolean getRendersChildren() {
         //always render the menu items
         return true;
     }
 
     protected void renderMenuItem(FacesContext context, ResponseWriter writer,
-            UINavigationMenuItem item) throws IOException
-    {
+                                  UINavigationMenuItem item) throws IOException {
         //find the enclosing form
         FormInfo formInfo = findNestingForm(item, context);
         String clientId = item.getClientId(context);
-        if (formInfo == null)
-        {
+        if (formInfo == null) {
             throw new IllegalArgumentException("Component " + clientId
-                    + " must be embedded in an form");
+                + " must be embedded in an form");
         }
         UIComponent nestingForm = formInfo.getForm();
         String formName = formInfo.getFormName();
@@ -181,21 +167,20 @@
 
         //call the clear_<formName> method
         onClick.append(
-                HtmlRendererUtils
-                        .getClearHiddenCommandFormParamsFunctionName(formName))
-                .append("();");
+            HtmlRendererUtils
+                .getClearHiddenCommandFormParamsFunctionName(formName))
+            .append("();");
         String jsForm = "document.forms['" + formName + "']";
 
         if (MyfacesConfig.getCurrentInstance(context.getExternalContext())
-                .isAutoScroll())
-        {
+            .isAutoScroll()) {
             org.apache.myfaces.shared_tomahawk.renderkit.html.util.JavascriptUtils
-                    .appendAutoScrollAssignment(onClick, formName);
+                .appendAutoScrollAssignment(onClick, formName);
         }
 
         //add id parameter for decode
         String hiddenFieldName = HtmlRendererUtils
-                .getHiddenCommandLinkFieldName(formName);
+            .getHiddenCommandLinkFieldName(formInfo);
         onClick.append(jsForm);
         onClick.append(".elements['").append(hiddenFieldName).append("']");
         onClick.append(".value='").append(clientId).append("';");
@@ -203,8 +188,7 @@
 
         //add the target window
         String target = item.getTarget();
-        if (target != null && target.trim().length() > 0)
-        {
+        if (target != null && target.trim().length() > 0) {
             onClick.append(jsForm);
             onClick.append(".target='");
             onClick.append(target);
@@ -213,9 +197,9 @@
 
         // onSubmit
         onClick.append("if(").append(jsForm).append(".onsubmit){var result=")
-                .append(jsForm).append(
-                        ".onsubmit();  if( (typeof result == 'undefined') || result ) {"
-                                + jsForm + ".submit();}}else{");
+            .append(jsForm).append(
+            ".onsubmit();  if( (typeof result == 'undefined') || result ) {"
+                + jsForm + ".submit();}}else{");
 
         //submit
         onClick.append(jsForm);
@@ -231,11 +215,9 @@
     }
 
     protected void writeAttribute(ResponseWriter writer,
-            HtmlFishEyeNavigationMenu fisheye, String name, Object value)
-            throws IOException
-    {
-        if (name != null && value != null)
-        {
+                                  HtmlFishEyeNavigationMenu fisheye, String name, Object value)
+        throws IOException {
+        if (name != null && value != null) {
             writer.writeAttribute(name, value, null);
         }
     }

Modified: myfaces/tomahawk/trunk/sandbox/examples/src/main/webapp/dojo/debugconsole.jsp
URL: http://svn.apache.org/viewvc/myfaces/tomahawk/trunk/sandbox/examples/src/main/webapp/dojo/debugconsole.jsp?rev=434574&r1=434573&r2=434574&view=diff
==============================================================================
--- myfaces/tomahawk/trunk/sandbox/examples/src/main/webapp/dojo/debugconsole.jsp (original)
+++ myfaces/tomahawk/trunk/sandbox/examples/src/main/webapp/dojo/debugconsole.jsp Thu Aug 24 16:52:09 2006
@@ -1,19 +1,19 @@
-<%@ page session="false" contentType="text/html;charset=utf-8"%>
-<%@ taglib uri="http://java.sun.com/jsf/html" prefix="h"%>
-<%@ taglib uri="http://java.sun.com/jsf/core" prefix="f"%>
-<%@ taglib uri="http://myfaces.apache.org/tomahawk" prefix="t"%>
-<%@ taglib uri="http://myfaces.apache.org/sandbox" prefix="s"%>
+<%@ page session="false" contentType="text/html;charset=utf-8" %>
+<%@ taglib uri="http://java.sun.com/jsf/html" prefix="h" %>
+<%@ taglib uri="http://java.sun.com/jsf/core" prefix="f" %>
+<%@ taglib uri="http://myfaces.apache.org/tomahawk" prefix="t" %>
+<%@ taglib uri="http://myfaces.apache.org/sandbox" prefix="s" %>
 
 <html>
-	<head>
-		<meta HTTP-EQUIV="Content-Type" CONTENT="text/html;charset=UTF-8" />
-		<title>MyFaces - the free JSF Implementation</title>
-
-		<link rel="stylesheet" type="text/css" href="css/basic.css" />
-	
-	</head>
+<head>
+    <meta HTTP-EQUIV="Content-Type" CONTENT="text/html;charset=UTF-8"/>
+    <title>MyFaces - the free JSF Implementation</title>
 
-	<!--
+    <link rel="stylesheet" type="text/css" href="css/basic.css"/>
+
+</head>
+
+<!--
 /*
  * Copyright 2004 The Apache Software Foundation.
  *
@@ -32,43 +32,46 @@
 //-->
 
 
-
-	<body>
-		<f:view>
-			<h:panelGroup>
-				<s:dojoInitializer require="dojo.widget.Editor" debug="true"/>	
-				<s:dojoInitializer require="dojo.widget.DebugConsole" />	
-				<s:dojoInitializer require="dojo.widget.ResizeHandle" />	
-				<s:dojoInitializer require="dojo.widget.Button" />	
-				<f:verbatim>
-					<script type="text/javascript" >
-						function generateSomeDebuggingInfo() {
-							for (var x=0; x<10; x++) {
-								dojo.debug(x + ": Here is some debugging info, should be 10 new lines");
-							}
-						}
-					</script>
-					<p>Debugging Console.  This widget, once loaded, will have djConfig output all debugging information to its floating pane.  Some debugging information won't go to the debugConsole before it loads, but there isn't much that can be done about that.  If you set djConfig = {isDebug:true}  it will log to the bottom of the screen (or some div if you set that) until the debugConsole finishes loading.</p> 
-					<button id="go" class="dojo-button" onClick="generateSomeDebuggingInfo();">Generate Debugging info
-					</button>
-					
-					<div dojoType="DebugConsole"
-						title="Debug Console"
-						iconSrc="images/flatScreen.gif";
-						constrainToContainer="1"
-						style="width: 700px; height: 500px; left: 200px;"
-						hasShadow="true"
-						resizable="true"
-						displayCloseAction="true"
-						layoutAlign="client"
-					>
-					</div>
-					
-					
-				</f:verbatim>
-			</h:panelGroup>
-		
-		</f:view>
-		<%@include file="../inc/page_footer.jsp"%>
-	</body>
+<body>
+<f:view>
+    <h:panelGroup>
+        <s:dojoInitializer require="dojo.widget.Editor" debug="true"/>
+        <s:dojoInitializer require="dojo.widget.DebugConsole"/>
+        <s:dojoInitializer require="dojo.widget.ResizeHandle"/>
+        <s:dojoInitializer require="dojo.widget.Button"/>
+        <f:verbatim>
+            <script type="text/javascript">
+                function generateSomeDebuggingInfo() {
+                    for (var x = 0; x < 10; x++) {
+                        dojo.debug(x + ": Here is some debugging info, should be 10 new lines");
+                    }
+                }
+            </script>
+
+            <p>Debugging Console. This widget, once loaded, will have djConfig output all debugging information to its
+                floating pane. Some debugging information won't go to the debugConsole before it loads, but there isn't
+                much that can be done about that. If you set djConfig = {isDebug:true} it will log to the bottom of the
+                screen (or some div if you set that) until the debugConsole finishes loading.</p>
+            <button id="go" class="dojo-button" onClick="generateSomeDebuggingInfo();">Generate Debugging info
+            </button>
+
+            <div dojoType="DebugConsole"
+                 title="Debug Console"
+                 iconSrc="images/flatScreen.gif"
+                 constrainToContainer="1"
+                 style="width: 700px; height: 500px; left: 200px;"
+                 hasShadow="true"
+                 resizable="true"
+                 displayCloseAction="true"
+                 layoutAlign="client"
+                >
+            </div>
+
+
+        </f:verbatim>
+    </h:panelGroup>
+
+</f:view>
+<%@ include file="../inc/page_footer.jsp" %>
+</body>
 </html>



Mime
View raw message