All Packages  Class Hierarchy  This Package  Previous  Next  Index

Class dtai.gwt.ComboBoxGadget

java.lang.Object
   |
   +----dtai.gwt.Gadget
           |
           +----dtai.gwt.ContainerGadget
                   |
                   +----dtai.gwt.PanelGadget
                           |
                           +----dtai.gwt.BorderGadget
                                   |
                                   +----dtai.gwt.ComboBoxGadget

public class ComboBoxGadget
extends BorderGadget
implements ItemSelectable, KeyListener
ComboBoxGadget


Constructor Index

 o ComboBoxGadget(int)
ComboBoxGadget
 o ComboBoxGadget(int, TextFieldGadget)
ComboBoxGadget

Method Index

 o add(String)
Adds the given item to the list.
 o add(String, int)
Adds the given item to the list at the given index.
 o addActionListener(ActionListener)
Adds the specified listener to be notified when component events occur on this component.
 o addItemListener(ItemListener)
Adds the specified listener to be notified when component events occur on this component.
 o countItems()
Returns the number of items in the ListGadget.
 o fillSearchText(KeyEvent)
Sets the searchText variable to be the text in the TextFieldGadget (in upper case);
 o getItem(int)
Gets the item in the list at the specified index.
 o getList()
Gets the ListGadget.
 o getMinimumSize()
Calls getPreferredSize().
 o getPreferredSize()
Returns the preferred width and height, if both >= 0, else compares the parent's preferred size to the list's, and returns the Dimension with the larger width.
 o getSelectedIndex()
Returns the index in the list of the selected item, or -1 if the selected item is not in the list.
 o getSelectedIndexes()
Returns an array of integers made up of the indexes of the selected items from the list.
 o getSelectedItem()
Gets the text in the TextFieldGadget.
 o getSelectedItems()
Returns an array of Strings made up of the names of the selected items from the list.
 o getText()
Gets the text in the TextFieldGadget.
 o getTextField()
Gets the TextFieldGadget.
 o getTextFieldGadget()
Returns the TextFieldGadget.
 o hideList()
Hides the list
 o insert(String, int)
Adds the given item to the list at the given index.
 o isAllowedToShrink()
isAllowedToShrink
 o isSorted()
Gets the boolean sorted flag.
 o keyPressed(KeyEvent)
If ComboBox is sorted, get text from the TextFieldGadget, and find the closest match in the list.
 o keyReleased(KeyEvent)
keyReleased - empty method.
 o keyTyped(KeyEvent)
keyTyped - empty method.
 o notifyList()
Hides the list, if it is showing, and shows the list if it is hiding.
 o processActionEvent(ActionEvent)
 o processActionPerformed(ActionEvent)
processActionPerformed
 o processEvent(AWTEvent)
processEvent
 o processItemEvent(ItemEvent)
 o remove(int)
Removes the item at the given position from the list.
 o remove(String)
Removes the specified item from the list.
 o removeActionListener(ActionListener)
Removes the specified listener so it no longer receives action events on this action.
 o removeItemListener(ItemListener)
Removes the specified listener so it no longer receives item events on this item.
 o replace(String, int)
Replace the item at the specified index with the given item.
 o requestFocus()
Calls text.requestFous().
 o select(int)
Selects the item at the given index in the list.
 o select(String)
Makes the given item the selected one, if it is not already.
 o setAllowedToShrink(boolean)
Sets the specified boolean to indicate whether or not this TextComponent should be allowedToShrink.
 o setBackground(Color, int)
Sets the background color of the LabelGadet at the specified index.
 o setBackground(Color, String)
Sets the background color of the LabelGadet with the specified name.
 o setForeground(Color, int)
Sets the foreground color of the LabelGadet at the specified index.
 o setForeground(Color, String)
Sets the foreground color of the LabelGadet with the specified name.
 o setNextFocusGadget(Gadget)
setNextFocusGadget
 o setParent(ContainerGadget, boolean)
setParent
 o setSorted(boolean)
Sets the boolean sorted flag.
 o setText(String)
Sets the text in the TextFieldGadget.
 o setVisible(boolean, boolean)
