com.vaadin.ui.

Class Window.CloseShortcut

  • All Implemented Interfaces:

    Action.Listener, Serializable

    Enclosing class:

    Window

    public static class Window.CloseShortcut
    extends ShortcutListener

    A ShortcutListener specifically made to define a keyboard shortcut that closes the window.

     
      // within the window using helper
      window.setCloseShortcut(KeyCode.ESCAPE, null);
    
      // or globally
      getUI().addAction(new Window.CloseShortcut(window, KeyCode.ESCAPE));
     
     

    See Also:

    Serialized Form

    • Field Detail

      • window

        protected Window window
    • Constructor Detail

      • CloseShortcut

        public CloseShortcut​(Window window,
                             String shorthandCaption)

        Creates a keyboard shortcut for closing the given window using the shorthand notation defined in ShortcutAction.

        Parameters:

        window - to be closed when the shortcut is invoked

        shorthandCaption - the caption with shortcut keycode and modifiers indicated

      • CloseShortcut

        public CloseShortcut​(Window window,
                             int keyCode,
                             int... modifiers)

        Creates a keyboard shortcut for closing the given window using the given ShortcutAction.KeyCode and ShortcutAction.ModifierKeys.

        Parameters:

        window - to be closed when the shortcut is invoked

        keyCode - KeyCode to react to

        modifiers - optional modifiers for shortcut

      • CloseShortcut

        public CloseShortcut​(Window window,
                             int keyCode)

        Creates a keyboard shortcut for closing the given window using the given ShortcutAction.KeyCode.

        Parameters:

        window - to be closed when the shortcut is invoked

        keyCode - KeyCode to react to