You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@myfaces.apache.org by pr...@apache.org on 2006/03/23 01:18:21 UTC
svn commit: r387978 - in /myfaces/tomahawk/trunk/sandbox:
core/src/main/java/org/apache/myfaces/custom/ajax/util/
examples/src/main/webapp/ examples/src/main/webapp/WEB-INF/
examples/src/main/webapp/css/
Author: prophecy
Date: Wed Mar 22 16:18:19 2006
New Revision: 387978
URL: http://svn.apache.org/viewcvs?rev=387978&view=rev
Log:
Fixed up some bugs that were introduced into AjaxRendererUtils so now the checkboxes, radios and toggles work.
Added:
myfaces/tomahawk/trunk/sandbox/examples/src/main/webapp/killSession.jsp
Modified:
myfaces/tomahawk/trunk/sandbox/core/src/main/java/org/apache/myfaces/custom/ajax/util/AjaxRendererUtils.java
myfaces/tomahawk/trunk/sandbox/examples/src/main/webapp/WEB-INF/web.xml
myfaces/tomahawk/trunk/sandbox/examples/src/main/webapp/css/basic.css
myfaces/tomahawk/trunk/sandbox/examples/src/main/webapp/inputAjax.jsp
Modified: myfaces/tomahawk/trunk/sandbox/core/src/main/java/org/apache/myfaces/custom/ajax/util/AjaxRendererUtils.java
URL: http://svn.apache.org/viewcvs/myfaces/tomahawk/trunk/sandbox/core/src/main/java/org/apache/myfaces/custom/ajax/util/AjaxRendererUtils.java?rev=387978&r1=387977&r2=387978&view=diff
==============================================================================
--- myfaces/tomahawk/trunk/sandbox/core/src/main/java/org/apache/myfaces/custom/ajax/util/AjaxRendererUtils.java (original)
+++ myfaces/tomahawk/trunk/sandbox/core/src/main/java/org/apache/myfaces/custom/ajax/util/AjaxRendererUtils.java Wed Mar 22 16:18:19 2006
@@ -49,9 +49,9 @@
{
/**
* util class.
- *
*/
- private AjaxRendererUtils(){
+ private AjaxRendererUtils()
+ {
//util clazz
}
@@ -117,7 +117,7 @@
UIComponent ajaxMessages = (UIComponent) ComponentUtils
.findFirstMessagesComponent(context, context.getViewRoot());
- if (ajaxMessages != null && ((HtmlMessages)ajaxMessages).getForceSpan())
+ if (ajaxMessages != null && ((HtmlMessages) ajaxMessages).getForceSpan())
{
ajaxMessagesId = ajaxMessages.getClientId(context);
}
@@ -173,10 +173,10 @@
buff.append(jsNameSpace).append("displayError(errorClientId, errorSeverity, errorSummary, errorDetail, styleClass, style);\n");
//also after displaying the error message, onSuccessFunction() should be called
- if (component.getOnSuccess() != null)
+ if (component.getOnSuccess() != null)
buff.append(jsNameSpace).append("onSuccessFunction(elname, elvalue, originalRequest);\n");
- buff.append(" }\n")
+ buff.append(" }\n")
.append(" var myObElementArray = originalRequest.responseXML.getElementsByTagName(\"response\")[0].getElementsByTagName(\"elementUpdated\");\n")
.append(" if(myObElementArray && myObElementArray.length > 0){")
.append(" var myObElement = myObElementArray[0];\n")
@@ -188,45 +188,46 @@
{
buff.append(" ").append(jsNameSpace).append("onSuccessFunction(elname, elvalue, originalRequest);\n");
}
- buff.append(jsNameSpace).append("clearErrorMessageAndFieldStyles(elname, myObElementArray);\n");
- buff.append(" ").append(jsNameSpace).append("clearError(elname);\n");
+ buff.append(jsNameSpace).append("clearErrorMessageAndFieldStyles(elname, myObElementArray);\n");
+ buff.append(" ").append(jsNameSpace).append("clearError(elname);\n");
buff.append(" }\n");
if (component.getOnFailure() != null)
{
buff.append(" else\n")
- .append(" {\n")
- .append(" ").append(jsNameSpace).append("onFailureFunction(elname, elvalue, originalRequest);}\n");
+ .append(" {\n")
+ .append(" ").append(jsNameSpace).append("onFailureFunction(elname, elvalue, originalRequest);}\n");
}
- buff.append(" }\n").append("}\n");
+ buff.append(" }\n").append("}\n");
// displayError function shows any errors sent back
- buff.append("function ").append(jsNameSpace).append("displayError(elname, severity, summary, detail, styleClass, style){\n")
- .append(" var summaryAndDetail = summary;\n")
- .append(" if(detail) summaryAndDetail += \": \" + detail;\n");
+ buff.append("function ").append(jsNameSpace).append("displayError(elname, severity, summary, detail, styleClass, style){\n")
+ .append(" var summaryAndDetail = summary;\n")
+ .append(" if(detail) summaryAndDetail += \": \" + detail;\n");
if (ajaxMessagesId != null)
{
buff.append(" var ajaxMessagesSpan = document.getElementById( \"" + ajaxMessagesId + "\");\n")
- .append(" if(ajaxMessagesSpan){\n")
- .append(" ajaxMessagesSpan.innerHTML = summaryAndDetail;\n")
- .append(" }");
+ .append(" if(ajaxMessagesSpan){\n")
+ .append(" ajaxMessagesSpan.innerHTML = summaryAndDetail;\n")
+ .append(" }");
}
- buff.append(" var msgSpan = document.getElementById(elname+\"_msgFor\");\n")
+ buff.append(" var msgSpan = document.getElementById(elname+\"_msgFor\");\n")
.append(" if(msgSpan) msgSpan.innerHTML = summaryAndDetail;\n")
.append(" if(styleClass) msgSpan.className = styleClass;\n");
- //.append(" if(style) msgSpan.style = style;") // guess you can't swap out the entire style like this
+ //.append(" if(style) msgSpan.style = style;") // guess you can't swap out the entire style like this
if (htmlInputTextAjax != null)
{
//styling of the ajax fields
buff.append("var errorStyleElem = document.getElementById(elname);\n")
- .append("if(errorStyleElem){\n");
- if (htmlInputTextAjax.getErrorStyleClass()!=null)
+ .append("if(errorStyleElem){\n");
+ if (htmlInputTextAjax.getErrorStyleClass() != null)
buff.append("errorStyleElem.className =\"").append(htmlInputTextAjax.getErrorStyleClass()).append("\";\n");
- if (htmlInputTextAjax.getErrorStyle()!=null)
+ if (htmlInputTextAjax.getErrorStyle() != null)
buff.append("errorStyleElem.style.cssText =\"").append(htmlInputTextAjax.getErrorStyle()).append("\";\n");
+ buff.append("}\n");
}
- buff.append("}}\n");
+ buff.append("}\n");
// clearError function to remove error display if there was one previously
buff.append("function ").append(jsNameSpace).append("clearError(elname){\n")
.append(" var msgSpan = document.getElementById(elname+\"_msgFor\");\n")
@@ -234,40 +235,41 @@
.append(" msgSpan.innerHTML = \"\";\n")
.append(" }\n")
.append("}\n");
- //clearError function; same as above, but also for the htmlInputTextAjax field if using the messages comp
- buff.append("function ").append(jsNameSpace).append("clearErrorMessageAndFieldStyles(elname, possibleUpdateTag){\n")
- .append("try\n")
- .append(" {\n")
- .append(" if(possibleUpdateTag[0].tagName == \"elementUpdated\")\n")
- .append(" {\n");
- if (ajaxMessagesId!=null)
+ //clearError function; same as above, but also for the htmlInputTextAjax field if using the messages comp
+ buff.append("function ").append(jsNameSpace).append("clearErrorMessageAndFieldStyles(elname, possibleUpdateTag){\n")
+ .append("try\n")
+ .append(" {\n")
+ .append(" if(possibleUpdateTag[0].tagName == \"elementUpdated\")\n")
+ .append(" {\n");
+ if (ajaxMessagesId != null)
{
- buff.append(" var errorMessageSpan = document.getElementById(\"" + ajaxMessagesId + "\");\n")
- .append(" errorMessageSpan.innerHTML = \"\";\n");
+ buff.append(" var errorMessageSpan = document.getElementById(\"" + ajaxMessagesId + "\");\n")
+ .append(" errorMessageSpan.innerHTML = \"\";\n");
}
- //set ajaxinputField to default style or styleclass
+ //set ajaxinputField to default style or styleclass
buff.append(" var errorField = document.getElementById(elname);\n");
- if(htmlInputTextAjax!=null)
+ if (htmlInputTextAjax != null)
+ {
+ if (htmlInputTextAjax.getStyleClass() != null)
+ buff.append("errorField.className = \"" + htmlInputTextAjax.getStyleClass() + "\";\n");
+ else if (htmlInputTextAjax.getStyle() != null)
{
- if(htmlInputTextAjax.getStyleClass()!=null)
- buff.append("errorField.className = \""+htmlInputTextAjax.getStyleClass()+"\";\n");
- else if (htmlInputTextAjax.getStyle() != null)
- {
- buff.append("errorField.style.cssText = \"" + htmlInputTextAjax.getStyle() + "\";\n");
- }
- else
- {
- buff.append("errorField.style.cssText = \"\";\n")
+ buff.append("errorField.style.cssText = \"" + htmlInputTextAjax.getStyle() + "\";\n");
+ }
+ else
+ {
+ buff.append("errorField.style.cssText = \"\";\n")
.append("errorField.className = \"\";\n");
- }
+ }
+
- buff.append(" }\n")
- .append(" }catch(e)\n")
- .append(" {\n")
- .append(" this.dispatchException(e);\n")
- .append(" }\n")
- .append(" }\n");
}
+ buff.append(" }\n")
+ .append(" }catch(e)\n")
+ .append(" {\n")
+ .append(" this.dispatchException(e);\n")
+ .append(" }\n")
+ .append(" }\n");
buff.append("function ").append(jsNameSpace)
.append("notifyElementFailure(originalRequest){\n")
@@ -320,8 +322,8 @@
buff.append(", onFailure: ").append(jsNameSpace).append("notifyElementFailure");
buff.append(
"} \n" +
- " );\n" +
- "}"
+ " );\n" +
+ "}"
);
out.writeText(buff.toString(), null);
Modified: myfaces/tomahawk/trunk/sandbox/examples/src/main/webapp/WEB-INF/web.xml
URL: http://svn.apache.org/viewcvs/myfaces/tomahawk/trunk/sandbox/examples/src/main/webapp/WEB-INF/web.xml?rev=387978&r1=387977&r2=387978&view=diff
==============================================================================
--- myfaces/tomahawk/trunk/sandbox/examples/src/main/webapp/WEB-INF/web.xml (original)
+++ myfaces/tomahawk/trunk/sandbox/examples/src/main/webapp/WEB-INF/web.xml Wed Mar 22 16:18:19 2006
@@ -49,7 +49,7 @@
<filter>
<filter-name>extensionsFilter</filter-name>
- <filter-class>org.apache.myfaces.component.html.util.ExtensionsFilter</filter-class>
+ <filter-class>org.apache.myfaces.webapp.filter.ExtensionsFilter</filter-class>
<init-param>
<description>Set the size limit for uploaded files.
Format: 10 - 10 bytes
Modified: myfaces/tomahawk/trunk/sandbox/examples/src/main/webapp/css/basic.css
URL: http://svn.apache.org/viewcvs/myfaces/tomahawk/trunk/sandbox/examples/src/main/webapp/css/basic.css?rev=387978&r1=387977&r2=387978&view=diff
==============================================================================
--- myfaces/tomahawk/trunk/sandbox/examples/src/main/webapp/css/basic.css (original)
+++ myfaces/tomahawk/trunk/sandbox/examples/src/main/webapp/css/basic.css Wed Mar 22 16:18:19 2006
@@ -1,5 +1,6 @@
-body {
- font-family : verdana, Geneva, Arial, Helvetica, sans-serif;
+body, td {
+ font-family : arial, verdana, Geneva, Arial, Helvetica, sans-serif;
+ font-size : 12px;
}
.standard {
Modified: myfaces/tomahawk/trunk/sandbox/examples/src/main/webapp/inputAjax.jsp
URL: http://svn.apache.org/viewcvs/myfaces/tomahawk/trunk/sandbox/examples/src/main/webapp/inputAjax.jsp?rev=387978&r1=387977&r2=387978&view=diff
==============================================================================
--- myfaces/tomahawk/trunk/sandbox/examples/src/main/webapp/inputAjax.jsp (original)
+++ myfaces/tomahawk/trunk/sandbox/examples/src/main/webapp/inputAjax.jsp Wed Mar 22 16:18:19 2006
@@ -57,6 +57,7 @@
random text into the Fields.<br/> It is possible to place one error message beneath each field or having one
central place for displaying all messages. <br/> In this case it may be useful to mark with the
help of the errorStyleClass or errorStyle attribute of the ajax fields where the error have occured. </p> <br/>
+
<f:view>
<t:panelLayout
@@ -131,7 +132,6 @@
<h:panelGrid columns="1">
<s:selectManyCheckboxAjax
id="smcb"
- forceId="true"
value="#{inputAjaxBean.chosenValues}">
<f:selectItems
value="#{inputAjaxBean.checkboxItems}"/>
@@ -143,7 +143,6 @@
<h:panelGrid columns="1">
<s:selectOneRadioAjax
id="radio1"
- forceId="true"
value="#{inputAjaxBean.radioValue}">
<f:valueChangeListener type="org.apache.myfaces.custom.inputAjax.SampleValueChangeListener"/>
<f:selectItems
@@ -157,11 +156,10 @@
<h:panelGroup>
<s:selectBooleanCheckboxAjax
id="toggle1"
- forceId="true"
value="#{inputAjaxBean.toggle1}"/>
<h:outputText value="Got Milk?"/>
</h:panelGroup>
- <s:message for="toggle1" styleClass="error"/>
+ <t:message for="toggle1" forceSpan="true" styleClass="errorMessage"/>
<f:verbatim>This component demonstrates ajax updating ability based on a toggle switch.</f:verbatim>
</h:panelGrid>
@@ -170,7 +168,6 @@
<h:panelGroup>
<s:selectBooleanCheckboxAjax
id="toggle2"
- forceId="true"
value="#{inputAjaxBean.toggle2}"
onImage="images/nav-plus.gif"
offImage="images/nav-minus.gif">
@@ -178,13 +175,13 @@
</s:selectBooleanCheckboxAjax>
<h:outputText value="Got Juice?"/>
</h:panelGroup>
- <s:message for="toggle2" styleClass="error"/>
+ <t:message for="toggle2" forceSpan="true" styleClass="errorMessage"/>
<f:verbatim>This component demonstrates ajax updating ability based on a toggle switch.</f:verbatim>
</h:panelGrid>
</h:panelGrid>
- <t:div id="statusDiv" forceId="true"></t:div>
+ <t:div id="statusDiv" ></t:div>
<h:commandButton action="#{inputAjaxBean.submit}" value="Submit"/>
</h:form>
</f:facet>
Added: myfaces/tomahawk/trunk/sandbox/examples/src/main/webapp/killSession.jsp
URL: http://svn.apache.org/viewcvs/myfaces/tomahawk/trunk/sandbox/examples/src/main/webapp/killSession.jsp?rev=387978&view=auto
==============================================================================
--- myfaces/tomahawk/trunk/sandbox/examples/src/main/webapp/killSession.jsp (added)
+++ myfaces/tomahawk/trunk/sandbox/examples/src/main/webapp/killSession.jsp Wed Mar 22 16:18:19 2006
@@ -0,0 +1,9 @@
+<%
+ // This is just if you want to kill the session for the current user so you can start fresh without restarting tomcat.
+ // Good for when making changes to the component tree
+ session.invalidate();
+%>
+Session Dead
+<br/>
+<br/>
+<a href="index.jsf">Home</a>