Interface StylesBuilder
-
- All Known Implementing Classes:
DomStylesBuilder,HtmlStylesBuilder
public interface StylesBuilderBuilds 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 StylesBuilderbackgroundImage(SafeUri uri)Sets the background-image CSS property.StylesBuilderborderStyle(Style.BorderStyle value)Sets the border-style CSS property.StylesBuilderborderWidth(double value, Style.Unit unit)Set the border-width css property.StylesBuilderbottom(double value, Style.Unit unit)Set the bottom css property.StylesBuildercursor(Style.Cursor value)Sets the cursor CSS property.StylesBuilderdisplay(Style.Display value)Sets the display CSS property.voidendStyle()End the current style attribute.StylesBuilderfloatprop(Style.Float value)Set the float css property.StylesBuilderfontSize(double value, Style.Unit unit)Set the font-size css property.StylesBuilderfontStyle(Style.FontStyle value)Sets the font-style CSS property.StylesBuilderfontWeight(Style.FontWeight value)Sets the font-weight CSS property.StylesBuilderheight(double value, Style.Unit unit)Set the height css property.StylesBuilderleft(double value, Style.Unit unit)Set the left css property.StylesBuilderlineHeight(double value, Style.Unit unit)Set the line-height css property.StylesBuilderlistStyleType(Style.ListStyleType value)Sets the list-style-type CSS property.StylesBuildermargin(double value, Style.Unit unit)Set the margin css property.StylesBuildermarginBottom(double value, Style.Unit unit)Set the margin-bottom css property.StylesBuildermarginLeft(double value, Style.Unit unit)Set the margin-left css property.StylesBuildermarginRight(double value, Style.Unit unit)Set the margin-right css property.StylesBuildermarginTop(double value, Style.Unit unit)Set the margin-top css property.StylesBuilderopacity(double value)Set the opacity css property.StylesBuilderoutlineStyle(Style.OutlineStyle value)Sets the outline-style CSS property.StylesBuilderoutlineWidth(double value, Style.Unit unit)Set the outline-width css property.StylesBuilderoverflow(Style.Overflow value)Sets the overflow CSS property.StylesBuilderoverflowX(Style.Overflow value)Sets the overflow-x CSS property.StylesBuilderoverflowY(Style.Overflow value)Sets the overflow-y CSS property.StylesBuilderpadding(double value, Style.Unit unit)Set the padding css property.StylesBuilderpaddingBottom(double value, Style.Unit unit)Set the padding-bottom css property.StylesBuilderpaddingLeft(double value, Style.Unit unit)Set the padding-left css property.StylesBuilderpaddingRight(double value, Style.Unit unit)Set the padding-right css property.StylesBuilderpaddingTop(double value, Style.Unit unit)Set the padding-top css property.StylesBuilderposition(Style.Position value)Sets the position CSS property.StylesBuilderright(double value, Style.Unit unit)Set the right css property.StylesBuildertableLayout(Style.TableLayout value)Set the table-layout CSS property.StylesBuildertextAlign(Style.TextAlign value)Set the text-align CSS property.StylesBuildertextDecoration(Style.TextDecoration value)Set the text-decoration CSS property.StylesBuildertextIndent(double value, Style.Unit unit)Set the text-indent CSS property.StylesBuildertextJustify(Style.TextJustify value)Set the text-justify CSS3 property.StylesBuildertextOverflow(Style.TextOverflow value)Set the text-overflow CSS3 property.StylesBuildertextTransform(Style.TextTransform value)Set the text-transform CSS property.StylesBuildertop(double value, Style.Unit unit)Set the top css property.StylesBuildertrustedBackgroundColor(java.lang.String value)Sets the "background-color" style property to the specified color string.StylesBuildertrustedBackgroundImage(java.lang.String value)Sets the "background-image" style property to the specified value.StylesBuildertrustedBorderColor(java.lang.String value)Sets the "border-color" style property to the specified color string.StylesBuildertrustedColor(java.lang.String value)Sets the "color" style property, which controls font color, to the specified color string.StylesBuildertrustedOutlineColor(java.lang.String value)Sets the "outline-color" style property to the specified color string.StylesBuildertrustedProperty(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.StylesBuildertrustedProperty(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.StylesBuilderverticalAlign(double value, Style.Unit unit)Sets the vertical-align CSS property.StylesBuilderverticalAlign(Style.VerticalAlign value)Sets the vertical-align CSS property.StylesBuildervisibility(Style.Visibility value)Sets the visibility CSS property.StylesBuilderwidth(double value, Style.Unit unit)Set the width css property.StylesBuilderzIndex(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
SafeStylescontract 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
SafeStylescontract 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.
-
-