summaryrefslogtreecommitdiffstats
path: root/src/com/vaadin/ui/GridLayout.java
diff options
context:
space:
mode:
authorArtur Signell <artur@vaadin.com>2012-03-29 18:22:46 +0300
committerArtur Signell <artur@vaadin.com>2012-03-29 18:22:46 +0300
commit18ce0109fa767e1d91333cef55e0e528e64818d7 (patch)
treefa8ae0198fcdcd15c72b37f93eeed927259c93aa /src/com/vaadin/ui/GridLayout.java
parent750abe0d1c909fc9f234c484162fbbfec046691e (diff)
downloadvaadin-framework-18ce0109fa767e1d91333cef55e0e528e64818d7.tar.gz
vaadin-framework-18ce0109fa767e1d91333cef55e0e528e64818d7.zip
Refactored ClickEventHandler and LayoutClickEventHandler to use RPC
Diffstat (limited to 'src/com/vaadin/ui/GridLayout.java')
-rw-r--r--src/com/vaadin/ui/GridLayout.java21
1 files changed, 17 insertions, 4 deletions
diff --git a/src/com/vaadin/ui/GridLayout.java b/src/com/vaadin/ui/GridLayout.java
index bc5f1a1999..0c8089258f 100644
--- a/src/com/vaadin/ui/GridLayout.java
+++ b/src/com/vaadin/ui/GridLayout.java
@@ -17,8 +17,11 @@ import com.vaadin.event.LayoutEvents.LayoutClickListener;
import com.vaadin.event.LayoutEvents.LayoutClickNotifier;
import com.vaadin.terminal.PaintException;
import com.vaadin.terminal.PaintTarget;
-import com.vaadin.terminal.gwt.client.EventId;
+import com.vaadin.terminal.gwt.client.Connector;
+import com.vaadin.terminal.gwt.client.MouseEventDetails;
import com.vaadin.terminal.gwt.client.ui.GridLayoutConnector;
+import com.vaadin.terminal.gwt.client.ui.GridLayoutConnector.GridLayoutServerRPC;
+import com.vaadin.terminal.gwt.client.ui.LayoutClickEventHandler;
/**
* A layout where the components are laid out on a grid using cell coordinates.
@@ -51,8 +54,15 @@ import com.vaadin.terminal.gwt.client.ui.GridLayoutConnector;
public class GridLayout extends AbstractLayout implements
Layout.AlignmentHandler, Layout.SpacingHandler, LayoutClickNotifier {
- private static final String CLICK_EVENT = EventId.LAYOUT_CLICK;
+ private GridLayoutServerRPC rpc = new GridLayoutServerRPC() {
+ public void layoutClick(MouseEventDetails mouseDetails,
+ Connector clickedConnector) {
+ fireEvent(LayoutClickEvent.createEvent(GridLayout.this,
+ mouseDetails, clickedConnector));
+
+ }
+ };
/**
* Initial grid columns.
*/
@@ -121,6 +131,7 @@ public class GridLayout extends AbstractLayout implements
public GridLayout(int columns, int rows) {
setColumns(columns);
setRows(rows);
+ registerRpcImplementation(rpc, GridLayoutServerRPC.class);
}
/**
@@ -1414,12 +1425,14 @@ public class GridLayout extends AbstractLayout implements
}
public void addListener(LayoutClickListener listener) {
- addListener(CLICK_EVENT, LayoutClickEvent.class, listener,
+ addListener(LayoutClickEventHandler.LAYOUT_CLICK_EVENT_IDENTIFIER,
+ LayoutClickEvent.class, listener,
LayoutClickListener.clickMethod);
}
public void removeListener(LayoutClickListener listener) {
- removeListener(CLICK_EVENT, LayoutClickEvent.class, listener);
+ removeListener(LayoutClickEventHandler.LAYOUT_CLICK_EVENT_IDENTIFIER,
+ LayoutClickEvent.class, listener);
}
}