FileDocCategorySizeDatePackage
View.javaAPI DocExample2377Sat Nov 22 20:33:22 GMT 2003cvexample.controller

View

public class View extends Object
The internal representation of a view from the views.xml file

Fields Summary
private HashMap
containers
the containers in this view, mapped by name
private String
template
the template for this view
Constructors Summary
public View(String template)
Create a new view with the given template

        containers = new HashMap();
        this.template = template;
    
Methods Summary
public voidaddInclude(java.lang.String container, java.lang.String name, java.lang.String url)
Add an include to this view, given a container within the view, the name of the include and the associated url

        // find the container
        Container c = (Container) containers.get(container);
        
        // if the container doesn't exist, create it
        if (c == null) {
            c = new Container();
            containers.put(container, c);
        }
        
        // add the include to the container
        c.addInclude(name, url);
    
public java.lang.StringgetTemplate()
Get the template associated with this view

        return template;
    
public java.lang.StringgetUrl(java.lang.String container, java.lang.String name)
Get the url associated with a named view

        // find the container
        Container c = (Container) containers.get(container);
        if (c == null) {
            return null;
        }
        
        // get the url
        return c.getUrl(name);
    
public booleanhasContainer(java.lang.String container)
Determine if this view has a container with the given name

        return containers.containsKey(container);