You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@myfaces.apache.org by bo...@apache.org on 2010/11/24 08:21:54 UTC

svn commit: r1038505 - in /myfaces/tobago/trunk: tobago-core/src/main/java/org/apache/myfaces/tobago/internal/taglib/component/ tobago-theme/tobago-theme-scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/

Author: bommel
Date: Wed Nov 24 07:21:54 2010
New Revision: 1038505

URL: http://svn.apache.org/viewvc?rev=1038505&view=rev
Log:
(TOBAGO-948) disabled attribute support for tc:hidden

Modified:
    myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/taglib/component/HiddenTagDeclaration.java
    myfaces/tobago/trunk/tobago-theme/tobago-theme-scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/HiddenRenderer.java

Modified: myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/taglib/component/HiddenTagDeclaration.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/taglib/component/HiddenTagDeclaration.java?rev=1038505&r1=1038504&r2=1038505&view=diff
==============================================================================
--- myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/taglib/component/HiddenTagDeclaration.java (original)
+++ myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/taglib/component/HiddenTagDeclaration.java Wed Nov 24 07:21:54 2010
@@ -24,6 +24,7 @@ import org.apache.myfaces.tobago.interna
 import org.apache.myfaces.tobago.internal.taglib.declaration.HasIdBindingAndRendered;
 import org.apache.myfaces.tobago.internal.taglib.declaration.HasValidator;
 import org.apache.myfaces.tobago.internal.taglib.declaration.HasValue;
+import org.apache.myfaces.tobago.internal.taglib.declaration.IsDisabled;
 import org.apache.myfaces.tobago.internal.taglib.declaration.IsReadonly;
 
 /**
@@ -36,5 +37,5 @@ import org.apache.myfaces.tobago.interna
     rendererType = RendererTypes.HIDDEN,
     allowedChildComponenents = "NONE")
 public interface HiddenTagDeclaration extends HasIdBindingAndRendered, HasValue, HasConverter, HasValidator,
-    IsReadonly {
+    IsReadonly, IsDisabled {
 }

Modified: myfaces/tobago/trunk/tobago-theme/tobago-theme-scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/HiddenRenderer.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/tobago-theme/tobago-theme-scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/HiddenRenderer.java?rev=1038505&r1=1038504&r2=1038505&view=diff
==============================================================================
--- myfaces/tobago/trunk/tobago-theme/tobago-theme-scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/HiddenRenderer.java (original)
+++ myfaces/tobago/trunk/tobago-theme/tobago-theme-scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/HiddenRenderer.java Wed Nov 24 07:21:54 2010
@@ -17,7 +17,10 @@ package org.apache.myfaces.tobago.render
  * limitations under the License.
  */
 
+import org.apache.myfaces.tobago.component.UIHidden;
+import org.apache.myfaces.tobago.layout.Display;
 import org.apache.myfaces.tobago.renderkit.InputRendererBase;
+import org.apache.myfaces.tobago.renderkit.css.Style;
 import org.apache.myfaces.tobago.renderkit.html.HtmlAttributes;
 import org.apache.myfaces.tobago.renderkit.html.HtmlElements;
 import org.apache.myfaces.tobago.renderkit.html.util.HtmlRendererUtils;
@@ -31,8 +34,7 @@ import java.io.IOException;
 // TODO: Its not nice, that the base class use layout
 public class HiddenRenderer extends InputRendererBase {
 
-  public void encodeEnd(FacesContext facesContext,
-      UIComponent component) throws IOException {
+  public void encodeEnd(FacesContext facesContext, UIComponent component) throws IOException {
 
     final String clientId = component.getClientId(facesContext);
     final String value = RenderUtils.currentValue(component);
@@ -40,7 +42,15 @@ public class HiddenRenderer extends Inpu
     TobagoResponseWriter writer = HtmlRendererUtils.getTobagoResponseWriter(facesContext);
 
     writer.startElement(HtmlElements.INPUT, component);
-    writer.writeAttribute(HtmlAttributes.TYPE, "hidden", false);
+    if (component instanceof UIHidden && ((UIHidden)component).isDisabled()) {
+      writer.writeAttribute(HtmlAttributes.TYPE, "text", false);
+      Style style = new Style();
+      style.setDisplay(Display.NONE);
+      writer.writeStyleAttribute(style);
+      writer.writeAttribute(HtmlAttributes.DISABLED, true);
+    } else {
+      writer.writeAttribute(HtmlAttributes.TYPE, "hidden", false);
+    }
     writer.writeNameAttribute(clientId);
     writer.writeIdAttribute(clientId);
     writer.writeAttribute(HtmlAttributes.VALUE, value != null ? value : "", true);