NAME

Reaction::UI::Window - Container for rendering the UI elements in

SYNOPSIS

my $window = Reaction::UI::Window->new(
  ctx => $ctx,
  view_name => $view_name,
  content_type => $content_type,
  title => $window_title,
);

# More commonly, as Reaction::UI::Controller::Root creates one for you:
my $window = $ctx->stash->{window};

# Resolve current events and render the view of the UI
#  elements of this Window:
# This is called by the end action of Reaction::UI::Controller::Root
$window->flush();

# Resolve current events:
$window->flush_events();

# Render the top ViewPort in the FocusStack of this Window:
$window->flush_view();

# Render a particular ViewPort:
$window->render_viewport($viewport);

# Or in a template:
[% window.render_viewport(self.inner) %]

# Add a ViewPort to the UI:
$window->focus_stack->push_viewport('Reaction::UI::ViewPort');

DESCRIPTION

A Window object is created and stored in the stash by Reaction::UI::Controller::Root, it is used to contain all the elements (ViewPorts) that make up the UI. The Window is rendered in the end action of the Root Controller to make up the page.

To add ViewPorts to the stack, use the "push_viewport" in Reaction::UI::Controller method. For more detailed information, read the Reaction::UI::FocusStack and Reaction::UI::ViewPort documentation.

ATTRIBUTES

These are set for you by "begin" in Reaction::UI::Controller::Root from your Root controller configuration.

ctx

Arguments: $ctx?

The current Catalyst context object.

view_name

Arguments: $viewname?

Retrieve/set the name of the Catalyst::View component used to render this Window. If this has not been set, rendering the Window will fail.

content_type

Arguments: $contenttype?

Retrieve the content_type for the page. If this has not been set, rendering the Window will fail.

title

Arguments: $title?
[% window.title %]

Retrieve/set the title of this page, if not set, it will default to "Untitled window".

view

Arguments: none

Retrieve the Catalyst::View instance, this can be set, or will be instantiated using the view_name class.

focus_stack

Arguments: none
$window->focus_stack->push_viewport('Reaction::UI::ViewPort');

Retrieve the stack of ViewPorts that contains all the UI elements for this Window. Use "push_viewport" in Reaction::UI::FocusStack on this to create more elements. An empty FocusStack is created by the Controller::Root when the Window is created.

METHODS

flush

Arguments: none

Synchronize the current events with all the Reaction::UI::ViewPort objects in the UI, then render the root ViewPort. This is called for you by "end" in Reaction::UI::Controller::Root.

flush_events

Arguments: none

Resolves all the current events, first the query parameters then the body parameters, with all the Reaction::UI::ViewPort objects in the UI. This calls "apply_events" in Reaction::UI::FocusStack. This method is called by flush.

flush_view

Arguments: none

Renders the page into the Catalyst::Response body, unless the response status is already set to 3xx, or the body has already been filled. This is done via "render_window" in Reaction::UI::View. This method is called by flush.

AUTHORS

See Reaction::Class for authors.

LICENSE

See Reaction::Class for the license.