T
- the type of the user / business object wrapped by the timeline
objectpublic class DefaultTimelineObject<T> extends AbstractPropertiesOwner implements ITimelineObject
ITimelineObject
interface. This
class provides all the information that is required to visualize the usage of
a time span via a horizontal bar. The object can be decorated with a label
and additional information about the object can be displayed in a popup /
annotation window. Most decisions made by policies are based on information
provided by this class.DefaultTimelineObjectRenderer
,
DefaultTimelineObjectEditor
Constructor and Description |
---|
DefaultTimelineObject()
Constructs a new timeline object with an undefined time span.
|
DefaultTimelineObject(ITimeSpan timeSpan)
Constructs a new timeline object.
|
DefaultTimelineObject(String name)
Constructs a new timeline object with an undefined time span.
|
DefaultTimelineObject(String name,
ITimeSpan timeSpan)
Constructs a new timeline object.
|
Modifier and Type | Method and Description |
---|---|
void |
addChild(ITimelineObject child)
Adds another timeline object as a child to this timeline object.
|
int |
compareTo(ITimelineObject tlo) |
Iterator<ITimelineObject> |
getChildren()
Returns an iterator over all children timeline objects of this timeline
object.
|
int |
getDragActions()
Returns the drag actions that can be performed on the timeline object.
|
String |
getLabel(LabelType type)
Returns labels for various purposes depending on the given label type
identifier.
|
int |
getLineIndex()
Returns the object's line index.
|
Object |
getPopupObject(boolean extended)
Returns the object for the popup window.
|
Object |
getPopupTitleObject()
Returns the object for the popup window.
|
Object |
getStatus()
Returns an object that represents some kind of status that the timeline
object is in.
|
ITimeSpan |
getTimeSpan()
Returns the time allocation of the timeline object.
|
T |
getUserObject()
Returns the user object wrapped by the timeline object.
|
boolean |
isDeletable()
Determines whether the timeline object can be deleted or not.
|
boolean |
isDurationChangeable()
Returns TRUE if the duration of the object can be modified.
|
boolean |
isInPlaceEditable()
Returns TRUE if the object can be edited via a timeline object editor.
|
boolean |
isParent()
Determines whether the timeline object is a parent timeline object.
|
boolean |
isSelectable()
Returns TRUE if the timeline object can be selected.
|
boolean |
isStartTimeChangeable()
Returns TRUE if the start time of the object can be modified.
|
void |
removeChild(ITimelineObject child)
Removes the given timeline object from the list of children of this
timeline object.
|
void |
setChildren(Collection<ITimelineObject> children)
Sets the given timeline objects as the children of this timeline object.
|
void |
setChildren(ITimelineObject... children)
Sets the given timeline objects as the children of this timeline object.
|
void |
setDeletable(boolean deletable)
Specifies whether the timeline object can be deleted by the user or not.
|
void |
setDragActions(int actions)
Specifies the drag actions that can be performed on the timeline object.
|
void |
setDurationChangeable(boolean changeable)
Determines whether or not the duration of the timeline object can be
edited by the user.
|
void |
setInPlaceEditable(boolean editable)
Specifies whether or not the timeline object can be edited with the help
of an
ITimelineObjectEditor instance. |
void |
setLabel(String label,
LabelType type)
Sets a new label for the given label type.
|
void |
setLineIndex(int index)
Specifies a line index.
|
void |
setPopupObject(Object object,
boolean extended)
Sets an object on the timeline object that will be used as input for the
popup renderer.
|
void |
setPopupTitleObject(Object object)
Sets the title object used for popup information windows.
|
void |
setSelectable(boolean b)
Specifies whether the timeline object can be selected.
|
void |
setStartTimeChangeable(boolean changeable)
Determines whether or not the start time of the timeline object can be
edited by the user.
|
void |
setStatus(Object status)
Sets an object that represents some kind of status that the timeline
object is in.
|
void |
setTimeSpan(ITimeSpan span)
Sets the time allocation of the timeline object.
|
void |
setUserObject(T obj)
Sets the user object on the timeline object.
|
String |
toString() |
getProperty, setProperty
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
getProperty, setProperty
public DefaultTimelineObject(String name, ITimeSpan timeSpan)
name
- the name of the timeline object gets displayed in the status
bar, the tooltip and in the title section of the popup window
(except if separate values for those places have been
specified via the setLabel(String, LabelType)
methodtimeSpan
- the time span that is assigned to the timeline object (may be
undefined, see TimeSpan.UNDEFINED
).public DefaultTimelineObject(String name)
name
- the name of the timeline object gets displayed in the status
bar, the tooltip and in the title section of the popup window
(except if separate values for those places have been
specified via the setLabel(String, LabelType)
methodTimeSpan.UNDEFINED
public DefaultTimelineObject(ITimeSpan timeSpan)
timeSpan
- the time span that is assigned to the timeline object (may be
undefined, see TimeSpan.UNDEFINED
).public DefaultTimelineObject()
TimeSpan.UNDEFINED
public void setUserObject(T obj)
obj
- the user object represented by the timeline objectgetUserObject()
public T getUserObject()
public ITimeSpan getTimeSpan()
ITimelineObject
getTimeSpan
in interface ITimelineObject
ITimelineObject.setTimeSpan(ITimeSpan)
public void setTimeSpan(ITimeSpan span)
ITimelineObject
setTimeSpan
in interface ITimelineObject
span
- the object's time allocationITimelineObject.getTimeSpan()
public int compareTo(ITimelineObject tlo)
compareTo
in interface Comparable<ITimelineObject>
public void setLabel(String label, LabelType type)
LabelType
enumerator specifies the context in which the label gets used: tooltip,
popup, status bar.label
- the new label used for the given label typetype
- the label type designating where the label will be usedpublic String getLabel(LabelType type)
ITimelineObject
getLabel
in interface ITimelineObject
type
- the type of label requestedILabelPolicy.getLabel(TimelineObjectPath, IGanttChartModel,
LabelType)
public boolean isStartTimeChangeable()
ITimelineObject
isStartTimeChangeable
in interface ITimelineObject
IEditTimelineObjectPolicy.isStartTimeChangeable(TimelineObjectPath,
IGanttChartModel)
public void setStartTimeChangeable(boolean changeable)
changeable
- if TRUE the start time can be modified interactively by the
userisStartTimeChangeable()
public boolean isDurationChangeable()
ITimelineObject
isDurationChangeable
in interface ITimelineObject
IEditTimelineObjectPolicy.isDurationChangeable(TimelineObjectPath,
IGanttChartModel)
public void setDurationChangeable(boolean changeable)
changeable
- if TRUE the duration can be modified interactively by the userisDurationChangeable()
,
IEditTimelineObjectPolicy.isDurationChangeable(TimelineObjectPath,
IGanttChartModel)
,
DefaultEditTimelineObjectPolicy
,
DefaultChangeTimelineObjectTimeSpanCommand
public Object getPopupObject(boolean extended)
ITimelineObject
getPopupObject
in interface ITimelineObject
extended
- a flag that signals whether the user wants to see the standard
popup information or the extended versionPopupLayer
,
IPopupRenderer
,
DefaultPopupRenderer
,
IPopupPolicy.getPopupValue(TimelineObjectPath, IGanttChartModel,
boolean)
public void setPopupObject(Object object, boolean extended)
extended
- a flag used to determine if the given object will be used as
for the standard or the extended popupobject
- the popup object that will be visualized by the popup layer
and rendererIPopupRenderer
,
PopupLayer
,
IPopupPolicy
,
DefaultPopupRenderer
public Object getPopupTitleObject()
ITimelineObject
getPopupTitleObject
in interface ITimelineObject
PopupLayer
,
IPopupRenderer
,
DefaultPopupRenderer
,
IPopupPolicy.getPopupTitleValue(TimelineObjectPath,
IGanttChartModel)
public void setPopupTitleObject(Object object)
object
- IPopupPolicy.getPopupTitleValue(TimelineObjectPath,
IGanttChartModel)
,
DefaultPopupRenderer
public boolean isSelectable()
ITimelineObject
isSelectable
in interface ITimelineObject
ISelectionPolicy.isSelectable(TimelineObjectPath, IGanttChartModel)
public void setSelectable(boolean b)
ITimelineObjectSelectionModel
of the layer
on which they are displayed at the time of their selection.b
- if TRUE the timeline object can be selected by the userITimelineObjectSelectionModel.isSelected(TimelineObjectPath)
,
ISelectionPolicy.isSelectable(TimelineObjectPath, IGanttChartModel)
public boolean isInPlaceEditable()
ITimelineObject
isInPlaceEditable
in interface ITimelineObject
IEditTimelineObjectPolicy.isInPlaceEditable(TimelineObjectPath,
IGanttChartModel)
,
ITimelineObjectEditor
public void setInPlaceEditable(boolean editable)
ITimelineObjectEditor
instance. These are user interface
components that are added directly to the layer container so that no
additional dialogs have to be opened.editable
- if TRUE the timeline object can be edited with an user
interface component directly inside the layer containerLayerContainer.setTimelineObjectEditor(Class, ITimelineObjectEditor)
,
EditingLayer
public void setLineIndex(int index)
index
- the timeline object's line index, use -1 to have the object
not use a line but the hierarchy node's entire row heightgetLineIndex()
,
ILinePolicy.getLineIndex(Object, ITreeTableModel, Object)
,
IGanttChartNode.getLineCount()
,
IGanttChartNode.getLineLocation(int, int)
,
IGanttChartNode.getLineHeight(int, int)
public int getLineIndex()
getLineIndex
in interface ITimelineObject
setLineIndex(int)
,
ILinePolicy.getLineIndex(Object, ITreeTableModel, Object)
,
IGanttChartNode.getLineCount()
,
IGanttChartNode.getLineLocation(int, int)
,
IGanttChartNode.getLineHeight(int, int)
public void setDeletable(boolean deletable)
deletable
- if TRUE the object can be deleted by the userIEditTimelineObjectPolicy.isDeletable(TimelineObjectPath,
IGanttChartModel)
public boolean isDeletable()
ITimelineObject
isDeletable
in interface ITimelineObject
IEditTimelineObjectPolicy.isDeletable(TimelineObjectPath,
IGanttChartModel)
public Object getStatus()
OverviewPalette
for example uses it
to color the timeline objects in different colors depending on their
current status.getStatus
in interface ITimelineObject
public void setStatus(Object status)
OverviewPalette
for example uses it
to color the timeline objects in different colors depending on their
current status.status
- the application-specific status of the timeline objectpublic void addChild(ITimelineObject child)
child
- the child timeline objectisParent()
public void removeChild(ITimelineObject child)
child
- the child to removeisParent()
public void setChildren(ITimelineObject... children)
children
- the children timeline objectspublic void setChildren(Collection<ITimelineObject> children)
children
- the children timeline objectspublic boolean isParent()
ITimelineObject
isParent
in interface ITimelineObject
ITimelineObject.getChildren()
public Iterator<ITimelineObject> getChildren()
ITimelineObject
getChildren
in interface ITimelineObject
ITimelineObject.isParent()
public void setDragActions(int actions)
DnDConstants
. Possible values are:
Declaring the drag actions is only half of the work needed for correct
drag and drop behaviour. A timeline object might be draggable but it also
needs a place where it can be dropped. The drop places are defined by
IGanttChartNode.getDropActions(Object, long)
.actions
- the supported drag actions (move, copy, or both)DefaultDragAndDropCommand
,
IDragAndDropPolicy.getDragActions(TimelineObjectPath,
IGanttChartModel)
public int getDragActions()
ITimelineObject
DnDConstants
. Possible values are:
Declaring the drag actions is only half of the work needed for correct
drag and drop behaviour. A timeline object might be draggable but it also
needs a place where it can be dropped. The drop places are defined by
IGanttChartNode.getDropActions(Object, long)
.getDragActions
in interface ITimelineObject
DefaultDragAndDropCommand
,
IDragAndDropPolicy.getDragActions(TimelineObjectPath,
IGanttChartModel)
Copyright © 2006–2020 Dirk Lemmermann Software & Consulting. All rights reserved.