T
- the type of the temporal unit (e.g. ChronoUnit)public abstract class VirtualGrid<T extends TemporalUnit> extends Object
Constructor and Description |
---|
VirtualGrid(String name,
String shortName,
T unit,
int amount)
Constructs a new grid.
|
VirtualGrid(String name,
T unit,
int amount)
Constructs a new grid.
|
Modifier and Type | Method and Description |
---|---|
abstract Instant |
adjustTime(Instant instant,
ZoneId zoneId,
boolean roundUp,
DayOfWeek firstDayOfWeek)
Adjusts the given instant so that the returned instant will snap to the
position defined by the grid settings.
|
abstract LocalTime |
adjustTime(LocalTime time,
boolean roundUp)
Adjusts the given local time so that the returned time will snap to the
position defined by the grid settings.
|
int |
getAmount()
The number of units used for the grid.
|
String |
getName()
Returns the grid name that can be used for grid selection controls.
|
String |
getShortName()
Returns the grid short name that can be used for grid selection controls.
|
T |
getUnit()
The temporal unit used for the grid.
|
String |
toString() |
public VirtualGrid(String name, String shortName, T unit, int amount)
name
- a name that can be shown in the user interface (e.g.
"15 Minutes")shortName
- a short name that can be shown in the user interface (e.g.
"15 Min.")unit
- the temporal unit of the grid (e.g. MINUTES)amount
- the amount of the temporal unit (e.g. "15")public VirtualGrid(String name, T unit, int amount)
name
- a name that can be shown in the user interface (e.g.
"15 Minutes"), will also be used as the short nameunit
- the temporal unit of the grid (e.g. MINUTES)amount
- the amount of the temporal unit (e.g. "15")public final String getName()
public final String getShortName()
public final T getUnit()
public final int getAmount()
public abstract Instant adjustTime(Instant instant, ZoneId zoneId, boolean roundUp, DayOfWeek firstDayOfWeek)
instant
- the time to adjust to a grid locationzoneId
- the time zone for which the adjustment is performed (can be
different from row to row)roundUp
- a flag signaling whether we want the adjusted time to snap to
an earlier or later time (start time or end time)firstDayOfWeek
- the weekday that is considered to be the first day of the week
(mostly Monday or Sunday)public abstract LocalTime adjustTime(LocalTime time, boolean roundUp)
time
- the time to adjust to a grid locationroundUp
- a flag signaling whether we want the adjusted time to snap to
an earlier or later time (start time or end time)Copyright © 2014 Dirk Lemmermann Software & Consulting. All rights reserved.