Merge branch 'master' of https://source.jalview.org/git/jalviewjs.git
[jalviewjs.git] / site / j2s / javax / swing / JTextPane.js
index 9212248..9770403 100644 (file)
-Clazz.declarePackage ("javax.swing");\r
-Clazz.load (["javax.swing.JEditorPane"], "javax.swing.JTextPane", ["java.lang.IllegalArgumentException", "javax.swing.UIManager", "javax.swing.text.JSMinimalAbstractDocument", "$.StyleConstants", "$.StyledDocument", "$.StyledEditorKit"], function () {\r
-c$ = Clazz.declareType (javax.swing, "JTextPane", javax.swing.JEditorPane);\r
-Clazz.makeConstructor (c$, \r
-function () {\r
-Clazz.superConstructor (this, javax.swing.JTextPane);\r
-var editorKit = this.createDefaultEditorKit ();\r
-var contentType = editorKit.getContentType ();\r
-if (contentType != null && javax.swing.JEditorPane.getEditorKitClassNameForContentType (contentType) === javax.swing.JEditorPane.defaultEditorKitMap.get (contentType)) {\r
-this.setEditorKitForContentType (contentType, editorKit);\r
-}this.setEditorKit (editorKit);\r
-});\r
-Clazz.makeConstructor (c$, \r
-function (doc) {\r
-this.construct ();\r
-this.setStyledDocument (doc);\r
-}, "javax.swing.text.StyledDocument");\r
-Clazz.overrideMethod (c$, "getUIClassID", \r
-function () {\r
-return "TextPaneUI";\r
-});\r
-Clazz.defineMethod (c$, "setDocument", \r
-function (doc) {\r
-if (Clazz.instanceOf (doc, javax.swing.text.StyledDocument)) {\r
-Clazz.superCall (this, javax.swing.JTextPane, "setDocument", [doc]);\r
-} else {\r
-throw  new IllegalArgumentException ("Model must be StyledDocument");\r
-}}, "javax.swing.text.Document");\r
-Clazz.defineMethod (c$, "setStyledDocument", \r
-function (doc) {\r
-Clazz.superCall (this, javax.swing.JTextPane, "setDocument", [doc]);\r
-}, "javax.swing.text.StyledDocument");\r
-Clazz.defineMethod (c$, "getStyledDocument", \r
-function () {\r
-return this.getDocument ();\r
-});\r
-Clazz.defineMethod (c$, "replaceSelection", \r
-function (content) {\r
-this.replaceSelection (content, true);\r
-}, "~S");\r
-Clazz.defineMethod (c$, "replaceSelection", \r
- function (content, checkEditable) {\r
-if (checkEditable && !this.isEditable ()) {\r
-javax.swing.UIManager.getLookAndFeel ().provideErrorFeedback (this);\r
-return;\r
-}var doc = this.getStyledDocument ();\r
-if (doc != null) {\r
-try {\r
-var caret = this.getCaret ();\r
-var p0 = Math.min (caret.getDot (), caret.getMark ());\r
-var p1 = Math.max (caret.getDot (), caret.getMark ());\r
-var attr = this.getInputAttributes ().copyAttributes ();\r
-if (Clazz.instanceOf (doc, javax.swing.text.JSMinimalAbstractDocument)) {\r
-(doc).replace (p0, p1 - p0, content, attr);\r
-} else {\r
-if (p0 != p1) {\r
-doc.remove (p0, p1 - p0);\r
-}if (content != null && content.length > 0) {\r
-doc.insertString (p0, content, attr);\r
-}}} catch (e) {\r
-if (Clazz.exceptionOf (e, javax.swing.text.BadLocationException)) {\r
-javax.swing.UIManager.getLookAndFeel ().provideErrorFeedback (this);\r
-} else {\r
-throw e;\r
-}\r
-}\r
-}}, "~S,~B");\r
-Clazz.defineMethod (c$, "insertComponent", \r
-function (c) {\r
-var inputAttributes = this.getInputAttributes ();\r
-inputAttributes.removeAttributes (inputAttributes);\r
-javax.swing.text.StyleConstants.setComponent (inputAttributes, c);\r
-this.replaceSelection (" ", false);\r
-inputAttributes.removeAttributes (inputAttributes);\r
-}, "java.awt.Component");\r
-Clazz.defineMethod (c$, "insertIcon", \r
-function (g) {\r
-var inputAttributes = this.getInputAttributes ();\r
-inputAttributes.removeAttributes (inputAttributes);\r
-javax.swing.text.StyleConstants.setIcon (inputAttributes, g);\r
-this.replaceSelection (" ", false);\r
-inputAttributes.removeAttributes (inputAttributes);\r
-}, "javax.swing.Icon");\r
-Clazz.defineMethod (c$, "addStyle", \r
-function (nm, parent) {\r
-var doc = this.getStyledDocument ();\r
-return doc.addStyle (nm, parent);\r
-}, "~S,javax.swing.text.Style");\r
-Clazz.defineMethod (c$, "removeStyle", \r
-function (nm) {\r
-var doc = this.getStyledDocument ();\r
-doc.removeStyle (nm);\r
-}, "~S");\r
-Clazz.defineMethod (c$, "getStyle", \r
-function (nm) {\r
-var doc = this.getStyledDocument ();\r
-return doc.getStyle (nm);\r
-}, "~S");\r
-Clazz.defineMethod (c$, "setLogicalStyle", \r
-function (s) {\r
-var doc = this.getStyledDocument ();\r
-doc.setLogicalStyle (this.getCaretPosition (), s);\r
-}, "javax.swing.text.Style");\r
-Clazz.defineMethod (c$, "getLogicalStyle", \r
-function () {\r
-var doc = this.getStyledDocument ();\r
-return doc.getLogicalStyle (this.getCaretPosition ());\r
-});\r
-Clazz.defineMethod (c$, "getCharacterAttributes", \r
-function () {\r
-var doc = this.getStyledDocument ();\r
-var run = doc.getCharacterElement (this.getCaretPosition ());\r
-if (run != null) {\r
-return run.getAttributes ();\r
-}return null;\r
-});\r
-Clazz.defineMethod (c$, "setCharacterAttributes", \r
-function (attr, replace) {\r
-var p0 = this.getSelectionStart ();\r
-var p1 = this.getSelectionEnd ();\r
-if (p0 != p1) {\r
-var doc = this.getStyledDocument ();\r
-doc.setCharacterAttributes (p0, p1 - p0, attr, replace);\r
-} else {\r
-var inputAttributes = this.getInputAttributes ();\r
-if (replace) {\r
-inputAttributes.removeAttributes (inputAttributes);\r
-}inputAttributes.addAttributes (attr);\r
-}}, "javax.swing.text.AttributeSet,~B");\r
-Clazz.defineMethod (c$, "getParagraphAttributes", \r
-function () {\r
-var doc = this.getStyledDocument ();\r
-var paragraph = doc.getParagraphElement (this.getCaretPosition ());\r
-if (paragraph != null) {\r
-return paragraph.getAttributes ();\r
-}return null;\r
-});\r
-Clazz.defineMethod (c$, "setParagraphAttributes", \r
-function (attr, replace) {\r
-var p0 = this.getSelectionStart ();\r
-var p1 = this.getSelectionEnd ();\r
-var doc = this.getStyledDocument ();\r
-doc.setParagraphAttributes (p0, p1 - p0, attr, replace);\r
-}, "javax.swing.text.AttributeSet,~B");\r
-Clazz.defineMethod (c$, "getInputAttributes", \r
-function () {\r
-return this.getStyledEditorKit ().getInputAttributes ();\r
-});\r
-Clazz.defineMethod (c$, "getStyledEditorKit", \r
-function () {\r
-return this.getEditorKit ();\r
-});\r
-Clazz.overrideMethod (c$, "createDefaultEditorKit", \r
-function () {\r
-return  new javax.swing.text.StyledEditorKit ();\r
-});\r
-Clazz.defineMethod (c$, "setEditorKit", \r
-function (kit) {\r
-if (Clazz.instanceOf (kit, javax.swing.text.StyledEditorKit)) {\r
-Clazz.superCall (this, javax.swing.JTextPane, "setEditorKit", [kit]);\r
-} else {\r
-throw  new IllegalArgumentException ("Must be StyledEditorKit");\r
-}}, "javax.swing.text.EditorKit");\r
-Clazz.defineStatics (c$,\r
-"$$uiClassID", "TextPaneUI");\r
-});\r
+Clazz.declarePackage ("javax.swing");
+Clazz.load (["javax.swing.JEditorPane"], "javax.swing.JTextPane", ["java.lang.IllegalArgumentException", "javax.swing.UIManager", "javax.swing.text.JSMinimalAbstractDocument", "$.StyleConstants", "$.StyledDocument", "$.StyledEditorKit"], function () {
+c$ = Clazz.declareType (javax.swing, "JTextPane", javax.swing.JEditorPane);
+Clazz.makeConstructor (c$, 
+function () {
+Clazz.superConstructor (this, javax.swing.JTextPane);
+var editorKit = this.createDefaultEditorKit ();
+var contentType = editorKit.getContentType ();
+if (contentType != null && javax.swing.JEditorPane.getEditorKitClassNameForContentType (contentType) === javax.swing.JEditorPane.defaultEditorKitMap.get (contentType)) {
+this.setEditorKitForContentType (contentType, editorKit);
+}this.setEditorKit (editorKit);
+});
+Clazz.makeConstructor (c$, 
+function (doc) {
+this.construct ();
+this.setStyledDocument (doc);
+}, "javax.swing.text.StyledDocument");
+Clazz.overrideMethod (c$, "getUIClassID", 
+function () {
+return "TextPaneUI";
+});
+Clazz.defineMethod (c$, "setDocument", 
+function (doc) {
+if (Clazz.instanceOf (doc, javax.swing.text.StyledDocument)) {
+Clazz.superCall (this, javax.swing.JTextPane, "setDocument", [doc]);
+} else {
+throw  new IllegalArgumentException ("Model must be StyledDocument");
+}}, "javax.swing.text.Document");
+Clazz.defineMethod (c$, "setStyledDocument", 
+function (doc) {
+Clazz.superCall (this, javax.swing.JTextPane, "setDocument", [doc]);
+}, "javax.swing.text.StyledDocument");
+Clazz.defineMethod (c$, "getStyledDocument", 
+function () {
+return this.getDocument ();
+});
+Clazz.defineMethod (c$, "replaceSelection", 
+function (content) {
+this.replaceSelection (content, true);
+}, "~S");
+Clazz.defineMethod (c$, "replaceSelection", 
+ function (content, checkEditable) {
+if (checkEditable && !this.isEditable ()) {
+javax.swing.UIManager.getLookAndFeel ().provideErrorFeedback (this);
+return;
+}var doc = this.getStyledDocument ();
+if (doc != null) {
+try {
+var caret = this.getCaret ();
+var p0 = Math.min (caret.getDot (), caret.getMark ());
+var p1 = Math.max (caret.getDot (), caret.getMark ());
+var attr = this.getInputAttributes ().copyAttributes ();
+if (Clazz.instanceOf (doc, javax.swing.text.JSMinimalAbstractDocument)) {
+(doc).replace (p0, p1 - p0, content, attr);
+} else {
+if (p0 != p1) {
+doc.remove (p0, p1 - p0);
+}if (content != null && content.length > 0) {
+doc.insertString (p0, content, attr);
+}}} catch (e) {
+if (Clazz.exceptionOf (e, javax.swing.text.BadLocationException)) {
+javax.swing.UIManager.getLookAndFeel ().provideErrorFeedback (this);
+} else {
+throw e;
+}
+}
+}}, "~S,~B");
+Clazz.defineMethod (c$, "insertComponent", 
+function (c) {
+var inputAttributes = this.getInputAttributes ();
+inputAttributes.removeAttributes (inputAttributes);
+javax.swing.text.StyleConstants.setComponent (inputAttributes, c);
+this.replaceSelection (" ", false);
+inputAttributes.removeAttributes (inputAttributes);
+}, "java.awt.Component");
+Clazz.defineMethod (c$, "insertIcon", 
+function (g) {
+var inputAttributes = this.getInputAttributes ();
+inputAttributes.removeAttributes (inputAttributes);
+javax.swing.text.StyleConstants.setIcon (inputAttributes, g);
+this.replaceSelection (" ", false);
+inputAttributes.removeAttributes (inputAttributes);
+}, "javax.swing.Icon");
+Clazz.defineMethod (c$, "addStyle", 
+function (nm, parent) {
+var doc = this.getStyledDocument ();
+return doc.addStyle (nm, parent);
+}, "~S,javax.swing.text.Style");
+Clazz.defineMethod (c$, "removeStyle", 
+function (nm) {
+var doc = this.getStyledDocument ();
+doc.removeStyle (nm);
+}, "~S");
+Clazz.defineMethod (c$, "getStyle", 
+function (nm) {
+var doc = this.getStyledDocument ();
+return doc.getStyle (nm);
+}, "~S");
+Clazz.defineMethod (c$, "setLogicalStyle", 
+function (s) {
+var doc = this.getStyledDocument ();
+doc.setLogicalStyle (this.getCaretPosition (), s);
+}, "javax.swing.text.Style");
+Clazz.defineMethod (c$, "getLogicalStyle", 
+function () {
+var doc = this.getStyledDocument ();
+return doc.getLogicalStyle (this.getCaretPosition ());
+});
+Clazz.defineMethod (c$, "getCharacterAttributes", 
+function () {
+var doc = this.getStyledDocument ();
+var run = doc.getCharacterElement (this.getCaretPosition ());
+if (run != null) {
+return run.getAttributes ();
+}return null;
+});
+Clazz.defineMethod (c$, "setCharacterAttributes", 
+function (attr, replace) {
+var p0 = this.getSelectionStart ();
+var p1 = this.getSelectionEnd ();
+if (p0 != p1) {
+var doc = this.getStyledDocument ();
+doc.setCharacterAttributes (p0, p1 - p0, attr, replace);
+} else {
+var inputAttributes = this.getInputAttributes ();
+if (replace) {
+inputAttributes.removeAttributes (inputAttributes);
+}inputAttributes.addAttributes (attr);
+}}, "javax.swing.text.AttributeSet,~B");
+Clazz.defineMethod (c$, "getParagraphAttributes", 
+function () {
+var doc = this.getStyledDocument ();
+var paragraph = doc.getParagraphElement (this.getCaretPosition ());
+if (paragraph != null) {
+return paragraph.getAttributes ();
+}return null;
+});
+Clazz.defineMethod (c$, "setParagraphAttributes", 
+function (attr, replace) {
+var p0 = this.getSelectionStart ();
+var p1 = this.getSelectionEnd ();
+var doc = this.getStyledDocument ();
+doc.setParagraphAttributes (p0, p1 - p0, attr, replace);
+}, "javax.swing.text.AttributeSet,~B");
+Clazz.defineMethod (c$, "getInputAttributes", 
+function () {
+return this.getStyledEditorKit ().getInputAttributes ();
+});
+Clazz.defineMethod (c$, "getStyledEditorKit", 
+function () {
+return this.getEditorKit ();
+});
+Clazz.overrideMethod (c$, "createDefaultEditorKit", 
+function () {
+return  new javax.swing.text.StyledEditorKit ();
+});
+Clazz.defineMethod (c$, "setEditorKit", 
+function (kit) {
+if (Clazz.instanceOf (kit, javax.swing.text.StyledEditorKit)) {
+Clazz.superCall (this, javax.swing.JTextPane, "setEditorKit", [kit]);
+} else {
+throw  new IllegalArgumentException ("Must be StyledEditorKit");
+}}, "javax.swing.text.EditorKit");
+Clazz.defineStatics (c$,
+"$$uiClassID", "TextPaneUI");
+});