06b6c33def70ccdcc7bd50359f91f449e2691b74
[jalviewjs.git] / site / j2s / javax / swing / border / CompoundBorder.js
1 Clazz.declarePackage ("javax.swing.border");
2 Clazz.load (["javax.swing.border.AbstractBorder"], "javax.swing.border.CompoundBorder", ["java.awt.Insets"], function () {
3 c$ = Clazz.decorateAsClass (function () {
4 this.outsideBorder = null;
5 this.insideBorder = null;
6 Clazz.instantialize (this, arguments);
7 }, javax.swing.border, "CompoundBorder", javax.swing.border.AbstractBorder);
8 Clazz.makeConstructor (c$, 
9 function () {
10 Clazz.superConstructor (this, javax.swing.border.CompoundBorder, []);
11 this.outsideBorder = null;
12 this.insideBorder = null;
13 });
14 Clazz.makeConstructor (c$, 
15 function (outsideBorder, insideBorder) {
16 Clazz.superConstructor (this, javax.swing.border.CompoundBorder, []);
17 this.outsideBorder = outsideBorder;
18 this.insideBorder = insideBorder;
19 }, "javax.swing.border.Border,javax.swing.border.Border");
20 Clazz.overrideMethod (c$, "isBorderOpaque", 
21 function () {
22 return (this.outsideBorder == null || this.outsideBorder.isBorderOpaque ()) && (this.insideBorder == null || this.insideBorder.isBorderOpaque ());
23 });
24 Clazz.overrideMethod (c$, "paintBorder", 
25 function (c, g, x, y, width, height) {
26 var nextInsets;
27 var px;
28 var py;
29 var pw;
30 var ph;
31 px = x;
32 py = y;
33 pw = width;
34 ph = height;
35 if (this.outsideBorder != null) {
36 this.outsideBorder.paintBorder (c, g, px, py, pw, ph);
37 nextInsets = this.outsideBorder.getBorderInsets (c);
38 px += nextInsets.left;
39 py += nextInsets.top;
40 pw = pw - nextInsets.right - nextInsets.left;
41 ph = ph - nextInsets.bottom - nextInsets.top;
42 }if (this.insideBorder != null) this.insideBorder.paintBorder (c, g, px, py, pw, ph);
43 }, "java.awt.Component,java.awt.Graphics,~N,~N,~N,~N");
44 Clazz.defineMethod (c$, "getBorderInsets", 
45 function (c, insets) {
46 var nextInsets;
47 insets.top = insets.left = insets.right = insets.bottom = 0;
48 if (this.outsideBorder != null) {
49 nextInsets = this.outsideBorder.getBorderInsets (c);
50 insets.top += nextInsets.top;
51 insets.left += nextInsets.left;
52 insets.right += nextInsets.right;
53 insets.bottom += nextInsets.bottom;
54 }if (this.insideBorder != null) {
55 nextInsets = this.insideBorder.getBorderInsets (c);
56 insets.top += nextInsets.top;
57 insets.left += nextInsets.left;
58 insets.right += nextInsets.right;
59 insets.bottom += nextInsets.bottom;
60 }return insets;
61 }, "java.awt.Component,java.awt.Insets");
62 Clazz.defineMethod (c$, "getBorderInsets", 
63 function (c) {
64 return this.getBorderInsets (c,  new java.awt.Insets (0, 0, 0, 0));
65 }, "java.awt.Component");
66 Clazz.defineMethod (c$, "getOutsideBorder", 
67 function () {
68 return this.outsideBorder;
69 });
70 Clazz.defineMethod (c$, "getInsideBorder", 
71 function () {
72 return this.insideBorder;
73 });
74 });