java.lang.Object
com.flexganttfx.model.dateline.VirtualGrid<SimpleUnit>
com.flexganttfx.model.dateline.SimpleUnitGrid
public final class SimpleUnitGrid extends VirtualGrid<SimpleUnit>
A virtual grid implementation for
SimpleUnit
.- Since:
- 1.1
-
Constructor Summary
Constructors Constructor Description SimpleUnitGrid(String name, SimpleUnit unit, int amount)
Constructs a new grid.SimpleUnitGrid(String name, String shortName, SimpleUnit unit, int amount)
Constructs a new grid. -
Method Summary
Modifier and Type Method Description 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.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.Methods inherited from class com.flexganttfx.model.dateline.VirtualGrid
getAmount, getName, getShortName, getUnit, toString
-
Constructor Details
-
SimpleUnitGrid
Constructs a new grid.- Parameters:
name
- the grid name as shown in the UI (e.g. "50 Units")shortName
- the short name (e.g. "50")unit
- the chrono unit on which the grid will be based (e.g. "TEN")amount
- the amount of the chrono unit (e.g. "5")- Since:
- 1.0
-
SimpleUnitGrid
Constructs a new grid.- Parameters:
name
- the grid name as shown in the UI (e.g. "50")unit
- the chrono unit on which the grid will be based (e.g. "TEN")amount
- the amount of the chrono unit (e.g. "5")- Since:
- 1.0
-
-
Method Details
-
adjustTime
public Instant adjustTime(Instant instant, ZoneId zoneId, boolean roundUp, DayOfWeek firstDayOfWeek)Description copied from class:VirtualGrid
Adjusts the given instant so that the returned instant will snap to the position defined by the grid settings.- Specified by:
adjustTime
in classVirtualGrid<SimpleUnit>
- Parameters:
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)- Returns:
- the grid adjusted time
-
adjustTime
Description copied from class:VirtualGrid
Adjusts the given local time so that the returned time will snap to the position defined by the grid settings.- Specified by:
adjustTime
in classVirtualGrid<SimpleUnit>
- Parameters:
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)- Returns:
- the grid adjusted local time
-