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

Quick Search    Search Deep

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

java.lang.Object
  extended byjava.awt.Component
      extended byjava.awt.Container
          extended byjava.awt.Panel
              extended bycom.flexstor.common.awt.field.ComboField
All Implemented Interfaces:
javax.accessibility.Accessible, java.awt.event.ActionListener, java.util.EventListener, com.flexstor.common.constants.FieldConstantsI, com.flexstor.common.awt.event.FlexTextListener, java.awt.image.ImageObserver, java.awt.MenuContainer, java.awt.event.MouseListener, java.io.Serializable

public class ComboField
extends java.awt.Panel
implements com.flexstor.common.awt.event.FlexTextListener, java.awt.event.MouseListener, com.flexstor.common.constants.FieldConstantsI, java.awt.event.ActionListener

ComboField is a self configuring TextField/Choice that provides full data validation and case conversion. All edit events are sent as FlexTextEvent events, so that three different events (ItemEvent, ActionEvent, and TextEvent/KeyEvent) do not need to be caught.

Version:
2.1

Nested Class Summary
 
Nested classes inherited from class java.awt.Panel
java.awt.Panel.AccessibleAWTPanel
 
Nested classes inherited from class java.awt.Container
java.awt.Container.AccessibleAWTContainer
 
Nested classes inherited from class java.awt.Component
java.awt.Component.AccessibleAWTComponent, java.awt.Component.BltBufferStrategy, java.awt.Component.FlipBufferStrategy
 
Field Summary
protected  com.flexstor.common.awt.ArrowButton arrow
           
protected  boolean bAllowRepaint
           
private  boolean bEnabled
           
protected  boolean bExtendedEdit
           
protected  boolean bPadChoice
          Flag for choice padding.
protected  boolean bShowExtEdit
           
private  boolean bVisualRequired
           
protected  ComponentI field
          Reference to the field object.
private  int nCase
           
private  int nForcedLength
           
protected  int nMode
          The current mode, either ENTRY_TYPE_UNDEFINED, ENTRY_TYPE_TEXT_FIELD, or ENTRY_TYPE_CHOICE.
private static int nPopupThreshold
           
protected  java.lang.String sName
          The name associated with this field.
private  java.lang.String sTextAreaText
           
private  java.util.Vector textListeners
          Text Listeners -- used for filtering of text events.
 
Fields inherited from class java.awt.Panel
 
Fields inherited from class java.awt.Container
 
Fields inherited from class java.awt.Component
BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
 
Fields inherited from interface com.flexstor.common.constants.FieldConstantsI
CASE_LOWER, CASE_NONE, CASE_PROPER, CASE_UNDEFINED, CASE_UPPER, DATA_NONE_ID, DATA_NONE_VALUE, ENTRY_TYPE_CHOICE, ENTRY_TYPE_TEXT_FIELD, ENTRY_TYPE_UNDEFINED, FIELD_FMT_DATE, FIELD_FMT_DATETIME, FIELD_FMT_TIME, FIELD_LENGTH_MAX, FIELD_TYPE_DATE, FIELD_TYPE_DATETIME, FIELD_TYPE_NUMBER, FIELD_TYPE_STRING, FIELD_TYPE_TIME, FIELD_TYPE_UNDEFINED, IDENTIFIER
 
Fields inherited from interface java.awt.image.ImageObserver
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
 
Constructor Summary
ComboField(java.lang.String sName, boolean bPadChoice)
          Creates a new ComboField with the specified name.
ComboField(java.lang.String sName, boolean bPadChoice, boolean bVisualRequired, boolean bExtendedEdit)
          Creates a new ComboField with the specified name.
 
Method Summary
 void actionPerformed(java.awt.event.ActionEvent e)
          This method is invoked when an action occurs.
 void addTextListener(com.flexstor.common.awt.event.FlexTextListener l)
           
 void cleanup()
           
