JClass DesktopViews 6.3.0 API
Documentation

com.klg.jclass.cell
Class EditorRendererRegistry

java.lang.Object
  |
  +--com.klg.jclass.cell.EditorRendererRegistry

public class EditorRendererRegistry
extends Object

This is the central editor renderer registry for JClass containers like HiGrid and LiveTable. Both HiGrid and LiveTable use a single instance of the registry to get default editor and renderer types based on data types. The EditorRendererRegistry is somewhat under the covers in JClass. In single container instances or simple applications, you don't have to worry about it - use the container (ie LiveTable or HiGrid) API to control type-to-editor and type-to-renderer mappings. However, if you have multiple LiveTable and HiGrid instances, and you want to control default type mappings, or if you want to add your own default mappings, then use this class.

See Also:
HiGrid, JCTable

Nested Class Summary
protected  class EditorRendererRegistry.ClassCells
          Inner class used to store Cell objects
 
Field Summary
protected static com.klg.jclass.cell.EditorRendererRegistry centralRegistry
          The central registry instance
protected  Hashtable classCellsTable
           
protected  boolean isCentralRegistry
          Flag indicating whether this is the central registry.
protected  com.klg.jclass.cell.EditorRendererRegistry parentRegistry
          Pointer to parent registry.
 
Constructor Summary
EditorRendererRegistry(com.klg.jclass.cell.EditorRendererRegistry parentRegistry)
          Creates a new registry as a child of the provided registry.
 
Method Summary
 boolean addClass(Class cellClass, String type, Class editor, Class renderer)
          Adds a type-to-editor/renderer mapping to the registry.
 boolean addClass(Class cellClass, String type, com.klg.jclass.cell.JCCellEditor editor, com.klg.jclass.cell.JCCellRenderer renderer)
          Adds a type-to-editor/renderer mapping to the registry.
 boolean addClass(String cellClass, String type, String editor, String renderer)
          Adds a type-to-editor/renderer mapping to the registry.
protected  EditorRendererRegistry.ClassCells findClass(Class cellClass)
          Look for the class in the table.
 com.klg.jclass.cell.JCCellEditor getCellEditorInstance(Class cellClass, String type)
          Given a data type and a modifier, retrieve an editor.
 com.klg.jclass.cell.JCCellEditor getCellEditorInstance(Class cellClass, String type, boolean useCache)
          Given a data type and a modifier, retrieve an editor.
 com.klg.jclass.cell.JCCellEditor getCellEditorInstance(String classString, String type)
          Given a data type and a modifier, retrieve an editor.
 String getCellEditorString(Class cellClass, String type)
          Given a data type and a modifier, gets the name of the associated cell editor
 String getCellEditorString(String classString, String type)
          Given a data type and a modifier, gets the name of the associated cell editor.
 com.klg.jclass.cell.JCCellRenderer getCellRendererInstance(Class cellClass, String type)
          Given a data type and a modifier, retrieve a renderer.
 com.klg.jclass.cell.JCCellRenderer getCellRendererInstance(Class cellClass, String type, boolean useCache)
          Given a data type and a modifier, retrieve a renderer.
 com.klg.jclass.cell.JCCellRenderer getCellRendererInstance(String classString, String type)
          Given a data type and a modifier, retrieve a renderer.
 String getCellRendererString(Class cellClass, String type)
          Given a data type and a modifier, gets the name of the associated cell renderer
 String getCellRendererString(String classString, String type)
          Given a data type and a modifier, gets the name of the associated cell renderer
static com.klg.jclass.cell.EditorRendererRegistry getCentralRegistry()
          Retrieves the central registry for use.
protected  void initDefaultTable()
          Initializes the default mappings.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

centralRegistry

protected static com.klg.jclass.cell.EditorRendererRegistry centralRegistry
The central registry instance


parentRegistry

protected com.klg.jclass.cell.EditorRendererRegistry parentRegistry
Pointer to parent registry. Allows registry chaining.


isCentralRegistry

protected boolean isCentralRegistry
Flag indicating whether this is the central registry.


classCellsTable

protected Hashtable classCellsTable
Constructor Detail

EditorRendererRegistry

public EditorRendererRegistry(com.klg.jclass.cell.EditorRendererRegistry parentRegistry)
Creates a new registry as a child of the provided registry.

Parameters:
parentRegistry - parent registry to use for additional mappings. Can be null.
Method Detail

getCentralRegistry

public static com.klg.jclass.cell.EditorRendererRegistry getCentralRegistry()
Retrieves the central registry for use. This is the registry used by default in HiGrid and LiveTable.

Returns:
The central registry

initDefaultTable

protected void initDefaultTable()
Initializes the default mappings. Override this method if you want to create your own special mappings by default.


