LEONARDI Application Composer - 8.9.0.40 by W4 S.A.

leon.view.win.swing.component
Class LyJFormattedInput._LyFormattedField

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.LyJFormattedInput._LyFormattedField
All Implemented Interfaces:
java.awt.event.FocusListener, java.awt.event.KeyListener, java.awt.event.MouseListener, java.awt.event.TextListener, java.awt.image.ImageObserver, java.awt.MenuContainer, java.io.Serializable, java.util.EventListener, javax.accessibility.Accessible, javax.swing.Scrollable, javax.swing.SwingConstants
Enclosing class:
LyJFormattedInput

public class LyJFormattedInput._LyFormattedField
extends LyJTextField
implements java.awt.event.KeyListener, java.awt.event.MouseListener, java.awt.event.TextListener, java.awt.event.FocusListener

Formatted field of a parsed value.

See Also:
Serialized Form

Nested Class Summary
 
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
 
Fields inherited from class leon.view.win.swing.component.LyJTextField
__VERSION, 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
LyJFormattedInput._LyFormattedField()
          Creates a new _LyFormattedField object with default attributes.
LyJFormattedInput._LyFormattedField(java.lang.String value, java.lang.String format, LyEventTransmitter parent, boolean useArrows)
          Creates a new _LyFormattedField object with the specified attributes.
 
Method Summary
 void checkSelection()
          Ensures that the selection is valid.
 void focusGained(java.awt.event.FocusEvent e)
           
 void focusLost(java.awt.event.FocusEvent e)
           
 int getCaretPosition()
           
 int getColumnWidth()
          Returns the average width of a character for the current font.
 java.lang.String getFormat()
          Gets the current format.
 java.lang.String getItemString()
          Gets the current structure item string.
 int getItemVal()
          Gets the current structure item value.
 int getMaxLength()
          Gets the maximum length of this structure.
 void init()
          Initializes this field component and registers its event listeners (keyboard, mouse and focus).
 void keyPressed(java.awt.event.KeyEvent evt)
           
 void keyReleased(java.awt.event.KeyEvent evt)
          Checks the selection upon key release.
 void keyTyped(java.awt.event.KeyEvent evt)
          Nothing is done when a key is typed.
 void mouseClicked(java.awt.event.MouseEvent e)
           
 void mouseEntered(java.awt.event.MouseEvent e)
          Nothing is done when a mouse enters a component.
 void mouseExited(java.awt.event.MouseEvent e)
          Nothing is done when a mouse exits a component.
 void mousePressed(java.awt.event.MouseEvent e)
           
 void mouseReleased(java.awt.event.MouseEvent e)
           
 void setCaretPosition(int position)
           
 void setEnabled(boolean enabled)
           
 void setFormat(java.lang.String format)
          Sets the current format to the specified one, then recreates this structure item.
 void setItemVal(int val)
          Sets the current structure item value.
 void setItemValue(java.lang.String value)
          Sets the current structure item string.
 boolean setValue(java.lang.String currentValue)
          Creates the content string according to format and current content.
 void textValueChanged(java.awt.event.TextEvent e)
           
 java.lang.String toDisplayString()
          Builds the representation string of this structure item.
 java.lang.String toFormatString()
          Builds the string of this structure item.
 
Methods inherited from class leon.view.win.swing.component.LyJTextField
createPopupMenu, delete, 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, getDisabledTextColor, getDocument, getDragEnabled, getDropLocation, getDropMode, getFocusAccelerator, getHighlighter, getInputMethodRequests, getKeymap, getKeymap, getMargin, getNavigationFilter, getPreferredScrollableViewportSize, getPrintable, getScrollableBlockIncrement, getScrollableTracksViewportHeight, getScrollableTracksViewportWidth, getScrollableUnitIncrement, getSelectedText, getSelectedTextColor, getSelectionColor, getSelectionEnd, getSelectionStart, getText, getText, getToolTipText, getUI, isEditable, loadKeymap, modelToView, moveCaretPosition, print, print, print, read, removeCaretListener, removeKeymap, removeNotify, replaceSelection, select, selectAll, setCaret, setCaretColor, 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, 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
 

Constructor Detail

LyJFormattedInput._LyFormattedField

public LyJFormattedInput._LyFormattedField()
Creates a new _LyFormattedField object with default attributes.


LyJFormattedInput._LyFormattedField

public LyJFormattedInput._LyFormattedField(java.lang.String value,
                                           java.lang.String format,
                                           LyEventTransmitter parent,
                                           boolean useArrows)
