package com.onaro.sanscreen.client.view.tabular.columns; import javax.swing.table.TableCellRenderer; import com.onaro.util.jfc.tables.filter.Filter; /** * Class used to present a value in a table column. Instances of this class are paired with a * {@link AbstractColumnValueRetriever} instance to provide a decoupled column retrieval and presentation * pattern in the column {@link CompoundColumn}. Instances of this class can also be used in the * {@link ColumnBuilder} class. This class also can specify the renderer and filter used by the CompoundColumn * to properly display and filter the presented values. * * @param type of the values retrieved by the associated retriever * @param

type of the values presented by this presenter * * @see AbstractColumnValueRetriever * @see CompoundColumn * @see ColumnBuilder */ public abstract class AbstractColumnValuePresenter { protected final Class

presentationType; /** * Construct a Presenter that returns objects of the given presentation type from the * method {@link #getPresentation(Object, String)}. * @param presentationType the type of the presentation objects */ public AbstractColumnValuePresenter(Class

presentationType) { if (presentationType == null) throw new IllegalArgumentException("presentationType"); //$NON-NLS-1$ this.presentationType = presentationType; } /** * Get the presentation of the given value. * @param value the value to present (may be null) * @param identifier the identifier of the value (may be null) * @return the presentation object (may be null) */ public abstract P getPresentation(V value, String identifier); /** * Get the type of the objects returned by the presenter. This value * will be used the valueType of the column. * @return the presentation object type */ public final Class

getPresentationType() { return presentationType; } /** * Create a custom renderer for the column using the Presenter. By * default, this method returns null, which indicates that no custom * renderer is necessary for the presentation. Subclasses can override * to specify the custom renderer. * @return the custom renderer to use, or null if no custom renderer is necessary */ public TableCellRenderer createCustomRenderer() { return null; } /** * Create a custom filter for the column using the Presenter. By * default, this method returns null, which indicates that no custom * filter is necessary for the presentation. Subclasses can override * to specify the custom filter. * @return the custom filter to use, or null if no custom filter is necessary */ public Filter createCustomFilter() { return null; } }