addClass

public boolean addClass(Class cellClass,
                        String type,
                        com.klg.jclass.cell.JCCellEditor editor,
                        com.klg.jclass.cell.JCCellRenderer renderer)
Adds a type-to-editor/renderer mapping to the registry.

Parameters:
cellClass - Class instance representing the cell data type.
type - modifier for mapping.
editor - editor instance to use for editing specified cell data type.
renderer - renderer instance to use for rendering cells containing specified data type.
Returns:
Whether the add succeeded

addClass

public boolean addClass(Class cellClass,
                        String type,
                        Class editor,
                        Class renderer)
Adds a type-to-editor/renderer mapping to the registry.

Parameters:
cellClass - Class instance representing the cell data type.
type - modifier for mapping.
editor - editor Class to use for editing specified cell data type.
renderer - renderer Class to use for rendering cells containing specified data type.
Returns:
Whether the add succeeded

addClass

public boolean addClass(String cellClass,
                        String type,
                        String editor,
                        String renderer)
Adds a type-to-editor/renderer mapping to the registry. Uses String instances and Class.forName() to load Class instances.

Parameters:
cellClass - String representing the cell data type.
type - modifier for mapping.
editor - editor class string to use for editing specified cell data type.
renderer - renderer class string to use for rendering cells containing specified data type.
Returns:
Whether the add succeeded

getCellEditorInstance

public com.klg.jclass.cell.JCCellEditor getCellEditorInstance(Class cellClass,
                                                              String type)
Given a data type and a modifier, retrieve an editor.

Parameters:
cellClass - Class instance representing the cell data type.
type - modifier for mapping.
Returns:
cell editor.

getCellEditorInstance

public com.klg.jclass.cell.JCCellEditor getCellEditorInstance(Class cellClass,
                                                              String type,
                                                              boolean useCache)
Given a data type and a modifier, retrieve an editor.

Parameters:
cellClass - Class instance representing the cell data type.
type - modifier for mapping.
useCache -
Returns:
cell editor.

getCellEditorInstance

public com.klg.jclass.cell.JCCellEditor getCellEditorInstance(String classString,
                                                              String type)
Given a data type and a modifier, retrieve an editor.

Parameters:
classString - String representing the cell data type.
type - Modifier for mapping.
Returns:
The cell editor based on the classString and type

getCellRendererInstance

public com.klg.jclass.cell.JCCellRenderer getCellRendererInstance(Class cellClass,
                                                                  String type)
Given a data type and a modifier, retrieve a renderer.

Parameters:
cellClass - Class instance representing the cell data type.
type - Modifier for mapping.
Returns:
The cell renderer based on the cellClass and type

getCellRendererInstance

public com.klg.jclass.cell.JCCellRenderer getCellRendererInstance(Class cellClass,
                                                                  String type,
                                                                  boolean useCache)
Given a data type and a modifier, retrieve a renderer.

Parameters:
cellClass - Class instance representing the cell data type.
type - Modifier for mapping.
useCache -
Returns:
The cell renderer based on the cellClass and type

getCellRendererInstance

public com.klg.jclass.cell.JCCellRenderer getCellRendererInstance(String classString,
                                                                  String type)
Given a data type and a modifier, retrieve a renderer.

Parameters:
classString - String representing the cell data type.
type - Modifier for mapping.
Returns:
The cell renderer based on the classString and type

getCellEditorString

public String getCellEditorString(Class cellClass,
                                  String type)
Given a data type and a modifier, gets the name of the associated cell editor

Parameters:
cellClass - Class instance representing the cell data type.
type - Modifier for mapping.
Returns:
The cell editor name as a string

getCellEditorString

public String getCellEditorString(String classString,
                                  String type)
Given a data type and a modifier, gets the name of the associated cell editor.

Parameters:
classString - String representing the cell data type.
type - Modifier for mapping.
Returns:
The cell editor name as a string

getCellRendererString

public String getCellRendererString(Class cellClass,
                                    String type)
Given a data type and a modifier, gets the name of the associated cell renderer

Parameters:
cellClass - Class instance representing the cell data type.
type - Modifier for mapping.
Returns:
The cell renderer name as a string

getCellRendererString

public String getCellRendererString(String classString,
                                    String type)
Given a data type and a modifier, gets the name of the associated cell renderer

Parameters:
classString - String representing the cell data type.
type - modifier for mapping.
Returns:
The cell renderer name as a string

findClass

protected EditorRendererRegistry.ClassCells findClass(Class cellClass)
Look for the class in the table. If the class cannot be found search for each super class/interface until one is found.

Parameters:
cellClass -
Returns:
The ClassCells object that matches the class

Copyright © 2004 Quest Software Inc..
All rights reserved.