Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

com.flexstor.common.awt.field
Class FlexChoice  view FlexChoice download FlexChoice.java

java.lang.Object
  extended byjava.awt.Component
      extended byjava.awt.Choice
          extended bycom.flexstor.common.awt.field.FlexChoice
All Implemented Interfaces:
javax.accessibility.Accessible, ComponentI, java.util.EventListener, java.awt.image.ImageObserver, java.awt.event.ItemListener, java.awt.ItemSelectable, java.awt.MenuContainer, java.io.Serializable
Direct Known Subclasses:
ActionChoice

public class FlexChoice
extends java.awt.Choice
implements java.awt.event.ItemListener, ComponentI

FlexChoice extends choice by providing for: 1. The ability to add a list of items at one time with the construstor. 2. The setItems() method which clears the choice and adds a list of items. 3. Auto padding automatically handled. This means that the first item in the choice is always a space. This option must be selected in the constructor. 4. Keeping an associated id to each item value in the list of choices.


Nested Class Summary
 
Nested classes inherited from class java.awt.Choice
java.awt.Choice.AccessibleAWTChoice
 
Nested classes inherited from class java.awt.Component
java.awt.Component.AccessibleAWTComponent, java.awt.Component.BltBufferStrategy, java.awt.Component.FlipBufferStrategy
 
Field Summary
private  java.util.ArrayList alItems
          The list of lookup items (value,id pairs) for this choice.
private  boolean bPadChoice
          A string with a single space is added as the first item to the choice when true.
private  boolean bRequired
           
private  boolean bTabbable
          If set to false, then this choice does not support tabbing.
private static java.awt.FontMetrics metrics
           
private  long nLastValueId
           
private  int nMaxLength
          The preferred length of the items in this choice.
private  java.lang.String sLastValue
          The currently valid selected item.
private  java.util.Vector textListeners
          Text Listeners -- used for filtering of text events.
 
Fields inherited from class java.awt.Choice
 
Fields inherited from class java.awt.Component
BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
 
Fields inherited from interface com.flexstor.common.awt.field.ComponentI
COMBO_FIELD_HEIGHT, COMPONENT_HEIGHT, MAX_FIELD_LENGTH, TEXT_AREA_HEIGHT
 
Fields inherited from interface java.awt.image.ImageObserver
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
 
Constructor Summary
FlexChoice()
          Creates an empty FlexChoice.
FlexChoice(java.util.ArrayList alItems)
          Creates a new FlexChoice containing the items saItems.
FlexChoice(boolean bPadChoice)
          Creates a new FlexChoice with the name sName and containing the items saItems.
FlexChoice(java.lang.String[] saItems)
          Creates a new FlexChoice containing the items saItems.
FlexChoice(java.lang.String sName, java.util.ArrayList alItems, boolean bPadChoice)
          Creates a new FlexChoice with the name sName and containing the items saItems.
FlexChoice(java.lang.String sName, java.lang.String[] saItems, boolean bPadChoice)
          Creates a new FlexChoice with the name sName and containing the items saItems.
 
Method Summary
 void addItem(com.flexstor.common.disguise.LookupListItem item)
           
 void addItem(java.lang.String sItem)
          Adds the specified item to this choice box.
 void addNotify()
          Creates the native peer for this object.
 void addTextListener(com.flexstor.common.awt.event.FlexTextListener l)
           
 void cleanup()
           
 void clear(boolean bNotify)
          Selects the first item in the choice.
 void configure(boolean bEditable, boolean bRequired, java.lang.String sLabel, java.util.ArrayList alItems)
          Configures the validator field.
 void configure(boolean bEditable, boolean bRequired, java.lang.String sLabel, java.lang.String[] saItems)
          Configures the validator field.
 void formatCase()
          Not implemented until this choice supports editing.
 boolean getEnabled()
          Returns true if this choice is enabled.
 long getId()
           
 java.awt.Dimension getMinimumSize()
          Returns the component's minimum size.
