1 Clazz.declarePackage ("javax.swing");
2 Clazz.load (["java.awt.LayoutManager2", "java.beans.PropertyChangeListener", "javax.swing.JComponent", "$.JSeparator", "$.SwingConstants", "javax.swing.plaf.UIResource"], "javax.swing.JToolBar", ["java.lang.Boolean", "$.IllegalArgumentException", "java.awt.Insets", "javax.swing.BoxLayout", "$.JButton", "$.UIManager"], function () {
3 c$ = Clazz.decorateAsClass (function () {
4 this.$paintBorder = true;
8 if (!Clazz.isClassDefined ("javax.swing.JToolBar.DefaultToolBarLayout")) {
9 javax.swing.JToolBar.$JToolBar$DefaultToolBarLayout$ ();
11 Clazz.instantialize (this, arguments);
12 }, javax.swing, "JToolBar", javax.swing.JComponent, javax.swing.SwingConstants);
13 Clazz.makeConstructor (c$,
17 Clazz.makeConstructor (c$,
18 function (orientation) {
19 this.construct (null, orientation);
21 Clazz.makeConstructor (c$,
23 this.construct (name, 0);
25 Clazz.makeConstructor (c$,
26 function (name, orientation) {
27 Clazz.superConstructor (this, javax.swing.JToolBar, []);
29 this.checkOrientation (orientation);
30 this.orientation = orientation;
31 var layout = Clazz.innerTypeInstance (javax.swing.JToolBar.DefaultToolBarLayout, this, null, orientation);
32 this.setLayout (layout);
33 this.addPropertyChangeListener (layout);
36 Clazz.overrideMethod (c$, "getUI",
40 Clazz.overrideMethod (c$, "updateUI",
42 this.setUI (javax.swing.UIManager.getUI (this));
43 if (this.getLayout () == null) {
44 this.setLayout (Clazz.innerTypeInstance (javax.swing.JToolBar.DefaultToolBarLayout, this, null, this.getOrientation ()));
47 Clazz.overrideMethod (c$, "getUIClassID",
51 Clazz.defineMethod (c$, "getComponentIndex",
53 var ncomponents = this.getComponentCount ();
54 var component = this.getComponents ();
55 for (var i = 0; i < ncomponents; i++) {
56 var comp = component[i];
57 if (comp === c) return i;
60 }, "java.awt.Component");
61 Clazz.defineMethod (c$, "getComponentAtIndex",
63 var ncomponents = this.getComponentCount ();
64 if (i >= 0 && i < ncomponents) {
65 var component = this.getComponents ();
69 Clazz.defineMethod (c$, "setMargin",
71 var old = this.margin;
73 this.firePropertyChangeObject ("margin", old, m);
76 }, "java.awt.Insets");
77 Clazz.defineMethod (c$, "getMargin",
79 if (this.margin == null) {
80 return new java.awt.Insets (0, 0, 0, 0);
84 Clazz.defineMethod (c$, "isBorderPainted",
86 return this.$paintBorder;
88 Clazz.defineMethod (c$, "setBorderPainted",
90 if (this.$paintBorder != b) {
91 var old = this.$paintBorder;
92 this.$paintBorder = b;
93 this.firePropertyChangeBool ("borderPainted", old, b);
97 Clazz.defineMethod (c$, "paintBorder",
99 if (this.isBorderPainted ()) {
100 Clazz.superCall (this, javax.swing.JToolBar, "paintBorder", [g]);
101 }}, "java.awt.Graphics");
102 Clazz.defineMethod (c$, "isFloatable",
104 return this.floatable;
106 Clazz.defineMethod (c$, "setFloatable",
108 if (this.floatable != b) {
109 var old = this.floatable;
111 this.firePropertyChangeBool ("floatable", old, b);
115 Clazz.defineMethod (c$, "getOrientation",
117 return this.orientation;
119 Clazz.defineMethod (c$, "setOrientation",
121 this.checkOrientation (o);
122 if (this.orientation != o) {
123 var old = this.orientation;
124 this.orientation = o;
125 this.firePropertyChangeInt ("orientation", old, o);
129 Clazz.defineMethod (c$, "setRollover",
130 function (rollover) {
131 this.putClientProperty ("JToolBar.isRollover", rollover ? Boolean.TRUE : Boolean.FALSE);
133 Clazz.defineMethod (c$, "isRollover",
135 var rollover = this.getClientProperty ("JToolBar.isRollover");
136 if (rollover != null) {
137 return rollover.booleanValue ();
140 Clazz.defineMethod (c$, "checkOrientation",
141 function (orientation) {
142 switch (orientation) {
147 throw new IllegalArgumentException ("orientation must be one of: VERTICAL, HORIZONTAL");
150 Clazz.defineMethod (c$, "addSeparator",
152 this.addSeparator (null);
154 Clazz.defineMethod (c$, "addSeparator",
156 var s = new javax.swing.JToolBar.Separator (size);
158 }, "java.awt.Dimension");
159 Clazz.defineMethod (c$, "add",
161 var b = this.createActionComponent (a);
165 }, "javax.swing.Action");
166 Clazz.defineMethod (c$, "createActionComponent",
168 var b = ((Clazz.isClassDefined ("javax.swing.JToolBar$1") ? 0 : javax.swing.JToolBar.$JToolBar$1$ ()), Clazz.innerTypeInstance (javax.swing.JToolBar$1, this, null));
169 if (a != null && (a.getValue ("SmallIcon") != null || a.getValue ("SwingLargeIconKey") != null)) {
170 b.setHideActionText (true);
171 }b.setHorizontalTextPosition (0);
172 b.setVerticalTextPosition (3);
174 }, "javax.swing.Action");
175 Clazz.defineMethod (c$, "createActionChangeListener",
178 }, "javax.swing.JButton");
179 Clazz.overrideMethod (c$, "addImpl",
180 function (comp, constraints, index) {
181 if (Clazz.instanceOf (comp, javax.swing.JToolBar.Separator)) {
182 if (this.getOrientation () == 1) {
183 (comp).setOrientation (0);
185 (comp).setOrientation (1);
186 }}this.addImplSAEM (comp, constraints, index);
187 if (Clazz.instanceOf (comp, javax.swing.JButton)) {
188 (comp).setDefaultCapable (false);
190 }, "java.awt.Component,~O,~N");
191 Clazz.defineMethod (c$, "paramString",
193 var paintBorderString = (this.$paintBorder ? "true" : "false");
194 var marginString = (this.margin != null ? this.margin.toString () : "");
195 var floatableString = (this.floatable ? "true" : "false");
196 var orientationString = (this.orientation == 0 ? "HORIZONTAL" : "VERTICAL");
197 return Clazz.superCall (this, javax.swing.JToolBar, "paramString", []) + ",floatable=" + floatableString + ",margin=" + marginString + ",orientation=" + orientationString + ",paintBorder=" + paintBorderString;
199 Clazz.defineMethod (c$, "setLayout",
201 var oldMgr = this.getLayout ();
202 if (Clazz.instanceOf (oldMgr, java.beans.PropertyChangeListener)) {
203 this.removePropertyChangeListener (oldMgr);
204 }Clazz.superCall (this, javax.swing.JToolBar, "setLayout", [mgr]);
205 }, "java.awt.LayoutManager");
206 c$.$JToolBar$DefaultToolBarLayout$ = function () {
208 c$ = Clazz.decorateAsClass (function () {
209 Clazz.prepareCallback (this, arguments);
211 Clazz.instantialize (this, arguments);
212 }, javax.swing.JToolBar, "DefaultToolBarLayout", null, [java.awt.LayoutManager2, java.beans.PropertyChangeListener, javax.swing.plaf.UIResource]);
213 Clazz.makeConstructor (c$,
216 this.lm = new javax.swing.BoxLayout (this.b$["javax.swing.JToolBar"], 3);
218 this.lm = new javax.swing.BoxLayout (this.b$["javax.swing.JToolBar"], 2);
220 Clazz.defineMethod (c$, "addLayoutComponent",
222 this.lm.addLayoutComponent (a, b);
223 }, "~S,java.awt.Component");
224 Clazz.defineMethod (c$, "addLayoutComponent",
226 this.lm.addLayoutComponent (a, b);
227 }, "java.awt.Component,~O");
228 Clazz.overrideMethod (c$, "removeLayoutComponent",
230 this.lm.removeLayoutComponent (a);
231 }, "java.awt.Component");
232 Clazz.overrideMethod (c$, "preferredLayoutSize",
234 return this.lm.preferredLayoutSize (a);
235 }, "java.awt.Container");
236 Clazz.overrideMethod (c$, "minimumLayoutSize",
238 return this.lm.minimumLayoutSize (a);
239 }, "java.awt.Container");
240 Clazz.overrideMethod (c$, "maximumLayoutSize",
242 return this.lm.maximumLayoutSize (a);
243 }, "java.awt.Container");
244 Clazz.overrideMethod (c$, "layoutContainer",
246 this.lm.layoutContainer (a);
247 }, "java.awt.Container");
248 Clazz.overrideMethod (c$, "getLayoutAlignmentX",
250 return this.lm.getLayoutAlignmentX (a);
251 }, "java.awt.Container");
252 Clazz.overrideMethod (c$, "getLayoutAlignmentY",
254 return this.lm.getLayoutAlignmentY (a);
255 }, "java.awt.Container");
256 Clazz.overrideMethod (c$, "invalidateLayout",
258 this.lm.invalidateLayout (a);
259 }, "java.awt.Container");
260 Clazz.overrideMethod (c$, "propertyChange",
262 var b = a.getPropertyName ();
263 if (b.equals ("orientation")) {
264 var c = (a.getNewValue ()).intValue ();
265 if (c == 1) this.lm = new javax.swing.BoxLayout (this.b$["javax.swing.JToolBar"], 3);
267 this.lm = new javax.swing.BoxLayout (this.b$["javax.swing.JToolBar"], 2);
268 }}}, "java.beans.PropertyChangeEvent");
271 c$.$JToolBar$1$ = function () {
273 c$ = Clazz.declareAnonymous (javax.swing, "JToolBar$1", javax.swing.JButton);
274 Clazz.defineMethod (c$, "createActionPropertyChangeListener",
276 var pcl = this.b$["javax.swing.JToolBar"].createActionChangeListener (this);
278 pcl = Clazz.superCall (this, javax.swing.JToolBar$1, "createActionPropertyChangeListener", [a]);
280 }, "javax.swing.Action");
284 c$ = Clazz.decorateAsClass (function () {
285 this.separatorSize = null;
286 Clazz.instantialize (this, arguments);
287 }, javax.swing.JToolBar, "Separator", javax.swing.JSeparator);
288 Clazz.makeConstructor (c$,
290 this.construct (null);
292 Clazz.makeConstructor (c$,
294 Clazz.superConstructor (this, javax.swing.JToolBar.Separator, [0]);
295 this.setSeparatorSize (a);
296 }, "java.awt.Dimension");
297 Clazz.overrideMethod (c$, "getUIClassID",
299 return "ToolBarSeparatorUI";
301 Clazz.defineMethod (c$, "setSeparatorSize",
304 this.separatorSize = a;
306 Clazz.superCall (this, javax.swing.JToolBar.Separator, "updateUI", []);
308 }, "java.awt.Dimension");
309 Clazz.defineMethod (c$, "getSeparatorSize",
311 return this.separatorSize;
313 Clazz.defineMethod (c$, "getMinimumSize",
315 if (this.separatorSize != null) {
316 return this.separatorSize.getSize ();
318 return Clazz.superCall (this, javax.swing.JToolBar.Separator, "getMinimumSize", []);
320 Clazz.defineMethod (c$, "getMaximumSize",
322 if (this.separatorSize != null) {
323 return this.separatorSize.getSize ();
325 return Clazz.superCall (this, javax.swing.JToolBar.Separator, "getMaximumSize", []);
327 Clazz.overrideMethod (c$, "getPreferredSize",
329 if (this.separatorSize != null) {
330 return this.separatorSize.getSize ();
332 return this.getPrefSizeJComp ();
335 Clazz.defineStatics (c$,
336 "$uiClassID", "ToolBarUI");