Class JDPChoice

java.lang.Object
   |
   +----java.awt.Component
           |
           +----java.awt.Container
                   |
                   +----java.awt.Panel
                           |
                           +----JDPChoice

public class JDPChoice
extends Panel
Class JDPChoice represents an extended pulldown choice class that allows for auto loading from a database and also tracks key values for dsiplayed values.


Constructor Index

 o JDPChoice()
Creates an extended Choice component.
 o JDPChoice(JDPUser)
Creates an extended Choice component.

Method Index

 o addItem(String)
Add an item to the choice.
 o addItem(String, String)
Add an item to the choice.
 o clear()
Remove all the entries from the Choice pulldown.
 o countItems()
Get the number of items in the Choice pulldown.
 o disable()
Disable the choice box
 o enable()
Enable the choice box
 o getBackground()
 o getEnabled()
Get the enabled setting of the choice box
 o getFont()
 o getForeground()
 o getItem(int)
Get the text value of a specific item.
 o getItem(String)
Get the item number of a specific item.
 o getItemCount()
Get the number of items in the Choice pulldown.
 o getItemForKey(String)
Get the matching item value of a specific key.
 o getItemKey(String)
Get the matching key value of a specific item.
 o getMaximumHeight()
Get the maximum height of the combo
 o getMaximumWidth()
Get the maximum width of the combo
 o getMinimumHeight()
Get the minimum height of the grid
 o getMinimumWidth()
Get the minimum width of the grid
 o getSelectedIndex()
Get the currently selected index.
 o getSelectedItem()
Get the currently selected value.
 o getSelectedKey()
Get the currently selected key value.
 o getSelectedKeyValue()
Get an array containing all the key values for the currently selected item.
 o handleEvent(Event)
 o layoutChoice()
Redraw the choice after items have been added or removed.
 o loadChoice(JDPUser, JDPJagg, String, String, String, String)
Load values into the choice from a database table.
 o loadChoice(String[], String[])
Load values into the choice from a set of arrays.
 o minimumSize()
 o preferredSize()
 o remove(int)
Remove a specific item from the Choice pulldown.
 o remove(String)
Remove a specific item from the Choice pulldown.
 o select(int)
Select a specific item.
 o select(String)
Select a specific item.
 o selectKey(String)
Select a specific item.
 o setBackground(Color)
 o setEnabled(boolean)
Set the enabled setting of the choice box
 o setFont(Font)
 o setForeground(Color)
 o setMaximumHeight(int)
Set the maximum height of the combo
 o setMaximumWidth(int)
Set the maximum width of the combo
 o setMinimumHeight(int)
Set the minimum height of the grid
 o setMinimumWidth(int)
Set the minimum width of the grid
 o sortItems()
Sort the items in the pulldown.

Constructors

 o JDPChoice
 public JDPChoice()
Creates an extended Choice component.

 o JDPChoice
 public JDPChoice(JDPUser user)
Creates an extended Choice component.

Methods

 o loadChoice
 public void loadChoice(JDPUser user,
                        JDPJagg jaggSQL,
                        String choiceName,
                        String actualName,
                        String tableName,
                        String whereClause)
Load values into the choice from a database table.

Parameters:
JDPUser - the global user parameter used to pass handles in JDP.
JDPJagg - a handle to an instance of JDPJagg. DSN and CSTR must already be intialized.
choiceName - the database column name to retrieve the choice values from
actualName - the database column name to retrieve the key values from
tableName - the database table data from
whereClause - the where clause to use when selecting rows from the table
 o loadChoice
 public void loadChoice(String choiceName[],
                        String actualName[])
Load values into the choice from a set of arrays.

Parameters:
choiceName - the array containing the names to load choice values from
actualName - the array containing the keys to load the key values
 o enable
 public void enable()
Enable the choice box

Overrides:
enable in class Component
 o disable
 public void disable()
Disable the choice box

Overrides:
disable in class Component
 o setEnabled
 public void setEnabled(boolean enabled)
Set the enabled setting of the choice box

Parameters:
enabled - the enabled setting for the choice box
Overrides:
setEnabled in class Component
 o getEnabled
 public boolean getEnabled()
Get the enabled setting of the choice box

Returns:
the enabled setting for the choice box
 o addItem
 public void addItem(String displayItem)
