diff options
author | John Alhroos <john.ahlroos@itmill.com> | 2010-06-01 07:24:53 +0000 |
---|---|---|
committer | John Alhroos <john.ahlroos@itmill.com> | 2010-06-01 07:24:53 +0000 |
commit | 57ee892bcd00ecc982448d6cc31c51a855da367e (patch) | |
tree | d15d65df3e39808ebf3f4b985b1ab03e4758078e /src/com/vaadin | |
parent | 12b497721d9bf44f33c611d07d5327eb815ca708 (diff) | |
download | vaadin-framework-57ee892bcd00ecc982448d6cc31c51a855da367e.tar.gz vaadin-framework-57ee892bcd00ecc982448d6cc31c51a855da367e.zip |
Fix for #3699
svn changeset:13451/svn branch:6.3
Diffstat (limited to 'src/com/vaadin')
-rw-r--r-- | src/com/vaadin/terminal/gwt/client/ui/VTwinColSelect.java | 34 |
1 files changed, 31 insertions, 3 deletions
diff --git a/src/com/vaadin/terminal/gwt/client/ui/VTwinColSelect.java b/src/com/vaadin/terminal/gwt/client/ui/VTwinColSelect.java index 880144a11b..a4d53ed837 100644 --- a/src/com/vaadin/terminal/gwt/client/ui/VTwinColSelect.java +++ b/src/com/vaadin/terminal/gwt/client/ui/VTwinColSelect.java @@ -8,6 +8,8 @@ import java.util.ArrayList; import java.util.Iterator;
import com.google.gwt.event.dom.client.ClickEvent;
+import com.google.gwt.event.dom.client.MouseDownEvent;
+import com.google.gwt.event.dom.client.MouseDownHandler;
import com.google.gwt.user.client.DOM;
import com.google.gwt.user.client.ui.FlowPanel;
import com.google.gwt.user.client.ui.HTML;
@@ -15,7 +17,8 @@ import com.google.gwt.user.client.ui.ListBox; import com.google.gwt.user.client.ui.Panel;
import com.vaadin.terminal.gwt.client.UIDL;
-public class VTwinColSelect extends VOptionGroupBase {
+public class VTwinColSelect extends VOptionGroupBase implements
+ MouseDownHandler {
private static final String CLASSNAME = "v-select-twincol";
@@ -31,9 +34,9 @@ public class VTwinColSelect extends VOptionGroupBase { private final VButton remove;
- private FlowPanel buttons;
+ private final FlowPanel buttons;
- private Panel panel;
+ private final Panel panel;
private boolean widthSet = false;
@@ -64,6 +67,9 @@ public class VTwinColSelect extends VOptionGroupBase { buttons.add(remove);
panel.add(buttons);
panel.add(selections);
+
+ options.addMouseDownHandler(this);
+ selections.addMouseDownHandler(this);
}
@Override
@@ -241,4 +247,26 @@ public class VTwinColSelect extends VOptionGroupBase { public void focus() {
options.setFocus(true);
}
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * com.google.gwt.event.dom.client.MouseDownHandler#onMouseDown(com.google
+ * .gwt.event.dom.client.MouseDownEvent)
+ */
+ public void onMouseDown(MouseDownEvent event) {
+ // Ensure that items are deselected when selecting
+ // from a different source. See #3699 for details.
+ if (event.getSource() == options) {
+ for (int i = 0; i < selections.getItemCount(); i++) {
+ selections.setItemSelected(i, false);
+ }
+ } else if (event.getSource() == selections) {
+ for (int i = 0; i < options.getItemCount(); i++) {
+ options.setItemSelected(i, false);
+ }
+ }
+
+ }
}
|