Class TerraTextInputSkin
- java.lang.Object
-
- org.apache.pivot.wtk.skin.ComponentSkin
-
- org.apache.pivot.wtk.skin.terra.TerraTextInputSkin
-
- All Implemented Interfaces:
ComponentKeyListener
,ComponentListener
,ComponentMouseButtonListener
,ComponentMouseListener
,ComponentMouseWheelListener
,ComponentStateListener
,ComponentTooltipListener
,ConstrainedVisual
,Skin
,TextInput.Skin
,TextInputContentListener
,TextInputListener
,TextInputSelectionListener
,Visual
public class TerraTextInputSkin extends ComponentSkin implements TextInput.Skin, TextInputListener, TextInputContentListener, TextInputSelectionListener
Text input skin.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface org.apache.pivot.wtk.ComponentKeyListener
ComponentKeyListener.Adapter, ComponentKeyListener.Listeners
-
Nested classes/interfaces inherited from interface org.apache.pivot.wtk.ComponentListener
ComponentListener.Adapter, ComponentListener.Listeners
-
Nested classes/interfaces inherited from interface org.apache.pivot.wtk.ComponentMouseButtonListener
ComponentMouseButtonListener.Adapter, ComponentMouseButtonListener.Listeners
-
Nested classes/interfaces inherited from interface org.apache.pivot.wtk.ComponentMouseListener
ComponentMouseListener.Adapter, ComponentMouseListener.Listeners
-
Nested classes/interfaces inherited from interface org.apache.pivot.wtk.ComponentMouseWheelListener
ComponentMouseWheelListener.Listeners
-
Nested classes/interfaces inherited from interface org.apache.pivot.wtk.ComponentStateListener
ComponentStateListener.Adapter, ComponentStateListener.Listeners
-
Nested classes/interfaces inherited from interface org.apache.pivot.wtk.ComponentTooltipListener
ComponentTooltipListener.Listeners
-
Nested classes/interfaces inherited from interface org.apache.pivot.wtk.TextInputContentListener
TextInputContentListener.Adapter, TextInputContentListener.Listeners
-
Nested classes/interfaces inherited from interface org.apache.pivot.wtk.TextInputListener
TextInputListener.Adapter, TextInputListener.Listeners
-
Nested classes/interfaces inherited from interface org.apache.pivot.wtk.TextInputSelectionListener
TextInputSelectionListener.Listeners
-
-
Constructor Summary
Constructors Constructor Description TerraTextInputSkin()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
editableChanged(TextInput textInput)
Called when the editable state has changed.void
enabledChanged(Component component)
Called when a component's enabled state has changed.void
focusedChanged(Component component, Component obverseComponent)
Called when a component's focused state has changed.java.awt.Color
getBackgroundColor()
int
getBaseline(int width, int height)
Should be implemented in every subclass.java.awt.Color
getBorderColor()
Bounds
getCharacterBounds(int index)
Determine the bounding box of the character at the given index in the text in coordinates relative to the entire component (that is, adding in the insets and padding, etc.).java.awt.Color
getColor()
java.awt.Color
getDisabledBackgroundColor()
java.awt.Color
getDisabledBorderColor()
java.awt.Color
getDisabledColor()
java.awt.Font
getFont()
HorizontalAlignment
getHorizontalAlignment()
java.awt.Color
getInactiveSelectionBackgroundColor()
java.awt.Color
getInactiveSelectionColor()
int
getInsertionPoint(int x)
Calculate the text insertion point given the mouse X-position relative to the component's X-position.java.awt.Color
getInvalidBackgroundColor()
java.awt.Color
getInvalidColor()
Insets
getPadding()
int
getPreferredHeight(int width)
Returns the visual's preferred height given the provided width constraint.Dimensions
getPreferredSize()
Returns the visual's unconstrained preferred size.int
getPreferredWidth(int height)
Returns the visual's preferred width given the provided height constraint.java.awt.Color
getPromptColor()
java.awt.Color
getSelectionBackgroundColor()
java.awt.Color
getSelectionColor()
TextInputMethodListener
getTextInputMethodListener()
Returns the input method listener for this component.void
insertTextVetoed(TextInput textInput, Vote reason)
Called when a text insertion has been vetoed.void
install(Component component)
Must be implemented in every subclass in order to do component-specific operations at instantiation time, but every subclass must call this superclass method to setup the necessary listeners, etc.boolean
keyPressed(Component component, int keyCode, Keyboard.KeyLocation keyLocation)
boolean
keyTyped(Component component, char character)
Called when a key has been typed.void
layout()
If the component on which the skin is installed is a container, lays out the container's children.void
maximumLengthChanged(TextInput textInput, int previousMaximumLength)
Called when a text input's maximum length has changed.boolean
mouseClick(Component component, Mouse.Button button, int x, int y, int count)
Called when a mouse button is clicked over a component.boolean
mouseDown(Component component, Mouse.Button button, int x, int y)
Called when a mouse button is pressed over a component.boolean
mouseMove(Component component, int x, int y)
Called when the mouse is moved over a component.boolean
mouseUp(Component component, Mouse.Button button, int x, int y)
Called when a mouse button is released over a component.void
paint(java.awt.Graphics2D graphics)
Paints the visual.void
passwordChanged(TextInput textInput)
Called when a text input's password flag has changed.Vote
previewInsertText(TextInput textInput, java.lang.CharSequence text, int index)
Called to preview a text insertion.Vote
previewRemoveText(TextInput textInput, int index, int count)
Called to preview a text removal.void
promptChanged(TextInput textInput, java.lang.String previousPrompt)
Called when a text input's prompt has changed.void
removeTextVetoed(TextInput textInput, Vote reason)
Called when a text removal has been vetoed.void
selectionChanged(TextInput textInput, int previousSelectionStart, int previousSelectionLength)
Called when a text input's selection state has changed.void
setBackgroundColor(int colorIndex)
void
setBackgroundColor(java.awt.Color colorValue)
void
setBackgroundColor(java.lang.String colorString)
void
setBorderColor(int colorIndex)
void
setBorderColor(java.awt.Color colorValue)
void
setBorderColor(java.lang.String colorString)
void
setColor(int colorIndex)
void
setColor(java.awt.Color colorValue)
void
setColor(java.lang.String colorString)
void
setDisabledBackgroundColor(int colorIndex)
void
setDisabledBackgroundColor(java.awt.Color colorValue)
void
setDisabledBackgroundColor(java.lang.String colorString)
void
setDisabledBorderColor(int colorIndex)
void
setDisabledBorderColor(java.awt.Color colorValue)
void
setDisabledBorderColor(java.lang.String colorString)
void
setDisabledColor(int colorIndex)
void
setDisabledColor(java.awt.Color colorValue)
void
setDisabledColor(java.lang.String colorString)
void
setFont(java.awt.Font newFont)
Set the new font to use to render the text in this component.void
setFont(java.lang.String fontString)
void
setFont(Dictionary<java.lang.String,?> fontDict)
void
setHorizontalAlignment(HorizontalAlignment alignment)
void
setInactiveSelectionBackgroundColor(int colorIndex)
void
setInactiveSelectionBackgroundColor(java.awt.Color colorValue)
void
setInactiveSelectionBackgroundColor(java.lang.String colorString)
void
setInactiveSelectionColor(int colorIndex)
void
setInactiveSelectionColor(java.awt.Color colorValue)
void
setInactiveSelectionColor(java.lang.String colorString)
void
setInvalidBackgroundColor(int colorIndex)
void
setInvalidBackgroundColor(java.awt.Color colorValue)
void
setInvalidBackgroundColor(java.lang.String colorString)
void
setInvalidColor(int colorIndex)
void
setInvalidColor(java.awt.Color colorValue)
void
setInvalidColor(java.lang.String colorString)
void
setPadding(int paddingValue)
void
setPadding(java.lang.Number paddingValue)
void
setPadding(java.lang.String paddingString)
void
setPadding(Dictionary<java.lang.String,?> paddingDictionary)
void
setPadding(Sequence<?> paddingSequence)
void
setPadding(Insets paddingValue)
void
setPromptColor(int colorIndex)
void
setPromptColor(java.awt.Color colorValue)
void
setPromptColor(java.lang.String colorString)
void
setSelectionBackgroundColor(int colorIndex)
void
setSelectionBackgroundColor(java.awt.Color colorValue)
void
setSelectionBackgroundColor(java.lang.String colorString)
void
setSelectionColor(int colorIndex)
void
setSelectionColor(java.awt.Color colorValue)
void
setSelectionColor(java.lang.String colorString)
void
setSize(int width, int height)
Set the final size of the component after layout has finished.void
showCaret(boolean show)
void
strictValidationChanged(TextInput textInput)
Called when a text input's strict validation flag has changed.void
textChanged(TextInput textInput)
Called when a text input's text has changed.void
textInserted(TextInput textInput, int index, int count)
Called when text has been inserted into a text input.void
textRemoved(TextInput textInput, int index, int count)
Called when text has been removed from a text input.void
textSizeChanged(TextInput textInput, int previousTextSize)
Called when a text input's text size has changed.void
textValidatorChanged(TextInput textInput, Validator previousValidator)
Called when the validator changes.void
textValidChanged(TextInput textInput)
Called when the text changes validity.-
Methods inherited from class org.apache.pivot.wtk.skin.ComponentSkin
colorFromObject, colorFromObject, colorFromObject, colorFromObject, currentTheme, cursorChanged, decodeFont, defaultBackgroundColor, defaultForegroundColor, dragSourceChanged, dropTargetChanged, fontFromObject, getBaseline, getColor, getComponent, getFocusRectangleStroke, getHeight, getSize, getThemeFont, getWidth, heightLimitsChanged, invalidateComponent, isFocusable, isOpaque, keyReleased, locationChanged, menuHandlerChanged, mouseOut, mouseOver, mouseWheel, nameChanged, parentChanged, preferredSizeChanged, repaintComponent, repaintComponent, repaintComponent, repaintComponent, repaintComponent, setDefaultStyles, sizeChanged, themeHasThickFocusRectangle, themeHasTransitionEnabled, themeIsDark, themeIsFlat, tooltipDelayChanged, tooltipTextChanged, tooltipTriggered, visibleChanged, widthLimitsChanged
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.apache.pivot.wtk.ConstrainedVisual
setSize
-
-
-
-
Method Detail
-
install
public void install(Component component)
Description copied from class:ComponentSkin
Must be implemented in every subclass in order to do component-specific operations at instantiation time, but every subclass must call this superclass method to setup the necessary listeners, etc.- Specified by:
install
in interfaceSkin
- Overrides:
install
in classComponentSkin
- Parameters:
component
- The component to which the skin is being attached.
-
getPreferredWidth
public int getPreferredWidth(int height)
Description copied from interface:ConstrainedVisual
Returns the visual's preferred width given the provided height constraint.- Specified by:
getPreferredWidth
in interfaceConstrainedVisual
- Parameters:
height
- The height by which to constrain the preferred width, or-1
for no constraint.- Returns:
- The preferred width given the height constraint.
-
getPreferredHeight
public int getPreferredHeight(int width)
Description copied from interface:ConstrainedVisual
Returns the visual's preferred height given the provided width constraint.- Specified by:
getPreferredHeight
in interfaceConstrainedVisual
- Parameters:
width
- The width by which to constrain the preferred height, or-1
for no constraint.- Returns:
- The preferred height given the width constraint.
-
getPreferredSize
public Dimensions getPreferredSize()
Description copied from interface:ConstrainedVisual
Returns the visual's unconstrained preferred size.- Specified by:
getPreferredSize
in interfaceConstrainedVisual
- Overrides:
getPreferredSize
in classComponentSkin
- Returns:
- The preferred size (width and height) of this component.
Depending on the component this can be a static value or derived (as for a container) from its subcomponents, etc.
The default implementation simply calls
ConstrainedVisual.getPreferredWidth(int)
andConstrainedVisual.getPreferredHeight(int)
.
-
getBaseline
public int getBaseline(int width, int height)
Description copied from class:ComponentSkin
Should be implemented in every subclass.The default implementation here simply returns -1 (no baseline).
- Specified by:
getBaseline
in interfaceConstrainedVisual
- Overrides:
getBaseline
in classComponentSkin
- Parameters:
width
- Constrained width to compute the baseline for.height
- Constrained height to compute the baseline for.- Returns:
- The baseline relative to the origin of this visual, or
-1
if this visual does not have a baseline.
-
layout
public void layout()
Description copied from interface:Skin
If the component on which the skin is installed is a container, lays out the container's children.
-
paint
public void paint(java.awt.Graphics2D graphics)
Description copied from interface:Visual
Paints the visual.
-
getInsertionPoint
public int getInsertionPoint(int x)
Calculate the text insertion point given the mouse X-position relative to the component's X-position.Note: if the given X-position is on the right-hand side of a glyph then the insertion point will be after that character, while an X-position within the left half of a glyph will position the insert before that character.
- Specified by:
getInsertionPoint
in interfaceTextInput.Skin
- Parameters:
x
- The relative X-position.- Returns:
- The offset into the text determined by the X-position.
-
getCharacterBounds
public Bounds getCharacterBounds(int index)
Determine the bounding box of the character at the given index in the text in coordinates relative to the entire component (that is, adding in the insets and padding, etc.).- Specified by:
getCharacterBounds
in interfaceTextInput.Skin
- Parameters:
index
- The 0-based index of the character to inquire about.- Returns:
- The bounding box within the component where that character
will be displayed, or
null
if there is no text.
-
getFont
public final java.awt.Font getFont()
-
setFont
public final void setFont(java.awt.Font newFont)
Set the new font to use to render the text in this component.Also calculate the
averageCharacterSize
value based on this font, which will be the width of the "missing glyph code" and the maximum height of any character in the font.- Parameters:
newFont
- The new font to use.- Throws:
java.lang.IllegalArgumentException
- if thenewFont
argument isnull
.
-
setFont
public final void setFont(java.lang.String fontString)
-
setFont
public final void setFont(Dictionary<java.lang.String,?> fontDict)
-
getColor
public final java.awt.Color getColor()
-
setColor
public final void setColor(java.awt.Color colorValue)
-
setColor
public final void setColor(java.lang.String colorString)
-
setColor
public final void setColor(int colorIndex)
-
getPromptColor
public final java.awt.Color getPromptColor()
-
setPromptColor
public final void setPromptColor(java.awt.Color colorValue)
-
setPromptColor
public final void setPromptColor(java.lang.String colorString)
-
setPromptColor
public final void setPromptColor(int colorIndex)
-
getDisabledColor
public final java.awt.Color getDisabledColor()
-
setDisabledColor
public final void setDisabledColor(java.awt.Color colorValue)
-
setDisabledColor
public final void setDisabledColor(java.lang.String colorString)
-
setDisabledColor
public final void setDisabledColor(int colorIndex)
-
getBackgroundColor
public final java.awt.Color getBackgroundColor()
-
setBackgroundColor
public final void setBackgroundColor(java.awt.Color colorValue)
-
setBackgroundColor
public final void setBackgroundColor(java.lang.String colorString)
-
setBackgroundColor
public final void setBackgroundColor(int colorIndex)
-
getInvalidColor
public final java.awt.Color getInvalidColor()
-
setInvalidColor
public final void setInvalidColor(java.awt.Color colorValue)
-
setInvalidColor
public final void setInvalidColor(java.lang.String colorString)
-
setInvalidColor
public final void setInvalidColor(int colorIndex)
-
getInvalidBackgroundColor
public final java.awt.Color getInvalidBackgroundColor()
-
setInvalidBackgroundColor
public final void setInvalidBackgroundColor(java.awt.Color colorValue)
-
setInvalidBackgroundColor
public final void setInvalidBackgroundColor(java.lang.String colorString)
-
setInvalidBackgroundColor
public final void setInvalidBackgroundColor(int colorIndex)
-
getDisabledBackgroundColor
public final java.awt.Color getDisabledBackgroundColor()
-
setDisabledBackgroundColor
public final void setDisabledBackgroundColor(java.awt.Color colorValue)
-
setDisabledBackgroundColor
public final void setDisabledBackgroundColor(java.lang.String colorString)
-
setDisabledBackgroundColor
public final void setDisabledBackgroundColor(int colorIndex)
-
getBorderColor
public final java.awt.Color getBorderColor()
-
setBorderColor
public final void setBorderColor(java.awt.Color colorValue)
-
setBorderColor
public final void setBorderColor(java.lang.String colorString)
-
setBorderColor
public final void setBorderColor(int colorIndex)
-
getDisabledBorderColor
public final java.awt.Color getDisabledBorderColor()
-
setDisabledBorderColor
public final void setDisabledBorderColor(java.awt.Color colorValue)
-
setDisabledBorderColor
public final void setDisabledBorderColor(java.lang.String colorString)
-
setDisabledBorderColor
public final void setDisabledBorderColor(int colorIndex)
-
getSelectionColor
public final java.awt.Color getSelectionColor()
-
setSelectionColor
public final void setSelectionColor(java.awt.Color colorValue)
-
setSelectionColor
public final void setSelectionColor(java.lang.String colorString)
-
setSelectionColor
public final void setSelectionColor(int colorIndex)
-
getSelectionBackgroundColor
public final java.awt.Color getSelectionBackgroundColor()
-
setSelectionBackgroundColor
public final void setSelectionBackgroundColor(java.awt.Color colorValue)
-
setSelectionBackgroundColor
public final void setSelectionBackgroundColor(java.lang.String colorString)
-
setSelectionBackgroundColor
public final void setSelectionBackgroundColor(int colorIndex)
-
getInactiveSelectionColor
public final java.awt.Color getInactiveSelectionColor()
-
setInactiveSelectionColor
public final void setInactiveSelectionColor(java.awt.Color colorValue)
-
setInactiveSelectionColor
public final void setInactiveSelectionColor(java.lang.String colorString)
-
setInactiveSelectionColor
public final void setInactiveSelectionColor(int colorIndex)
-
getInactiveSelectionBackgroundColor
public final java.awt.Color getInactiveSelectionBackgroundColor()
-
setInactiveSelectionBackgroundColor
public final void setInactiveSelectionBackgroundColor(java.awt.Color colorValue)
-
setInactiveSelectionBackgroundColor
public final void setInactiveSelectionBackgroundColor(java.lang.String colorString)
-
setInactiveSelectionBackgroundColor
public final void setInactiveSelectionBackgroundColor(int colorIndex)
-
getPadding
public final Insets getPadding()
-
setPadding
public final void setPadding(Insets paddingValue)
-
setPadding
public final void setPadding(Dictionary<java.lang.String,?> paddingDictionary)
-
setPadding
public final void setPadding(Sequence<?> paddingSequence)
-
setPadding
public final void setPadding(int paddingValue)
-
setPadding
public final void setPadding(java.lang.Number paddingValue)
-
setPadding
public final void setPadding(java.lang.String paddingString)
-
getHorizontalAlignment
public final HorizontalAlignment getHorizontalAlignment()
-
setHorizontalAlignment
public final void setHorizontalAlignment(HorizontalAlignment alignment)
-
mouseMove
public boolean mouseMove(Component component, int x, int y)
Description copied from interface:ComponentMouseListener
Called when the mouse is moved over a component.- Specified by:
mouseMove
in interfaceComponentMouseListener
- Overrides:
mouseMove
in classComponentSkin
- Parameters:
component
- Component that is under the mouse.x
- X position of the mouse.y
- Y position of the mouse.- Returns:
true
to consume the event;false
to allow it to propagate (default return).
-
mouseDown
public boolean mouseDown(Component component, Mouse.Button button, int x, int y)
Description copied from interface:ComponentMouseButtonListener
Called when a mouse button is pressed over a component.- Specified by:
mouseDown
in interfaceComponentMouseButtonListener
- Overrides:
mouseDown
in classComponentSkin
- Parameters:
component
- Component that is under the mouse pointer.button
- Which mouse button was pressed.x
- X position of the mouse.y
- Y position of the mouse.- Returns:
true
to consume the event;false
to allow it to propagate (default).
-
mouseUp
public boolean mouseUp(Component component, Mouse.Button button, int x, int y)
Description copied from interface:ComponentMouseButtonListener
Called when a mouse button is released over a component.- Specified by:
mouseUp
in interfaceComponentMouseButtonListener
- Overrides:
mouseUp
in classComponentSkin
- Parameters:
component
- Component user the mouse pointer.button
- Which mouse button that was released.x
- X position of the mouse.y
- Y position of the mouse.- Returns:
true
to consume the event;false
to allow it to propagate (default).
-
mouseClick
public boolean mouseClick(Component component, Mouse.Button button, int x, int y, int count)
Description copied from interface:ComponentMouseButtonListener
Called when a mouse button is clicked over a component.- Specified by:
mouseClick
in interfaceComponentMouseButtonListener
- Overrides:
mouseClick
in classComponentSkin
- Parameters:
component
- Component user the mouse pointer.button
- Which mouse button was clicked.x
- X position of the mouse.y
- Y position of the mouse.count
- Number of clicks (1 = single click, 2 = double click, etc.).- Returns:
true
to consume the event;false
to allow it to propagate (default).
-
keyTyped
public boolean keyTyped(Component component, char character)
Description copied from interface:ComponentKeyListener
Called when a key has been typed.- Specified by:
keyTyped
in interfaceComponentKeyListener
- Overrides:
keyTyped
in classComponentSkin
- Parameters:
component
- Component that has the focus, that is receiving this key.character
- The decoded character that was typed.- Returns:
true
to consume the event;false
to allow it to propagate.
-
keyPressed
public boolean keyPressed(Component component, int keyCode, Keyboard.KeyLocation keyLocation)
DELETE
Delete the character after the caret or the entire selection if there is one.
BACKSPACE
Delete the character before the caret or the entire selection if there is one.HOME
Move the caret to the beginning of the text.
LEFT
+META
Move the caret to the beginning of the text.HOME
+SHIFT
Select from the caret to the beginning of the text.
LEFT
+META
+SHIFT
Select from the caret to the beginning of the text.END
Move the caret to the end of the text.
RIGHT
+META
Move the caret to the end of the text.END
+SHIFT
Select from the caret to the end of the text.
RIGHT
+META
+SHIFT
Select from the caret to the end of the text.LEFT
Clear the selection and move the caret back by one character.
LEFT
+SHIFT
Add the previous character to the selection.
LEFT
+CTRL
Clear the selection and move the caret to the beginning of the text.
LEFT
+CTRL
+SHIFT
Add all preceding text to the selection.RIGHT
Clear the selection and move the caret forward by one character.
RIGHT
+SHIFT
Add the next character to the selection.
RIGHT
+CTRL
Clear the selection and move the caret to the end of the text.
RIGHT
+CTRL
+SHIFT
Add all subsequent text to the selection.CommandModifier +
A
Select all.
CommandModifier +X
Cut selection to clipboard (if not a password TextInput).
CommandModifier +C
Copy selection to clipboard (if not a password TextInput).
CommandModifier +V
Paste from clipboard.
CommandModifier +Z
Undo.- Specified by:
keyPressed
in interfaceComponentKeyListener
- Overrides:
keyPressed
in classComponentSkin
- Parameters:
component
- Component that has the focus.keyCode
- The key code for the key that was pressed.keyLocation
- Location value for the key (left or right for shift keys, etc.).- Returns:
true
to consume the event;false
to allow it to propagate.- See Also:
Platform.getCommandModifier()
-
enabledChanged
public void enabledChanged(Component component)
Description copied from interface:ComponentStateListener
Called when a component's enabled state has changed.Called both when the component is enabled and when it is disabled. The component's
enabled
flag has already been set when this method is called so the new state can be determined by calling theComponent.isEnabled()
method.- Specified by:
enabledChanged
in interfaceComponentStateListener
- Overrides:
enabledChanged
in classComponentSkin
- Parameters:
component
- The component whose enabled state is changing.
-
focusedChanged
public void focusedChanged(Component component, Component obverseComponent)
Description copied from interface:ComponentStateListener
Called when a component's focused state has changed.This will be called both when a component gains focus and when it loses focus. The currently focused component has already been set when this method is called, so that the new state of the component can be determined by calling the
Component.isFocused()
method.- Specified by:
focusedChanged
in interfaceComponentStateListener
- Overrides:
focusedChanged
in classComponentSkin
- Parameters:
component
- The component that is either gaining focus or the one that previously had focus and is now losing it.obverseComponent
- If the component is gaining focus, this is the component that is losing focus. If the component is losing focus this is the component that is gaining the focus instead.
-
textSizeChanged
public void textSizeChanged(TextInput textInput, int previousTextSize)
Description copied from interface:TextInputListener
Called when a text input's text size has changed.- Specified by:
textSizeChanged
in interfaceTextInputListener
- Parameters:
textInput
- The source of this event.previousTextSize
- The previous text size for the control
-
maximumLengthChanged
public void maximumLengthChanged(TextInput textInput, int previousMaximumLength)
Description copied from interface:TextInputListener
Called when a text input's maximum length has changed.- Specified by:
maximumLengthChanged
in interfaceTextInputListener
- Parameters:
textInput
- The source of this event.previousMaximumLength
- The previous maximum text length.
-
passwordChanged
public void passwordChanged(TextInput textInput)
Description copied from interface:TextInputListener
Called when a text input's password flag has changed.- Specified by:
passwordChanged
in interfaceTextInputListener
- Parameters:
textInput
- The source of this event.
-
promptChanged
public void promptChanged(TextInput textInput, java.lang.String previousPrompt)
Description copied from interface:TextInputListener
Called when a text input's prompt has changed.- Specified by:
promptChanged
in interfaceTextInputListener
- Parameters:
textInput
- The source of this event.previousPrompt
- The previous prompt string.
-
textValidatorChanged
public void textValidatorChanged(TextInput textInput, Validator previousValidator)
Description copied from interface:TextInputListener
Called when the validator changes.- Specified by:
textValidatorChanged
in interfaceTextInputListener
- Parameters:
textInput
- The source of this event.previousValidator
- The previous validator for the text.
-
strictValidationChanged
public void strictValidationChanged(TextInput textInput)
Description copied from interface:TextInputListener
Called when a text input's strict validation flag has changed.- Specified by:
strictValidationChanged
in interfaceTextInputListener
- Parameters:
textInput
- The text input that has changed.
-
textValidChanged
public void textValidChanged(TextInput textInput)
Description copied from interface:TextInputListener
Called when the text changes validity.- Specified by:
textValidChanged
in interfaceTextInputListener
- Parameters:
textInput
- The text input that has been changed.
-
previewInsertText
public Vote previewInsertText(TextInput textInput, java.lang.CharSequence text, int index)
Description copied from interface:TextInputContentListener
Called to preview a text insertion.- Specified by:
previewInsertText
in interfaceTextInputContentListener
- Parameters:
textInput
- The source of the event.text
- The text that will be inserted.index
- The index at which the text will be inserted.- Returns:
- The accumulated vote as to whether to allow this insertion.
-
insertTextVetoed
public void insertTextVetoed(TextInput textInput, Vote reason)
Description copied from interface:TextInputContentListener
Called when a text insertion has been vetoed.- Specified by:
insertTextVetoed
in interfaceTextInputContentListener
- Parameters:
textInput
- The source of the event.reason
- The reason the event was vetoed.
-
textInserted
public void textInserted(TextInput textInput, int index, int count)
Description copied from interface:TextInputContentListener
Called when text has been inserted into a text input.- Specified by:
textInserted
in interfaceTextInputContentListener
- Parameters:
textInput
- The source of the event.index
- The index at which the text was inserted.count
- The number of characters that were inserted.
-
previewRemoveText
public Vote previewRemoveText(TextInput textInput, int index, int count)
Description copied from interface:TextInputContentListener
Called to preview a text removal.- Specified by:
previewRemoveText
in interfaceTextInputContentListener
- Parameters:
textInput
- The source of the event.index
- The starting index from which the text will be removed.count
- The count of characters to be removed starting from that index.- Returns:
- The accumulated vote as to whether to allow this removal.
-
setSize
public void setSize(int width, int height)
Description copied from class:ComponentSkin
Set the final size of the component after layout has finished.All subclasses must call this superclass method in order to set the
ComponentSkin.width
andComponentSkin.height
values, but may need to do additional calculations before doing so.- Specified by:
setSize
in interfaceConstrainedVisual
- Overrides:
setSize
in classComponentSkin
- Parameters:
width
- The new (final) width of the component after layout.height
- The new (final) height of the component after layout.
-
removeTextVetoed
public void removeTextVetoed(TextInput textInput, Vote reason)
Description copied from interface:TextInputContentListener
Called when a text removal has been vetoed.- Specified by:
removeTextVetoed
in interfaceTextInputContentListener
- Parameters:
textInput
- The source of the event.reason
- The reason the event was vetoed.
-
textRemoved
public void textRemoved(TextInput textInput, int index, int count)
Description copied from interface:TextInputContentListener
Called when text has been removed from a text input.- Specified by:
textRemoved
in interfaceTextInputContentListener
- Parameters:
textInput
- The source of the event.index
- The index from which the text was removed.count
- The number of characters that were removed.
-
textChanged
public void textChanged(TextInput textInput)
Description copied from interface:TextInputContentListener
Called when a text input's text has changed.- Specified by:
textChanged
in interfaceTextInputContentListener
- Parameters:
textInput
- The source of the event.
-
editableChanged
public void editableChanged(TextInput textInput)
Description copied from interface:TextInputListener
Called when the editable state has changed.- Specified by:
editableChanged
in interfaceTextInputListener
- Parameters:
textInput
- The text input whose state has changed.
-
selectionChanged
public void selectionChanged(TextInput textInput, int previousSelectionStart, int previousSelectionLength)
Description copied from interface:TextInputSelectionListener
Called when a text input's selection state has changed.- Specified by:
selectionChanged
in interfaceTextInputSelectionListener
- Parameters:
textInput
- The source of the event.previousSelectionStart
- If the selection changed directly, the previous selection start index. Otherwise, the current selection start index.previousSelectionLength
- If the selection changed directly, the previous selection length. Otherwise, the current selection length.
-
showCaret
public void showCaret(boolean show)
-
getTextInputMethodListener
public TextInputMethodListener getTextInputMethodListener()
Description copied from class:ComponentSkin
Returns the input method listener for this component.Should be overridden by any component's skin that wants to handle Input Method events (such as
TextInput
).- Overrides:
getTextInputMethodListener
in classComponentSkin
- Returns:
- The input method listener (if any) for this component.
-
-