public class SpenContentText extends SpenContentBase
SpenContentBase since 5.0.0.| Modifier and Type | Field and Description |
|---|---|
static int |
STYLE_BOLD
Bold text style.
|
static int |
STYLE_ITALIC
Italic text style.
|
static int |
STYLE_NONE
Properties of text font style.
|
static int |
STYLE_UNDERLINE
Underline text style.
|
STATE_CANCELED, STATE_DONE, STATE_EXCEPTION, STATE_FAIL, STATE_INIT, STATE_NONE, STATE_READY, STATE_RUNNING, TASK_BULLET, TASK_DONE, TASK_NONE, TASK_NUMBER, TASK_TODO, TYPE_DRAWING, TYPE_HANDWRITING, TYPE_IMAGE, TYPE_NONE, TYPE_TEXT| Constructor and Description |
|---|
SpenContentText()
Creates an SpenContentText instance
|
| Modifier and Type | Method and Description |
|---|---|
void |
appendSpan(SpenTextSpan span)
Add the specified span information.
Where there are existing spans, this method merges the new span with the existing spans. |
void |
copy(SpenContentBase source)
Copy data from the specified content.
|
ArrayList<SpenTextSpan> |
findSpan(int startIndex,
int endIndex)
Find the list of spans between the specified start position and end position.
|
int |
getCursorPosition()
Get cursor position.
|
String |
getHintText()
Get the hint text.
|
int |
getHintTextColor()
Get the color of the hint text.
|
float |
getHintTextSize()
Get the font size of the hint text.
|
int |
getHintTextStyle()
Get the specified style for hint text.
|
int |
getParagraphNumber()
Get the text paragraph number.
|
ArrayList<SpenTextSpan> |
getSpan()
Get the span information.
|
void |
insertText(String text,
int position)
Insert the text at the position in the text box.
If the position is negative or larger than the length of the entire text, an exception is thrown.In the new text, the span style follows the existing text. |
void |
insertTextAtCursor(String text)
Insert the text at the current cursor position.
After insertion, the cursor moves to the end of the new text. In the new text, the span style follows the existing text. |
boolean |
isHintTextEnabled()
Check if hint text is enabled.
|
void |
removeAllText()
Delete the entire text including span and paragraph data.
|
void |
removeSpan(SpenTextSpan span)
Remove the specified spans.
|
void |
removeText(int startIndex,
int length)
Delete the text from the position with the length.
If the delete position is negative or larger than the length of the entire text, an exception is thrown. |
void |
replaceText(String text,
int startIndex,
int length)
Replace the text specified by the starting position and length with the new text.
Span and paragraph data are retained and applied to the new text. |
void |
setCursorPosition(int position)
Set the cursor at the specified position.
|
void |
setHintText(String text)
Set the hint text.
|
void |
setHintTextColor(int color)
Set the specified color for hint text.
|
void |
setHintTextEnabled(boolean enable)
Show or hide the hint text.
|
void |
setHintTextSize(float size)
Set the hint text font size.
|
void |
setHintTextStyle(int style)
Set the specified style for hint text.
|
void |
setParagraphNumber(int number)
Set the text paragraph number.
|
void |
setSpan(ArrayList<SpenTextSpan> list)
Set the specified span information.
|
clearChangedFlag, equals, getItemHeight, getLength, getState, getTaskId, getTaskNumber, getTaskStyle, getText, getThumbnailPath, getType, isChanged, setItemHeight, setState, setTaskId, setTaskNumber, setTaskStyle, setText, setThumbnailPathpublic static final int STYLE_NONE
setHintTextStyle(int),
getHintTextStyle(),
Constant Field Valuespublic static final int STYLE_BOLD
setHintTextStyle(int),
getHintTextStyle(),
Constant Field Valuespublic static final int STYLE_ITALIC
setHintTextStyle(int),
getHintTextStyle(),
Constant Field Valuespublic static final int STYLE_UNDERLINE
setHintTextStyle(int),
getHintTextStyle(),
Constant Field Valuespublic SpenContentText()
public void setParagraphNumber(int number)
number - The paragraph number.getParagraphNumber()public int getParagraphNumber()
setParagraphNumber(int)public void setSpan(ArrayList<SpenTextSpan> list)
setSpan in class SpenContentBaselist - The span information.public ArrayList<SpenTextSpan> getSpan()
getSpan in class SpenContentBasepublic ArrayList<SpenTextSpan> findSpan(int startIndex, int endIndex)
findSpan in class SpenContentBasestartIndex - The index of the first character for finding span information.endIndex - The index of the last character for finding span information.public void removeSpan(SpenTextSpan span)
removeSpan in class SpenContentBasespan - The span instance.public void appendSpan(SpenTextSpan span)
appendSpan in class SpenContentBasespan - The span instance.public void insertText(String text, int position)
position is negative or larger than the length of the entire text, an exception is thrown.text - The text to insert.position - The position in the text box to insert the text.IllegalArgumentException - If the position is negative or larger than the text box length.
If the text of TextBox is NULL and the position is not 0.insertTextAtCursor(String)public void insertTextAtCursor(String text)
text - The text to insert.insertText(String, int)public void removeText(int startIndex,
int length)
startIndex - The start index of the text to be deleted.length - The length of the text to be deleted.IllegalArgumentException - If startPosition is negative or larger than the length of the entire textIllegalStateException - If the text of TextBox is NULL.public void replaceText(String text, int startIndex, int length)
text - The new text.startIndex - The start index of the text to be replaced.length - The length of the text to be replaced.IllegalArgumentException - If startPosition is negative or larger than the length of the entire text.
Or the text of TextBox is NULL.public void removeAllText()
public void setCursorPosition(int position)
position - The cursor positionIndexOutOfBoundsException - If position passed is negative or larger than the length of the entire text.getCursorPosition()public int getCursorPosition()
setCursorPosition(int)public void setHintText(String text)
text - hint text.public String getHintText()
public void setHintTextColor(int color)
color - The ARGB8888 format color.public int getHintTextColor()
public void setHintTextStyle(int style)
style - style.#STYLE_NONE}, {@link #STYLE_BOLD}, {@link #STYLE_ITALIC}, {@link #STYLE_UNDERLINE}public int getHintTextStyle()
#STYLE_NONE}, {@link #STYLE_BOLD}, {@link #STYLE_ITALIC}, {@link #STYLE_UNDERLINE}public void setHintTextSize(float size)
size - The hint text sizeIllegalArgumentException - Thrown if size is negative.public float getHintTextSize()
public void setHintTextEnabled(boolean enable)
enable - Set to true to show the hint text, set to false to hide the hint text.public boolean isHintTextEnabled()
true, The hint text is "enabled".public void copy(SpenContentBase source)
copy in class SpenContentBasesource - The source content.IllegalArgumentException - Thrown if class type is different.
Or if source is null.