public class IlvDashboardKeySelectManager extends Object
IlvDashboardKeySelectManager
manages dashboard symbol
key selection.
This class is used by a IlvDashboardInteractor
to select the
IlvDashboardSymbol
objects in a dashboard diagram.
Symbols in a dashboard diagram are arranged in a selection chain. That is,
an order of selection inside the diagram.
IlvDashboardKeySelectManager
manages and updates the selection
chain in response to user actions.
IlvDashboardKeySelectManager
object and attach it
to the dashboard diagram view. The following code example shows how this is
done.
public void perform(ActionEvent e, IlvDiagrammer diagrammer) throws Exception { IlvDashboardDiagram source = (IlvDashboardDiagram) diagrammer; IlvDashboardContext context = new IlvDashboardContext(); IlvDashboardDiagram dashboard = new IlvDashboardDiagram(context); ... // Build the DOM DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance(); DocumentBuilder builder = factory.newDocumentBuilder(); Document document = builder.newDocument(); Element dashboardDOM = IlvDashboardDOM.buildDashboardDOM(document, source); document.appendChild(dashboardDOM); // Read the contents IlvDashboardDOM.readDashboardDOM(dashboard, document); // Manage view interactor dashboard.getView().setInteractor(new IlvDashboardInteractor()); // Manage keyboard focus selection dashboard.setSelectManager(new IlvDashboardKeySelectManager(dashboard)); ... }
IlvDashboardInteractor
,
IlvDashboardSymbol
,
IlvDashboardDiagram
,
IlvDashboardDiagram.setSelectManager(IlvDashboardKeySelectManager)
,
IlvDashboardContext
Constructor and Description |
---|
IlvDashboardKeySelectManager(IlvDashboardDiagram diagram)
Constructs an
IlvDashboardKeySelectManager object
to be used with diagram |
Modifier and Type | Method and Description |
---|---|
void |
focusGained()
Call
focusGained() when the dashboard diagram attached to
this selector gains the focus. |
void |
focusLost()
Call
focusLost() when the dashboard diagram attached to
this selector gains the focus. |
IlvDashboardSymbol |
getSelected()
Returns the currently selected symbol in the dashboard diagram.
|
protected void |
insertSelectableSymbol(IlvDashboardSymbol symbol)
Inserts a selectable symbol into the selection chain.
|
protected boolean |
isAfter(IlvDashboardSymbol symbol,
IlvDashboardSymbol reference)
Compares the selection chain order for two symbols.
|
protected boolean |
isSelectable(IlvDashboardSymbol symbol)
Tests if the
symbol is selectable. |
void |
removeSelectableSymbol(IlvDashboardSymbol symbol)
Removes
symbol from the selectable symbol chain. |
void |
select(IlvDashboardSymbol symbol)
Selects a
IlvDashboardSymbol in a dashboard diagram in
response to a keyboard event. |
void |
selectAt(double x,
double y,
IlvManagerView view)
Selects the object located at the (
x ,y )
coordinate in view . |
protected void |
selectImpl(IlvDashboardSymbol symbol)
Sets the keyboard selection to
symbol . |
void |
selectNext()
Select the next symbol in the selection chain.
|
void |
selectPrevious()
Selects the previous selectable symbol in the selection
chain.
|
protected void |
unselect(IlvDashboardSymbol symbol)
Removes the selection from
symbol . |
void |
updateSelectionChain()
Updates the selection chain.
|
public IlvDashboardKeySelectManager(IlvDashboardDiagram diagram)
IlvDashboardKeySelectManager
object
to be used with diagram
diagram
- A dashboard diagram that will react to key selection
events.public void updateSelectionChain()
public void select(IlvDashboardSymbol symbol)
IlvDashboardSymbol
in a dashboard diagram in
response to a keyboard event.symbol
- The symbol to be selected.public IlvDashboardSymbol getSelected()
public void removeSelectableSymbol(IlvDashboardSymbol symbol)
symbol
from the selectable symbol chain.symbol
- The Dashboard Symbol to be removed.public void selectNext()
public void selectPrevious()
public void selectAt(double x, double y, IlvManagerView view)
x
,y
)
coordinate in view
.
Note: if there is no selectable symbol at the specified location, this method does nothing.
x
- The x coordinate.y
- The y coordinate.view
- The view of the attached dashboard diagram.public void focusGained()
focusGained()
when the dashboard diagram attached to
this selector gains the focus.public void focusLost()
focusLost()
when the dashboard diagram attached to
this selector gains the focus.focusGained()
protected boolean isSelectable(IlvDashboardSymbol symbol)
symbol
is selectable. The default implementation
returns true
for any symbol that is not a link.symbol
- A symbol in the dashboard diagram attached to this
IlvDashboardKeySelectManager
instance.true
if symbol
can be selected.protected void insertSelectableSymbol(IlvDashboardSymbol symbol)
isAfter(IlvDashboardSymbol, IlvDashboardSymbol)
to determine its position in the selection order.symbol
- the selectable symbol to be inserted into the selection chain.protected boolean isAfter(IlvDashboardSymbol symbol, IlvDashboardSymbol reference)
symbol
- The symbol to be compared with a reference
symbol.reference
- The reference symbol to which symbol
is compared.true
if symbol
will gain keyboard
selection after reference
protected void unselect(IlvDashboardSymbol symbol)
symbol
.symbol
- The symbol that has lost keyboard selection.protected void selectImpl(IlvDashboardSymbol symbol)
symbol
.symbol
- The symbol that has keyboard selection.© Copyright 2024 Rogue Wave Software, Inc., a Perforce company.. All Rights Reserved.