Shows or hides the component depending on the boolean flag b.
 o showList()
Shows the list

Constructors

 o ComboBoxGadget
 public ComboBoxGadget(int visibleItems)
ComboBoxGadget

Parameters:
visibleItems - number of visible items in this ComboBoxGadget
 o ComboBoxGadget
 public ComboBoxGadget(int visibleItems,
                       TextFieldGadget text)
ComboBoxGadget

Parameters:
visibleItems - number of visible items in this ComboBoxGadget
text - the TextFieldGadget for this ComboBox

Methods

 o isAllowedToShrink
 public boolean isAllowedToShrink()
isAllowedToShrink

Returns:
the boolean indicating whether this TextComponent is allowedToShrink or not.
See Also:
setEditable
 o setAllowedToShrink
 public void setAllowedToShrink(boolean b)
Sets the specified boolean to indicate whether or not this TextComponent should be allowedToShrink.

Parameters:
b - the boolean to be set
See Also:
isEditable
 o getTextField
 public TextFieldGadget getTextField()
Gets the TextFieldGadget.

Returns:
TextFieldGadget
 o getList
 public ListGadget getList()
Gets the ListGadget.

Returns:
ListGadget
 o setBackground
 public void setBackground(Color color,
                           int index)
Sets the background color of the LabelGadet at the specified index.

Parameters:
color - color of new Background
index - index of the LabelGadget in the list that will have its background color set.
 o setBackground
 public void setBackground(Color color,
                           String item)
Sets the background color of the LabelGadet with the specified name.

Parameters:
color - color of new Background
item - name of the LabelGadget in the list that will have its background color set.
 o setForeground
 public void setForeground(Color color,
                           int index)
Sets the foreground color of the LabelGadet at the specified index.

Parameters:
color - color of new foreground
index - index of the LabelGadget in the list that will have its foreground color set.
 o setForeground
 public void setForeground(Color color,
                           String item)
Sets the foreground color of the LabelGadet with the specified name.

Parameters:
color - color of new foreground
item - name of the LabelGadget in the list that will have its foreground color set. setForeground
color - description
item - description
 o setNextFocusGadget
 public void setNextFocusGadget(Gadget nextFocusGadget)
setNextFocusGadget

Parameters:
nextFocusGadget - description
Overrides:
setNextFocusGadget in class Gadget
 o setSorted
 public void setSorted(boolean in)
Sets the boolean sorted flag.

Parameters:
in - boolean sorted status
 o isSorted
 public boolean isSorted()
Gets the boolean sorted flag.

Returns:
boolean
 o setText
 public void setText(String textval)
Sets the text in the TextFieldGadget.

Parameters:
textval - new text for the TextFieldGadget
 o getText
 public String getText()
Gets the text in the TextFieldGadget.

Returns:
text in the TextFieldGadget
 o countItems
 public int countItems()
Returns the number of items in the ListGadget.

Returns:
number of items in the list
 o getItem
 public String getItem(int index)
Gets the item in the list at the specified index.

Parameters:
index - index of item in the list to be retrieved
Returns:
item in the list at the given index
 o add
 public void add(String item)
Adds the given item to the list. If the list is currently unsorted, the new item is simply added to the list. If the list is currently sorted, the new item is inserted in its properly sorted spot.

Parameters:
item - name of the item to be added to the list
 o add
 public void add(String item,
                 int index)
Adds the given item to the list at the given index.

Parameters:
item - name of the item to be added to the list
index - where in the list to insert given item
 o replace
 public void replace(String item,
                     int index)
Replace the item at the specified index with the given item.

Parameters:
item - new value to replace the existing item
index - the position of the item to replace
 o remove
 public void remove(String item)
Removes the specified item from the list.

Parameters:
item - item to be removed from the list
 o remove
 public void remove(int pos)
Removes the item at the given position from the list.

Parameters:
pos - index of item to be removed from the list
Overrides:
remove in class ContainerGadget
 o insert
 public void insert(String item,
                    int index)
Adds the given item to the list at the given index.

Parameters:
item - name of the item to be added to the list
index - where in the list to insert given item
 o getSelectedItem
 public String getSelectedItem()
