Class CSSGridTracks.Track
java.lang.Object
com.iizix.prop.ui.CSSGridTracks.Track
- Enclosing class:
CSSGridTracks
One track, track function or repetition. Immutable.
- Author:
- Christopher Mindus
Method Summary
Modifier and TypeMethodDescriptionbooleanTwo tracks are equal when their canonical CSS texts are equal.static CSSGridTracks.TrackfitContent(CSSGridTracks.Track limit) Creates afit-content(length)track.static CSSGridTracks.TrackCreates a flexible track.intgetCount()Returns the repeat count ofrepeat().getKind()Returns the kind.getMax()Returns the maximum ofminmax().getMin()Returns the minimum ofminmax()or the limit offit-content().Returns the canonical number text of a length or flexible length.Returns the repeated tracks ofrepeat().intReturns the number of tracks this entry produces.getUnit()Returns the unit of a length (""for a unitless 0) or"fr"for a flexible length.doublegetValue()Returns the number of a length or flexible length.inthashCode()Hash code of the canonical CSS text.booleanReturns if this is a simple breadth: a length, a flexible length or a keyword.booleanReturns if this track has a fixed size in the CSS sense (<fixed-size>): a length, or aminmax()with a length as either its minimum or (with an inflexible minimum) its maximum.booleanReturns if this track (or one inside it) grows with a flexible lengthfr.static CSSGridTracks.Trackkeyword(CSSGridTracks.Kind kind) Creates a keyword track.static CSSGridTracks.TrackCreates a length track.static CSSGridTracks.Trackminmax(CSSGridTracks.Track min, CSSGridTracks.Track max) Creates aminmax(min,max)track.static CSSGridTracks.Trackrepeat(int count, List<CSSGridTracks.Track> repeated) Creates arepeat(count,tracks).toString()Returns the CSS text of the track, in canonical form.
Method Details
length
Creates a length track.- Parameters:
number- The non-negative number, e.g."200"or"1.5".unit- One ofCSSGridTracks.LENGTH_UNITS, or""when the number is zero.- Returns:
- The track.
- Throws:
IllegalArgumentException- For a negative or malformed number or an unknown unit.
flex
Creates a flexible track.- Parameters:
number- The non-negative number offr.- Returns:
- The track.
- Throws:
IllegalArgumentException- For a negative or malformed number.
keyword
Creates a keyword track.- Parameters:
kind-CSSGridTracks.Kind.AUTO,CSSGridTracks.Kind.MIN_CONTENTorCSSGridTracks.Kind.MAX_CONTENT.- Returns:
- The track.
- Throws:
IllegalArgumentException- For another kind.
minmax
Creates aminmax(min,max)track.- Parameters:
min- The minimum: a length or a keyword, never a flexible length.max- The maximum: a length, a flexible length or a keyword.- Returns:
- The track.
- Throws:
IllegalArgumentException- When an argument is not allowed in its position.
fitContent
Creates afit-content(length)track.- Parameters:
limit- The length limit.- Returns:
- The track.
- Throws:
IllegalArgumentException- When the limit is not a length.
repeat
Creates arepeat(count,tracks).- Parameters:
count- A positive count up toCSSGridTracks.MAX_REPEAT,CSSGridTracks.AUTO_FILLorCSSGridTracks.AUTO_FIT.repeated- The repeated tracks, at least one, none of them a repeat; with auto-fill or auto-fit every one of them must have a fixed size.- Returns:
- The track.
- Throws:
IllegalArgumentException- When the count or a track is not allowed.
getKind
getNumber
Returns the canonical number text of a length or flexible length.- Returns:
- The number text, e.g.
"1.5", or null for other kinds.
getValue
public double getValue()Returns the number of a length or flexible length.- Returns:
- The number, or
Double.NaNfor other kinds.
getUnit
Returns the unit of a length (""for a unitless 0) or"fr"for a flexible length.- Returns:
- The lower-case unit, or null for other kinds.
getMin
Returns the minimum ofminmax()or the limit offit-content().- Returns:
- The track, or null for other kinds.
getMax
Returns the maximum ofminmax().- Returns:
- The track, or null for other kinds.
getCount
public int getCount()Returns the repeat count ofrepeat().- Returns:
- A positive count,
CSSGridTracks.AUTO_FILL,CSSGridTracks.AUTO_FIT, or 0 for other kinds.
getRepeated
Returns the repeated tracks ofrepeat().- Returns:
- The unmodifiable list, empty for other kinds.
isBreadth
public boolean isBreadth()Returns if this is a simple breadth: a length, a flexible length or a keyword.- Returns:
- true for a breadth.
isFixedSize
public boolean isFixedSize()Returns if this track has a fixed size in the CSS sense (<fixed-size>): a length, or aminmax()with a length as either its minimum or (with an inflexible minimum) its maximum. Only fixed sizes may be repeated by auto-fill or auto-fit.- Returns:
- true for a fixed size.
isFlexible
public boolean isFlexible()Returns if this track (or one inside it) grows with a flexible lengthfr.- Returns:
- true when flexible.
getTrackCount
public int getTrackCount()Returns the number of tracks this entry produces.- Returns:
- The count, -1 when it depends on the container size (auto-fill, auto-fit).
toString
equals
hashCode