|
|
|
|
@ -7,6 +7,9 @@
|
|
|
|
|
|
|
|
|
|
package net.java.sip.communicator.impl.gui.utils;
|
|
|
|
|
|
|
|
|
|
import java.awt.event.MouseEvent;
|
|
|
|
|
|
|
|
|
|
import javax.swing.JEditorPane;
|
|
|
|
|
import javax.swing.text.Document;
|
|
|
|
|
import javax.swing.text.Element;
|
|
|
|
|
import javax.swing.text.StyleConstants;
|
|
|
|
|
@ -16,14 +19,15 @@
|
|
|
|
|
import javax.swing.text.html.HTMLDocument;
|
|
|
|
|
import javax.swing.text.html.HTMLEditorKit;
|
|
|
|
|
import javax.swing.text.html.StyleSheet;
|
|
|
|
|
import javax.swing.text.html.HTMLEditorKit.LinkController;
|
|
|
|
|
|
|
|
|
|
public class MyHTMLEditorKit extends HTMLEditorKit {
|
|
|
|
|
|
|
|
|
|
public ViewFactory getViewFactory() {
|
|
|
|
|
return new HTMLFactoryX();
|
|
|
|
|
}
|
|
|
|
|
public class SIPCommHTMLEditorKit extends HTMLEditorKit {
|
|
|
|
|
|
|
|
|
|
public ViewFactory getViewFactory() {
|
|
|
|
|
return new HTMLFactoryX();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public static class HTMLFactoryX extends HTMLFactory
|
|
|
|
|
public static class HTMLFactoryX extends HTMLFactory
|
|
|
|
|
implements ViewFactory {
|
|
|
|
|
|
|
|
|
|
public View create(Element elem) {
|
|
|
|
|
@ -36,29 +40,29 @@ public View create(Element elem) {
|
|
|
|
|
HTML.Tag kind = (HTML.Tag) o;
|
|
|
|
|
|
|
|
|
|
if (kind == HTML.Tag.IMG)
|
|
|
|
|
return new MyImageView(elem);
|
|
|
|
|
return new SIPCommImageView(elem);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return super.create( elem );
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Create an uninitialized text storage model
|
|
|
|
|
* that is appropriate for this type of editor.
|
|
|
|
|
*
|
|
|
|
|
* @return the model
|
|
|
|
|
*/
|
|
|
|
|
public Document createDefaultDocument() {
|
|
|
|
|
StyleSheet styles = getStyleSheet();
|
|
|
|
|
StyleSheet ss = new StyleSheet();
|
|
|
|
|
/**
|
|
|
|
|
* Create an uninitialized text storage model
|
|
|
|
|
* that is appropriate for this type of editor.
|
|
|
|
|
*
|
|
|
|
|
* @return the model
|
|
|
|
|
*/
|
|
|
|
|
public Document createDefaultDocument() {
|
|
|
|
|
StyleSheet styles = getStyleSheet();
|
|
|
|
|
StyleSheet ss = new StyleSheet();
|
|
|
|
|
|
|
|
|
|
ss.addStyleSheet(styles);
|
|
|
|
|
ss.addStyleSheet(styles);
|
|
|
|
|
|
|
|
|
|
HTMLDocument doc = new HTMLDocument(ss);
|
|
|
|
|
doc.setParser(getParser());
|
|
|
|
|
doc.setAsynchronousLoadPriority(4);
|
|
|
|
|
doc.setTokenThreshold(100);
|
|
|
|
|
return doc;
|
|
|
|
|
}
|
|
|
|
|
HTMLDocument doc = new HTMLDocument(ss);
|
|
|
|
|
doc.setParser(getParser());
|
|
|
|
|
doc.setAsynchronousLoadPriority(4);
|
|
|
|
|
doc.setTokenThreshold(100);
|
|
|
|
|
return doc;
|
|
|
|
|
}
|
|
|
|
|
}
|