[jboss-cvs] jboss-seam/src/ui/org/jboss/seam/ui ...
Gavin King
gavin.king at jboss.com
Mon Feb 26 20:44:53 EST 2007
User: gavin
Date: 07/02/26 20:44:53
Modified: src/ui/org/jboss/seam/ui UIDecorate.java
Log:
better search algorithm
Revision Changes Path
1.7 +24 -11 jboss-seam/src/ui/org/jboss/seam/ui/UIDecorate.java
(In the diff below, changes in quantity of whitespace are not shown.)
Index: UIDecorate.java
===================================================================
RCS file: /cvsroot/jboss/jboss-seam/src/ui/org/jboss/seam/ui/UIDecorate.java,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -b -r1.6 -r1.7
--- UIDecorate.java 17 Feb 2007 03:02:04 -0000 1.6
+++ UIDecorate.java 27 Feb 2007 01:44:53 -0000 1.7
@@ -23,17 +23,14 @@
private boolean hasMessage()
{
- String id = getInputId();
-
- if (id==null)
+ String clientId = getInputClientId();
+ if (clientId==null)
{
return false;
}
else
{
- UIComponent component = findComponent(id);
- return component==null ? null :
- getFacesContext().getMessages( component.getClientId( getFacesContext() ) ).hasNext();
+ return getFacesContext().getMessages(clientId).hasNext();
}
}
@@ -42,7 +39,8 @@
String id = getFor();
if (id==null)
{
- return getInputId(this);
+ UIInput input = getInput(this);
+ return input==null ? null : input.getId();
}
else
{
@@ -50,10 +48,25 @@
}
}
+ private String getInputClientId()
+ {
+ String id = getFor();
+ if (id==null)
+ {
+ UIInput input = getInput(this);
+ return input==null ? null : input.getClientId( getFacesContext() );
+ }
+ else
+ {
+ UIComponent component = findComponent(id);
+ return component==null ? null : component.getClientId( getFacesContext() );
+ }
+ }
+
/**
* A depth-first search for a UIInput
*/
- private static String getInputId(UIComponent component)
+ private static UIInput getInput(UIComponent component)
{
for (Object child: component.getChildren())
{
@@ -62,13 +75,13 @@
UIInput input = (UIInput) child;
if ( input.isRendered() )
{
- return input.getId();
+ return input;
}
}
else if (child instanceof UIComponent)
{
- String id = getInputId( (UIComponent) child );
- if (id!=null) return id;
+ UIInput input = getInput( (UIComponent) child );
+ if (input!=null) return input;
}
}
return null;
More information about the jboss-cvs-commits
mailing list