myfaces-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From to...@apache.org
Subject svn commit: r436783 - in /myfaces/tomahawk/trunk/core/src/main/java/org/apache/myfaces/custom: collapsiblepanel/HtmlCollapsiblePanelRenderer.java tree/renderkit/html/HtmlTreeImageCommandLinkRenderer.java tree/renderkit/html/HtmlTreeNodeRenderer.java
Date Fri, 25 Aug 2006 13:02:44 GMT
Author: tomsp
Date: Fri Aug 25 06:02:41 2006
New Revision: 436783

URL: http://svn.apache.org/viewvc?rev=436783&view=rev
Log:
fix for Trinidad / Tomahawk commandlink problem

Modified:
    myfaces/tomahawk/trunk/core/src/main/java/org/apache/myfaces/custom/collapsiblepanel/HtmlCollapsiblePanelRenderer.java
    myfaces/tomahawk/trunk/core/src/main/java/org/apache/myfaces/custom/tree/renderkit/html/HtmlTreeImageCommandLinkRenderer.java
    myfaces/tomahawk/trunk/core/src/main/java/org/apache/myfaces/custom/tree/renderkit/html/HtmlTreeNodeRenderer.java

Modified: myfaces/tomahawk/trunk/core/src/main/java/org/apache/myfaces/custom/collapsiblepanel/HtmlCollapsiblePanelRenderer.java
URL: http://svn.apache.org/viewvc/myfaces/tomahawk/trunk/core/src/main/java/org/apache/myfaces/custom/collapsiblepanel/HtmlCollapsiblePanelRenderer.java?rev=436783&r1=436782&r2=436783&view=diff
==============================================================================
--- myfaces/tomahawk/trunk/core/src/main/java/org/apache/myfaces/custom/collapsiblepanel/HtmlCollapsiblePanelRenderer.java
(original)
+++ myfaces/tomahawk/trunk/core/src/main/java/org/apache/myfaces/custom/collapsiblepanel/HtmlCollapsiblePanelRenderer.java
Fri Aug 25 06:02:41 2006
@@ -38,19 +38,16 @@
  * @author Kalle Korhonen (latest modification by $Author$)
  * @version $Revision$ $Date$
  */
