|
Jive Forums API (5.5.20.2-oracle) Developer Javadocs | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.jivesoftware.forum.renderer.macro.code.JavaCodeViewer
public class JavaCodeViewer
A class that syntax highlights Java code into html.
A CodeViewer object is used to syntax highlight Java code. To make use of this class, first set up how tokens should be highlighted by invoking the getXXX and setXXX methods, then pass in "chunks" of relevent input to be filtered. Typically this will mean the section(s) of a form input that has been tagged with [code][/code] tags.
Constructor Summary | |
---|---|
JavaCodeViewer()
|
Method Summary | |
---|---|
java.lang.String |
getBracketEnd()
Gets the html for the end of a bracket. |
java.lang.String |
getBracketStart()
Gets the html for the start of a bracket. |
java.lang.String |
getCharacterEnd()
Gets the html for the end of a character. |
java.lang.String |
getCharacterStart()
Gets the html for the start of a character. |
java.lang.String |
getCommentEnd()
Gets the html for the end of a comment block. |
java.lang.String |
getCommentStart()
Gets the html for the start of a comment block. |
boolean |
getFilterMethod()
See if method filtering is enabled. |
boolean |
getFilterNumber()
See if number filtering is enabled. |
java.lang.String |
getMethodEnd()
Gets the html for the end of a method. |
java.lang.String |
getMethodStart()
Gets the html for the start of a method. |
java.lang.String |
getNumberEnd()
Gets the html for the end of a number. |
java.lang.String |
getNumberStart()
Gets the html for the start of a number |
java.lang.String |
getReservedWordEnd()
Gets the html for the end of a reserved word. |
java.lang.String |
getReservedWordStart()
Gets the html for the start of a reserved word. |
java.lang.String |
getStringEnd()
Gets the html for the end of a String. |
java.lang.String |
getStringStart()
Gets the html for the start of a String. |
java.lang.String |
javaCodeFilter(java.lang.String line)
Syntax highlights any java code in the input. |
void |
setBracketEnd(java.lang.String bracketEnd)
Sets the html for the end of a bracket. |
void |
setBracketStart(java.lang.String bracketStart)
Sets the html for the start of a bracket. |
void |
setCharacterEnd(java.lang.String characterEnd)
Sets the html for the end of a character. |
void |
setCharacterStart(java.lang.String characterStart)
Sets the html for the start of a character. |
void |
setCommentEnd(java.lang.String commentEnd)
Sets the html for the end of a comment block. |
void |
setCommentStart(java.lang.String commentStart)
Sets the html for the start of a comment block. |
void |
setFilterMethod(boolean filterMethod)
Enables or disables method filtering. |
void |
setFilterNumber(boolean filterNumber)
Enables or disables number filtering. |
void |
setMethodEnd(java.lang.String methodEnd)
Sets the html for the end of a method. |
void |
setMethodStart(java.lang.String methodStart)
Sets the html for the start of a method. |
void |
setNumberEnd(java.lang.String numberEnd)
Sets the html for the end of a number. |
void |
setNumberStart(java.lang.String numberStart)
Sets the html for the start of a number. |
void |
setReservedWordEnd(java.lang.String reservedWordEnd)
Sets the html for the end of a reserved word. |
void |
setReservedWordStart(java.lang.String reservedWordStart)
Sets the html for the start of a reserved word. |
void |
setStringEnd(java.lang.String stringEnd)
Sets the html for the end of a String. |
void |
setStringStart(java.lang.String stringStart)
Sets the html for the start of a String. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public JavaCodeViewer()
Method Detail |
---|
public java.lang.String getCommentStart()
public void setCommentStart(java.lang.String commentStart)
public java.lang.String getCommentEnd()
public void setCommentEnd(java.lang.String commentEnd)
public java.lang.String getStringStart()
public void setStringStart(java.lang.String stringStart)
public java.lang.String getStringEnd()
public void setStringEnd(java.lang.String stringEnd)
public java.lang.String getReservedWordStart()
public void setReservedWordStart(java.lang.String reservedWordStart)
public java.lang.String getReservedWordEnd()
public void setReservedWordEnd(java.lang.String reservedWordEnd)
public java.lang.String getMethodStart()
public void setMethodStart(java.lang.String methodStart)
public java.lang.String getMethodEnd()
public void setMethodEnd(java.lang.String methodEnd)
public java.lang.String getCharacterStart()
public void setCharacterStart(java.lang.String characterStart)
public java.lang.String getCharacterEnd()
public void setCharacterEnd(java.lang.String characterEnd)
public java.lang.String getBracketStart()
public void setBracketStart(java.lang.String bracketStart)
public java.lang.String getBracketEnd()
public void setBracketEnd(java.lang.String bracketEnd)
public java.lang.String getNumberStart()
public void setNumberStart(java.lang.String numberStart)
public java.lang.String getNumberEnd()
public void setNumberEnd(java.lang.String numberEnd)
public boolean getFilterMethod()
public void setFilterMethod(boolean filterMethod)
public boolean getFilterNumber()
public void setFilterNumber(boolean filterNumber)
public final java.lang.String javaCodeFilter(java.lang.String line)
The overall strategy is as follows:
The input is processed a character at a time, accompanied by a state update. When a valid
Java token is detected, such as a keyword, a string, a comment block, etc, said token gets
"wrapped" by htmlStart and htmlEnd tags. Not everything is implemented according to the Java
Language Specifications. For example, the length of a valid number is left unchecked.
line
- string possibly containing Java code
|
Jive Forums Project Page | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |