|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objecthudson.AbstractMarkupText
public abstract class AbstractMarkupText
Common part between MarkupText
and MarkupText.SubText
.
See MarkupText
for more discussion about what this class represents.
Method Summary | |
---|---|
void |
addHyperlink(int startPos,
int endPos,
String url)
Inserts an A tag that surrounds the given position. |
void |
addHyperlinkLowKey(int startPos,
int endPos,
String url)
Inserts an A tag that surrounds the given position. |
abstract void |
addMarkup(int startPos,
int endPos,
String startTag,
String endTag)
Adds a start tag and end tag at the specified position. |
char |
charAt(int idx)
|
protected abstract MarkupText.SubText |
createSubText(Matcher m)
|
MarkupText.SubText |
findToken(Pattern pattern)
Find the first occurrence of the given pattern in this text, or null. |
List<MarkupText.SubText> |
findTokens(Pattern pattern)
Find all "tokens" that match the given pattern in this text. |
abstract String |
getText()
Returns the plain text portion of this MarkupText without
any markup, nor any escape. |
void |
hide(int startPos,
int endPos)
Hides the given text. |
int |
length()
Length of the plain text. |
abstract MarkupText.SubText |
subText(int start,
int end)
Returns a subtext. |
void |
wrapBy(String startTag,
String endTag)
Adds a start tag and end tag around the entire text |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Method Detail |
---|
public abstract String getText()
MarkupText
without
any markup, nor any escape.
public char charAt(int idx)
public final int length()
public abstract MarkupText.SubText subText(int start, int end)
end
- If negative, -N means "trim the last N-1 chars". That is, (s,-1) is the same as (s,length)public abstract void addMarkup(int startPos, int endPos, String startTag, String endTag)
For example, if the text was "abc", then addMarkup(1,2,"<b>","</b>") would generate "a<b>b</b>c"
public void addHyperlink(int startPos, int endPos, String url)
public void addHyperlinkLowKey(int startPos, int endPos, String url)
public void hide(int startPos, int endPos)
public final void wrapBy(String startTag, String endTag)
public MarkupText.SubText findToken(Pattern pattern)
public List<MarkupText.SubText> findTokens(Pattern pattern)
A token is like a substring, except that it's aware of word boundaries.
For example, while "bc" is a string of "abc", calling findTokens
with "bc" as a pattern on string "abc" won't match anything.
This method is convenient for finding keywords that follow a certain syntax
from natural text. You can then use MarkupText.SubText.surroundWith(String,String)
to put mark up around such text.
protected abstract MarkupText.SubText createSubText(Matcher m)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |