Class Style
java.lang.Object
io.mindspice.simplypages.core.Style
Mutable builder for CSS utility classes and inline declarations.
This type stores tokens only; it does not validate CSS semantics and does not escape values. Consumers are responsible for supplying trusted class and style input.
Mutability/thread-safety: mutable and not thread-safe. Use per component/request and do not share across concurrent renders.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionAdds a raw class token without transformation.addClasses(String... classNames) Adds raw class tokens without transformation.addInlineStyle(String property, String value) Appends an inline style fragment in the formproperty: value.alignItems(String value) Adds a utility class token in the formitems-{value}.backgroundColor(String color) Adds a utility class token in the formbg-{color}.Adds a utility class token in the formborder-{value}.Adds a utility class token in the formtext-{color}.static Stylecreate()Creates a new empty style builder.flex()Adds theflexutility class.flexDirection(String direction) Adds a utility class token in the formflex-{direction}.Adds a utility class token in the formtext-{size}.fontWeight(String weight) Adds a utility class token in the formfont-{weight}.Adds a utility class token in the formgap-{value}.Returns class tokens joined by a single space.Returns inline style fragments joined by;.booleanReturns whether at least one class token has been added.booleanReturns whether at least one inline style fragment has been added.Adds a utility class token in the formh-{value}.justifyContent(String value) Adds a utility class token in the formjustify-{value}.Adds a utility class token in the formm-{value}.Adds a utility class token in the formp-{value}.Adds a utility class token in the formrounded-{value}.Adds a utility class token in the formshadow-{value}.Adds a utility class token in the formtext-{alignment}.Adds a utility class token in the formw-{value}.
-
Constructor Details
-
Style
public Style()
-
-
Method Details
-
create
Creates a new empty style builder. -
padding
-
margin
-
textAlign
-
fontSize
-
fontWeight
-
color
-
backgroundColor
-
border
-
rounded
-
width
-
height
-
flex
Adds theflexutility class. -
flexDirection
-
justifyContent
-
alignItems
-
gap
-
shadow
-
addClass
-
addClasses
-
addInlineStyle
Appends an inline style fragment in the formproperty: value.Both arguments must be application-controlled or separately validated for their CSS context. No property-name, declaration-breakout, semantic CSS, or URL validation is performed; separators are retained. Attribute encoding by a later tag does not supply these checks. Unlike
HtmlTag.addStyle(String, String), this is a raw fragment path. -
getClassString
Returns class tokens joined by a single space. -
getStyleString
Returns inline style fragments joined by;. -
hasClasses
public boolean hasClasses()Returns whether at least one class token has been added. -
hasInlineStyles
public boolean hasInlineStyles()Returns whether at least one inline style fragment has been added.
-