-public class HtmlCollapsiblePanelRenderer extends HtmlRenderer
-{
+public class HtmlCollapsiblePanelRenderer extends HtmlRenderer {
     //private static final Log log = LogFactory.getLog(HtmlCollapsiblePanel.class);
     private static final String LINK_ID = "ToggleCollapsed".intern();
     private static final String COLLAPSED_STATE_ID = "CollapsedState".intern();
 
-    public boolean getRendersChildren()
-    {
+    public boolean getRendersChildren() {
         return true;
     }
 
-    public void encodeChildren(FacesContext facesContext, UIComponent uiComponent) throws
IOException
-    {
+    public void encodeChildren(FacesContext facesContext, UIComponent uiComponent) throws
IOException {
         // RendererUtils.checkParamValidity(facesContext, uiComponent, HtmlCollapsiblePanel.class);
         ResponseWriter writer = facesContext.getResponseWriter();
         HtmlCollapsiblePanel collapsiblePanel = (HtmlCollapsiblePanel) uiComponent;
@@ -59,18 +56,15 @@
         UIComponent linkToReset = null;
         String resetId = null;
 
-        if(headerComp!=null)
-        {
-            linkToReset = RendererUtils.findComponent(headerComp,HtmlHeaderLink.class);
+        if (headerComp != null) {
+            linkToReset = RendererUtils.findComponent(headerComp, HtmlHeaderLink.class);
 
-            if(linkToReset != null)
-            {
+            if (linkToReset != null) {
                 resetId = linkToReset.getId();
                 linkToReset.setId(collapsiblePanel.getId() + LINK_ID);
             }
         }
-        else
-        {
+        else {
             HtmlCommandLink link = getLink(facesContext, collapsiblePanel);
             collapsiblePanel.getChildren().add(link);
 
@@ -78,18 +72,17 @@
         }
 
         //Render the current state - collapsed or not - of the panel.
-        HtmlRendererUtils.renderHiddenInputField(writer,collapsiblePanel.getClientId(facesContext)+
-                COLLAPSED_STATE_ID,
-                collapsiblePanel.getSubmittedValue()!=null?
-                        collapsiblePanel.getSubmittedValue():(collapsiblePanel.isCollapsed()+""));
+        HtmlRendererUtils.renderHiddenInputField(writer, collapsiblePanel.getClientId(facesContext)
+
+            COLLAPSED_STATE_ID,
+                                                 collapsiblePanel.getSubmittedValue() !=
null ?
+                                                     collapsiblePanel.getSubmittedValue()
: (collapsiblePanel.isCollapsed() + ""));
 
         // Always render the header - to be able toggle the collapsed state
         RendererUtils.renderChild(facesContext, headerComp);
         headerComp.setRendered(false);
 
         // conditionally render the rest of the children
-        if (!collapsiblePanel.isCollapsed())
-        {
+        if (!collapsiblePanel.isCollapsed()) {
             HtmlRendererUtils.writePrettyLineSeparator(facesContext);
             // TODO apply styles from the parent element to this DIV
             writer.startElement(HTML.DIV_ELEM, uiComponent);
@@ -97,11 +90,9 @@
             writer.endElement(HTML.DIV_ELEM);
             HtmlRendererUtils.writePrettyLineSeparator(facesContext);
         }
-        else
-        {
+        else {
             UIComponent component = collapsiblePanel.getFacet("closedContent");
-            if (component != null)
-            {
+            if (component != null) {
                 writer.startElement(HTML.DIV_ELEM, uiComponent);
                 RendererUtils.renderChild(facesContext, component);
                 writer.endElement(HTML.DIV_ELEM);
@@ -111,14 +102,12 @@
 
         headerComp.setRendered(true);
 
-        if(linkToReset != null)
-        {
+        if (linkToReset != null) {
             linkToReset.setId(resetId);
         }
     }
 
-    public void encodeBegin(FacesContext facesContext, UIComponent uiComponent) throws IOException
-    {
+    public void encodeBegin(FacesContext facesContext, UIComponent uiComponent) throws IOException
{
         RendererUtils.checkParamValidity(facesContext, uiComponent, HtmlCollapsiblePanel.class);
         ResponseWriter writer = facesContext.getResponseWriter();
 
@@ -133,47 +122,42 @@
     }
 
 
-    public void encodeEnd(FacesContext facesContext, UIComponent uiComponent) throws IOException
-    {
+    public void encodeEnd(FacesContext facesContext, UIComponent uiComponent) throws IOException
{
         //RendererUtils.checkParamValidity(facesContext, uiComponent, HtmlCollapsiblePanel.class);
         ResponseWriter writer = facesContext.getResponseWriter();
         writer.endElement(HTML.DIV_ELEM);
         HtmlRendererUtils.writePrettyLineSeparator(facesContext);
     }
 
-    public void decode(FacesContext facesContext, UIComponent uiComponent)
-    {
+    public void decode(FacesContext facesContext, UIComponent uiComponent) {
         RendererUtils.checkParamValidity(facesContext, uiComponent, HtmlCollapsiblePanel.class);
         HtmlCollapsiblePanel collapsiblePanel = (HtmlCollapsiblePanel) uiComponent;
 
         Map reqParams = facesContext.getExternalContext().getRequestParameterMap();
 
         String togglingIndicated = (String) reqParams.get(HtmlRendererUtils
-        		.getHiddenCommandLinkFieldName(
-        				DummyFormUtils.findNestingForm(collapsiblePanel, facesContext).getFormName()));
+            .getHiddenCommandLinkFieldName(
+            DummyFormUtils.findNestingForm(collapsiblePanel, facesContext)));
         String reqValue = (String) reqParams.get(
-                collapsiblePanel.getClientId(facesContext)+COLLAPSED_STATE_ID);
+            collapsiblePanel.getClientId(facesContext) + COLLAPSED_STATE_ID);
 
         collapsiblePanel.setCurrentlyCollapsed(HtmlCollapsiblePanel.isCollapsed(reqValue));
 
-        if ((collapsiblePanel.getClientId(facesContext) + LINK_ID).equals(togglingIndicated))
-        {
-            if(reqValue!=null)
-                collapsiblePanel.setSubmittedValue(""+!collapsiblePanel.isCurrentlyCollapsed());
+        if ((collapsiblePanel.getClientId(facesContext) + LINK_ID).equals(togglingIndicated))
{
+            if (reqValue != null)
+                collapsiblePanel.setSubmittedValue("" + !collapsiblePanel.isCurrentlyCollapsed());
             else
-                collapsiblePanel.setSubmittedValue(""+!collapsiblePanel.isCollapsed());
+                collapsiblePanel.setSubmittedValue("" + !collapsiblePanel.isCollapsed());
         }
-        else
-        {
-            if(reqValue!=null)
-                collapsiblePanel.setSubmittedValue(""+collapsiblePanel.isCurrentlyCollapsed());
+        else {
+            if (reqValue != null)
+                collapsiblePanel.setSubmittedValue("" + collapsiblePanel.isCurrentlyCollapsed());
         }
 
     }
 
     protected HtmlCommandLink getLink(FacesContext facesContext, HtmlCollapsiblePanel collapsiblePanel)
-            throws IOException
-    {
+        throws IOException {
         Application application = facesContext.getApplication();
         HtmlCommandLink link = (HtmlCommandLink) application.createComponent(HtmlCommandLink.COMPONENT_TYPE);
         link.setId(collapsiblePanel.getId() + LINK_ID);
@@ -193,8 +177,7 @@
 
         // Create the optional label
         String label = collapsiblePanel.getTitle();
-        if (label != null)
-        {
+        if (label != null) {
             uiText = (HtmlOutputText) application.createComponent(HtmlOutputText.COMPONENT_TYPE);
             uiText.setTransient(true);
             uiText.setValue(" " + label);
@@ -205,10 +188,8 @@
         return link;
     }
 
-    public Object getConvertedValue(FacesContext context, UIComponent component, Object submittedValue)
throws ConverterException
-    {
-        if(submittedValue instanceof String)
-        {
+    public Object getConvertedValue(FacesContext context, UIComponent component, Object submittedValue)
throws ConverterException {
+        if (submittedValue instanceof String) {
             return Boolean.valueOf((String) submittedValue);
         }
 

Modified: myfaces/tomahawk/trunk/core/src/main/java/org/apache/myfaces/custom/tree/renderkit/html/HtmlTreeImageCommandLinkRenderer.java
URL: http://svn.apache.org/viewvc/myfaces/tomahawk/trunk/core/src/main/java/org/apache/myfaces/custom/tree/renderkit/html/HtmlTreeImageCommandLinkRenderer.java?rev=436783&r1=436782&r2=436783&view=diff
==============================================================================
--- myfaces/tomahawk/trunk/core/src/main/java/org/apache/myfaces/custom/tree/renderkit/html/HtmlTreeImageCommandLinkRenderer.java
(original)
+++ myfaces/tomahawk/trunk/core/src/main/java/org/apache/myfaces/custom/tree/renderkit/html/HtmlTreeImageCommandLinkRenderer.java
Fri Aug 25 06:02:41 2006
@@ -34,23 +34,20 @@
  * @version $Revision$ $Date$
  */
 public class HtmlTreeImageCommandLinkRenderer
-        extends ExtendedHtmlLinkRenderer
-{
+    extends ExtendedHtmlLinkRenderer {
 
     private static final Integer ZERO = new Integer(0);
 
 
-    public void decode(FacesContext facesContext, UIComponent component)
-    {
+    public void decode(FacesContext facesContext, UIComponent component) {
         super.decode(facesContext, component);
         String clientId = component.getClientId(facesContext);
-        String reqValue = (String)facesContext
-        	.getExternalContext()
-        	.getRequestParameterMap().get(HtmlRendererUtils
-        			.getHiddenCommandLinkFieldName(DummyFormUtils.findNestingForm(component, facesContext).getFormName()));
-        if (reqValue != null && reqValue.equals(clientId))
-        {
-            HtmlTreeNode node = (HtmlTreeNode)component.getParent();
+        String reqValue = (String) facesContext
+            .getExternalContext()
+            .getRequestParameterMap().get(HtmlRendererUtils
+            .getHiddenCommandLinkFieldName(DummyFormUtils.findNestingForm(component, facesContext)));
+        if (reqValue != null && reqValue.equals(clientId)) {
+            HtmlTreeNode node = (HtmlTreeNode) component.getParent();
 
             node.toggleExpanded();
         }
@@ -62,15 +59,13 @@
                                           String clientId,
                                           Object value,
                                           String style,
-                                          String styleClass) throws IOException
-    {
+                                          String styleClass) throws IOException {
 
         super.renderCommandLinkStart(facesContext, component, clientId, value, style, styleClass);
 
-        String url = ((HtmlTreeImageCommandLink)component).getImage();
+        String url = ((HtmlTreeImageCommandLink) component).getImage();
 
-        if ((url != null) && (url.length() > 0))
-        {
+        if ((url != null) && (url.length() > 0)) {
             ResponseWriter writer = facesContext.getResponseWriter();
             writer.startElement(HTML.IMG_ELEM, component);
             String src = facesContext.getApplication().getViewHandler().getResourceURL(facesContext,
url);

Modified: myfaces/tomahawk/trunk/core/src/main/java/org/apache/myfaces/custom/tree/renderkit/html/HtmlTreeNodeRenderer.java
URL: http://svn.apache.org/viewvc/myfaces/tomahawk/trunk/core/src/main/java/org/apache/myfaces/custom/tree/renderkit/html/HtmlTreeNodeRenderer.java?rev=436783&r1=436782&r2=436783&view=diff
==============================================================================
--- myfaces/tomahawk/trunk/core/src/main/java/org/apache/myfaces/custom/tree/renderkit/html/HtmlTreeNodeRenderer.java
(original)
+++ myfaces/tomahawk/trunk/core/src/main/java/org/apache/myfaces/custom/tree/renderkit/html/HtmlTreeNodeRenderer.java
Fri Aug 25 06:02:41 2006
@@ -28,22 +28,19 @@
  * @version $Revision$ $Date$
  */
 public class HtmlTreeNodeRenderer
-        extends ExtendedHtmlLinkRenderer
-{
+    extends ExtendedHtmlLinkRenderer {
 
-    public void decode(FacesContext facesContext, UIComponent component)
-    {
+    public void decode(FacesContext facesContext, UIComponent component) {
         super.decode(facesContext, component);
         String clientId = component.getClientId(facesContext);
-        String reqValue = (String)facesContext
-        .getExternalContext()
-        .getRequestParameterMap()
-        .get(HtmlRendererUtils
-        		.getHiddenCommandLinkFieldName(DummyFormUtils
-        				.findNestingForm(component, facesContext).getFormName()));
-        if (reqValue != null && reqValue.equals(clientId))
-        {
-            HtmlTreeNode node = (HtmlTreeNode)component;
+        String reqValue = (String) facesContext
+            .getExternalContext()
+            .getRequestParameterMap()
+            .get(HtmlRendererUtils
+                .getHiddenCommandLinkFieldName(DummyFormUtils
+                .findNestingForm(component, facesContext)));
+        if (reqValue != null && reqValue.equals(clientId)) {
+            HtmlTreeNode node = (HtmlTreeNode) component;
 
             node.setSelected(true);
         }



Mime
View raw message