aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorArtur Signell <artur@vaadin.com>2012-03-27 10:36:26 +0300
committerArtur Signell <artur@vaadin.com>2012-03-27 10:36:26 +0300
commitcf025b388dc07f50e8743fd6127cf2a9c5a1c628 (patch)
treef6732f54dcdd47cfc302bf0ee966066fdc462787
parent45c0127529b574ff80f526a82ef2ca0c35c57b51 (diff)
parent381c3eb5d4ebce92bceddd06e2a9ed81b40789c4 (diff)
downloadvaadin-framework-cf025b388dc07f50e8743fd6127cf2a9c5a1c628.tar.gz
vaadin-framework-cf025b388dc07f50e8743fd6127cf2a9c5a1c628.zip
Merge remote-tracking branch 'origin/6.8'
Conflicts: src/com/vaadin/terminal/gwt/client/ui/VScrollTable.java Moved Table context menu tracking to VScrollTable as there is no "open" listener for a context menu. Previous merge was broken.
-rw-r--r--src/com/vaadin/data/util/sqlcontainer/ColumnProperty.java2
-rw-r--r--src/com/vaadin/terminal/gwt/client/ui/TableConnector.java37
-rw-r--r--src/com/vaadin/terminal/gwt/client/ui/VScrollTable.java33
3 files changed, 38 insertions, 34 deletions
diff --git a/src/com/vaadin/data/util/sqlcontainer/ColumnProperty.java b/src/com/vaadin/data/util/sqlcontainer/ColumnProperty.java
index a74db6ce8a..d84a164bfa 100644
--- a/src/com/vaadin/data/util/sqlcontainer/ColumnProperty.java
+++ b/src/com/vaadin/data/util/sqlcontainer/ColumnProperty.java
@@ -123,8 +123,8 @@ final public class ColumnProperty implements Property {
/* Set the new value and notify container of the change. */
changedValue = newValue;
- owner.getContainer().itemChangeNotification(owner);
modified = true;
+ owner.getContainer().itemChangeNotification(owner);
}
private boolean isValueAlreadySet(Object newValue) {
diff --git a/src/com/vaadin/terminal/gwt/client/ui/TableConnector.java b/src/com/vaadin/terminal/gwt/client/ui/TableConnector.java
index fc99d2e417..370d4bc001 100644
--- a/src/com/vaadin/terminal/gwt/client/ui/TableConnector.java
+++ b/src/com/vaadin/terminal/gwt/client/ui/TableConnector.java
@@ -8,10 +8,7 @@ import java.util.Iterator;
import com.google.gwt.core.client.GWT;
import com.google.gwt.core.client.Scheduler;
import com.google.gwt.dom.client.Style.Position;
-import com.google.gwt.event.logical.shared.CloseEvent;
-import com.google.gwt.event.logical.shared.CloseHandler;
import com.google.gwt.user.client.Command;
-import com.google.gwt.user.client.ui.PopupPanel;
import com.google.gwt.user.client.ui.Widget;
import com.vaadin.terminal.gwt.client.AbstractFieldState;
import com.vaadin.terminal.gwt.client.ApplicationConnection;
@@ -21,41 +18,16 @@ import com.vaadin.terminal.gwt.client.ComponentState;
import com.vaadin.terminal.gwt.client.DirectionalManagedLayout;
import com.vaadin.terminal.gwt.client.UIDL;
import com.vaadin.terminal.gwt.client.Util;
+import com.vaadin.terminal.gwt.client.ui.VScrollTable.ContextMenuDetails;
import com.vaadin.terminal.gwt.client.ui.VScrollTable.VScrollTableBody.VScrollTableRow;
public class TableConnector extends AbstractComponentContainerConnector
implements DirectionalManagedLayout, PostLayoutListener {
- /**
- * Used to recall the position of an open context menu if we need to close
- * and reopen it during a row update.
- */
- class ContextMenuDetails {
- String rowKey;
- int left;
- int top;
-
- ContextMenuDetails(String rowKey, int left, int top) {
- this.rowKey = rowKey;
- this.left = left;
- this.top = top;
- }
- }
-
- protected ContextMenuDetails contextMenu = null;
-
@Override
protected void init() {
super.init();
-
- // Add a handler to clear saved context menu details when the menu
- // closes. See #8526.
- getConnection().getContextMenu().addCloseHandler(
- new CloseHandler<PopupPanel>() {
- public void onClose(CloseEvent<PopupPanel> event) {
- contextMenu = null;
- }
- });
+ getWidget().init(getConnection());
}
/*
@@ -72,7 +44,7 @@ public class TableConnector extends AbstractComponentContainerConnector
// If a row has an open context menu, it will be closed as the row is
// detached. Retain a reference here so we can restore the menu if
// required.
- ContextMenuDetails contextMenuBeforeUpdate = contextMenu;
+ ContextMenuDetails contextMenuBeforeUpdate = getWidget().contextMenu;
if (uidl.hasAttribute(VScrollTable.ATTRIBUTE_PAGEBUFFER_FIRST)) {
getWidget().serverCacheFirst = uidl
@@ -114,7 +86,6 @@ public class TableConnector extends AbstractComponentContainerConnector
.setPosition(Position.RELATIVE);
}
- getWidget().client = client;
getWidget().paintableId = uidl.getStringAttribute("id");
getWidget().immediate = getState().isImmediate();
@@ -340,7 +311,7 @@ public class TableConnector extends AbstractComponentContainerConnector
Widget w = iterator.next();
VScrollTableRow row = (VScrollTableRow) w;
if (row.getKey().equals(savedContextMenu.rowKey)) {
- contextMenu = savedContextMenu;
+ getWidget().contextMenu = savedContextMenu;
getConnection().getContextMenu().showAt(row,
savedContextMenu.left, savedContextMenu.top);
}
diff --git a/src/com/vaadin/terminal/gwt/client/ui/VScrollTable.java b/src/com/vaadin/terminal/gwt/client/ui/VScrollTable.java
index 09f25a239b..2f488a62af 100644
--- a/src/com/vaadin/terminal/gwt/client/ui/VScrollTable.java
+++ b/src/com/vaadin/terminal/gwt/client/ui/VScrollTable.java
@@ -45,6 +45,8 @@ import com.google.gwt.event.dom.client.ScrollEvent;
import com.google.gwt.event.dom.client.ScrollHandler;
import com.google.gwt.event.dom.client.TouchStartEvent;
import com.google.gwt.event.dom.client.TouchStartHandler;
+import com.google.gwt.event.logical.shared.CloseEvent;
+import com.google.gwt.event.logical.shared.CloseHandler;
import com.google.gwt.user.client.Command;
import com.google.gwt.user.client.DOM;
import com.google.gwt.user.client.Element;
@@ -54,6 +56,7 @@ import com.google.gwt.user.client.Window;
import com.google.gwt.user.client.ui.FlowPanel;
import com.google.gwt.user.client.ui.HasWidgets;
import com.google.gwt.user.client.ui.Panel;
+import com.google.gwt.user.client.ui.PopupPanel;
import com.google.gwt.user.client.ui.RootPanel;
import com.google.gwt.user.client.ui.UIObject;
import com.google.gwt.user.client.ui.Widget;
@@ -457,6 +460,24 @@ public class VScrollTable extends FlowPanel implements HasWidgets,
private boolean sizeNeedsInit = true;
+ /**
+ * Used to recall the position of an open context menu if we need to close
+ * and reopen it during a row update.
+ */
+ class ContextMenuDetails {
+ String rowKey;
+ int left;
+ int top;
+
+ ContextMenuDetails(String rowKey, int left, int top) {
+ this.rowKey = rowKey;
+ this.left = left;
+ this.top = top;
+ }
+ }
+
+ protected ContextMenuDetails contextMenu = null;
+
public VScrollTable() {
setMultiSelectMode(MULTISELECT_MODE_DEFAULT);
@@ -502,6 +523,17 @@ public class VScrollTable extends FlowPanel implements HasWidgets,
rowRequestHandler = new RowRequestHandler();
}
+ public void init(ApplicationConnection client) {
+ this.client = client;
+ // Add a handler to clear saved context menu details when the menu
+ // closes. See #8526.
+ client.getContextMenu().addCloseHandler(new CloseHandler<PopupPanel>() {
+ public void onClose(CloseEvent<PopupPanel> event) {
+ contextMenu = null;
+ }
+ });
+ }
+
protected TouchScrollDelegate getTouchScrollDelegate() {
if (touchScrollDelegate == null) {
touchScrollDelegate = new TouchScrollDelegate(
@@ -5151,6 +5183,7 @@ public class VScrollTable extends FlowPanel implements HasWidgets,
int top = Util.getTouchOrMouseClientY(event);
top += Window.getScrollTop();
left += Window.getScrollLeft();
+ contextMenu = new ContextMenuDetails(getKey(), left, top);
client.getContextMenu().showAt(this, left, top);
}
}