Revision 41179 trunk/org.gvsig.desktop/org.gvsig.desktop.library/org.gvsig.ui/src/main/java/org/gvsig/gui/beans/comboboxconfigurablelookup/JComboBoxConfigurableLookUp.java
JComboBoxConfigurableLookUp.java | ||
---|---|---|
145 | 145 |
* @see JComboBox |
146 | 146 |
* @see DefaultComboBoxConfigurableLookUpModel |
147 | 147 |
* |
148 |
* @author Pablo Piqueras Bartolom? (pablo.piqueras@iver.es)
|
|
148 |
* @author Pablo Piqueras Bartolom? |
|
149 | 149 |
* @version 07/02/2008 |
150 | 150 |
*/ |
151 | 151 |
public class JComboBoxConfigurableLookUp extends JComboBox implements java.io.Serializable { |
... | ... | |
425 | 425 |
JList jlist = ((ComboPopup)aC).getList(); |
426 | 426 |
|
427 | 427 |
jlist.addMouseListener(new MouseAdapter() { |
428 |
/* |
|
429 |
* (non-Javadoc) |
|
430 |
* @see java.awt.event.MouseListener#mousePressed(java.awt.event.MouseEvent) |
|
431 |
*/ |
|
432 | 428 |
public void mousePressed(MouseEvent e) { |
433 | 429 |
// User selects an item of the popup using the mouse |
434 | 430 |
popupItemSelected = true; |
... | ... | |
438 | 434 |
|
439 | 435 |
if (aC instanceof BasicComboPopup) { |
440 | 436 |
((BasicComboPopup)aC).addPopupMenuListener(new PopupMenuListener() { |
441 |
/* |
|
442 |
* (non-Javadoc) |
|
443 |
* @see javax.swing.event.PopupMenuListener#popupMenuCanceled(javax.swing.event.PopupMenuEvent) |
|
444 |
*/ |
|
445 | 437 |
public void popupMenuCanceled(PopupMenuEvent e) { |
446 | 438 |
if (arrowButtonClicked) { |
447 | 439 |
arrowButtonClicked = false; |
448 | 440 |
} |
449 | 441 |
} |
450 | 442 |
|
451 |
/* |
|
452 |
* (non-Javadoc) |
|
453 |
* @see javax.swing.event.PopupMenuListener#popupMenuWillBecomeInvisible(javax.swing.event.PopupMenuEvent) |
|
454 |
*/ |
|
455 | 443 |
public void popupMenuWillBecomeInvisible(PopupMenuEvent e) { |
456 | 444 |
if (arrowButtonClicked) { |
457 | 445 |
arrowButtonClicked = false; |
458 | 446 |
} |
459 | 447 |
} |
460 | 448 |
|
461 |
/* |
|
462 |
* (non-Javadoc) |
|
463 |
* @see javax.swing.event.PopupMenuListener#popupMenuWillBecomeVisible(javax.swing.event.PopupMenuEvent) |
|
464 |
*/ |
|
465 | 449 |
public void popupMenuWillBecomeVisible(PopupMenuEvent e) { |
466 | 450 |
if (arrowButtonClicked) { |
467 | 451 |
arrowButtonClicked = false; |
... | ... | |
854 | 838 |
super.setEditor(anEditor); |
855 | 839 |
} |
856 | 840 |
|
857 |
/* |
|
858 |
* (non-Javadoc) |
|
859 |
* @see javax.swing.JComboBox#setModel(javax.swing.ComboBoxModel) |
|
860 |
*/ |
|
861 | 841 |
public void setModel(ComboBoxModel aModel) { |
862 | 842 |
// If model isn't DefaultComboBoxConfigurableLookUpModel, sets as model a new DefaultComboBoxConfigurableLookUpModel, with the data |
863 | 843 |
// of ''aModel'': |
... | ... | |
876 | 856 |
model = (DefaultComboBoxConfigurableLookUpModel)super.getModel(); |
877 | 857 |
} |
878 | 858 |
|
879 |
/* |
|
880 |
* (non-Javadoc) |
|
881 |
* @see javax.swing.JComboBox#setSelectedIndex(int) |
|
882 |
*/ |
|
883 | 859 |
public void setSelectedIndex(int anIndex) { |
884 | 860 |
if (anIndex < -1 || anIndex >= model.getSize()) |
885 | 861 |
// Fails because index is out of bounds. |
... | ... | |
890 | 866 |
setSelectedItem((anIndex == -1) ? null : model.getElementAt(anIndex)); |
891 | 867 |
} |
892 | 868 |
|
893 |
/* |
|
894 |
* (non-Javadoc) |
|
895 |
* @see javax.swing.JComboBox#setSelectedItem(java.lang.Object) |
|
896 |
*/ |
|
897 | 869 |
public void setSelectedItem(Object anObject) { |
898 | 870 |
if ((selectedItemReminder == null) || (!selectedItemReminder.equals(anObject))) { |
899 | 871 |
if (arrowKeyPressed) { |
... | ... | |
927 | 899 |
document.updateOnlyTextColor(); |
928 | 900 |
} |
929 | 901 |
|
930 |
/* |
|
931 |
* <p>Unsupported operation. A <code>JComboBoxConfigurableLookUp</code> is always editable.</p> |
|
932 |
* |
|
933 |
* (non-Javadoc) |
|
934 |
* @see javax.swing.JComboBox#setEditable(boolean) |
|
935 |
*/ |
|
936 | 902 |
public void setEditable(boolean b) { |
937 | 903 |
throw new UnsupportedOperationException(); |
938 | 904 |
} |
939 | 905 |
|
940 |
/* |
|
941 |
* (non-Javadoc) |
|
942 |
* @see javax.swing.JComboBox#removeAllItems() |
|
943 |
*/ |
|
944 | 906 |
public void removeAllItems() { |
945 | 907 |
if ( !(model instanceof MutableComboBoxModel) ) |
946 | 908 |
throw new RuntimeException("Cannot use this method with a non-Mutable data dataModel."); |
... | ... | |
956 | 918 |
} |
957 | 919 |
|
958 | 920 |
document.updateTextColorAndRingBeep(); |
921 |
updateUI(); |
|
959 | 922 |
} |
960 | 923 |
|
961 | 924 |
public void addItem(Object anObject) { |
Also available in: Unified diff