Justin Hunter > Reaction > Reaction::UI::FocusStack

Download:
Reaction-0.002005.tar.gz

Dependencies

Annotate this POD

CPAN RT

New  1
Open  1
Stalled  1
View/Report Bugs
Source  

NAME ^

Reaction::UI::FocusStack - A linked list of ViewPort-based objects

SYNOPSIS ^

  my $stack = Reaction::UI::FocusStack->new();

  # Or more commonly, in a Reaction::UI::RootController based
  # Catalyst Controller:
  my $stack = $ctx->focus_stack;

  # Add a new basic viewport inside the last viewport on the stack:
  my $vp = $stack->push_viewport('Reaction::UI::ViewPort' => 
                                  layout => 'xhtml'
                                );

  # Fetch the innermost viewport from the stack:
  my $vp = $stack->pop_viewport();

  # Remove all viewports inside a given viewport:
  $stack->pop_viewports_to($vp);

  # Create a named stack as a tangent to an existing viewport:
  my $newstack = $vp->create_tangent('somename');

  # Resolve current events using your stack:
  # This is called by Reaction::UI::RootController in the end action.
  $stack->apply_events($ctx, $param_hash);

DESCRIPTION ^

A FocusStack represents a list of related ViewPort objects. The Reaction::UI::RootController creates an empty stack for you in it's begin action, which represents the main thread/container of the page. Typically you add new ViewPorts to this stack as the main parts of your page. To add multiple parallel page subparts, create a tangent from the outer viewport, and add more viewports as normal.

METHODS ^

new

Arguments: none

Create a new empty FocusStack. This is done for you in Reaction::UI::RootController.

push_viewport

Arguments: $class, %options

Creates a new Reaction::UI::ViewPort based object and adds it to the stack.

The following attributes of the new ViewPort are set:

outer

Is set to the preceding ViewPort in the stack.

focus_stack

Is set to the FocusStack object that created the ViewPort.

location

Is set to the location of the ViewPort in the stack.

pop_viewport

Arguments: none

Removes the last/innermost ViewPort from the stack and returns it.

pop_viewports_to

Arguments: $viewport

Pops all ViewPorts off the stack until the given ViewPort object remains as the last item. If passed a $viewport not on the stack, this will empty the stack completely (and then die complainingly).

TODO: Should pop_viewports_to check $vp->focus_stack eq $self first?

vp_head

Arguments: none

Retrieve the first ViewPort in this stack. Useful for calling "render_viewport" in Reaction::UI::Window on a "focus_tangent" in Reaction::UI::ViewPort.

vp_head

Arguments: none

Retrieve the first ViewPort in this stack. Useful for calling "render_viewport" in Reaction::UI::Window on a "focus_tangent" in Reaction::UI::ViewPort.

vp_tail

Arguments: none

Retrieve the last ViewPort in this stack. Useful for calling "render_viewport" in Reaction::UI::Window on a "focus_tangent" in Reaction::UI::ViewPort.

vp_count

Arguments: none

loc_prefix

apply_events

Arguments: $ctx, $params_hashref

Instruct each of the ViewPorts in the stack to apply the given events to each of it's tangent stacks, and then to itself. These are applied starting with the last/innermost ViewPort first.

AUTHORS ^

See Reaction::Class for authors.

LICENSE ^

See Reaction::Class for the license.

syntax highlighting: