borland Packages Class Hierarchy jbcl.view Package Index
java.util.EventListener +----borland.jbcl.view.CustomItemListener
MethodsAn implementor of the CustomItemListener interface listens to a view manager receive requests for item painters and item editors.
When a request is made, an event is fired to allow a listener (an implementor of this interface) to customize the properties of the ItemPaintSite using the CustomPaintSite interface. The listener has access to all contextual information in the event call, including address, data, and state information. The listener can analyze any of this information (or none of it) to determine what custom changes to make to the CustomPaintSite.
These events are commonly used, for example, to make all negative numbers apear red on a JBCL component such as a grid, and to make even numbered rows to have a gray background. The following is an example event handler that shows how to do this:
public void customizeItem(Object address, Object data, int state, CustomPaintSite) ( //make the foreground red if the data is numeric and negative if (data instanceof Number) ( int value = ((Number)data).intValue(); if (value < 0) site.setForeground(Color.red); ) // make all even numbered rows have a light gray background if (address instanceof MatrixLocation) ( int row = ((MatrixLocation)address).row; if (row % 2 == 0) site.setBackground(Color.lightGray); ) )
public void customizeItem(java.lang.Object address, java.lang.Object data, int state, borland.jbcl.model.CustomPaintSite site)This event is triggered when a view manager is asked for an item painter to paint an item within a component, or when it is asked for an item editor to edit a component A listener can set the properties of the CustomPaintSite based on the address, data, state information, or whatever is needed.
Parameters: