\r
public interface FieldEvents {\r
\r
+ /**\r
+ * The interface for adding and removing <code>FocusEvent</code> listeners.\r
+ * By implementing this interface a class explicitly announces that it will\r
+ * generate a <code>FocusEvent</code> when it receives keyboard focus.\r
+ * <p>\r
+ * Note: The general Java convention is not to explicitly declare that a\r
+ * class generates events, but to directly define the\r
+ * <code>addListener</code> and <code>removeListener</code> methods. That\r
+ * way the caller of these methods has no real way of finding out if the\r
+ * class really will send the events, or if it just defines the methods to\r
+ * be able to implement an interface.\r
+ * </p>\r
+ * @since 6.2\r
+ * @see FocusListener\r
+ * @see FocusEvent\r
+ */\r
+ public interface FocusNotifier {\r
+ /**\r
+ * Adds a <code>FocusListener</code> to the Component which gets fired\r
+ * when a <code>Field</code> receives keyboard focus.\r
+ * \r
+ * @param listener\r
+ * @see FocusListener\r
+ * @since 6.2\r
+ */\r
+ public void addListener(FocusListener listener);\r
+\r
+ /**\r
+ * Removes a <code>FocusListener</code> from the Component.\r
+ * \r
+ * @param listener\r
+ * @see FocusListener\r
+ * @since 6.2\r
+ */\r
+ public void removeListener(FocusListener listener);\r
+ }\r
+\r
+ /**\r
+ * The interface for adding and removing <code>BlurEvent</code> listeners.\r
+ * By implementing this interface a class explicitly announces that it will\r
+ * generate a <code>BlurEvent</code> when it loses keyboard focus.\r
+ * <p>\r
+ * Note: The general Java convention is not to explicitly declare that a\r
+ * class generates events, but to directly define the\r
+ * <code>addListener</code> and <code>removeListener</code> methods. That\r
+ * way the caller of these methods has no real way of finding out if the\r
+ * class really will send the events, or if it just defines the methods to\r
+ * be able to implement an interface.\r
+ * </p>\r
+ * @since 6.2\r
+ * @see BlurListener\r
+ * @see BlurEvent\r
+ */\r
+ public interface BlurNotifier {\r
+ /**\r
+ * Adds a <code>BlurListener</code> to the Component which gets fired\r
+ * when a <code>Field</code> loses keyboard focus.\r
+ * \r
+ * @param listener\r
+ * @see BlurListener\r
+ * @since 6.2\r
+ */\r
+ public void addListener(BlurListener listener);\r
+\r
+ /**\r
+ * Removes a <code>BlurListener</code> from the Component.\r
+ * \r
+ * @param listener\r
+ * @see BlurListener\r
+ * @since 6.2\r
+ */\r
+ public void removeListener(BlurListener listener);\r
+ }\r
+\r
/**\r
* <code>FocusEvent</code> class for holding additional event information.\r
* Fired when a <code>Field</code> receives keyboard focus.\r
import java.util.Map;
import com.vaadin.data.Property;
+import com.vaadin.event.FieldEvents;
import com.vaadin.event.FieldEvents.BlurEvent;
import com.vaadin.event.FieldEvents.BlurListener;
import com.vaadin.event.FieldEvents.FocusEvent;
*/
@SuppressWarnings("serial")
@ClientWidget(VTextField.class)
-public class TextField extends AbstractField {
+public class TextField extends AbstractField implements
+ FieldEvents.BlurNotifier, FieldEvents.FocusNotifier {
/* Private members */
fireEvent(new BlurEvent(this));
}
- /**
- * TODO
- *
- * @param listener
- */
public void addListener(FocusListener listener) {
addListener(FOCUS_EVENT, FocusEvent.class, listener,
FocusListener.focusMethod);
}
- /**
- * TODO
- *
- * @param listener
- */
public void removeListener(FocusListener listener) {
removeListener(FOCUS_EVENT, FocusEvent.class, listener);
}
- /**
- * TODO
- *
- * @param listener
- */
public void addListener(BlurListener listener) {
addListener(BLUR_EVENT, BlurEvent.class, listener,
BlurListener.blurMethod);
}
- /**
- * TODO
- *
- * @param listener
- */
public void removeListener(BlurListener listener) {
removeListener(BLUR_EVENT, BlurEvent.class, listener);
}