|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectjava.awt.Component
java.awt.List
wt.clients.util.EnumeratedList
This class allows the selection of the allowable values for a specified EnumeratedType class in a choice list.
Supported API: true
Extendable: false
Sample code:
static public void main(String args[]) { if (args.length == 0 ) { System.out.println("supply enumeration class"); return; } String classname = args[0]; class DriverFrame extends java.awt.Frame { EnumeratedList choice = null; public DriverFrame(String title) { super(title); addWindowListener(new java.awt.event.WindowAdapter() { public void windowClosing(java.awt.event.WindowEvent event) { dispose(); // free the system resources System.exit(0); // close the application } }); setLayout(new java.awt.BorderLayout()); setSize(300,300); choice = new EnumeratedList(); choice.setDisplayNonSelectable(true); add(choice, "Center"); choice.addItemListener( new java.awt.event.ItemListener() { public void itemStateChanged(ItemEvent ie) { EnumeratedType value = choice.getSelectedEnumeratedType(); System.out.println("Selected value is now " + value); } }); } public void setClass(String name) { try { choice.setEnumeratedTypeClassName(name); } catch(PropertyVetoException pve) { pve.printStackTrace(); } } public void setClass(Class a_class) { try { choice.setEnumeratedTypeClass(a_class); } catch(PropertyVetoException pve) { pve.printStackTrace(); } } } DriverFrame df; df = new DriverFrame("EnumeratedList Test"); df.setClass(classname); df.show(); }
wt.fc.EnumeratedType;
,
Serialized FormNested Class Summary |
Nested classes inherited from class java.awt.List |
List.AccessibleAWTList |
Nested classes inherited from class java.awt.Component |
Component.AccessibleAWTComponent, Component.BltBufferStrategy, Component.FlipBufferStrategy |
Field Summary | |
private boolean |
allChoiceAllowed
|
private boolean |
blankChoiceAllowed
|
protected Hashtable |
displayedValues
|
private boolean |
displayNonSelectable
|
private Class |
enumeratedTypeClass
|
protected static ResourceBundle |
resource
|
protected static String |
RESOURCE
|
protected EnumeratedType[] |
valueSet
|
Fields inherited from class java.awt.List |
|
Fields inherited from class java.awt.Component |
BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT |
Fields inherited from interface java.awt.image.ImageObserver |
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH |
Constructor Summary | |
EnumeratedList(int shown)
|
Method Summary | |
static WTContext |
getContext()
|
Class |
getEnumeratedTypeClass()
Returns the class of the EnumeratedType used by this component. |
String |
getEnumeratedTypeClassName()
Gets the class name of the EnumeratedType used by this component. |
static ResourceBundle |
getLabelsRB()
|
static String |
getLocalizedMessage(String key,
Object[] params)
|
static String |
getLocalizedValue(String key)
|
EnumeratedType |
getSelectedEnumeratedType()
Gets a representation of the current choice as an EnumeratedList. |
protected String |
getSimpleName(Class a_class)
Helper method to get the name of the class without the package qualification. |
protected static void |
initResources()
|
boolean |
isAllChoiceAllowed()
Determines if an "All" choice has been added to the list. |
boolean |
isBlankChoiceAllowed()
Determines if an blank choice has been added to the list. |
boolean |
isDisplayNonSelectable()
Returns true if items in the list for the EnumeratedList marked as non-selectable will be displayed in the list. |
static void |
main(String[] args)
A main method that demonstrates how to use this class and allows testing. |
protected void |
redrawList()
Internal method to redraw the choice list. |
void |
setAllChoiceAllowed(boolean choice)
Sets if an "All" choice should be added to the list. |
void |
setBlankChoiceAllowed(boolean choice)
Sets if a blank choice should be added to the list. |
void |
setDisplayNonSelectable(boolean value)
Sets if items in the list for the EnumeratedList marked as non-selectable should be displayed in the list. |
void |
setEnumeratedTypeClass(Class enumeratedTypeClass)
Sets the EnumeratedType class to be used by this component. |
void |
setEnumeratedTypeClassName(String enumeratedTypeClassName)
Sets the class name of the EnumeratedType used by this component. |
void |
setSelectedEnumeratedType(EnumeratedType type)
Sets the selected item in this Choice to be the item with the specified EnumeratedType value. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
private Class enumeratedTypeClass
protected EnumeratedType[] valueSet
protected Hashtable displayedValues
private boolean allChoiceAllowed
private boolean blankChoiceAllowed
private boolean displayNonSelectable
protected static String RESOURCE
protected static ResourceBundle resource
Constructor Detail |
public EnumeratedList(int shown)
Method Detail |
public void setEnumeratedTypeClass(Class enumeratedTypeClass) throws PropertyVetoException
This will populate the choice component with the list of selectable values for the specified EnumeratedType.
PropertyVetoException
getEnumeratedTypeClass()
public Class getEnumeratedTypeClass()
Class
the EnumeratedType class used in the componentsetEnumeratedTypeClass(java.lang.Class)
public void setEnumeratedTypeClassName(String enumeratedTypeClassName) throws PropertyVetoException
This will populate the choice component with the list of selectable values for the specified EnumeratedType.
PropertyVetoException
getEnumeratedTypeClassName()
public String getEnumeratedTypeClassName()
setEnumeratedTypeClassName(java.lang.String)
public boolean isAllChoiceAllowed()
true
if the all choice is allowed; false
otherwise.setAllChoiceAllowed(boolean)
public void setAllChoiceAllowed(boolean choice)
isAllChoiceAllowed()
public void setDisplayNonSelectable(boolean value)
isDisplayNonSelectable()
public boolean isDisplayNonSelectable()
setDisplayNonSelectable(boolean)
protected void redrawList()
public boolean isBlankChoiceAllowed()
true
if the blank choice is allowed; false
otherwise.setBlankChoiceAllowed(boolean)
public void setBlankChoiceAllowed(boolean choice)
isBlankChoiceAllowed()
protected String getSimpleName(Class a_class)
public void setSelectedEnumeratedType(EnumeratedType type)
getSelectedEnumeratedType()
public EnumeratedType getSelectedEnumeratedType()
setSelectedEnumeratedType(wt.fc.EnumeratedType)
protected static void initResources()
public static WTContext getContext()
public static String getLocalizedMessage(String key, Object[] params)
public static ResourceBundle getLabelsRB()
public static String getLocalizedValue(String key)
public static void main(String[] args)
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |