ICEfaces
  1. ICEfaces
  2. ICE-5766

sparkle generator ActionSource2 support

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 2.0-Alpha3
    • Fix Version/s: 2.0-Beta2, 2.0.0
    • Component/s: ICE-Components
    • Labels:
      None
    • Environment:
      sparkle

      Description

      Most properties follow a simple pattern, having a tag attribute name from which one can derive the StateHelper key, and the getter and setter method names. The action and actionListener attributes, as part of an ActionSource2 implementing component, are a whole other matter.

      The action attribute is represented in the component by MethodExpression getActionExpression() and void setActionExpression(MethodExpression) methods. As well, there are deprecated legacy MethodBinding getAction() and void setAction(MethodBinding) methods, which use wrapper code to call into the ActionExpression methods.

      The actionListener attribute is even more complicated, with the preferred API involving void addActionListener(ActionListener), void removeActionListener(ActionListener), ActionListener[] getActionListeners(). This means that there's no classical getter/setter, and any Tag class or Facelets Handler class would have to use javax.faces.event.MethodExpressionActionListener to wrap the MethodExpression with an ActionListener implementation.

      The immediate attribute behaves like any other property, but its TLD doc and Javadoc has a different explanation than the UIInput variant of immediate.

      With sparkle, we can see two main scenarios for Meta classes using ActionSource2. The first is where the generated Base class in some way extends a concrete implementation of ActionSource2, like UICommand. The second scenario is where the generated Base class itself should implement ActionSource2, effectively duplicating UICommand.

      In the first scenario, we only want to create entries for action/actionListener/immediate in the xml files, like the TLD. We don't want to generate any code in the Base class, and need only properly invoke setActionExpression(-), addActionListener, setImmediate(-) from the JSP Tag class. It's not necessary for creating Facelets Handler code, since Facelets already does this. We'll have to find a way to represent this in the Meta class. The typical inherit/useTemplate fields don't exactly cover the scope of alteration necessary. And with immediate, we'd still have to add some way of differentiating between the two immediate attributes.

      In the second scenario, we would have to generate all the code that UICommand already has, into the Base class, then do everything from the above scenario as well. It's likely that the Meta class would have to specify something to differentiate the two scenarios, such as have inherit=false.

        Issue Links

          Activity

          Mark Collette created issue -
          Repository Revision Date User Message
          ICEsoft Public SVN Repository #21480 Wed May 26 09:46:02 MDT 2010 judy.guglielmin ICE-5766 workaround modifications so UICommand ActionListener/MethodExpression bindings will be allowed in generator. jsf tags are turned off--not supported in ICEfaces-2.0 anyways (yet)
          Files Changed
          Commit graph MODIFY /icefaces/scratchpads/sparkle/generator/src/org/icefaces/generator/FileWriter.java
          Commit graph MODIFY /icefaces/scratchpads/sparkle/generator/src/org/icefaces/generator/TagClassGenerator.java
          Commit graph MODIFY /icefaces/scratchpads/sparkle/generator/src/org/icefaces/component/annotation/PropertyTemplate.java
          Commit graph MODIFY /icefaces/scratchpads/sparkle/generator/src/org/icefaces/generator/Generator.java
          Ken Fyten made changes -
          Field Original Value New Value
          Salesforce Case []
          Fix Version/s 2.0-Alpha3 [ 10032 ]
          Assignee Priority P1
          Assignee Adnan Durrani [ adnan.durrani ]
          Hide
          Judy Guglielmin added a comment -

          committed workaround to disable the jsp tag writing for UICommnad (doesn't accomodate ActionSource2 ability of UICommand).
          Note also some modifications for debug statements (when property is null). Also, had to modify property annotations for the properties "action" and "actionListener"

          Show
          Judy Guglielmin added a comment - committed workaround to disable the jsp tag writing for UICommnad (doesn't accomodate ActionSource2 ability of UICommand). Note also some modifications for debug statements (when property is null). Also, had to modify property annotations for the properties "action" and "actionListener"
          Ken Fyten made changes -
          Fix Version/s 2.0-Beta [ 10231 ]
          Fix Version/s 2.0-Alpha3 [ 10032 ]
          Hide
          Adnan Durrani added a comment -

          Got it. Now we have to come up with a way to define meta data for both of these scenario:

          My suggestion:

          Scenario 1- Meta class that doesn't extends ActionSource type of class and would like to generated an ActionSource type of component.

          @Component(.......
          isActionSource=true
          )
          public class Button

          { ..... }

          As we can see in above example that we are setting a property at class level annotation. Which is saying that it is going to be a actionsource type. So the generator can implement appropriate interface and generate other artifacts as well.

          Scenario 2- Component that extends UICommand or any component that is a type of ActionSource2.

          If the extended component is a type of ActionSource2 then generator automatically add action, actionListener and immediate into tld and tag classes. No need to define metadata in Meta class?

          Please let me know if that sounds good. So I can proceed?

          Show
          Adnan Durrani added a comment - Got it. Now we have to come up with a way to define meta data for both of these scenario: My suggestion: Scenario 1- Meta class that doesn't extends ActionSource type of class and would like to generated an ActionSource type of component. @Component(....... isActionSource=true ) public class Button { ..... } As we can see in above example that we are setting a property at class level annotation. Which is saying that it is going to be a actionsource type. So the generator can implement appropriate interface and generate other artifacts as well. Scenario 2- Component that extends UICommand or any component that is a type of ActionSource2. If the extended component is a type of ActionSource2 then generator automatically add action, actionListener and immediate into tld and tag classes. No need to define metadata in Meta class? Please let me know if that sounds good. So I can proceed?
          Judy Guglielmin made changes -
          Link This issue blocks ICE-5753 [ ICE-5753 ]
          Repository Revision Date User Message
          ICEsoft Public SVN Repository #21552 Sun May 30 22:36:23 MDT 2010 adnan.durrani Fix towards ICE-5766(sparkle generator ActionSource2 support)
          Files Changed
          Commit graph MODIFY /icefaces/scratchpads/sparkle/component/src/org/icefaces/component/pushbutton/PushButtonMeta.java
          Commit graph MODIFY /icefaces/scratchpads/sparkle/generator/src/org/icefaces/generator/TagClassGenerator.java
          Hide
          Adnan Durrani added a comment -

          Tag class enabled so the TLD docs can be generated, and changes made to the generator to use ActionSource2 methods to register action and actionListener.

          Command: Commit
          Modified: D:\work\development\head\svn\ossrepo\icefaces\scratchpads\sparkle\component\src\org\icefaces\component\pushbutton\PushButtonMeta.java
          Modified: D:\work\development\head\svn\ossrepo\icefaces\scratchpads\sparkle\generator\src\org\icefaces\generator\TagClassGenerator.java
          Sending content: D:\work\development\head\svn\ossrepo\icefaces\scratchpads\sparkle\component\src\org\icefaces\component\pushbutton\PushButtonMeta.java
          Sending content: D:\work\development\head\svn\ossrepo\icefaces\scratchpads\sparkle\generator\src\org\icefaces\generator\TagClassGenerator.java
          Completed: At revision: 21552

          Show
          Adnan Durrani added a comment - Tag class enabled so the TLD docs can be generated, and changes made to the generator to use ActionSource2 methods to register action and actionListener. Command: Commit Modified: D:\work\development\head\svn\ossrepo\icefaces\scratchpads\sparkle\component\src\org\icefaces\component\pushbutton\PushButtonMeta.java Modified: D:\work\development\head\svn\ossrepo\icefaces\scratchpads\sparkle\generator\src\org\icefaces\generator\TagClassGenerator.java Sending content: D:\work\development\head\svn\ossrepo\icefaces\scratchpads\sparkle\component\src\org\icefaces\component\pushbutton\PushButtonMeta.java Sending content: D:\work\development\head\svn\ossrepo\icefaces\scratchpads\sparkle\generator\src\org\icefaces\generator\TagClassGenerator.java Completed: At revision: 21552
          Repository Revision Date User Message
          ICEsoft Public SVN Repository #21721 Thu Jun 10 21:58:05 MDT 2010 adnan.durrani Fix towards ICE-5766 (sparkle generator ActionSource2 support)
          Files Changed
          Commit graph ADD /icefaces/scratchpads/sparkle/generator/src/org/icefaces/generator/behavior/Behavior.java
          Commit graph MODIFY /icefaces/scratchpads/sparkle/generator/src/org/icefaces/generator/context/ComponentContext.java
          Commit graph ADD /icefaces/scratchpads/sparkle/generator/src/org/icefaces/component/annotation/ActionSource.java
          Commit graph ADD /icefaces/scratchpads/sparkle/generator/src/org/icefaces/generator/behavior
          Commit graph MODIFY /icefaces/scratchpads/sparkle/generator/src/org/icefaces/generator/artifacts/ComponentArtifact.java
          Commit graph MODIFY /icefaces/scratchpads/sparkle/generator/src/org/icefaces/generator/context/GeneratorContext.java
          Commit graph ADD /icefaces/scratchpads/sparkle/generator/src/org/icefaces/generator/behavior/ActionSourceBehavior.java
          Hide
          Adnan Durrani added a comment -

          Preliminary code added to plug behavior.

          Command: Commit
          Adding: D:\work\development\head\svn\ossrepo\icefaces\scratchpads\sparkle\generator\src\org\icefaces\component\annotation\ActionSource.java
          Modified: D:\work\development\head\svn\ossrepo\icefaces\scratchpads\sparkle\generator\src\org\icefaces\generator\artifacts\ComponentArtifact.java
          Adding: D:\work\development\head\svn\ossrepo\icefaces\scratchpads\sparkle\generator\src\org\icefaces\generator\behavior
          Adding: D:\work\development\head\svn\ossrepo\icefaces\scratchpads\sparkle\generator\src\org\icefaces\generator\behavior\ActionSourceBehavior.java
          Adding: D:\work\development\head\svn\ossrepo\icefaces\scratchpads\sparkle\generator\src\org\icefaces\generator\behavior\Behavior.java
          Modified: D:\work\development\head\svn\ossrepo\icefaces\scratchpads\sparkle\generator\src\org\icefaces\generator\context\ComponentContext.java
          Modified: D:\work\development\head\svn\ossrepo\icefaces\scratchpads\sparkle\generator\src\org\icefaces\generator\context\GeneratorContext.java
          Sending content: D:\work\development\head\svn\ossrepo\icefaces\scratchpads\sparkle\generator\src\org\icefaces\generator\context\ComponentContext.java
          Sending content: D:\work\development\head\svn\ossrepo\icefaces\scratchpads\sparkle\generator\src\org\icefaces\generator\behavior\ActionSourceBehavior.java
          Sending content: D:\work\development\head\svn\ossrepo\icefaces\scratchpads\sparkle\generator\src\org\icefaces\generator\behavior\Behavior.java
          Sending content: D:\work\development\head\svn\ossrepo\icefaces\scratchpads\sparkle\generator\src\org\icefaces\generator\context\GeneratorContext.java
          Sending content: D:\work\development\head\svn\ossrepo\icefaces\scratchpads\sparkle\generator\src\org\icefaces\generator\artifacts\ComponentArtifact.java
          Sending content: D:\work\development\head\svn\ossrepo\icefaces\scratchpads\sparkle\generator\src\org\icefaces\component\annotation\ActionSource.java
          Completed: At revision: 21721

          Show
          Adnan Durrani added a comment - Preliminary code added to plug behavior. Command: Commit Adding: D:\work\development\head\svn\ossrepo\icefaces\scratchpads\sparkle\generator\src\org\icefaces\component\annotation\ActionSource.java Modified: D:\work\development\head\svn\ossrepo\icefaces\scratchpads\sparkle\generator\src\org\icefaces\generator\artifacts\ComponentArtifact.java Adding: D:\work\development\head\svn\ossrepo\icefaces\scratchpads\sparkle\generator\src\org\icefaces\generator\behavior Adding: D:\work\development\head\svn\ossrepo\icefaces\scratchpads\sparkle\generator\src\org\icefaces\generator\behavior\ActionSourceBehavior.java Adding: D:\work\development\head\svn\ossrepo\icefaces\scratchpads\sparkle\generator\src\org\icefaces\generator\behavior\Behavior.java Modified: D:\work\development\head\svn\ossrepo\icefaces\scratchpads\sparkle\generator\src\org\icefaces\generator\context\ComponentContext.java Modified: D:\work\development\head\svn\ossrepo\icefaces\scratchpads\sparkle\generator\src\org\icefaces\generator\context\GeneratorContext.java Sending content: D:\work\development\head\svn\ossrepo\icefaces\scratchpads\sparkle\generator\src\org\icefaces\generator\context\ComponentContext.java Sending content: D:\work\development\head\svn\ossrepo\icefaces\scratchpads\sparkle\generator\src\org\icefaces\generator\behavior\ActionSourceBehavior.java Sending content: D:\work\development\head\svn\ossrepo\icefaces\scratchpads\sparkle\generator\src\org\icefaces\generator\behavior\Behavior.java Sending content: D:\work\development\head\svn\ossrepo\icefaces\scratchpads\sparkle\generator\src\org\icefaces\generator\context\GeneratorContext.java Sending content: D:\work\development\head\svn\ossrepo\icefaces\scratchpads\sparkle\generator\src\org\icefaces\generator\artifacts\ComponentArtifact.java Sending content: D:\work\development\head\svn\ossrepo\icefaces\scratchpads\sparkle\generator\src\org\icefaces\component\annotation\ActionSource.java Completed: At revision: 21721
          Hide
          Ken Fyten added a comment -

          Mark, need to re-enable the TLD generation now.

          Show
          Ken Fyten added a comment - Mark, need to re-enable the TLD generation now.
          Ken Fyten made changes -
          Assignee Adnan Durrani [ adnan.durrani ] Mark Collette [ mark.collette ]
          Hide
          Mark Collette added a comment -

          Adnan re-enabled it, with his fix. I found the TLD file here: sparkle\component\build\exploded\META-INF\components.tld

          Show
          Mark Collette added a comment - Adnan re-enabled it, with his fix. I found the TLD file here: sparkle\component\build\exploded\META-INF\components.tld
          Ken Fyten made changes -
          Status Open [ 1 ] Resolved [ 5 ]
          Assignee Priority P1
          Resolution Fixed [ 1 ]
          Ken Fyten made changes -
          Fix Version/s 2.0-Beta2 [ 10242 ]
          Fix Version/s 2.0-Beta1 [ 10231 ]
          Ken Fyten made changes -
          Security Private [ 10001 ]
          Ken Fyten made changes -
          Fix Version/s 2.0.0 [ 10230 ]
          Ken Fyten made changes -
          Status Resolved [ 5 ] Closed [ 6 ]

            People

            • Assignee:
              Mark Collette
              Reporter:
              Mark Collette
            • Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: