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