Revision 2375 org.gvsig.tools/library/trunk/org.gvsig.tools/org.gvsig.tools.util/org.gvsig.tools.util.impl/src/main/java/org/gvsig/configurableactions/ActionsComponent.java
ActionsComponent.java | ||
---|---|---|
14 | 14 |
import javax.swing.JPopupMenu; |
15 | 15 |
import org.gvsig.tools.ToolsLocator; |
16 | 16 |
import org.gvsig.tools.i18n.I18nManager; |
17 |
import org.gvsig.tools.swing.api.SupportIsEnable; |
|
18 |
import org.gvsig.tools.swing.api.SupportIsVisible; |
|
17 | 19 |
|
18 | 20 |
|
19 | 21 |
public class ActionsComponent extends JLabel { |
... | ... | |
96 | 98 |
|
97 | 99 |
private void doShowMenu() { |
98 | 100 |
JPopupMenu menu = new JPopupMenu(); |
101 |
SupportIsVisible visible = null; |
|
102 |
if( this.source instanceof SupportIsVisible ) { |
|
103 |
visible = (SupportIsVisible) this.source; |
|
104 |
} |
|
105 |
SupportIsEnable enabled = null; |
|
106 |
if( this.source instanceof SupportIsEnable ) { |
|
107 |
enabled = (SupportIsEnable) this.source; |
|
108 |
} |
|
99 | 109 |
for (Action action : actions) { |
100 |
JMenuItem item = new JMenuItem(new ActionListenerAdapter(action)); |
|
101 |
menu.add(item); |
|
110 |
if( visible==null || visible.isVisible(action) ) { |
|
111 |
JMenuItem item = new JMenuItem(new ActionListenerAdapter(action)); |
|
112 |
if( enabled!=null && !enabled.isEnabled(action)) { |
|
113 |
item.setEnabled(false); |
|
114 |
} |
|
115 |
menu.add(item); |
|
116 |
} |
|
102 | 117 |
} |
103 | 118 |
menu.show(this, 0,this.getHeight()); |
104 | 119 |
} |
Also available in: Unified diff