Class NavigationArea

java.lang.Object
org.luwrain.controls.NavigationArea
All Implemented Interfaces:
ClipboardTranslator.Provider, RegionTextQueryTranslator.Provider, Area, HotPoint, HotPointControl, Lines
Direct Known Subclasses:
ConsoleArea, EditArea, FormArea, SimpleArea

public abstract class NavigationArea extends Object implements Area, HotPointControl, ClipboardTranslator.Provider, RegionTextQueryTranslator.Provider
An area with basic navigation operations. This abstract class implements the usual behaviour for navigation over the static text in the area. There is no data container, so it's implied that user should implement method getLine() and getLineCount().

The supported operations include arrow keys, Page up/down and Home/End. The copying to clipboard is supported as well.

See Also:
  • Field Details

    • context

      protected final ControlContext context
    • regionPoint

      protected final RegionPoint regionPoint
    • clipboardTranslator

      protected final ClipboardTranslator clipboardTranslator
    • regionTextQueryTranslator

      protected final RegionTextQueryTranslator regionTextQueryTranslator
    • hotPointX

      protected int hotPointX
    • hotPointY

      protected int hotPointY
  • Constructor Details

  • Method Details

    • onInputEvent

      public boolean onInputEvent(InputEvent event)
      Specified by:
      onInputEvent in interface Area
    • onSystemEvent

      public boolean onSystemEvent(SystemEvent event)
      Specified by:
      onSystemEvent in interface Area
    • onAreaQuery

      public boolean onAreaQuery(AreaQuery query)
      Specified by:
      onAreaQuery in interface Area
    • getAreaActions

      public Action[] getAreaActions()
      Specified by:
      getAreaActions in interface Area
    • onHome

      protected boolean onHome(InputEvent event)
    • onEnd

      protected boolean onEnd(InputEvent event)
    • onAltHome

      protected boolean onAltHome(InputEvent event)
    • onAltEnd

      protected boolean onAltEnd(InputEvent event)
    • onMoveDown

      protected boolean onMoveDown(InputEvent event)
    • onMoveUp

      protected boolean onMoveUp(InputEvent event)
    • onMoveRight

      protected boolean onMoveRight(InputEvent event)
    • onMoveLeft

      protected boolean onMoveLeft(InputEvent event)
    • onPageDown

      protected boolean onPageDown(InputEvent event)
    • isBlockBoundLine

      protected boolean isBlockBoundLine(int index, String line)
    • getNextBlockLine

      protected int getNextBlockLine(int startFrom)
    • onPageUp

      protected boolean onPageUp(InputEvent event)
    • getPrevBlockLine

      protected int getPrevBlockLine(int startFrom)
    • onAltRight

      protected boolean onAltRight(InputEvent event)
    • onAltLeft

      protected boolean onAltLeft(InputEvent event)
    • announceLine

      public void announceLine(int index, String line)
    • getNewHotPointX

      public int getNewHotPointX(int oldHotPointY, int newHotPointY, int oldHotPointX, String oldLine, String newLine)
    • reset

      public void reset(boolean announce)
    • redraw

      public void redraw()
      Redraws content and updates hot point position.
    • beginHotPointTrans

      public void beginHotPointTrans()
      Specified by:
      beginHotPointTrans in interface HotPointControl
    • endHotPointTrans

      public void endHotPointTrans()
      Specified by:
      endHotPointTrans in interface HotPointControl
    • setHotPoint

      public void setHotPoint(int x, int y)
      Sets the hot point to the new position. The provided coordinates are adjusted to real area size and the user may not take care about exceeding area bounds.
      Parameters:
      x - The x coordinate of the new position
      y - The y coordinate of the new position
    • setHotPointX

      public void setHotPointX(int value)
      Specified by:
      setHotPointX in interface HotPointControl
    • setHotPointY

      public void setHotPointY(int value)
      Specified by:
      setHotPointY in interface HotPointControl
    • getHotPointX

      public int getHotPointX()
      Specified by:
      getHotPointX in interface Area
      Specified by:
      getHotPointX in interface HotPoint
      Specified by:
      getHotPointX in interface HotPointControl
    • getHotPointY

      public int getHotPointY()
      Specified by:
      getHotPointY in interface Area
      Specified by:
      getHotPointY in interface HotPoint
      Specified by:
      getHotPointY in interface HotPointControl
    • onRegionTextQuery

      public String onRegionTextQuery(int fromX, int fromY, int toX, int toY)
      Specified by:
      onRegionTextQuery in interface RegionTextQueryTranslator.Provider
    • onClipboardCopyAll

      public boolean onClipboardCopyAll()
      Specified by:
      onClipboardCopyAll in interface ClipboardTranslator.Provider
    • onClipboardCopy

      public boolean onClipboardCopy(int fromX, int fromY, int toX, int toY, boolean withDeleting)
      Specified by:
      onClipboardCopy in interface ClipboardTranslator.Provider
    • onDeleteRegion

      public boolean onDeleteRegion(int fromX, int fromY, int toX, int toY)
      Specified by:
      onDeleteRegion in interface ClipboardTranslator.Provider
    • getRegionPoint

      public AbstractRegionPoint getRegionPoint()
    • getValidLineCount

      protected int getValidLineCount()
    • getLineNotNull

      protected String getLineNotNull(int index)
    • defaultLineAnnouncement

      public static void defaultLineAnnouncement(ControlContext context, int index, String line)