harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From a...@apache.org
Subject svn commit: r572950 - in /harmony/enhanced/classlib/trunk/modules/swing/src/main/java/common/javax/swing: DefaultButtonModel.java JToggleButton.java
Date Wed, 05 Sep 2007 13:34:56 GMT
Author: ayza
Date: Wed Sep  5 06:34:51 2007
New Revision: 572950

URL: http://svn.apache.org/viewvc?rev=572950&view=rev
Log:
Applying patch from HARMONY-4658 ([classlib][swing][compartibility] The order of ItemStateChanged
events in buttonGroup is differs from RI)

Modified:
    harmony/enhanced/classlib/trunk/modules/swing/src/main/java/common/javax/swing/DefaultButtonModel.java
    harmony/enhanced/classlib/trunk/modules/swing/src/main/java/common/javax/swing/JToggleButton.java

Modified: harmony/enhanced/classlib/trunk/modules/swing/src/main/java/common/javax/swing/DefaultButtonModel.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/swing/src/main/java/common/javax/swing/DefaultButtonModel.java?rev=572950&r1=572949&r2=572950&view=diff
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/swing/src/main/java/common/javax/swing/DefaultButtonModel.java
(original)
+++ harmony/enhanced/classlib/trunk/modules/swing/src/main/java/common/javax/swing/DefaultButtonModel.java
Wed Sep  5 06:34:51 2007
@@ -220,8 +220,10 @@
             listeners[i].actionPerformed(event);
         }
     }
-
-    private void toggleState(int stateFlag) {
+    
+    void toggleState(int stateFlag) {
+        // visibility is changed from private to default because according to
+        // HARMONY-4658 patch the method is needed by ToggleButtonModel
         stateMask ^= stateFlag;
         fireStateChanged();
     }

Modified: harmony/enhanced/classlib/trunk/modules/swing/src/main/java/common/javax/swing/JToggleButton.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/swing/src/main/java/common/javax/swing/JToggleButton.java?rev=572950&r1=572949&r2=572950&view=diff
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/swing/src/main/java/common/javax/swing/JToggleButton.java
(original)
+++ harmony/enhanced/classlib/trunk/modules/swing/src/main/java/common/javax/swing/JToggleButton.java
Wed Sep  5 06:34:51 2007
@@ -46,6 +46,8 @@
     };
 
     public static class ToggleButtonModel extends DefaultButtonModel {
+        
+        @Override
         public void setPressed(final boolean pressed) {
             boolean oldPressed = isPressed();
             if (oldPressed != pressed && !pressed && isArmed()) {
@@ -54,13 +56,30 @@
             super.setPressed(pressed);
         }
 
-        public void setSelected(final boolean selected) {
-            if (group != null && group.getSelection() == this) {
-                return;
-            }
-            super.setSelected(selected);
-            if (selected && group != null) {
-                group.setSelected(this, true);
+        @Override
+        public void setSelected(boolean selected) {
+            // The method changed according to HARMONY-4658.
+            // Now super.setSelected(selected) divided if group!=null
+            if (group != null) {
+            
+                if (group.getSelection() == this) {
+                    return;
+                }
+                
+                toggleState(SELECTED);
+                
+                if (selected) {
+                    group.setSelected(this, true);
+                }
+                
+                int state = selected ? ItemEvent.SELECTED
+                        : ItemEvent.DESELECTED;
+                ItemEvent event = new ItemEvent(this,
+                        ItemEvent.ITEM_STATE_CHANGED, this, state);
+                fireItemStateChanged(event);
+                
+            } else {
+                super.setSelected(selected);
             }
         }
     }



Mime
View raw message