LEONARDI Application Composer - 8.9.0.40 by W4 S.A.

leon.view.win.swing.component
Class LyJFormattedField

java.lang.Object
  extended by java.awt.Component
      extended by java.awt.Container
          extended by javax.swing.JComponent
              extended by javax.swing.text.JTextComponent
                  extended by javax.swing.JTextField
                      extended by leon.view.win.swing.component.LyJTextField
                          extended by leon.view.win.swing.component.LyJFormattedField
All Implemented Interfaces:
java.awt.event.FocusListener, java.awt.event.KeyListener, java.awt.image.ImageObserver, java.awt.MenuContainer, java.io.Serializable, java.util.EventListener, javax.accessibility.Accessible, javax.swing.Scrollable, javax.swing.SwingConstants

public class LyJFormattedField
extends LyJTextField
implements java.awt.event.FocusListener, java.awt.event.KeyListener

This class implements a TextField that allows formatted input. The format is : '[' number '-' number ']' ( sep '[' number '-' number ']' ) * where variable number is a positive number and sep is a separator String that can be ""

See Also:
LyJFormat, Serialized Form

Nested Class Summary
 class LyJFormattedField._LyJCaretListener
          Customizes the navigation in the textField.
 class LyJFormattedField._LyJFormattedTextCaret
          A caret that remember its last position.
 
Nested classes/interfaces inherited from class leon.view.win.swing.component.LyJTextField
LyJTextField._LyPopupInvoker
 
Nested classes/interfaces inherited from class javax.swing.text.JTextComponent
javax.swing.text.JTextComponent.AccessibleJTextComponent, javax.swing.text.JTextComponent.DropLocation, javax.swing.text.JTextComponent.KeyBinding
 
Nested classes/interfaces inherited from class javax.swing.JComponent
javax.swing.JComponent.AccessibleJComponent
 
Nested classes/interfaces inherited from class java.awt.Component
java.awt.Component.BaselineResizeBehavior
 
Field Summary
static java.lang.String __VERSION
           
 
Fields inherited from class leon.view.win.swing.component.LyJTextField
CANCEL, COPY, CUT, DELETE, PASTE, SELECT_ALL
 
Fields inherited from class javax.swing.JTextField
notifyAction
 
Fields inherited from class javax.swing.text.JTextComponent
DEFAULT_KEYMAP, FOCUS_ACCELERATOR_KEY
 
Fields inherited from class javax.swing.JComponent
TOOL_TIP_TEXT_KEY, UNDEFINED_CONDITION, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_FOCUSED, WHEN_IN_FOCUSED_WINDOW
 
Fields inherited from class java.awt.Component
BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
 
Fields inherited from interface javax.swing.SwingConstants
BOTTOM, CENTER, EAST, HORIZONTAL, LEADING, LEFT, NEXT, NORTH, NORTH_EAST, NORTH_WEST, PREVIOUS, RIGHT, SOUTH, SOUTH_EAST, SOUTH_WEST, TOP, TRAILING, VERTICAL, WEST
 
Fields inherited from interface java.awt.image.ImageObserver
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
 
Constructor Summary
LyJFormattedField(LyJFormattedInput parent, LyEnvironment env)
          Creates a formatted field constructor and initializes it.
LyJFormattedField(java.lang.String format, LyJFormattedInput parent, LyEnvironment env)
          Creates a formatted field constructor with the specified format and initializes it.
 
Method Summary
 void focusGained(java.awt.event.FocusEvent e)
          Invoked when the textField gains the focus.
 void focusLost(java.awt.event.FocusEvent e)
          Invoked when the textField loses the focus.
 int getNextCaretPosition()
          Gets the next caret position.
 int getSelectedIntValue()
          Gets the value at the caret position.
 int getSelectedMaxIntValue()
          Gets the maximum value at the caret position.
 int getSelectedMinIntValue()
          Gets the minimum value at the caret position.
 java.lang.String getText()
          Gets the text of this text component.
 java.lang.String getValue()
          Gets the value of this text component.
 void keyPressed(java.awt.event.KeyEvent e)
          (non-Javadoc).
 void keyReleased(java.awt.event.KeyEvent e)
          Nothing is done when a key is released.
 void keyTyped(java.awt.event.KeyEvent e)
          If the user presses '
 void setFormatString(java.lang.String format)
          Sets the format for this field.
 void setSelectedIntValue(int value)
          Sets the subvalue at the position of the caret.
 void setValue(java.lang.String value)
          Set the current value of the text component.
 
Methods inherited from class leon.view.win.swing.component.LyJTextField
createPopupMenu, delete, getColumnWidth, getMenu, getMinimumSize, init, paste, showMenu, superPaste, undo
 
