public class AutoCompleteTextComponent extends TextComponent
TextComponent
version of AutoCompleteTextField
This component was contributed here https://github.com/codenameone/CodenameOne/issues/2705Modifier and Type | Class and Description |
---|---|
static interface |
AutoCompleteTextComponent.AutoCompleteFilter
Allows filtering the entries in the auto complete
|
BASELINE, BOTTOM, BRB_CENTER_OFFSET, BRB_CONSTANT_ASCENT, BRB_CONSTANT_DESCENT, BRB_OTHER, CENTER, CROSSHAIR_CURSOR, DEFAULT_CURSOR, DRAG_REGION_IMMEDIATELY_DRAG_X, DRAG_REGION_IMMEDIATELY_DRAG_XY, DRAG_REGION_IMMEDIATELY_DRAG_Y, DRAG_REGION_LIKELY_DRAG_X, DRAG_REGION_LIKELY_DRAG_XY, DRAG_REGION_LIKELY_DRAG_Y, DRAG_REGION_NOT_DRAGGABLE, DRAG_REGION_POSSIBLE_DRAG_X, DRAG_REGION_POSSIBLE_DRAG_XY, DRAG_REGION_POSSIBLE_DRAG_Y, E_RESIZE_CURSOR, HAND_CURSOR, LEFT, MOVE_CURSOR, N_RESIZE_CURSOR, NE_RESIZE_CURSOR, NW_RESIZE_CURSOR, RIGHT, S_RESIZE_CURSOR, SE_RESIZE_CURSOR, SW_RESIZE_CURSOR, TEXT_CURSOR, TOP, W_RESIZE_CURSOR, WAIT_CURSOR
Constructor and Description |
---|
AutoCompleteTextComponent(ListModel<String> listModel,
AutoCompleteTextComponent.AutoCompleteFilter customFilter)
This constructor allows us to create an AutoCompleteTextComponent with the
given listModel and customFilter
|
Modifier and Type | Method and Description |
---|---|
AutoCompleteTextComponent |
columns(int columns)
Sets the columns in the text field
|
AutoCompleteTextComponent |
constraint(int constraint)
Sets the constraint for text input matching the constraints from the text
area class
|
AutoCompleteTextComponent |
descriptionMessage(String descriptionMessage)
Overridden for covariant return type
Overridden for covariant return type
Sets the text of the description label which currently only applies in the onTop mode.
|
AutoCompleteTextComponent |
errorMessage(String errorMessage)
Overridden for covariant return type Overridden for covariant return type
Sets the text of the error label
|
AutoCompleteTextComponent |
focusAnimation(boolean focusAnimation)
The focus animation mode forces the hint and text to be identical and
animates the hint to the label when focus is in the text field as is
common on Android.
|
AutoCompleteTextField |
getAutoCompleteField()
Allows us to invoke setters/getters and bind listeners to the text field
|
Component |
getEditor()
Returns the editor component e.g.
|
TextField |
getField()
Allows us to invoke setters/getters and bind listeners to the text field
|
String[] |
getPropertyNames()
A component may expose mutable property names for a UI designer to manipulate, this
API is designed for usage internally by the GUI builder code
|
String[] |
getPropertyTypeNames()
This method is here to workaround an XMLVM array type bug where property types aren't
identified properly, it returns the names of the types using the following type names:
String,int,double,long,byte,short,char,String[],String[][],byte[],Image,Image[],Object[],ListModel,ListCellRenderer
|
Class[] |
getPropertyTypes()
Matches the property names method (see that method for further details).
|
Object |
getPropertyValue(String name)
Returns the current value of the property name, this method is used by the GUI builder
|
String |
getText()
Returns the text in the field
TextArea.getText() |
AutoCompleteTextComponent |
hint(Image hint)
Sets the hint of the field
|
AutoCompleteTextComponent |
hint(String hint)
Sets the hint of the field
|
boolean |
isFocusAnimation()
The focus animation mode forces the hint and text to be identical and
animates the hint to the label when focus is in the text field as is
common on Android.
|
AutoCompleteTextComponent |
label(String text)
Overridden for covariant return type * Overridden for covariant return type
Sets the text of the label
}
|
AutoCompleteTextComponent |
labelAndHint(String text)
Convenience method for setting the label and hint together
|
AutoCompleteTextComponent |
multiline(boolean multiline)
Sets the text field to multiline or single line
|
AutoCompleteTextComponent |
onTopMode(boolean onTopMode)
Overridden for covariant return type Overridden for covariant return type
Sets the on top mode which places the label above the text when true.
|
AutoCompleteTextComponent |
rows(int rows)
Sets the rows in the text field
|
String |
setPropertyValue(String name,
Object value)
Sets a new value to the given property, returns an error message if failed
and null if successful.
|
AutoCompleteTextComponent |
text(String text)
Sets the text of the field
|
action, actionAsButton, actionClick, actionText, actionUIID
calcPreferredSize, createErrorLabel, getAction, getActionText, getActionUIID, group, initInput, isActionAsButton, isMultiLineErrorMessage, isOnTopMode, setMultiLineErrorMessage
add, add, add, add, add, add, addAll, addComponent, addComponent, addComponent, addComponent, animateHierarchy, animateHierarchyAndWait, animateHierarchyFade, animateHierarchyFadeAndWait, animateLayout, animateLayoutAndWait, animateLayoutFade, animateLayoutFadeAndWait, animateUnlayout, animateUnlayoutAndWait, applyRTL, cancelRepaints, clearClientProperties, constrainHeightWhenScrollable, constrainWidthWhenScrollable, contains, createAnimateHierarchy, createAnimateHierarchyFade, createAnimateLayout, createAnimateLayoutFade, createAnimateLayoutFadeAndWait, createAnimateMotion, createAnimateUnlayout, createReplaceTransition, dragInitiated, drop, encloseIn, encloseIn, findDropTargetAt, findFirstFocusable, fireClicked, flushReplace, forceRevalidate, getBottomGap, getChildrenAsList, getClosestComponentTo, getComponentAt, getComponentAt, getComponentCount, getComponentIndex, getGridPosX, getGridPosY, getLayout, getLayoutHeight, getLayoutWidth, getLeadComponent, getLeadParent, getResponderAt, getSafeAreaRoot, getScrollIncrement, getSideGap, getUIManager, initLaf, invalidate, isEnabled, isSafeArea, isSafeAreaRoot, isScrollableX, isScrollableY, isSelectableInteraction, isSurface, iterator, iterator, keyPressed, keyReleased, layoutContainer, morph, morphAndWait, paint, paintBackground, paintBorderBackground, paintComponentBackground, paintGlass, paramString, pointerPressed, refreshTheme, removeAll, removeComponent, replace, replace, replaceAndWait, replaceAndWait, replaceAndWait, revalidate, revalidateLater, revalidateWithAnimationSafety, scrollComponentToVisible, setCellRenderer, setEnabled, setLayout, setLeadComponent, setSafeArea, setSafeAreaRoot, setScrollable, setScrollableX, setScrollableY, setScrollIncrement, setShouldCalcPreferredSize, setShouldLayout, setUIManager, updateTabIndices
addDragFinishedListener, addDragOverListener, addDropListener, addFocusListener, addLongPressListener, addPointerDraggedListener, addPointerPressedListener, addPointerReleasedListener, addPullToRefresh, addScrollListener, addStateChangeListener, animate, bindProperty, blocksSideSwipe, calcScrollSize, contains, containsOrOwns, createStyleAnimation, deinitialize, deinitializeCustomStyle, dragEnter, dragExit, dragFinished, draggingOver, drawDraggedImage, focusGained, focusLost, getAbsoluteX, getAbsoluteY, getAllStyles, getAnimationManager, getBaseline, getBaselineResizeBehavior, getBindablePropertyNames, getBindablePropertyTypes, getBorder, getBoundPropertyValue, getBounds, getBounds, getClientProperty, getCloudBoundProperty, getCloudDestinationProperty, getComponentForm, getComponentState, getCursor, getDefaultDragTransparency, getDirtyRegion, getDisabledStyle, getDraggedx, getDraggedy, getDragImage, getDragRegionStatus, getDragSpeed, getDragTransparency, getEditingDelegate, getHeight, getInlineAllStyles, getInlineDisabledStyles, getInlinePressedStyles, getInlineSelectedStyles, getInlineStylesTheme, getInlineUnselectedStyles, getInnerHeight, getInnerPreferredH, getInnerPreferredW, getInnerWidth, getInnerX, getInnerY, getLabelForComponent, getName, getNativeOverlay, getNextFocusDown, getNextFocusLeft, getNextFocusRight, getNextFocusUp, getOuterHeight, getOuterPreferredH, getOuterPreferredW, getOuterWidth, getOuterX, getOuterY, getOwner, getParent, getPreferredH, getPreferredSize, getPreferredSizeStr, getPreferredTabIndex, getPreferredW, getPressedStyle, getSameHeight, getSameWidth, getScrollable, getScrollAnimationSpeed, getScrollDimension, getScrollOpacity, getScrollOpacityChangeSpeed, getScrollX, getScrollY, getSelectCommandText, getSelectedRect, getSelectedStyle, getStyle, getTabIndex, getTensileLength, getTextSelectionSupport, getTooltip, getUIID, getUnselectedStyle, getVisibleBounds, getVisibleBounds, getWidth, getX, getY, growShrink, handlesInput, hasFixedPreferredSize, hasFocus, hideNativeOverlay, initComponent, initCustomStyle, initDisabledStyle, initPressedStyle, initSelectedStyle, initUnselectedStyle, installDefaultPainter, isAlwaysTensile, isBlockLead, isCellRenderer, isChildOf, isDragActivated, isDragAndDropOperation, isDraggable, isDragRegion, isDropTarget, isEditable, isEditing, isFlatten, isFocusable, isGrabsPointerEvents, isHidden, isHidden, isHideInLandscape, isHideInPortrait, isIgnorePointerEvents, isInClippingRegion, isInitialized, isOpaque, isOwnedBy, isPinchBlocksDragAndDrop, isRippleEffect, isRTL, isScrollable, isScrollVisible, isSetCursorSupported, isSmoothScrolling, isSnapToGrid, isStickyDrag, isTactileTouch, isTactileTouch, isTensileDragEnabled, isTraversable, isVisible, keyRepeated, laidOut, longKeyPress, longPointerPress, onScrollX, onScrollY, paintBackgrounds, paintBorder, paintComponent, paintComponent, paintIntersectingComponentsAbove, paintLock, paintLockRelease, paintRippleOverlay, paintScrollbars, paintScrollbarX, paintScrollbarY, paintShadows, parsePreferredSize, pinch, pinch, pinchReleased, pointerDragged, pointerDragged, pointerHover, pointerHoverPressed, pointerHoverReleased, pointerPressed, pointerReleased, pointerReleased, putClientProperty, refreshTheme, refreshTheme, remove, removeDragFinishedListener, removeDragOverListener, removeDropListener, removeFocusListener, removeLongPressListener, removePointerDraggedListener, removePointerPressedListener, removePointerReleasedListener, removeScrollListener, removeStateChangeListener, repaint, repaint, requestFocus, resetFocusable, respondsToPointerEvents, scrollRectToVisible, scrollRectToVisible, setAlwaysTensile, setBlockLead, setBoundPropertyValue, setCloudBoundProperty, setCloudDestinationProperty, setComponentState, setCursor, setDefaultDragTransparency, setDirtyRegion, setDisabledStyle, setDraggable, setDragTransparency, setDropTarget, setEditingDelegate, setFlatten, setFocus, setFocusable, setGrabsPointerEvents, setHandlesInput, setHeight, setHidden, setHidden, setHideInLandscape, setHideInPortrait, setIgnorePointerEvents, setInitialized, setInlineAllStyles, setInlineDisabledStyles, setInlinePressedStyles, setInlineSelectedStyles, setInlineStylesTheme, setInlineUnselectedStyles, setIsScrollVisible, setLabelForComponent, setName, setNextFocusDown, setNextFocusLeft, setNextFocusRight, setNextFocusUp, setOpaque, setOwner, setPinchBlocksDragAndDrop, setPreferredH, setPreferredSize, setPreferredSizeStr, setPreferredTabIndex, setPreferredW, setPressedStyle, setRippleEffect, setRTL, setSameHeight, setSameSize, setSameWidth, setScrollAnimationSpeed, setScrollOpacityChangeSpeed, setScrollSize, setScrollVisible, setScrollX, setScrollY, setSelectCommandText, setSelectedStyle, setSize, setSmoothScrolling, setSnapToGrid, setTabIndex, setTactileTouch, setTensileDragEnabled, setTensileLength, setTooltip, setTraversable, setUIID, setUIID, setUnselectedStyle, setVisible, setWidth, setX, setY, shouldBlockSideSwipe, shouldBlockSideSwipeLeft, shouldBlockSideSwipeRight, shouldRenderComponentSelection, showNativeOverlay, startEditingAsync, stopEditing, stripMarginAndPadding, styleChanged, toImage, toString, unbindProperty, updateNativeOverlay, visibleBoundsContains
public AutoCompleteTextComponent(ListModel<String> listModel, AutoCompleteTextComponent.AutoCompleteFilter customFilter)
listModel
- customFilter
- public TextField getField()
getField
in class TextComponent
public Component getEditor()
getEditor
in class TextComponent
public boolean isFocusAnimation()
textComponentAnimBool
which is true by default on Android. Notice
that this is designed for the onTopMode
and might not work if
that is set to false...isFocusAnimation
in class TextComponent
public AutoCompleteTextComponent focusAnimation(boolean focusAnimation)
textComponentAnimBool
which is true by default on Android. Notice
that this is designed for the onTopMode
and might not work if
that is set to false...focusAnimation
in class TextComponent
focusAnimation
- true for the label to animate into place on focus,
false otherwiseAutoCompleteTextComponent tc = new AutoCompleteTextComponent().text("Text").label("Label");
public AutoCompleteTextComponent text(String text)
text
in class TextComponent
text
- the textAutoCompleteTextComponent tc = new AutoCompleteTextComponent().text("Text").label("Label");
public AutoCompleteTextComponent onTopMode(boolean onTopMode)
textComponentOnTopBool
theme constant which defaults to falseonTopMode
in class TextComponent
onTopMode
- true for the label to be above the textTextComponent tc = new TextComponent().text("Text").label("Label");
public AutoCompleteTextComponent descriptionMessage(String descriptionMessage)
descriptionMessage
in class TextComponent
descriptionMessage
- the textTextComponent tc = new TextComponent().text("Text").label("Label");
public AutoCompleteTextComponent errorMessage(String errorMessage)
errorMessage
in class TextComponent
errorMessage
- the textTextComponent tc = new TextComponent().text("Text").label("Label");
public AutoCompleteTextComponent label(String text)
label
in class TextComponent
text
- the textTextComponent tc = new TextComponent().text("Text").label("Label");
public AutoCompleteTextComponent labelAndHint(String text)
labelAndHint
in class TextComponent
text
- the text and hintAutoCompleteTextComponent tc = new AutoCompleteTextComponent().text("Text").label("Label");
public AutoCompleteTextComponent hint(String hint)
hint
in class TextComponent
hint
- the text of the hintAutoCompleteTextComponent tc = new AutoCompleteTextComponent().text("Text").label("Label");
public AutoCompleteTextComponent hint(Image hint)
hint
in class TextComponent
hint
- the icon for the hintAutoCompleteTextComponent tc = new AutoCompleteTextComponent().text("Text").label("Label");
public AutoCompleteTextComponent multiline(boolean multiline)
multiline
in class TextComponent
multiline
- true for multiline, false otherwiseAutoCompleteTextComponent tc = new AutoCompleteTextComponent().text("Text").label("Label");
public AutoCompleteTextComponent columns(int columns)
columns
in class TextComponent
columns
- the number of columns which is used for preferred size
calculationsAutoCompleteTextComponent tc = new AutoCompleteTextComponent().text("Text").label("Label");
public AutoCompleteTextComponent rows(int rows)
rows
in class TextComponent
rows
- the number of rows which is used for preferred size
calculationsAutoCompleteTextComponent tc = new AutoCompleteTextComponent().text("Text").label("Label");
public AutoCompleteTextComponent constraint(int constraint)
constraint
in class TextComponent
constraint
- one of the constants from the
TextArea
class see
TextArea.setConstraint(int)
AutoCompleteTextComponent tc = new AutoCompleteTextComponent().text("Text").label("Label");
public AutoCompleteTextField getAutoCompleteField()
public String[] getPropertyNames()
getPropertyNames
in class TextComponent
public Class[] getPropertyTypes()
getPropertyTypes
in class TextComponent
public String[] getPropertyTypeNames()
getPropertyTypeNames
in class TextComponent
public Object getPropertyValue(String name)
getPropertyValue
in class TextComponent
name
- the name of the propertypublic String setPropertyValue(String name, Object value)
setPropertyValue
in class TextComponent
name
- the name of the propertyvalue
- new value for the propertypublic String getText()
TextArea.getText()
getText
in class TextComponent