1 7 8 package org.jdesktop.swing.data; 9 10 import java.util.List ; 11 import java.util.Locale ; 12 13 31 32 public class EnumeratedMetaData extends MetaData { 33 34 protected Object [] enumeration; 35 36 43 public EnumeratedMetaData() { 44 this("enumvalue"); 45 } 46 47 52 public EnumeratedMetaData(String name) { 53 super(name); 54 } 55 56 62 public EnumeratedMetaData(String name, Class klass) { 63 super(name, klass); 64 } 65 66 74 public EnumeratedMetaData(String name, Class klass, String label) { 75 super(name, klass, label); 76 } 77 78 86 public Object [] getEnumeration() { 87 Object [] evalues; 88 if (enumeration != null) { 89 evalues = new Object [enumeration.length]; 90 System.arraycopy(enumeration, 0, evalues, 0, 91 enumeration.length); 92 } 93 else { 94 evalues = new Object [0]; 95 } 96 return evalues; 97 } 98 99 105 public void setEnumeration(Object [] enumeration) { 106 Object oldEnumeration[] = this.enumeration; 107 this.enumeration = new Object [enumeration.length]; 108 System.arraycopy(enumeration, 0, this.enumeration, 0, 109 enumeration.length); 110 firePropertyChange("enumeration", oldEnumeration, enumeration); 111 } 112 113 119 public void setEnumeration(List enumeration) { 120 setEnumeration(enumeration.toArray()); 121 } 122 123 124 } 125 | Popular Tags |