|
Nekit v 0.9 |
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Object
|
+--javax.swing.text.AbstractDocument
|
+--javax.swing.text.DefaultStyledDocument
|
+--javax.swing.text.html.HTMLDocument
|
+--com.nekhem.nekit.NekitDocument
All the routines to actually manipulate the text Ovverrides some of the methods of HTMLDocument to workaround some problems FIXME: reduce redundancy
| Nested Class Summary |
| Nested classes inherited from class javax.swing.text.html.HTMLDocument |
javax.swing.text.html.HTMLDocument.BlockElement, javax.swing.text.html.HTMLDocument.HTMLReader, javax.swing.text.html.HTMLDocument.Iterator, javax.swing.text.html.HTMLDocument.RunElement |
| Nested classes inherited from class javax.swing.text.DefaultStyledDocument |
javax.swing.text.DefaultStyledDocument.AttributeUndoableEdit, javax.swing.text.DefaultStyledDocument.ElementBuffer, javax.swing.text.DefaultStyledDocument.ElementSpec, javax.swing.text.DefaultStyledDocument.SectionElement |
| Nested classes inherited from class javax.swing.text.AbstractDocument |
javax.swing.text.AbstractDocument.AbstractElement, javax.swing.text.AbstractDocument.AttributeContext, javax.swing.text.AbstractDocument.BranchElement, javax.swing.text.AbstractDocument.Content, javax.swing.text.AbstractDocument.DefaultDocumentEvent, javax.swing.text.AbstractDocument.ElementEdit, javax.swing.text.AbstractDocument.LeafElement |
| Field Summary | |
java.util.Vector |
paragraphTags
All the tags that define a paragraph |
java.util.Vector |
titleTags
All tags that define a title |
| Fields inherited from class javax.swing.text.html.HTMLDocument |
AdditionalComments |
| Fields inherited from class javax.swing.text.DefaultStyledDocument |
buffer, BUFFER_SIZE_DEFAULT |
| Fields inherited from class javax.swing.text.AbstractDocument |
BAD_LOCATION, BidiElementName, ContentElementName, ElementNameAttribute, listenerList, ParagraphElementName, SectionElementName |
| Fields inherited from interface javax.swing.text.Document |
StreamDescriptionProperty, TitleProperty |
| Method Summary | |
void |
adjustEnd()
Ensures the presence of a paragraph at the end of the document. |
boolean |
anyActiveHere(int pos,
java.util.Vector tags)
Is the offset given included in any of the tags given? |
javax.swing.text.html.HTMLDocument.BlockElement |
attachBlockTag(int index,
int removeQty,
javax.swing.text.html.HTMLDocument.BlockElement parent,
javax.swing.text.Element attrSource)
Create a copy BlockElement and attach it to 'parent' at position 'index' replacing 'removeQty' elements |
javax.swing.text.html.HTMLDocument.RunElement |
attachLeaf(int start,
int end,
javax.swing.text.html.HTMLDocument.BlockElement parent,
javax.swing.text.Element attrSource)
Create a copy RunElement and attach it to 'parent' with range given |
boolean |
charDeletable(int pos)
Can somebody delete thar char? |
void |
clearFormat(int start,
int end)
Format the given region to normal text |
java.lang.String |
cutHtmlSlice(int offset,
int length)
Remove a region of the document and get a HTML representation of it |
void |
dumpAttributes(int caretPos)
Debug method that writes the Element structure at offset given |
com.nekhem.nekit.Interval |
findLineEnds(int start,
int end)
Find the minimal region, delimited by newlines, that includes the range given |
javax.swing.text.Element |
findTagElement(int offset,
javax.swing.text.html.HTML.Tag tag)
Find the Element that includes this offset and that corresponds to this tag |
java.lang.String |
getAlignment(int offset)
Get the tipe of alignment ("","center","right") |
java.lang.String |
getChar(int pos)
Get the "one char string" at the position |
javax.swing.text.html.HTMLDocument |
getDocument()
getter |
java.lang.String |
getHtmlSlice(int offset,
int length)
Get a HTML representation of a region of the document |
javax.swing.text.html.HTML.Tag |
getTag(javax.swing.text.Element el)
Get the tag corresponding to the Element |
javax.swing.text.html.HTMLDocument.BlockElement |
insertBlockTag(javax.swing.text.html.HTMLDocument.BlockElement parent,
javax.swing.text.Element attrSource)
Insert a copy of attrSource at the start of parent |
void |
insertBreak(int pos)
Insert a BR tag (simple newline) |
void |
insertHRule(int caretPos)
Method for inserting a horizontal rule (HR) element |
void |
insertHtml(int offset,
java.lang.String html)
Insert a piece of HTML code |
void |
insertParagraphBreak(int pos)
Method for inserting a Parag (P) element |
boolean |
isSimpleBlank(int pos)
Is the char at position 'pos' a space char? |
boolean |
isTag(javax.swing.text.Element el,
javax.swing.text.html.HTML.Tag tag)
Does the Element correspond to this tag? |
boolean |
oneOfTheeseTagsInRange(int start,
int end,
java.lang.Object[] tags)
Is there any of the tags listed in range given? |
boolean |
oneOfTheeseTagsInRange(int start,
int end,
java.util.Vector tags)
Is there any of the tags listed in range given? |
int |
paragraphize(int start,
int end)
Transform the given region in a separated paragraph |
void |
remove(int start,
int length)
"No exception" remove() |
boolean |
removeBreak(int pos)
if at pos there is a break (tag BR) remove it |
boolean |
removeListElementIfVoid(int pos)
If the current position is in a List Element and the Element has no characters, remove it. |
boolean |
removeParagraphIfVoid(int pos)
If the current position contains a null paragraph, remove it |
static java.lang.String |
removeUnNeeded(java.lang.String html)
Keep only the part between body tags. |
java.lang.String |
safeGetText(int offset,
int length)
No exception getText (the limits are adjusted to become legal) |
void |
setBaseAttributes(javax.swing.text.AttributeSet as)
|
void |
setTagsAttributes(int start,
int end,
java.util.Vector tags,
javax.swing.text.html.HTML.Attribute attrId,
java.lang.String attrvalue)
Give to any tag in 'tags' that stays in the given range, the attibute 'attrId=attrvalue' |
void |
simpleInsert(int pos,
java.lang.String text)
"no Exception" insertString() this is not good practice, but I needed more readable algoritms in the development phase.... |
void |
splitList(int pos)
Split the current "bullet list"-line in two. |
boolean |
tagActiveHere(int pos,
javax.swing.text.html.HTML.Tag tag)
Is the offset given included in the tag given? |
java.lang.String |
textInRange(int start,
int end)
Get the region of text |
void |
transferLeafs(javax.swing.text.html.HTMLDocument.RunElement[] array,
javax.swing.text.html.HTMLDocument.BlockElement parent)
Move Elements to a new parent |
| Methods inherited from class javax.swing.text.html.HTMLDocument |
create, createBranchElement, createDefaultRoot, createLeafElement, fireChangedUpdate, fireUndoableEditUpdate, getBase, getElement, getElement, getIterator, getParser, getPreservesUnknownTags, getReader, getReader, getStyleSheet, getTokenThreshold, insert, insertAfterEnd, insertAfterStart, insertBeforeEnd, insertBeforeStart, insertUpdate, processHTMLFrameHyperlinkEvent, setBase, setInnerHTML, setOuterHTML, setParagraphAttributes, setParser, setPreservesUnknownTags, setTokenThreshold |
| Methods inherited from class javax.swing.text.DefaultStyledDocument |
addDocumentListener, addStyle, getBackground, getCharacterElement, getDefaultRootElement, getFont, getForeground, getLogicalStyle, getParagraphElement, getStyle, getStyleNames, removeDocumentListener, removeStyle, removeUpdate, setCharacterAttributes, setLogicalStyle, styleChanged |
| Methods inherited from class javax.swing.text.AbstractDocument |
addUndoableEditListener, createPosition, dump, fireInsertUpdate, fireRemoveUpdate, getAsynchronousLoadPriority, getAttributeContext, getBidiRootElement, getContent, getCurrentWriter, getDocumentFilter, getDocumentListeners, getDocumentProperties, getEndPosition, getLength, getListeners, getProperty, getRootElements, getStartPosition, getText, getText, getUndoableEditListeners, insertString, postRemoveUpdate, putProperty, readLock, readUnlock, removeUndoableEditListener, render, replace, setAsynchronousLoadPriority, setDocumentFilter, setDocumentProperties, writeLock, writeUnlock |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Methods inherited from interface javax.swing.text.Document |
addUndoableEditListener, createPosition, getEndPosition, getLength, getProperty, getRootElements, getStartPosition, getText, getText, insertString, putProperty, removeUndoableEditListener, render |
| Field Detail |
public java.util.Vector paragraphTags
public java.util.Vector titleTags
| Method Detail |
public void setBaseAttributes(javax.swing.text.AttributeSet as)
as - public javax.swing.text.html.HTMLDocument getDocument()
public void simpleInsert(int pos,
java.lang.String text)
pos - insert positiontext - ascii text to insert
public java.lang.String textInRange(int start,
int end)
start - initial positionend - end position
public java.lang.String safeGetText(int offset,
int length)
offset - start positionlength - -
public java.lang.String getChar(int pos)
pos - offset position
public void remove(int start,
int length)
remove in interface javax.swing.text.Documentremove in class javax.swing.text.AbstractDocumentstart - length - public boolean removeListElementIfVoid(int pos)
pos - the offset
public void insertHtml(int offset,
java.lang.String html)
offset - insertion positionhtml - html code
public java.lang.String getHtmlSlice(int offset,
int length)
offset - start positionlength - number of document characters (tags are not
considered)
public java.lang.String cutHtmlSlice(int offset,
int length)
offset - start positionlength - number of document characters
public javax.swing.text.html.HTML.Tag getTag(javax.swing.text.Element el)
el - the Element
public boolean isTag(javax.swing.text.Element el,
javax.swing.text.html.HTML.Tag tag)
el - tag -
public javax.swing.text.Element findTagElement(int offset,
javax.swing.text.html.HTML.Tag tag)
offset - textual offsettag - -t
public boolean oneOfTheeseTagsInRange(int start,
int end,
java.lang.Object[] tags)
start - range startend - range endtags - tag list
public boolean oneOfTheeseTagsInRange(int start,
int end,
java.util.Vector tags)
start - end - tags -
public javax.swing.text.html.HTMLDocument.BlockElement insertBlockTag(javax.swing.text.html.HTMLDocument.BlockElement parent,
javax.swing.text.Element attrSource)
parent - attrSource -
public javax.swing.text.html.HTMLDocument.BlockElement attachBlockTag(int index,
int removeQty,
javax.swing.text.html.HTMLDocument.BlockElement parent,
javax.swing.text.Element attrSource)
index - order number in 'parent'removeQty - how many childs of 'parent' remove?parent - branch to attach toattrSource - the Element to copy from
public javax.swing.text.html.HTMLDocument.RunElement attachLeaf(int start,
int end,
javax.swing.text.html.HTMLDocument.BlockElement parent,
javax.swing.text.Element attrSource)
start - range startend - range endparent - attrSource - the Element to copy
public void transferLeafs(javax.swing.text.html.HTMLDocument.RunElement[] array,
javax.swing.text.html.HTMLDocument.BlockElement parent)
array - The Elements to moveparent - The new parent
public boolean tagActiveHere(int pos,
javax.swing.text.html.HTML.Tag tag)
pos - the offsettag - the searched tag
public boolean anyActiveHere(int pos,
java.util.Vector tags)
pos - the offsettags - the tag list
public boolean isSimpleBlank(int pos)
pos - offset
public boolean removeBreak(int pos)
pos - the offset
public java.lang.String getAlignment(int offset)
offset - -
public com.nekhem.nekit.Interval findLineEnds(int start,
int end)
start - range startend - range end
public void dumpAttributes(int caretPos)
caretPos - the offset
public void insertHRule(int caretPos)
throws java.io.IOException,
javax.swing.text.BadLocationException,
java.lang.RuntimeException
caretPos -
java.io.IOException
javax.swing.text.BadLocationException
java.lang.RuntimeException
public void insertParagraphBreak(int pos)
throws java.io.IOException,
javax.swing.text.BadLocationException,
java.lang.RuntimeException
java.io.IOException
javax.swing.text.BadLocationException
java.lang.RuntimeException
public void insertBreak(int pos)
throws java.io.IOException,
javax.swing.text.BadLocationException,
java.lang.RuntimeException
pos - the offset
java.io.IOException
javax.swing.text.BadLocationException
java.lang.RuntimeExceptionpublic static java.lang.String removeUnNeeded(java.lang.String html)
html - a complete HTML Document
public void setTagsAttributes(int start,
int end,
java.util.Vector tags,
javax.swing.text.html.HTML.Attribute attrId,
java.lang.String attrvalue)
start - range startend - range endtags - list of tags that must receive the attributeattrId - the attribute nameattrvalue - the attribute valuepublic void adjustEnd()
public boolean charDeletable(int pos)
pos - the character position
public int paragraphize(int start,
int end)
start - start of the regionend - end of the region
public void clearFormat(int start,
int end)
start - start of regionend - end of regionpublic void splitList(int pos)
pos - position of the splitListContextpublic boolean removeParagraphIfVoid(int pos)
pos - offset
|
Nekit v 0.9 |
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||