Revert "* Bug 16633: now Listbox callback can be triggered by item click" 38/21738/2
St├ęphane MOTTELET [Wed, 21 Apr 2021 12:56:27 +0000 (14:56 +0200)]
There are redundant callbacks, which are unavoidable.

This reverts commit bea89839ef0b59f42eb320f5da8f45c6a97435ef.

Change-Id: I5bc1d93407c6f382d2c686df4df462355c5b19c0

scilab/CHANGES.md
scilab/modules/gui/src/java/org/scilab/modules/gui/bridge/listbox/SwingScilabListBox.java

index babde46..13058a9 100644 (file)
@@ -227,7 +227,6 @@ Feature changes and additions on 6.1.1
 * `gamma` is extended to incomplete gamma integrals.
 * `close` is extended to close the help browser, xcos, or the variables browser or editor GUIs.
 * `polyint` is introduced to compute polynomial antiderivatives.
-* Listbox uicontrol callback is now triggered by item click in single selection mode. For example, it allows successive execution of a demo in the demonstrations gui.
 * `det` is now actually extended to sparse matrices.
 * `deff` is upgraded:
    - The created function may be returned  as output argument.
index 4de22e7..e62cc01 100644 (file)
@@ -31,8 +31,6 @@ import java.awt.Font;
 import java.awt.event.AdjustmentEvent;
 import java.awt.event.AdjustmentListener;
 import java.io.IOException;
-import java.awt.event.MouseAdapter;
-import java.awt.event.MouseEvent;
 
 import javax.swing.DefaultListModel;
 import javax.swing.Icon;
@@ -142,21 +140,13 @@ public class SwingScilabListBox extends JScrollPane implements SwingViewObject,
                 }
 
                 GraphicController.getController().setProperty(uid, __GO_UI_VALUE__, scilabIndices);
-                if (callback != null && getList().getSelectionMode() == ListSelectionModel.MULTIPLE_INTERVAL_SELECTION) {
+                if (callback != null) {
                     callback.actionPerformed(null);
                 }
             }
         };
         getList().addListSelectionListener(listListener);
 
-         getList().addMouseListener(new MouseAdapter() {
-            public void mouseReleased(MouseEvent evt) {
-                if (callback != null && getList().getSelectionMode() == ListSelectionModel.SINGLE_SELECTION) {
-                    callback.actionPerformed(null);
-                }
-            }
-        });
-
         adjustmentListener = new AdjustmentListener() {
             public void adjustmentValueChanged(AdjustmentEvent arg0) {
                 int listboxtopValue = getList().getUI().locationToIndex(getList(), getViewport().getViewPosition()) + 1;