Main Page | Class Hierarchy | Alphabetical List | Class List | File List | Class Members | Related Pages

edu.virtualschool.jwaa.MetaPage Class Reference

Inheritance diagram for edu.virtualschool.jwaa.MetaPage:

edu.virtualschool.jwaa.TreeNode edu.virtualschool.jwaa.xml.PageElement Collaboration diagram for edu.virtualschool.jwaa.MetaPage:

Collaboration graph
[legend]
List of all members.

Detailed Description

Defines the position of a page with respect to its parent/siblings in a page hierarchy.

Definition at line 18 of file MetaPage.java.

Public Member Functions

 MetaPage (Class pageClass, String url, String anchor, String title, MetaPage[] children)
 MetaPage (Class pageClass, String url, String anchor, String title)
 MetaPage (Class pageClass, String url, String anchor, String title, RoleAbstraction requiredRole)
 MetaPage (Class pageClass, String url, String anchor, String title, RoleAbstraction requiredRole, MetaPage[] children)
boolean isSelected ()
void setSelected (boolean yesno)
GenericURI getLink ()
final String getAnchor ()
final String getTitle ()
final RoleAbstraction getRequiredRole ()
final MetaPage nextPage ()
final MetaPage prevPage ()
boolean allowsAccessBy (AccountAbstraction person)
String emitLink (GenericPage ctlr, Object a, Object t, Object[] args)
String emitForm (GenericPage ctlr, Object[] args)
final void forward (GenericPage ctlr) throws IOFault, IgnorableFault, ServletFault

Package Functions

String encodeRedirectURL (GenericPage ctlr, String uri)
String encodeURL (GenericPage ctlr, String uri)
String composeURIAndArgs (String uri, Object[] args)

Package Attributes

final Class pageClass
final String defaultAnchor
final String defaultTitle
final GenericURI link
boolean isSelected = false
final RoleAbstraction requiredRole


Constructor & Destructor Documentation

edu.virtualschool.jwaa.MetaPage.MetaPage Class  pageClass,
String  url,
String  anchor,
String  title,
MetaPage[]  children
 

Constructor

Parameters:
pageClass: the page class itself
url: A unique uri for the page. Should be relative to the servlet root.
anchor: the anchor text for this page (one word).
title: the title text for this page (a few words).
children: pages attached to this page in the page hierarchy.

Definition at line 38 of file MetaPage.java.

00040   {
00041     this(pageClass, url, anchor, title, null, children);
00042   }


Member Function Documentation

boolean edu.virtualschool.jwaa.MetaPage.allowsAccessBy AccountAbstraction  person  ) 
 

Returns true if this page allows access by the provided person (which may be null or Role.NONE if no one is logged in), else false. Access is allowed if the page specifies no role requirement (requiredRole is null), otherwise disallowed unless someone is logged in (person it not null) and has the required role. Refused requests are logged (along with the person identifier) at WARN priority.

Definition at line 148 of file MetaPage.java.

References edu.virtualschool.jwaa.AccountAbstraction.hasRole(), and edu.virtualschool.jwaa.AccountAbstraction.isNull().

Referenced by edu.virtualschool.jwaa.GenericLookAndFeel.computeNavigationBar(), edu.virtualschool.jwaa.GenericServlet.doRequest(), and edu.virtualschool.jwaa.xml.Controller.run().

00149   {
00150     boolean allowed = false;
00151     if (requiredRole == null)
00152       allowed = true;
00153     else if (person == null)
00154       allowed = false;
00155     else if (person.isNull())
00156       allowed = false;
00157     else 
00158       allowed = person.hasRole(requiredRole);
00159     if (!allowed)
00160       logger.warn(this + " denied access by person " + person);
00161     return allowed;
00162   }

String edu.virtualschool.jwaa.MetaPage.encodeRedirectURL GenericPage  ctlr,
String  uri
[package]
 

Return the string representation for this page

Returns:
String

Definition at line 171 of file MetaPage.java.

References edu.virtualschool.jwaa.GenericPage.httpResponse.

00172   {
00173     HttpServletResponse rsp = ctlr.httpResponse;
00174     String encodedURL = rsp.encodeRedirectURL(uri);
00175     return encodedURL;
00176   }

final String edu.virtualschool.jwaa.MetaPage.getAnchor  ) 
 

Return the anchor string for this page

Returns:
String

Definition at line 89 of file MetaPage.java.

00090   {
00091     return defaultAnchor;
00092   }

final RoleAbstraction edu.virtualschool.jwaa.MetaPage.getRequiredRole  ) 
 

Return the role needed to access this page

Returns:
GenericRole

Definition at line 106 of file MetaPage.java.

00106 { return requiredRole; }

final String edu.virtualschool.jwaa.MetaPage.getTitle  ) 
 

Return the title string for this page

Returns:
String

Definition at line 97 of file MetaPage.java.

00098   {
00099     return defaultTitle;
00100   }

final MetaPage edu.virtualschool.jwaa.MetaPage.nextPage  ) 
 

Returns the next page

Returns:
PageElement: this page's right hand sibling or the first child of the leftmost sibling if there are no right siblings.

Definition at line 112 of file MetaPage.java.

References edu.virtualschool.jwaa.TreeNode.childrenIterator(), edu.virtualschool.jwaa.TreeNode.getParentNode(), and edu.virtualschool.jwaa.TreeNode.nextSiblingNode().

00113   {
00114     Iterator iterator = childrenIterator();
00115     if (iterator.hasNext()) 
00116       return (MetaPage)iterator.next();
00117 
00118     MetaPage sibling = (MetaPage)nextSiblingNode();
00119     if (sibling != null) 
00120       return sibling;
00121 
00122     MetaPage parent = (MetaPage)getParentNode();
00123     if (parent != null) 
00124       return (MetaPage)parent.nextSiblingNode();
00125     else 
00126       return null;
00127   }

final MetaPage edu.virtualschool.jwaa.MetaPage.prevPage  ) 
 

Return this page's left sibling

Returns:
PageElement: this page's left sibling or its parent if there are no more left siblings.

Definition at line 133 of file MetaPage.java.

References edu.virtualschool.jwaa.TreeNode.getParentNode(), and edu.virtualschool.jwaa.TreeNode.prevSiblingNode().

00134   {
00135     MetaPage sibling = (MetaPage)prevSiblingNode();
00136     if (sibling != null) return sibling;
00137     return (MetaPage)getParentNode();
00138   }


The documentation for this class was generated from the following file: