diff options
author | Artur Signell <artur.signell@itmill.com> | 2009-11-25 14:33:16 +0000 |
---|---|---|
committer | Artur Signell <artur.signell@itmill.com> | 2009-11-25 14:33:16 +0000 |
commit | a23903bf21edeafa91a2a731d55698bbf3b95770 (patch) | |
tree | 759a22e68dfc21358cb522118bde1159ad3c282b /src/com/vaadin/ui/AbsoluteLayout.java | |
parent | e5caa74cc45cdd63a0edae9989010699dfaea1be (diff) | |
download | vaadin-framework-a23903bf21edeafa91a2a731d55698bbf3b95770.tar.gz vaadin-framework-a23903bf21edeafa91a2a731d55698bbf3b95770.zip |
Work in progress
svn changeset:10026/svn branch:event-framework-3234
Diffstat (limited to 'src/com/vaadin/ui/AbsoluteLayout.java')
-rw-r--r-- | src/com/vaadin/ui/AbsoluteLayout.java | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/src/com/vaadin/ui/AbsoluteLayout.java b/src/com/vaadin/ui/AbsoluteLayout.java index 8e382622ca..b2f0a5be76 100644 --- a/src/com/vaadin/ui/AbsoluteLayout.java +++ b/src/com/vaadin/ui/AbsoluteLayout.java @@ -10,8 +10,11 @@ import java.util.Iterator; import java.util.LinkedHashSet; import java.util.Map; +import com.vaadin.event.LayoutEvents.LayoutClickEvent; +import com.vaadin.event.LayoutEvents.LayoutClickListener; import com.vaadin.terminal.PaintException; import com.vaadin.terminal.PaintTarget; +import com.vaadin.terminal.gwt.client.MouseEventDetails; import com.vaadin.terminal.gwt.client.ui.VAbsoluteLayout; /** @@ -23,6 +26,8 @@ import com.vaadin.terminal.gwt.client.ui.VAbsoluteLayout; @ClientWidget(VAbsoluteLayout.class) public class AbsoluteLayout extends AbstractLayout { + private static final String CLICK_EVENT = VAbsoluteLayout.CLICK_EVENT_IDENTIFIER; + private Collection<Component> components = new LinkedHashSet<Component>(); private Map<Component, ComponentPosition> componentToCoordinates = new HashMap<Component, ComponentPosition>(); @@ -353,4 +358,30 @@ public class AbsoluteLayout extends AbstractLayout { } + @Override + public void changeVariables(Object source, Map variables) { + super.changeVariables(source, variables); + if (variables.containsKey(CLICK_EVENT)) { + fireClick((Object[]) variables.get(CLICK_EVENT)); + } + + } + + private void fireClick(Object[] parameters) { + MouseEventDetails mouseDetails = MouseEventDetails + .deserialize((String) parameters[0]); + Component childComponent = (Component) parameters[1]; + + fireEvent(new LayoutClickEvent(this, mouseDetails, childComponent)); + } + + public void addListener(LayoutClickListener listener) { + addListener(CLICK_EVENT, LayoutClickEvent.class, listener, + LayoutClickListener.clickMethod); + } + + public void removeListener(LayoutClickListener listener) { + removeListener(CLICK_EVENT, LayoutClickEvent.class, listener); + } + } |