private  void cleanUp()
           
 void clear(boolean bNotify)
          This method will select the first item in the Choice box or clear out the text field.
 void configure(int nDataType, int nEntryType, int nLength, int nCase, boolean bRequired, boolean bEditable, java.lang.String sLabel)
          Configures this field.
 void configure(int nDataType, int nEntryType, int nLength, int nCase, boolean bRequired, boolean bEditable, java.lang.String sLabel, java.util.ArrayList alLookup)
          Configures this field.
 void configure(int nDataType, int nEntryType, int nLength, int nCase, boolean bRequired, boolean bEditable, java.lang.String sLabel, java.lang.String[] saLookup)
          Configures this field.
 void enableRepaints(boolean bPaint)
           
private  java.lang.String fixupLabel(java.lang.String sLabel)
          Removes invalid characters from the label.
 void formatCase()
           
 boolean getEnabled()
           
 long getId()
           
 java.awt.Dimension getMinimumSize()
          Returns the minimum size of this container.
 int getMode()
           
 java.lang.String getName()
          Returns the name of this field.
private  java.awt.Frame getParentFrame()
           
 java.awt.Dimension getPreferredSize()
          Returns the preferred size of this container.
 int getSelectedIndex()
           
 java.lang.String getText()
           
 boolean isBlank()
           
 boolean isRequired()
           
 boolean isShowing()
          Tests whether or not this component is actually being shown on the screen.
 java.awt.Dimension minimumSize()
          Returns the minimum size of this container.
 void mouseClicked(java.awt.event.MouseEvent e)
          This method is called when the mouse is clicked (pressed and released in short succession) on a component.
 void mouseEntered(java.awt.event.MouseEvent e)
          This method is called when the mouse enters a component.
 void mouseExited(java.awt.event.MouseEvent e)
          This method is called when the mouse exits a component.
 void mousePressed(java.awt.event.MouseEvent e)
          This method is called when the mouse is pressed over a component.
 void mouseReleased(java.awt.event.MouseEvent e)
          This method is called when the mouse is released over a component.
 void paint(java.awt.Graphics g)
          Paints this container.
private  void popupExtDialog()
           
 java.awt.Dimension preferredSize()
          Returns the preferred size of this container.
 boolean quietVerify()
           
 void removeTextListener(com.flexstor.common.awt.event.FlexTextListener l)
           
 void requestFocus()
          Request that this Component be given the keyboard input focus and that its top-level ancestor become the focused Window.
 void setCustomValidator(com.flexstor.common.parsers.ValidatorI validator)
           
 void setEnabled(boolean bEdit)
          Conditionally enables/disables this field.
 void setId(long nId)
           
 void setItems(java.util.ArrayList alItems)
           
 void setOptimumSize(int nMaxFieldWidth)
           
 void setPreferredWidth(int nWidth)
           
 void setRequired(boolean bRequired)
           
 void setText(java.lang.String sText)
           
 void textValueChangeBegin(com.flexstor.common.awt.event.FlexTextEvent e)
           
 void textValueChangeEnd(com.flexstor.common.awt.event.FlexTextEvent e)
           
 boolean verify(boolean bCheckRequired)
          Checks if the field is required.
 
Methods inherited from class java.awt.Panel
addNotify, getAccessibleContext
 
Methods inherited from class java.awt.Container
add, add, add, add, add, addContainerListener, addImpl, addPropertyChangeListener, addPropertyChangeListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getAlignmentX, getAlignmentY, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getComponentZOrder, getContainerListeners, getFocusTraversalKeys, getFocusTraversalPolicy, getInsets, getLayout, getListeners, getMaximumSize, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusCycleRoot, isFocusTraversalPolicySet, layout, list, list, locate, paintComponents, paramString, print, printComponents, processContainerEvent, processEvent, remove, remove, removeAll, removeContainerListener, removeNotify, setComponentZOrder, setFocusCycleRoot, setFocusTraversalKeys, setFocusTraversalPolicy, setFont, setLayout, transferFocusDownCycle, update, validate, validateTree
 