Creates a new _LyFormattedField object with the specified attributes.

Parameters:
value - the current value. At first, this is the same as the last value.
format - the format to use
parent - the parent transmitter
Method Detail

init

public void init()
Initializes this field component and registers its event listeners (keyboard, mouse and focus).


getColumnWidth

public int getColumnWidth()
Returns the average width of a character for the current font.

Overrides:
getColumnWidth in class LyJTextField
See Also:
JTextField.getColumnWidth()

setValue

public boolean setValue(java.lang.String currentValue)
Creates the content string according to format and current content. If the structure is null, initializes it at the current value.

Parameters:
currentValue - the current value of this field
Returns:
true if this field text has been successfuly set, false otherwise
See Also:
getValue()

keyTyped

public void keyTyped(java.awt.event.KeyEvent evt)
Nothing is done when a key is typed.

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

setEnabled

public void setEnabled(boolean enabled)
Overrides:
setEnabled in class javax.swing.JComponent

keyPressed

public void keyPressed(java.awt.event.KeyEvent evt)
Specified by:
keyPressed in interface java.awt.event.KeyListener

keyReleased

public void keyReleased(java.awt.event.KeyEvent evt)
Checks the selection upon key release.

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

mouseClicked

public void mouseClicked(java.awt.event.MouseEvent e)
Specified by:
mouseClicked in interface java.awt.event.MouseListener

mousePressed

public void mousePressed(java.awt.event.MouseEvent e)
Specified by:
mousePressed in interface java.awt.event.MouseListener

mouseReleased

public void mouseReleased(java.awt.event.MouseEvent e)
Specified by:
mouseReleased in interface java.awt.event.MouseListener

mouseEntered

public void mouseEntered(java.awt.event.MouseEvent e)
Nothing is done when a mouse enters a component.

Specified by:
mouseEntered in interface java.awt.event.MouseListener
See Also:
MouseListener.mouseEntered(java.awt.event.MouseEvent)

mouseExited

public void mouseExited(java.awt.event.MouseEvent e)
Nothing is done when a mouse exits a component.

Specified by:
mouseExited in interface java.awt.event.MouseListener
See Also:
MouseListener.mouseExited(java.awt.event.MouseEvent)

checkSelection

public void checkSelection()
Ensures that the selection is valid.


textValueChanged

public void textValueChanged(java.awt.event.TextEvent e)
Specified by:
textValueChanged in interface java.awt.event.TextListener

focusGained

public void focusGained(java.awt.event.FocusEvent e)
Specified by:
focusGained in interface java.awt.event.FocusListener

setCaretPosition

public void setCaretPosition(int position)
Overrides:
setCaretPosition in class javax.swing.text.JTextComponent

focusLost

public void focusLost(java.awt.event.FocusEvent e)
Specified by:
focusLost in interface java.awt.event.FocusListener

getCaretPosition

public int getCaretPosition()
Overrides:
getCaretPosition in class javax.swing.text.JTextComponent

getFormat

public java.lang.String getFormat()
Gets the current format.

Returns:
the format
See Also:
setFormat(String)

setFormat

public void setFormat(java.lang.String format)
Sets the current format to the specified one, then recreates this structure item.

Parameters:
format - the new format of this structure
See Also:
getFormat()

getItemVal

public int getItemVal()
Gets the current structure item value.

Returns:
the value of the structure item at the current caret position, or -1 if there is none
See Also:
setItemVal(int)

getItemString

public java.lang.String getItemString()
Gets the current structure item string.

Returns:
the displayed string of the structure item at the current caret position, or null if there is none
See Also:
setItemValue(String)

setItemVal

public void setItemVal(int val)
Sets the current structure item value.

Parameters:
val - the new value
See Also:
getItemVal()

toFormatString

public java.lang.String toFormatString()
Builds the string of this structure item.

Returns:
the string formating this structure item
See Also:
_LyParsedStructure#toFormatString()

getMaxLength

public int getMaxLength()
Gets the maximum length of this structure.

Returns:
the maximum length of this structure, or 10 if the structure is null

toDisplayString

public java.lang.String toDisplayString()
Builds the representation string of this structure item.

Returns:
the string representing this structure item
See Also:
_LyParsedStructure#toDisplayString()

setItemValue

public void setItemValue(java.lang.String value)
Sets the current structure item string.

Parameters:
value - the new value
See Also:
getItemString()

(c) January 2013 - W4 S.A.

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