myfaces-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From hno...@apache.org
Subject svn commit: r1792180 - in /myfaces/tobago/trunk: tobago-core/src/main/java/org/apache/myfaces/tobago/internal/renderkit/renderer/ tobago-example/tobago-example-demo/src/main/java/org/apache/myfaces/tobago/example/demo/ tobago-example/tobago-example-dem...
Date Fri, 21 Apr 2017 11:02:03 GMT
Author: hnoeth
Date: Fri Apr 21 11:02:03 2017
New Revision: 1792180

URL: http://svn.apache.org/viewvc?rev=1792180&view=rev
Log:
TOBAGO-1550 Add f:message to form-elements automatically
* messages can now also appear on tc:out

Added:
    myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/java/org/apache/myfaces/tobago/example/demo/MessageLayoutController.java
Modified:
    myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/renderkit/renderer/OutRenderer.java
    myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/webapp/content/40-test/60000-manual/5000-messageLayout/messageLayout.xhtml

Modified: myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/renderkit/renderer/OutRenderer.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/renderkit/renderer/OutRenderer.java?rev=1792180&r1=1792179&r2=1792180&view=diff
==============================================================================
--- myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/renderkit/renderer/OutRenderer.java
(original)
+++ myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/renderkit/renderer/OutRenderer.java
Fri Apr 21 11:02:03 2017
@@ -36,10 +36,10 @@ import javax.faces.context.FacesContext;
 import java.io.IOException;
 import java.util.StringTokenizer;
 
-public class OutRenderer extends LabelLayoutRendererBase {
+public class OutRenderer extends MessageLayoutRendererBase {
 
   @Override
-  public void encodeBeginMessageField(final FacesContext facesContext, final UIComponent
component) throws IOException {
+  public void encodeBeginField(final FacesContext facesContext, final UIComponent component)
throws IOException {
 
     final UIOut out = (UIOut) component;
 
@@ -84,7 +84,7 @@ public class OutRenderer extends LabelLa
   }
 
   @Override
-  public void encodeEndMessageField(final FacesContext facesContext, final UIComponent component)
throws IOException {
+  public void encodeEndField(final FacesContext facesContext, final UIComponent component)
throws IOException {
 
     final UIOut out = (UIOut) component;
     final TobagoResponseWriter writer = getResponseWriter(facesContext);

Added: myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/java/org/apache/myfaces/tobago/example/demo/MessageLayoutController.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/java/org/apache/myfaces/tobago/example/demo/MessageLayoutController.java?rev=1792180&view=auto
==============================================================================
--- myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/java/org/apache/myfaces/tobago/example/demo/MessageLayoutController.java
(added)
+++ myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/java/org/apache/myfaces/tobago/example/demo/MessageLayoutController.java
Fri Apr 21 11:02:03 2017
@@ -0,0 +1,48 @@
+/*
+ * 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.tobago.example.demo;
+
+import javax.enterprise.context.RequestScoped;
+import javax.faces.application.FacesMessage;
+import javax.faces.component.UIComponent;
+import javax.faces.context.FacesContext;
+import javax.inject.Named;
+import java.io.Serializable;
+
+@Named
+@RequestScoped
+public class MessageLayoutController implements Serializable {
+
+  private UIComponent component;
+
+  public UIComponent getComponent() {
+    return component;
+  }
+
+  public void setComponent(UIComponent component) {
+    this.component = component;
+  }
+
+  public void addInfo() {
+    final FacesMessage message = new FacesMessage(
+        FacesMessage.SEVERITY_INFO, "Custom info", "This is an info message on an output
field");
+    FacesContext.getCurrentInstance().addMessage(component.getClientId(), message);
+  }
+}

Modified: myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/webapp/content/40-test/60000-manual/5000-messageLayout/messageLayout.xhtml
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/webapp/content/40-test/60000-manual/5000-messageLayout/messageLayout.xhtml?rev=1792180&r1=1792179&r2=1792180&view=diff
==============================================================================
--- myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/webapp/content/40-test/60000-manual/5000-messageLayout/messageLayout.xhtml
(original)
+++ myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/webapp/content/40-test/60000-manual/5000-messageLayout/messageLayout.xhtml
Fri Apr 21 11:02:03 2017
@@ -76,5 +76,32 @@
                       var="planet" itemLabel="#{planet.name}" itemValue="#{planet}"/>
     </tc:selectManyShuttle>
     <tc:file label="File" required="true" validator="#{severityController.addFatal}"/>
+
+    <tc:section label="Ouput Components">
+      <tc:form id="outputComponents">
+        <tc:button label="Add Messages" action="#{messageLayoutController.addInfo}"/>
+        <tc:out id="out" label="Output" value="123" binding="#{messageLayoutController.component}"/>
+      </tc:form>
+    </tc:section>
+  </tc:section>
+
+  <tc:section label="Special Situations">
+    <tc:segmentLayout large="6;6" medium="8;4" small="12" id="p2">
+      <tc:box label="Anzeige Box 2">
+        <tc:panel>
+          <tc:in label="Value"/>
+          <tc:in label="Value" value="" required="true"/>
+          <tc:in label="Value">
+            <f:facet name="after">after</f:facet>
+          </tc:in>
+          <tc:in label="Value" required="true">
+            <f:facet name="after">after</f:facet>
+          </tc:in>
+          <tc:date id="dateReq" label="Date" value="" required="true"/>
+          <tc:date id="dateNotReq" label="Date"/>
+        </tc:panel>
+      </tc:box>
+      <tc:panel/>
+    </tc:segmentLayout>
   </tc:section>
 </ui:composition>



Mime
View raw message