summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorArtur Signell <artur@vaadin.com>2012-08-27 13:38:13 +0300
committerArtur Signell <artur@vaadin.com>2012-08-27 13:38:13 +0300
commit5964acd1e7ea2a00681fc49525f4f10e5dfa06fe (patch)
treedc0c01c12664e567c75d9165eb80457a8a7e5c85
parent2af52b6102051fd9289778c35a1a74c58d51bf02 (diff)
parent9a32e217f2cb89887b2a46934b992ff32e880ba1 (diff)
downloadvaadin-framework-5964acd1e7ea2a00681fc49525f4f10e5dfa06fe.tar.gz
vaadin-framework-5964acd1e7ea2a00681fc49525f4f10e5dfa06fe.zip
Merge remote-tracking branch 'origin/6.8'
Conflicts: server/src/com/vaadin/ui/Select.java
-rw-r--r--client/src/com/vaadin/terminal/gwt/client/ui/table/VScrollTable.java52
-rw-r--r--server/src/com/vaadin/data/util/sqlcontainer/SQLContainer.java4
-rw-r--r--server/src/com/vaadin/ui/Button.java4
-rw-r--r--server/src/com/vaadin/ui/Select.java14
-rw-r--r--tests/testbench/com/vaadin/tests/components/table/CtrlShiftMultiselect.java2
-rw-r--r--tests/testbench/com/vaadin/tests/components/table/SelectionRangeDragging.html52
6 files changed, 106 insertions, 22 deletions
diff --git a/client/src/com/vaadin/terminal/gwt/client/ui/table/VScrollTable.java b/client/src/com/vaadin/terminal/gwt/client/ui/table/VScrollTable.java
index 345eebc8aa..dcec10f86f 100644
--- a/client/src/com/vaadin/terminal/gwt/client/ui/table/VScrollTable.java
+++ b/client/src/com/vaadin/terminal/gwt/client/ui/table/VScrollTable.java
@@ -5256,6 +5256,27 @@ public class VScrollTable extends FlowPanel implements HasWidgets,
return false;
}
+ /**
+ * Checks if the row represented by the row key has been selected
+ *
+ * @param key
+ * The generated row key
+ */
+ private boolean rowKeyIsSelected(int rowKey) {
+ // Check single selections
+ if (selectedRowKeys.contains("" + rowKey)) {
+ return true;
+ }
+
+ // Check range selections
+ for (SelectionRange r : selectedRowRanges) {
+ if (r.inRange(getRenderedRowByKey("" + rowKey))) {
+ return true;
+ }
+ }
+ return false;
+ }
+
protected void startRowDrag(Event event, final int type,
Element targetTdOrTr) {
VTransferable transferable = new VTransferable();
@@ -5274,18 +5295,37 @@ public class VScrollTable extends FlowPanel implements HasWidgets,
VDragEvent ev = VDragAndDropManager.get().startDrag(
transferable, event, true);
if (dragmode == DRAGMODE_MULTIROW && isMultiSelectModeAny()
- && selectedRowKeys.contains("" + rowKey)) {
- ev.createDragImage(
- (Element) scrollBody.tBodyElement.cast(), true);
+ && rowKeyIsSelected(rowKey)) {
+
+ // Create a drag image of ALL rows (ie6,7 has a different
+ // DOM structure)
+ if(BrowserInfo.get().isIE6() || BrowserInfo.get().isIE7()){
+ ev.createDragImage(scrollBody.getElement(), true);
+ } else {
+ ev.createDragImage(
+ (Element) scrollBody.tBodyElement.cast(), true);
+ }
+
+ // Hide rows which are not selected
Element dragImage = ev.getDragImage();
int i = 0;
for (Iterator<Widget> iterator = scrollBody.iterator(); iterator
.hasNext();) {
VScrollTableRow next = (VScrollTableRow) iterator
.next();
- Element child = (Element) dragImage.getChild(i++);
- if (!selectedRowKeys.contains("" + next.rowKey)) {
- child.getStyle().setVisibility(Visibility.HIDDEN);
+
+ Element child;
+ if(BrowserInfo.get().isIE6() || BrowserInfo.get().isIE7()){
+ child = (Element) dragImage.getChild(1)
+ .getChild(0)
+ .getChild(i++);
+ } else {
+ child = (Element) dragImage.getChild(i++);
+ }
+
+ if (!rowKeyIsSelected(next.rowKey)) {
+ child.getStyle().setVisibility(
+ Visibility.HIDDEN);
}
}
} else {
diff --git a/server/src/com/vaadin/data/util/sqlcontainer/SQLContainer.java b/server/src/com/vaadin/data/util/sqlcontainer/SQLContainer.java
index f772e2701c..13248f1e06 100644
--- a/server/src/com/vaadin/data/util/sqlcontainer/SQLContainer.java
+++ b/server/src/com/vaadin/data/util/sqlcontainer/SQLContainer.java
@@ -551,9 +551,7 @@ public class SQLContainer implements Container, Container.Filterable,
@Override
public void removeContainerFilter(Filter filter) {
filters.remove(filter);
- // TODO this cannot be added before ComboBox is fixed
- // (Select.requestRepaint() must not affect filter string)
- // refresh();
+ refresh();
}
/**
diff --git a/server/src/com/vaadin/ui/Button.java b/server/src/com/vaadin/ui/Button.java
index 8546d8f830..68b9f1392f 100644
--- a/server/src/com/vaadin/ui/Button.java
+++ b/server/src/com/vaadin/ui/Button.java
@@ -472,6 +472,10 @@ public class Button extends AbstractComponent implements
* Determines if a button is automatically disabled when clicked. If this is
* set to true the button will be automatically disabled when clicked,
* typically to prevent (accidental) extra clicks on a button.
+ * <p>
+ * Note that this is only used when the click comes from the user, not when
+ * calling {@link #click()}.
+ * </p>
*
* @param disableOnClick
* true to disable button when it is clicked, false otherwise
diff --git a/server/src/com/vaadin/ui/Select.java b/server/src/com/vaadin/ui/Select.java
index 20345b55e0..6ff7c9c9bc 100644
--- a/server/src/com/vaadin/ui/Select.java
+++ b/server/src/com/vaadin/ui/Select.java
@@ -654,7 +654,7 @@ public class Select extends AbstractSelect implements AbstractSelect.Filtering,
if (filterstring != null) {
filterstring = filterstring.toLowerCase();
}
- optionRepaint();
+ requestRepaint();
} else if (isNewItemsAllowed()) {
// New option entered (and it is allowed)
final String newitem = (String) variables.get("newitem");
@@ -682,18 +682,6 @@ public class Select extends AbstractSelect implements AbstractSelect.Filtering,
}
@Override
- public void markAsDirty() {
- super.markAsDirty();
- optionRequest = false;
- prevfilterstring = filterstring;
- filterstring = null;
- }
-
- private void optionRepaint() {
- super.markAsDirty();
- }
-
- @Override
public void setFilteringMode(int filteringMode) {
this.filteringMode = filteringMode;
}
diff --git a/tests/testbench/com/vaadin/tests/components/table/CtrlShiftMultiselect.java b/tests/testbench/com/vaadin/tests/components/table/CtrlShiftMultiselect.java
index 02f4af045b..b9e23930e4 100644
--- a/tests/testbench/com/vaadin/tests/components/table/CtrlShiftMultiselect.java
+++ b/tests/testbench/com/vaadin/tests/components/table/CtrlShiftMultiselect.java
@@ -5,6 +5,7 @@ import com.vaadin.data.Item;
import com.vaadin.data.util.IndexedContainer;
import com.vaadin.tests.components.TestBase;
import com.vaadin.ui.Table;
+import com.vaadin.ui.Table.TableDragMode;
@SuppressWarnings("serial")
public class CtrlShiftMultiselect extends TestBase {
@@ -18,6 +19,7 @@ public class CtrlShiftMultiselect extends TestBase {
table.setSelectable(true);
table.setMultiSelect(true);
+ table.setDragMode(TableDragMode.MULTIROW);
table.setWidth("400px");
table.setHeight("400px");
diff --git a/tests/testbench/com/vaadin/tests/components/table/SelectionRangeDragging.html b/tests/testbench/com/vaadin/tests/components/table/SelectionRangeDragging.html
new file mode 100644
index 0000000000..1e911699d1
--- /dev/null
+++ b/tests/testbench/com/vaadin/tests/components/table/SelectionRangeDragging.html
@@ -0,0 +1,52 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
+<head profile="http://selenium-ide.openqa.org/profiles/test-case">
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
+<link rel="selenium.base" href="" />
+<title>New Test</title>
+</head>
+<body>
+<table cellpadding="1" cellspacing="1" border="1">
+<thead>
+<tr><td rowspan="1" colspan="3">New Test</td></tr>
+</thead><tbody>
+<tr>
+ <td>open</td>
+ <td>/run/com.vaadin.tests.components.table.CtrlShiftMultiselect?restartApplication</td>
+ <td></td>
+</tr>
+<tr>
+ <td>mouseClick</td>
+ <td>vaadin=runcomvaadintestscomponentstableCtrlShiftMultiselect::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[0]/VScrollTable[0]/domChild[1]/domChild[0]/domChild[1]/domChild[0]/domChild[5]/domChild[1]/domChild[0]</td>
+ <td>112,12</td>
+</tr>
+<tr>
+ <td>mouseClick</td>
+ <td>vaadin=runcomvaadintestscomponentstableCtrlShiftMultiselect::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[0]/VScrollTable[0]/domChild[1]/domChild[0]/domChild[1]/domChild[0]/domChild[10]/domChild[1]/domChild[0]</td>
+ <td>82,16:shift</td>
+</tr>
+<tr>
+ <td>drag</td>
+ <td>vaadin=runcomvaadintestscomponentstableCtrlShiftMultiselect::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[0]/VScrollTable[0]/domChild[1]/domChild[0]/domChild[1]/domChild[0]/domChild[8]/domChild[1]/domChild[0]</td>
+ <td>87,1</td>
+</tr>
+<tr>
+ <td>mouseMoveAt</td>
+ <td>vaadin=runcomvaadintestscomponentstableCtrlShiftMultiselect::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/domChild[0]/domChild[0]</td>
+ <td>700,210</td>
+</tr>
+<tr>
+ <td>screenCapture</td>
+ <td></td>
+ <td>multiple-rows-dragged</td>
+</tr>
+<tr>
+ <td>drop</td>
+ <td>vaadin=runcomvaadintestscomponentstableCtrlShiftMultiselect::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/domChild[0]/domChild[0]</td>
+ <td>700,210</td>
+</tr>
+
+</tbody></table>
+</body>
+</html>