myfaces-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mmarinsc...@apache.org
Subject cvs commit: incubator-myfaces/webapps/examples/web tabbedPane.jsp
Date Mon, 24 Jan 2005 12:20:12 GMT
mmarinschek    2005/01/24 04:20:11

  Modified:    src/components/org/apache/myfaces/custom/tabbedpane
                        HtmlPanelTabbedPane.java
                        HtmlTabbedPaneRenderer.java
               src/share/org/apache/myfaces/renderkit/html
                        HtmlRendererUtils.java
               webapps/examples/web tabbedPane.jsp
  Log:
  Changed the TabbedPane component to only decode components which are on the visible tags
- other components are not processed in the decode phase. Changed the HtmlRendererUtils back
to submit empty strings for components which should be posted back but have null values.
  
  Revision  Changes    Path
  1.9       +57 -2     incubator-myfaces/src/components/org/apache/myfaces/custom/tabbedpane/HtmlPanelTabbedPane.java
  
  Index: HtmlPanelTabbedPane.java
  ===================================================================
  RCS file: /home/cvs/incubator-myfaces/src/components/org/apache/myfaces/custom/tabbedpane/HtmlPanelTabbedPane.java,v
  retrieving revision 1.8
  retrieving revision 1.9
  diff -u -r1.8 -r1.9
  --- HtmlPanelTabbedPane.java	26 Nov 2004 14:29:12 -0000	1.8
  +++ HtmlPanelTabbedPane.java	24 Jan 2005 12:20:11 -0000	1.9
  @@ -15,18 +15,27 @@
    */
   package org.apache.myfaces.custom.tabbedpane;
   
  +import org.apache.myfaces.renderkit.RendererUtils;
  +
   import javax.faces.component.html.HtmlPanelGroup;
  +import javax.faces.component.UIComponent;
  +import javax.faces.component.NamingContainer;
   import javax.faces.context.FacesContext;
   import javax.faces.el.EvaluationException;
   import javax.faces.el.MethodBinding;
   import javax.faces.el.ValueBinding;
   import javax.faces.event.AbortProcessingException;
   import javax.faces.event.FacesEvent;
  +import java.util.Iterator;
  +import java.util.List;
   
   /**
    * @author Manfred Geiler (latest modification by $Author$)
    * @version $Revision$ $Date$
    * $Log$
  + * Revision 1.9  2005/01/24 12:20:11  mmarinschek
  + * Changed the TabbedPane component to only decode components which are on the visible
tags - other components are not processed in the decode phase. Changed the HtmlRendererUtils
back to submit empty strings for components which should be posted back but have null values.
  + *
    * Revision 1.8  2004/11/26 14:29:12  oros
    * bug fix #1006636: VisibleOnUserRole attribute for x:panelTab tag
    *
  @@ -57,6 +66,52 @@
       private MethodBinding _tabChangeListener = null;
   
       //TODO: additional HTML Table attributes (see HtmlPanelTabbedPaneTag)
  +
  +    public void decode(FacesContext context)
  +    {
  +        super.decode(context);    //To change body of overridden methods use File | Settings
| File Templates.
  +    }
  +
  +    public void processDecodes(javax.faces.context.FacesContext context)
  +    {
  +        if (context == null) throw new NullPointerException("context");
  +        decode(context);
  +
  +        int tabIdx = 0;
  +        int selectedIndex = getSelectedIndex();
  +
  +        Iterator it = getFacetsAndChildren();
  +
  +        while (it.hasNext())
  +        {
  +            UIComponent childOrFacet = getUIComponent((UIComponent) it.next());
  +            if (childOrFacet instanceof HtmlPanelTab)
  +            {
  +                if (tabIdx == selectedIndex)
  +                {
  +                    childOrFacet.processDecodes(context);
  +                }
  +                tabIdx++;
  +            }
  +            else
  +            {
  +                childOrFacet.processDecodes(context);
  +            }
  +        }
  +    }
  +
  +    private UIComponent getUIComponent(UIComponent uiComponent)
  +    {
  +        if (uiComponent instanceof NamingContainer)
  +        {
  +            List children = uiComponent.getChildren();
  +            for (int i = 0, len = children.size(); i < len; i++)
  +            {
  +                uiComponent = getUIComponent((UIComponent)children.get(i));
  +            }
  +        }
  +        return uiComponent;
  +    }
   
       public void addTabChangeListener(TabChangeListener listener)
       {
  
  
  
  1.8       +5 -2      incubator-myfaces/src/components/org/apache/myfaces/custom/tabbedpane/HtmlTabbedPaneRenderer.java
  
  Index: HtmlTabbedPaneRenderer.java
  ===================================================================
  RCS file: /home/cvs/incubator-myfaces/src/components/org/apache/myfaces/custom/tabbedpane/HtmlTabbedPaneRenderer.java,v
  retrieving revision 1.7
  retrieving revision 1.8
  diff -u -r1.7 -r1.8
  --- HtmlTabbedPaneRenderer.java	26 Nov 2004 14:29:12 -0000	1.7
  +++ HtmlTabbedPaneRenderer.java	24 Jan 2005 12:20:11 -0000	1.8
  @@ -35,6 +35,9 @@
    * @author Manfred Geiler (latest modification by $Author$)
    * @version $Revision$ $Date$
    * $Log$
  + * Revision 1.8  2005/01/24 12:20:11  mmarinschek
  + * Changed the TabbedPane component to only decode components which are on the visible
tags - other components are not processed in the decode phase. Changed the HtmlRendererUtils
back to submit empty strings for components which should be posted back but have null values.
  + *
    * Revision 1.7  2004/11/26 14:29:12  oros
    * bug fix #1006636: VisibleOnUserRole attribute for x:panelTab tag
    *
  
  
  
  1.26      +6 -10     incubator-myfaces/src/share/org/apache/myfaces/renderkit/html/HtmlRendererUtils.java
  
  Index: HtmlRendererUtils.java
  ===================================================================
  RCS file: /home/cvs/incubator-myfaces/src/share/org/apache/myfaces/renderkit/html/HtmlRendererUtils.java,v
  retrieving revision 1.25
  retrieving revision 1.26
  diff -u -r1.25 -r1.26
  --- HtmlRendererUtils.java	23 Jan 2005 22:06:33 -0000	1.25
  +++ HtmlRendererUtils.java	24 Jan 2005 12:20:11 -0000	1.26
  @@ -139,8 +139,7 @@
               //if the component has not been disabled
               if(!isDisabledOrReadOnly(component))
               {
  -                ((EditableValueHolder) component).setSubmittedValue( null );
  -                // Was .setSubmittedValue(RendererUtils.EMPTY_STRING) before.
  +                ((EditableValueHolder) component).setSubmittedValue(RendererUtils.EMPTY_STRING);
                   // This caused a bug when the component wasn't displayed
                   // (for example if it was in a TabPanel's Tab that wasn't displayed).
               }
  @@ -180,8 +179,7 @@
               //if the component has not been disabled
               if(!isDisabledOrReadOnly(component))
               {
  -                ((EditableValueHolder) component).setSubmittedValue( null );
  -                // Was .setSubmittedValue(Boolean.FALSE) before.
  +                ((EditableValueHolder) component).setSubmittedValue(Boolean.FALSE);
                   // This caused a bug when the component wasn't displayed
                   // (for example if it was in a TabPanel's Tab that wasn't displayed).
               }
  @@ -226,8 +224,7 @@
               //if the component has not been disabled
               if(!isDisabledOrReadOnly(component))
               {
  -                ((EditableValueHolder) component).setSubmittedValue( null );
  -                // Was .setSubmittedValue(RendererUtils.EMPTY_STRING) before.
  +                ((EditableValueHolder) component).setSubmittedValue(RendererUtils.EMPTY_STRING);
                   // This caused a bug when the component wasn't displayed
                   // (for example if it was in a TabPanel's Tab that wasn't displayed).
               }
  @@ -260,8 +257,7 @@
   
               if(!isDisabledOrReadOnly(component))
               {
  -                ((EditableValueHolder) component).setSubmittedValue( null );
  -                // Was .setSubmittedValue(RendererUtils.EMPTY_STRING) before.
  +                ((EditableValueHolder) component).setSubmittedValue(RendererUtils.EMPTY_STRING);
                   // This caused a bug when the component wasn't displayed
                   // (for example if it was in a TabPanel's Tab that wasn't displayed).
               }
  
  
  
  1.22      +13 -6     incubator-myfaces/webapps/examples/web/tabbedPane.jsp
  
  Index: tabbedPane.jsp
  ===================================================================
  RCS file: /home/cvs/incubator-myfaces/webapps/examples/web/tabbedPane.jsp,v
  retrieving revision 1.21
  retrieving revision 1.22
  diff -u -r1.21 -r1.22
  --- tabbedPane.jsp	24 Nov 2004 09:53:47 -0000	1.21
  +++ tabbedPane.jsp	24 Jan 2005 12:20:11 -0000	1.22
  @@ -67,9 +67,10 @@
   
                   <x:panelTabbedPane bgcolor="#FFFFCC" >
   
  -                    <f:verbatim>
  -                        <p><h:outputText value="#{example_messages['tabbed_common']}"/></p>
  -                    </f:verbatim>
  +                    <f:verbatim><p></f:verbatim>
  +                        <h:outputText value="#{example_messages['tabbed_common']}"/>
  +                    <f:verbatim></p></f:verbatim>
  +
   
                       <x:panelTab id="tab1" label="#{example_messages['tabbed_tab1']}"
rendered="#{tabbedPaneBean.tab1Visible}">
                           <h:inputText id="inp1"/><f:verbatim><br></f:verbatim>
  @@ -88,9 +89,15 @@
   
                       <f:verbatim><br></f:verbatim>
   
  -                    <h:selectBooleanCheckbox value="#{tabbedPaneBean.tab1Visible}"/><h:outputText
value="#{example_messages['tabbed_visible1']}"/><br>
  -                    <h:selectBooleanCheckbox value="#{tabbedPaneBean.tab2Visible}"/><h:outputText
value="#{example_messages['tabbed_visible2']}" /><br>
  -                    <h:selectBooleanCheckbox value="#{tabbedPaneBean.tab3Visible}"/><h:outputText
value="#{example_messages['tabbed_visible3']}" /><br>
  +                    <h:selectBooleanCheckbox value="#{tabbedPaneBean.tab1Visible}"/>
  +                    <h:outputText value="#{example_messages['tabbed_visible1']}"/>
  +                    <f:verbatim><br></f:verbatim>
  +                    <h:selectBooleanCheckbox value="#{tabbedPaneBean.tab2Visible}"/>
  +                    <h:outputText value="#{example_messages['tabbed_visible2']}" />
  +                    <f:verbatim><br></f:verbatim>
  +                    <h:selectBooleanCheckbox value="#{tabbedPaneBean.tab3Visible}"/>
  +                    <h:outputText value="#{example_messages['tabbed_visible3']}" />
  +                    <f:verbatim><br></f:verbatim>
   
                       <h:commandButton value="#{example_messages['tabbed_submit']}" />
   
  
  
  

Mime
View raw message