Class EventSelectionHandler
- java.lang.Object
-
- com.metsci.glimpse.core.plot.timeline.event.listener.EventSelectionHandler
-
public class EventSelectionHandler extends Object
Helper class which manages keeping track of selected Events forEventPlotInfo
.- Author:
- ulman
-
-
Constructor Summary
Constructors Constructor Description EventSelectionHandler()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addEventSelectionListener(EventSelectionListener listener)
void
addSelectedEvent(Event event)
void
clearSelectedEvents()
float[]
getSelectedEventBackgroundColor()
float[]
getSelectedEventBorderColor()
float
getSelectedEventBorderThickness()
Set<Event>
getSelectedEvents()
boolean
isAllowMouseEventSelection()
boolean
isAllowMultipleEventSelection()
boolean
isClearSelectionOnClick()
boolean
isEventSelected(Event event)
boolean
isHighlightSelectedEvents()
void
removeEventSelectionListener(EventSelectionListener listener)
void
removeSelectedEvent(Event event)
void
setAllowMouseEventSelection(boolean allowSelection)
If true, Events are automatically selected when users click inside or near them with the mouse (unless they are set as unselectable viaEvent.setSelectable(boolean)
.void
setAllowMultipleEventSelection(boolean allowMultiple)
If true, multiple events may be selected by holding down the ctrl key while clicking them.void
setClearSelectionOnClick(boolean clear)
If true, the set of selected events is cleared when the user clicks on an area of the timeline which contains no events.void
setHighlightSelectedEvents(boolean highlight)
void
setSelectedEventBackgroundColor(float[] color)
void
setSelectedEventBorderColor(float[] color)
void
setSelectedEventBorderThickness(float thickness)
void
setSelectedEvents(Set<Event> newEvents)
-
-
-
Method Detail
-
addEventSelectionListener
public void addEventSelectionListener(EventSelectionListener listener)
-
removeEventSelectionListener
public void removeEventSelectionListener(EventSelectionListener listener)
-
setAllowMultipleEventSelection
public void setAllowMultipleEventSelection(boolean allowMultiple)
If true, multiple events may be selected by holding down the ctrl key while clicking them. Does not restrict programmatic selection in any way.
-
isAllowMultipleEventSelection
public boolean isAllowMultipleEventSelection()
-
setClearSelectionOnClick
public void setClearSelectionOnClick(boolean clear)
If true, the set of selected events is cleared when the user clicks on an area of the timeline which contains no events. Otherwise, such a click has no effect on the selected events. In this case, the only way to deselect all events is to ctrl-click on all the selected events.- Parameters:
clear
-
-
isClearSelectionOnClick
public boolean isClearSelectionOnClick()
- See Also:
EventPlotInfo#setClearSelectionOnClick(boolean)
-
setAllowMouseEventSelection
public void setAllowMouseEventSelection(boolean allowSelection)
If true, Events are automatically selected when users click inside or near them with the mouse (unless they are set as unselectable via
Event.setSelectable(boolean)
. Clicking one event removes all other selected events unless the ctrl key is held down, in which case the clicked event is added or removed from the set of selected Events.If custom selection semmantics are required (only selecting events when their icon is clicked, for example), then
setAllowMouseEventSelection(boolean)
can be set to false and client code can attach a customEventPlotListener
orGlimpseMouseListener
which callssetSelectedEvents(Set)
as desired based on user clicks.- Parameters:
allowSelection
-
-
isAllowMouseEventSelection
public boolean isAllowMouseEventSelection()
-
clearSelectedEvents
public void clearSelectedEvents()
-
addSelectedEvent
public void addSelectedEvent(Event event)
-
removeSelectedEvent
public void removeSelectedEvent(Event event)
-
isEventSelected
public boolean isEventSelected(Event event)
-
getSelectedEventBorderColor
public float[] getSelectedEventBorderColor()
-
getSelectedEventBackgroundColor
public float[] getSelectedEventBackgroundColor()
-
getSelectedEventBorderThickness
public float getSelectedEventBorderThickness()
-
isHighlightSelectedEvents
public boolean isHighlightSelectedEvents()
-
setSelectedEventBorderColor
public void setSelectedEventBorderColor(float[] color)
-
setSelectedEventBackgroundColor
public void setSelectedEventBackgroundColor(float[] color)
-
setSelectedEventBorderThickness
public void setSelectedEventBorderThickness(float thickness)
-
setHighlightSelectedEvents
public void setHighlightSelectedEvents(boolean highlight)
-
-