* Bug #11298 fixed - Listboxes callback was executed several times for one action. 81/9081/3
Bruno JOFRET [Thu, 20 Sep 2012 10:00:08 +0000 (12:00 +0200)]
Change-Id: Ie5f24344baa121a5be0716a545cf53cca4715fdf

scilab/CHANGES_5.4.X
scilab/modules/gui/src/java/org/scilab/modules/gui/bridge/listbox/SwingScilabListBox.java

index f722ea6..1fafaf7 100644 (file)
@@ -83,6 +83,8 @@ Bug Fixes
 
 * Bug #11293 fixed - Line style was not taken into account.
 
+* Bug #11298 fixed - Listboxes callback was executed several times for one action.
+
 * Bug #11489 fixed - 'SliderStep' property was ignored for uicontrols.
 
 * Bug #11558 fixed - Typo in helptools module fixed.
index 0723f96..3285476 100644 (file)
@@ -198,15 +198,18 @@ public class SwingScilabListBox extends JScrollPane implements SwingViewObject,
      *                      (true if the UIElement is enabled, false if not)
      */
     public void setEnabled(boolean newEnableState) {
-        super.setEnabled(newEnableState);
-        getList().setEnabled(newEnableState);
-        if (newEnableState) {
-            if (mouseListener != null) {
-                getList().addMouseListener(mouseListener);
-            }
-        } else {
-            if (mouseListener != null) {
-                getList().removeMouseListener(mouseListener);
+        if (newEnableState != super.isEnabled())
+        {
+            super.setEnabled(newEnableState);
+            getList().setEnabled(newEnableState);
+            if (newEnableState) {
+                if (mouseListener != null) {
+                    getList().addMouseListener(mouseListener);
+                }
+            } else {
+                if (mouseListener != null) {
+                    getList().removeMouseListener(mouseListener);
+                }
             }
         }
     }