Details
-
Type: Bug
-
Status: Closed
-
Priority: Major
-
Resolution: Fixed
-
Affects Version/s: 2.0-Alpha3
-
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.
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
- blocks
-
ICE-5753 New PushButton ACE component.
- Closed
Activity
- All
- Comments
- History
- Activity
- Remote Attachments
- Subversion
Repository | Revision | Date | User | Message |
ICEsoft Public SVN Repository | #21721 | Thu Jun 10 21:58:05 MDT 2010 | adnan.durrani | Fix towards |
Files Changed | ||||
ADD
/icefaces/scratchpads/sparkle/generator/src/org/icefaces/generator/behavior/Behavior.java
MODIFY /icefaces/scratchpads/sparkle/generator/src/org/icefaces/generator/context/ComponentContext.java ADD /icefaces/scratchpads/sparkle/generator/src/org/icefaces/component/annotation/ActionSource.java ADD /icefaces/scratchpads/sparkle/generator/src/org/icefaces/generator/behavior MODIFY /icefaces/scratchpads/sparkle/generator/src/org/icefaces/generator/artifacts/ComponentArtifact.java MODIFY /icefaces/scratchpads/sparkle/generator/src/org/icefaces/generator/context/GeneratorContext.java ADD /icefaces/scratchpads/sparkle/generator/src/org/icefaces/generator/behavior/ActionSourceBehavior.java |
Repository | Revision | Date | User | Message |
ICEsoft Public SVN Repository | #21552 | Sun May 30 22:36:23 MDT 2010 | adnan.durrani | Fix towards |
Files Changed | ||||
MODIFY
/icefaces/scratchpads/sparkle/component/src/org/icefaces/component/pushbutton/PushButtonMeta.java
MODIFY /icefaces/scratchpads/sparkle/generator/src/org/icefaces/generator/TagClassGenerator.java |
Repository | Revision | Date | User | Message |
ICEsoft Public SVN Repository | #21480 | Wed May 26 09:46:02 MDT 2010 | judy.guglielmin | |
Files Changed | ||||
MODIFY
/icefaces/scratchpads/sparkle/generator/src/org/icefaces/generator/FileWriter.java
MODIFY /icefaces/scratchpads/sparkle/generator/src/org/icefaces/generator/TagClassGenerator.java MODIFY /icefaces/scratchpads/sparkle/generator/src/org/icefaces/component/annotation/PropertyTemplate.java MODIFY /icefaces/scratchpads/sparkle/generator/src/org/icefaces/generator/Generator.java |