/** Returns {@link ComponentDefinition} of the specified name, or null * if not found. * It is the same as {@link #getShadowDefinition}, except this method * won't throw any exception. * * @param name the name of the shadow element definition. * @since 8.0.0 */ public ComponentDefinition getShadowDefinitionIfAny(String name) { return _shadowdefs.get(name); }
addComponentDefinition(pgdef._compdefs.get((String) it.next()));
/** Returns {@link ComponentDefinition} of the specified name, or null * if not found. * It is the same as {@link #getComponentDefinition}, except this method * won't throw any exception. * * @param name the name of the component definition. * @since 3.0.2 */ public ComponentDefinition getComponentDefinitionIfAny(String name) { return _compdefs.get(name); }
/** Returns {@link ComponentDefinition} of the specified name. * * <p>Note: anonymous shadow element definition won't be returned by * this method. * * @param name the name of the shadow element definition. * @exception DefinitionNotFoundException is thrown if the definition * is not found */ public ComponentDefinition getShadowDefinition(String name) { final ComponentDefinition compdef = _shadowdefs.get(name); if (compdef == null) throw new DefinitionNotFoundException("Shadow element definition not found: " + name); return compdef; }
/** Returns {@link ComponentDefinition} of the specified name. * * <p>Note: anonymous component definition won't be returned by * this method. * * @param name the name of the component definition. * @exception DefinitionNotFoundException is thrown if the definition * is not found */ public ComponentDefinition getComponentDefinition(String name) { final ComponentDefinition compdef = _compdefs.get(name); if (compdef == null) throw new DefinitionNotFoundException("Component definition not found: " + name); return compdef; }
/** Returns {@link ComponentDefinition} of the specified class. * * <p>Note: anonymous component definition won't be returned by * this method. * * @param klass the class that implements the component. * @exception DefinitionNotFoundException is thrown if the definition * is not found */ public ComponentDefinition getComponentDefinition(Class klass) { final ComponentDefinition compdef = _compdefs.get(klass); if (compdef == null) throw new DefinitionNotFoundException("Component definition not found: " + klass); return compdef; }
/** Returns {@link ComponentDefinition} of the specified class. * * <p>Note: anonymous shadow element definition won't be returned by * this method. * * @param klass the class that implements the shadow element. * @exception DefinitionNotFoundException is thrown if the definition * is not found * @since 8.0.0 */ public ComponentDefinition getShadowDefinition(Class klass) { final ComponentDefinition compdef = _shadowdefs.get(klass); if (compdef == null) throw new DefinitionNotFoundException("Shadow element definition not found: " + klass); return compdef; }
public ComponentDefinition getComponentDefinition(Class<? extends Component> cls, boolean recurse) { final ComponentDefinition compdef = _compdefs.get(cls); if (!recurse || compdef != null) return compdef; try { return _langdef.getComponentDefinition(cls); } catch (DefinitionNotFoundException ex) { try { // try with shadow element return _langdef.getShadowDefinition(cls); } catch (DefinitionNotFoundException eex) { } } return null; }
public ComponentDefinition getComponentDefinition(String name, boolean recurse) { final ComponentDefinition compdef = _compdefs.get(name); if (!recurse || compdef != null) return compdef; try { return _langdef.getComponentDefinition(name); } catch (DefinitionNotFoundException ex) { try { // try with shadow element return _langdef.getShadowDefinition(name); } catch (DefinitionNotFoundException exe) { } } return null; }
/** Returns the component definition of the specified name, or null * if not found. * * <p>Note: unlike {@link LanguageDefinition#getComponentDefinition}, * this method doesn't throw ComponentNotFoundException if not found. * It just returns null. * * @param recurse whether to look up the component from {@link #getLanguageDefinition} */ public ComponentDefinition getComponentDefinition(String name, boolean recurse) { final ComponentDefinition compdef = _compdefs.get(name); if (!recurse || compdef != null) return compdef; try { return getLanguageDefinition().getComponentDefinition(name); } catch (DefinitionNotFoundException ex) { } return null; }
/** Returns whether it is a Shadow element. * @param pref namespace's prefix * @param uri namespace's URI * @param bNativeContent whether to ignore if URI not specified explicitly */ private static final boolean isShadowElement(LanguageDefinition langdef, PageDefinition pgdef, String nm, String pref, String uri, boolean bNativeContent) { // feature in 8.0.0, no need to check namespace, if any. if ("true".equalsIgnoreCase(Library.getProperty("org.zkoss.zk.namespace.tolerant", "false"))) return langdef.hasShadowDefinition(nm) || (!"xul/html".equals(langdef.getName()) && LanguageDefinition.lookup("xul/html").hasShadowDefinition(nm)); ComponentDefinition componentDefinition = pgdef.getComponentDefinitionMap().get(nm); // F80 - support another namespace if (componentDefinition instanceof ShadowDefinitionImpl || LanguageDefinition.SHADOW_NAMESPACE.equals(uri) || LanguageDefinition.SHADOW_NAME.equals(uri)) return true; if (isDefaultNS(langdef, pref, uri)) return !bNativeContent && langdef.hasShadowDefinition(nm); return false; }
/** Returns the component definition of the specified class, or null * if not found. * * <p>Note: unlike {@link LanguageDefinition#getComponentDefinition}, * this method doesn't throw ComponentNotFoundException if not found. * It just returns null. * * @param recurse whether to look up the component from {@link #getLanguageDefinition} */ public ComponentDefinition getComponentDefinition(Class cls, boolean recurse) { final ComponentDefinition compdef = _compdefs.get(cls); if (!recurse || compdef != null) return compdef; try { return getLanguageDefinition().getComponentDefinition(cls); } catch (DefinitionNotFoundException ex) { try { // try with shadow element return getLanguageDefinition().getShadowDefinition(cls); } catch (DefinitionNotFoundException eex) { } } return null; }
final LanguageDefinition lookup = LanguageDefinition.lookup("xul/html"); ComponentDefinition shadowDefinition = lookup.hasShadowDefinition(name) ? lookup.getShadowDefinition(name) : pgdef.getComponentDefinitionMap().get(name); final ShadowInfo compInfo = new ShadowInfo(parent, shadowDefinition, name, ConditionImpl.getInstance(ifc, unless));
final boolean defaultNS = isDefaultNS(langdef, pref, uri); final LanguageDefinition complangdef = defaultNS ? langdef : LanguageDefinition.lookup(uri); ComponentDefinition compdef = defaultNS ? pgdef.getComponentDefinitionMap().get(nm) : null; if (compdef != null) { compInfo = new ComponentInfo(parent, compdef, nm);