com.leafdigital.ui.api
Interface TextView

All Superinterfaces:
Widget

public interface TextView
extends Widget

Interface for a scrolling text view.


Nested Class Summary
static interface TextView.ActionHandler
          Interface that happens when user clicks on things
static interface TextView.MenuHandler
          Interface used when user right-clicks
 
Field Summary
static int LINELIMIT_NONE
          Constant indicating no line limit
 
Method Summary
 void addLine(java.lang.String line)
          Add a line of text.
 void addPara(java.lang.String block)
          Add a paragraph of text.
 void addXML(java.lang.String xml)
          Adds arbitrary text data.
 void clear()
          Removes all text back to empty state.
 void copy()
          Copies selection to clipboard
 void fadeMark(int opacity)
          Fades out the position marker.
 boolean hasMark()
           
 boolean hasSelection()
           
 boolean isAtEnd()
           
 void markPosition()
          Marks the current position with a red line below it when new text appears.
 void removeMark()
          Removes the position marker if present
 void scrollToEnd()
          Scrolls to end of text
 void selectAll()
          Selects everything
 void selectNone()
          Sets selection to none
 void setAction(java.lang.String tag, TextView.ActionHandler ah)
          Sets handler for 'actions' (user clicking on things).
 void setDefaultHeight(int height)
          Set the default height for the view.
 void setDefaultWidth(int width)
          Set the default width for the view.
 void setLineLimit(int limit)
          If set, the view will delete lines from the beginning after you add more than this many lines.
 void setMenuHandler(TextView.MenuHandler mh)
          Sets handler for menu clicks (right-clicks)
 void setOnScroll(java.lang.String callback)
          Sets callback that happens whenever scroll position changes.
 void setScrolledUpWarning(boolean enable)
          Enables or disables the 'scrolled-up warning'; a graphical cue that appears when you're not looking at the bottom of the window.
 void setStyleSheet(java.io.InputStream is)
          Sets the stylesheet for the textview.
 void setStyleSheet(java.lang.String styles)
          Sets the stylesheet for the textview.
 void setThemeType(java.lang.String themeType)
          Set type name used to select theme details.
 
Methods inherited from interface com.leafdigital.ui.api.Widget
getID, getOwner, informClosed, isVisible, setOwner, setVisible
 

Field Detail

LINELIMIT_NONE

static final int LINELIMIT_NONE
Constant indicating no line limit

See Also:
Constant Field Values
Method Detail

setThemeType

void setThemeType(java.lang.String themeType)
Set type name used to select theme details.

Parameters:
themeType - Name used for items of this type within theme.

setDefaultWidth

void setDefaultWidth(int width)
Set the default width for the view. Has no effect when the label is already showing.

Parameters:
width - Desired width (default 200)

setDefaultHeight

void setDefaultHeight(int height)
Set the default height for the view. Has no effect when the label is already showing.

Parameters:
height - Desired width (default 200)

clear

void clear()
Removes all text back to empty state.


setLineLimit

void setLineLimit(int limit)
If set, the view will delete lines from the beginning after you add more than this many lines. (The limit is the number that are guaranteed to be kept. It actually only deletes lines, in a batch, when you exceed the limit by a certain amount.)

Parameters:
limit - Limit or LINELIMIT_NONE

selectAll

void selectAll()
Selects everything


hasSelection

boolean hasSelection()
Returns:
True if the textview has a selection

copy

void copy()
Copies selection to clipboard


selectNone

void selectNone()
Sets selection to none


addPara

void addPara(java.lang.String block)
             throws GeneralException
Add a paragraph of text.

Parameters:
block - XML data for new text (will be surrounded with para tag)
Throws:
GeneralException - If the text is not valid data

addLine

void addLine(java.lang.String line)
             throws GeneralException
Add a line of text.

Parameters:
line - XML data for new text (will be surrounded with line tag)
Throws:
GeneralException - If the text is not valid data

addXML

void addXML(java.lang.String xml)
            throws GeneralException
Adds arbitrary text data.

Parameters:
xml - XML data for new text (will be surrounded with but nothing else)
Throws:
GeneralException - If the text is not valid data

setStyleSheet

void setStyleSheet(java.io.InputStream is)
                   throws GeneralException
Sets the stylesheet for the textview. (If a stylesheet was already set, it reverts to default, then sets the new one.)

Parameters:
is - Stylesheet to add
Throws:
GeneralException - If there's a problem with the sheet format

setStyleSheet

void setStyleSheet(java.lang.String styles)
                   throws GeneralException
Sets the stylesheet for the textview. (If a stylesheet was already set, it reverts to default, then sets the new one.)

Parameters:
styles - Stylesheet to add
Throws:
GeneralException - If there's a problem with the sheet format

scrollToEnd

void scrollToEnd()
Scrolls to end of text


isAtEnd

boolean isAtEnd()
Returns:
True if currently at end of scroll

setOnScroll

@UICallback
void setOnScroll(java.lang.String callback)
Sets callback that happens whenever scroll position changes.

Parameters:
callback - Callback name
Throws:
BugException - If callback doesn't exist etc.

setAction

void setAction(java.lang.String tag,
               TextView.ActionHandler ah)
Sets handler for 'actions' (user clicking on things). If called multiple times for same tag, second call replaces first.

Parameters:
tag - Tag that is sensitive to clicks.
ah - Handler

setMenuHandler

void setMenuHandler(TextView.MenuHandler mh)
Sets handler for menu clicks (right-clicks)

Parameters:
mh - New handler

markPosition

void markPosition()
Marks the current position with a red line below it when new text appears. You cannot mark position when there is nothing in the window, or when the view has not yet been formatted for display (sized); doing so has no effect.


fadeMark

void fadeMark(int opacity)
Fades out the position marker.

Parameters:
opacity - New opacity (0=transparent, 255=full)

removeMark

void removeMark()
Removes the position marker if present


hasMark

boolean hasMark()
Returns:
True if position is marked

setScrolledUpWarning

void setScrolledUpWarning(boolean enable)
Enables or disables the 'scrolled-up warning'; a graphical cue that appears when you're not looking at the bottom of the window.

Parameters:
enable - True to enable


Copyright © 2011 Samuel Marshall. All rights reserved.