jsf 2 - How to find composite component in JSF component tree? -


i implement simple method, iterate jsf components tree , sets components disabled. (so user cannot change values). method doesn't function composite components. how can detect composite component @ least? can try set special attribute disabled.

the uicomponent class has iscompositecomponent() helper method purpose.

so, should do:

for (uicomponent child : component.getchildren()) {     if (uicomponent.iscompositecomponent(child)) {         // it's composite child!     } } 

for interested in "under covers" workings, here's implementation source code mojarra 2.1.25:

public static boolean iscompositecomponent(uicomponent component) {      if (component == null) {         throw new nullpointerexception();     }     boolean result = false;     if (null != component.iscompositecomponent) {         result = component.iscompositecomponent.booleanvalue();     } else {         result = component.iscompositecomponent =                 (component.getattributes().containskey(                            resource.component_resource_key));     }     return result;  } 

it's identified presence of component attribute name definied resource.component_resource_key has value of "javax.faces.application.resource.componentresource".


Comments

Popular posts from this blog

assembly - 8086 TASM: Illegal Indexing Mode -

Java, LWJGL, OpenGL 1.1, decoding BufferedImage to Bytebuffer and binding to OpenGL across classes -

javascript - addthis share facebook and google+ url -