net.liftweb.util

BindHelpers

object BindHelpers extends BindHelpers

BindHelpers can be used to obtain additional information while a bind call is executing. This informaiton includes node attributes of the current bound node or the entire NodeSeq that is to be bound. Since the context is created during bind execution and destroyed when bind terminates, you can benefit of these helpers in the context of FuncBindParam or FuncAttrBindParam. You can also provide your own implementation of BindParam and your BindParam#calcValue function will be called in the appropriate context.

Example:

bind("hello", xml,
     "someNode" -> {node: NodeSeq => })

In function-body you can safely use BindHelpers methods to obtain correctly-scoped information.

Linear Supertypes
Ordering
  1. Alphabetic
  2. By inheritance
Inherited
  1. BindHelpers
  2. BindHelpers
  3. AnyRef
  4. Any
  1. Hide All
  2. Show all
Learn more about member selection
Visibility
  1. Public
  2. All

Type Members

  1. final class AttrBindParam extends BindParam with BindWithAttr

    BindParam that binds a given value into a new attribute.

  2. sealed trait BindParam extends AnyRef

    Base class for Bind parameters.

  3. trait BindWithAttr extends AnyRef

    A trait that indicates what the newly bound attribute name should be.

  4. final class BooleanBindParam extends (String, Boolean) with BindParam

    Definition Classes
    BindHelpers
  5. final class BoxBindParam extends (String, Box[NodeSeq]) with BindParam

    Definition Classes
    BindHelpers
  6. final class FuncAttrBindParam extends BindParam with BindWithAttr

    BindParam that computes a new attribute value based on the current attribute value.

  7. final class FuncAttrBoxBindParam extends BindParam with BindWithAttr

    BindParam that computes an optional new attribute value based on the current attribute value.

  8. final class FuncAttrOptionBindParam extends BindParam with BindWithAttr

    BindParam that computes an optional new attribute value based on the current attribute value.

  9. final class FuncBindParam extends (String, (NodeSeq) ⇒ NodeSeq) with BindParam

    BindParam using a function to calculate its value

  10. final class IntBindParam extends (String, Int) with BindParam

    Definition Classes
    BindHelpers
  11. final class LongBindParam extends (String, Long) with BindParam

    Definition Classes
    BindHelpers
  12. final class OptionBindParam extends (String, Option[NodeSeq]) with BindParam

    Definition Classes
    BindHelpers
  13. sealed case class PrefixedBindWithAttr(prefix: String, binding: BindParam with BindWithAttr) extends BindParam with BindWithAttr with Product with Serializable

    A case class that wraps attribute-oriented BindParams to allow prefixing the resulting attribute

  14. class SuperArrowAssoc extends AnyRef

    Definition Classes
    BindHelpers
  15. final class SymbolBindParam extends (String, Symbol) with BindParam

    Definition Classes
    BindHelpers
  16. final class TheBindParam extends (String, NodeSeq) with BindParam

    Constant BindParam always returning the same value

  17. final class TheBindableBindParam[T <: Bindable] extends (String, T) with BindParam

    Definition Classes
    BindHelpers
  18. final class TheStrBindParam extends (String, String) with BindParam

    Constant BindParam always returning the same value

  19. class BindParamAssoc extends AnyRef

    This class creates a BindParam from an input value

