public interface StylesBuilder
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.
Modifier and Type | Method and 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(String value)
Sets the "background-color" style property to the specified color string.
|
StylesBuilder |
trustedBackgroundImage(String value)
Sets the "background-image" style property to the specified value.
|
StylesBuilder |
trustedBorderColor(String value)
Sets the "border-color" style property to the specified color string.
|
StylesBuilder |
trustedColor(String value)
Sets the "color" style property, which controls font color, to the
specified color string.
|
StylesBuilder |
trustedOutlineColor(String value)
Sets the "outline-color" style property to the specified color string.
|
StylesBuilder |
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.
|
StylesBuilder |
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.
|
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.
|
StylesBuilder backgroundImage(SafeUri uri)
uri
- the URI of the background imageStylesBuilder
trustedBackgroundImage(String)
StylesBuilder borderStyle(Style.BorderStyle value)
StylesBuilder borderWidth(double value, Style.Unit unit)
StylesBuilder bottom(double value, Style.Unit unit)
StylesBuilder cursor(Style.Cursor value)
StylesBuilder display(Style.Display value)
void endStyle()
IllegalStateException
- if the style attribute is already closedStylesBuilder floatprop(Style.Float value)
StylesBuilder fontSize(double value, Style.Unit unit)
StylesBuilder fontStyle(Style.FontStyle value)
StylesBuilder fontWeight(Style.FontWeight value)
StylesBuilder height(double value, Style.Unit unit)
StylesBuilder left(double value, Style.Unit unit)
StylesBuilder lineHeight(double value, Style.Unit unit)
StylesBuilder listStyleType(Style.ListStyleType value)
StylesBuilder margin(double value, Style.Unit unit)
StylesBuilder marginBottom(double value, Style.Unit unit)
StylesBuilder marginLeft(double value, Style.Unit unit)
StylesBuilder marginRight(double value, Style.Unit unit)
StylesBuilder marginTop(double value, Style.Unit unit)
StylesBuilder opacity(double value)
StylesBuilder outlineStyle(Style.OutlineStyle value)
StylesBuilder outlineWidth(double value, Style.Unit unit)
StylesBuilder overflow(Style.Overflow value)
StylesBuilder overflowX(Style.Overflow value)
StylesBuilder overflowY(Style.Overflow value)
StylesBuilder padding(double value, Style.Unit unit)
StylesBuilder paddingBottom(double value, Style.Unit unit)
StylesBuilder paddingLeft(double value, Style.Unit unit)
StylesBuilder paddingRight(double value, Style.Unit unit)
StylesBuilder paddingTop(double value, Style.Unit unit)
StylesBuilder position(Style.Position value)
StylesBuilder right(double value, Style.Unit unit)
StylesBuilder tableLayout(Style.TableLayout value)
StylesBuilder textAlign(Style.TextAlign value)
StylesBuilder textDecoration(Style.TextDecoration value)
StylesBuilder textIndent(double value, Style.Unit unit)
StylesBuilder textJustify(Style.TextJustify value)
StylesBuilder textOverflow(Style.TextOverflow value)
StylesBuilder textTransform(Style.TextTransform value)
StylesBuilder top(double value, Style.Unit unit)
StylesBuilder trustedBackgroundColor(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
.
StylesBuilder
StylesBuilder trustedBackgroundImage(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
.
StylesBuilder
StylesBuilder trustedBorderColor(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
.
StylesBuilder
StylesBuilder trustedColor(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
.
StylesBuilder
StylesBuilder trustedOutlineColor(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
.
StylesBuilder
StylesBuilder 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. 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.
unit
- the units of the valueStylesBuilder
StylesBuilder 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. 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.
StylesBuilder
StylesBuilder verticalAlign(double value, Style.Unit unit)
StylesBuilder verticalAlign(Style.VerticalAlign value)
StylesBuilder visibility(Style.Visibility value)
StylesBuilder width(double value, Style.Unit unit)
StylesBuilder zIndex(int value)
Copyright © 2018. All rights reserved.