org.barracudamvc.core.comp
Class DefaultView

java.lang.Object
  extended by org.barracudamvc.core.comp.DefaultView
All Implemented Interfaces:
Cloneable, View
Direct Known Subclasses:
DefaultTableView, DefaultTemplateView

public class DefaultView
extends Object
implements View

This interface defines a View for components to render themselves in. Similar to the java.awt.Graphics object in AWT and Swing.

Since:
1.0
Version:
%I%, %G%
Author:
Christian Cryder , Stephen Peterson , Jacob Kjome

Field Summary
protected static org.apache.log4j.Logger logger
           
protected  Node node
           
protected  Map templateNodes
           
 
Constructor Summary
DefaultView()
          Default constructor to create a view
DefaultView(Node node)
          Create a view and bind it to a node
DefaultView(String name)
          Create a view and bind it to a node
DefaultView(String name, Node node)
          Create a view and bind it to a node
 
Method Summary
 Object clone()
          When a view is cloned, the underlying node that backs the view is set to null; you MUST bind the newly cloned view to a node before you can use it.
protected  void customSearchForTemplates(Node curnode)
          If you want to identify templates based on some custom mechanism, this is the method to override.
 String getName()
          Get the name for this view
 Node getNode()
          Get the specific DOM node the View is bound to
protected  void searchForTemplates(Node curnode)
          Allow the view to search the node for any templates.
 void setName(String iname)
          Set the name for this view
 void setNode(Node inode)
          Bind the view to a specific DOM node
 String toString()
          Get a String describing the view
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

logger

protected static final org.apache.log4j.Logger logger

node

protected Node node

templateNodes

protected Map templateNodes
Constructor Detail

DefaultView

public DefaultView()
Default constructor to create a view


DefaultView

public DefaultView(String name)
Create a view and bind it to a node

Parameters:
name - the name of the view

DefaultView

public DefaultView(Node node)
Create a view and bind it to a node

Parameters:
node - the node to which the view is bound

DefaultView

public DefaultView(String name,
                   Node node)
Create a view and bind it to a node

Parameters:
name - the name of the view
node - the node to which the view is bound
Method Detail

setNode

public void setNode(Node inode)
Bind the view to a specific DOM node

Specified by:
setNode in interface View
Parameters:
inode - the specific DOM node to bind the View to

getNode

public Node getNode()
Get the specific DOM node the View is bound to

Specified by:
getNode in interface View
Returns:
the specific DOM node the View is bound to

setName

public void setName(String iname)
Set the name for this view

Specified by:
setName in interface View
Parameters:
iname - the name for this view

getName

public String getName()
Get the name for this view

Specified by:
getName in interface View
Returns:
the name for this view

toString

public String toString()
Get a String describing the view

Overrides:
toString in class Object

searchForTemplates

protected void searchForTemplates(Node curnode)
Allow the view to search the node for any templates. By default, this method now only considers the root node (it used to parse through the entire template, which was not very efficient).


customSearchForTemplates

protected void customSearchForTemplates(Node curnode)
If you want to identify templates based on some custom mechanism, this is the method to override. Look at DefaultTableView for an example...


clone

public Object clone()
When a view is cloned, the underlying node that backs the view is set to null; you MUST bind the newly cloned view to a node before you can use it.

Specified by:
clone in interface View
Overrides:
clone in class Object


Copyright © 2006 BarracudaMVC.org All Rights Reserved.