Value Members

  1. final def !=(arg0: AnyRef): Boolean

    Definition Classes
    AnyRef
  2. final def !=(arg0: Any): Boolean

    Definition Classes
    Any
  3. final def ##(): Int

    Definition Classes
    AnyRef → Any
  4. final def ==(arg0: AnyRef): Boolean

    Definition Classes
    AnyRef
  5. final def ==(arg0: Any): Boolean

    Definition Classes
    Any
  6. object AttrBindParam

    BindParam that binds a given value into a new attribute.

  7. object BooleanBindParam extends Serializable

    Definition Classes
    BindHelpers
  8. object BoxBindParam extends Serializable

    Definition Classes
    BindHelpers
  9. object FuncAttrBindParam

    BindParam using a function to calculate its value.

  10. object FuncAttrBoxBindParam

    BindParam that computes an optional new attribute value based on the current attribute value.

  11. object FuncAttrOptionBindParam

    BindParam that computes an optional new attribute value based on the current attribute value.

  12. object FuncBindParam extends Serializable

    Definition Classes
    BindHelpers
  13. object IntBindParam extends Serializable

    Definition Classes
    BindHelpers
  14. object LongBindParam extends Serializable

    Definition Classes
    BindHelpers
  15. object OptionBindParam extends Serializable

    Definition Classes
    BindHelpers
  16. object SymbolBindParam extends Serializable

    Definition Classes
    BindHelpers
  17. object TheBindParam extends Serializable

    Definition Classes
    BindHelpers
  18. object TheBindableBindParam extends Serializable

    Definition Classes
    BindHelpers
  19. object TheStrBindParam extends Serializable

    Definition Classes
    BindHelpers
  20. def addAttributes(in: NodeSeq, attributes: MetaData): NodeSeq

    takes a NodeSeq and applies all the attributes to all the Elems at the top level of the NodeSeq.

    takes a NodeSeq and applies all the attributes to all the Elems at the top level of the NodeSeq. The id attribute is applied to the first-found Elem only

    Definition Classes
    BindHelpers
  21. def addCssClass(cssClass: String, elem: Elem): Elem

    Adds a css class to the existing class tag of an Elem or create the class attribute

    Adds a css class to the existing class tag of an Elem or create the class attribute

    Definition Classes
    BindHelpers
  22. def addCssClass(cssClass: Box[String], elem: Elem): Elem

    Adds a css class to the existing class tag of an Elem or create the class attribute

    Adds a css class to the existing class tag of an Elem or create the class attribute

    Definition Classes
    BindHelpers
  23. final def asInstanceOf[T0]: T0

    Definition Classes
    Any
  24. object attr extends AttrHelper[Option]

    Helpers for obtaining attributes of the current Elem

  25. def bind(vals: Map[String, NodeSeq], xml: NodeSeq): NodeSeq

    Replace the content of lift:bind nodes with the corresponding nodes found in a map, according to the value of the "name" attribute.

    Replace the content of lift:bind nodes with the corresponding nodes found in a map, according to the value of the "name" attribute.

    Usage:

      bind(Map("a" ->
    = ), change this) must ==/(
    =  =
    )
    

    vals

    map of name/nodes to replace

    xml

    nodes containing lift:bind nodes

    returns

    the NodeSeq that results from the specified transforms

    Definition Classes
    BindHelpers
  26. def bind(namespace: String, nodeFailureXform: Box[(NodeSeq) ⇒ NodeSeq], paramFailureXform: Box[(PrefixedAttribute) ⇒ MetaData], preserveScope: Boolean, xml: NodeSeq, params: BindParam*): NodeSeq

    Bind a set of values to parameters and attributes in a block of XML with defined transforms for unbound elements within the specified namespace.

    Bind a set of values to parameters and attributes in a block of XML with defined transforms for unbound elements within the specified namespace.

    For example:

      bind("user",
           Full(xhtml: NodeSeq => Text("Default Value")),
           Empty,
           replace thisreplace with default,
           "hello" ->
    = )
    
    will return
    =  =
    Default Value
    

    namespace

    the namespace of tags to bind

    nodeFailureXform

    a box containing the function to use as the default transform for tags in the specified namespace that do not have bindings specified.

    paramFailureXform

    a box containing the function to use as the default transform for unrecognized attributes in bound elements.

    xml

    the NodeSeq in which to find elements to be bound.

    params

    the list of BindParam bindings to be applied

    returns

    the NodeSeq that results from the specified transforms

    Definition Classes
    BindHelpers
  27. def bind(namespace: String, nodeFailureXform: Box[(NodeSeq) ⇒ NodeSeq], paramFailureXform: Box[(PrefixedAttribute) ⇒ MetaData], xml: NodeSeq, params: BindParam*): NodeSeq

    Bind a set of values to parameters and attributes in a block of XML with defined transforms for unbound elements within the specified namespace.

    Bind a set of values to parameters and attributes in a block of XML with defined transforms for unbound elements within the specified namespace.

    For example:

      bind("user",
           Full(xhtml: NodeSeq => Text("Default Value")),
           Empty,
           replace thisreplace with default,
           "hello" ->
    = )
    
    will return
    =  =
    Default Value
    

    namespace

    the namespace of tags to bind

    nodeFailureXform

    a box containing the function to use as the default transform for tags in the specified namespace that do not have bindings specified.

    paramFailureXform

    a box containing the function to use as the default transform for unrecognized attributes in bound elements.

    xml

    the NodeSeq in which to find elements to be bound.

    params

    the list of BindParam bindings to be applied

    returns

    the NodeSeq that results from the specified transforms

    Definition Classes
    BindHelpers
  28. def bind(namespace: String, xml: NodeSeq, params: BindParam*): NodeSeq

    Bind a set of values to parameters and attributes in a block of XML.

    Bind a set of values to parameters and attributes in a block of XML.

    For example:

      bind("user", replace this, "hello" ->
    = )
    
    will return
    =  =
    

    namespace

    the namespace of tags to bind

    xml

    the NodeSeq in which to find elements to be bound.

    params

    the list of BindParam bindings to be applied

    returns

    the NodeSeq that results from the specified transforms

    Definition Classes
    BindHelpers
  29. def bindNodes: Box[List[NodeSeq]]

    A list of NodeSeq that preceeds the NodeSeq passed to bind.

    A list of NodeSeq that preceeds the NodeSeq passed to bind. The head of the list is the most recent NodeSeq. This returns Empty if it is called outside its context, or Full(Nil) if there are no child nodes but the function is called within the appropriate context.

  30. def bindlist(listvals: List[Map[String, NodeSeq]], xml: NodeSeq): Box[NodeSeq]

    Bind a list of name/xml maps to a block of XML containing lift:bind nodes (see the bind(Map, NodeSeq) function)

    Bind a list of name/xml maps to a block of XML containing lift:bind nodes (see the bind(Map, NodeSeq) function)

    returns

    the NodeSeq that results from the specified transforms

    Definition Classes
    BindHelpers
  31. def chooseTemplate(prefix: String, tag: String, xhtml: NodeSeq): NodeSeq

    Finds and returns one of many templates from the children based upon the namespace and tag name: for example, for prefix "choose" and tag name "stuff" this would return the contents of the first tag <choose:stuff> ... </choose:stuff> in the specified NodeSeq.

    Finds and returns one of many templates from the children based upon the namespace and tag name: for example, for prefix "choose" and tag name "stuff" this would return the contents of the first tag <choose:stuff> ... </choose:stuff> in the specified NodeSeq.

    prefix

    the prefix (e.g., "choose")

    tag

    the tag to choose (e.g., "stuff")

    xhtml

    the node sequence to search for the specified element

    returns

    the first matching node sequence

    Definition Classes
    BindHelpers
  32. def clone(): AnyRef

    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  33. implicit def cssSelectorToCssBindPromoter(sel: CssSelector): ToCssBindPromoter

    promote a String to a ToCssBindPromotor

    promote a String to a ToCssBindPromotor

    Definition Classes
    BindHelpers
  34. def currentNode: Box[Elem]

    A Box containing the current Elem, the children of which are passed to the bindParam

  35. def deepEnsureUniqueId(in: NodeSeq): NodeSeq

    For a list of NodeSeq, ensure that the the id of the root Elems are unique.

    For a list of NodeSeq, ensure that the the id of the root Elems are unique. If there's a duplicate, that Elem will be returned without an id

    Definition Classes
    BindHelpers
  36. def ensureId(ns: NodeSeq, id: String): NodeSeq

    Ensure that the first Element has the specified ID

    Ensure that the first Element has the specified ID

    Definition Classes
    BindHelpers
  37. def ensureUniqueId(in: Seq[NodeSeq]): Seq[NodeSeq]

    For a list of NodeSeq, ensure that the the id of the root Elems are unique.

    For a list of NodeSeq, ensure that the the id of the root Elems are unique. If there's a duplicate, that Elem will be returned without an id

    Definition Classes
    BindHelpers
  38. final def eq(arg0: AnyRef): Boolean

    Definition Classes
    AnyRef
  39. def equals(arg0: Any): Boolean

    Definition Classes
    AnyRef → Any
  40. def errorDiv(body: NodeSeq): Box[NodeSeq]

    Definition Classes
    BindHelpers
  41. def finalize(): Unit

    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( classOf[java.lang.Throwable] )
  42. def findBox[T](nodes: Seq[Node])(f: (Elem) ⇒ Box[T]): Box[T]

    Given a NodeSeq and a function that returns a Box[T], return the first value found in which the function evaluates to Full

    Given a NodeSeq and a function that returns a Box[T], return the first value found in which the function evaluates to Full

    Definition Classes
    BindHelpers
  43. def findId(ns: NodeSeq): Box[String]

    Finds the first Element in the NodeSeq (or any children) that has an ID attribute

    Finds the first Element in the NodeSeq (or any children) that has an ID attribute

    Definition Classes
    BindHelpers
  44. def findId(nodes: Seq[Node], id: String): Option[Elem]

    Given an id value, find the Elem with the specified id

    Given an id value, find the Elem with the specified id

    Definition Classes
    BindHelpers
  45. def findNode(in: Elem, nodes: NodeSeq): Box[Elem]

    Finds and returns the first node in the specified NodeSeq and its children with the same label and prefix as the specified element.

    Finds and returns the first node in the specified NodeSeq and its children with the same label and prefix as the specified element.

    Definition Classes
    BindHelpers
  46. def findOption[T](nodes: Seq[Node])(f: (Elem) ⇒ Option[T]): Option[T]

    Given a NodeSeq and a function that returns an Option[T], return the first value found in which the function evaluates to Some

    Given a NodeSeq and a function that returns an Option[T], return the first value found in which the function evaluates to Some

    Definition Classes
    BindHelpers
  47. def findOrCreateId(f: (String) ⇒ (NodeSeq) ⇒ NodeSeq): (NodeSeq) ⇒ NodeSeq

    Find the first Elem in the NodeSeq.

    Find the first Elem in the NodeSeq. If it has an id attribute, then call the function, f, with that id. If the first Elem does not have an id attribute, create an id attribute and pass that id attribute to the function

    Definition Classes
    BindHelpers
  48. final def getClass(): Class[_]

    Definition Classes
    AnyRef → Any
  49. def hashCode(): Int

    Definition Classes
    AnyRef → Any
  50. final def isInstanceOf[T0]: Boolean

    Definition Classes
    Any
  51. def mixinAttributes(out: Elem)(in: NodeSeq): NodeSeq

    Takes attributes from the first node of 'in' (if any) and mixes them into 'out'.

    Takes attributes from the first node of 'in' (if any) and mixes them into 'out'. Curried form can be used to produce a NodeSeq => NodeSeq for bind.

    out

    where to put the attributes

    in

    where to take the attributes from

    returns

    'out' element with attributes from 'in'

    Definition Classes
    BindHelpers
  52. final def ne(arg0: AnyRef): Boolean

    Definition Classes
    AnyRef
  53. final def notify(): Unit

    Definition Classes
    AnyRef
  54. final def notifyAll(): Unit

    Definition Classes
    AnyRef
  55. def replaceIdNode(in: NodeSeq, id: String, replacement: NodeSeq): NodeSeq

    Replace the element with the id that matches with the replacement nodeseq.

    Replace the element with the id that matches with the replacement nodeseq.

    Definition Classes
    BindHelpers
  56. implicit def strToCssBindPromoter(str: String): ToCssBindPromoter

    promote a String to a ToCssBindPromotor

    promote a String to a ToCssBindPromotor

    Definition Classes
    BindHelpers
  57. implicit def strToSuperArrowAssoc(in: String): SuperArrowAssoc

    Definition Classes
    BindHelpers
  58. def stripHead(in: NodeSeq): NodeSeq

    Remove all the <head> tags, just leaving the child tags

    Remove all the <head> tags, just leaving the child tags

    Definition Classes
    BindHelpers
  59. final def synchronized[T0](arg0: ⇒ T0): T0

    Definition Classes
    AnyRef
  60. def template(xhtml: NodeSeq, prefix: String, tag1: String, tag2: String, tag3: String): Box[(NodeSeq, NodeSeq, NodeSeq)]

    Find three of many templates from the children

    Find three of many templates from the children

    Definition Classes
    BindHelpers
  61. def template(xhtml: NodeSeq, prefix: String, tag1: String, tag2: String): Box[(NodeSeq, NodeSeq)]

    Find two of many templates from the children

    Find two of many templates from the children

    Definition Classes
    BindHelpers
  62. def template(xhtml: NodeSeq, prefix: String, tag: String): Box[NodeSeq]

    Similar to chooseTemplate, this returns the contents of the element in a Full Box if found or an Empty Box otherwise.

    Similar to chooseTemplate, this returns the contents of the element in a Full Box if found or an Empty Box otherwise.

    Definition Classes
    BindHelpers
  63. def toString(): String

    Definition Classes
    AnyRef → Any
  64. final def wait(): Unit

    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  65. final def wait(arg0: Long, arg1: Int): Unit

    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  66. final def wait(arg0: Long): Unit

    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  67. def xmlParam(in: NodeSeq, param: String): Box[String]

    Finds the named attribute in specified XML element and returns a Full Box containing the value of the attribute if found.

    Finds the named attribute in specified XML element and returns a Full Box containing the value of the attribute if found. Empty otherwise.

    returns

    a Full Box containing the value of the attribute if found; Empty otherwise

    Definition Classes
    BindHelpers