Methods inherited from class javax.swing.JTextField
addActionListener, getAccessibleContext, getAction, getActionListeners, getActions, getColumns, getHorizontalAlignment, getHorizontalVisibility, getPreferredSize, getScrollOffset, getUIClassID, isValidateRoot, postActionEvent, removeActionListener, scrollRectToVisible, setAction, setActionCommand, setColumns, setDocument, setFont, setHorizontalAlignment, setScrollOffset
 
Methods inherited from class javax.swing.text.JTextComponent
addCaretListener, addInputMethodListener, addKeymap, copy, cut, getCaret, getCaretColor, getCaretListeners, getCaretPosition, getDisabledTextColor, getDocument, getDragEnabled, getDropLocation, getDropMode, getFocusAccelerator, getHighlighter, getInputMethodRequests, getKeymap, getKeymap, getMargin, getNavigationFilter, getPreferredScrollableViewportSize, getPrintable, getScrollableBlockIncrement, getScrollableTracksViewportHeight, getScrollableTracksViewportWidth, getScrollableUnitIncrement, getSelectedText, getSelectedTextColor, getSelectionColor, getSelectionEnd, getSelectionStart, getText, getToolTipText, getUI, isEditable, loadKeymap, modelToView, moveCaretPosition, print, print, print, read, removeCaretListener, removeKeymap, removeNotify, replaceSelection, select, selectAll, setCaret, setCaretColor, setCaretPosition, setComponentOrientation, setDisabledTextColor, setDragEnabled, setDropMode, setEditable, setFocusAccelerator, setHighlighter, setKeymap, setMargin, setNavigationFilter, setSelectedTextColor, setSelectionColor, setSelectionEnd, setSelectionStart, setText, setUI, updateUI, viewToModel, write
 
Methods inherited from class javax.swing.JComponent
addAncestorListener, addNotify, addVetoableChangeListener, computeVisibleRect, contains, createToolTip, disable, enable, firePropertyChange, firePropertyChange, firePropertyChange, getActionForKeyStroke, getActionMap, getAlignmentX, getAlignmentY, getAncestorListeners, getAutoscrolls, getBaseline, getBaselineResizeBehavior, getBorder, getBounds, getClientProperty, getComponentPopupMenu, getConditionForKeyStroke, getDebugGraphicsOptions, getDefaultLocale, getFontMetrics, getGraphics, getHeight, getInheritsPopupMenu, getInputMap, getInputMap, getInputVerifier, getInsets, getInsets, getListeners, getLocation, getMaximumSize, getNextFocusableComponent, getPopupLocation, getRegisteredKeyStrokes, getRootPane, getSize, getToolTipLocation, getToolTipText, getTopLevelAncestor, getTransferHandler, getVerifyInputWhenFocusTarget, getVetoableChangeListeners, getVisibleRect, getWidth, getX, getY, grabFocus, isDoubleBuffered, isLightweightComponent, isManagingFocus, isOpaque, isOptimizedDrawingEnabled, isPaintingForPrint, isPaintingTile, isRequestFocusEnabled, paint, paintImmediately, paintImmediately, print, printAll, putClientProperty, registerKeyboardAction, registerKeyboardAction, removeAncestorListener, removeVetoableChangeListener, repaint, repaint, requestDefaultFocus, requestFocus, requestFocus, requestFocusInWindow, resetKeyboardActions, reshape, revalidate, setActionMap, setAlignmentX, setAlignmentY, setAutoscrolls, setBackground, setBorder, setComponentPopupMenu, setDebugGraphicsOptions, setDefaultLocale, setDoubleBuffered, setEnabled, setFocusTraversalKeys, setForeground, setInheritsPopupMenu, setInputMap, setInputVerifier, setMaximumSize, setMinimumSize, setNextFocusableComponent, setOpaque, setPreferredSize, setRequestFocusEnabled, setToolTipText, setTransferHandler, setVerifyInputWhenFocusTarget, setVisible, unregisterKeyboardAction, update
 
Methods inherited from class java.awt.Container
add, add, add, add, add, addContainerListener, addPropertyChangeListener, addPropertyChangeListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getComponentZOrder, getContainerListeners, getFocusTraversalKeys, getFocusTraversalPolicy, getLayout, getMousePosition, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusCycleRoot, isFocusTraversalPolicyProvider, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, printComponents, remove, remove, removeAll, removeContainerListener, setComponentZOrder, setFocusCycleRoot, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setLayout, transferFocusBackward, transferFocusDownCycle, validate
 
