diff options
author | Guilhem Lavaux <guilhem@kaffe.org> | 2006-06-08 20:19:53 +0000 |
---|---|---|
committer | Guilhem Lavaux <guilhem@kaffe.org> | 2006-06-08 20:19:53 +0000 |
commit | 2f94810a11e0e3cdeb4bed695a4bf9eb9ce41c34 (patch) | |
tree | c5e2c0011d6dd129dbdc8da0273cdaff7b1bc3f6 /javax/swing/text/html/HTMLDocument.java | |
parent | 56c5b96a2d3754736d13eebb73270fb8f925301d (diff) | |
download | classpath-2f94810a11e0e3cdeb4bed695a4bf9eb9ce41c34.tar.gz |
2006-06-07 Guilhem Lavaux <guilhem@kaffe.org>native_layer_merge_head_2006_06_06
* Merged HEAD as of 2006-06-06.
* native/jni/native-lib/cpproc.h
(CPIO_EXEC_NUM_PIPES): Compilation fix.
Diffstat (limited to 'javax/swing/text/html/HTMLDocument.java')
-rw-r--r-- | javax/swing/text/html/HTMLDocument.java | 128 |
1 files changed, 16 insertions, 112 deletions
diff --git a/javax/swing/text/html/HTMLDocument.java b/javax/swing/text/html/HTMLDocument.java index fba6cad12..4eba007f6 100644 --- a/javax/swing/text/html/HTMLDocument.java +++ b/javax/swing/text/html/HTMLDocument.java @@ -40,14 +40,12 @@ package javax.swing.text.html; import gnu.classpath.NotImplementedException; +import gnu.javax.swing.text.html.CharacterAttributeTranslator; import java.io.IOException; import java.net.URL; import java.util.HashMap; import java.util.Stack; import java.util.Vector; - -import javax.swing.event.DocumentEvent; -import javax.swing.event.UndoableEditEvent; import javax.swing.text.AbstractDocument; import javax.swing.text.AttributeSet; import javax.swing.text.BadLocationException; @@ -131,21 +129,6 @@ public class HTMLDocument extends DefaultStyledDocument } /** - * Replaces the contents of the document with the given element - * specifications. This is called before insert if the loading is done - * in bursts. This is the only method called if loading the document - * entirely in one burst. - * - * @param data - the date that replaces the content of the document - */ - protected void create(DefaultStyledDocument.ElementSpec[] data) - { - // Once the super behaviour is properly implemented it should be sufficient - // to simply call super.create(data). - super.create(data); - } - - /** * This method creates a root element for the new document. * * @return the new default root @@ -216,41 +199,6 @@ public class HTMLDocument extends DefaultStyledDocument } /** - * Inserts new elements in bulk. This is how elements get created in the - * document. The parsing determines what structure is needed and creates the - * specification as a set of tokens that describe the edit while leaving the - * document free of a write-lock. This method can then be called in bursts by - * the reader to acquire a write-lock for a shorter duration (i.e. while the - * document is actually being altered). - * - * @param offset - the starting offset - * @param data - the element data - * @throws BadLocationException - if the given position does not - * represent a valid location in the associated document. - */ - protected void insert(int offset, DefaultStyledDocument.ElementSpec[] data) - throws BadLocationException - { - super.insert(offset, data); - } - - /** - * Updates document structure as a result of text insertion. This will happen - * within a write lock. This implementation simply parses the inserted content - * for line breaks and builds up a set of instructions for the element buffer. - * - * @param chng - a description of the document change - * @param attr - the attributes - */ - protected void insertUpdate(AbstractDocument.DefaultDocumentEvent chng, - AttributeSet attr) - { - // FIXME: Not implemented - System.out.println("insertUpdate not implemented"); - super.insertUpdate(chng, attr); - } - - /** * Returns the parser used by this HTMLDocument to insert HTML. * * @return the parser used by this HTMLDocument to insert HTML. @@ -414,6 +362,7 @@ public class HTMLDocument extends DefaultStyledDocument } public void processHTMLFrameHyperlinkEvent(HTMLFrameHyperlinkEvent event) + throws NotImplementedException { // TODO: Implement this properly. } @@ -646,12 +595,16 @@ public class HTMLDocument extends DefaultStyledDocument { // Put the old attribute set on the stack. pushCharacterStyle(); - - // And create the new one by adding the attributes in <code>a</code>. - if (a != null) - charAttr.addAttribute(t, a.copyAttributes()); + + // Translate tag.. return if succesful. + if(CharacterAttributeTranslator.translateTag(charAttr, t, a)) + return; + + // Just add the attributes in <code>a</code>. + if (a != null) + charAttr.addAttribute(t, a.copyAttributes()); } - + /** * Called when an end tag is seen for one of the types of tags associated * with this Action. @@ -745,7 +698,6 @@ public class HTMLDocument extends DefaultStyledDocument */ public void start(HTML.Tag t, MutableAttributeSet a) { - // FIXME: What else must be done here? blockOpen(t, a); } @@ -755,7 +707,6 @@ public class HTMLDocument extends DefaultStyledDocument */ public void end(HTML.Tag t) { - // FIXME: What else must be done here? blockClose(t); } } @@ -771,6 +722,7 @@ public class HTMLDocument extends DefaultStyledDocument { // FIXME: Implement. print ("PreAction.start not implemented"); + super.start(t, a); } /** @@ -782,6 +734,7 @@ public class HTMLDocument extends DefaultStyledDocument { // FIXME: Implement. print ("PreAction.end not implemented"); + super.end(t); } } @@ -1131,7 +1084,7 @@ public class HTMLDocument extends DefaultStyledDocument */ protected void pushCharacterStyle() { - charAttrStack.push(charAttr); + charAttrStack.push(charAttr.copyAttributes()); } /** @@ -1565,8 +1518,8 @@ public class HTMLDocument extends DefaultStyledDocument */ public Element getElement(String attrId) { - Element root = getDefaultRootElement(); - return getElement(root, HTML.getAttributeKey(attrId) , attrId); + return getElement(getDefaultRootElement(), HTML.getAttributeKey(attrId), + attrId); } /** @@ -1690,53 +1643,4 @@ public class HTMLDocument extends DefaultStyledDocument // FIXME: Not implemented fully, use InsertHTML* in HTMLEditorKit? System.out.println("insertAfterStart not implemented"); } - - /** - * This method sets the attributes associated with the paragraph containing - * offset. If replace is false, s is merged with existing attributes. The - * length argument determines how many characters are affected by the new - * attributes. This is often the entire paragraph. - * - * @param offset - - * the offset into the paragraph (must be at least 0) - * @param length - - * the number of characters affected (must be at least 0) - * @param s - - * the attributes - * @param replace - - * whether to replace existing attributes, or merge them - */ - public void setParagraphAttributes(int offset, int length, AttributeSet s, - boolean replace) - throws NotImplementedException - { - // FIXME: Not implemented. - System.out.println("setParagraphAttributes not implemented"); - super.setParagraphAttributes(offset, length, s, replace); - } - - /** - * This method flags a change in the document. - * - * @param e - the Document event - */ - protected void fireChangedUpdate(DocumentEvent e) - throws NotImplementedException - { - // FIXME: Not implemented. - System.out.println("fireChangedUpdate not implemented"); - super.fireChangedUpdate(e); - } - - /** - * This method fires an event intended to be caught by Undo listeners. It - * simply calls the super version inherited from DefaultStyledDocument. With - * this method, an HTML editor could easily provide undo support. - * - * @param e - the UndoableEditEvent - */ - protected void fireUndoableEditUpdate(UndoableEditEvent e) - { - super.fireUndoableEditUpdate(e); - } } |