Package org.luwrain.controls
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 Summary
Modifier and TypeFieldDescriptionprotected final ClipboardTranslator
protected final ControlContext
protected int
protected int
protected final RegionPoint
protected final RegionTextQueryTranslator
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
announceLine
(int index, String line) void
static void
defaultLineAnnouncement
(ControlContext context, int index, String line) void
Action[]
int
int
protected String
getLineNotNull
(int index) int
getNewHotPointX
(int oldHotPointY, int newHotPointY, int oldHotPointX, String oldLine, String newLine) protected int
getNextBlockLine
(int startFrom) protected int
getPrevBlockLine
(int startFrom) protected int
protected boolean
isBlockBoundLine
(int index, String line) protected boolean
onAltEnd
(InputEvent event) protected boolean
onAltHome
(InputEvent event) protected boolean
onAltLeft
(InputEvent event) protected boolean
onAltRight
(InputEvent event) boolean
onAreaQuery
(AreaQuery query) boolean
onClipboardCopy
(int fromX, int fromY, int toX, int toY, boolean withDeleting) boolean
boolean
onDeleteRegion
(int fromX, int fromY, int toX, int toY) protected boolean
onEnd
(InputEvent event) protected boolean
onHome
(InputEvent event) boolean
onInputEvent
(InputEvent event) protected boolean
onMoveDown
(InputEvent event) protected boolean
onMoveLeft
(InputEvent event) protected boolean
onMoveRight
(InputEvent event) protected boolean
onMoveUp
(InputEvent event) protected boolean
onPageDown
(InputEvent event) protected boolean
onPageUp
(InputEvent event) onRegionTextQuery
(int fromX, int fromY, int toX, int toY) boolean
onSystemEvent
(SystemEvent event) void
redraw()
Redraws content and updates hot point position.void
reset
(boolean announce) void
setHotPoint
(int x, int y) Sets the hot point to the new position.void
setHotPointX
(int value) void
setHotPointY
(int value) Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface org.luwrain.core.Area
getAreaName
Methods inherited from interface org.luwrain.core.Lines
getLine, getLineCount
-
Field Details
-
context
-
regionPoint
-
clipboardTranslator
-
regionTextQueryTranslator
-
hotPointX
protected int hotPointX -
hotPointY
protected int hotPointY
-
-
Constructor Details
-
NavigationArea
-
-
Method Details
-
onInputEvent
- Specified by:
onInputEvent
in interfaceArea
-
onSystemEvent
- Specified by:
onSystemEvent
in interfaceArea
-
onAreaQuery
- Specified by:
onAreaQuery
in interfaceArea
-
getAreaActions
- Specified by:
getAreaActions
in interfaceArea
-
onHome
-
onEnd
-
onAltHome
-
onAltEnd
-
onMoveDown
-
onMoveUp
-
onMoveRight
-
onMoveLeft
-
onPageDown
-
isBlockBoundLine
-
getNextBlockLine
protected int getNextBlockLine(int startFrom) -
onPageUp
-
getPrevBlockLine
protected int getPrevBlockLine(int startFrom) -
onAltRight
-
onAltLeft
-
announceLine
-
getNewHotPointX
-
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 interfaceHotPointControl
-
endHotPointTrans
public void endHotPointTrans()- Specified by:
endHotPointTrans
in interfaceHotPointControl
-
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 positiony
- The y coordinate of the new position
-
setHotPointX
public void setHotPointX(int value) - Specified by:
setHotPointX
in interfaceHotPointControl
-
setHotPointY
public void setHotPointY(int value) - Specified by:
setHotPointY
in interfaceHotPointControl
-
getHotPointX
public int getHotPointX()- Specified by:
getHotPointX
in interfaceArea
- Specified by:
getHotPointX
in interfaceHotPoint
- Specified by:
getHotPointX
in interfaceHotPointControl
-
getHotPointY
public int getHotPointY()- Specified by:
getHotPointY
in interfaceArea
- Specified by:
getHotPointY
in interfaceHotPoint
- Specified by:
getHotPointY
in interfaceHotPointControl
-
onRegionTextQuery
- Specified by:
onRegionTextQuery
in interfaceRegionTextQueryTranslator.Provider
-
onClipboardCopyAll
public boolean onClipboardCopyAll()- Specified by:
onClipboardCopyAll
in interfaceClipboardTranslator.Provider
-
onClipboardCopy
public boolean onClipboardCopy(int fromX, int fromY, int toX, int toY, boolean withDeleting) - Specified by:
onClipboardCopy
in interfaceClipboardTranslator.Provider
-
onDeleteRegion
public boolean onDeleteRegion(int fromX, int fromY, int toX, int toY) - Specified by:
onDeleteRegion
in interfaceClipboardTranslator.Provider
-
getRegionPoint
-
getValidLineCount
protected int getValidLineCount() -
getLineNotNull
-
defaultLineAnnouncement
-