Methods inherited from class java.awt.Component
action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, contains, createImage, createImage, createVolatileImage, createVolatileImage, dispatchEvent, enable, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getBackground, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusCycleRootAncestor, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getForeground, getGraphicsConfiguration, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputContext, getInputMethodListeners, getKeyListeners, getLocale, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPeer, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getToolkit, getTreeLock, gotFocus, handleEvent, hasFocus, hide, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isPreferredSizeSet, isShowing, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, postEvent, prepareImage, prepareImage, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, resize, resize, setBounds, setBounds, setCursor, setDropTarget, setFocusable, setFocusTraversalKeysEnabled, setIgnoreRepaint, setLocale, setLocation, setLocation, setName, setSize, setSize, show, show, size, toString, transferFocus, transferFocusUpCycle
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

__VERSION

public static final java.lang.String __VERSION
See Also:
Constant Field Values
Constructor Detail

LyJFormattedField

public LyJFormattedField(LyJFormattedInput parent,
                         LyEnvironment env)
                  throws LyJBadFormatException,
                         javax.swing.text.BadLocationException
Creates a formatted field constructor and initializes it.

Parameters:
parent - the parent component
env - the current environment
Throws:
LyJBadFormatException - is not thrown here
javax.swing.text.BadLocationException - if the format displayable can't be updates in the associated formatted text document

LyJFormattedField

public LyJFormattedField(java.lang.String format,
                         LyJFormattedInput parent,
                         LyEnvironment env)
                  throws LyJBadFormatException,
                         javax.swing.text.BadLocationException
Creates a formatted field constructor with the specified format and initializes it.

Parameters:
format - the String expression of the format
parent - the parent component
env - the current environment
Throws:
LyJBadFormatException - if the format generates errors during parsing
javax.swing.text.BadLocationException - if the format displayable can't be updates in the associated formatted text document
Method Detail

setFormatString

public void setFormatString(java.lang.String format)
                     throws LyJBadFormatException
Sets the format for this field.

Parameters:
format - the format that is parsed and set
Throws:
LyJBadFormatException - if the format generates errors during parsing
See Also:
LyJFormat.setFormatString(String)

focusGained

public void focusGained(java.awt.event.FocusEvent e)
Invoked when the textField gains the focus. Shows the editing value and resets the caret position.

Specified by:
focusGained in interface java.awt.event.FocusListener
See Also:
FocusListener.focusGained(java.awt.event.FocusEvent)

focusLost

public void focusLost(java.awt.event.FocusEvent e)
Invoked when the textField loses the focus. Shows the editing value and resets the caret position.

Specified by:
focusLost in interface java.awt.event.FocusListener
See Also:
FocusListener.focusLost(java.awt.event.FocusEvent)

keyPressed

public void keyPressed(java.awt.event.KeyEvent e)
(non-Javadoc).

Specified by:
keyPressed in interface java.awt.event.KeyListener
See Also:
KeyListener.keyPressed(java.awt.event.KeyEvent)

keyReleased

public void keyReleased(java.awt.event.KeyEvent e)
Nothing is done when a key is released.

Specified by:
keyReleased in interface java.awt.event.KeyListener
See Also:
KeyListener.keyReleased(java.awt.event.KeyEvent)

keyTyped

public void keyTyped(java.awt.event.KeyEvent e)
If the user presses '.', the caret go to the next valid position.

Specified by:
keyTyped in interface java.awt.event.KeyListener
See Also:
KeyListener.keyTyped(java.awt.event.KeyEvent)

getNextCaretPosition

public int getNextCaretPosition()
Gets the next caret position.

Returns:
the next valid caret position

getText

public java.lang.String getText()
Gets the text of this text component.

Overrides:
getText in class javax.swing.text.JTextComponent
Returns:
null if the value is not set.
See Also:
JTextComponent.getText()

getValue

public java.lang.String getValue()
Gets the value of this text component.

Returns:
the current value
See Also:
getText(), setValue(String)

setValue

public void setValue(java.lang.String value)
Set the current value of the text component.

Parameters:
value - the value to set
See Also:
getValue()

getSelectedIntValue

public int getSelectedIntValue()
Gets the value at the caret position.

Returns:
the subvalue at the position of the caret
See Also:
setSelectedIntValue(int), LyJFormat.getIntValue(int)

setSelectedIntValue

public void setSelectedIntValue(int value)
Sets the subvalue at the position of the caret.

Parameters:
value - the value to set
See Also:
getSelectedIntValue()

getSelectedMinIntValue

public int getSelectedMinIntValue()
Gets the minimum value at the caret position.

Returns:
the minimum value at the position of the caret

getSelectedMaxIntValue

public int getSelectedMaxIntValue()
Gets the maximum value at the caret position.

Returns:
the maximum value at the position of the caret

(c) January 2013 - W4 S.A.

Website: W4 S.A., contact us: support@w4global.com