public class Event extends Object implements Iterable<Event>
EventPlotInfo
(which represents
a row or column of a StackedTimePlot2D
.
In addition to time bounds, Events can have text labels, icons, and tool tips associated
with them. EventPlotInfo allows registering of listeners which report when the mouse
interacts with an Event. Events can also be adjusted by the user by click and
dragging on their bounds.Modifier and Type | Class and Description |
---|---|
static class |
Event.OverlapRenderingMode
Indicates what types of overlaps should be considered when determining whether to shorten Event box text.
|
static class |
Event.TextRenderingMode
Indicates how text which is too large to fit in the Event box should be shortened.
|
Modifier and Type | Method and Description |
---|---|
void |
addConstraint(EventConstraint constraint)
Adds an EventConstraint which determines whether proposed changes to the min
and max time bounds of an Event are allowed.
|
boolean |
contains(TimeStamp time)
Returns whether the provided Timestamp is inside the bounds of this Event.
|
static Event |
createDummyEvent(Event event) |
static Event |
createDummyEvent(TimeStamp time) |
boolean |
equals(Object obj) |
float[] |
getBackgroundColor()
|
float[] |
getBorderColor()
|
float |
getBorderThickness() |
double |
getDuration() |
TimeStamp |
getEndTime() |
static Comparator<Event> |
getEndTimeComparator() |
int |
getEventCount()
Gets the number of aggregated events that make up this event.
|
EventPainter |
getEventPainter() |
EventPlotInfo |
getEventPlotInfo() |
Object |
getIconId() |
int |
getIconSize() |
Object |
getId()
An Event's id may be any Object, but its
equals(Object) and hashCode()
methods should be properly implemented and it should be unique among the Events of an
EventPlotInfo timeline. |
String |
getLabel() |
float[] |
getLabelColor() |
double |
getMaxTimeSpan()
|
double |
getMinTimeSpan()
|
Event.OverlapRenderingMode |
getOverlapRenderingMode() |
double |
getOverlapTime(Event event) |
int |
getRow()
EventPlotInfo plots on a StackedTimePlot2D can place events into multiple
rows to prevent them from overlapping with one another if they overlap in time. |
TimeStamp |
getStartTime() |
static Comparator<Event> |
getStartTimeComparator() |
Event.TextRenderingMode |
getTextRenderingMode() |
TimeSpan |
getTimeSpan() |
String |
getToolTipText() |
boolean |
hasChildren()
Events can be aggregated when many Events are close together in time and the timeline view is zoomed out very far.
|
int |
hashCode() |
boolean |
isEditable() |
boolean |
isEndTimeMoveable() |
boolean |
isFixedRow()
Events may either be assigned a fixed row to be displayed on, or may float automatically between
rows to ensure that no Events overlap in time.
|
boolean |
isResizeable()
|
boolean |
isSelectable() |
boolean |
isShowBackground()
return if true, the event box is filled with the background color.
|
boolean |
isShowBorder() |
boolean |
isShowIcon()
return whether the icon associated with this event should be shown when room permits.
|
boolean |
isShowLabel()
return whether the label associated with this event should be shown when room permits.
|
boolean |
isStartTimeMoveable() |
boolean |
isUseDefaultIconSize() |
Iterator<Event> |
iterator()
EventPlotInfo can automatically create synthetic groups of Events when the timeline
is zoomed out far enough that a bunch of Events are crowded into the same space.
|
void |
paint(EventPainter defaultPainter,
javax.media.opengl.GL2 gl,
Event nextEvent,
EventPlotInfo info,
GlimpseBounds bounds,
Axis1D timeAxis,
int posMin,
int posMax) |
void |
removeConstraint(EventConstraint constraint) |
void |
setBackgroundColor(float[] backgroundColor) |
void |
setBorderColor(float[] borderColor) |
void |
setBorderThickness(float thickness) |
void |
setEditable(boolean isEditable)
Sets whether or not the Event start and end times are modifiable by the user
via mouse interaction.
|
void |
setEndTime(TimeStamp endTime) |
void |
setEndTimeMoveable(boolean isEndTimeMoveable)
If true, the endTime of the Event cannot be adjusted by user mouse gestures.
|
void |
setEventPainter(EventPainter painter)
Sets a custom painter for this event.
|
void |
setFixedRow(int rowIndex)
This event will appear on the requested row index in the timeline
regardless of whether that causes it to overlap with other Events.
|
void |
setFloatingRow()
The row this Event appears on will be managed by its
EventPlotInfo
parent. |
void |
setIconId(Object iconId)
Sets the icon displayed inside the Event box on the timeline.
|
void |
setIconSize(int iconSize)
Sets the height of the Event's icon (for horizontal timeline layouts) or the width (for vertical timeline layouts).
|
void |
setLabel(String name)
Sets the text displayed inside the Event box on the timeline.
|
void |
setLabelColor(float[] textColor) |
void |
setMaxTimeSpan(double maxTimeSpan)
Sets the maximum time span between the start and end times.
|
void |
setMinTimeSpan(double minTimeSpan)
Sets the minimum (inclusive) span between the start and end times.
|
void |
setOverlapMode(Event.OverlapRenderingMode mode)
Set what types of overlaps should be considered when determining whether to shorten Event box text
and whether to display the Event's icon.
|
void |
setResizeable(boolean isResizeable)
If true, the time span of the Event (the amount of time between the start and
end times) cannot be adjusted by user mouse gestures.
|
void |
setSelectable(boolean isSelectable)
Sets whether or not this Event can be selected via mouse clicks.
|
void |
setShowBackground(boolean showBorder) |
void |
setShowBorder(boolean showBorder) |
void |
setShowIcon(boolean showIcon) |
void |
setShowLabel(boolean showName) |
void |
setStartTime(TimeStamp startTime) |
void |
setStartTimeMoveable(boolean isStartTimeMoveable)
If true, the startTime of the Event cannot be adjusted by user mouse gestures.
|
void |
setTextRenderingMode(Event.TextRenderingMode mode)
Sets how text and icons should be handled when this Event's box is too small or when it overlaps
with another Event's box.
|
void |
setTimes(TimeStamp startTime,
TimeStamp endTime)
|
void |
setTimes(TimeStamp startTime,
TimeStamp endTime,
boolean force)
Sets the start and end time for this Event.
|
void |
setToolTipText(String text)
Sets the tooltip text to be displayed when the user mouses over this Event.
|
void |
setUseDefaultIconSize(boolean useDefaultSize)
If a specific icon size has not been set, the default icon size is used.
|
String |
toString() |
forEach, spliterator
public void paint(EventPainter defaultPainter, javax.media.opengl.GL2 gl, Event nextEvent, EventPlotInfo info, GlimpseBounds bounds, Axis1D timeAxis, int posMin, int posMax)
EventPainter#paint(GL, Event, Event, EventPlotInfo, GlimpseBounds, Axis1D, int, int)
public void setIconSize(int iconSize)
iconSize
- the icon size in pixelspublic int getIconSize()
setIconSize(int)
public void setUseDefaultIconSize(boolean useDefaultSize)
public boolean isUseDefaultIconSize()
setUseDefaultIconSize(boolean)
public boolean hasChildren()
public int getEventCount()
public Iterator<Event> iterator()
public void setEventPainter(EventPainter painter)
EventPlotInfo#setEventPainter(EventPainter)
can be used to modify the default
EventPainter used for all events in the EventPlotInfo. However, the EventPainter set
here takes precedence.painter
- the EventPainter to use to render this event on the timelinepublic EventPainter getEventPainter()
setEventPainter(EventPainter)
public void addConstraint(EventConstraint constraint)
Adds an EventConstraint which determines whether proposed changes to the min and max time bounds of an Event are allowed.
This method should be used for specialized constraints. Events support basic constraints by default via setEditable, setResizeable, setEndTimeMoveable, setStartTimeMoveable, setMinTimeSpan, and setMaxTimeSpan.
constraint
- the EventConstraint to addpublic void removeConstraint(EventConstraint constraint)
constraint
- the EventConstraint to removeaddConstraint(EventConstraint)
public void setToolTipText(String text)
public String getToolTipText()
getToolTipText()
public void setSelectable(boolean isSelectable)
EventPlotInfo#setSelectedEvents(java.util.Set)
.isSelectable
- public boolean isSelectable()
isSelectable()
public void setEditable(boolean isEditable)
setStartTimeMoveable(boolean)
, setResizeable(boolean)
,
and setMinTimeSpan(double)
.public boolean isEditable()
setEditable(boolean)
public boolean isEndTimeMoveable()
setEndTimeMoveable(boolean)
public void setEndTimeMoveable(boolean isEndTimeMoveable)
public boolean isStartTimeMoveable()
setStartTimeMoveable(boolean)
public void setStartTimeMoveable(boolean isStartTimeMoveable)
public boolean isResizeable()
public void setResizeable(boolean isResizeable)
public double getMaxTimeSpan()
public void setMaxTimeSpan(double maxTimeSpan)
public double getMinTimeSpan()
public void setMinTimeSpan(double minTimeSpan)
public String getLabel()
public void setLabel(String name)
name
- public Object getIconId()
setIconId(Object)
public void setIconId(Object iconId)
TextureAtlas
associated with the EventPlotInfo
parent of this Event.iconId
- the identifier for the icon displayed inside the Event box on the timeline.public void setBorderThickness(float thickness)
thickness
- the thickness (in pixels) of the border around the box for this Event on the timeline.public float getBorderThickness()
setBorderThickness(float)
public float[] getBackgroundColor()
public void setBackgroundColor(float[] backgroundColor)
backgroundColor
- the fill color of the box for this Event on the timeline.public float[] getBorderColor()
public void setBorderColor(float[] borderColor)
borderColor
- the border color of the box for this Event on the timeline.public float[] getLabelColor()
setLabelColor(float[])
public void setLabelColor(float[] textColor)
textColor
- the color for the label text display for this Event on the timeline.public void setTimes(TimeStamp startTime, TimeStamp endTime, boolean force)
Sets the start and end time for this Event.
If force is false, then the constraints (see addConstraint(EventConstraint)
)
are taken into account and the final Event bounds might not be equal to
the input arguments.
startTime
- endTime
- force
- public int getRow()
EventPlotInfo
plots on a StackedTimePlot2D
can place events into multiple
rows to prevent them from overlapping with one another if they overlap in time. This
method allows querying for the row that this Event has been assigned.public boolean isFixedRow()
getRow()
public void setFloatingRow()
EventPlotInfo
parent. If EventPlotInfo.setStackOverlappingEvents(boolean)
is set
to true, then the row will be set to avoid overlaps with other events, otherwise
the Event will be placed in the first row.public void setFixedRow(int rowIndex)
public void setTimes(TimeStamp startTime, TimeStamp endTime)
startTime
- endTime
- public TimeStamp getStartTime()
public void setStartTime(TimeStamp startTime)
startTime
- setTimes(TimeStamp, TimeStamp, boolean)
public TimeStamp getEndTime()
public void setEndTime(TimeStamp endTime)
startTime
- setTimes(TimeStamp, TimeStamp, boolean)
public TimeSpan getTimeSpan()
public boolean isShowLabel()
public void setShowLabel(boolean showName)
showName
- whether to show the label text in this Event's box on the timeline.public void setOverlapMode(Event.OverlapRenderingMode mode)
mode
- public Event.OverlapRenderingMode getOverlapRenderingMode()
setOverlapMode(OverlapRenderingMode)
public void setTextRenderingMode(Event.TextRenderingMode mode)
mode
- public Event.TextRenderingMode getTextRenderingMode()
setTextRenderingMode(TextRenderingMode)
public boolean isShowIcon()
public void setShowIcon(boolean showIcon)
showIcon
- whether to show the icon associated with this event.public boolean isShowBackground()
public void setShowBackground(boolean showBorder)
showBorder
- whether to fill the event box with the background color.public boolean isShowBorder()
public void setShowBorder(boolean showBorder)
showBorder
- whether to draw a line border around the event box.public Object getId()
An Event's id may be any Object, but its equals(Object)
and hashCode()
methods should be properly implemented and it should be unique among the Events of an
EventPlotInfo
timeline.
EventPlotListener
will use this id when reporting events occurring on this Event.
public EventPlotInfo getEventPlotInfo()
public double getOverlapTime(Event event)
public double getDuration()
public boolean contains(TimeStamp time)
Returns whether the provided Timestamp is inside the bounds of this Event. The startTime is treated as inclusive and the endTime is treated as exclusive. This means that instantaneous events (with startTime equal to endTime) will always return false.
This method is equivalent to event.getStartTime().isBeforeOrEquals( time ) && event.getEndTime().isAfter( time )
time
- the TimeStamp to testpublic static Comparator<Event> getStartTimeComparator()
public static Comparator<Event> getEndTimeComparator()
Copyright © 2016 Metron, Inc.. All rights reserved.