67 @Override public void clearSelection() {
68 updateSelectedIndex(-1);
69 }
70
71 /**
72 * Clears the selection of the given index, if it is currently selected.
73 */
74 @Override public void clearSelection(int index) {
75 if (getSelectedIndex() == index) {
76 clearSelection();
77 }
78 }
79
80 /** {@inheritDoc} */
81 @Override public boolean isEmpty() {
82 return getItemCount() == 0 || getSelectedIndex() == -1;
83 }
84
85 /**
86 * <p>This method will return true if the given index is the currently
87 * selected index in this SingleSelectionModel.</code>.
88 *
89 * @param index The index to check as to whether it is currently selected
90 * or not.
91 * @return True if the given index is selected, false otherwise.
92 */
93 @Override public boolean isSelected(int index) {
94 return getSelectedIndex() == index;
95 }
96
97 /**
98 * In the SingleSelectionModel, this method is functionally equivalent to
99 * calling <code>select(index)</code>, as only one selection is allowed at
100 * a time.
101 */
102 @Override public void clearAndSelect(int index) {
103 select(index);
104 }
105
106 /**
107 * Selects the index for the first instance of given object in the underlying
|
67 @Override public void clearSelection() {
68 updateSelectedIndex(-1);
69 }
70
71 /**
72 * Clears the selection of the given index, if it is currently selected.
73 */
74 @Override public void clearSelection(int index) {
75 if (getSelectedIndex() == index) {
76 clearSelection();
77 }
78 }
79
80 /** {@inheritDoc} */
81 @Override public boolean isEmpty() {
82 return getItemCount() == 0 || getSelectedIndex() == -1;
83 }
84
85 /**
86 * <p>This method will return true if the given index is the currently
87 * selected index in this SingleSelectionModel.
88 *
89 * @param index The index to check as to whether it is currently selected
90 * or not.
91 * @return True if the given index is selected, false otherwise.
92 */
93 @Override public boolean isSelected(int index) {
94 return getSelectedIndex() == index;
95 }
96
97 /**
98 * In the SingleSelectionModel, this method is functionally equivalent to
99 * calling <code>select(index)</code>, as only one selection is allowed at
100 * a time.
101 */
102 @Override public void clearAndSelect(int index) {
103 select(index);
104 }
105
106 /**
107 * Selects the index for the first instance of given object in the underlying
|