Interface StylesBuilder
-
- All Known Implementing Classes:
DomStylesBuilder
,HtmlStylesBuilder
public interface StylesBuilder
Builds the style attribute on an element.The HTML implementation of class appends the style properties to the HTML string. The DOM implementation of this class sets the element's styles directly.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description StylesBuilder
backgroundImage(SafeUri uri)
Sets the background-image CSS property.StylesBuilder
borderStyle(Style.BorderStyle value)
Sets the border-style CSS property.StylesBuilder
borderWidth(double value, Style.Unit unit)
Set the border-width css property.StylesBuilder
bottom(double value, Style.Unit unit)
Set the bottom css property.StylesBuilder
cursor(Style.Cursor value)
Sets the cursor CSS property.StylesBuilder
display(Style.Display value)
Sets the display CSS property.void
endStyle()
End the current style attribute.StylesBuilder
floatprop(Style.Float value)
Set the float css property.StylesBuilder
fontSize(double value, Style.Unit unit)
Set the font-size css property.StylesBuilder
fontStyle(Style.FontStyle value)
Sets the font-style CSS property.StylesBuilder
fontWeight(Style.FontWeight value)
Sets the font-weight CSS property.StylesBuilder
height(double value, Style.Unit unit)
Set the height css property.StylesBuilder
left(double value, Style.Unit unit)
Set the left css property.StylesBuilder
lineHeight(double value, Style.Unit unit)
Set the line-height css property.StylesBuilder
listStyleType(Style.ListStyleType value)
Sets the list-style-type CSS property.StylesBuilder
margin(double value, Style.Unit unit)
Set the margin css property.StylesBuilder
marginBottom(double value, Style.Unit unit)
Set the margin-bottom css property.StylesBuilder
marginLeft(double value, Style.Unit unit)
Set the margin-left css property.StylesBuilder
marginRight(double value, Style.Unit unit)
Set the margin-right css property.StylesBuilder
marginTop(double value, Style.Unit unit)
Set the margin-top css property.StylesBuilder
opacity(double value)
Set the opacity css property.StylesBuilder
outlineStyle(Style.OutlineStyle value)
Sets the outline-style CSS property.StylesBuilder
outlineWidth(double value, Style.Unit unit)
Set the outline-width css property.StylesBuilder
overflow(Style.Overflow value)
Sets the overflow CSS property.StylesBuilder
overflowX(Style.Overflow value)
Sets the overflow-x CSS property.StylesBuilder
overflowY(Style.Overflow value)
Sets the overflow-y CSS property.StylesBuilder
padding(double value, Style.Unit unit)
Set the padding css property.StylesBuilder
paddingBottom(double value, Style.Unit unit)
Set the padding-bottom css property.StylesBuilder
paddingLeft(double value, Style.Unit unit)
Set the padding-left css property.StylesBuilder
paddingRight(double value, Style.Unit unit)
Set the padding-right css property.StylesBuilder
paddingTop(double value, Style.Unit unit)
Set the padding-top css property.StylesBuilder
position(Style.Position value)
Sets the position CSS property.StylesBuilder
right(double value, Style.Unit unit)
Set the right css property.StylesBuilder
tableLayout(Style.TableLayout value)
Set the table-layout CSS property.StylesBuilder
textAlign(Style.TextAlign value)
Set the text-align CSS property.StylesBuilder
textDecoration(Style.TextDecoration value)
Set the text-decoration CSS property.StylesBuilder
textIndent(double value, Style.Unit unit)
Set the text-indent CSS property.StylesBuilder
textJustify(Style.TextJustify value)
Set the text-justify CSS3 property.StylesBuilder
textOverflow(Style.TextOverflow value)
Set the text-overflow CSS3 property.StylesBuilder
textTransform(Style.TextTransform value)
Set the text-transform CSS property.StylesBuilder
top(double value, Style.Unit unit)
Set the top css property.StylesBuilder
trustedBackgroundColor(java.lang.String value)
Sets the "background-color" style property to the specified color string.StylesBuilder
trustedBackgroundImage(java.lang.String value)
Sets the "background-image" style property to the specified value.StylesBuilder
trustedBorderColor(java.lang.String value)
Sets the "border-color" style property to the specified color string.StylesBuilder
trustedColor(java.lang.String value)
Sets the "color" style property, which controls font color, to the specified color string.StylesBuilder
trustedOutlineColor(java.lang.String value)
Sets the "outline-color" style property to the specified color string.StylesBuilder
trustedProperty(java.lang.String name, double value, Style.Unit unit)
Set a style property from a trusted name and a trusted value, i.e., without escaping the name and value.StylesBuilder
trustedProperty(java.lang.String name, java.lang.String value)
Set a style property from a trusted name and a trusted value, i.e., without escaping the name and value.StylesBuilder
verticalAlign(double value, Style.Unit unit)
Sets the vertical-align CSS property.StylesBuilder
verticalAlign(Style.VerticalAlign value)
Sets the vertical-align CSS property.StylesBuilder
visibility(Style.Visibility value)
Sets the visibility CSS property.StylesBuilder
width(double value, Style.Unit unit)
Set the width css property.StylesBuilder
zIndex(int value)
Set the z-index css property.
-
-
-
Method Detail
-
backgroundImage
StylesBuilder backgroundImage(SafeUri uri)
Sets the background-image CSS property.- Parameters:
uri
- the URI of the background image- Returns:
- this
StylesBuilder
- See Also:
trustedBackgroundImage(String)
-
borderStyle
StylesBuilder borderStyle(Style.BorderStyle value)
Sets the border-style CSS property.
-
borderWidth
StylesBuilder borderWidth(double value, Style.Unit unit)
Set the border-width css property.
-
bottom
StylesBuilder bottom(double value, Style.Unit unit)
Set the bottom css property.
-
cursor
StylesBuilder cursor(Style.Cursor value)
Sets the cursor CSS property.
-
display
StylesBuilder display(Style.Display value)
Sets the display CSS property.
-
endStyle
void endStyle()
End the current style attribute.- Throws:
java.lang.IllegalStateException
- if the style attribute is already closed
-
floatprop
StylesBuilder floatprop(Style.Float value)
Set the float css property.
-
fontSize
StylesBuilder fontSize(double value, Style.Unit unit)
Set the font-size css property.
-
fontStyle
StylesBuilder fontStyle(Style.FontStyle value)
Sets the font-style CSS property.
-
fontWeight
StylesBuilder fontWeight(Style.FontWeight value)
Sets the font-weight CSS property.
-
height
StylesBuilder height(double value, Style.Unit unit)
Set the height css property.
-
left
StylesBuilder left(double value, Style.Unit unit)
Set the left css property.
-
lineHeight
StylesBuilder lineHeight(double value, Style.Unit unit)
Set the line-height css property.
-
listStyleType
StylesBuilder listStyleType(Style.ListStyleType value)
Sets the list-style-type CSS property.
-
margin
StylesBuilder margin(double value, Style.Unit unit)
Set the margin css property.
-
marginBottom
StylesBuilder marginBottom(double value, Style.Unit unit)
Set the margin-bottom css property.
-
marginLeft
StylesBuilder marginLeft(double value, Style.Unit unit)
Set the margin-left css property.
-
marginRight
StylesBuilder marginRight(double value, Style.Unit unit)
Set the margin-right css property.
-
marginTop
StylesBuilder marginTop(double value, Style.Unit unit)
Set the margin-top css property.
-
opacity
StylesBuilder opacity(double value)
Set the opacity css property.
-
outlineStyle
StylesBuilder outlineStyle(Style.OutlineStyle value)
Sets the outline-style CSS property.
-
outlineWidth
StylesBuilder outlineWidth(double value, Style.Unit unit)
Set the outline-width css property.
-
overflow
StylesBuilder overflow(Style.Overflow value)
Sets the overflow CSS property.
-
overflowX
StylesBuilder overflowX(Style.Overflow value)
Sets the overflow-x CSS property.
-
overflowY
StylesBuilder overflowY(Style.Overflow value)
Sets the overflow-y CSS property.
-
padding
StylesBuilder padding(double value, Style.Unit unit)
Set the padding css property.
-
paddingBottom
StylesBuilder paddingBottom(double value, Style.Unit unit)
Set the padding-bottom css property.
-
paddingLeft
StylesBuilder paddingLeft(double value, Style.Unit unit)
Set the padding-left css property.
-
paddingRight
StylesBuilder paddingRight(double value, Style.Unit unit)
Set the padding-right css property.
-
paddingTop
StylesBuilder paddingTop(double value, Style.Unit unit)
Set the padding-top css property.
-
position
StylesBuilder position(Style.Position value)
Sets the position CSS property.
-
right
StylesBuilder right(double value, Style.Unit unit)
Set the right css property.
-
tableLayout
StylesBuilder tableLayout(Style.TableLayout value)
Set the table-layout CSS property.
-
textAlign
StylesBuilder textAlign(Style.TextAlign value)
Set the text-align CSS property.
-
textDecoration
StylesBuilder textDecoration(Style.TextDecoration value)
Set the text-decoration CSS property.
-
textIndent
StylesBuilder textIndent(double value, Style.Unit unit)
Set the text-indent CSS property.
-
textJustify
StylesBuilder textJustify(Style.TextJustify value)
Set the text-justify CSS3 property.
-
textOverflow
StylesBuilder textOverflow(Style.TextOverflow value)
Set the text-overflow CSS3 property.
-
textTransform
StylesBuilder textTransform(Style.TextTransform value)
Set the text-transform CSS property.
-
top
StylesBuilder top(double value, Style.Unit unit)
Set the top css property.
-
trustedBackgroundColor
StylesBuilder trustedBackgroundColor(java.lang.String value)
Sets the "background-color" style property to the specified color string. Does not check or escape the color string. The calling code should be carefully reviewed to ensure that the provided color string won't cause a security issue if included in a style attribute.
For details and constraints, see
SafeStyles
.- Returns:
- this
StylesBuilder
-
trustedBackgroundImage
StylesBuilder trustedBackgroundImage(java.lang.String value)
Sets the "background-image" style property to the specified value. Does not check or escape the value. The calling code should be carefully reviewed to ensure that the provided value string won't cause a security issue if included in a style attribute.
For details and constraints, see
SafeStyles
.- Returns:
- this
StylesBuilder
-
trustedBorderColor
StylesBuilder trustedBorderColor(java.lang.String value)
Sets the "border-color" style property to the specified color string. Does not check or escape the color string. The calling code should be carefully reviewed to ensure that the provided color string won't cause a security issue if included in a style attribute.
For details and constraints, see
SafeStyles
.- Returns:
- this
StylesBuilder
-
trustedColor
StylesBuilder trustedColor(java.lang.String value)
Sets the "color" style property, which controls font color, to the specified color string. Does not check or escape the color string. The calling code should be carefully reviewed to ensure that the provided color string won't cause a security issue if included in a style attribute.
For details and constraints, see
SafeStyles
.- Returns:
- this
StylesBuilder
-
trustedOutlineColor
StylesBuilder trustedOutlineColor(java.lang.String value)
Sets the "outline-color" style property to the specified color string. Does not check or escape the color string. The calling code should be carefully reviewed to ensure that the provided color string won't cause a security issue if included in a style attribute.
For details and constraints, see
SafeStyles
.- Returns:
- this
StylesBuilder
-
trustedProperty
StylesBuilder trustedProperty(java.lang.String name, double value, Style.Unit unit)
Set a style property from a trusted name and a trusted value, i.e., without escaping the name and value. No checks are performed. The calling code should be carefully reviewed to ensure the argument will satisfy the
SafeStyles
contract when they are composed into the form: "<name>:<value>;".SafeStyles may never contain literal angle brackets. Otherwise, it could be unsafe to place a SafeStyles into a <style> tag (where it can't be HTML escaped). For example, if the SafeStyles containing "
font: 'foo <style><script>evil</script>
'" is used in a style sheet in a <style> tag, this could then break out of the style context into HTML.- Parameters:
unit
- the units of the value- Returns:
- this
StylesBuilder
-
trustedProperty
StylesBuilder trustedProperty(java.lang.String name, java.lang.String value)
Set a style property from a trusted name and a trusted value, i.e., without escaping the name and value. No checks are performed. The calling code should be carefully reviewed to ensure the argument will satisfy the
SafeStyles
contract when they are composed into the form: "<name>:<value>;".SafeStyles may never contain literal angle brackets. Otherwise, it could be unsafe to place a SafeStyles into a <style> tag (where it can't be HTML escaped). For example, if the SafeStyles containing "
font: 'foo <style><script>evil</script>
'" is used in a style sheet in a <style> tag, this could then break out of the style context into HTML.- Returns:
- this
StylesBuilder
-
verticalAlign
StylesBuilder verticalAlign(double value, Style.Unit unit)
Sets the vertical-align CSS property.
-
verticalAlign
StylesBuilder verticalAlign(Style.VerticalAlign value)
Sets the vertical-align CSS property.
-
visibility
StylesBuilder visibility(Style.Visibility value)
Sets the visibility CSS property.
-
width
StylesBuilder width(double value, Style.Unit unit)
Set the width css property.
-
zIndex
StylesBuilder zIndex(int value)
Set the z-index css property.
-
-