Class BaseKeyboardService

java.lang.Object
com.gluonhq.attach.keyboard.impl.BaseKeyboardService
All Implemented Interfaces:
KeyboardService
Direct Known Subclasses:
AndroidKeyboardService, IOSKeyboardService

public abstract class BaseKeyboardService extends Object implements KeyboardService
Base class that provides common functionality for iOS and Android implementations.
  • Property Details

  • Field Details

    • VISIBLE_HEIGHT

      protected static final javafx.beans.property.ReadOnlyFloatWrapper VISIBLE_HEIGHT
    • debug

      protected static final boolean debug
  • Method Details

    • keepVisibilityForNode

      public void keepVisibilityForNode(javafx.scene.Node node)
      Description copied from interface: KeyboardService
      Node is adjusted vertically when software keyboard shows up, so it is visible and not covered by it. For that, the root parent will be moved accordingly.
      Specified by:
      keepVisibilityForNode in interface KeyboardService
      Parameters:
      node - the Node to adjust, so it is always visible
    • keepVisibilityForNode

      public void keepVisibilityForNode(javafx.scene.Node node, javafx.scene.Parent parent)
      Description copied from interface: KeyboardService
      Node is adjusted vertically when software keyboard shows up, so it is visible and not covered by it
      Specified by:
      keepVisibilityForNode in interface KeyboardService
      Parameters:
      node - the Node to adjust, so it is always visible
      parent - the Parent of the node that will be moved
    • releaseVisibilityForNode

      public void releaseVisibilityForNode(javafx.scene.Node node)
      Description copied from interface: KeyboardService
      Stops adjusting the node when the software keyboard shows up, removing the listener previously registered via KeyboardService.keepVisibilityForNode(Node) or KeyboardService.keepVisibilityForNode(Node, Parent).
      Specified by:
      releaseVisibilityForNode in interface KeyboardService
      Parameters:
      node - the Node that was previously registered
    • visibleHeightProperty

      public javafx.beans.property.ReadOnlyFloatProperty visibleHeightProperty()
      Description copied from interface: KeyboardService
      Gets the visible height of the Keyboard, so scene or views can adjusted to prevent some of their content from being covered by the keyboard.
      Specified by:
      visibleHeightProperty in interface KeyboardService
      Returns:
      the visibleHeight property
    • setKeyboardTypeForNode

      public void setKeyboardTypeForNode(javafx.scene.Node node, KeyboardType type)
      Description copied from interface: KeyboardService
      Assigns a keyboard type to a specific node (typically a TextInputControl). When the node gains gets activated, the keyboard type is applied automatically. When the keyboard hides, the keyboard type reverts to KeyboardType.ASCII.

      If nodes are registered, they default to KeyboardType.ASCII.

      Specified by:
      setKeyboardTypeForNode in interface KeyboardService
      Parameters:
      node - the node (typically a text input control) to configure
      type - the KeyboardType to use when this node is active
    • removeKeyboardTypeForNode

      public void removeKeyboardTypeForNode(javafx.scene.Node node)
      Description copied from interface: KeyboardService
      Removes the keyboard type assignment and event filter previously installed via KeyboardService.setKeyboardTypeForNode(Node, KeyboardType). After this call the node will simply use the default keyboard type.
      Specified by:
      removeKeyboardTypeForNode in interface KeyboardService
      Parameters:
      node - the node to unregister
    • syntheticId

      protected static String syntheticId(javafx.scene.Node node)
      Uses the node's own id if set, otherwise falls back to an id based on its identity hash code.
    • adjustPosition

      protected static void adjustPosition(javafx.scene.Node node, javafx.scene.Parent parent, double kh)
    • applyKeyboardType

      protected abstract void applyKeyboardType(int nativeValue)
      Apply the keyboard type on the native side.
      Parameters:
      nativeValue - the integer value from KeyboardType.getValue()
    • applyActiveNodeId

      protected abstract void applyActiveNodeId(String id)
      Pass to the native layer the id of the currently active node.
      Parameters:
      id - the string id of the active node