Copyright 2002 by aragost

com.aragost.araspect.handlers
Class HandlerFacade

java.lang.Object
  |
  +--com.aragost.araspect.handlers.HandlerFacade

public class HandlerFacade
extends java.lang.Object

A HandlerFacade is a wrapper around a Handler object and thereby a chain of Handlers. All invocations from the Inspector of methods in the Handler chain always goes through the HanderFacade object.


Constructor Summary
HandlerFacade(Inspector inspector, Handler handler)
          Construct a HandlerFacade that wraps the specified Hanlder chain.
 
Method Summary
 Element createEditElement(Path path, PathElement elm, boolean withNull)
          Create an HTML element to change the value of the attribute specified by the parameters.
 Handler getChain()
          Gets the chain.
 MethodContainer getGetters()
          Return the getter methods that should be displayed in the inspector view
 Inspector getInspector()
          Gets the inspector.
 Path getPath()
          Gets the path.
 boolean isEditable()
          Check if it possible for the user to edit a field represented by the receiver.
 boolean needsRecalc(java.lang.Object value)
          If this method returns false (default) then it is assumed that the specified value can be reused, and we don't have to evaluate it everytime the value is needed.
 void setInspector(Inspector inspector)
          Sets the inspector.
 void setPath(Path path)
          Sets the path.
 java.lang.String toString(java.lang.Object value, int limit)
          Return a String representation of the specified object.
 java.lang.String typeName(java.lang.Object value, java.lang.Class clazz)
          Return the name of the specified class.
 void writeHtml(HtmlWriter writer)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

HandlerFacade

public HandlerFacade(Inspector inspector,
                     Handler handler)
Construct a HandlerFacade that wraps the specified Hanlder chain.

Method Detail

toString

public java.lang.String toString(java.lang.Object value,
                                 int limit)
Return a String representation of the specified object. The String returned will not be longer than the limit specified. If the limit is 0 then there is no limit.


getGetters

public MethodContainer getGetters()
Return the getter methods that should be displayed in the inspector view

Returns:
a MethodContainer with the methods

typeName

public java.lang.String typeName(java.lang.Object value,
                                 java.lang.Class clazz)
Return the name of the specified class. If value is not null it must be an instance of the specified clazz. The value is use for some types to give more information, e.g. Collection size or String sizes.


needsRecalc

public boolean needsRecalc(java.lang.Object value)
If this method returns false (default) then it is assumed that the specified value can be reused, and we don't have to evaluate it everytime the value is needed. E.g. for Iterators we have to reevaluate, because we need to start iterating at the beginning each time.


isEditable

public boolean isEditable()
Check if it possible for the user to edit a field represented by the receiver.


createEditElement

public Element createEditElement(Path path,
                                 PathElement elm,
                                 boolean withNull)
Create an HTML element to change the value of the attribute specified by the parameters.

Parameters:
path - Path of containing object
elm - The PathElement identifying the attribute we are editing
withNull - Should it be possible to set the value to null?
Returns:
Element The element to edit the attribute

writeHtml

public void writeHtml(HtmlWriter writer)

getPath

public Path getPath()
Gets the path.

Returns:
Returns a Path

setPath

public void setPath(Path path)
Sets the path.

Parameters:
path - The path to set

getChain

public Handler getChain()
Gets the chain.

Returns:
Returns a Handler

getInspector

public Inspector getInspector()
Gets the inspector.

Returns:
Returns a Inspector

setInspector

public void setInspector(Inspector inspector)
Sets the inspector.

Parameters:
inspector - The inspector to set

Copyright 2002 by aragost