|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object com.dlsc.flexgantt.model.dateline.AbstractDatelineModel<T>
T
- the granularity typepublic abstract class AbstractDatelineModel<T extends IGranularity>
An abstract implementation of IDatelineModel
that contains the most
basic functionality shared by most dateline models.
Field Summary | |
---|---|
protected int |
datelineWidth
The width of the dateline based on the current granularity and the time span (the horizon). |
protected T |
granularity
Stores the currently used time granularity (e.g. hours, minutes, seconds, ...). |
protected ITimeSpan |
selectedTimeSpan
Stores the currently selected time span (is NULL is no selection exists). |
protected ITimeSpan |
timeSpan
The total time span covered by the dateline model. |
protected java.util.TimeZone |
timeZone
The time zone represented by the dateline model. |
protected double |
zoom
The zoom factor that gets used for smooth zoom operations. |
Constructor Summary | |
---|---|
protected |
AbstractDatelineModel(ITimeSpan timeSpan,
java.util.TimeZone timeZone)
Constructs a new dateline model. |
Method Summary | |
---|---|
void |
addDatelineModelListener(IDatelineModelListener l)
Adds a listener to the dateline model. |
protected abstract void |
calculateDatelineWidth()
Calculates the required width of the dateline based on the total time span and some additional information that needs to be provided by the subclasses. |
protected void |
fireDatelineModelChangeEvent(DatelineModelEvent evt)
Sends dateline model events to all currently registered listeners. |
protected void |
fireDatelineModelWillChangeEvent(DatelineModelEvent evt)
Sends dateline model events to all currently registered listeners. |
int |
getDatelineWidth()
Returns the width of the dateline that is required based on the current settings of the dateline model. |
T |
getGranularity()
Returns the currently shown granularity. |
ITimeSpan |
getSelectedTimeSpan()
Returns the currently selected time span. |
ITimeSpan |
getTimeSpan()
Returns the total time span covered by the model / dateline. |
java.util.TimeZone |
getTimeZone()
Returns the time zone represented by the dateline. |
double |
getZoom()
Returns the zoom factor of the model / dateline. |
void |
removeDatelineModelListener(IDatelineModelListener l)
Removes a listener from the dateline model. |
void |
setGranularity(T granularity)
Sets the granularity for the minor times, which will cause a recalculation of the dateline width. |
void |
setSelectedTimeSpan(ITimeSpan newSpan)
Sets a time span selection. |
void |
setTimeSpan(ITimeSpan timeSpan)
Sets the total time span covered by the model / dateline. |
void |
setTimeZone(java.util.TimeZone zone)
Sets the time zone represented by the dateline. |
void |
setZoom(double zoom)
Sets a zoom factor on the model / dateline. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Methods inherited from interface com.dlsc.flexgantt.model.dateline.IDatelineModel |
---|
getGrid, getTimeAt, getTimeLocation, getTimeSpanAt, getTimeString, requestVisibleTimeSpan |
Field Detail |
---|
protected ITimeSpan selectedTimeSpan
protected java.util.TimeZone timeZone
protected ITimeSpan timeSpan
protected T extends IGranularity granularity
protected double zoom
protected int datelineWidth
Constructor Detail |
---|
protected AbstractDatelineModel(ITimeSpan timeSpan, java.util.TimeZone timeZone)
timeSpan
- the total time span covered by the model (span in which the
user can scroll)timeZone
- the time zone represented by the model (used for offset
calculations)Method Detail |
---|
public ITimeSpan getTimeSpan()
IDatelineModel
TimeGranularityDatelineModel
for example uses the currently used TimeGranularity
while the
SimpleGranularityDatelineModel
uses the currently active
SimpleGranularity
.
getTimeSpan
in interface IDatelineModel<T extends IGranularity>
IDatelineModel.setTimeSpan(ITimeSpan)
public void setTimeSpan(ITimeSpan timeSpan) throws DatelineModelException
IDatelineModel
TimeGranularityDatelineModel
for example uses the currently used TimeGranularity
while the
SimpleGranularityDatelineModel
uses the currently active
SimpleGranularity
.
setTimeSpan
in interface IDatelineModel<T extends IGranularity>
timeSpan
- the total time span covered by the dateline
DatelineModelException
IDatelineModel.getTimeSpan()
public void setTimeZone(java.util.TimeZone zone) throws DatelineModelException
IDatelineModel
setTimeZone
in interface IDatelineModel<T extends IGranularity>
zone
- the time zone represented by the dateline (model)
DatelineModelException
IDatelineModel.getTimeZone()
public void setZoom(double zoom) throws DatelineModelException
IDatelineModel
setZoom
in interface IDatelineModel<T extends IGranularity>
zoom
- the zoom factor
DatelineModelException
- if the requested zoom factor can not be appliedIDatelineModel.getZoom()
public double getZoom()
IDatelineModel
getZoom
in interface IDatelineModel<T extends IGranularity>
IDatelineModel.setZoom(double)
public java.util.TimeZone getTimeZone()
IDatelineModel
getTimeZone
in interface IDatelineModel<T extends IGranularity>
IDatelineModel.setTimeZone(TimeZone)
public void setSelectedTimeSpan(ITimeSpan newSpan)
IDatelineModel
setSelectedTimeSpan
in interface IDatelineModel<T extends IGranularity>
newSpan
- the selected time spanIDatelineModel.getSelectedTimeSpan()
public T getGranularity()
getGranularity
in interface IDatelineModel<T extends IGranularity>
public void setGranularity(T granularity) throws DatelineModelException
setGranularity
in interface IDatelineModel<T extends IGranularity>
granularity
- the granularity to use for the minor times
DatelineModelException
- if the requested granularity can not be shown by the datelinepublic ITimeSpan getSelectedTimeSpan()
IDatelineModel
getSelectedTimeSpan
in interface IDatelineModel<T extends IGranularity>
IDatelineModel.setSelectedTimeSpan(ITimeSpan)
public void addDatelineModelListener(IDatelineModelListener l)
IDatelineModel
addDatelineModelListener
in interface IDatelineModel<T extends IGranularity>
l
- the listener to addIDatelineModel.removeDatelineModelListener(IDatelineModelListener)
public void removeDatelineModelListener(IDatelineModelListener l)
IDatelineModel
removeDatelineModelListener
in interface IDatelineModel<T extends IGranularity>
l
- the listener to removeIDatelineModel.addDatelineModelListener(IDatelineModelListener)
protected void fireDatelineModelWillChangeEvent(DatelineModelEvent evt) throws DatelineModelVetoException
evt
- the event to propagate
DatelineModelVetoException
- if a listener rejects the requested changeIDatelineModelListener
,
addDatelineModelListener(IDatelineModelListener)
protected void fireDatelineModelChangeEvent(DatelineModelEvent evt)
evt
- the event to propagateIDatelineModelListener
,
addDatelineModelListener(IDatelineModelListener)
public int getDatelineWidth()
IDatelineModel
getDatelineWidth
in interface IDatelineModel<T extends IGranularity>
protected abstract void calculateDatelineWidth() throws DatelineModelException
DatelineModelException
- if the calculated width exceeds the maximum width that is
equal to Integer.MAX_VALUE
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |