NAME

Reaction::UI::ViewPort::Object - Display an InterfaceModel::Object

SYNOPSIS

use aliased 'Reaction::UI::ViewPort::Object';

...
$controller->push_viewport(Object,
  model           => $person_interface_model_object,
  fields_order    => [qw( firstname lastname )],
  excluded_fields => [qw( password )],
);

DESCRIPTION

Takes a Reaction::InterfaceModel::Object class and displays the configured fields.

ATTRIBUTES

model

Required Reaction::InterfaceModel::Object.

fields

Initialised via "_build_fields"

field_args

Hash reference keyed by field names. Values are hash references containing arguments to the field builder method of the attribute.

field_order

Array reference of strings defining the order of all fields (including the ones that might be excluded).

builder_cache

Hash reference containing resolved builder method names per field. Utilised by "_build_fields"

excluded_fields

Array reference of strings naming fields to exclude from the interface.

included_fields

List of field names to include. If both included_fields and excluded_fields are specified the result is those fields which are in included_fields and not in excluded_fields.

computed_field_order

Array reference of strings Initialised by the "_computed_field_order" method. Contains the fields to show in the correct order.

containers

Array reference populated by "_build_containers".

container_layouts

Array reference containing container layout specifications.

INTERNAL METHODS

These methods, although stable, are subject to change without notice. These are meant to be used only by developers. End users should refrain from using these methods to avoid potential breakages.

BUILD

Takes the value of the Field constructor argument, if true, and sets it as the new "field_args" hash reference.

get_builder_for

Takes an attribute object as argument and returns a string containing the name of the method that builds the fields for this attribute.

If the viewport implements it, _build_fields_for_name_${attr_name} will be used.

If that is not available, it will take the isa information of the type constraint and see if it is a loaded class implementing meta. If it is, every class in its class_precedence_list will be taken and used to try to find a _build_fields_for_type_${mangled_class_name} method on the viewport.

"mangled" means here that every :* will be replaced with _. For example: Foo::Bar would become Foo_Bar.

If the isa information was not obtainable or no fitting method was found, it will try the type name in a method named _build_fields_for_type_${mangled_type_name}.

If could be found on this constraint, it will make the same attempts to find a method on its parent type constraint.

This method will die if it can't locate a method to build a field for this attribute.

_build_containers

Uses "container_layouts" to build a list of Reaction::UI::ViewPort::Field::Container objects.

_build_fields

Takes the "model"s parameter_attributes to build fields via "get_builder_for". They will be ordered as specified in "computed_field_order".

_build_computed_field_order

Takes the names of the "model"s parameter_attributes' reader methods and assumes them as field names. Then it uses "field_order" and "excluded_fields" to calculate the order of all included fields and returns those names.

_build_simple_field

$self->_build_simple_field(
  attribute => $attribute_object,
  class     => $field_class,
  %field_attrs,
);

Takes an attribute meta object, a field class (a Reaction::UI::ViewPort::Field subclass) and an additional set of arguments to pass to the field constructor and returns the new field. Field classes themselves are Reaction::UI::ViewPort subclasses.

_build_fields_for_type_Num

_build_fields_for_type_Int

_build_fields_for_type_Bool

_build_fields_for_type_Password

_build_fields_for_type_Str

_build_fields_for_type_SimpleStr

_build_fields_for_type_DateTime

_build_fields_for_type_Enum

_build_fields_for_type_ArrayRef

_build_fields_for_type_Reaction_InterfaceModel_Object

_build_fields_for_type_Reaction_InterfaceModel_Collection

FIELD TYPES

Text, Number, Integer, Boolean, String, DateTime, RelatedObject, Array, Collection, File, Container

AUTHORS

See Reaction::Class for authors.

LICENSE

See Reaction::Class for the license.