Deprecated Value Members

  1. object BindParamAssoc

    transforms a Box into a Text node

  2. def processBind(around: NodeSeq, atWhat: Map[String, NodeSeq]): NodeSeq

    Bind parameters to XML.

    Bind parameters to XML.

    around

    XML with lift:bind elements

    atWhat

    data to bind

    Definition Classes
    BindHelpers
    Annotations
    @deprecated
    Deprecated

    (Since version 2.3) use the bind function instead

  3. implicit def strToBPAssoc(in: String): BindParamAssoc

    transforms a String to a BindParamAssoc object which can be associated to a BindParam object using the --> operator.

    transforms a String to a BindParamAssoc object which can be associated to a BindParam object using the --> operator.

    Usage: "David" --> "name"

    Definition Classes
    BindHelpers
    Annotations
    @deprecated
    Deprecated

    (Since version 2.4) use -> instead

  4. implicit def symToSAAssoc(in: Symbol): SuperArrowAssoc

    transforms a Symbol to a SuperArrowAssoc object which can be associated to a BindParam object using the -> operator.

    transforms a Symbol to a SuperArrowAssoc object which can be associated to a BindParam object using the -> operator.

    Usage: 'David -> "name"

    Definition Classes
    BindHelpers
    Annotations
    @deprecated
    Deprecated

    (Since version 2.4) use -> instead

  5. def xbind(namespace: String, xml: NodeSeq)(transform: PartialFunction[String, (NodeSeq) ⇒ NodeSeq]): NodeSeq

    Experimental extension to bind which passes in an additional "parameter" from the XHTML to the transform function, which can be used to format the returned NodeSeq.

    Experimental extension to bind which passes in an additional "parameter" from the XHTML to the transform function, which can be used to format the returned NodeSeq.

    Definition Classes
    BindHelpers
    Annotations
    @deprecated
    Deprecated

    (Since version 2.4) use bind instead

Inherited from BindHelpers

Inherited from AnyRef

Inherited from Any

Ungrouped