com.leafdigital.ui.api
Interface EditBox

All Superinterfaces:
SupportsBaseGroup, Widget

public interface EditBox
extends Widget, SupportsBaseGroup

Interface for single-line edit boxes.

See Also:
EditArea

Nested Class Summary
static interface EditBox.TabCompletion
          Handler interface to be implemented by anything that provides completion.
 
Field Summary
static int FLAG_DIM
          Display dim text, indicating editfield value is presently unimportant
static int FLAG_ERROR
          Display text in error colour, indicating that value must be corrected
static int FLAG_NORMAL
          Display normal text
static int LINEBYTES_NOLIMIT
          If no limit on line characters
 
Method Summary
 void focus()
          Focuses this edit
 int getFlag()
           
 java.lang.String getValue()
           
 java.lang.String[] getValueLines()
           
 boolean isEnabled()
           
 void selectAll()
          Selects everything
 void setEnabled(boolean enabled)
           
 void setFlag(int flag)
          Sets the display to indicate a particular situation.
 void setLineBytes(int max)
          Sets the maximum number of bytes (UTF-8).
 void setLineWrap(boolean allowWrap)
          Sets line wrapping (doesn't actually wrap, just indicates where lines would wrap)
 void setOnChange(java.lang.String callback)
          Sets the action method called when user types or does anything else that changes the value.
 void setOnEnter(java.lang.String callback)
          Sets the action method called when user presses Return.
 void setOnFocus(java.lang.String callback)
          Sets the action method called when the control is focused.
 void setOnMultiLine(java.lang.String callback)
          Sets the action method called when multiple lines are pasted.
 void setRemember(java.lang.String category, java.lang.String memoryId)
          Sets details used to remember the command history between sessions.
 void setRequire(java.lang.String require)
          Sets a required regular expression which is applied to automatically set state to FLAG_ERROR or FLAG_NORMAL.
 void setTabCompletion(EditBox.TabCompletion tc)
          Enables/disables tab-completion handling.
 void setTextView(java.lang.String id)
          Sets a linked textview which will be handle some keyboard input from this control.
 void setUseFontSettings(boolean useFontSettings)
           
 void setValue(java.lang.String s)
           
 void setWidth(int width)
          Sets preferred width
 
Methods inherited from interface com.leafdigital.ui.api.Widget
getID, getOwner, informClosed, isVisible, setOwner, setVisible
 
Methods inherited from interface com.leafdigital.ui.api.SupportsBaseGroup
setBaseGroup
 

Field Detail

LINEBYTES_NOLIMIT

static final int LINEBYTES_NOLIMIT
If no limit on line characters

See Also:
Constant Field Values

FLAG_NORMAL

static final int FLAG_NORMAL
Display normal text

See Also:
Constant Field Values

FLAG_DIM

static final int FLAG_DIM
Display dim text, indicating editfield value is presently unimportant

See Also:
Constant Field Values

FLAG_ERROR

static final int FLAG_ERROR
Display text in error colour, indicating that value must be corrected

See Also:
Constant Field Values
Method Detail

getValue

java.lang.String getValue()
Returns:
Entered/selected value as string

getValueLines

java.lang.String[] getValueLines()
Returns:
Multi-line value as string array (only splits lines if wrap is turned on)

setValue

void setValue(java.lang.String s)
Parameters:
s - New text

setUseFontSettings

void setUseFontSettings(boolean useFontSettings)
Parameters:
useFontSettings - If true, uses user-selected font rather than OS default

setTextView

void setTextView(java.lang.String id)
Sets a linked textview which will be handle some keyboard input from this control. (E.g. copy here will do copy in textview.)

Parameters:
id - ID of textview
Throws:
BugException - If the textview doesn't exist or hasn't been constructed yet

setOnEnter

@UICallback
void setOnEnter(java.lang.String callback)
Sets the action method called when user presses Return.

Parameters:
callback - Name of method
Throws:
BugException - If method doesn't exist etc.

setOnChange

@UICallback
void setOnChange(java.lang.String callback)
Sets the action method called when user types or does anything else that changes the value.

Parameters:
callback - Name of method
Throws:
BugException - If method doesn't exist etc.

setOnFocus

@UICallback
void setOnFocus(java.lang.String callback)
Sets the action method called when the control is focused.

Parameters:
callback - Name of method
Throws:
BugException - If method doesn't exist etc.

setOnMultiLine

@UICallback
void setOnMultiLine(java.lang.String callback)
Sets the action method called when multiple lines are pasted. If you don't set this, multiline pastes are disallowed. The method must have a single string parameter.

Parameters:
callback - Name of method or null for none.

setRemember

void setRemember(java.lang.String category,
                 java.lang.String memoryId)
Sets details used to remember the command history between sessions. If this is set, the edit box will load its command history, and later save it into preferences.

Parameters:
category - Category of editbox (must follow the rules for preferences tokens, i.e. must start with a letter, all characters must be letters, digits, - or _)
memoryId - ID of editbox (should be unique within category; may be null if there is never more than one window of that category; can include any characters; does not have to match the 'real' ID assigned to the box)

setFlag

void setFlag(int flag)
Sets the display to indicate a particular situation.

Parameters:
flag - One of the FLAG_xx constants

getFlag

int getFlag()
Returns:
Current flag state FLAG_xx

setRequire

void setRequire(java.lang.String require)
Sets a required regular expression which is applied to automatically set state to FLAG_ERROR or FLAG_NORMAL. This automatic behaviour occurs before the OnChange callback.

Parameters:
require - Regular expression following Java conventions e.g. "[0-9]+"

setEnabled

void setEnabled(boolean enabled)
Parameters:
enabled - True to enable, false to disable

isEnabled

boolean isEnabled()
Returns:
True if enabled

focus

void focus()
Focuses this edit


setLineBytes

void setLineBytes(int max)
Sets the maximum number of bytes (UTF-8).

Parameters:
max - Max characters per line or LINEBYTES_NOLIMIT (default)

setLineWrap

void setLineWrap(boolean allowWrap)
Sets line wrapping (doesn't actually wrap, just indicates where lines would wrap)

Parameters:
allowWrap - If true, allows word-wrapping to a second line (default false)

setWidth

void setWidth(int width)
Sets preferred width

Parameters:
width - Width in pixels.

setTabCompletion

void setTabCompletion(EditBox.TabCompletion tc)
Enables/disables tab-completion handling.

Parameters:
tc - Tab completion handler, or null for none

selectAll

void selectAll()
Selects everything



Copyright © 2011 Samuel Marshall. All rights reserved.