com.arsdigita.cms.ui.util
Class DefaultTableCellRenderer

java.lang.Object
  extended bycom.arsdigita.util.LockableImpl
      extended bycom.arsdigita.cms.ui.util.DefaultTableCellRenderer
All Implemented Interfaces:
com.arsdigita.util.Lockable, com.arsdigita.bebop.table.TableCellRenderer

public class DefaultTableCellRenderer
extends com.arsdigita.util.LockableImpl
implements com.arsdigita.bebop.table.TableCellRenderer

The default renderer for table cells. This renderer is used by the Table component for rendering the table headers and cells if no other renderer is specified.

This renderer can operate in two different modes: active and inactive mode. In inactive mode, all objects are rendered by converting them to a string and enclosing that string in a Label. If the renderer is in active mode, this label is further enclosed in a control link. When the user clicks on this link, the table will fire an TableActionEvent whose getKey() and getColumn() method return the values of the key and column parameters that were passed into getComponent.

In a nutshell, an active renderer will let the user click a link that causes a TableActionEvent for the corresponding cell, while an inactive renderer will display the values just as strings, thus making it impossible for the user to cause such an event.

Version:
$Id: //cms/dev/src/com/arsdigita/cms/ui/util/DefaultTableCellRenderer.java#8 $
Author:
David Lutterkort, Michael Pih (pihman@arsdigita.com)
See Also:
Table, TableActionEvent

Field Summary
 
Fields inherited from interface com.arsdigita.bebop.table.TableCellRenderer
versionId
 
Fields inherited from interface com.arsdigita.util.Lockable
versionId
 
Constructor Summary
DefaultTableCellRenderer()
          Creates a new table cell renderer.
DefaultTableCellRenderer(boolean active)
          Creates a new table cell renderer.
 
Method Summary
 com.arsdigita.bebop.Component getComponent(com.arsdigita.bebop.Table table, com.arsdigita.bebop.PageState state, Object value, boolean isSelected, Object key, int row, int column)
          Return the component that should be used to render the given value.
 boolean isActive()
          Return true if the renderer is in active mode.
 void setActive(boolean v)
          Set the renderer to active or inactive mode.
 
Methods inherited from class com.arsdigita.util.LockableImpl
isLocked, lock
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DefaultTableCellRenderer

public DefaultTableCellRenderer()
Creates a new table cell renderer. The table cell renderer is in inactive mode.


DefaultTableCellRenderer

public DefaultTableCellRenderer(boolean active)
Creates a new table cell renderer. The active argument specifies whether the renderer should be active or not.

Parameters:
active - true if the renderer should generate links instead of just static labels.
Method Detail

isActive

public final boolean isActive()
Return true if the renderer is in active mode. A rendererin active mode will enclose the objects it renders in links that, when clicked, will cause the containing table to fire a TableActionEvent.

Returns:
true if the renderer is in active mode.

setActive

public void setActive(boolean v)
Set the renderer to active or inactive mode.

Parameters:
v - true if the renderer should operate in active mode.

getComponent

public com.arsdigita.bebop.Component getComponent(com.arsdigita.bebop.Table table,
                                                  com.arsdigita.bebop.PageState state,
                                                  Object value,
                                                  boolean isSelected,
                                                  Object key,
                                                  int row,
                                                  int column)
Return the component that should be used to render the given value. Returns a Label if the renderer is active, and a ControlLink if the renderer is inactive.

Specified by:
getComponent in interface com.arsdigita.bebop.table.TableCellRenderer


Copyright (c) 2004 Red Hat, Inc. Corporation. All Rights Reserved. Generated at July 21 2004:2352 UTC