public class FocusControl extends ControlAdapter
Updates the contents of a TupleSet of focus items in response to mouse actions. For example, clicking a node or double-clicking a node could update its focus status. This Control supports monitoring a specified number of clicks to executing a focus change. By default a click pattern will cause a VisualItem to become the sole member of the focus group. Hold down the control key while clicking to add an item to a group without removing the current members.
Updating a focus group does not necessarily cause the display to change. For this functionality, either register an action with this control, or register a TupleSetListener with the focus group.
Modifier and Type | Field and Description |
---|---|
protected java.lang.String |
activity |
protected int |
button |
protected int |
ccount |
protected VisualItem |
curFocus |
protected Predicate |
filter |
LEFT_MOUSE_BUTTON, MIDDLE_MOUSE_BUTTON, RIGHT_MOUSE_BUTTON
Constructor and Description |
---|
FocusControl()
Creates a new FocusControl that changes the focus to another item
when that item is clicked once.
|
FocusControl(int clicks)
Creates a new FocusControl that changes the focus when an item is
clicked the specified number of times.
|
FocusControl(int clicks,
java.lang.String act)
Creates a new FocusControl that changes the focus when an item is
clicked the specified number of times.
|
FocusControl(java.lang.String focusGroup)
Creates a new FocusControl that changes the focus to another item
when that item is clicked once.
|
FocusControl(java.lang.String focusGroup,
int clicks)
Creates a new FocusControl that changes the focus when an item is
clicked the specified number of times.
|
FocusControl(java.lang.String focusGroup,
int clicks,
java.lang.String act)
Creates a new FocusControl that changes the focus when an item is
clicked the specified number of times.
|
Modifier and Type | Method and Description |
---|---|
protected boolean |
filterCheck(VisualItem item)
Perform a filtering check on the input item.
|
Predicate |
getFilter()
Get the filter for processing items by this focus control.
|
void |
itemClicked(VisualItem item,
java.awt.event.MouseEvent e)
Invoked when the mouse button has been clicked (pressed and released) on
a VisualItem.
|
void |
itemEntered(VisualItem item,
java.awt.event.MouseEvent e)
Invoked when the mouse enters a VisualItem.
|
void |
itemExited(VisualItem item,
java.awt.event.MouseEvent e)
Invoked when the mouse exits a VisualItem.
|
void |
setFilter(Predicate p)
Set a filter for processing items by this focus control.
|
isEnabled, itemDragged, itemKeyPressed, itemKeyReleased, itemKeyTyped, itemMoved, itemPressed, itemReleased, itemWheelMoved, keyPressed, keyReleased, keyTyped, mouseClicked, mouseDragged, mouseEntered, mouseExited, mouseMoved, mousePressed, mouseReleased, mouseWheelMoved, setEnabled
protected java.lang.String activity
protected VisualItem curFocus
protected int ccount
protected int button
protected Predicate filter
public FocusControl()
public FocusControl(java.lang.String focusGroup)
focusGroup
- the name of the focus group to usepublic FocusControl(int clicks)
clicks
- the number of clicks needed to switch the focus.public FocusControl(java.lang.String focusGroup, int clicks)
focusGroup
- the name of the focus group to useclicks
- the number of clicks needed to switch the focus.public FocusControl(int clicks, java.lang.String act)
clicks
- the number of clicks needed to switch the focus.act
- an action run to upon focus changepublic FocusControl(java.lang.String focusGroup, int clicks, java.lang.String act)
focusGroup
- the name of the focus group to useclicks
- the number of clicks needed to switch the focus.act
- an action run to upon focus changepublic void setFilter(Predicate p)
p
- the filtering predicate to applypublic Predicate getFilter()
protected boolean filterCheck(VisualItem item)
item
- the item to check against the filterpublic void itemEntered(VisualItem item, java.awt.event.MouseEvent e)
Control
itemEntered
in interface Control
itemEntered
in class ControlAdapter
Control.itemEntered(prefuse.visual.VisualItem, java.awt.event.MouseEvent)
public void itemExited(VisualItem item, java.awt.event.MouseEvent e)
Control
itemExited
in interface Control
itemExited
in class ControlAdapter
Control.itemExited(prefuse.visual.VisualItem, java.awt.event.MouseEvent)
public void itemClicked(VisualItem item, java.awt.event.MouseEvent e)
Control
itemClicked
in interface Control
itemClicked
in class ControlAdapter
Control.itemClicked(prefuse.visual.VisualItem, java.awt.event.MouseEvent)
Copyright ? 2013 Regents of the University of California