net.sf.click.control
Interface Decorator


public interface Decorator

Provides a decorator interface for delegating object rendering.

Decorator Example

The following example illustrates how to render a email hyperlink in a email table column.
 Column column = new Column("email");

 column.setDecorator(new Decorator() {
     public String render(Object row, Context context) {
         Customer customer = (Customer) row;
         String email = customer.getEmail();
         String fullName = customer.getFullName();
         return "<a href='mailto:" + email + "'>" + fullName + "</a>";
     }
 });

 table.addColumn(column); 

Author:
Malcolm Edgar
See Also:
Column, Table

Method Summary
 String render(Object object, Context context)
          Returns a decorated string representation of the given object.
 

Method Detail

render

public String render(Object object,
                     Context context)
Returns a decorated string representation of the given object.

Parameters:
object - the object to render
context - the request context
Returns:
a decorated string representation of the given object