Miles Crawford > Solstice-1440 > Solstice::View

Download:
Solstice-1440.tar.gz

Dependencies

Annotate this POD

View/Report Bugs
Module Version: 3364   Source  

NAME ^

Solstice::View - A superclass for constructing views.

SYNOPSIS ^

  package MyView;

  use base qw(Solstice::View);

  our $template = 'path/to/template.html';

  # If you dynamically choose a template, you need to specify the possibilities up 
  # front, so the compiler knows how to deal with them.  In most cases, this line 
  # is unnecessary:
  $self->setPossibleTemplates('template_cool.html', 'template_lame.html');

  sub generateParams {
    # To add a single scalar or array ref
    $self->setParam('param_name', $scalar);
    $self->setParam('param_name', \@array);

    # To add to a loop...
    $self->addParam('loop_name', \%hash_ref);

    # To add multiple values at once...
    $self->setParams(\%hash_ref);
  }

  # You can do this instead, but it's old, and not recommended.
  sub _getTemplateParams {
    return { my => "specific", template => "params" };
  }

DESCRIPTION ^

This is a virtual class for creating solstice view objects. This class should never be instantiated as an object, rather, it should always be sub-classed.

Export

No symbols exported..

Methods

new($model)

Creates a new Solstice::View object. $model is the data model for the view

getErrorHTML()

Takes an error object and returns the html you can put in your template.

This function isn't doing anything anymore. Is it even being used??

setModel($model)

Sets the data model for this view.

getModel()

Returns the data model for this view.

setError($form_results)

Sets an error for this view.

getError()

Returns the error for this view.

setPossibleTemplates(@template_names)

Sets all of the templates that might be used by the view.

getPossibleTemplates()

Returns the templates that this view might use.

makeButton {
makeStaticButton {
makeFlyoutButton {
makePopinButton {
makePopupButton {
addSortParams($sort_service)

Adds the sorting widgets for a given sort service object.

paint(\$screen)

Appends the HTML code for this view to $screen.

This will try to compile a paint method, if there's a path for compiled views in config.

setParam('name', 'value')

Sets a param's value. Multiple calls to this method will overwrite previous values.

setParams(\%hash)

Sets multiple values into a param. Multiple calls will overwrite previous values.

addParam('loop_name', $data_ref)

This adds the data combo to the loop given. Multiple calls will add multiple values.

setSubView("key_name", $view_object)

This tells the view that a subview has already been created, so it should use that instead of creating a new one.

getSubView("key_name")

This is a method for a view to get a subview that may have already been created.

setIsSubView()

This turns on a flag for a view, so that it knows it is not the top-level view. By default all views will think they are top level, which impacts the way they react upon form submission error.

isSubView()

Returns the flag specifying whether this view is a sub view.

setSubViewHasError()

This sets a flag that says a subview has an error. This makes it so the top level view can show a more global error message.

subViewHasError()

Returns a flag saying whether a subview has an error.

createChildViewList( 'loop_name', 'var_name' )
addChildView()
addChildViews()

this is an alias for addChildView, since it can actually handle many views

processChildViews()
generateParams()

This should fill out the params for the view, by way of setParam and addParam.

generateChildParams()

Process child views and add params to the view.

Private Methods

_setApp()

Sets the template file for this view. The template file is assumed to live in the relative 'templates' directory.

_getApp()

Returns the template file for this view. The template file is assumed to live in the relative 'templates' directory.

_setTemplate()

Sets the template file for this view. The template file is assumed to live in the relative 'templates' directory.

_getTemplate()

Returns the template file for this view. The template file is assumed to live in the relative 'templates' directory.

_setTemplatePath()
_getTemplatePath()
_getPackageTemplate()
_getTemplateEngine()
_createTemplatePath()

This will return the path to templates. If it's been set already, it will return that, otherwise it will figure it out.

_getTemplateParams()

This will return the data for a template. Can be overridden by old-skool view subclasses. This handles errors for us. Yay!

_clearParams()

Clears out all params added or set.

_templateModified()

Determines whether the template has been modified, and recompiles if needed.

_compilePaint($screen)

Modules Used

Solstice::View::MessageService.

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.

syntax highlighting: