Changeset 12824
- Timestamp:
- 2006-09-22T09:40:43+12:00 (18 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/gli/src/org/greenstone/gatherer/cdm/Argument.java
r12466 r12824 42 42 import org.greenstone.gatherer.metadata.MetadataTools; 43 43 import org.greenstone.gatherer.util.StaticStrings; 44 import org.greenstone.gatherer.util.Utility; 44 45 import org.greenstone.gatherer.util.XMLTools; 45 46 import org.w3c.dom.*; … … 94 95 private Element element; 95 96 /** If the argument is of type ENUM then this map holds all the various options. Each entry is an <option value> -> <description> mapping. */ 96 private HashMaplist = null;97 private ArrayList option_list = null; 97 98 /** A default value for parameter-type arguments. May be a Perl pattern. */ 98 99 private String default_value = null; … … 117 118 } 118 119 119 /** Method to add an element to the option 120 /** Method to add an element to the option_list. 120 121 * @param name the name value of the option as a String 121 122 * @param desc the description of this options as a String … … 126 127 desc = ""; 127 128 } 128 if( list == null) {129 list = new HashMap();130 } 131 list.put(name, desc);129 if(option_list == null) { 130 option_list = new ArrayList(); 131 } 132 option_list.add(new ArgumentOption(name, desc)); 132 133 } 133 134 } … … 154 155 copy.setDefaultValue(default_value); 155 156 copy.setDescription(description); 156 copy.setOptions( list);157 copy.setOptions(option_list); 157 158 copy.setOwner(owner); 158 159 copy.setName(name); … … 188 189 } 189 190 190 /** Method to retrieve the description of a certain list option value.191 * @param key the String whose description we are searching for192 * @return the description of the desired key as a String which may be empty if no such key exists193 */194 public String getDescription(String key) {195 if(list.containsKey(key)) {196 return (String)list.get(key);197 }198 return "";199 }200 201 191 public Element getElement() { 202 192 return element; … … 242 232 * @return a HashMap containing <option value> -> <description> entries 243 233 */ 244 public HashMapgetOptions() {245 return list;234 public ArrayList getOptions() { 235 return option_list; 246 236 } 247 237 … … 377 367 * @param list the new options list as a HashMap 378 368 */ 379 public void setOptions( HashMaplist) {380 this. list = list;369 public void setOptions(ArrayList list) { 370 this.option_list = list; 381 371 } 382 372 … … 416 406 if(new_type.equalsIgnoreCase(StaticStrings.ENUM_STR)) { 417 407 this.type = ENUM; 418 list = new HashMap();408 option_list = new ArrayList(); 419 409 } 420 410 else if(new_type.equalsIgnoreCase(StaticStrings.FLAG_STR)) { … … 626 616 627 617 } // parseXML 618 619 public class ArgumentOption 620 implements Comparable { 621 public String name; 622 public String description; 623 private String text; // cached version 624 625 public ArgumentOption(String name, String desc) { 626 this.name = name; 627 this.description = desc; 628 } 629 630 public int compareTo(Object obj) { 631 return toString().compareTo(obj.toString()); 632 } 633 634 public boolean equals(Object obj) { 635 return (obj != null && compareTo(obj) == 0); 636 } 637 638 public String toString() { 639 return name + " "+ StaticStrings.MINUS_CHARACTER + " "+ description; 640 } 641 642 public String getToolTip() { 643 return Utility.formatHTMLWidth(name+": "+description, 80); 644 } 645 } 628 646 }
Note:
See TracChangeset
for help on using the changeset viewer.