3.2.1: 2012-12-13

net.sf.basedb.clients.web.extensions.list
Class PropertyPathActionFactory<I,V>

java.lang.Object
  extended by net.sf.basedb.clients.web.extensions.AbstractJspFactory
      extended by net.sf.basedb.clients.web.extensions.AbstractJspActionFactory<ListColumnAction<I,V>>
          extended by net.sf.basedb.clients.web.extensions.list.PropertyPathActionFactory<I,V>
All Implemented Interfaces:
ActionFactory<ListColumnAction<I,V>>

public class PropertyPathActionFactory<I,V>
extends AbstractJspActionFactory<ListColumnAction<I,V>>

A factory implementation that generates list columns based on a property path as used by the Metadata class. Most properties of the ListColumnAction can be configured by calling setter method for this factory. The ListColumnAction.getProperty() is used as the property path in Metadata.getPropertyPath(String, boolean). By default, the sample property is used for sorting, filtering and exporting, which are enabled by default.

A formatter class can be specified by setFormatterClass(String) if the given class has a public, no-argument constructor. Otherwise a suitable formatter is selected by calling FormatterFactory.getTypeFormatter(SessionControl, Type) with the type taken from ListColumnAction.getValueType().

More advanced usage or formatting requirements need a custom factory implementation.

Since:
3.2
Author:
Nicklas

Nested Class Summary
(package private) static class PropertyPathActionFactory.PropertyPathAction<I,V>
          A concrete implementation of the ListColumnAction interface.
 
Field Summary
private  String clazz
           
private  boolean exportable
           
private  String exportFormatterClass
           
private  String exportProperty
           
private  boolean filterable
           
private  String filterProperty
           
private  String formatterClass
           
private  String id
           
private  String property
           
private  boolean sortable
           
private  String sortProperty
           
private  String style
           
private  String title
           
private  String tooltip
           
private  Type valueType
           
 
Constructor Summary
PropertyPathActionFactory()
           
 
Method Summary
 ListColumnAction<I,V>[] getActions(InvokationContext<? super ListColumnAction<I,V>> context)
          This method may be called one or several times for each request.
protected  Formatter<V> getFormatter(InvokationContext context, String className)
          Create a formatter instance that should be used for the online table.
 void setClazz(String clazz)
           
 void setExportable(String exportable)
           
 void setExportFormatterClass(String formatterClass)
           
 void setExportProperty(String exportProperty)
           
 void setFilterable(String filterable)
           
 void setFilterProperty(String filterProperty)
           
 void setFormatterClass(String formatterClass)
           
 void setId(String id)
           
 void setProperty(String property)
           
 void setSortable(String sortable)
           
 void setSortProperty(String sortProperty)
           
 void setStyle(String style)
           
 void setTitle(String title)
           
 void setTooltip(String tooltip)
           
 void setValueType(String valueType)
           
 
Methods inherited from class net.sf.basedb.clients.web.extensions.AbstractJspActionFactory
prepareContext
 
Methods inherited from class net.sf.basedb.clients.web.extensions.AbstractJspFactory
getScripts, getStylesheets, prepareContext, setScript, setStylesheet
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

id

private String id

clazz

private String clazz

style

private String style

title

private String title

tooltip

private String tooltip

property

private String property

valueType

private Type valueType

sortable

private boolean sortable

sortProperty

private String sortProperty

filterable

private boolean filterable

filterProperty

private String filterProperty

exportable

private boolean exportable

exportProperty

private String exportProperty

formatterClass

private String formatterClass

exportFormatterClass

private String exportFormatterClass
Constructor Detail

PropertyPathActionFactory

public PropertyPathActionFactory()
Method Detail

getActions

public ListColumnAction<I,V>[] getActions(InvokationContext<? super ListColumnAction<I,V>> context)
Description copied from interface: ActionFactory
This method may be called one or several times for each request. This is decided by the extension point. If, for example, the extension point is a pure single-item extension point then this method is probably only called once. If the extension point is a per-item extension point in a list context, then this method may be called once for every item in the list. The context parameter contains all information about the context of the extension point, including the current item, if any.

Parameters:
context - The current invokation context
Returns:
An array of actions that should be added to the extension point. Returns null or an empty array if there are no actions in the current context.

setId

public void setId(String id)

setClazz

public void setClazz(String clazz)

setStyle

public void setStyle(String style)

setTitle

public void setTitle(String title)

setTooltip

public void setTooltip(String tooltip)

setProperty

public void setProperty(String property)

setValueType

public void setValueType(String valueType)

setSortable

public void setSortable(String sortable)

setSortProperty

public void setSortProperty(String sortProperty)

setFilterable

public void setFilterable(String filterable)

setFilterProperty

public void setFilterProperty(String filterProperty)

setExportable

public void setExportable(String exportable)

setExportProperty

public void setExportProperty(String exportProperty)

setFormatterClass

public void setFormatterClass(String formatterClass)

setExportFormatterClass

public void setExportFormatterClass(String formatterClass)

getFormatter

protected Formatter<V> getFormatter(InvokationContext context,
                                    String className)
Create a formatter instance that should be used for the online table. If a className is specified try to load an instance of that class, otherwise use FormatterFactory.getTypeFormatter(SessionControl, Type) with the value type from setValueType(String).


3.2.1: 2012-12-13