summaryrefslogtreecommitdiffstats
path: root/src/com/vaadin/ui
diff options
context:
space:
mode:
authorHenri Sara <henri.sara@itmill.com>2011-02-24 06:54:28 +0000
committerHenri Sara <henri.sara@itmill.com>2011-02-24 06:54:28 +0000
commitf4b3242373c10f6912eb2477149869fe35ccebfe (patch)
tree0e5cf4a269ea99ff1a19eb4c7affec1b9911f6c4 /src/com/vaadin/ui
parent6e9e7b34507be862d9eca9b730adc195ccced913 (diff)
downloadvaadin-framework-f4b3242373c10f6912eb2477149869fe35ccebfe.tar.gz
vaadin-framework-f4b3242373c10f6912eb2477149869fe35ccebfe.zip
#6434 LayoutClickNotifier interface
svn changeset:17403/svn branch:6.5
Diffstat (limited to 'src/com/vaadin/ui')
-rw-r--r--src/com/vaadin/ui/AbsoluteLayout.java25
-rw-r--r--src/com/vaadin/ui/AbstractLayout.java11
-rw-r--r--src/com/vaadin/ui/AbstractOrderedLayout.java24
-rw-r--r--src/com/vaadin/ui/CssLayout.java25
-rw-r--r--src/com/vaadin/ui/GridLayout.java24
5 files changed, 16 insertions, 93 deletions
diff --git a/src/com/vaadin/ui/AbsoluteLayout.java b/src/com/vaadin/ui/AbsoluteLayout.java
index d96059fdb3..3b0239af7b 100644
--- a/src/com/vaadin/ui/AbsoluteLayout.java
+++ b/src/com/vaadin/ui/AbsoluteLayout.java
@@ -12,6 +12,7 @@ import java.util.Map;
import com.vaadin.event.LayoutEvents.LayoutClickEvent;
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.Sizeable;
@@ -25,7 +26,8 @@ import com.vaadin.terminal.gwt.client.ui.VAbsoluteLayout;
*/
@SuppressWarnings("serial")
@ClientWidget(VAbsoluteLayout.class)
-public class AbsoluteLayout extends AbstractLayout {
+public class AbsoluteLayout extends AbstractLayout implements
+ LayoutClickNotifier {
private static final String CLICK_EVENT = EventId.LAYOUT_CLICK;
@@ -560,32 +562,11 @@ public class AbsoluteLayout extends AbstractLayout {
}
}
- /**
- * Add a click listener to the layout. The listener is called whenever the
- * user clicks inside the layout. Also when the click targets a component
- * inside the Panel, provided the targeted component does not prevent the
- * click event from propagating.
- *
- * The child component that was clicked is included in the
- * {@link LayoutClickEvent}.
- *
- * Use {@link #removeListener(LayoutClickListener)} to remove the listener.
- *
- * @param listener
- * The listener to add
- */
public void addListener(LayoutClickListener listener) {
addListener(CLICK_EVENT, LayoutClickEvent.class, listener,
LayoutClickListener.clickMethod);
}
- /**
- * Remove a click listener from the layout. The listener should earlier have
- * been added using {@link #addListener(LayoutClickListener)}.
- *
- * @param listener
- * The listener to remove
- */
public void removeListener(LayoutClickListener listener) {
removeListener(CLICK_EVENT, LayoutClickEvent.class, listener);
}
diff --git a/src/com/vaadin/ui/AbstractLayout.java b/src/com/vaadin/ui/AbstractLayout.java
index eff53cf1e0..d0cc549138 100644
--- a/src/com/vaadin/ui/AbstractLayout.java
+++ b/src/com/vaadin/ui/AbstractLayout.java
@@ -7,6 +7,7 @@ package com.vaadin.ui;
import java.util.Map;
import com.vaadin.event.LayoutEvents.LayoutClickEvent;
+import com.vaadin.event.LayoutEvents.LayoutClickNotifier;
import com.vaadin.terminal.PaintException;
import com.vaadin.terminal.PaintTarget;
import com.vaadin.terminal.gwt.client.EventId;
@@ -95,7 +96,8 @@ public abstract class AbstractLayout extends AbstractComponentContainer
public void changeVariables(Object source, Map<String, Object> variables) {
super.changeVariables(source, variables);
// not all subclasses use these events
- if (variables.containsKey(CLICK_EVENT)) {
+ if (this instanceof LayoutClickNotifier
+ && variables.containsKey(CLICK_EVENT)) {
fireClick((Map<String, Object>) variables.get(CLICK_EVENT));
}
@@ -104,11 +106,12 @@ public abstract class AbstractLayout extends AbstractComponentContainer
/**
* Fire a layout click event.
*
- * Note that this is only used by the subclasses that support layout click
- * listeners, and can be overridden for custom click event firing.
+ * Note that this method is only used by the subclasses that implement
+ * {@link LayoutClickNotifier}, and can be overridden for custom click event
+ * firing.
*
* @param parameters
- * The parameters recieved from the client side implementation
+ * The parameters received from the client side implementation
*/
protected void fireClick(Map<String, Object> parameters) {
MouseEventDetails mouseDetails = MouseEventDetails
diff --git a/src/com/vaadin/ui/AbstractOrderedLayout.java b/src/com/vaadin/ui/AbstractOrderedLayout.java
index 6e55343c2e..8dfbe07b18 100644
--- a/src/com/vaadin/ui/AbstractOrderedLayout.java
+++ b/src/com/vaadin/ui/AbstractOrderedLayout.java
@@ -11,6 +11,7 @@ import java.util.Map;
import com.vaadin.event.LayoutEvents.LayoutClickEvent;
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.Sizeable;
@@ -18,7 +19,7 @@ import com.vaadin.terminal.gwt.client.EventId;
@SuppressWarnings("serial")
public abstract class AbstractOrderedLayout extends AbstractLayout implements
- Layout.AlignmentHandler, Layout.SpacingHandler {
+ Layout.AlignmentHandler, Layout.SpacingHandler, LayoutClickNotifier {
private static final String CLICK_EVENT = EventId.LAYOUT_CLICK;
@@ -349,32 +350,11 @@ public abstract class AbstractOrderedLayout extends AbstractLayout implements
AlignmentUtils.setComponentAlignment(this, component, alignment);
}
- /**
- * Add a click listener to the layout. The listener is called whenever the
- * user clicks inside the layout. Also when the click targets a component
- * inside the Panel, provided the targeted component does not prevent the
- * click event from propagating.
- *
- * The child component that was clicked is included in the
- * {@link LayoutClickEvent}.
- *
- * Use {@link #removeListener(LayoutClickListener)} to remove the listener.
- *
- * @param listener
- * The listener to add
- */
public void addListener(LayoutClickListener listener) {
addListener(CLICK_EVENT, LayoutClickEvent.class, listener,
LayoutClickListener.clickMethod);
}
- /**
- * Remove a click listener from the layout. The listener should earlier have
- * been added using {@link #addListener(LayoutClickListener)}.
- *
- * @param listener
- * The listener to remove
- */
public void removeListener(LayoutClickListener listener) {
removeListener(CLICK_EVENT, LayoutClickEvent.class, listener);
}
diff --git a/src/com/vaadin/ui/CssLayout.java b/src/com/vaadin/ui/CssLayout.java
index 5e0cfed263..5789a65ed3 100644
--- a/src/com/vaadin/ui/CssLayout.java
+++ b/src/com/vaadin/ui/CssLayout.java
@@ -9,6 +9,7 @@ import java.util.LinkedList;
import com.vaadin.event.LayoutEvents.LayoutClickEvent;
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.Paintable;
@@ -57,7 +58,7 @@ import com.vaadin.terminal.gwt.client.ui.VCssLayout;
*
*/
@ClientWidget(VCssLayout.class)
-public class CssLayout extends AbstractLayout {
+public class CssLayout extends AbstractLayout implements LayoutClickNotifier {
private static final String CLICK_EVENT = EventId.LAYOUT_CLICK;
@@ -249,33 +250,11 @@ public class CssLayout extends AbstractLayout {
}
}
- /**
- * Add a click listener to the layout. The listener is called whenever the
- * user clicks inside the layout. Also when the click targets a component
- * inside the Panel, provided the targeted component does not prevent the
- * click event from propagating. A caption is not considered part of a
- * component.
- *
- * The child component that was clicked is included in the
- * {@link LayoutClickEvent}.
- *
- * Use {@link #removeListener(LayoutClickListener)} to remove the listener.
- *
- * @param listener
- * The listener to add
- */
public void addListener(LayoutClickListener listener) {
addListener(CLICK_EVENT, LayoutClickEvent.class, listener,
LayoutClickListener.clickMethod);
}
- /**
- * Remove a click listener from the layout. The listener should earlier have
- * been added using {@link #addListener(LayoutClickListener)}.
- *
- * @param listener
- * The listener to remove
- */
public void removeListener(LayoutClickListener listener) {
removeListener(CLICK_EVENT, LayoutClickEvent.class, listener);
}
diff --git a/src/com/vaadin/ui/GridLayout.java b/src/com/vaadin/ui/GridLayout.java
index ed6136a852..40b0ca9a6c 100644
--- a/src/com/vaadin/ui/GridLayout.java
+++ b/src/com/vaadin/ui/GridLayout.java
@@ -14,6 +14,7 @@ import java.util.Map.Entry;
import com.vaadin.event.LayoutEvents.LayoutClickEvent;
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;
@@ -42,7 +43,7 @@ import com.vaadin.terminal.gwt.client.ui.VGridLayout;
@SuppressWarnings("serial")
@ClientWidget(VGridLayout.class)
public class GridLayout extends AbstractLayout implements
- Layout.AlignmentHandler, Layout.SpacingHandler {
+ Layout.AlignmentHandler, Layout.SpacingHandler, LayoutClickNotifier {
private static final String CLICK_EVENT = EventId.LAYOUT_CLICK;
@@ -1378,32 +1379,11 @@ public class GridLayout extends AbstractLayout implements
AlignmentUtils.setComponentAlignment(this, component, alignment);
}
- /**
- * Add a click listener to the layout. The listener is called whenever the
- * user clicks inside the layout. Also when the click targets a component
- * inside the Panel, provided the targeted component does not prevent the
- * click event from propagating.
- *
- * The child component that was clicked is included in the
- * {@link LayoutClickEvent}.
- *
- * Use {@link #removeListener(LayoutClickListener)} to remove the listener.
- *
- * @param listener
- * The listener to add
- */
public void addListener(LayoutClickListener listener) {
addListener(CLICK_EVENT, LayoutClickEvent.class, listener,
LayoutClickListener.clickMethod);
}
- /**
- * Remove a click listener from the layout. The listener should earlier have
- * been added using {@link #addListener(LayoutClickListener)}.
- *
- * @param listener
- * The listener to remove
- */
public void removeListener(LayoutClickListener listener) {
removeListener(CLICK_EVENT, LayoutClickEvent.class, listener);
}