Methods inherited from class java.awt.Component
action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, coalesceEvents, contains, contains, createImage, createImage, createVolatileImage, createVolatileImage, disable, disableEvents, dispatchEvent, enable, enable, enableEvents, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getBackground, getBounds, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusCycleRootAncestor, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getFontMetrics, getForeground, getGraphics, getGraphicsConfiguration, getHeight, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputContext, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocale, getLocation, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMouseWheelListeners, getParent, getPeer, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getSize, getToolkit, getTreeLock, getWidth, getX, getY, gotFocus, handleEvent, hasFocus, hide, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isDoubleBuffered, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isOpaque, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, postEvent, prepareImage, prepareImage, printAll, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processKeyEvent, processMouseEvent, processMouseMotionEvent, processMouseWheelEvent, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, repaint, requestFocus, requestFocusInWindow, requestFocusInWindow, reshape, resize, resize, setBackground, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setFocusable, setFocusTraversalKeysEnabled, setForeground, setIgnoreRepaint, setLocale, setLocation, setLocation, setName, setSize, setSize, setVisible, show, show, size, toString, transferFocus, transferFocusBackward, transferFocusUpCycle
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

nMode

protected int nMode
The current mode, either ENTRY_TYPE_UNDEFINED, ENTRY_TYPE_TEXT_FIELD, or ENTRY_TYPE_CHOICE.


field

protected ComponentI field
Reference to the field object.


sName

protected java.lang.String sName
The name associated with this field.


bPadChoice

protected boolean bPadChoice
Flag for choice padding.


bAllowRepaint

protected boolean bAllowRepaint

bVisualRequired

private boolean bVisualRequired

bExtendedEdit

protected boolean bExtendedEdit

bShowExtEdit

protected boolean bShowExtEdit

arrow

protected com.flexstor.common.awt.ArrowButton arrow

bEnabled

private boolean bEnabled

textListeners

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


sTextAreaText

private java.lang.String sTextAreaText

nCase

private int nCase

nPopupThreshold

private static int nPopupThreshold

nForcedLength

private int nForcedLength
Constructor Detail

ComboField

public ComboField(java.lang.String sName,
                  boolean bPadChoice)
Creates a new ComboField with the specified name.


ComboField

public ComboField(java.lang.String sName,
                  boolean bPadChoice,
                  boolean bVisualRequired,
                  boolean bExtendedEdit)
Creates a new ComboField with the specified name.

Method Detail

cleanup

public void cleanup()

getName

public java.lang.String getName()
Returns the name of this field.


setEnabled

public void setEnabled(boolean bEdit)
Conditionally enables/disables this field.


getEnabled

public boolean getEnabled()

configure

public void configure(int nDataType,
                      int nEntryType,
                      int nLength,
                      int nCase,
                      boolean bRequired,
                      boolean bEditable,
                      java.lang.String sLabel)
Configures this field.


configure

public void configure(int nDataType,
                      int nEntryType,
                      int nLength,
                      int nCase,
                      boolean bRequired,
                      boolean bEditable,
                      java.lang.String sLabel,
                      java.lang.String[] saLookup)
Configures this field.


configure

public void configure(int nDataType,
                      int nEntryType,
                      int nLength,
                      int nCase,
                      boolean bRequired,
                      boolean bEditable,
                      java.lang.String sLabel,
                      java.util.ArrayList alLookup)
Configures this field.


setItems

public void setItems(java.util.ArrayList alItems)

setPreferredWidth

public void setPreferredWidth(int nWidth)

getMinimumSize

public java.awt.Dimension getMinimumSize()
Description copied from class: java.awt.Container
Returns the minimum size of this container.


getPreferredSize

public java.awt.Dimension getPreferredSize()
Description copied from class: java.awt.Container
Returns the preferred size of this container.


minimumSize

public java.awt.Dimension minimumSize()
Description copied from class: java.awt.Container
Returns the minimum size of this container.


preferredSize

public java.awt.Dimension preferredSize()
Description copied from class: java.awt.Container
Returns the preferred size of this container.


setText

public void setText(java.lang.String sText)

getText

public java.lang.String getText()

setId

