edu.stanford.smi.protegex.widget.editorpane
Class EditorPaneLinkDetector.HTMLDocLinkDetector
java.lang.Object
javax.swing.text.AbstractDocument
javax.swing.text.DefaultStyledDocument
javax.swing.text.html.HTMLDocument
edu.stanford.smi.protegex.widget.editorpane.EditorPaneLinkDetector.HTMLDocLinkDetector
- All Implemented Interfaces:
- Serializable, Document, StyledDocument
- Enclosing class:
- EditorPaneLinkDetector
protected class EditorPaneLinkDetector.HTMLDocLinkDetector
- extends HTMLDocument
- See Also:
- Serialized Form
Method Summary |
protected void |
computeLinks(Element e)
This method corrects or creates a url contained in an Element as an
hyperlink. |
protected void |
correctLink(Element e)
The method corrects the url inside an Element, that is supposed to be
an element containing a link only. |
protected void |
createLink(Element e)
The method check if the element contains a url in plain text, and if
so, it creates the html tag HTML.Tag.A to have the url displayed as
an hyperlink. |
void |
insertString(int offs,
String str,
AttributeSet a)
|
protected boolean |
isLink(Element e)
Returns true if the Element contains a HTML.Tag.A attribute, false
otherwise. |
void |
remove(int offs,
int len)
|
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, 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, putProperty, removeUndoableEditListener, render |
EditorPaneLinkDetector.HTMLDocLinkDetector
public EditorPaneLinkDetector.HTMLDocLinkDetector(StyleSheet ss)
isLink
protected boolean isLink(Element e)
- Returns true if the Element contains a HTML.Tag.A attribute, false
otherwise.
- Parameters:
e
- the Element to be checked
- Returns:
computeLinks
protected void computeLinks(Element e)
throws BadLocationException
- This method corrects or creates a url contained in an Element as an
hyperlink.
- Parameters:
e
- the Element to be computed
- Throws:
BadLocationException
correctLink
protected void correctLink(Element e)
throws BadLocationException,
IOException
- The method corrects the url inside an Element, that is supposed to be
an element containing a link only. This function is typically called
when the url is beeing edited. What the function does is to remove
the html tags, so the url is actually edited in plain text and not as
an hyperlink.
- Parameters:
e
- the Element that contains the url
- Throws:
BadLocationException
IOException
createLink
protected void createLink(Element e)
throws BadLocationException,
IOException
- The method check if the element contains a url in plain text, and if
so, it creates the html tag HTML.Tag.A to have the url displayed as
an hyperlink.
- Parameters:
e
- element that contains the url
- Throws:
BadLocationException
IOException
remove
public void remove(int offs,
int len)
throws BadLocationException
- Specified by:
remove
in interface Document
- Overrides:
remove
in class AbstractDocument
- Throws:
BadLocationException
insertString
public void insertString(int offs,
String str,
AttributeSet a)
throws BadLocationException
- Specified by:
insertString
in interface Document
- Overrides:
insertString
in class AbstractDocument
- Throws:
BadLocationException
Submit a bug report or feature request