/*
@ITMillApache2LicenseForJavaFiles@
*/
package com.vaadin.event;
import java.io.Serializable;
import java.lang.reflect.Method;
import com.vaadin.terminal.gwt.client.EventId;
import com.vaadin.tools.ReflectTools;
import com.vaadin.ui.Component;
import com.vaadin.ui.Field;
/**
* Interface that serves as a wrapper for {@link Field} related events.
*/
public interface FieldEvents {
/**
* The interface for adding and removing FocusEvent
listeners.
* By implementing this interface a class explicitly announces that it will
* generate a FocusEvent
when it receives keyboard focus.
*
* Note: The general Java convention is not to explicitly declare that a
* class generates events, but to directly define the
* addListener
and removeListener
methods. That
* way the caller of these methods has no real way of finding out if the
* class really will send the events, or if it just defines the methods to
* be able to implement an interface.
*
FocusListener
to the Component which gets fired
* when a Field
receives keyboard focus.
*
* @param listener
* @see FocusListener
* @since 6.2
*/
public void addListener(FocusListener listener);
/**
* Removes a FocusListener
from the Component.
*
* @param listener
* @see FocusListener
* @since 6.2
*/
public void removeListener(FocusListener listener);
}
/**
* The interface for adding and removing BlurEvent
listeners.
* By implementing this interface a class explicitly announces that it will
* generate a BlurEvent
when it loses keyboard focus.
*
* Note: The general Java convention is not to explicitly declare that a
* class generates events, but to directly define the
* addListener
and removeListener
methods. That
* way the caller of these methods has no real way of finding out if the
* class really will send the events, or if it just defines the methods to
* be able to implement an interface.
*
BlurListener
to the Component which gets fired
* when a Field
loses keyboard focus.
*
* @param listener
* @see BlurListener
* @since 6.2
*/
public void addListener(BlurListener listener);
/**
* Removes a BlurListener
from the Component.
*
* @param listener
* @see BlurListener
* @since 6.2
*/
public void removeListener(BlurListener listener);
}
/**
* FocusEvent
class for holding additional event information.
* Fired when a Field
receives keyboard focus.
*
* @since 6.2
*/
@SuppressWarnings("serial")
public class FocusEvent extends Component.Event {
/**
* Identifier for event that can be used in {@link EventRouter}
*/
public static final String EVENT_ID = EventId.FOCUS;
public FocusEvent(Component source) {
super(source);
}
}
/**
* FocusListener
interface for listening for
* FocusEvent
fired by a Field
.
*
* @see FocusEvent
* @since 6.2
*/
public interface FocusListener extends ComponentEventListener {
public static final Method focusMethod = ReflectTools.findMethod(
FocusListener.class, "focus", FocusEvent.class);
/**
* Component has been focused
*
* @param event
* Component focus event.
*/
public void focus(FocusEvent event);
}
/**
* BlurEvent
class for holding additional event information.
* Fired when a Field
loses keyboard focus.
*
* @since 6.2
*/
@SuppressWarnings("serial")
public class BlurEvent extends Component.Event {
/**
* Identifier for event that can be used in {@link EventRouter}
*/
public static final String EVENT_ID = EventId.BLUR;
public BlurEvent(Component source) {
super(source);
}
}
/**
* BlurListener
interface for listening for
* BlurEvent
fired by a Field
.
*
* @see BlurEvent
* @since 6.2
*/
public interface BlurListener extends ComponentEventListener {
public static final Method blurMethod = ReflectTools.findMethod(
BlurListener.class, "blur", BlurEvent.class);
/**
* Component has been blurred
*
* @param event
* Component blur event.
*/
public void blur(BlurEvent event);
}
}