public abstract class CascadingNavigationFilter extends NavigationFilter
NavigationFilter
, which supports chaining of filters
on an JTextComponent.
The implementation should call super methods to
allow lower-precedence filters to react. If the implementation desires to
disable the filters and take the movement action directly, it can still use
the FilterBypass
instance passed.
There are helper CascadingNavigationFilter.register(javax.swing.text.JTextComponent, org.netbeans.api.editor.caret.MoveCaretsOrigin)
and CascadingNavigationFilter.unregister()
methods which
ensure the chain of filters is correctly maintained. After registering, methods
implemented by this class will delegate to the remembered formerly-toplevel filter.
Implementor of this class may safely call super.* methods to delegate to filters
further in the chain.
NavigationFilter.FilterBypass
Constructor and Description |
---|
CascadingNavigationFilter() |
Modifier and Type | Method and Description |
---|---|
protected NavigationFilter |
getNextFilter()
Returns the next filter in the chain.
|
int |
getNextVisualPositionFrom(JTextComponent text,
int pos,
Position.Bias bias,
int direction,
Position.Bias[] biasRet) |
void |
moveDot(NavigationFilter.FilterBypass fb,
int dot,
Position.Bias bias) |
void |
register(JTextComponent component,
MoveCaretsOrigin origin)
Registers this Filter into the NavigationFilter chain.
|
void |
setDot(NavigationFilter.FilterBypass fb,
int dot,
Position.Bias bias) |
void |
setOwnerAndPrevious(JTextComponent component,
MoveCaretsOrigin orig,
NavigationFilter prev) |
void |
unregister()
Removes this NavigationFilter from the chain; preceding filter will
be connected to the following one, so the chain will not be broken.
|
protected final NavigationFilter getNextFilter()
public int getNextVisualPositionFrom(JTextComponent text, int pos, Position.Bias bias, int direction, Position.Bias[] biasRet) throws BadLocationException
getNextVisualPositionFrom
in class NavigationFilter
BadLocationException
public void moveDot(NavigationFilter.FilterBypass fb, int dot, Position.Bias bias)
moveDot
in class NavigationFilter
public void setDot(NavigationFilter.FilterBypass fb, int dot, Position.Bias bias)
setDot
in class NavigationFilter
public final void unregister()
public final void register(@NonNull JTextComponent component, @NonNull MoveCaretsOrigin origin)
This filter will be placed on top of the filter's chain and the formerly-toplevel filter will be remembered for delegation.
It is not permitted to register with more carets; make multiple instances of the filter for that case.
component
- where this Filter should be registered.origin
- operation specifierpublic void setOwnerAndPrevious(JTextComponent component, MoveCaretsOrigin orig, NavigationFilter prev)