All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.vaadin.v7.event.FieldEvents Maven / Gradle / Ivy

There is a newer version: 8.27.5
Show newest version
/*
 * Copyright (C) 2000-2024 Vaadin Ltd
 *
 * This program is available under Vaadin Commercial License and Service Terms.
 *
 * See  for the full
 * license.
 */

package com.vaadin.v7.event;

import java.io.Serializable;
import java.lang.reflect.Method;

import com.vaadin.event.ConnectorEventListener;
import com.vaadin.event.FieldEvents.BlurEvent;
import com.vaadin.event.FieldEvents.BlurListener;
import com.vaadin.event.FieldEvents.FocusEvent;
import com.vaadin.event.FieldEvents.FocusListener;
import com.vaadin.ui.Component;
import com.vaadin.util.ReflectTools;
import com.vaadin.v7.ui.Field;
import com.vaadin.v7.ui.Field.ValueChangeEvent;
import com.vaadin.v7.ui.TextField;

/**
 * Interface that serves as a wrapper for {@link Field} related events.
 */
@Deprecated
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.
     *
     * @since 6.2
     * @see FocusListener
     * @see FocusEvent
     */
    @Deprecated
    public interface FocusNotifier extends Serializable {
        /**
         * Adds a FocusListener to the Component which gets fired
         * when a Field receives keyboard focus.
         *
         * @param listener
         * @see FocusListener
         * @since 6.2
         */
        public void addFocusListener(FocusListener listener);

        /**
         * Removes a FocusListener from the Component.
         *
         * @param listener
         * @see FocusListener
         * @since 6.2
         */
        public void removeFocusListener(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.
     *
     * @since 6.2
     * @see BlurListener
     * @see BlurEvent
     */
    @Deprecated
    public interface BlurNotifier extends Serializable {
        /**
         * Adds a BlurListener to the Component which gets fired
         * when a Field loses keyboard focus.
         *
         * @param listener
         * @see BlurListener
         * @since 6.2
         */
        public void addBlurListener(BlurListener listener);

        /**
         * Removes a BlurListener from the Component.
         *
         * @param listener
         * @see BlurListener
         * @since 6.2
         */
        public void removeBlurListener(BlurListener listener);
    }

    /**
     * TextChangeEvents are fired when the user is editing the text content of a
     * field. Most commonly text change events are triggered by typing text with
     * keyboard, but e.g. pasting content from clip board to a text field also
     * triggers an event.
     * 

* TextChangeEvents differ from {@link ValueChangeEvent}s so that they are * triggered repeatedly while the end user is filling the field. * ValueChangeEvents are not fired until the user for example hits enter or * focuses another field. Also note the difference that TextChangeEvents are * only fired if the change is triggered from the user, while * ValueChangeEvents are also fired if the field value is set by the * application code. *

* The {@link TextChangeNotifier}s implementation may decide when exactly * TextChangeEvents are fired. TextChangeEvents are not necessary fire for * example on each key press, but buffered with a small delay. The * {@code TextField} component supports different modes for triggering * TextChangeEvents. * * @see TextChangeListener * @see TextChangeNotifier * @see TextField#setTextChangeEventMode(com.vaadin.ui.TextField.TextChangeEventMode) * @since 6.5 */ @Deprecated public abstract static class TextChangeEvent extends Component.Event { public TextChangeEvent(Component source) { super(source); } /** * @return the text content of the field after the * {@link TextChangeEvent} */ public abstract String getText(); /** * @return the cursor position during after the {@link TextChangeEvent} */ public abstract int getCursorPosition(); } /** * A listener for {@link TextChangeEvent}s. * * @since 6.5 */ @Deprecated public interface TextChangeListener extends ConnectorEventListener { public static String EVENT_ID = "ie"; public static Method EVENT_METHOD = ReflectTools.findMethod( TextChangeListener.class, "textChange", TextChangeEvent.class); /** * This method is called repeatedly while the text is edited by a user. * * @param event * the event providing details of the text change */ public void textChange(TextChangeEvent event); } /** * An interface implemented by a {@link Field} supporting * {@link TextChangeEvent}s. An example a {@link TextField} supports * {@link TextChangeListener}s. */ @Deprecated public interface TextChangeNotifier extends Serializable { public void addTextChangeListener(TextChangeListener listener); public void removeTextChangeListener(TextChangeListener listener); } }





© 2015 - 2025 Weber Informatics LLC | Privacy Policy