Object
Formatter
- All Implemented Interfaces:
Runnable
- Enclosing class:
ValuesUnderCursor
Task for fetching and formatting values in a background thread.
The background thread and the interaction with JavaFX thread are managed by the enclosing class.
The same
Formatter
instance can be reused as long as the source of data does not change.
As a rule of thumbs, all properties in ValuesUnderCursor
class shall be read and written
from the JavaFX thread, while all properties in this Formatter
class may be read and written
from any thread.
- Since:
- 1.3
-
Constructor Summary
ModifierConstructorDescriptionprotected
Formatter
(ValuesUnderCursor owner) Creates a new formatter instance. -
Method Summary
Modifier and TypeMethodDescriptionabstract String
evaluate
(DirectPosition point) Returns a string representation of data under the given "real world" position.void
run()
Invoked in a background thread for formatting values at the most recent position.
-
Constructor Details
-
Formatter
Creates a new formatter instance.- Parameters:
owner
- instance of the enclosing class which will evaluate values under cursor position.
-
-
Method Details
-
run
public void run()Invoked in a background thread for formatting values at the most recent position. If the cursor moves while this method is formatting values, then this method will continue its execution for formatting also the values at new positions until the cursor stop moving.This method does not need to be invoked explicitly; it is invoked automatically by
ValuesUnderCursor
. But it may be overridden for adding pretreatment or post-treatment. -
evaluate
Returns a string representation of data under the given "real world" position. The position CRS should be non-null for avoiding ambiguity about what is the default CRS. The position CRS may be anything; this method shall transform coordinates itself if needed.This method is invoked by
run()
in a background thread. Implementations are responsible for fetching data in a thread-safe manner.- Parameters:
point
- the cursor location in arbitrary CRS (usually the CRS shown in the status bar). May benull
for declaring that the point is outside canvas region.- Returns:
- string representation of data under given position, or
null
if none.
-