T
- the granularity typepublic abstract class AbstractDatelineModel<T extends IGranularity> extends Object implements IDatelineModel<T>
IDatelineModel
that contains the most
basic functionality shared by most dateline models.Modifier and Type | Field and Description |
---|---|
protected double |
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.
|
protected ITimeSpan |
selectedTimeSpan
Stores the currently selected time span (is NULL is no selection exists).
|
int |
spreadsheetCellWidth
The width used for the cells when the Gantt chart shows a spreadsheet.
|
protected ITimeSpan |
timeSpan
The total time span covered by the dateline model.
|
protected TimeZone |
timeZone
The time zone represented by the dateline model.
|
protected double |
zoom
The zoom factor that gets used for smooth zoom operations.
|
Modifier | Constructor and Description |
---|---|
protected |
AbstractDatelineModel(ITimeSpan timeSpan,
TimeZone timeZone)
Constructs a new dateline model.
|
Modifier and Type | Method and Description |
---|---|
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.
|
int |
getSpreadsheetCellWidth()
Returns the width used for spreadsheet cells.
|
ITimeSpan |
getTimeSpan()
Returns the total time span covered by the model / dateline.
|
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 |
setSpreadsheetCellWidth(int width)
Sets the width used for spreadsheet cells.
|
void |
setTimeSpan(ITimeSpan timeSpan)
Sets the total time span covered by the model / dateline.
|
void |
setTimeZone(TimeZone zone)
Sets the time zone represented by the dateline.
|
void |
setZoom(double zoom)
Sets a zoom factor on the model / dateline.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
getGrid, getTimeAt, getTimeLocation, getTimeSpanAt, getTimeString, requestVisibleTimeSpan
protected ITimeSpan selectedTimeSpan
protected TimeZone timeZone
protected ITimeSpan timeSpan
protected T extends IGranularity granularity
protected double zoom
protected double datelineWidth
public int spreadsheetCellWidth
protected AbstractDatelineModel(ITimeSpan timeSpan, 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)public void setSpreadsheetCellWidth(int width) throws DatelineModelException
setSpreadsheetCellWidth
in interface IDatelineModel<T extends IGranularity>
width
- spreadsheet cell widthDatelineModelException
- when the cell width violates model constraintspublic int getSpreadsheetCellWidth()
getSpreadsheetCellWidth
in interface IDatelineModel<T extends IGranularity>
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 datelineDatelineModelException
IDatelineModel.getTimeSpan()
public void setTimeZone(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 factorDatelineModelException
- 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 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 timesDatelineModelException
- 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 propagateDatelineModelVetoException
- 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
Copyright © 2006–2016 Dirk Lemmermann Software & Consulting. All rights reserved.