Add an item to the choice.

Parameters:
displayItem - the text of the item.
 o addItem
 public void addItem(String displayItem,
                     String actualItem)
Add an item to the choice.

Parameters:
displayItem - the text of the item.
actualItem - the matching key value.
 o select
 public void select(int selection)
Select a specific item.

Parameters:
selection - the item number to select.
 o select
 public void select(String selection)
Select a specific item.

Parameters:
selection - the item value to select.
 o selectKey
 public void selectKey(String selection)
Select a specific item.

Parameters:
selection - the item value to select.
 o getItemCount
 public int getItemCount()
Get the number of items in the Choice pulldown.

Returns:
the number of items.
 o countItems
 public int countItems()
Get the number of items in the Choice pulldown.

Returns:
the number of items.
 o sortItems
 public void sortItems()
Sort the items in the pulldown.

 o clear
 public void clear()
Remove all the entries from the Choice pulldown.

 o remove
 public void remove(int item)
Remove a specific item from the Choice pulldown.

Parameters:
itemNumber - the item number to remove.
Overrides:
remove in class Container
 o remove
 public void remove(String item)
Remove a specific item from the Choice pulldown.

Parameters:
itemName - the item to remove.
 o getItem
 public String getItem(int selection)
Get the text value of a specific item.

Parameters:
itemNumber - the item number.
Returns:
the item.
 o getItem
 public int getItem(String item)
Get the item number of a specific item.

Parameters:
itemValue - the item.
Returns:
the item number.
 o getItemKey
 public String getItemKey(String item)
Get the matching key value of a specific item.

Parameters:
itemValue - the item.
Returns:
the item key value.
 o getItemForKey
 public String getItemForKey(String key)
Get the matching item value of a specific key.

Parameters:
keyValue - the item key.
Returns:
the item value.
 o getSelectedItem
 public String getSelectedItem()
Get the currently selected value.

Returns:
the item value.
 o getSelectedIndex
 public int getSelectedIndex()
Get the currently selected index.

Returns:
the item index.
 o getSelectedKey
 public String getSelectedKey()
Get the currently selected key value.

Returns:
the item key value.
 o getSelectedKeyValue
 public String[] getSelectedKeyValue()
Get an array containing all the key values for the currently selected item. (presently this only returns a one dimensional array as keys can only be one dimension).

Returns:
the item key values.
 o setBackground
 public void setBackground(Color thisColor)
Overrides:
setBackground in class Component
 o getBackground
 public Color getBackground()
Overrides:
getBackground in class Component
 o setForeground
 public void setForeground(Color thisColor)
Overrides:
setForeground in class Component
 o getForeground
 public Color getForeground()
Overrides:
getForeground in class Component
 o setFont
 public void setFont(Font thisFont)
Overrides:
setFont in class Component
 o getFont
 public Font getFont()
Overrides:
getFont in class Component
 o handleEvent
 public boolean handleEvent(Event e)
Overrides:
handleEvent in class Component
 o layoutChoice
 public void layoutChoice()
Redraw the choice after items have been added or removed.

 o preferredSize
 public Dimension preferredSize()
Overrides:
preferredSize in class Container
 o minimumSize
 public Dimension minimumSize()
Overrides:
minimumSize in class Container
 o setMinimumWidth
 public void setMinimumWidth(int width)
Set the minimum width of the grid

Parameters:
the - width in pixels.
 o getMinimumWidth
 public int getMinimumWidth()
Get the minimum width of the grid

Returns:
the width in pixels.
 o setMinimumHeight
 public void setMinimumHeight(int height)
Set the minimum height of the grid

Parameters:
the - height in pixels.
 o getMinimumHeight
 public int getMinimumHeight()
Get the minimum height of the grid

Returns:
the height in pixels.
 o setMaximumWidth
 public void setMaximumWidth(int width)
Set the maximum width of the combo

Parameters:
the - width in pixels.
 o getMaximumWidth
 public int getMaximumWidth()
Get the maximum width of the combo

Returns:
the width in pixels.
 o setMaximumHeight
 public void setMaximumHeight(int height)
Set the maximum height of the combo

Parameters:
the - height in pixels.
 o getMaximumHeight
 public int getMaximumHeight()
Get the maximum height of the combo

Returns:
the height in pixels.