- ViewPort - component representing part of a page - Focus - current page - Tangent - inner stack of a viewport for holding multiple viewports. - Stack - Hierarchical collection of viewports defining a page - Event ? The focus stack is a linked list of viewports, from outside in. Outside being th e page level, inner items being the various parts of the page, which can further be broken down into more viewports. The stack defines the layers of viewports that make up the entire page. Each viewport also knows what it's target is, the stack itself. (target_name)(?) ViewPorts can be added to or removed from the stack using push_viewport and pop_viewport. (also controller methods?) An empty focus stack is created by the begin action in the UI::RootController. The end action does event delivery before rendering. Per default, a viewport can only contain one inner viewport, to contain multiple viewports, you need to create a tangent. $viewport->create_tangent('name') creates a named tangent stack for the given viewport, onto which more viewports can be pushed. A viewport decides which events are are for it, and which for it's children, it applies the events to the children first, then to itself. Thus, the innermost viewports are rendered(?) first. By default, child events are just any focus tangents owned by that viewport. To render the inner viewport in the template for the current viewport, use [% window.render_viewport(self.inner) %]. If using tangents for multiple inner viewports, you can select the tangent using focus_tangent: [% window.render_viewport(self.focus_tangent('name').vp_outer %]. 14:29 <@mst> reaction assigns each viewport a param prefix 14:30 <@mst> so '1-foo-0:bar=baz' means 'find $stack->vps->[1]->tangents->{foo}- >vps->[0] and call $vp->bar('baz') - connect_event / connect_control, connect_href ? - Existing ViewPorts: ListView, Field, ActionForm =============================================================================== - Reaction::UI::Widget has_a viewport has_a view implements render, which calls render_widget on $self, passing the rendering context (rctx) and self. implements render_viewport which calls render_viewport on the view instance, passing the viewport instance in the _ slot in the arguments hashref. (??) ====== - Reaction::UI::View has_a app (readonly, required) - the $context from catalyst has_a skin_name (readonly, required) has_a layout_set_class (readonly, lazy build) has_a rendering_context_class (readonly, lazy build) implements COMPONENT - this is a catalyst component, sets "app" to the passed in $context. implements render_window - retrieves the root viewport via the focus_stack of the passed in window instance, and passes it to $self->render_viewport implments render_viewport - fetches the layoutset for the passed in viewport (see above) (layout_set_for_ - creates a rendering context using the layoutset and the outer rendering context (rctx) (create_rendering_context) - fetches a widget instance for the viewport and layoutset combination (widget_for) - calls render on the widget, passing it the new rendering context implements widget_for - takes a viewport and a layout_set and returns a new instance of the appropriate widget_class for the layoutset, passing the viewport and this view instance. (widget_class_for) implements widget_class_for - determines the appropriate widget class for the given layoutset by taking as a base the class of $self (a Reaction::UI::View) and appending 'Widget' plus the widget_type of the passed in layoutset. The class is loaded (Class::MOP::load_class) and returned. implements layout_set_for - calls layout on the passed in viewport to find out the layout_set name - if this fails, extracts the last part of the viewport class name and converts it, changing camel case to underscore, eg: ActionForm => action_form - retrieves the layoutset instance from the cache (_layout_set_cache) if available, else calls create_layout_set passing the name implements create_layout_set - takes a layout set name and returns a new instance of the appropriate layout set class, retrieving the arguments for it via layout_set_args_for (layout_set_class) implements find_related_class - searches for a class name like ::View:: in the class hierarchy (meta->class_precedence_list) of this View class, replaces the ::View:: with the passed in relative name, and attempts to load and return the class name. implements build_layout_set_class - find_related_class('LayoutSet') implements layout_set_args_for - returns a hash with two keys, name => passed in name, and search_path => layout_search_path implements layout_search_path - returns the search_path_for_type result for 'layout' implements search_path_for_type - returns an arrayref containing a Path::Class object from Catalyst's path_to passing it "share/skin/$skin_name/$type", using the passed in type. implements create_rendering_context - returns a new instance of a rendering context (rendering_context_class), passing it the default args for rendering contexts (rendering_context_args_for) and any passed in args. implements build_rendering_context_class - find_related_class('RenderingContext') implements rendering_context_args_for - empty ========== - Reaction::UI::LayoutSet has_a fragments (readonly) - defaults to empty hashref has_a name (readonly, required) has_a source_file implements BUILD - uses an arrayref 'search_path' from the arguments - looks through the search path for a file named after the "name" of this LayoutSet, which is loaded (_load_file) implements _load_file - attempts to slurp the contents of the given filename - retrieves the fragments hashref, and tries to extract fragment chunks (=for layout XX --> =something - sets source_file to $file implements widget_type - returns the CamelCased version of the layout name. ========== - Reaction::UI::LayoutSet::TT has_a tt_view (Reaction::UI::View) implements BUILD - call _build_tt_view to create the tt_view object implements _build_tt_view - requires a 'tt_object' key in args - processes an inline TT template containing VIEW (name of this layoutset) and a bunch of BLOCK statements from the hashref of data in 'fragments' - returns result? in $tt_args->{data}{view} ? ========== - Reaction::UI::RenderingContext implements render - an empty abstract method ========== - Reaction::UI::RenderingContext::TT has_a tt_view (Reaction::UI::View) has_a iter_class default: Reaction::UI::Renderer::TT::Iter implements render - takes name and args - make all coderef arguments close over the instance of this renderingcontext