1 Clazz.declarePackage ("javax.swing");
\r
2 Clazz.load (["javax.swing.JComponent", "$.MenuElement"], "javax.swing.JMenuBar", ["java.lang.Error", "java.util.Vector", "java.awt.Insets", "javax.swing.DefaultSingleSelectionModel", "$.JMenu", "$.JPopupMenu", "$.KeyboardManager", "$.UIManager"], function () {
\r
3 c$ = Clazz.decorateAsClass (function () {
\r
4 this.selectionModel = null;
\r
5 this.$paintBorder = true;
\r
7 Clazz.instantialize (this, arguments);
\r
8 }, javax.swing, "JMenuBar", javax.swing.JComponent, javax.swing.MenuElement);
\r
9 Clazz.makeConstructor (c$,
\r
11 Clazz.superConstructor (this, javax.swing.JMenuBar);
\r
12 this.setSelectionModel ( new javax.swing.DefaultSingleSelectionModel ());
\r
15 Clazz.overrideMethod (c$, "getUI",
\r
19 Clazz.overrideMethod (c$, "updateUI",
\r
21 this.setUI (javax.swing.UIManager.getUI (this));
\r
23 Clazz.overrideMethod (c$, "getUIClassID",
\r
27 Clazz.defineMethod (c$, "getSelectionModel",
\r
29 return this.selectionModel;
\r
31 Clazz.defineMethod (c$, "setSelectionModel",
\r
33 var oldValue = this.selectionModel;
\r
34 this.selectionModel = model;
\r
35 this.firePropertyChangeObject ("selectionModel", oldValue, this.selectionModel);
\r
36 }, "javax.swing.SingleSelectionModel");
\r
37 Clazz.defineMethod (c$, "add",
\r
39 Clazz.superCall (this, javax.swing.JMenuBar, "add", [c]);
\r
41 }, "javax.swing.JMenu");
\r
42 Clazz.defineMethod (c$, "getMenu",
\r
44 var c = this.getComponentAtIndex (index);
\r
45 if (Clazz.instanceOf (c, javax.swing.JMenu)) return c;
\r
48 Clazz.defineMethod (c$, "getMenuCount",
\r
50 return this.getComponentCount ();
\r
52 Clazz.defineMethod (c$, "setHelpMenu",
\r
54 throw new Error ("setHelpMenu() not yet implemented.");
\r
55 }, "javax.swing.JMenu");
\r
56 Clazz.defineMethod (c$, "getHelpMenu",
\r
58 throw new Error ("getHelpMenu() not yet implemented.");
\r
60 Clazz.defineMethod (c$, "getComponentAtIndex",
\r
62 if (i < 0 || i >= this.getComponentCount ()) {
\r
64 }return this.getComponent (i);
\r
66 Clazz.defineMethod (c$, "getComponentIndex",
\r
68 var ncomponents = this.getComponentCount ();
\r
69 var component = this.getComponents ();
\r
70 for (var i = 0; i < ncomponents; i++) {
\r
71 var comp = component[i];
\r
72 if (comp === c) return i;
\r
75 }, "java.awt.Component");
\r
76 Clazz.defineMethod (c$, "setSelected",
\r
78 var model = this.getSelectionModel ();
\r
79 var index = this.getComponentIndex (sel);
\r
80 model.setSelectedIndex (index);
\r
81 }, "java.awt.Component");
\r
82 Clazz.defineMethod (c$, "isSelected",
\r
84 return this.selectionModel.isSelected ();
\r
86 Clazz.defineMethod (c$, "isBorderPainted",
\r
88 return this.$paintBorder;
\r
90 Clazz.defineMethod (c$, "setBorderPainted",
\r
92 var oldValue = this.$paintBorder;
\r
93 this.$paintBorder = b;
\r
94 this.firePropertyChangeBool ("borderPainted", oldValue, this.$paintBorder);
\r
95 if (b != oldValue) {
\r
99 Clazz.defineMethod (c$, "paintBorder",
\r
101 if (this.isBorderPainted ()) {
\r
102 Clazz.superCall (this, javax.swing.JMenuBar, "paintBorder", [g]);
\r
103 }}, "java.awt.Graphics");
\r
104 Clazz.defineMethod (c$, "setMargin",
\r
106 var old = this.margin;
\r
108 this.firePropertyChangeObject ("margin", old, m);
\r
109 if (old == null || !old.equals (m)) {
\r
110 this.revalidate ();
\r
112 }}, "java.awt.Insets");
\r
113 Clazz.defineMethod (c$, "getMargin",
\r
115 if (this.margin == null) {
\r
116 return new java.awt.Insets (0, 0, 0, 0);
\r
118 return this.margin;
\r
120 Clazz.defineMethod (c$, "processMouseEvent",
\r
121 function (event, path, manager) {
\r
122 }, "java.awt.event.MouseEvent,~A,javax.swing.MenuSelectionManager");
\r
123 Clazz.defineMethod (c$, "processKeyEvent",
\r
124 function (e, path, manager) {
\r
125 }, "java.awt.event.KeyEvent,~A,javax.swing.MenuSelectionManager");
\r
126 Clazz.overrideMethod (c$, "menuSelectionChanged",
\r
127 function (isIncluded) {
\r
129 Clazz.defineMethod (c$, "getSubElements",
\r
132 var tmp = new java.util.Vector ();
\r
133 var c = this.getComponentCount ();
\r
136 for (i = 0; i < c; i++) {
\r
137 m = this.getComponent (i);
\r
138 if (Clazz.instanceOf (m, javax.swing.MenuElement)) tmp.addElement (m);
\r
140 result = new Array (tmp.size ());
\r
141 for (i = 0, c = tmp.size (); i < c; i++) result[i] = tmp.elementAt (i);
\r
145 Clazz.defineMethod (c$, "getComponent",
\r
149 Clazz.defineMethod (c$, "paramString",
\r
151 var paintBorderString = (this.$paintBorder ? "true" : "false");
\r
152 var marginString = (this.margin != null ? this.margin.toString () : "");
\r
153 return Clazz.superCall (this, javax.swing.JMenuBar, "paramString", []) + ",margin=" + marginString + ",paintBorder=" + paintBorderString;
\r
155 Clazz.defineMethod (c$, "processKeyBinding",
\r
156 function (ks, e, condition, pressed) {
\r
157 var retValue = Clazz.superCall (this, javax.swing.JMenuBar, "processKeyBinding", [ks, e, condition, pressed]);
\r
159 var subElements = this.getSubElements ();
\r
160 for (var i = 0; i < subElements.length; i++) {
\r
161 if (javax.swing.JMenuBar.processBindingForKeyStrokeRecursive (subElements[i], ks, e, condition, pressed)) {
\r
165 }, "javax.swing.KeyStroke,java.awt.event.KeyEvent,~N,~B");
\r
166 c$.processBindingForKeyStrokeRecursive = Clazz.defineMethod (c$, "processBindingForKeyStrokeRecursive",
\r
167 function (elem, ks, e, condition, pressed) {
\r
168 if (elem == null) {
\r
170 }var c = elem.getComponent ();
\r
171 if (!(c.isVisible () || (Clazz.instanceOf (c, javax.swing.JPopupMenu))) || !c.isEnabled ()) {
\r
173 }if (c != null && Clazz.instanceOf (c, javax.swing.JComponent) && (c).processKeyBinding (ks, e, condition, pressed)) {
\r
175 }var subElements = elem.getSubElements ();
\r
176 for (var i = 0; i < subElements.length; i++) {
\r
177 if (javax.swing.JMenuBar.processBindingForKeyStrokeRecursive (subElements[i], ks, e, condition, pressed)) {
\r
181 }, "javax.swing.MenuElement,javax.swing.KeyStroke,java.awt.event.KeyEvent,~N,~B");
\r
182 Clazz.defineMethod (c$, "addNotify",
\r
184 Clazz.superCall (this, javax.swing.JMenuBar, "addNotify", []);
\r
185 javax.swing.KeyboardManager.getCurrentManager ().registerMenuBar (this);
\r
187 Clazz.defineMethod (c$, "removeNotify",
\r
189 Clazz.superCall (this, javax.swing.JMenuBar, "removeNotify", []);
\r
190 javax.swing.KeyboardManager.getCurrentManager ().unregisterMenuBar (this);
\r
192 Clazz.defineStatics (c$,
\r
193 "$uiClassID", "MenuBarUI");
\r