1 Clazz.declarePackage ("javax.swing");
2 Clazz.load (["java.awt.ItemSelectable", "java.awt.event.ActionListener", "$.ItemListener", "javax.swing.ActionPropertyChangeListener", "$.JComponent", "$.SwingConstants", "javax.swing.event.ChangeListener"], "javax.swing.AbstractButton", ["java.lang.Boolean", "$.IllegalArgumentException", "java.awt.event.ActionEvent", "$.ItemEvent", "javax.swing.AbstractAction", "$.DefaultButtonModel", "$.OverlayLayout", "$.SwingUtilities", "$.UIManager", "javax.swing.event.ChangeEvent", "javax.swing.plaf.UIResource"], function () {
3 c$ = Clazz.decorateAsClass (function () {
7 this.defaultMargin = null;
8 this.defaultIcon = null;
9 this.pressedIcon = null;
10 this.disabledIcon = null;
11 this.selectedIcon = null;
12 this.disabledSelectedIcon = null;
13 this.rolloverIcon = null;
14 this.rolloverSelectedIcon = null;
15 this.$paintBorder = true;
16 this.paintFocus = true;
17 this.rolloverEnabled = false;
18 this.contentAreaFilled = true;
19 this.verticalAlignment = 0;
20 this.horizontalAlignment = 0;
21 this.verticalTextPosition = 0;
22 this.horizontalTextPosition = 11;
25 this.mnemonicIndex = -1;
26 this.multiClickThreshhold = 0;
27 this.borderPaintedSet = false;
28 this.rolloverEnabledSet = false;
29 this.iconTextGapSet = false;
30 this.contentAreaFilledSet = false;
31 this.$setLayout = false;
32 this.defaultCapable = true;
34 this.changeListener = null;
35 this.actionListener = null;
36 this.itemListener = null;
37 this.changeEvent = null;
38 this.hideActionText = false;
40 this.actionPropertyChangeListener = null;
41 if (!Clazz.isClassDefined ("javax.swing.AbstractButton.ButtonChangeListener")) {
42 javax.swing.AbstractButton.$AbstractButton$ButtonChangeListener$ ();
44 if (!Clazz.isClassDefined ("javax.swing.AbstractButton.Handler")) {
45 javax.swing.AbstractButton.$AbstractButton$Handler$ ();
47 Clazz.instantialize (this, arguments);
48 }, javax.swing, "AbstractButton", javax.swing.JComponent, [java.awt.ItemSelectable, javax.swing.SwingConstants]);
49 Clazz.defineMethod (c$, "setHideActionText",
50 function (hideActionText) {
51 if (hideActionText != this.hideActionText) {
52 this.hideActionText = hideActionText;
53 if (this.getAction () != null) {
54 this.setTextFromAction (this.getAction (), false);
55 }this.firePropertyChangeBool ("hideActionText", !hideActionText, hideActionText);
57 Clazz.defineMethod (c$, "getHideActionText",
59 return this.hideActionText;
61 Clazz.defineMethod (c$, "getText",
65 Clazz.defineMethod (c$, "setText",
67 var oldValue = this.text;
69 this.firePropertyChangeObject ("text", oldValue, text);
70 this.updateDisplayedMnemonicIndex (text, this.getMnemonic ());
71 if (text == null || oldValue == null || !text.equals (oldValue)) {
75 Clazz.defineMethod (c$, "isSelected",
77 return this.model.isSelected ();
79 Clazz.defineMethod (c$, "setSelected",
81 this.model.setSelected (b);
83 Clazz.defineMethod (c$, "doClick",
87 Clazz.defineMethod (c$, "doClick",
88 function (pressTime) {
90 Clazz.defineMethod (c$, "setMargin",
92 if (Clazz.instanceOf (m, javax.swing.plaf.UIResource)) {
93 this.defaultMargin = m;
94 } else if (Clazz.instanceOf (this.margin, javax.swing.plaf.UIResource)) {
95 this.defaultMargin = this.margin;
96 }if (m == null && this.defaultMargin != null) {
97 m = this.defaultMargin;
98 }var old = this.margin;
100 this.firePropertyChangeObject ("margin", old, m);
101 if (old == null || !old.equals (m)) {
104 }}, "java.awt.Insets");
105 Clazz.defineMethod (c$, "getMargin",
107 return (this.margin == null) ? null : this.margin.clone ();
109 Clazz.defineMethod (c$, "getIcon",
111 return this.defaultIcon;
113 Clazz.defineMethod (c$, "setIcon",
114 function (defaultIcon) {
115 var oldValue = this.defaultIcon;
116 this.defaultIcon = defaultIcon;
117 if (defaultIcon !== oldValue && (Clazz.instanceOf (this.disabledIcon, javax.swing.plaf.UIResource))) {
118 this.disabledIcon = null;
119 }this.firePropertyChangeObject ("icon", oldValue, defaultIcon);
120 if (defaultIcon !== oldValue) {
121 if (defaultIcon == null || oldValue == null || defaultIcon.getIconWidth () != oldValue.getIconWidth () || defaultIcon.getIconHeight () != oldValue.getIconHeight ()) {
124 }}, "javax.swing.Icon");
125 Clazz.defineMethod (c$, "getPressedIcon",
127 return this.pressedIcon;
129 Clazz.defineMethod (c$, "setPressedIcon",
130 function (pressedIcon) {
131 var oldValue = this.pressedIcon;
132 this.pressedIcon = pressedIcon;
133 this.firePropertyChangeObject ("pressedIcon", oldValue, pressedIcon);
134 if (pressedIcon !== oldValue) {
135 if (this.getModel ().isPressed ()) {
137 }}}, "javax.swing.Icon");
138 Clazz.defineMethod (c$, "getSelectedIcon",
140 return this.selectedIcon;
142 Clazz.defineMethod (c$, "setSelectedIcon",
143 function (selectedIcon) {
144 var oldValue = this.selectedIcon;
145 this.selectedIcon = selectedIcon;
146 if (selectedIcon !== oldValue && Clazz.instanceOf (this.disabledSelectedIcon, javax.swing.plaf.UIResource)) {
147 this.disabledSelectedIcon = null;
148 }this.firePropertyChangeObject ("selectedIcon", oldValue, selectedIcon);
149 if (selectedIcon !== oldValue) {
150 if (this.isSelected ()) {
152 }}}, "javax.swing.Icon");
153 Clazz.defineMethod (c$, "getRolloverIcon",
155 return this.rolloverIcon;
157 Clazz.defineMethod (c$, "setRolloverIcon",
158 function (rolloverIcon) {
159 var oldValue = this.rolloverIcon;
160 this.rolloverIcon = rolloverIcon;
161 this.firePropertyChangeObject ("rolloverIcon", oldValue, rolloverIcon);
162 this.setRolloverEnabled (true);
163 if (rolloverIcon !== oldValue) {
165 }}, "javax.swing.Icon");
166 Clazz.defineMethod (c$, "getRolloverSelectedIcon",
168 return this.rolloverSelectedIcon;
170 Clazz.defineMethod (c$, "setRolloverSelectedIcon",
171 function (rolloverSelectedIcon) {
172 var oldValue = this.rolloverSelectedIcon;
173 this.rolloverSelectedIcon = rolloverSelectedIcon;
174 this.firePropertyChangeObject ("rolloverSelectedIcon", oldValue, rolloverSelectedIcon);
175 this.setRolloverEnabled (true);
176 if (rolloverSelectedIcon !== oldValue) {
177 if (this.isSelected ()) {
179 }}}, "javax.swing.Icon");
180 Clazz.defineMethod (c$, "getDisabledIcon",
182 if (this.disabledIcon == null) {
183 this.disabledIcon = javax.swing.UIManager.getLookAndFeel ().getDisabledIcon (this, this.getIcon ());
184 if (this.disabledIcon != null) {
185 this.firePropertyChangeObject ("disabledIcon", null, this.disabledIcon);
186 }}return this.disabledIcon;
188 Clazz.defineMethod (c$, "setDisabledIcon",
189 function (disabledIcon) {
190 var oldValue = this.disabledIcon;
191 this.disabledIcon = disabledIcon;
192 this.firePropertyChangeObject ("disabledIcon", oldValue, disabledIcon);
193 if (disabledIcon !== oldValue) {
194 if (!this.isEnabled ()) {
196 }}}, "javax.swing.Icon");
197 Clazz.defineMethod (c$, "getDisabledSelectedIcon",
199 if (this.disabledSelectedIcon == null) {
200 if (this.selectedIcon != null) {
201 this.disabledSelectedIcon = javax.swing.UIManager.getLookAndFeel ().getDisabledSelectedIcon (this, this.getSelectedIcon ());
203 return this.getDisabledIcon ();
204 }}return this.disabledSelectedIcon;
206 Clazz.defineMethod (c$, "setDisabledSelectedIcon",
207 function (disabledSelectedIcon) {
208 var oldValue = this.disabledSelectedIcon;
209 this.disabledSelectedIcon = disabledSelectedIcon;
210 this.firePropertyChangeObject ("disabledSelectedIcon", oldValue, disabledSelectedIcon);
211 if (disabledSelectedIcon !== oldValue) {
212 if (disabledSelectedIcon == null || oldValue == null || disabledSelectedIcon.getIconWidth () != oldValue.getIconWidth () || disabledSelectedIcon.getIconHeight () != oldValue.getIconHeight ()) {
214 }if (!this.isEnabled () && this.isSelected ()) {
216 }}}, "javax.swing.Icon");
217 Clazz.defineMethod (c$, "getVerticalAlignment",
219 return this.verticalAlignment;
221 Clazz.defineMethod (c$, "setVerticalAlignment",
222 function (alignment) {
223 if (alignment == this.verticalAlignment) return;
224 var oldValue = this.verticalAlignment;
225 this.verticalAlignment = this.checkVerticalKey (alignment, "verticalAlignment");
226 this.firePropertyChangeInt ("verticalAlignment", oldValue, this.verticalAlignment);
229 Clazz.defineMethod (c$, "getHorizontalAlignment",
231 return this.horizontalAlignment;
233 Clazz.defineMethod (c$, "setHorizontalAlignment",
234 function (alignment) {
235 if (alignment == this.horizontalAlignment) return;
236 var oldValue = this.horizontalAlignment;
237 this.horizontalAlignment = this.checkHorizontalKey (alignment, "horizontalAlignment");
238 this.firePropertyChangeInt ("horizontalAlignment", oldValue, this.horizontalAlignment);
241 Clazz.defineMethod (c$, "getVerticalTextPosition",
243 return this.verticalTextPosition;
245 Clazz.defineMethod (c$, "setVerticalTextPosition",
246 function (textPosition) {
247 if (textPosition == this.verticalTextPosition) return;
248 var oldValue = this.verticalTextPosition;
249 this.verticalTextPosition = this.checkVerticalKey (textPosition, "verticalTextPosition");
250 this.firePropertyChangeInt ("verticalTextPosition", oldValue, this.verticalTextPosition);
254 Clazz.defineMethod (c$, "getHorizontalTextPosition",
256 return this.horizontalTextPosition;
258 Clazz.defineMethod (c$, "setHorizontalTextPosition",
259 function (textPosition) {
260 if (textPosition == this.horizontalTextPosition) return;
261 var oldValue = this.horizontalTextPosition;
262 this.horizontalTextPosition = this.checkHorizontalKey (textPosition, "horizontalTextPosition");
263 this.firePropertyChangeInt ("horizontalTextPosition", oldValue, this.horizontalTextPosition);
267 Clazz.defineMethod (c$, "getIconTextGap",
269 return this.iconTextGap;
271 Clazz.defineMethod (c$, "setIconTextGap",
272 function (iconTextGap) {
273 var oldValue = this.iconTextGap;
274 this.iconTextGap = iconTextGap;
275 this.iconTextGapSet = true;
276 this.firePropertyChangeInt ("iconTextGap", oldValue, iconTextGap);
277 if (iconTextGap != oldValue) {
281 Clazz.defineMethod (c$, "checkHorizontalKey",
282 function (key, exception) {
283 if ((key == 2) || (key == 0) || (key == 4) || (key == 10) || (key == 11)) {
286 throw new IllegalArgumentException (exception);
288 Clazz.defineMethod (c$, "checkVerticalKey",
289 function (key, exception) {
290 if ((key == 1) || (key == 0) || (key == 3)) {
293 throw new IllegalArgumentException (exception);
295 Clazz.defineMethod (c$, "removeNotify",
297 Clazz.superCall (this, javax.swing.AbstractButton, "removeNotify", []);
298 if (this.isRolloverEnabled ()) {
299 this.getModel ().setRollover (false);
301 Clazz.defineMethod (c$, "setActionCommand",
302 function (actionCommand) {
303 this.getModel ().setActionCommand (actionCommand);
305 Clazz.defineMethod (c$, "getActionCommand",
307 var ac = this.getModel ().getActionCommand ();
309 ac = this.getText ();
312 Clazz.defineMethod (c$, "setAction",
314 var oldValue = this.getAction ();
315 if (this.$action == null || !this.$action.equals (a)) {
317 if (oldValue != null) {
318 this.removeActionListener (oldValue);
319 oldValue.removePropertyChangeListener (this.actionPropertyChangeListener);
320 this.actionPropertyChangeListener = null;
321 }this.configurePropertiesFromAction (this.$action);
322 if (this.$action != null) {
323 if (!this.isListener (java.awt.event.ActionListener, this.$action)) {
324 this.addActionListener (this.$action);
325 }this.actionPropertyChangeListener = this.createActionPropertyChangeListener (this.$action);
326 this.$action.addPropertyChangeListener (this.actionPropertyChangeListener);
327 }this.firePropertyChangeObject ("action", oldValue, this.$action);
328 }}, "javax.swing.Action");
329 Clazz.defineMethod (c$, "isListener",
331 var isListener = false;
332 var listeners = this.listenerList.getListenerList ();
333 for (var i = listeners.length - 2; i >= 0; i -= 2) {
334 if (listeners[i] === c && listeners[i + 1] === a) {
338 }, "Class,java.awt.event.ActionListener");
339 Clazz.defineMethod (c$, "getAction",
343 Clazz.defineMethod (c$, "configurePropertiesFromAction",
345 this.setMnemonicFromAction (a);
346 this.setTextFromAction (a, false);
347 javax.swing.AbstractAction.setToolTipTextFromAction (this, a);
348 this.setIconFromAction (a);
349 this.setActionCommandFromAction (a);
350 javax.swing.AbstractAction.setEnabledFromAction (this, a);
351 if (javax.swing.AbstractAction.hasSelectedKey (a) && this.shouldUpdateSelectedStateFromAction ()) {
352 this.setSelectedFromAction (a);
353 }this.setDisplayedMnemonicIndexFromAction (a, false);
354 }, "javax.swing.Action");
355 Clazz.overrideMethod (c$, "clientPropertyChanged",
356 function (key, oldValue, newValue) {
357 if (key === "hideActionText") {
358 var current = (Clazz.instanceOf (newValue, Boolean)) ? newValue : false;
359 if (this.getHideActionText () != current) {
360 this.setHideActionText (current);
362 Clazz.defineMethod (c$, "shouldUpdateSelectedStateFromAction",
366 Clazz.defineMethod (c$, "actionPropertyChanged",
367 function (action, propertyName) {
368 if (propertyName === "Name") {
369 this.setTextFromAction (action, true);
370 } else if (propertyName === "enabled") {
371 javax.swing.AbstractAction.setEnabledFromAction (this, action);
372 } else if (propertyName === "ShortDescription") {
373 javax.swing.AbstractAction.setToolTipTextFromAction (this, action);
374 } else if (propertyName === "SmallIcon") {
375 this.smallIconChanged (action);
376 } else if (propertyName === "MnemonicKey") {
377 this.setMnemonicFromAction (action);
378 } else if (propertyName === "ActionCommandKey") {
379 this.setActionCommandFromAction (action);
380 } else if (propertyName === "SwingSelectedKey" && javax.swing.AbstractAction.hasSelectedKey (action) && this.shouldUpdateSelectedStateFromAction ()) {
381 this.setSelectedFromAction (action);
382 } else if (propertyName === "SwingDisplayedMnemonicIndexKey") {
383 this.setDisplayedMnemonicIndexFromAction (action, true);
384 } else if (propertyName === "SwingLargeIconKey") {
385 this.largeIconChanged (action);
386 }}, "javax.swing.Action,~S");
387 Clazz.defineMethod (c$, "setDisplayedMnemonicIndexFromAction",
388 function (a, fromPropertyChange) {
389 var iValue = (a == null) ? null : a.getValue ("SwingDisplayedMnemonicIndexKey");
390 if (fromPropertyChange || iValue != null) {
392 if (iValue == null) {
395 value = (iValue).intValue ();
396 var text = this.getText ();
397 if (text == null || value >= text.length) {
399 }}this.setDisplayedMnemonicIndex (value);
400 }}, "javax.swing.Action,~B");
401 Clazz.defineMethod (c$, "setMnemonicFromAction",
403 var n = (a == null) ? null : a.getValue ("MnemonicKey");
404 this.setMnemonic ((n == null) ? '\0' : n);
405 }, "javax.swing.Action");
406 Clazz.defineMethod (c$, "setTextFromAction",
407 function (a, propertyChange) {
408 var hideText = this.getHideActionText ();
409 if (!propertyChange) {
410 this.setText ((a != null && !hideText) ? a.getValue ("Name") : null);
411 } else if (!hideText) {
412 this.setText (a.getValue ("Name"));
413 }}, "javax.swing.Action,~B");
414 Clazz.defineMethod (c$, "setIconFromAction",
418 icon = a.getValue ("SwingLargeIconKey");
420 icon = a.getValue ("SmallIcon");
421 }}this.setIcon (icon);
422 }, "javax.swing.Action");
423 Clazz.defineMethod (c$, "smallIconChanged",
425 if (a.getValue ("SwingLargeIconKey") == null) {
426 this.setIconFromAction (a);
427 }}, "javax.swing.Action");
428 Clazz.defineMethod (c$, "largeIconChanged",
430 this.setIconFromAction (a);
431 }, "javax.swing.Action");
432 Clazz.defineMethod (c$, "setActionCommandFromAction",
434 this.setActionCommand ((a != null) ? a.getValue ("ActionCommandKey") : null);
435 }, "javax.swing.Action");
436 Clazz.defineMethod (c$, "setSelectedFromAction",
438 var selected = false;
440 selected = javax.swing.AbstractAction.isSelected (a);
441 }if (selected != this.isSelected ()) {
442 this.setSelected (selected);
443 if (!selected && this.isSelected ()) {
444 if (Clazz.instanceOf (this.getModel (), javax.swing.DefaultButtonModel)) {
445 var group = (this.getModel ()).getGroup ();
447 group.clearSelection ();
448 }}}}}, "javax.swing.Action");
449 Clazz.defineMethod (c$, "createActionPropertyChangeListener",
451 return this.createActionPropertyChangeListener0 (a);
452 }, "javax.swing.Action");
453 Clazz.defineMethod (c$, "createActionPropertyChangeListener0",
455 return new javax.swing.AbstractButton.ButtonActionPropertyChangeListener (this, a);
456 }, "javax.swing.Action");
457 Clazz.defineMethod (c$, "isBorderPainted",
459 return this.$paintBorder;
461 Clazz.defineMethod (c$, "setBorderPainted",
463 var oldValue = this.$paintBorder;
464 this.$paintBorder = b;
465 this.borderPaintedSet = true;
466 this.firePropertyChangeBool ("borderPainted", oldValue, this.$paintBorder);
471 Clazz.defineMethod (c$, "paintBorder",
473 if (this.isBorderPainted ()) {
474 Clazz.superCall (this, javax.swing.AbstractButton, "paintBorder", [g]);
475 }}, "java.awt.Graphics");
476 Clazz.defineMethod (c$, "isFocusPainted",
478 return this.paintFocus;
480 Clazz.defineMethod (c$, "setFocusPainted",
482 var oldValue = this.paintFocus;
484 this.firePropertyChangeBool ("focusPainted", oldValue, this.paintFocus);
485 if (b != oldValue && this.isFocusOwner ()) {
489 Clazz.defineMethod (c$, "isContentAreaFilled",
491 return this.contentAreaFilled;
493 Clazz.defineMethod (c$, "setContentAreaFilled",
495 var oldValue = this.contentAreaFilled;
496 this.contentAreaFilled = b;
497 this.contentAreaFilledSet = true;
498 this.firePropertyChangeBool ("contentAreaFilled", oldValue, this.contentAreaFilled);
502 Clazz.defineMethod (c$, "isRolloverEnabled",
504 return this.rolloverEnabled;
506 Clazz.defineMethod (c$, "setRolloverEnabled",
508 var oldValue = this.rolloverEnabled;
509 this.rolloverEnabled = b;
510 this.rolloverEnabledSet = true;
511 this.firePropertyChangeBool ("rolloverEnabled", oldValue, this.rolloverEnabled);
515 Clazz.defineMethod (c$, "getMnemonic",
517 return this.mnemonic;
519 Clazz.defineMethod (c$, "setMnemonic",
520 function (mnemonic) {
521 this.model.setMnemonic (mnemonic);
522 this.updateMnemonicProperties ();
524 Clazz.defineMethod (c$, "setMnemonic",
525 function (mnemonic) {
526 var vk = (mnemonic).charCodeAt (0);
527 if (vk >= 97 && vk <= 122) vk -= (32);
528 this.setMnemonic (vk);
530 Clazz.defineMethod (c$, "setDisplayedMnemonicIndex",
532 var oldValue = this.mnemonicIndex;
534 this.mnemonicIndex = -1;
536 var text = this.getText ();
537 var textLength = (text == null) ? 0 : text.length;
538 if (index < -1 || index >= textLength) {
539 throw new IllegalArgumentException ("index == " + index);
540 }}this.mnemonicIndex = index;
541 this.firePropertyChangeInt ("displayedMnemonicIndex", oldValue, index);
542 if (index != oldValue) {
546 Clazz.defineMethod (c$, "getDisplayedMnemonicIndex",
548 return this.mnemonicIndex;
550 Clazz.defineMethod (c$, "updateDisplayedMnemonicIndex",
551 function (text, mnemonic) {
552 this.setDisplayedMnemonicIndex (javax.swing.SwingUtilities.findDisplayedMnemonicIndex (text, mnemonic));
554 Clazz.defineMethod (c$, "updateMnemonicProperties",
556 var newMnemonic = this.model.getMnemonic ();
557 if (this.mnemonic != newMnemonic) {
558 var oldValue = this.mnemonic;
559 this.mnemonic = newMnemonic;
560 this.firePropertyChangeInt ("mnemonic", oldValue, this.mnemonic);
561 this.updateDisplayedMnemonicIndex (this.getText (), this.mnemonic);
565 Clazz.defineMethod (c$, "setMultiClickThreshhold",
566 function (threshhold) {
567 if (threshhold < 0) {
568 throw new IllegalArgumentException ("threshhold must be >= 0");
569 }this.multiClickThreshhold = threshhold;
571 Clazz.defineMethod (c$, "getMultiClickThreshhold",
573 return this.multiClickThreshhold;
575 Clazz.defineMethod (c$, "getModel",
579 Clazz.defineMethod (c$, "setModel",
580 function (newModel) {
581 var oldModel = this.getModel ();
582 if (oldModel != null) {
583 oldModel.removeChangeListener (this.changeListener);
584 oldModel.removeActionListener (this.actionListener);
585 oldModel.removeItemListener (this.itemListener);
586 this.changeListener = null;
587 this.actionListener = null;
588 this.itemListener = null;
589 }this.model = newModel;
590 if (newModel != null) {
591 this.changeListener = this.createChangeListener ();
592 this.actionListener = this.createActionListener ();
593 this.itemListener = this.createItemListener ();
594 newModel.addChangeListener (this.changeListener);
595 newModel.addActionListener (this.actionListener);
596 newModel.addItemListener (this.itemListener);
597 this.updateMnemonicProperties ();
598 Clazz.superCall (this, javax.swing.AbstractButton, "setEnabled", [newModel.isEnabled ()]);
601 }this.updateDisplayedMnemonicIndex (this.getText (), this.mnemonic);
602 this.firePropertyChangeObject ("model", oldModel, newModel);
603 if (newModel !== oldModel) {
606 }}, "javax.swing.ButtonModel");
607 Clazz.overrideMethod (c$, "getUI",
611 Clazz.defineMethod (c$, "setUI",
613 Clazz.superCall (this, javax.swing.AbstractButton, "setUI", [ui]);
614 if (Clazz.instanceOf (this.disabledIcon, javax.swing.plaf.UIResource)) {
615 this.setDisabledIcon (null);
616 }if (Clazz.instanceOf (this.disabledSelectedIcon, javax.swing.plaf.UIResource)) {
617 this.setDisabledSelectedIcon (null);
618 }}, "javax.swing.plaf.ButtonUI");
619 Clazz.overrideMethod (c$, "updateUI",
622 Clazz.overrideMethod (c$, "addImpl",
623 function (comp, constraints, index) {
624 if (!this.$setLayout) {
625 this.setLayout ( new javax.swing.OverlayLayout (this));
626 }return this.addImplSAEM (comp, constraints, index);
627 }, "java.awt.Component,~O,~N");
628 Clazz.defineMethod (c$, "setLayout",
630 this.$setLayout = true;
631 Clazz.superCall (this, javax.swing.AbstractButton, "setLayout", [mgr]);
632 }, "java.awt.LayoutManager");
633 Clazz.defineMethod (c$, "addChangeListener",
635 this.listenerList.add (javax.swing.event.ChangeListener, l);
636 }, "javax.swing.event.ChangeListener");
637 Clazz.defineMethod (c$, "removeChangeListener",
639 this.listenerList.remove (javax.swing.event.ChangeListener, l);
640 }, "javax.swing.event.ChangeListener");
641 Clazz.defineMethod (c$, "getChangeListeners",
643 return (this.listenerList.getListeners (javax.swing.event.ChangeListener));
645 Clazz.defineMethod (c$, "fireStateChanged",
647 var listeners = this.listenerList.getListenerList ();
648 for (var i = listeners.length - 2; i >= 0; i -= 2) {
649 if (listeners[i] === javax.swing.event.ChangeListener) {
650 if (this.changeEvent == null) this.changeEvent = new javax.swing.event.ChangeEvent (this);
651 (listeners[i + 1]).stateChanged (this.changeEvent);
654 Clazz.defineMethod (c$, "addActionListener",
656 this.listenerList.add (java.awt.event.ActionListener, l);
657 }, "java.awt.event.ActionListener");
658 Clazz.defineMethod (c$, "removeActionListener",
660 if ((l != null) && (this.getAction () === l)) {
661 this.setAction (null);
663 this.listenerList.remove (java.awt.event.ActionListener, l);
664 }}, "java.awt.event.ActionListener");
665 Clazz.defineMethod (c$, "getActionListeners",
667 return (this.listenerList.getListeners (java.awt.event.ActionListener));
669 Clazz.defineMethod (c$, "createChangeListener",
671 return this.getHandler ();
673 Clazz.defineMethod (c$, "fireActionPerformed",
675 var listeners = this.listenerList.getListenerList ();
677 for (var i = listeners.length - 2; i >= 0; i -= 2) {
678 if (listeners[i] === java.awt.event.ActionListener) {
680 var actionCommand = event.getActionCommand ();
681 if (actionCommand == null) {
682 actionCommand = this.getActionCommand ();
683 }e = new java.awt.event.ActionEvent (this, 1001, actionCommand, event.getWhen (), event.getModifiers ());
684 }(listeners[i + 1]).actionPerformed (e);
686 }, "java.awt.event.ActionEvent");
687 Clazz.defineMethod (c$, "fireItemStateChanged",
689 var listeners = this.listenerList.getListenerList ();
691 for (var i = listeners.length - 2; i >= 0; i -= 2) {
692 if (listeners[i] === java.awt.event.ItemListener) {
694 e = new java.awt.event.ItemEvent (this, 701, this, event.getStateChange ());
695 }(listeners[i + 1]).itemStateChanged (e);
697 }, "java.awt.event.ItemEvent");
698 Clazz.defineMethod (c$, "createActionListener",
700 return this.getHandler ();
702 Clazz.defineMethod (c$, "createItemListener",
704 return this.getHandler ();
706 Clazz.defineMethod (c$, "setEnabled",
708 if (!b && this.model.isRollover ()) {
709 this.model.setRollover (false);
710 }Clazz.superCall (this, javax.swing.AbstractButton, "setEnabled", [b]);
711 this.model.setEnabled (b);
713 Clazz.defineMethod (c$, "getLabel",
715 return this.getText ();
717 Clazz.defineMethod (c$, "setLabel",
719 this.setText (label);
721 Clazz.overrideMethod (c$, "addItemListener",
723 this.listenerList.add (java.awt.event.ItemListener, l);
724 }, "java.awt.event.ItemListener");
725 Clazz.overrideMethod (c$, "removeItemListener",
727 this.listenerList.remove (java.awt.event.ItemListener, l);
728 }, "java.awt.event.ItemListener");
729 Clazz.defineMethod (c$, "getItemListeners",
731 return this.listenerList.getListeners (java.awt.event.ItemListener);
733 Clazz.overrideMethod (c$, "getSelectedObjects",
735 if (this.isSelected () == false) {
737 }var selectedObjects = new Array (1);
738 selectedObjects[0] = this.getText ();
739 return selectedObjects;
741 Clazz.defineMethod (c$, "init",
742 function (text, icon) {
748 this.setAlignmentX (0.0);
749 this.setAlignmentY (0.5);
750 }, "~S,javax.swing.Icon");
751 Clazz.defineMethod (c$, "imageUpdate",
752 function (img, infoflags, x, y, w, h) {
753 var iconDisplayed = this.getIcon ();
754 if (iconDisplayed == null) {
756 }if (!this.model.isEnabled ()) {
757 if (this.model.isSelected ()) {
758 iconDisplayed = this.getDisabledSelectedIcon ();
760 iconDisplayed = this.getDisabledIcon ();
761 }} else if (this.model.isPressed () && this.model.isArmed ()) {
762 iconDisplayed = this.getPressedIcon ();
763 } else if (this.isRolloverEnabled () && this.model.isRollover ()) {
764 if (this.model.isSelected ()) {
765 iconDisplayed = this.getRolloverSelectedIcon ();
767 iconDisplayed = this.getRolloverIcon ();
768 }} else if (this.model.isSelected ()) {
769 iconDisplayed = this.getSelectedIcon ();
770 }if (!javax.swing.SwingUtilities.doesIconReferenceImage (iconDisplayed, img)) {
772 }return Clazz.superCall (this, javax.swing.AbstractButton, "imageUpdate", [img, infoflags, x, y, w, h]);
773 }, "java.awt.Image,~N,~N,~N,~N,~N");
774 Clazz.defineMethod (c$, "setUIProperty",
775 function (propertyName, value) {
776 if (propertyName === "borderPainted") {
777 if (!this.borderPaintedSet) {
778 this.setBorderPainted ((value).booleanValue ());
779 this.borderPaintedSet = false;
780 }} else if (propertyName === "rolloverEnabled") {
781 if (!this.rolloverEnabledSet) {
782 this.setRolloverEnabled ((value).booleanValue ());
783 this.rolloverEnabledSet = false;
784 }} else if (propertyName === "iconTextGap") {
785 if (!this.iconTextGapSet) {
786 this.setIconTextGap ((value).intValue ());
787 this.iconTextGapSet = false;
788 }} else if (propertyName === "contentAreaFilled") {
789 if (!this.contentAreaFilledSet) {
790 this.setContentAreaFilled ((value).booleanValue ());
791 this.contentAreaFilledSet = false;
793 Clazz.superCall (this, javax.swing.AbstractButton, "setUIProperty", [propertyName, value]);
795 Clazz.defineMethod (c$, "paramString",
797 var defaultIconString = ((this.defaultIcon != null) && (this.defaultIcon !== this) ? this.defaultIcon.toString () : "");
798 var pressedIconString = ((this.pressedIcon != null) && (this.pressedIcon !== this) ? this.pressedIcon.toString () : "");
799 var disabledIconString = ((this.disabledIcon != null) && (this.disabledIcon !== this) ? this.disabledIcon.toString () : "");
800 var selectedIconString = ((this.selectedIcon != null) && (this.selectedIcon !== this) ? this.selectedIcon.toString () : "");
801 var disabledSelectedIconString = ((this.disabledSelectedIcon != null) && (this.disabledSelectedIcon !== this) ? this.disabledSelectedIcon.toString () : "");
802 var rolloverIconString = ((this.rolloverIcon != null) && (this.rolloverIcon !== this) ? this.rolloverIcon.toString () : "");
803 var rolloverSelectedIconString = ((this.rolloverSelectedIcon != null) && (this.rolloverSelectedIcon !== this) ? this.rolloverSelectedIcon.toString () : "");
804 var paintBorderString = (this.$paintBorder ? "true" : "false");
805 var paintFocusString = (this.paintFocus ? "true" : "false");
806 var rolloverEnabledString = (this.rolloverEnabled ? "true" : "false");
807 return Clazz.superCall (this, javax.swing.AbstractButton, "paramString", []) + ",defaultIcon=" + defaultIconString + ",disabledIcon=" + disabledIconString + ",disabledSelectedIcon=" + disabledSelectedIconString + ",margin=" + this.margin + ",paintBorder=" + paintBorderString + ",paintFocus=" + paintFocusString + ",pressedIcon=" + pressedIconString + ",rolloverEnabled=" + rolloverEnabledString + ",rolloverIcon=" + rolloverIconString + ",rolloverSelectedIcon=" + rolloverSelectedIconString + ",selectedIcon=" + selectedIconString + ",text=" + this.text;
809 Clazz.defineMethod (c$, "getHandler",
811 if (this.handler == null) {
812 this.handler = Clazz.innerTypeInstance (javax.swing.AbstractButton.Handler, this, null);
813 }return this.handler;
815 c$.$AbstractButton$ButtonChangeListener$ = function () {
817 c$ = Clazz.decorateAsClass (function () {
818 Clazz.prepareCallback (this, arguments);
819 Clazz.instantialize (this, arguments);
820 }, javax.swing.AbstractButton, "ButtonChangeListener", null, javax.swing.event.ChangeListener);
821 Clazz.makeConstructor (c$,
824 Clazz.overrideMethod (c$, "stateChanged",
826 this.b$["javax.swing.AbstractButton"].getHandler ().stateChanged (a);
827 }, "javax.swing.event.ChangeEvent");
830 c$.$AbstractButton$Handler$ = function () {
832 c$ = Clazz.decorateAsClass (function () {
833 Clazz.prepareCallback (this, arguments);
834 Clazz.instantialize (this, arguments);
835 }, javax.swing.AbstractButton, "Handler", null, [java.awt.event.ActionListener, javax.swing.event.ChangeListener, java.awt.event.ItemListener]);
836 Clazz.overrideMethod (c$, "stateChanged",
838 this.b$["javax.swing.AbstractButton"].updateMnemonicProperties ();
839 if (this.b$["javax.swing.AbstractButton"].isEnabled () != this.b$["javax.swing.AbstractButton"].model.isEnabled ()) {
840 this.b$["javax.swing.AbstractButton"].setEnabled (this.b$["javax.swing.AbstractButton"].model.isEnabled ());
841 }this.b$["javax.swing.AbstractButton"].fireStateChanged ();
842 this.b$["javax.swing.AbstractButton"].repaint ();
843 }, "javax.swing.event.ChangeEvent");
844 Clazz.overrideMethod (c$, "actionPerformed",
846 this.b$["javax.swing.AbstractButton"].fireActionPerformed (a);
847 }, "java.awt.event.ActionEvent");
848 Clazz.overrideMethod (c$, "itemStateChanged",
850 this.b$["javax.swing.AbstractButton"].fireItemStateChanged (a);
851 if (this.b$["javax.swing.AbstractButton"].shouldUpdateSelectedStateFromAction ()) {
852 var b = this.b$["javax.swing.AbstractButton"].getAction ();
853 if (b != null && javax.swing.AbstractAction.hasSelectedKey (b)) {
854 var c = this.b$["javax.swing.AbstractButton"].isSelected ();
855 var d = javax.swing.AbstractAction.isSelected (b);
857 b.putValue ("SwingSelectedKey", new Boolean (c));
858 }}}}, "java.awt.event.ItemEvent");
862 c$ = Clazz.declareType (javax.swing.AbstractButton, "ButtonActionPropertyChangeListener", javax.swing.ActionPropertyChangeListener);
863 Clazz.overrideMethod (c$, "actionPropertyChanged",
865 if (javax.swing.AbstractAction.shouldReconfigure (c)) {
866 a.configurePropertiesFromAction (b);
868 a.actionPropertyChanged (b, c.getPropertyName ());
869 }}, "javax.swing.AbstractButton,javax.swing.Action,java.beans.PropertyChangeEvent");
871 Clazz.defineStatics (c$,
872 "MODEL_CHANGED_PROPERTY", "model",
873 "TEXT_CHANGED_PROPERTY", "text",
874 "MNEMONIC_CHANGED_PROPERTY", "mnemonic",
875 "MARGIN_CHANGED_PROPERTY", "margin",
876 "VERTICAL_ALIGNMENT_CHANGED_PROPERTY", "verticalAlignment",
877 "HORIZONTAL_ALIGNMENT_CHANGED_PROPERTY", "horizontalAlignment",
878 "VERTICAL_TEXT_POSITION_CHANGED_PROPERTY", "verticalTextPosition",
879 "HORIZONTAL_TEXT_POSITION_CHANGED_PROPERTY", "horizontalTextPosition",
880 "BORDER_PAINTED_CHANGED_PROPERTY", "borderPainted",
881 "FOCUS_PAINTED_CHANGED_PROPERTY", "focusPainted",
882 "ROLLOVER_ENABLED_CHANGED_PROPERTY", "rolloverEnabled",
883 "CONTENT_AREA_FILLED_CHANGED_PROPERTY", "contentAreaFilled",
884 "ICON_CHANGED_PROPERTY", "icon",
885 "PRESSED_ICON_CHANGED_PROPERTY", "pressedIcon",
886 "SELECTED_ICON_CHANGED_PROPERTY", "selectedIcon",
887 "ROLLOVER_ICON_CHANGED_PROPERTY", "rolloverIcon",
888 "ROLLOVER_SELECTED_ICON_CHANGED_PROPERTY", "rolloverSelectedIcon",
889 "DISABLED_ICON_CHANGED_PROPERTY", "disabledIcon",
890 "DISABLED_SELECTED_ICON_CHANGED_PROPERTY", "disabledSelectedIcon");