myfaces-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From drobin...@apache.org
Subject svn commit: r557634 - in /myfaces/trinidad/trunk/trinidad/trinidad-examples/trinidad-demo/src/main: java/org/apache/myfaces/trinidaddemo/MessagesBean.java webapp/WEB-INF/faces-config.xml webapp/components/messages.jspx
Date Thu, 19 Jul 2007 14:15:28 GMT
Author: drobinson
Date: Thu Jul 19 07:15:27 2007
New Revision: 557634

URL: http://svn.apache.org/viewvc?view=rev&rev=557634
Log:
Updated tr:messages demo to better exercise latest MessageBoxRenderer.
TRINIDAD-110

Added:
    myfaces/trinidad/trunk/trinidad/trinidad-examples/trinidad-demo/src/main/java/org/apache/myfaces/trinidaddemo/MessagesBean.java
Modified:
    myfaces/trinidad/trunk/trinidad/trinidad-examples/trinidad-demo/src/main/webapp/WEB-INF/faces-config.xml
    myfaces/trinidad/trunk/trinidad/trinidad-examples/trinidad-demo/src/main/webapp/components/messages.jspx

Added: myfaces/trinidad/trunk/trinidad/trinidad-examples/trinidad-demo/src/main/java/org/apache/myfaces/trinidaddemo/MessagesBean.java
URL: http://svn.apache.org/viewvc/myfaces/trinidad/trunk/trinidad/trinidad-examples/trinidad-demo/src/main/java/org/apache/myfaces/trinidaddemo/MessagesBean.java?view=auto&rev=557634
==============================================================================
--- myfaces/trinidad/trunk/trinidad/trinidad-examples/trinidad-demo/src/main/java/org/apache/myfaces/trinidaddemo/MessagesBean.java
(added)
+++ myfaces/trinidad/trunk/trinidad/trinidad-examples/trinidad-demo/src/main/java/org/apache/myfaces/trinidaddemo/MessagesBean.java
Thu Jul 19 07:15:27 2007
@@ -0,0 +1,57 @@
+/*
+ *  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.trinidaddemo;
+
+import java.util.Date;
+
+import javax.faces.application.FacesMessage;
+import javax.faces.context.FacesContext;
+
+public class MessagesBean implements java.io.Serializable
+{
+  public String createGlobalMessage()
+  {
+    FacesContext context = FacesContext.getCurrentInstance();
+
+    FacesMessage msg = new FacesMessage(FacesMessage.SEVERITY_FATAL,
+        "Fatal Msg.", "Programatically generated at " + new Date());
+    
+    context.addMessage(null, msg);
+
+    return null;
+  }
+
+  public String createMultipleGlobalMessages()
+  {
+    FacesContext context = FacesContext.getCurrentInstance();
+
+    FacesMessage msg = new FacesMessage(FacesMessage.SEVERITY_WARN,
+        "Warning Msg.", "Programatically generated at " + new Date());
+
+    context.addMessage(null, msg);
+    
+    msg = new FacesMessage(FacesMessage.SEVERITY_INFO,
+        "Info Msg.", "Programatically generated at " + new Date());
+
+    context.addMessage(null, msg);
+
+    return null;
+  }
+
+}

Modified: myfaces/trinidad/trunk/trinidad/trinidad-examples/trinidad-demo/src/main/webapp/WEB-INF/faces-config.xml
URL: http://svn.apache.org/viewvc/myfaces/trinidad/trunk/trinidad/trinidad-examples/trinidad-demo/src/main/webapp/WEB-INF/faces-config.xml?view=diff&rev=557634&r1=557633&r2=557634
==============================================================================
--- myfaces/trinidad/trunk/trinidad/trinidad-examples/trinidad-demo/src/main/webapp/WEB-INF/faces-config.xml
(original)
+++ myfaces/trinidad/trunk/trinidad/trinidad-examples/trinidad-demo/src/main/webapp/WEB-INF/faces-config.xml
Thu Jul 19 07:15:27 2007
@@ -173,6 +173,15 @@
     </managed-bean-scope>
   </managed-bean>
 
+  <managed-bean>
+    <managed-bean-name>messages</managed-bean-name>
+    <managed-bean-class>
+       org.apache.myfaces.trinidaddemo.MessagesBean
+    </managed-bean-class>
+    <managed-bean-scope>
+       session
+    </managed-bean-scope>
+  </managed-bean>
 
   <managed-bean>
     <managed-bean-name>table</managed-bean-name>

Modified: myfaces/trinidad/trunk/trinidad/trinidad-examples/trinidad-demo/src/main/webapp/components/messages.jspx
URL: http://svn.apache.org/viewvc/myfaces/trinidad/trunk/trinidad/trinidad-examples/trinidad-demo/src/main/webapp/components/messages.jspx?view=diff&rev=557634&r1=557633&r2=557634
==============================================================================
--- myfaces/trinidad/trunk/trinidad/trinidad-examples/trinidad-demo/src/main/webapp/components/messages.jspx
(original)
+++ myfaces/trinidad/trunk/trinidad/trinidad-examples/trinidad-demo/src/main/webapp/components/messages.jspx
Thu Jul 19 07:15:27 2007
@@ -35,17 +35,35 @@
                 action="guide"/>            
             <tr:outputFormatted styleUsage="instruction" value="&lt;b>Simple messages
demo&lt;/b>"/>
               
-            <tr:messages binding="#{editor.component}"/>
+            <tr:messages binding="#{editor.component}" onclick="alert('clicked');"/>
 
-            <tr:inputText label="Label">
+            <tr:panelFormLayout>
+              <tr:inputText label="Amount">
+                  <f:facet name="help">
+                    <tr:outputText value="Type 'cat' to see an error in the message box"/>
+                  </f:facet>
+                <f:converter converterId="javax.faces.BigInteger"/>
+              </tr:inputText>    
+              
+              <tr:inputText label="Threshold">
                 <f:facet name="help">
-                  <tr:outputText value="Type 'cat' to see an error in the message box"/>
+                  <tr:outputText value="type='percent' locale='en_US' - This results in
fraction displayed as integer value with % symbol"/>
                 </f:facet>
-              <f:converter converterId="javax.faces.BigInteger"/>
-            </tr:inputText>                      
-             
+                <f:convertNumber type="percent" locale="en_US"/>
+              </tr:inputText>
+
+            </tr:panelFormLayout>            
+
             <tr:commandButton id="messages" text="Submit"/>
 
+            <tr:panelHorizontalLayout>
+    
+              <tr:commandButton text="Add Message" action="#{messages.createGlobalMessage}"
immediate="true" ></tr:commandButton>                  
+
+              <tr:commandButton text="Add Multiple Messages" action="#{messages.createMultipleGlobalMessages}"
immediate="true" ></tr:commandButton>                  
+    
+            </tr:panelHorizontalLayout>
+            
             <jsp:directive.include file="editor.jspf" />
     
           </tr:panelGroupLayout>



Mime
View raw message