Example #1
0
  /**
   * 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) {
    }
    return null;
  }
Example #2
0
 /**
  * Adds a component definition belonging to this page definition only.
  *
  * <p>It is the same as calling {@link ComponentDefinitionMap#add} against {@link
  * #getComponentDefinitionMap}
  */
 public void addComponentDefinition(ComponentDefinition compdef) {
   final LanguageDefinition langdef = compdef.getLanguageDefinition();
   if (langdef != null) {
     final LanguageDefinition ld2 = getLanguageDefinition();
     if (langdef != ld2 && !langdef.getDeviceType().equals(ld2.getDeviceType()))
       throw new UiException(
           "Component definition, "
               + compdef
               + ", does not belong to the same device type of the page definition, "
               + ld2.getDeviceType());
   }
   _compdefs.add(compdef);
 }