The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

Solstice::State::Tracker - Tracks each users' progress through the state graph.

SYNOPSIS

  use Solstice::State::Tracker;
  my $tracker = new Solstice::State::Tracker;

  my $current_state = $tracker->getState();

  # These are passthroughs to the state machine
  $validate = $tracker->requiresValidation('transition');
  $revert = $tracker->requiresRevert('transition');
  $fresh = $tracker->requiresFresh('transition');
  $commit = $tracker->requiresCommit('transition');
  $update = $tracker->requiresUpdate('transition');

  if (! $tracker->transition('transition')) {
    die "Couldn't make a transition";
  }

  my $controller_name = $tracker->getController();

DESCRIPTION

This tracks the way a user moves through a Solstice tool. It seperates the state data from the movement through it, to help save some memory/cpu in the generation/storing of the state table. This is also the model for the navigation view.

Methods

new()

Constructor for a new State::Tracker object. You are not in a state yet until you call startApplication.

startApplication($pageFlowName, $state)

Pushes a new flow and state onto the stack. Use this when you need to set the user's position to a particular flow/state (like when they type in a URL).

transition($action)

Transitions to the next state given the action.

returns - the next state name; undef if invalid.

getController($app)

Returns the controller for the current state.

getState()

Returns the name of the current state.

setState()

Sets the current state.

canUseBackButton($action)

Returns whether the user should be able to use the back button after this transition.

getBackErrorMessage()

Returns the error message a user should receive if the back button is used but not allowed.

requires*($action)

Returns whether we have to run lifecycle stages

fail*()

Transitions to the failover state for the corresponding lifecycle stage.

returns - the controller for the new state.

getUpdateFailoverController()

Nontransitioning version of failUpdate()

getValidPreConditionsFailoverController()

Nontransitioning version of failValidPreConditions()

getFlow()

Returns the current page flow.

AUTHOR

Catalyst Group, <catalyst@u.washington.edu>

VERSION

$Revision: 3364 $

COPYRIGHT

Copyright 1998-2007 Office of Learning Technologies, University of Washington

Licensed under the Educational Community License, Version 1.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at: http://www.opensource.org/licenses/ecl1.php

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.