summaryrefslogtreecommitdiffstats
path: root/server
diff options
context:
space:
mode:
authorNiklas Nyholm <niklas.nyholm@procountor.com>2014-07-11 13:37:41 +0300
committerVaadin Code Review <review@vaadin.com>2014-08-20 12:25:43 +0000
commit849894ae8d61cea654e25533be175a2173679921 (patch)
tree95ea5ae67a1a9f14caa7daaa113783e601a58be0 /server
parent0110af79f162c5c58e15d20bc35d8655fc5a8cde (diff)
downloadvaadin-framework-849894ae8d61cea654e25533be175a2173679921.tar.gz
vaadin-framework-849894ae8d61cea654e25533be175a2173679921.zip
Added support for focus and blur listeners in NativeSelect (#6847)
Implemented BlurNotifier and FocusNotifier interfaces in NativeSelect Change-Id: Ief38d72edee05bef07f0d57367811bab2c6def50
Diffstat (limited to 'server')
-rw-r--r--server/src/com/vaadin/ui/NativeSelect.java79
1 files changed, 78 insertions, 1 deletions
diff --git a/server/src/com/vaadin/ui/NativeSelect.java b/server/src/com/vaadin/ui/NativeSelect.java
index 51f5536588..ee7bfc3e5c 100644
--- a/server/src/com/vaadin/ui/NativeSelect.java
+++ b/server/src/com/vaadin/ui/NativeSelect.java
@@ -19,6 +19,12 @@ package com.vaadin.ui;
import java.util.Collection;
import com.vaadin.data.Container;
+import com.vaadin.event.FieldEvents;
+import com.vaadin.event.FieldEvents.BlurEvent;
+import com.vaadin.event.FieldEvents.BlurListener;
+import com.vaadin.event.FieldEvents.FocusAndBlurServerRpcImpl;
+import com.vaadin.event.FieldEvents.FocusEvent;
+import com.vaadin.event.FieldEvents.FocusListener;
import com.vaadin.server.PaintException;
import com.vaadin.server.PaintTarget;
@@ -29,13 +35,23 @@ import com.vaadin.server.PaintTarget;
* better choice.
*/
@SuppressWarnings("serial")
-public class NativeSelect extends AbstractSelect {
+public class NativeSelect extends AbstractSelect implements
+ FieldEvents.BlurNotifier, FieldEvents.FocusNotifier {
// width in characters, mimics TextField
private int columns = 0;
+ FocusAndBlurServerRpcImpl focusBlurRpc = new FocusAndBlurServerRpcImpl(this) {
+
+ @Override
+ protected void fireEvent(Event event) {
+ NativeSelect.this.fireEvent(event);
+ }
+ };
+
public NativeSelect() {
super();
+ registerRpc(focusBlurRpc);
}
public NativeSelect(String caption, Collection<?> options) {
@@ -118,4 +134,65 @@ public class NativeSelect extends AbstractSelect {
}
}
+ @Override
+ public void addFocusListener(FocusListener listener) {
+ addListener(FocusEvent.EVENT_ID, FocusEvent.class, listener,
+ FocusListener.focusMethod);
+ }
+
+ /**
+ * @deprecated As of 7.0, replaced by
+ * {@link #addFocusListener(FocusListener)}
+ **/
+ @Override
+ @Deprecated
+ public void addListener(FocusListener listener) {
+ addFocusListener(listener);
+ }
+
+ @Override
+ public void removeFocusListener(FocusListener listener) {
+ removeListener(FocusEvent.EVENT_ID, FocusEvent.class, listener);
+ }
+
+ /**
+ * @deprecated As of 7.0, replaced by
+ * {@link #removeFocusListener(FocusListener)}
+ **/
+ @Override
+ @Deprecated
+ public void removeListener(FocusListener listener) {
+ removeFocusListener(listener);
+ }
+
+ @Override
+ public void addBlurListener(BlurListener listener) {
+ addListener(BlurEvent.EVENT_ID, BlurEvent.class, listener,
+ BlurListener.blurMethod);
+ }
+
+ /**
+ * @deprecated As of 7.0, replaced by {@link #addBlurListener(BlurListener)}
+ **/
+ @Override
+ @Deprecated
+ public void addListener(BlurListener listener) {
+ addBlurListener(listener);
+ }
+
+ @Override
+ public void removeBlurListener(BlurListener listener) {
+ removeListener(BlurEvent.EVENT_ID, BlurEvent.class, listener);
+ }
+
+ /**
+ * @deprecated As of 7.0, replaced by
+ * {@link #removeBlurListener(BlurListener)}
+ **/
+ @Override
+ @Deprecated
+ public void removeListener(BlurListener listener) {
+ removeBlurListener(listener);
+ }
+
}