private  java.awt.Frame getParentFrame()
           
 java.awt.Dimension getPreferredSize()
          Returns the component's preferred size.
 java.lang.String getText()
          Returns the contents of the upper part of the choice.
 void insert(com.flexstor.common.disguise.LookupListItem item, int index)
           
 void insert(java.lang.String sItem, int index)
          Inserts an item into this Choice.
 boolean isBlank()
           
 boolean isFocusTraversable()
          Overides isFocusTraversable in java.awt.Component.
 boolean isRequired()
           
 void itemStateChanged(java.awt.event.ItemEvent ie)
          This method is called when an item's state is changed.
 boolean quietVerify()
           
 void removeAll()
          Removes all of the objects from this choice box.
 void removeTextListener(com.flexstor.common.awt.event.FlexTextListener l)
           
 void select(int pos)
          Forces the item at the specified index to be selected.
 void select(java.lang.String str)
          Forces the named item to be selected.
 void setCustomValidator(com.flexstor.common.parsers.ValidatorI validator)
          Not implemented until this choice supports editing.
 void setFocusTraversable(boolean bState)
          Sets the focusTraversable function.
 void setId(long nId)
           
 void setItems(java.util.ArrayList alItems)
          Adds an array of items to the choice.
 void setItems(java.lang.String[] saItems)
          Adds an array of items to the choice.
 void setRequired(boolean bRequired)
           
 void setText(java.lang.String sText)
          Sets the contents of the upper part of the choice.
 boolean verify(boolean bCheckRequired)
           
 
Methods inherited from class java.awt.Choice
add, addItemListener, countItems, getAccessibleContext, getItem, getItemCount, getItemListeners, getListeners, getSelectedIndex, getSelectedItem, getSelectedObjects, paramString, processEvent, processItemEvent, remove, remove, removeItemListener
 
Methods inherited from class java.awt.Component
action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, addPropertyChangeListener, addPropertyChangeListener, applyComponentOrientation, areFocusTraversalKeysSet, bounds, checkImage, checkImage, coalesceEvents, contains, contains, createImage, createImage, createVolatileImage, createVolatileImage, deliverEvent, disable, disableEvents, dispatchEvent, doLayout, enable, enable, enableEvents, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getAlignmentX, getAlignmentY, getBackground, getBounds, getBounds, getColorModel, getComponentAt, getComponentAt, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusCycleRootAncestor, getFocusListeners, getFocusTraversalKeys, getFocusTraversalKeysEnabled, getFont, getFontMetrics, getForeground, getGraphics, getGraphicsConfiguration, getHeight, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputContext, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocale, getLocation, getLocation, getLocationOnScreen, getMaximumSize, getMouseListeners, getMouseMotionListeners, getMouseWheelListeners, getName, getParent, getPeer, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getSize, getToolkit, getTreeLock, getWidth, getX, getY, gotFocus, handleEvent, hasFocus, hide, imageUpdate, inside, invalidate, isBackgroundSet, isCursorSet, isDisplayable, isDoubleBuffered, isEnabled, isFocusable, isFocusCycleRoot, isFocusOwner, isFontSet, isForegroundSet, isLightweight, isOpaque, isShowing, isValid, isVisible, keyDown, keyUp, layout, list, list, list, list, list, locate, location, lostFocus, minimumSize, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paint, paintAll, postEvent, preferredSize, prepareImage, prepareImage, print, printAll, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processKeyEvent, processMouseEvent, processMouseMotionEvent, processMouseWheelEvent, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removeNotify, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, repaint, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, reshape, resize, resize, setBackground, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setEnabled, setFocusable, setFocusTraversalKeys, setFocusTraversalKeysEnabled, setFont, setForeground, setIgnoreRepaint, setLocale, setLocation, setLocation, setName, setSize, setSize, setVisible, show, show, size, toString, transferFocus, transferFocusBackward, transferFocusUpCycle, update, validate
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface com.flexstor.common.awt.field.ComponentI
requestFocus, setBounds, setEnabled
 

Field Detail

nMaxLength

private int nMaxLength
The preferred length of the items in this choice.


bTabbable

private boolean bTabbable
If set to false, then this choice does not support tabbing.


bPadChoice

private boolean bPadChoice
A string with a single space is added as the first item to the choice when true.


textListeners

private java.util.Vector textListeners
Text Listeners -- used for filtering of text events.


bRequired

private boolean bRequired

sLastValue

private java.lang.String sLastValue
The currently valid selected item. May differ from actual selected value when between textValueChangeBegin() and textValueChangeEnd() processing.


nLastValueId

private long nLastValueId

alItems

private java.util.ArrayList alItems
The list of lookup items (value,id pairs) for this choice.


metrics

private static java.awt.FontMetrics metrics
Constructor Detail

FlexChoice

public FlexChoice()
Creates an empty FlexChoice.


FlexChoice

public FlexChoice(java.util.ArrayList alItems)
Creates a new FlexChoice containing the items saItems.


FlexChoice

public FlexChoice(java.lang.String[] saItems)
Creates a new FlexChoice containing the items saItems.


FlexChoice

public FlexChoice(boolean bPadChoice)
Creates a new FlexChoice with the name sName and containing the items saItems.


FlexChoice

public FlexChoice(java.lang.String sName,
                  java.lang.String[] saItems,
                  boolean bPadChoice)
