| View previous topic :: View next topic |
| Author |
Message |
andvicoso
Joined: 20 Nov 2008 Posts: 15
|
Posted: Thu Oct 15, 2009 2:13 pm Post subject: NodeAction JMenuItem enablement error |
|
|
Hello,
I'm trying to show a node popup menu on other screen position. So, I'm doing something like this:
| Code: |
public JPopupMenu getNodePopup(){
final Node node = new MyNode(myLookup);
return Utilities.actionsToPopup(node.getActions(false), Lookups.fixed(node, node.getLookup()));
}
|
But I've seen that inside CookieAction (which is one of the possible actions from the node), a NodeAction->resultChanged (from the created DelegateAction) like the above:
| Code: |
public void resultChanged(LookupEvent ev) {
boolean old = enabled;
enabled = delegate.enable(nodes());
support.firePropertyChange(PROP_ENABLED, old, enabled);
}
|
is called, and it correctly sets the local enabled field. But, after the execution returns to the Utilities.actionsToPopup, the created JMenuItem is never set enabled/disabled based on that trully corresponding NodeAction.enabled field. Even if I try set the enablement of the action inside the overriden getPopupPresenter method from my action, like this:
| Code: |
@Override
public JMenuItem getPopupPresenter() {
final JMenuItem menu = new JMenuItem(this);//super.getPopupPresenter();
menu.setEnabled(isEnabled());//Try to force the enablement
return menu;
}
|
The problem here is that the isEnabled method from MyAction calls isEnabled from NodeAction, which returns (Boolean) getProperty(PROP_ENABLED), which is different from the correct enablement.
Am I doing something wrong? |
|
| Back to top |
|
 |
andvicoso
Joined: 20 Nov 2008 Posts: 15
|
Posted: Tue Nov 03, 2009 6:30 pm Post subject: |
|
|
| Nobody??? |
|
| Back to top |
|
 |
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum You can attach files in this forum You can download files in this forum
|
|
|
|