You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@myfaces.apache.org by lu...@apache.org on 2011/04/28 22:57:19 UTC
svn commit: r1097607 - in
/myfaces/tomahawk/trunk/core20/src/main/java/org/apache/myfaces/custom:
calendar/HtmlCalendarRenderer.java
inputTextHelp/AbstractHtmlInputTextHelp.java
inputTextHelp/HtmlTextHelpRenderer.java
Author: lu4242
Date: Thu Apr 28 20:57:19 2011
New Revision: 1097607
URL: http://svn.apache.org/viewvc?rev=1097607&view=rev
Log:
TOMAHAWK-1577 t:inputCalendar disabled status is not working with f:ajax
Added:
myfaces/tomahawk/trunk/core20/src/main/java/org/apache/myfaces/custom/inputTextHelp/AbstractHtmlInputTextHelp.java
Modified:
myfaces/tomahawk/trunk/core20/src/main/java/org/apache/myfaces/custom/calendar/HtmlCalendarRenderer.java
myfaces/tomahawk/trunk/core20/src/main/java/org/apache/myfaces/custom/inputTextHelp/HtmlTextHelpRenderer.java
Modified: myfaces/tomahawk/trunk/core20/src/main/java/org/apache/myfaces/custom/calendar/HtmlCalendarRenderer.java
URL: http://svn.apache.org/viewvc/myfaces/tomahawk/trunk/core20/src/main/java/org/apache/myfaces/custom/calendar/HtmlCalendarRenderer.java?rev=1097607&r1=1097606&r2=1097607&view=diff
==============================================================================
--- myfaces/tomahawk/trunk/core20/src/main/java/org/apache/myfaces/custom/calendar/HtmlCalendarRenderer.java (original)
+++ myfaces/tomahawk/trunk/core20/src/main/java/org/apache/myfaces/custom/calendar/HtmlCalendarRenderer.java Thu Apr 28 20:57:19 2011
@@ -291,6 +291,16 @@ public class HtmlCalendarRenderer
HtmlInputTextHelp inputText = getOrCreateInputTextChild(inputCalendar, application);
RendererUtils.copyHtmlInputTextAttributes(inputCalendar, inputText);
+
+ inputText.setId(inputCalendar.getId()+"_input");
+
+ boolean forceId = RendererUtils.getBooleanValue(
+ JSFAttr.FORCE_ID_ATTR,
+ inputCalendar.getAttributes().get(JSFAttr.FORCE_ID_ATTR),
+ false);
+ if (forceId) {
+ inputText.getAttributes().put(JSFAttr.FORCE_ID_ATTR, Boolean.TRUE);
+ }
inputText.setConverter(null); // value for this transient component will already be converted
inputText.setTransient(true);
@@ -316,21 +326,27 @@ public class HtmlCalendarRenderer
//This is where two components with the same id are in the tree,
//so make sure that during the rendering the id is unique.
- inputCalendar.setId(inputCalendar.getId()+"tempId");
+ //inputCalendar.setId(inputCalendar.getId()+"tempId");
inputCalendar.getChildren().add(inputText);
//Reset client id to ensure proper operation
inputText.setId(inputText.getId());
+
+ inputText.setName(inputCalendar.getClientId(facesContext));
+
+ ResponseWriter writer = facesContext.getResponseWriter();
+
+ writer.startElement(HTML.SPAN_ELEM, inputCalendar);
+
+ writer.writeAttribute(HTML.ID_ATTR, inputCalendar.getClientId(facesContext), null);
RendererUtils.renderChild(facesContext, inputText);
inputCalendar.getChildren().remove(inputText);
//Set back the correct id to the input calendar
- inputCalendar.setId(inputText.getId());
-
- ResponseWriter writer = facesContext.getResponseWriter();
+ //inputCalendar.setId(inputText.getId());
writer.startElement(HTML.SPAN_ELEM,inputCalendar);
writer.writeAttribute(HTML.ID_ATTR,inputCalendar.getClientId(facesContext)+"Span",
@@ -371,6 +387,8 @@ public class HtmlCalendarRenderer
});
}
}
+
+ writer.endElement(HTML.SPAN_ELEM);
}
private void renderInline(
Added: myfaces/tomahawk/trunk/core20/src/main/java/org/apache/myfaces/custom/inputTextHelp/AbstractHtmlInputTextHelp.java
URL: http://svn.apache.org/viewvc/myfaces/tomahawk/trunk/core20/src/main/java/org/apache/myfaces/custom/inputTextHelp/AbstractHtmlInputTextHelp.java?rev=1097607&view=auto
==============================================================================
--- myfaces/tomahawk/trunk/core20/src/main/java/org/apache/myfaces/custom/inputTextHelp/AbstractHtmlInputTextHelp.java (added)
+++ myfaces/tomahawk/trunk/core20/src/main/java/org/apache/myfaces/custom/inputTextHelp/AbstractHtmlInputTextHelp.java Thu Apr 28 20:57:19 2011
@@ -0,0 +1,59 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.myfaces.custom.inputTextHelp;
+
+import org.apache.myfaces.component.html.ext.HtmlInputText;
+
+/**
+ * Extends standard inputText by helptext support.
+ *
+ * Unless otherwise specified, all attributes accept static values or EL expressions.
+ *
+ * @JSFComponent
+ * name = "t:inputTextHelp"
+ * class = "org.apache.myfaces.custom.inputTextHelp.HtmlInputTextHelp"
+ * tagClass = "org.apache.myfaces.custom.inputTextHelp.HtmlInputTextHelpTag"
+ * @since 1.1.7
+ * @author Thomas Obereder
+ * @version $Date: 2005-07-02 15:32:34 +01:00 (Thu, 09 Jun 2005)
+ */
+public abstract class AbstractHtmlInputTextHelp extends HtmlInputText
+{
+ public static final String JS_FUNCTION_SELECT_TEXT = "selectText";
+ public static final String JS_FUNCTION_RESET_HELP = "resetHelpValue";
+ public static final String COMPONENT_TYPE = "org.apache.myfaces.HtmlInputTextHelp";
+ public static final String DEFAULT_RENDERER_TYPE = "org.apache.myfaces.TextHelp";
+
+ /**
+ * @JSFProperty
+ */
+ public abstract String getHelpText();
+
+ /**
+ * @JSFProperty
+ * defaultValue="false"
+ */
+ public abstract boolean isSelectText();
+
+ /**
+ * @JSFProperty
+ */
+ public abstract String getName();
+
+}
Modified: myfaces/tomahawk/trunk/core20/src/main/java/org/apache/myfaces/custom/inputTextHelp/HtmlTextHelpRenderer.java
URL: http://svn.apache.org/viewvc/myfaces/tomahawk/trunk/core20/src/main/java/org/apache/myfaces/custom/inputTextHelp/HtmlTextHelpRenderer.java?rev=1097607&r1=1097606&r2=1097607&view=diff
==============================================================================
--- myfaces/tomahawk/trunk/core20/src/main/java/org/apache/myfaces/custom/inputTextHelp/HtmlTextHelpRenderer.java (original)
+++ myfaces/tomahawk/trunk/core20/src/main/java/org/apache/myfaces/custom/inputTextHelp/HtmlTextHelpRenderer.java Thu Apr 28 20:57:19 2011
@@ -111,7 +111,13 @@ public class HtmlTextHelpRenderer extend
writer.startElement(HTML.INPUT_ELEM, input);
writer.writeAttribute(HTML.ID_ATTR, input.getClientId(facesContext), null);
- writer.writeAttribute(HTML.NAME_ATTR, input.getClientId(facesContext), null);
+
+ String name = (String) input.getAttributes().get("name");
+ if (name == null)
+ {
+ name = input.getClientId(facesContext);
+ }
+ writer.writeAttribute(HTML.NAME_ATTR, name, null);
writer.writeAttribute(HTML.TYPE_ATTR, HTML.INPUT_TYPE_TEXT, null);
renderHelpTextAttributes(input, writer, facesContext);