Aug 18th, 2006, 10:08 PM
Guarding a JButton in Matisse form
I have been blending Spring RCP with some Matisse-based forms with pretty good luck. I am using the ListSingleSelectionGuard in conjunction with the AbstractObjectTable to disable certain toolbar buttons when appropriate. That works fine. However, I've encountered a problem with the following scenario:
1) Create custom JButton on a Matisse form.
2) Create SwingActionAdapter using the TargetableActionCommand that I want to be guarded.
3) Construct SingleSelectionGuard using the TargetableActionCommand in step 2. The selection guard is for the AbstractObjectTable.
4) I then call setAction() on my JButton and give it the SwingActionAdapter from step 2. This works fine...I get my label and icon from the Action as I expect and the button works. The JButton works as expected, but it is NEVER guarded in spite of the fact that I have my ListSingleSelectionGuard set up on the AbstractObjectTable.
I would expect the JButton to be disabled, or at the very least, I would expect the Action invocation to be ignored when the guard condition is met.
I guess the question can be summed up as follows:
I can create an Action from a TargetableActionCommand using the SwingActionAdapter class. Then I can set up a JButton with said Action. After doing that, is there a way to block that Action from being executed by applying a guard to the TargetableActionCommand?
The code is too scattered to post here, but hopefully the list above explains the situation adequately for one of the experts to lend a hand.
BTW, props to all those who built this framework. This is truly excellent & important work.
Aug 18th, 2006, 10:17 PM
Please Disregard Previous Question - It Works!
I found the problem in my code. This scenario works with Spring RCP!