Package tripleplay.ui

Class Styles

java.lang.Object
tripleplay.ui.Styles

public final class Styles extends Object
An immutable collection of styles. Used in builder-style to add, replace or remove styles. Configure a group of styles and then apply them to an element via Element.setStyles(tripleplay.ui.Styles) or Element.addStyles(tripleplay.ui.Styles).
  • Method Summary

    Modifier and Type
    Method
    Description
    add(Style.Binding<?>... bindings)
    Returns a new instance where the supplied bindings overwrite any previous bindings for the specified styles in the default mode.
    add(Style.Mode mode, Style.Binding<?>... bindings)
    Returns a new instance where the supplied bindings overwrite any previous bindings for the specified styles (in the specified mode).
    addDisabled(Style.Binding<?>... bindings)
    Returns a new instance where the supplied bindings overwrite any previous bindings for the specified styles in the disabled mode.
    Returns a new instance where the supplied bindings overwrite any previous bindings for the specified styles in the disabled selected mode.
    addSelected(Style.Binding<?>... bindings)
    Returns a new instance where the supplied bindings overwrite any previous bindings for the specified styles in the selected mode.
    <V> Styles
    clear(Style.Mode mode, Style<V> style)
    Returns a new instance where no binding exists for the specified style in the specified state.
    static Styles
    make(Style.Binding<?>... bindings)
    Creates a styles instance with the supplied style bindings in the DEFAULT mode.
    merge(Styles styles)
    Returns a new styles instance which merges these styles with the supplied styles.
    static Styles
    Returns the empty styles instance.
    static <V> V
    resolveStyle(Element<?> element, Style<V> style)
    Resolves the current value of style on element.

    Methods inherited from class java.lang.Object

    equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Method Details

    • none

      public static Styles none()
      Returns the empty styles instance.
    • make

      public static Styles make(Style.Binding<?>... bindings)
      Creates a styles instance with the supplied style bindings in the DEFAULT mode.
    • resolveStyle

      public static <V> V resolveStyle(Element<?> element, Style<V> style)
      Resolves the current value of style on element.
    • add

      public Styles add(Style.Binding<?>... bindings)
      Returns a new instance where the supplied bindings overwrite any previous bindings for the specified styles in the default mode. The receiver is not modified.
    • addDisabled

      public Styles addDisabled(Style.Binding<?>... bindings)
      Returns a new instance where the supplied bindings overwrite any previous bindings for the specified styles in the disabled mode. The receiver is not modified.
    • addSelected

      public Styles addSelected(Style.Binding<?>... bindings)
      Returns a new instance where the supplied bindings overwrite any previous bindings for the specified styles in the selected mode. The receiver is not modified.
    • addDisabledSelected

      public Styles addDisabledSelected(Style.Binding<?>... bindings)
      Returns a new instance where the supplied bindings overwrite any previous bindings for the specified styles in the disabled selected mode. The receiver is not modified.
    • add

      public Styles add(Style.Mode mode, Style.Binding<?>... bindings)
      Returns a new instance where the supplied bindings overwrite any previous bindings for the specified styles (in the specified mode). The receiver is not modified.
    • clear

      public <V> Styles clear(Style.Mode mode, Style<V> style)
      Returns a new instance where no binding exists for the specified style in the specified state. The receiver is not modified.
    • merge

      public Styles merge(Styles styles)
      Returns a new styles instance which merges these styles with the supplied styles. Where both instances define a particular style, the supplied styles will take precedence.