You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@myfaces.apache.org by we...@apache.org on 2006/08/20 12:59:41 UTC
svn commit: r432964 - in /myfaces/tobago/trunk:
core/src/main/java/org/apache/myfaces/tobago/
core/src/main/java/org/apache/myfaces/tobago/taglib/component/
example/demo/src/main/java/org/apache/myfaces/tobago/example/demo/clientConfig/
theme/scarborou...
Author: weber
Date: Sun Aug 20 03:59:40 2006
New Revision: 432964
URL: http://svn.apache.org/viewvc?rev=432964&view=rev
Log:
TOBAGO-57 (Add globalOnly attribute to messages tag)
Modified:
myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/TobagoConstants.java
myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/taglib/component/MessagesTag.java
myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/taglib/component/MessagesTagDeclaration.java
myfaces/tobago/trunk/example/demo/src/main/java/org/apache/myfaces/tobago/example/demo/clientConfig/ClientConfigController.java
myfaces/tobago/trunk/theme/scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/MessagesRenderer.java
Modified: myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/TobagoConstants.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/TobagoConstants.java?rev=432964&r1=432963&r2=432964&view=diff
==============================================================================
--- myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/TobagoConstants.java (original)
+++ myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/TobagoConstants.java Sun Aug 20 03:59:40 2006
@@ -52,6 +52,7 @@
public static final String ATTR_FORCE_VERTICAL_SCROLLBAR = "forceVerticalScrollbar";
public static final String ATTR_FORMAT_PATTERN = "formatPattern";
public static final String ATTR_FOR = "for";
+ public static final String ATTR_GLOBAL_ONLY = "globalOnly";
public static final String ATTR_HEIGHT = "height";
public static final String ATTR_HIDDEN = "hidden";
public static final String ATTR_HOVER = "hover";
Modified: myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/taglib/component/MessagesTag.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/taglib/component/MessagesTag.java?rev=432964&r1=432963&r2=432964&view=diff
==============================================================================
--- myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/taglib/component/MessagesTag.java (original)
+++ myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/taglib/component/MessagesTag.java Sun Aug 20 03:59:40 2006
@@ -17,6 +17,7 @@
*/
import static org.apache.myfaces.tobago.TobagoConstants.ATTR_FOR;
+import static org.apache.myfaces.tobago.TobagoConstants.ATTR_GLOBAL_ONLY;
import org.apache.myfaces.tobago.component.ComponentUtil;
import javax.faces.component.UIComponent;
@@ -28,6 +29,7 @@
private String forComponent;
+ private String globalOnly;
public String getComponentType() {
return UIMessages.COMPONENT_TYPE;
@@ -36,6 +38,7 @@
protected void setProperties(UIComponent component) {
super.setProperties(component);
ComponentUtil.setStringProperty(component, ATTR_FOR, forComponent);
+ ComponentUtil.setBooleanProperty(component, ATTR_GLOBAL_ONLY, globalOnly);
}
public void release() {
@@ -49,5 +52,9 @@
public void setFor(String forComponent) {
this.forComponent = forComponent;
+ }
+
+ public void setGlobalOnly(String globalOnly) {
+ this.globalOnly = globalOnly;
}
}
Modified: myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/taglib/component/MessagesTagDeclaration.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/taglib/component/MessagesTagDeclaration.java?rev=432964&r1=432963&r2=432964&view=diff
==============================================================================
--- myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/taglib/component/MessagesTagDeclaration.java (original)
+++ myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/taglib/component/MessagesTagDeclaration.java Sun Aug 20 03:59:40 2006
@@ -18,7 +18,9 @@
import org.apache.myfaces.tobago.apt.annotation.BodyContent;
import org.apache.myfaces.tobago.apt.annotation.Tag;
+import org.apache.myfaces.tobago.apt.annotation.TagAttribute;
import org.apache.myfaces.tobago.apt.annotation.UIComponentTag;
+import org.apache.myfaces.tobago.apt.annotation.UIComponentTagAttribute;
import org.apache.myfaces.tobago.taglib.decl.HasFor;
import org.apache.myfaces.tobago.taglib.decl.HasIdBindingAndRendered;
@@ -39,4 +41,13 @@
rendererType = "Messages")
public interface MessagesTagDeclaration extends TobagoTagDeclaration, HasIdBindingAndRendered, HasFor {
+
+ /**
+ * Flag indicating that only messages that are not associated to any
+ * particular UIComponent should be displayed. That are messages without clientId.
+ * The default is "false".
+ */
+ @TagAttribute
+ @UIComponentTagAttribute()
+ void setGlobalOnly(String globalOnly);
}
Modified: myfaces/tobago/trunk/example/demo/src/main/java/org/apache/myfaces/tobago/example/demo/clientConfig/ClientConfigController.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/example/demo/src/main/java/org/apache/myfaces/tobago/example/demo/clientConfig/ClientConfigController.java?rev=432964&r1=432963&r2=432964&view=diff
==============================================================================
--- myfaces/tobago/trunk/example/demo/src/main/java/org/apache/myfaces/tobago/example/demo/clientConfig/ClientConfigController.java (original)
+++ myfaces/tobago/trunk/example/demo/src/main/java/org/apache/myfaces/tobago/example/demo/clientConfig/ClientConfigController.java Sun Aug 20 03:59:40 2006
@@ -21,11 +21,12 @@
* $Id: ClientConfigController.java 1271 2005-08-08 20:44:11 +0200 (Mo, 08 Aug 2005) lofwyr $
*/
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
import org.apache.myfaces.tobago.config.TobagoConfig;
import org.apache.myfaces.tobago.context.ClientProperties;
import org.apache.myfaces.tobago.context.Theme;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
import javax.faces.application.Application;
import javax.faces.context.FacesContext;
Modified: myfaces/tobago/trunk/theme/scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/MessagesRenderer.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/theme/scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/MessagesRenderer.java?rev=432964&r1=432963&r2=432964&view=diff
==============================================================================
--- myfaces/tobago/trunk/theme/scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/MessagesRenderer.java (original)
+++ myfaces/tobago/trunk/theme/scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/MessagesRenderer.java Sun Aug 20 03:59:40 2006
@@ -21,19 +21,22 @@
* $Id$
*/
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
+import static org.apache.myfaces.tobago.TobagoConstants.ATTR_GLOBAL_ONLY;
import static org.apache.myfaces.tobago.TobagoConstants.ATTR_STYLE;
import org.apache.myfaces.tobago.component.ComponentUtil;
import org.apache.myfaces.tobago.renderkit.MessageRendererBase;
import org.apache.myfaces.tobago.renderkit.html.HtmlConstants;
import org.apache.myfaces.tobago.webapp.TobagoResponseWriter;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
import javax.faces.application.FacesMessage;
import javax.faces.component.UIComponent;
import javax.faces.context.FacesContext;
import javax.faces.context.ResponseWriter;
import java.io.IOException;
+import java.util.ArrayList;
import java.util.Iterator;
public class MessagesRenderer extends MessageRendererBase {
@@ -70,7 +73,14 @@
// with id
String focusId = null;
- Iterator clientIds = facesContext.getClientIdsWithMessages();
+ Iterator clientIds;
+ if (ComponentUtil.getBooleanAttribute(component, ATTR_GLOBAL_ONLY)) {
+ ArrayList<String> list = new ArrayList<String>(1);
+ list.add(null);
+ clientIds = list.iterator();
+ } else {
+ clientIds = facesContext.getClientIdsWithMessages();
+ }
while(clientIds.hasNext()) {
String clientId = (String) clientIds.next();
encodeMessagesForId(facesContext, writer, clientId);