Clover coverage report - Code Coverage for tapestry release 3.1-alpha-1
Coverage timestamp: Mon Feb 21 2005 09:16:14 EST
file stats: LOC: 324   Methods: 0
NCLOC: 42   Classes: 1
30 day Evaluation Version distributed via the Maven Jar Repository. Clover is not free. You have 30 days to evaluate it. Please visit http://www.thecortex.net/clover to obtain a licensed version of Clover
 
 Source file Conditionals Statements Methods TOTAL
IComponent.java - - - -
coverage
 1   
 // Copyright 2004, 2005 The Apache Software Foundation
 2   
 //
 3   
 // Licensed under the Apache License, Version 2.0 (the "License");
 4   
 // you may not use this file except in compliance with the License.
 5   
 // You may obtain a copy of the License at
 6   
 //
 7   
 //     http://www.apache.org/licenses/LICENSE-2.0
 8   
 //
 9   
 // Unless required by applicable law or agreed to in writing, software
 10   
 // distributed under the License is distributed on an "AS IS" BASIS,
 11   
 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 12   
 // See the License for the specific language governing permissions and
 13   
 // limitations under the License.
 14   
 
 15   
 package org.apache.tapestry;
 16   
 
 17   
 import java.util.Collection;
 18   
 import java.util.Map;
 19   
 
 20   
 import org.apache.hivemind.LocationHolder;
 21   
 import org.apache.hivemind.Messages;
 22   
 import org.apache.tapestry.engine.IPageLoader;
 23   
 import org.apache.tapestry.listener.ListenerMap;
 24   
 import org.apache.tapestry.spec.IComponentSpecification;
 25   
 
 26   
 /**
 27   
  * Defines an object which may be used to provide dynamic content on a Tapestry web page.
 28   
  * <p>
 29   
  * Components are created dynamically from thier class names (part of the
 30   
  * {@link IComponentSpecification}).
 31   
  * 
 32   
  * @author Howard Leiws Ship
 33   
  */
 34   
 
 35   
 public interface IComponent extends IRender, LocationHolder
 36   
 {
 37   
 
 38   
     /**
 39   
      * Adds an asset to the component. This is invoked from the page loader.
 40   
      */
 41   
 
 42   
     public void addAsset(String name, IAsset asset);
 43   
 
 44   
     /**
 45   
      * Adds a component to a container. Should only be called during the page loading process, which
 46   
      * is responsible for any checking.
 47   
      * 
 48   
      * @see IPageLoader
 49   
      */
 50   
 
 51   
     public void addComponent(IComponent component);
 52   
 
 53   
     /**
 54   
      * Adds a new renderable element to the receiver's body. The element may be either another
 55   
      * component, or static HTML. Such elements come from inside the receiver's tag within its
 56   
      * container's template, and represent static text and other components.
 57   
      * <p>
 58   
      * The method {@link #renderBody(IMarkupWriter, IRequestCycle)}is used to render these
 59   
      * elements.
 60   
      * 
 61   
      * @since 2.2
 62   
      */
 63   
 
 64   
     public void addBody(IRender element);
 65   
 
 66   
     /**
 67   
      * Returns the asset map for the component, which may be empty but will not be null.
 68   
      * <p>
 69   
      * The return value is unmodifiable.
 70   
      */
 71   
 
 72   
     public Map getAssets();
 73   
 
 74   
     /**
 75   
      * Returns the named asset, or null if not found.
 76   
      */
 77   
 
 78   
     public IAsset getAsset(String name);
 79   
 
 80   
     /**
 81   
      * Returns the binding with the given name or null if not found.
 82   
      * <p>
 83   
      * Bindings are added to a component using {@link #setBinding(String,IBinding)}.
 84   
      */
 85   
 
 86   
     public IBinding getBinding(String name);
 87   
 
 88   
     /**
 89   
      * Returns a {@link Collection}of the names of all bindings (which includes bindings for both
 90   
      * formal and informal parameters).
 91   
      * <p>
 92   
      * The return value is unmodifiable. It will be null for a {@link IPage page}, or may simply be
 93   
      * empty for a component with no bindings.
 94   
      */
 95   
 
 96   
     public Collection getBindingNames();
 97   
 
 98   
     /**
 99   
      * Returns a {@link Map}of the {@link IBinding bindings}for this component; this includes
 100   
      * informal parameters as well as formal bindings.
 101   
      * 
 102   
      * @since 1.0.5
 103   
      */
 104   
 
 105   
     public Map getBindings();
 106   
 
 107   
     /**
 108   
      * Retrieves an contained component by its id. Contained components have unique ids within their
 109   
      * container.
 110   
      * 
 111   
      * @exception ApplicationRuntimeException
 112   
      *                runtime exception thrown if the named component does not exist.
 113   
      */
 114   
 
 115   
     public IComponent getComponent(String id);
 116   
 
 117   
     /**
 118   
      * Returns the component which embeds the receiver. All components are contained within other
 119   
      * components, with the exception of the root page component.
 120   
      * <p>
 121   
      * A page returns null.
 122   
      */
 123   
 
 124   
     public IComponent getContainer();
 125   
 
 126   
     /**
 127   
      * Sets the container of the component. This is write-once, an attempt to change it later will
 128   
      * throw an {@link ApplicationRuntimeException}.
 129   
      */
 130   
 
 131   
     public void setContainer(IComponent value);
 132   
 
 133   
     /**
 134   
      * Returns a string identifying the name of the page and the id path of the reciever within the
 135   
      * page. Pages simply return their name.
 136   
      * 
 137   
      * @see #getIdPath()
 138   
      */
 139   
 
 140   
     public String getExtendedId();
 141   
 
 142   
     /**
 143   
      * Returns the simple id of the component, as defined in its specification.
 144   
      * <p>
 145   
      * An id will be unique within the component which contains this component.
 146   
      * <p>
 147   
      * A {@link IPage page}will always return null.
 148   
      */
 149   
 
 150   
     public String getId();
 151   
 
 152   
     /**
 153   
      * Sets the id of the component. This is write-once, an attempt to change it later will throw an
 154   
      * {@link ApplicationRuntimeException}.
 155   
      */
 156   
 
 157   
     public void setId(String value);
 158   
 
 159   
     /**
 160   
      * Returns the qualified id of the component. This represents a path from the {@link IPage page}
 161   
      * to this component, showing how components contain each other.
 162   
      * <p>
 163   
      * A {@link IPage page}will always return null. A component contained on a page returns its
 164   
      * simple id. Other components return their container's id path followed by a period and their
 165   
      * own name.
 166   
      * 
 167   
      * @see #getId()
 168   
      */
 169   
 
 170   
     public String getIdPath();
 171   
 
 172   
     /**
 173   
      * Returns the page which ultimately contains the receiver. A page will return itself.
 174   
      */
 175   
 
 176   
     public IPage getPage();
 177   
 
 178   
     /**
 179   
      * Sets the page which ultimiately contains the component. This is write-once, an attempt to
 180   
      * change it later will throw an {@link ApplicationRuntimeException}.
 181   
      */
 182   
 
 183   
     public void setPage(IPage value);
 184   
 
 185   
     /**
 186   
      * Returns the specification which defines the component.
 187   
      */
 188   
 
 189   
     public IComponentSpecification getSpecification();
 190   
 
 191   
     /**
 192   
      * Invoked to make the receiver render its body (the elements and components its tag wraps
 193   
      * around, on its container's template). This method is public so that the
 194   
      * {@link org.apache.tapestry.components.RenderBody}component may operate.
 195   
      * 
 196   
      * @since 2.2
 197   
      */
 198   
 
 199   
     public void renderBody(IMarkupWriter writer, IRequestCycle cycle);
 200   
 
 201   
     /**
 202   
      * Adds a binding to a container. Should only be called during the page loading process (which
 203   
      * is responsible for eror checking).
 204   
      * 
 205   
      * @see IPageLoader
 206   
      */
 207   
 
 208   
     public void setBinding(String name, IBinding binding);
 209   
 
 210   
     /**
 211   
      * Returns the contained components as an unmodifiable {@link Map}. This allows peer components
 212   
      * to work together without directly involving their container ... the classic example is to
 213   
      * have an {@link org.apache.tapestry.components.Insert}work with an enclosing
 214   
      * {@link org.apache.tapestry.components.Foreach}.
 215   
      * <p>
 216   
      * This is late addition to Tapestry, because it also opens the door to abuse, since it is quite
 217   
      * possible to break the "black box" aspect of a component by interacting directly with
 218   
      * components it embeds. This creates ugly interelationships between components that should be
 219   
      * seperated.
 220   
      * 
 221   
      * @return A Map of components keyed on component id. May return an empty map, but won't return
 222   
      *         null.
 223   
      */
 224   
 
 225   
     public Map getComponents();
 226   
 
 227   
     /**
 228   
      * Allows a component to finish any setup after it has been constructed.
 229   
      * <p>
 230   
      * The exact timing is not specified, but any components contained by the receiving component
 231   
      * will also have been constructed before this method is invoked.
 232   
      * <p>
 233   
      * As of release 1.0.6, this method is invoked <em>before</em> bindings are set. This should
 234   
      * not affect anything, as bindings should only be used during renderring.
 235   
      * <p>
 236   
      * Release 2.2 added the cycle parameter which is, regretfully, not backwards compatible.
 237   
      * 
 238   
      * @since 0.2.12
 239   
      */
 240   
 
 241   
     public void finishLoad(IRequestCycle cycle, IPageLoader loader,
 242   
             IComponentSpecification specification);
 243   
 
 244   
     /**
 245   
      * Returns component strings for the component. Starting in release 3.1, this method is
 246   
      * unimplemented (and is automatically injected into each component implementation).
 247   
      * 
 248   
      * @since 3.0
 249   
      */
 250   
 
 251   
     public Messages getMessages();
 252   
 
 253   
     /**
 254   
      * Returns the {@link INamespace}in which the component was defined (as an alias).
 255   
      * 
 256   
      * @since 2.2
 257   
      */
 258   
 
 259   
     public INamespace getNamespace();
 260   
 
 261   
     /**
 262   
      * Sets the {@link INamespace}for the component. The namespace should only be set once.
 263   
      * 
 264   
      * @since 2.2
 265   
      */
 266   
 
 267   
     public void setNamespace(INamespace namespace);
 268   
 
 269   
     /**
 270   
      * Sets a property of a component.
 271   
      * 
 272   
      * @param propertyName
 273   
      *            the property name
 274   
      * @param value
 275   
      *            the provided value
 276   
      */
 277   
     public void setProperty(String propertyName, Object value);
 278   
 
 279   
     /**
 280   
      * Gets a property of a component.
 281   
      * 
 282   
      * @param propertyName
 283   
      *            the property name
 284   
      * @return Object the value of property
 285   
      */
 286   
     public Object getProperty(String propertyName);
 287   
 
 288   
     /**
 289   
      * Returns true if the component is currently rendering.
 290   
      * 
 291   
      * @since 3.1
 292   
      */
 293   
 
 294   
     public boolean isRendering();
 295   
 
 296   
     /**
 297   
      * Invoked after {@link #finishLoad(IRequestCycle, IPageLoader, IComponentSpecification)}to
 298   
      * switch the component from its initial construction state into its active state. The
 299   
      * difference concerns parameters, whose defaults values may be set from inside
 300   
      * {@link #finishLoad(IRequestCycle, IPageLoader, IComponentSpecification)}.
 301   
      * 
 302   
      * @since 3.1
 303   
      */
 304   
 
 305   
     public void enterActiveState();
 306   
 
 307   
     /**
 308   
      * Returns a {@link IBeanProvider}&nbsp;from which managed beans can be obtained.
 309   
      * 
 310   
      * @since 3.1
 311   
      */
 312   
 
 313   
     public IBeanProvider getBeans();
 314   
 
 315   
     /**
 316   
      * Returns a {@link ListenerMap}for the component. The map contains a number of synthetic
 317   
      * read-only properties that implement the {@link IActionListener}&nbsp;interface, but in fact,
 318   
      * cause public instance methods to be invoked.
 319   
      * 
 320   
      * @since 3.1
 321   
      */
 322   
 
 323   
     public ListenerMap getListeners();
 324   
 }