Interface StylesBuilder
- All Known Implementing Classes:
DomStylesBuilder
,HtmlStylesBuilder
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
Modifier and TypeMethodDescriptionbackgroundImage
(SafeUri uri) Sets the background-image CSS property.borderStyle
(Style.BorderStyle value) Sets the border-style CSS property.borderWidth
(double value, Style.Unit unit) Set the border-width css property.bottom
(double value, Style.Unit unit) Set the bottom css property.cursor
(Style.Cursor value) Sets the cursor CSS property.display
(Style.Display value) Sets the display CSS property.void
endStyle()
End the current style attribute.floatprop
(Style.Float value) Set the float css property.fontSize
(double value, Style.Unit unit) Set the font-size css property.fontStyle
(Style.FontStyle value) Sets the font-style CSS property.fontWeight
(Style.FontWeight value) Sets the font-weight CSS property.height
(double value, Style.Unit unit) Set the height css property.left
(double value, Style.Unit unit) Set the left css property.lineHeight
(double value, Style.Unit unit) Set the line-height css property.listStyleType
(Style.ListStyleType value) Sets the list-style-type CSS property.margin
(double value, Style.Unit unit) Set the margin css property.marginBottom
(double value, Style.Unit unit) Set the margin-bottom css property.marginLeft
(double value, Style.Unit unit) Set the margin-left css property.marginRight
(double value, Style.Unit unit) Set the margin-right css property.marginTop
(double value, Style.Unit unit) Set the margin-top css property.opacity
(double value) Set the opacity css property.outlineStyle
(Style.OutlineStyle value) Sets the outline-style CSS property.outlineWidth
(double value, Style.Unit unit) Set the outline-width css property.overflow
(Style.Overflow value) Sets the overflow CSS property.overflowX
(Style.Overflow value) Sets the overflow-x CSS property.overflowY
(Style.Overflow value) Sets the overflow-y CSS property.padding
(double value, Style.Unit unit) Set the padding css property.paddingBottom
(double value, Style.Unit unit) Set the padding-bottom css property.paddingLeft
(double value, Style.Unit unit) Set the padding-left css property.paddingRight
(double value, Style.Unit unit) Set the padding-right css property.paddingTop
(double value, Style.Unit unit) Set the padding-top css property.position
(Style.Position value) Sets the position CSS property.right
(double value, Style.Unit unit) Set the right css property.tableLayout
(Style.TableLayout value) Set the table-layout CSS property.textAlign
(Style.TextAlign value) Set the text-align CSS property.Set the text-decoration CSS property.textIndent
(double value, Style.Unit unit) Set the text-indent CSS property.textJustify
(Style.TextJustify value) Set the text-justify CSS3 property.textOverflow
(Style.TextOverflow value) Set the text-overflow CSS3 property.textTransform
(Style.TextTransform value) Set the text-transform CSS property.top
(double value, Style.Unit unit) Set the top css property.trustedBackgroundColor
(String value) Sets the "background-color" style property to the specified color string.trustedBackgroundImage
(String value) Sets the "background-image" style property to the specified value.trustedBorderColor
(String value) Sets the "border-color" style property to the specified color string.trustedColor
(String value) Sets the "color" style property, which controls font color, to the specified color string.trustedOutlineColor
(String value) Sets the "outline-color" style property to the specified color string.trustedProperty
(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.trustedProperty
(String name, String value) Set a style property from a trusted name and a trusted value, i.e., without escaping the name and value.verticalAlign
(double value, Style.Unit unit) Sets the vertical-align CSS property.verticalAlign
(Style.VerticalAlign value) Sets the vertical-align CSS property.visibility
(Style.Visibility value) Sets the visibility CSS property.width
(double value, Style.Unit unit) Set the width css property.zIndex
(int value) Set the z-index css property.
-
Method Details
-
borderStyle
Sets the border-style CSS property. -
borderWidth
Set the border-width css property. -
bottom
Set the bottom css property. -
cursor
Sets the cursor CSS property. -
display
Sets the display CSS property. -
endStyle
void endStyle()End the current style attribute.- Throws:
IllegalStateException
- if the style attribute is already closed
-
floatprop
Set the float css property. -
fontSize
Set the font-size css property. -
fontStyle
Sets the font-style CSS property. -
fontWeight
Sets the font-weight CSS property. -
height
Set the height css property. -
left
Set the left css property. -
lineHeight
Set the line-height css property. -
listStyleType
Sets the list-style-type CSS property. -
margin
Set the margin css property. -
marginBottom
Set the margin-bottom css property. -
marginLeft
Set the margin-left css property. -
marginRight
Set the margin-right css property. -
marginTop
Set the margin-top css property. -
opacity
Set the opacity css property. -
outlineStyle
Sets the outline-style CSS property. -
outlineWidth
Set the outline-width css property. -
overflow
Sets the overflow CSS property. -
overflowX
Sets the overflow-x CSS property. -
overflowY
Sets the overflow-y CSS property. -
padding
Set the padding css property. -
paddingBottom
Set the padding-bottom css property. -
paddingLeft
Set the padding-left css property. -
paddingRight
Set the padding-right css property. -
paddingTop
Set the padding-top css property. -
position
Sets the position CSS property. -
right
Set the right css property. -
tableLayout
Set the table-layout CSS property. -
textAlign
Set the text-align CSS property. -
textDecoration
Set the text-decoration CSS property. -
textIndent
Set the text-indent CSS property. -
textJustify
Set the text-justify CSS3 property. -
textOverflow
Set the text-overflow CSS3 property. -
textTransform
Set the text-transform CSS property. -
top
Set the top css property. -
trustedBackgroundColor
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
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
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
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
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
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
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
Sets the vertical-align CSS property. -
verticalAlign
Sets the vertical-align CSS property. -
visibility
Sets the visibility CSS property. -
width
Set the width css property. -
zIndex
Set the z-index css property.