/** Returns the component definition of the specified class, or null
* if not found.
*/
private static ComponentDefinition getDefinition(Execution exec, Class cls) {
if (exec != null) {
final ExecutionCtrl execCtrl = (ExecutionCtrl)exec;
final PageDefinition pgdef = execCtrl.getCurrentPageDefinition();
final Page page = execCtrl.getCurrentPage();
final ComponentDefinition compdef =
pgdef != null ? pgdef.getComponentDefinition(cls, true):
page != null ? page.getComponentDefinition(cls, true): null;
if (compdef != null && compdef.getLanguageDefinition() != null)