Revision 2537 org.gvsig.tools/library/trunk/org.gvsig.tools/org.gvsig.tools.swing/org.gvsig.tools.swing.impl/src/main/java/org/gvsig/tools/swing/impl/DropDownLabel.java
DropDownLabel.java | ||
---|---|---|
24 | 24 |
import javax.swing.JPopupMenu; |
25 | 25 |
import javax.swing.UIManager; |
26 | 26 |
import org.apache.commons.lang3.StringUtils; |
27 |
import org.gvsig.tools.swing.api.ActionListenerSupport; |
|
27 | 28 |
import org.gvsig.tools.swing.api.DropDown; |
28 | 29 |
import org.gvsig.tools.util.LabeledValue; |
29 | 30 |
|
... | ... | |
46 | 47 |
private Color enabledForeground = null; |
47 | 48 |
private final Color backgroundColor; |
48 | 49 |
private final Color warningBackgroundColor; |
50 |
private final ActionListenerSupport dropdownListsnersHelper; |
|
49 | 51 |
|
50 | 52 |
|
51 | 53 |
public DropDownLabel(final JComponent component, Color warningBackgroundColor) { |
52 | 54 |
this.component = component; |
53 | 55 |
this.itemListeners = new HashSet<>(); |
56 |
this.dropdownListsnersHelper = new DefaultActionListenerSupport(); |
|
54 | 57 |
this.component.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR)); |
55 | 58 |
this.component.addMouseListener(new MouseAdapter() { |
56 | 59 |
@Override |
... | ... | |
129 | 132 |
} |
130 | 133 |
|
131 | 134 |
private void doShowPopup() { |
135 |
ActionEvent ev = new ActionEvent(this, 0, null); |
|
136 |
dropdownListsnersHelper.fireActionEvent(ev); |
|
132 | 137 |
if (model == null) { |
133 | 138 |
return; |
134 | 139 |
} |
... | ... | |
280 | 285 |
public void removeItemListener(ItemListener l) { |
281 | 286 |
this.itemListeners.remove(l); |
282 | 287 |
} |
288 |
|
|
289 |
@Override |
|
290 |
public void addDropdownListener(ActionListener listener) { |
|
291 |
this.dropdownListsnersHelper.addActionListener(listener); |
|
292 |
} |
|
283 | 293 |
|
294 |
@Override |
|
295 |
public void removeDropdownListener(ActionListener listener) { |
|
296 |
this.dropdownListsnersHelper.removeActionListener(listener); |
|
297 |
} |
|
298 |
|
|
284 | 299 |
} |
Also available in: Unified diff