1 Clazz.declarePackage ("javax.swing.text");
2 Clazz.load (["javax.swing.text.GlyphView", "$.TabableView"], "javax.swing.text.LabelView", ["java.awt.Toolkit", "javax.swing.text.StateInvariantError", "$.StyleConstants", "$.StyledDocument"], function () {
3 c$ = Clazz.decorateAsClass (function () {
7 this.underline = false;
9 this.superscript = false;
10 this.subscript = false;
11 Clazz.instantialize (this, arguments);
12 }, javax.swing.text, "LabelView", javax.swing.text.GlyphView, javax.swing.text.TabableView);
13 Clazz.defineMethod (c$, "sync",
15 if (this.font == null) {
16 this.setPropertiesFromAttributes ();
18 Clazz.defineMethod (c$, "setUnderline",
22 Clazz.defineMethod (c$, "setStrikeThrough",
26 Clazz.defineMethod (c$, "setSuperscript",
30 Clazz.defineMethod (c$, "setSubscript",
34 Clazz.defineMethod (c$, "setBackground",
38 Clazz.defineMethod (c$, "setPropertiesFromAttributes",
40 var attr = this.getAttributes ();
42 var d = this.getDocument ();
43 if (Clazz.instanceOf (d, javax.swing.text.StyledDocument)) {
45 this.font = doc.getFont (attr);
46 this.fg = doc.getForeground (attr);
47 if (attr.isDefined (javax.swing.text.StyleConstants.Background)) {
48 this.bg = doc.getBackground (attr);
51 }this.setUnderline (javax.swing.text.StyleConstants.isUnderline (attr));
52 this.setStrikeThrough (javax.swing.text.StyleConstants.isStrikeThrough (attr));
53 this.setSuperscript (javax.swing.text.StyleConstants.isSuperscript (attr));
54 this.setSubscript (javax.swing.text.StyleConstants.isSubscript (attr));
56 throw new javax.swing.text.StateInvariantError ("LabelView needs StyledDocument");
58 Clazz.defineMethod (c$, "getFontMetrics",
61 var c = this.getContainer ();
62 return (c != null) ? c.getFontMetrics (this.font) : java.awt.Toolkit.getDefaultToolkit ().getFontMetrics (this.font);
64 Clazz.overrideMethod (c$, "getBackground",
69 Clazz.overrideMethod (c$, "getForeground",
74 Clazz.overrideMethod (c$, "getFont",
79 Clazz.overrideMethod (c$, "isUnderline",
82 return this.underline;
84 Clazz.overrideMethod (c$, "isStrikeThrough",
89 Clazz.overrideMethod (c$, "isSubscript",
92 return this.subscript;
94 Clazz.overrideMethod (c$, "isSuperscript",
97 return this.superscript;
99 Clazz.defineMethod (c$, "changedUpdate",
102 Clazz.superCall (this, javax.swing.text.LabelView, "changedUpdate", [e, a, f]);
103 }, "javax.swing.event.DocumentEvent,java.awt.Shape,javax.swing.text.ViewFactory");