You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@myfaces.apache.org by bo...@apache.org on 2007/08/13 17:12:52 UTC
svn commit: r565374 - in
/myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago:
component/ComponentUtil.java renderkit/html/HtmlRendererUtil.java
taglib/decl/HasColumnLayout.java taglib/decl/HasRowLayout.java
Author: bommel
Date: Mon Aug 13 08:12:51 2007
New Revision: 565374
URL: http://svn.apache.org/viewvc?view=rev&rev=565374
Log:
minor fix for getClientId for UIData
update tld documentation for row and column in gridlayout
added hasErrorMessages util method
Modified:
myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/component/ComponentUtil.java
myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/renderkit/html/HtmlRendererUtil.java
myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/taglib/decl/HasColumnLayout.java
myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/taglib/decl/HasRowLayout.java
Modified: myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/component/ComponentUtil.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/component/ComponentUtil.java?view=diff&rev=565374&r1=565373&r2=565374
==============================================================================
--- myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/component/ComponentUtil.java (original)
+++ myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/component/ComponentUtil.java Mon Aug 13 08:12:51 2007
@@ -110,6 +110,17 @@
private ComponentUtil() {
}
+
+ public static boolean hasErrorMessages(FacesContext context) {
+ for (Iterator iter = context.getMessages(); iter.hasNext();) {
+ FacesMessage message = (FacesMessage) iter.next();
+ if (FacesMessage.SEVERITY_ERROR.compareTo(message.getSeverity()) <= 0) {
+ return true;
+ }
+ }
+ return false;
+ }
+
public static boolean containsPopupActionListener(UICommand command) {
ActionListener [] actionListeners = command.getActionListeners();
for(ActionListener actionListener: actionListeners) {
@@ -1166,11 +1177,11 @@
result.add(string.trim());
}
}
- return (String[]) result.toArray(new String[result.size()]);
+ return result.toArray(new String[result.size()]);
} else if (markups == null) {
return new String[0];
} else {
- return new String[]{(String) markups.toString()};
+ return new String[]{markups.toString()};
}
}
@@ -1266,4 +1277,4 @@
// we should reset rowIndex on UIData
uiData.setRowIndex(oldRowIndex);
}
- }
+}
Modified: myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/renderkit/html/HtmlRendererUtil.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/renderkit/html/HtmlRendererUtil.java?view=diff&rev=565374&r1=565373&r2=565374
==============================================================================
--- myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/renderkit/html/HtmlRendererUtil.java (original)
+++ myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/renderkit/html/HtmlRendererUtil.java Mon Aug 13 08:12:51 2007
@@ -34,6 +34,7 @@
import static org.apache.myfaces.tobago.TobagoConstants.RENDERER_TYPE_OUT;
import org.apache.myfaces.tobago.component.ComponentUtil;
import org.apache.myfaces.tobago.component.UIPage;
+import org.apache.myfaces.tobago.component.UIData;
import org.apache.myfaces.tobago.context.ResourceManagerUtil;
import org.apache.myfaces.tobago.renderkit.LabelWithAccessKey;
import org.apache.myfaces.tobago.renderkit.LayoutInformationProvider;
@@ -46,6 +47,7 @@
import javax.faces.component.UIComponent;
import javax.faces.component.UIInput;
+import javax.faces.component.NamingContainer;
import javax.faces.context.FacesContext;
import javax.faces.context.ResponseWriter;
import javax.faces.model.SelectItem;
@@ -589,7 +591,14 @@
public static String getComponentId(FacesContext context, UIComponent component, String componentId) {
UIComponent partiallyComponent = ComponentUtil.findComponent(component, componentId);
if (partiallyComponent != null) {
- return partiallyComponent.getClientId(context);
+ String clientId = partiallyComponent.getClientId(context);
+ if (partiallyComponent instanceof UIData) {
+ int rowIndex = ((UIData)partiallyComponent).getRowIndex();
+ if (rowIndex >= 0 && clientId.endsWith(Integer.toString(rowIndex))) {
+ return clientId.substring(0, clientId.lastIndexOf(NamingContainer.SEPARATOR_CHAR));
+ }
+ }
+ return clientId;
}
// TODO log error message if no component founc
return null;
Modified: myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/taglib/decl/HasColumnLayout.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/taglib/decl/HasColumnLayout.java?view=diff&rev=565374&r1=565373&r2=565374
==============================================================================
--- myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/taglib/decl/HasColumnLayout.java (original)
+++ myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/taglib/decl/HasColumnLayout.java Mon Aug 13 08:12:51 2007
@@ -30,6 +30,6 @@
* Semicolon separated list of layout tokens ('*', '<x>*', '<x>px' or '<x>%').
* Where '*' is equvalent to '1*'.
*/
- @TagAttribute @UIComponentTagAttribute()
+ @TagAttribute @UIComponentTagAttribute(defaultValue = "1*")
void setColumns(String columns);
}
Modified: myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/taglib/decl/HasRowLayout.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/taglib/decl/HasRowLayout.java?view=diff&rev=565374&r1=565373&r2=565374
==============================================================================
--- myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/taglib/decl/HasRowLayout.java (original)
+++ myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/taglib/decl/HasRowLayout.java Mon Aug 13 08:12:51 2007
@@ -30,6 +30,6 @@
* Semicolon separated list of layout tokens ('<x>*', '<x>px', '<x>%' or 'fixed').
*
*/
- @TagAttribute @UIComponentTagAttribute()
+ @TagAttribute @UIComponentTagAttribute(defaultValue = "1*")
void setRows(String rows);
}