Changeset 4798 for trunk/gli/src/org/greenstone/gatherer/gui/GComboBox.java
- Timestamp:
- 2003-06-25T13:17:33+12:00 (21 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/gli/src/org/greenstone/gatherer/gui/GComboBox.java
r4675 r4798 54 54 private Color selection_foreground = null; 55 55 56 private Model model;57 58 56 public GComboBox() { 59 57 super(); … … 61 59 } 62 60 63 public GComboBox(Gatherer gatherer) {64 this();65 }66 67 61 public GComboBox(ArrayList data) { 68 62 super(data.toArray()); … … 86 80 87 81 public int add(Object object) { 88 return model.add(object); 82 if(dataModel instanceof Model) { 83 return ((Model)dataModel).add(object); 84 } 85 else { 86 return -1; 87 } 89 88 } 90 89 91 90 public Object get(int index) { 92 return model.getElementAt(index); 93 } 94 95 public int getMaximumRowCount() { 96 int size = model.getSize(); 97 if(size == 0) { 98 return 1; 99 } 100 else if(size < maximumRowCount) { 101 return model.getSize(); 102 } 103 return maximumRowCount; 91 return dataModel.getElementAt(index); 104 92 } 105 93 106 94 public void clear() { 107 model.clear(); 95 if(dataModel instanceof Model) { 96 ((Model)dataModel).clear(); 97 } 108 98 } 109 99 110 100 public int count() { 111 return model.getSize();101 return dataModel.getSize(); 112 102 } 113 103 … … 137 127 138 128 public void init() { 139 this.model = new Model();129 Model model = new Model(); 140 130 ComboBoxModel old_model = (ComboBoxModel) getModel(); 141 131 setModel(model); … … 191 181 int position = 0; 192 182 String extension_str = extension.toString().toLowerCase(); 193 while(extension != null && position < size()) {183 while(extension != null && position < getSize()) { 194 184 String sibling = getElementAt(position).toString().toLowerCase(); 195 185 int order = extension_str.compareTo(sibling); … … 209 199 } 210 200 if(extension != null) { 211 position = size();201 position = getSize(); 212 202 addElement(extension); 213 203 } … … 217 207 public void clear() { 218 208 removeAllElements(); 219 }220 221 public int size() {222 return getSize();223 209 } 224 210 }
Note:
See TracChangeset
for help on using the changeset viewer.