Creates a new FlexChoice with the name sName and containing the items saItems.


FlexChoice

public FlexChoice(java.lang.String sName,
                  java.util.ArrayList alItems,
                  boolean bPadChoice)
Creates a new FlexChoice with the name sName and containing the items saItems.

Method Detail

configure

public void configure(boolean bEditable,
                      boolean bRequired,
                      java.lang.String sLabel,
                      java.lang.String[] saItems)
Configures the validator field.


configure

public void configure(boolean bEditable,
                      boolean bRequired,
                      java.lang.String sLabel,
                      java.util.ArrayList alItems)
Configures the validator field.


addItem

public void addItem(java.lang.String sItem)
Description copied from class: java.awt.Choice
Adds the specified item to this choice box. This method is oboslete since Java 2 platform 1.1. Please use @see add instead.


addItem

public void addItem(com.flexstor.common.disguise.LookupListItem item)

setItems

public void setItems(java.lang.String[] saItems)
Adds an array of items to the choice.


setItems

public void setItems(java.util.ArrayList alItems)
Adds an array of items to the choice.


removeAll

public void removeAll()
Description copied from class: java.awt.Choice
Removes all of the objects from this choice box.


insert

public void insert(java.lang.String sItem,
                   int index)
Description copied from class: java.awt.Choice
Inserts an item into this Choice. Existing items are shifted upwards. If the new item is the only item, then it is selected. If the currently selected item is shifted, then the first item is selected. If the currently selected item is not shifted, then it remains selected.


insert

public void insert(com.flexstor.common.disguise.LookupListItem item,
                   int index)

clear

public void clear(boolean bNotify)
Selects the first item in the choice.

Specified by:
clear in interface ComponentI

cleanup

public void cleanup()
Specified by:
cleanup in interface ComponentI

addNotify

public void addNotify()
Description copied from class: java.awt.Choice
Creates the native peer for this object.


setFocusTraversable

public void setFocusTraversable(boolean bState)
Sets the focusTraversable function.


isFocusTraversable

public boolean isFocusTraversable()
Overides isFocusTraversable in java.awt.Component. This choice supports tabbing only if it is enabled, showing on the screen, and setFocusTraversable(false) was not called.


itemStateChanged

public void itemStateChanged(java.awt.event.ItemEvent ie)
Description copied from interface: java.awt.event.ItemListener
This method is called when an item's state is changed.

Specified by:
itemStateChanged in interface java.awt.event.ItemListener

getEnabled

public boolean getEnabled()
Returns true if this choice is enabled.

Specified by:
getEnabled in interface ComponentI

setText

public void setText(java.lang.String sText)
Sets the contents of the upper part of the choice. Automatically handles padding.

Specified by:
setText in interface ComponentI

getText

public java.lang.String getText()
Returns the contents of the upper part of the choice. Automatically handles padding.

Specified by:
getText in interface ComponentI

setId

public void setId(long nId)
Specified by:
setId in interface ComponentI

getId

public long getId()
Specified by:
getId in interface ComponentI

select

public void select(int pos)
Description copied from class: java.awt.Choice
Forces the item at the specified index to be selected.


select

public void select(java.lang.String str)
Description copied from class: java.awt.Choice
Forces the named item to be selected.


verify

public boolean verify(boolean bCheckRequired)
Specified by:
verify in interface ComponentI

getParentFrame

private java.awt.Frame getParentFrame()

formatCase

public void formatCase()
Not implemented until this choice supports editing.

Specified by:
formatCase in interface ComponentI

setCustomValidator

public void setCustomValidator(com.flexstor.common.parsers.ValidatorI validator)
Not implemented until this choice supports editing.

Specified by:
setCustomValidator in interface ComponentI

quietVerify

public boolean quietVerify()
Specified by:
quietVerify in interface ComponentI

isBlank

public boolean isBlank()
Specified by:
isBlank in interface ComponentI

isRequired

public boolean isRequired()
Specified by:
isRequired in interface ComponentI

setRequired

public void setRequired(boolean bRequired)
Specified by:
setRequired in interface ComponentI

getMinimumSize

public java.awt.Dimension getMinimumSize()
Description copied from class: java.awt.Component
Returns the component's minimum size.

Specified by:
getMinimumSize in interface ComponentI

getPreferredSize

public java.awt.Dimension getPreferredSize()
Description copied from class: java.awt.Component
Returns the component's preferred size.

Specified by:
getPreferredSize in interface ComponentI

addTextListener

public void addTextListener(com.flexstor.common.awt.event.FlexTextListener l)

removeTextListener

public void removeTextListener(com.flexstor.common.awt.event.FlexTextListener l)