org.mmbase.bridge.jsp.taglib.typehandler
Class AbstractTypeHandler

java.lang.Object
  extended byorg.mmbase.bridge.jsp.taglib.typehandler.AbstractTypeHandler
All Implemented Interfaces:
TypeHandler
Direct Known Subclasses:
BinaryHandler, DateHandler, DefaultTypeHandler, DoubleHandler, DurationHandler, EnumHandler, FloatHandler, IntegerHandler, LongHandler, NodeHandler, StringHandler

public abstract class AbstractTypeHandler
extends Object
implements TypeHandler

Since:
MMBase-1.6
Version:
$Id: AbstractTypeHandler.java,v 1.48 2006/04/27 17:35:59 michiel Exp $
Author:
Gerard van de Looi, Michiel Meeuwissen
Warning: No Java Documentation Available.

Field Summary
protected  EnumHandler eh
           
protected  boolean gotEnumHandler
           
protected  FieldInfoTag tag
           
 
Constructor Summary
AbstractTypeHandler(FieldInfoTag tag)
          Constructor for AbstractTypeHandler.
 
Method Summary
protected  StringBuffer addExtraAttributes(StringBuffer buf)
           
protected  Object cast(Object value, Node node, Field field)
           
 String checkHtmlInput(Node node, Field field, boolean errors)
          Produces a div, containing the error message for the current value, or the empty string if everything ok.
protected  String findString(Field field)
           
protected  String getClasses(Field field)
           
protected  EnumHandler getEnumHandler(Node node, Field field)
           
protected  Object getFieldValue(Field field)
          Returns the field value as specified by the client's post.
protected  Object getFieldValue(Node node, Field field, boolean useDefault)
          Returns the field value to be used in the page.
protected  int getOperator()
          The operator to be used by whereHtmlInput(field, query)
protected  String getSearchValue(String string)
          Converts the value to the actual value to be searched.
 String htmlInput(Node node, Field field, boolean search)
          Produces an form input field for the given Node, and Field.
 void init()
           
protected  boolean interpretEmptyAsNull(Field field)
           
 void paramHtmlInput(ParamHandler handler, Field field)
           
protected  String prefix(String s)
          Puts a prefix before a name.
protected  String prefixError(String s)
           
protected  String prefixID(String s)
          Puts a prefix 'mm_' before an id in form fields.
 boolean useHtmlInput(Node node, Field field)
          returns true if setValue happened.
 String whereHtmlInput(Field field)
           
 Constraint whereHtmlInput(Field field, Query query)
          Adds search constraint to Query object.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

tag

protected FieldInfoTag tag

eh

protected EnumHandler eh

gotEnumHandler

protected boolean gotEnumHandler
Constructor Detail

AbstractTypeHandler

public AbstractTypeHandler(FieldInfoTag tag)
Constructor for AbstractTypeHandler.

Method Detail

init

public void init()
Specified by:
init in interface TypeHandler

getEnumHandler

protected EnumHandler getEnumHandler(Node node,
                                     Field field)
                              throws JspTagException
Throws:
JspTagException

addExtraAttributes

protected StringBuffer addExtraAttributes(StringBuffer buf)
                                   throws JspTagException
Throws:
JspTagException

getClasses

protected String getClasses(Field field)
Since:
MMBase-1.8

htmlInput

public String htmlInput(Node node,
                        Field field,
                        boolean search)
                 throws JspTagException
Description copied from interface: TypeHandler
Produces an form input field for the given Node, and Field.

Specified by:
htmlInput in interface TypeHandler
Parameters:
search - if true, then a search field is produced.
Throws:
JspTagException
See Also:
TypeHandler.htmlInput(Node, Field, boolean)

getFieldValue

protected Object getFieldValue(Field field)
                        throws JspTagException
Returns the field value as specified by the client's post.

Throws:
JspTagException

interpretEmptyAsNull

protected boolean interpretEmptyAsNull(Field field)

cast

protected Object cast(Object value,
                      Node node,
                      Field field)

getFieldValue

protected Object getFieldValue(Node node,
                               Field field,
                               boolean useDefault)
                        throws JspTagException
Returns the field value to be used in the page.

Throws:
JspTagException

checkHtmlInput

public String checkHtmlInput(Node node,
                             Field field,
                             boolean errors)
                      throws JspTagException
Description copied from interface: TypeHandler
Produces a div, containing the error message for the current value, or the empty string if everything ok.

Specified by:
checkHtmlInput in interface TypeHandler
Parameters:
errors - Whether to output the error messages (otherwises only invalidates form)
Throws:
JspTagException

useHtmlInput

public boolean useHtmlInput(Node node,
                            Field field)
                     throws JspTagException
Description copied from interface: TypeHandler
returns true if setValue happened.

Specified by:
useHtmlInput in interface TypeHandler
Throws:
JspTagException
See Also:
TypeHandler.useHtmlInput(Node, Field)

whereHtmlInput

public String whereHtmlInput(Field field)
                      throws JspTagException
Specified by:
whereHtmlInput in interface TypeHandler
Returns:
Piece of SQL. null if no constraint.
Throws:
JspTagException
See Also:
TypeHandler.whereHtmlInput(Field)

getOperator

protected int getOperator()
The operator to be used by whereHtmlInput(field, query)

Since:
MMBase-1.7

getSearchValue

protected String getSearchValue(String string)
Converts the value to the actual value to be searched. (mainly targeted at StringHandler).

Since:
MMBase-1.7

findString

protected final String findString(Field field)
                           throws JspTagException
Throws:
JspTagException
Since:
MMBase-1.7

paramHtmlInput

public void paramHtmlInput(ParamHandler handler,
                           Field field)
                    throws JspTagException
Specified by:
paramHtmlInput in interface TypeHandler
Throws:
JspTagException

whereHtmlInput

public Constraint whereHtmlInput(Field field,
                                 Query query)
                          throws JspTagException
Adds search constraint to Query object.

Specified by:
whereHtmlInput in interface TypeHandler
Returns:
null if nothing to be searched, the constraint if constraint added
Throws:
JspTagException

prefix

protected String prefix(String s)
                 throws JspTagException
Puts a prefix before a name. This is used in htmlInput and useHtmlInput, they need it to get a reasonably unique value for the name attribute of form elements.

Throws:
JspTagException

prefixID

protected String prefixID(String s)
                   throws JspTagException
Puts a prefix 'mm_' before an id in form fields. To be used in ccs etc..

Parameters:
s - Fieldname
Returns:
String with the id, like f.e. 'mm_title'
Throws:
JspTagException

prefixError

protected String prefixError(String s)
                      throws JspTagException
Throws:
JspTagException


MMBase build 1.8.1.20060716