- Timestamp:
- 2003-06-06T09:55:23+12:00 (21 years ago)
- Location:
- trunk/gli/src/org/greenstone/gatherer/checklist
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/gli/src/org/greenstone/gatherer/checklist/CheckList.java
r4366 r4496 78 78 } 79 79 /** Constructor. 80 * @param list_data An <strong>ArrayList</strong>of entries for this checklist.81 82 80 * @param list_data An ArrayList of entries for this checklist. 81 * @see org.greenstone.gatherer.checklist.CheckList.Entry 82 */ 83 83 public CheckList(ArrayList list_data) { 84 84 super(); … … 86 86 DefaultListModel model = new DefaultListModel(); 87 87 for(int i = 0; i < list_data.size(); i++) { 88 Entry entry = new Entry(list_data.get(i)); 88 Entry entry = null; 89 Object temp = list_data.get(i); 90 if(temp instanceof Entry) { 91 entry = (Entry) temp; 92 } 93 else { 94 entry = new Entry(list_data.get(i)); 95 } 96 temp = null; 89 97 String name = entry.toString(); 90 98 int index = 0; -
trunk/gli/src/org/greenstone/gatherer/checklist/Entry.java
r4366 r4496 9 9 /** An Entry encapsulates a single row of the list, both its check box and the object the row represents. */ 10 10 public class Entry 11 extends JCheckBox { 11 extends JCheckBox 12 implements Comparable { 13 12 14 /** Is this checkboxes state fixed. */ 13 pr ivateboolean fixed = false;15 protected boolean fixed = false; 14 16 /** The original object this row is based on, and whose toString() is used to generate the check box label. */ 15 pr ivateObject object = null;17 protected Object object = null; 16 18 /** A sundry string for storing original values (rather than strings retrieved from dictionary). */ 17 pr ivateString property;19 protected String property; 18 20 /** Constructor. */ 19 21 public Entry(Object object) { … … 41 43 super(text); 42 44 setSelected(is_selected); 45 } 46 47 /** Test this Entry against an Object for ordering. 48 * @param obj the other Object. 49 * @return <0, 0 or >0 if this Entry is before, equal to or after the given object. 50 */ 51 public int compareTo(Object obj) { 52 return toString().toLowerCase().compareTo(obj.toString().toLowerCase()); 53 } 54 /** Test this Entry against an Object for equality. 55 * @param obj the other Object. 56 * @return true if the two are equal, false otherwise. 57 */ 58 public boolean equals(Object obj) { 59 return toString().equalsIgnoreCase(obj.toString()); 43 60 } 44 61
Note:
See TracChangeset
for help on using the changeset viewer.