public void setId(long nId)

getId

public long getId()

getSelectedIndex

public int getSelectedIndex()

setRequired

public void setRequired(boolean bRequired)

isRequired

public boolean isRequired()

clear

public void clear(boolean bNotify)
This method will select the first item in the Choice box or clear out the text field.


verify

public boolean verify(boolean bCheckRequired)
Checks if the field is required.


quietVerify

public boolean quietVerify()

formatCase

public void formatCase()

setCustomValidator

public void setCustomValidator(com.flexstor.common.parsers.ValidatorI validator)

requestFocus

public void requestFocus()
Description copied from class: java.awt.Component
Request that this Component be given the keyboard input focus and that its top-level ancestor become the focused Window. For the request to be granted, the Component must be focusable, displayable and showing and the top-level Window to which it belongs must be focusable. If the request is initially denied on the basis that the top-level Window is not focusable, the request will be remembered and granted when the Window does become focused. Never assume that this Component is the focus owner until it receives a FOCUS_GAINED event. The behaviour of this method is platform-dependent. Component.requestFocusInWindow()>Component.requestFocusInWindow() 55 should be used instead.


enableRepaints

public void enableRepaints(boolean bPaint)

paint

public void paint(java.awt.Graphics g)
Description copied from class: java.awt.Container
Paints this container. The implementation of this method in this class forwards to any lightweight components in this container. If this method is subclassed, this method should still be invoked as a superclass method so that lightweight components are properly drawn.


setOptimumSize

public void setOptimumSize(int nMaxFieldWidth)

textValueChangeBegin

public void textValueChangeBegin(com.flexstor.common.awt.event.FlexTextEvent e)
Specified by:
textValueChangeBegin in interface com.flexstor.common.awt.event.FlexTextListener

textValueChangeEnd

public void textValueChangeEnd(com.flexstor.common.awt.event.FlexTextEvent e)
Specified by:
textValueChangeEnd in interface com.flexstor.common.awt.event.FlexTextListener

addTextListener

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

removeTextListener

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

actionPerformed

public void actionPerformed(java.awt.event.ActionEvent e)
Description copied from interface: java.awt.event.ActionListener
This method is invoked when an action occurs.

Specified by:
actionPerformed in interface java.awt.event.ActionListener

popupExtDialog

private void popupExtDialog()

mousePressed

public void mousePressed(java.awt.event.MouseEvent e)
Description copied from interface: java.awt.event.MouseListener
This method is called when the mouse is pressed over a component.

Specified by:
mousePressed in interface java.awt.event.MouseListener

mouseClicked

public void mouseClicked(java.awt.event.MouseEvent e)
Description copied from interface: java.awt.event.MouseListener
This method is called when the mouse is clicked (pressed and released in short succession) on a component.

Specified by:
mouseClicked in interface java.awt.event.MouseListener

mouseEntered

public void mouseEntered(java.awt.event.MouseEvent e)
Description copied from interface: java.awt.event.MouseListener
This method is called when the mouse enters a component.

Specified by:
mouseEntered in interface java.awt.event.MouseListener

mouseExited

public void mouseExited(java.awt.event.MouseEvent e)
Description copied from interface: java.awt.event.MouseListener
This method is called when the mouse exits a component.

Specified by:
mouseExited in interface java.awt.event.MouseListener

mouseReleased

public void mouseReleased(java.awt.event.MouseEvent e)
Description copied from interface: java.awt.event.MouseListener
This method is called when the mouse is released over a component.

Specified by:
mouseReleased in interface java.awt.event.MouseListener

cleanUp

private void cleanUp()

getMode

public int getMode()

isBlank

public boolean isBlank()

getParentFrame

private java.awt.Frame getParentFrame()

isShowing

public boolean isShowing()
Description copied from class: java.awt.Component
Tests whether or not this component is actually being shown on the screen. This will be true if and only if it this component is visible and its parent components are all visible.


fixupLabel

private java.lang.String fixupLabel(java.lang.String sLabel)
Removes invalid characters from the label.