|
||||||||||
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<SimpleGranularity> com.dlsc.flexgantt.swing.timeline.SimpleGranularityDatelineModel
public class SimpleGranularityDatelineModel
A dateline model implementation based on the SimpleGranularity
enumerator. The model returns major time points that are always ten times
larger than the minor time points. So if the minor times are 1, 2, 3, ...
then the major times are 10, 20, 30, 40, 50, ...
SimpleGranularity
,
SimpleGranularityDatelineRenderer
,
SimpleGranularityGridPolicy
Field Summary |
---|
Fields inherited from class com.dlsc.flexgantt.model.dateline.AbstractDatelineModel |
---|
datelineWidth, granularity, selectedTimeSpan, timeSpan, timeZone, zoom |
Constructor Summary | |
---|---|
SimpleGranularityDatelineModel(Dateline dateline)
Constructs a new dateline model. |
|
SimpleGranularityDatelineModel(Dateline dateline,
ITimeSpan timeSpan,
SimpleGranularity sg)
Constructs a new dateline model. |
|
SimpleGranularityDatelineModel(Dateline dateline,
ITimeSpan timeSpan,
SimpleGranularity sg,
java.util.TimeZone timeZone)
Constructs a new dateline model. |
|
SimpleGranularityDatelineModel(Dateline dateline,
SimpleGranularity sg)
Constructs a new dateline model. |
Method Summary | |
---|---|
protected 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. |
int |
getGap()
The gap (in pixel) that will be added twice to each granularity width so that there will be some space between the text and the grid lines. |
java.util.List<GridLine> |
getGrid(int x1,
int x2,
boolean major)
Returns a list of grid line coordinates for the given coordinate interval. |
java.lang.String |
getMajorDateString(SimpleGranularity granularity,
long time)
Returns a text representation for the given major time point and granularity. |
SimpleGranularity |
getMajorSimpleGranularity()
Returns the currently shown major granularity, which gets determined by invoking SimpleGranularity.next() on the current
granularity. |
java.lang.String |
getMinorDateString(SimpleGranularity granularity,
long time)
Returns a text representation for the given minor time point and granularity. |
long |
getTimeAt(int x)
Returns the time for the given x-coordinate. |
int |
getTimeLocation(long time)
Returns the location of the given time point. |
ITimeSpan |
getTimeSpanAt(int x,
boolean major)
Returns the time span that gets defined by the grid lines to the left and the right of the given x-coordinate. |
java.lang.String |
getTimeString(long time)
Returns a textual representation for the givent time point. |
void |
requestVisibleTimeSpan(ITimeSpan span)
A request that asks the model to change its settings in such a way that the requested time span will become visible in the viewport on the right-hand side of the Gantt chart. |
void |
setGap(int gap)
Sets the gap (in pixel) that will be added twice to each granularity width so that there will be some space between the text and the grid lines. |
Methods inherited from class com.dlsc.flexgantt.model.dateline.AbstractDatelineModel |
---|
addDatelineModelListener, fireDatelineModelChangeEvent, fireDatelineModelWillChangeEvent, getDatelineWidth, getGranularity, getSelectedTimeSpan, getTimeSpan, getTimeZone, getZoom, removeDatelineModelListener, setGranularity, setSelectedTimeSpan, setTimeSpan, setTimeZone, setZoom |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public SimpleGranularityDatelineModel(Dateline dateline, ITimeSpan timeSpan, SimpleGranularity sg, java.util.TimeZone timeZone) throws DatelineModelException
dateline
- the dateline to which the model belongstimeSpan
- the total time span covered (the planning horizon)sg
- the initial simple granularitytimeZone
- the time zone represented by the model
DatelineModelException
- if the requested time span can not be visualized with the
requested granularitypublic SimpleGranularityDatelineModel(Dateline dateline, ITimeSpan timeSpan, SimpleGranularity sg) throws DatelineModelException
TimeZone.getDefault()
dateline
- the dateline to which the model belongstimeSpan
- the total time span covered (the planning horizon)sg
- the initial simple granularity
DatelineModelException
- if the requested time span can not be visualized with the
requested granularitypublic SimpleGranularityDatelineModel(Dateline dateline, SimpleGranularity sg) throws DatelineModelException
TimeZone.getDefault()
dateline
- the dateline to which the model belongssg
- the initial simple granularity
DatelineModelException
- if the requested time span can not be visualized with the
requested granularitypublic SimpleGranularityDatelineModel(Dateline dateline) throws DatelineModelException
SimpleGranularity.ONE
, and the time zone
defaults to TimeZone.getDefault()
dateline
- the dateline to which the model belongs
DatelineModelException
- if the requested time span can not be visualized with the
requested granularityMethod Detail |
---|
public SimpleGranularity getMajorSimpleGranularity()
SimpleGranularity.next()
on the current
granularity.
protected void calculateDatelineWidth() throws DatelineModelException
AbstractDatelineModel
calculateDatelineWidth
in class AbstractDatelineModel<SimpleGranularity>
DatelineModelException
- if the calculated width exceeds the maximum width that is
equal to Integer.MAX_VALUE
public java.util.List<GridLine> getGrid(int x1, int x2, boolean major)
IDatelineModel
x1
- the start coordinatex2
- the end coordinatemajor
- if TRUE the method needs to return the major grid lines
GridLayer
public int getTimeLocation(long time)
IDatelineModel
IDatelineModel.getTimeAt(int)
method (example: x = getTimeLocation(getTimeAt(x))
).
time
- the time for which to return a coordinate
IDatelineModel.getTimeAt(int)
public long getTimeAt(int x)
IDatelineModel
x
- the x-coordinate for which to return a time point
IDatelineModel.getTimeLocation(long)
public ITimeSpan getTimeSpanAt(int x, boolean major)
IDatelineModel
x
- the location for which to return a time spanmajor
- a flag controlling whether to return the time span of the
major or the minor part of the dateline
public void requestVisibleTimeSpan(ITimeSpan span) throws DatelineModelException
IDatelineModel
span
- the requested time span
DatelineModelException
- if the model can not satisfy the requestpublic java.lang.String getMajorDateString(SimpleGranularity granularity, long time)
granularity
- the granularity in which the given time point will be
displayedtime
- the time point in need of a text representation
public java.lang.String getMinorDateString(SimpleGranularity granularity, long time)
granularity
- the granularity in which the given time point will be
displayedtime
- the time point in need of a text representation
public int getGap()
public void setGap(int gap)
gap
- the text gap in pixelpublic java.lang.String getTimeString(long time)
IDatelineModel
time
- the time for which to return a textual representation
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |