myfaces-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bom...@apache.org
Subject svn commit: r805099 - in /myfaces/tobago/branches/tobago-1.0.x: core/src/main/java/org/apache/myfaces/tobago/component/UIMessages.java theme/scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/MessagesRenderer.java
Date Mon, 17 Aug 2009 19:09:01 GMT
Author: bommel
Date: Mon Aug 17 19:09:01 2009
New Revision: 805099

URL: http://svn.apache.org/viewvc?rev=805099&view=rev
Log:
(TOBAGO-787) The MessagesRenderer should consider the messages filter properties of UIMessages
for calculating the height

Modified:
    myfaces/tobago/branches/tobago-1.0.x/core/src/main/java/org/apache/myfaces/tobago/component/UIMessages.java
    myfaces/tobago/branches/tobago-1.0.x/theme/scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/MessagesRenderer.java

Modified: myfaces/tobago/branches/tobago-1.0.x/core/src/main/java/org/apache/myfaces/tobago/component/UIMessages.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/branches/tobago-1.0.x/core/src/main/java/org/apache/myfaces/tobago/component/UIMessages.java?rev=805099&r1=805098&r2=805099&view=diff
==============================================================================
--- myfaces/tobago/branches/tobago-1.0.x/core/src/main/java/org/apache/myfaces/tobago/component/UIMessages.java
(original)
+++ myfaces/tobago/branches/tobago-1.0.x/core/src/main/java/org/apache/myfaces/tobago/component/UIMessages.java
Mon Aug 17 19:09:01 2009
@@ -36,33 +36,37 @@
   private FacesMessage.Severity minSeverity;
   private FacesMessage.Severity maxSeverity;
   private Integer maxNumber;
-  // todo: emnum
   private OrderBy orderBy;
   private String forValue;
   private Boolean confirmation;
 
   public List<Item> createMessageList(FacesContext facesContext) {
 
-    Iterator clientIds;
-    if (isGlobalOnly()) {
-      clientIds = new SingletonIterator(null);
-    } else if (getFor() != null) {
-      clientIds = new SingletonIterator(getFor());
-    } else {
-      clientIds = facesContext.getClientIdsWithMessages();
-    }
-
-    List<Item> messages = collectMessageList(facesContext, clientIds);
+    List<Item> messages = createMessageListInternal(facesContext);
 
     // todo
     if (OrderBy.SEVERITY.equals(orderBy)) {
       // sort
       Collections.sort(messages, new ItemComparator());
     }
+    return messages;
+  }
 
+  public int getMessageListCount(final FacesContext facesContext) {
+    return createMessageListInternal(facesContext).size();
+  }
 
+  private List<Item> createMessageListInternal(FacesContext facesContext) {
+    Iterator clientIds;
+    if (isGlobalOnly()) {
+      clientIds = new SingletonIterator(null);
+    } else if (getFor() != null) {
+      clientIds = new SingletonIterator(getFor());
+    } else {
+      clientIds = facesContext.getClientIdsWithMessages();
+    }
 
-    return messages;
+    return collectMessageList(facesContext, clientIds);
   }
 
   private List<Item> collectMessageList(FacesContext facesContext, Iterator clientIds)
{

Modified: myfaces/tobago/branches/tobago-1.0.x/theme/scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/MessagesRenderer.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/branches/tobago-1.0.x/theme/scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/MessagesRenderer.java?rev=805099&r1=805098&r2=805099&view=diff
==============================================================================
--- myfaces/tobago/branches/tobago-1.0.x/theme/scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/MessagesRenderer.java
(original)
+++ myfaces/tobago/branches/tobago-1.0.x/theme/scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/MessagesRenderer.java
Mon Aug 17 19:09:01 2009
@@ -59,10 +59,8 @@
 
   @Override
   public int getFixedHeight(FacesContext facesContext, UIComponent component) {
-    int count = 0;
-    for (Iterator i = facesContext.getMessages(); i.hasNext(); i.next()) {
-      count++;
-    }
+    UIMessages messages = (UIMessages) component;
+    int count = messages.getMessageListCount(facesContext);
     if (LOG.isDebugEnabled()) {
       LOG.debug("component = '" + component + "'");
       LOG.debug("here are " + count + " messages");
@@ -92,33 +90,10 @@
       writer.writeClassAttribute("tobago-validation-message");
       writer.writeStyleAttribute();
 
-      // with id
-      String focusId = null;
-      Iterator clientIds;
-      if (ComponentUtil.getBooleanAttribute(messages, TobagoConstants.ATTR_GLOBAL_ONLY))
{
-        ArrayList<String> list = new ArrayList<String>(1);
-        list.add(null);
-        clientIds = list.iterator();
-      } else {
-        clientIds = facesContext.getClientIdsWithMessages();
-      }
-
       for (UIMessages.Item item : messages.createMessageList(facesContext)) {
         encodeMessage(writer, messages, item.getFacesMessage(), item.getClientId());
       }
-/*
-      while(clientIds.hasNext()) {
-        String clientId = (String) clientIds.next();
-        encodeMessagesForId(facesContext, writer, clientId, showSummary, showDetail);
-        if (focusId == null) {
-          focusId = clientId;
-        }
-      }
-  todo: don't forget: focus
-      if (focusId != null) {
-        ComponentUtil.findPage(facesContext, messages).setFocusId(focusId);
-      }
-*/
+
       writer.endElement(HtmlConstants.SPAN);
     }
   }



Mime
View raw message