Uploaded image for project: 'MyFaces Core'
  1. MyFaces Core
  2. MYFACES-2455

ClientBehaviorHolder interface should be tracked by myfaces-builder-plugin metadata

    XMLWordPrintableJSON

Details

    • Task
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 2.0.0-alpha
    • 2.0.0-beta
    • JSR-314
    • None

    Description

      Actually we use something like this:

      @JSFComponent
      (name = "h:commandButton",
      clazz = "javax.faces.component.html.HtmlCommandButton",template=true,
      tagClass = "org.apache.myfaces.taglib.html.HtmlCommandButtonTag",
      defaultRendererType = "javax.faces.Button",
      implementz = "javax.faces.component.behavior.ClientBehaviorHolder",
      defaultEventName = "action"
      )

      Look the part that says implementz. In this way we notice if the component is implementing ClientBehaviorHolder interface and the method:

      java.util.Collection<String> getEventNames()

      is override properly in a similar way saveState and restoreState methods are generated in 1.2 or earlier.

      Note that in myfaces core we don't have a hierarchy of components that implements ClientBehaviorHolder, so we have to deal in this method properly. The typical case looks like this:

      static private final java.util.Collection<String> CLIENT_EVENTS_LIST =
      java.util.Collections.unmodifiableCollection(
      java.util.Arrays.asList(
      "change"
      , "select"
      , "click"
      , "dblclick"
      , "keydown"
      , "keypress"
      , "keyup"
      , "mousedown"
      , "mousemove"
      , "mouseout"
      , "mouseover"
      , "mouseup"
      , "blur"
      , "focus"
      , "action"
      ));

      public java.util.Collection<String> getEventNames()

      { return CLIENT_EVENTS_LIST; }

      If the child component adds one behavior, a new Collection<String> should be generated and the method should be override again.

      There is another problem related, the method:

      public String getDefaultEventName()

      is override if defaultEventName is set.

      In myfaces-builder-plugin we also have a small bug (or todo) with defaultEventName. This attribute is merged for all child components, so in the velocity template that generates component classes, this method is override many times as "levels" in the hierarchy from the component that defines this method. We have to keep track if the current component define this property or not.

      Attachments

        Activity

          People

            lu4242 Leonardo Uribe
            lu4242 Leonardo Uribe
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: