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 Details Link icon

    • backgroundImage Link icon

      StylesBuilder backgroundImage(SafeUri uri)
      Sets the background-image CSS property.
      Parameters:
      uri - the URI of the background image
      Returns:
      this StylesBuilder
      See Also:
    • borderStyle Link icon

      StylesBuilder borderStyle(Style.BorderStyle value)
      Sets the border-style CSS property.
    • borderWidth Link icon

      StylesBuilder borderWidth(double value, Style.Unit unit)
      Set the border-width css property.
    • bottom Link icon

      StylesBuilder bottom(double value, Style.Unit unit)
      Set the bottom css property.
    • cursor Link icon

      StylesBuilder cursor(Style.Cursor value)
      Sets the cursor CSS property.
    • display Link icon

      StylesBuilder display(Style.Display value)
      Sets the display CSS property.
    • endStyle Link icon

      void endStyle()
      End the current style attribute.
      Throws:
      IllegalStateException - if the style attribute is already closed
    • floatprop Link icon

      StylesBuilder floatprop(Style.Float value)
      Set the float css property.
    • fontSize Link icon

      StylesBuilder fontSize(double value, Style.Unit unit)
      Set the font-size css property.
    • fontStyle Link icon

      StylesBuilder fontStyle(Style.FontStyle value)
      Sets the font-style CSS property.
    • fontWeight Link icon

      StylesBuilder fontWeight(Style.FontWeight value)
      Sets the font-weight CSS property.
    • height Link icon

      StylesBuilder height(double value, Style.Unit unit)
      Set the height css property.
    • left Link icon

      StylesBuilder left(double value, Style.Unit unit)
      Set the left css property.
    • lineHeight Link icon

      StylesBuilder lineHeight(double value, Style.Unit unit)
      Set the line-height css property.
    • listStyleType Link icon

      StylesBuilder listStyleType(Style.ListStyleType value)
      Sets the list-style-type CSS property.
    • margin Link icon

      StylesBuilder margin(double value, Style.Unit unit)
      Set the margin css property.
    • marginBottom Link icon

      StylesBuilder marginBottom(double value, Style.Unit unit)
      Set the margin-bottom css property.
    • marginLeft Link icon

      StylesBuilder marginLeft(double value, Style.Unit unit)
      Set the margin-left css property.
    • marginRight Link icon

      StylesBuilder marginRight(double value, Style.Unit unit)
      Set the margin-right css property.
    • marginTop Link icon

      StylesBuilder marginTop(double value, Style.Unit unit)
      Set the margin-top css property.
    • opacity Link icon

      StylesBuilder opacity(double value)
      Set the opacity css property.
    • outlineStyle Link icon

      StylesBuilder outlineStyle(Style.OutlineStyle value)
      Sets the outline-style CSS property.
    • outlineWidth Link icon

      StylesBuilder outlineWidth(double value, Style.Unit unit)
      Set the outline-width css property.
    • overflow Link icon

      StylesBuilder overflow(Style.Overflow value)
      Sets the overflow CSS property.
    • overflowX Link icon

      StylesBuilder overflowX(Style.Overflow value)
      Sets the overflow-x CSS property.
    • overflowY Link icon

      StylesBuilder overflowY(Style.Overflow value)
      Sets the overflow-y CSS property.
    • padding Link icon

      StylesBuilder padding(double value, Style.Unit unit)
      Set the padding css property.
    • paddingBottom Link icon

      StylesBuilder paddingBottom(double value, Style.Unit unit)
      Set the padding-bottom css property.
    • paddingLeft Link icon

      StylesBuilder paddingLeft(double value, Style.Unit unit)
      Set the padding-left css property.
    • paddingRight Link icon

      StylesBuilder paddingRight(double value, Style.Unit unit)
      Set the padding-right css property.
    • paddingTop Link icon

      StylesBuilder paddingTop(double value, Style.Unit unit)
      Set the padding-top css property.
    • position Link icon

      StylesBuilder position(Style.Position value)
      Sets the position CSS property.
    • right Link icon

      StylesBuilder right(double value, Style.Unit unit)
      Set the right css property.
    • tableLayout Link icon

      StylesBuilder tableLayout(Style.TableLayout value)
      Set the table-layout CSS property.
    • textAlign Link icon

      StylesBuilder textAlign(Style.TextAlign value)
      Set the text-align CSS property.
    • textDecoration Link icon

      StylesBuilder textDecoration(Style.TextDecoration value)
      Set the text-decoration CSS property.
    • textIndent Link icon

      StylesBuilder textIndent(double value, Style.Unit unit)
      Set the text-indent CSS property.
    • textJustify Link icon

      StylesBuilder textJustify(Style.TextJustify value)
      Set the text-justify CSS3 property.
    • textOverflow Link icon

      StylesBuilder textOverflow(Style.TextOverflow value)
      Set the text-overflow CSS3 property.
    • textTransform Link icon

      StylesBuilder textTransform(Style.TextTransform value)
      Set the text-transform CSS property.
    • top Link icon

      StylesBuilder top(double value, Style.Unit unit)
      Set the top css property.
    • trustedBackgroundColor Link icon

      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.

      Returns:
      this StylesBuilder
    • trustedBackgroundImage Link icon

      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.

      Returns:
      this StylesBuilder
    • trustedBorderColor Link icon

      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.

      Returns:
      this StylesBuilder
    • trustedColor Link icon

      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.

      Returns:
      this StylesBuilder
    • trustedOutlineColor Link icon

      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.

      Returns:
      this StylesBuilder
    • trustedProperty Link icon

      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.

      Parameters:
      unit - the units of the value
      Returns:
      this StylesBuilder
    • trustedProperty Link icon

      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.

      Returns:
      this StylesBuilder
    • verticalAlign Link icon

      StylesBuilder verticalAlign(double value, Style.Unit unit)
      Sets the vertical-align CSS property.
    • verticalAlign Link icon

      StylesBuilder verticalAlign(Style.VerticalAlign value)
      Sets the vertical-align CSS property.
    • visibility Link icon

      StylesBuilder visibility(Style.Visibility value)
      Sets the visibility CSS property.
    • width Link icon

      StylesBuilder width(double value, Style.Unit unit)
      Set the width css property.
    • zIndex Link icon

      StylesBuilder zIndex(int value)
      Set the z-index css property.