package form
- Alphabetic
- Public
- All
Type Members
-
trait
Card
extends Specification with Snippets
This trait defines a simple tab with a title and some text.
This trait defines a simple tab with a title and some text.
The text will be interpreted as Markdown text when rendered as html
-
trait
Cards
extends AnyRef
A set of tabs with a title, where each tab simply contains some text
-
trait
Cell
extends Text with Xml with Executable
A Cell is the Textual or Xml representation of a Form element: Field, Prop or Form.
A Cell is the Textual or Xml representation of a Form element: Field, Prop or Form. A more general XmlCell is also available to be able to input any kind of Xml inside a Form
A Cell can be executed by executing the underlying element but also by setting the cell to a specific result (success or failure). This feature is used to display rows of values with were expected and found ok in Forms.
-
trait
Constraint
[T] extends AnyRef
Base class for constraints executed on an optional expected value.
-
trait
DecoratedLabel
[T] extends AnyRef
A DecoratedLabel holds a decorator and delegates decoration and styling operations to that Decorator
-
trait
DecoratedProperty
[T] extends DecoratedLabel[T]
A DecoratedLabel holds a decorator and delegates decoration and styling operations for values and labels to that Decorator
-
case class
Decorator
(label: (Any) ⇒ Any = identity, value: (Any) ⇒ Any = identity, labelStyles: Seq[String] = Vector(), valueStyles: Seq[String] = Vector()) extends Product with Serializable
This class contains functions to decorate and style a label and a value:
This class contains functions to decorate and style a label and a value:
- with a function taking the xml for the label/value and returning some xml
- with some xml attributes "name":"value" to style those labels/values
The methods of that class allow to stack new decoration, new styling attributes but also define standard decoration and styles for bold / italic / centered ... text.
-
case class
Effect
[T](label: String, value: Property[T], decorator: Decorator = Decorator()) extends Executable with DecoratedProperty[Effect[T]] with Product with Serializable
An Effect is a property which is used to display names corresponding to side-effects.
An Effect is a property which is used to display names corresponding to side-effects.
If the side effect throws an exception, the Effect will display it alongside to the label. Otherwise only the label is displayed.
The apply method can be used to execute the Effect effect and possibly get a value out of it (but usually not displayed):
Effect(label, 1).apply() must_== 1
The value is stored in a Property object so it will not be evaluated until explicitly queried.
-
case class
EffectCell
(e: Effect[_], result: Option[Result] = None) extends Cell with Product with Serializable
Cell embedding a Eff
-
case class
Field
[T](label: String, value: Property[T], decorator: Decorator = Decorator().bkGreyLabel) extends Executable with DecoratedProperty[Field[T]] with Product with Serializable
A Field is a property which is used only to display input values or output values.
A Field is a property which is used only to display input values or output values.
The apply method can be used to retrieve the Field value:
Field(label, 1).apply() must_== 1
The value is stored in a Property object so it will not be evaluated until explicitly queried
-
case class
FieldCell
(f: Field[_], result: Option[Result] = None) extends Cell with Product with Serializable
Cell embedding a Field
-
class
Form
extends Executable with Text
A Form is a container for Rows (@see Row) where each row contain some Cell (@see Cell).
A Form is a container for Rows (@see Row) where each row contain some Cell (@see Cell). It has an optional title and possibly no rows.
A Form can be executed by executing each row and collecting the results.
-
class
FormCell
extends Cell
Cell embedding a Form
-
case class
FunctionConstraint
[T, S](actual: T, executor: (T, T) ⇒ Result) extends Constraint[T] with Product with Serializable
This general constraint uses a function taking an actual value and an expected value to do the match.
-
trait
HasLabel
extends AnyRef
generic trait for anything having a label, to unify Props and Forms
-
class
InlinedForm
extends Form
This Form overrides the toXml and text methods so that it appears seamlessly included in another Form.
-
class
LazyCell
extends Cell
Proxy to a cell that's not evaluated right away when added to a row
-
case class
Prop
[T, S](label: String = "", actual: Property[T] = Property[T](), expected: Property[S] = Property[S](), constraint: (T, S) ⇒ Result = Prop.checkProp, decorator: Decorator = Decorator().bkGreyLabel) extends Executable with DecoratedProperty[Prop[T, S]] with Product with Serializable
The Prop class is a named property which holds:
The Prop class is a named property which holds:
- an actual value
- an expected value
- a constraint to check if the actual value conforms to the expected one
This property can be executed and can be inserted in a Form.
A Prop is meant to be declared as "bound" to an actual value:
val customerName = Prop("Customer name", person.name)
[the actual value is not evaluated until the Prop is executed]
Then it can be associated an expected value with the apply method (usually in a Form declaration):
customerName("Bill")
The actual and the expected values can have different types and the constraint which is applied to them can be anything returning a result.
However the Prop companion object provides a method to create a Property with a constraint using a beEqualTo matcher:
Prop("Name", "Eric")("Eric") must_== Success("'Eric' is equal to 'Eric'")
-
case class
PropCell
(p: Prop[_, _], result: Option[Result] = None) extends Cell with Product with Serializable
Cell embedding a Prop
- trait PropSyntax extends AnyRef
-
case class
Row
(cellList: List[Cell]) extends Executable with Product with Serializable
A Row is a non-empty list of Cells
A Row is a non-empty list of Cells
A Row can be executed by executing each Cell and collecting the results.
-
case class
Tab
(title: String, form: Form, result: Option[Result] = None) extends Cell with Product with Serializable
Class representing an individual tab
-
case class
Tabs
(tabs: Seq[Tab] = Vector(), result: Option[Result] = None) extends Cell with Product with Serializable
This class allows the creation of tabs to embed several forms at once on a limited html space
This class allows the creation of tabs to embed several forms at once on a limited html space
- See also
org.specs2.examples.FormSpec
-
trait
Text
extends AnyRef
Base type for anything returning some text
-
case class
TextCell
(s: String, result: Option[Result] = None, decorator: Decorator = Decorator()) extends Cell with DecoratedProperty[TextCell] with Product with Serializable
Simple Cell embedding an arbitrary String
-
trait
Xml
extends AnyRef
Base type for anything returning some xml
-
class
XmlCell
extends Cell
This cell can contain any xml
Value Members
-
object
Effect
extends Product with Serializable
Factory methods for creating Effects.
Factory methods for creating Effects. Effects values can also be concatenated to produce "summary" effects.
val e1 = Effect("hello", print("hello")) val e2 = Effect("world", print("world")) val concatenatedEffects = Effect(e1, e2) concatenatedEffects.toString == hello/world
val concatenatedEffect = Effect(", ", e1, e2) concatenatedEffects2.toString == hello, world
-
object
Field
extends Product with Serializable
Factory methods for creating Fields.
Factory methods for creating Fields. Fields values can also be concatenated to produce "summary" fields.
val f1 = Field(label, "hello") val f2 = Field(label, "world") val concatenatedFields = Field(label, f1, f2) concatenatedFields.toString == label: hello/world
val concatenatedFields2 = Field(label, ", ", f1, f2) concatenatedFields2.toString == label: hello, world
-
object
Form
extends Product with Serializable
Companion object of a Form to create:
Companion object of a Form to create:
- an empty Form
- a Form with no rows but a title
- a Form with no title but one row
- object FormCell
- object FormDiffs extends FormDiffs
- object LazyCell
-
object
Prop
extends Serializable
Companion object with factory methods
-
object
Row
extends Product with Serializable
Companion object of a Row to create a Row with at least one cell
- object TextCell extends Serializable
-
object
Xml
utility functions for creating xml for Cells
- object XmlCell