Gets the text in the TextFieldGadget.

Returns:
the text in the TextFieldGadget
 o getSelectedIndex
 public int getSelectedIndex()
Returns the index in the list of the selected item, or -1 if the selected item is not in the list.

Returns:
int
 o getPreferredSize
 public Dimension getPreferredSize()
Returns the preferred width and height, if both >= 0, else compares the parent's preferred size to the list's, and returns the Dimension with the larger width.

Returns:
a Dimension object
Overrides:
getPreferredSize in class ContainerGadget
 o getMinimumSize
 public Dimension getMinimumSize()
Calls getPreferredSize().

Returns:
Dimension
Overrides:
getMinimumSize in class ContainerGadget
 o setParent
 public void setParent(ContainerGadget parent,
                       boolean notifyParent)
setParent

Parameters:
parent - description
notifyParent - description
Overrides:
setParent in class Gadget
 o getTextFieldGadget
 public TextFieldGadget getTextFieldGadget()
Returns the TextFieldGadget.

Returns:
TextFieldGadget
 o getSelectedIndexes
 public int[] getSelectedIndexes()
Returns an array of integers made up of the indexes of the selected items from the list.

Returns:
int[]
 o getSelectedItems
 public String[] getSelectedItems()
Returns an array of Strings made up of the names of the selected items from the list.

Returns:
String[]
 o requestFocus
 public void requestFocus()
Calls text.requestFous().

Overrides:
requestFocus in class Gadget
See Also:
requestFocus
 o select
 public void select(String item)
Makes the given item the selected one, if it is not already.

Parameters:
item - name of the item to select
 o select
 public void select(int pos)
Selects the item at the given index in the list.

Parameters:
pos - index of item in list to select
 o processActionPerformed
 protected void processActionPerformed(ActionEvent e)
processActionPerformed

Parameters:
e - the firing ActionEvent
 o notifyList
 protected void notifyList()
Hides the list, if it is showing, and shows the list if it is hiding.

See Also:
showList, hideList
 o showList
 protected void showList()
Shows the list

 o setVisible
 public void setVisible(boolean in,
                        boolean invalidateParent)
Shows or hides the component depending on the boolean flag b.

Overrides:
setVisible in class Gadget
 o hideList
 protected void hideList()
Hides the list

 o addItemListener
 public synchronized void addItemListener(ItemListener l)
Adds the specified listener to be notified when component events occur on this component.

Parameters:
l - the listener to receive the events
 o removeItemListener
 public synchronized void removeItemListener(ItemListener l)
Removes the specified listener so it no longer receives item events on this item.

Parameters:
l - the listener to remove
 o addActionListener
 public synchronized void addActionListener(ActionListener l)
Adds the specified listener to be notified when component events occur on this component.

Parameters:
l - the listener to receive the events
 o removeActionListener
 public synchronized void removeActionListener(ActionListener l)
Removes the specified listener so it no longer receives action events on this action.

Parameters:
l - the listener to remove
 o processEvent
 protected void processEvent(AWTEvent e)
processEvent

Parameters:
e - a ItemEvent
Returns:
boolean result
Overrides:
processEvent in class ContainerGadget
 o processActionEvent
 protected void processActionEvent(ActionEvent e)
 o processItemEvent
 protected void processItemEvent(ItemEvent e)
 o keyTyped
 public void keyTyped(KeyEvent e)
keyTyped - empty method.

Parameters:
e - the firing KeyEvent
 o keyPressed
 public void keyPressed(KeyEvent e)
If ComboBox is sorted, get text from the TextFieldGadget, and find the closest match in the list. If ComboBox isn't sorted, handle appropriate key-press possibilities: ESCAPE, UP, DOWN, ENTER, or TAB.

Parameters:
e - the firing KeyEvent
 o fillSearchText
 public void fillSearchText(KeyEvent e)
Sets the searchText variable to be the text in the TextFieldGadget (in upper case);

Parameters:
e - firing KeyEvent
 o keyReleased
 public void keyReleased(KeyEvent e)
keyReleased - empty method.

Parameters:
e - firing KeyEvent

All Packages  Class Hierarchy  This Package  Previous  Next  Index