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 2006/11/03 00:56:49 UTC
svn commit: r470606 -
/myfaces/tobago/trunk/theme/scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/GridLayoutRenderer.java
Author: bommel
Date: Thu Nov 2 15:56:48 2006
New Revision: 470606
URL: http://svn.apache.org/viewvc?view=rev&rev=470606
Log:
Avoid ClassCastException
Modified:
myfaces/tobago/trunk/theme/scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/GridLayoutRenderer.java
Modified: myfaces/tobago/trunk/theme/scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/GridLayoutRenderer.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/theme/scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/GridLayoutRenderer.java?view=diff&rev=470606&r1=470605&r2=470606
==============================================================================
--- myfaces/tobago/trunk/theme/scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/GridLayoutRenderer.java (original)
+++ myfaces/tobago/trunk/theme/scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/GridLayoutRenderer.java Thu Nov 2 15:56:48 2006
@@ -566,8 +566,8 @@
private int getMaxHeight(FacesContext facesContext, UIGridLayout.Row row, boolean minimum) {
int maxHeight = 0;
List cells = row.getElements();
- for (int j = 0; j < cells.size(); j++) {
- Object object = cells.get(j);
+ for (Object cell : cells) {
+ Object object = cell;
if (object instanceof UIComponent) {
UIComponent component = (UIComponent) object;
@@ -576,11 +576,14 @@
height = (int) LayoutUtil.getMinimumSize(facesContext, component).getHeight();
} else {
RendererBase renderer = ComponentUtil.getRenderer(facesContext, component);
- if (renderer instanceof RendererBase) {
+ if (renderer != null) {
height = renderer.getFixedHeight(facesContext, component);
}
}
maxHeight = Math.max(maxHeight, height);
+ } else {
+ // TODO is this needed?
+ LOG.error("Object is not instanceof UIComponent " + object.getClass().getName() );
}
}
return maxHeight;
@@ -591,17 +594,25 @@
for (UIGridLayout.Row row : rows) {
if (column < row.getElements().size()) {
- UIComponent component = (UIComponent) row.getElements().get(column);
- int max = -1;
- if (minimum) {
- max = (int) LayoutUtil.getMinimumSize(facesContext, component).getWidth();
- } else {
- RendererBase renderer = ComponentUtil.getRenderer(facesContext, component);
- if (renderer instanceof RendererBase) {
- max = renderer.getFixedWidth(facesContext, component);
+ Object object = row.getElements().get(column);
+
+ if (object instanceof UIComponent) {
+ UIComponent component = (UIComponent) object;
+
+ int max = -1;
+ if (minimum) {
+ max = (int) LayoutUtil.getMinimumSize(facesContext, component).getWidth();
+ } else {
+ RendererBase renderer = ComponentUtil.getRenderer(facesContext, component);
+ if (renderer != null) {
+ max = renderer.getFixedWidth(facesContext, component);
+ }
}
+ maxWidth = Math.max(maxWidth, max);
+ } else {
+ // TODO is this needed?
+ LOG.error("Object is not instanceof UIComponent " + object.getClass().getName() );
}
- maxWidth = Math.max(maxWidth, max);
}
}
return maxWidth;