Search in sources :

Example 1 with BlurListener

use of com.vaadin.event.FieldEvents.BlurListener in project opencms-core by alkacon.

the class CmsMessageBundleEditorOptions method initAddKeyInput.

/**
 * Initializes the input field for new keys {@link #m_addKeyInput}.
 */
private void initAddKeyInput() {
    // the input field for the key
    m_addKeyInput = new TextField();
    m_addKeyInput.setWidth("100%");
    m_addKeyInput.setInputPrompt(m_messages.key(Messages.GUI_INPUT_PROMPT_ADD_KEY_0));
    final ShortcutListener shortCutListener = new ShortcutListener("Add key via ENTER", KeyCode.ENTER, null) {

        private static final long serialVersionUID = 1L;

        @Override
        public void handleAction(Object sender, Object target) {
            handleAddKey();
        }
    };
    m_addKeyInput.addFocusListener(new FocusListener() {

        private static final long serialVersionUID = 1L;

        public void focus(FocusEvent event) {
            m_addKeyInput.addShortcutListener(shortCutListener);
        }
    });
    m_addKeyInput.addBlurListener(new BlurListener() {

        private static final long serialVersionUID = 1L;

        public void blur(BlurEvent event) {
            m_addKeyInput.removeShortcutListener(shortCutListener);
        }
    });
}
Also used : ShortcutListener(com.vaadin.event.ShortcutListener) BlurListener(com.vaadin.event.FieldEvents.BlurListener) TextField(com.vaadin.v7.ui.TextField) BlurEvent(com.vaadin.event.FieldEvents.BlurEvent) FocusListener(com.vaadin.event.FieldEvents.FocusListener) FocusEvent(com.vaadin.event.FieldEvents.FocusEvent)

Aggregations

BlurEvent (com.vaadin.event.FieldEvents.BlurEvent)1 BlurListener (com.vaadin.event.FieldEvents.BlurListener)1 FocusEvent (com.vaadin.event.FieldEvents.FocusEvent)1 FocusListener (com.vaadin.event.FieldEvents.FocusListener)1 ShortcutListener (com.vaadin.event.ShortcutListener)1 TextField (com.vaadin.v7.ui.TextField)1