Search this API

y.option
Class TableEditorFactory

java.lang.Object
  extended by y.option.TableEditorFactory
All Implemented Interfaces:
EditorFactory

public class TableEditorFactory
extends java.lang.Object
implements EditorFactory

Editor factory that creates editors which represent the parameters managed by a given OptionHandler in a tabular fashion. Sections can be collapsed or expanded to hide or show the contained parameters.

 ---------------------------------
 | - Section Name                |
 ---------------------------------
 |   Parameter Name | Input Mask |
 ---------------------------------
 |   Parameter Name | Input Mask |
 ---------------------------------
 |   ...                         |
 ---------------------------------
 | + Section Name                |
 ---------------------------------
 | - Section Name                |
 ---------------------------------
 |   Parameter Name | Input Mask |
 ---------------------------------
 |   ...                         |
 ---------------------------------
 

 

Nested Class Summary
static class TableEditorFactory.EditorLocation
          Enumeration to specify where external item editors should appear.
static class TableEditorFactory.InfoPosition
          Enumeration to specify the position of the editor's info component.
static interface TableEditorFactory.ItemEditorOwner
          This interface should be implemented by TableCellEditor and TableCellRenderer classes used with the TableEditorFactory that need to know additional information to display the editor value.
static class TableEditorFactory.Theme
          This class can be used to customize the look of editors created by a TableEditorFactory.
 
Field Summary
static java.lang.String ATTRIBUTE_EDITOR_LOCATION
          Attribute key that can be used to specify where external item editors should appear.
static java.lang.String ATTRIBUTE_EDITOR_LOCATION_REFERENCE_COMPONENT
          Attribute key that can be used to specify a reference component for TableEditorFactory.EditorLocation.RELATIVE_TO_REFERENCE_COMPONENT.
static java.lang.String ATTRIBUTE_INFO_POSITION
          Attribute key that can be used to specify the info style of the editor component.
static java.lang.String ATTRIBUTE_STRING_REPRESENTATION
          Attribute key used to store String representations of the option item or value.
static java.lang.String ATTRIBUTE_TABLE_EDITOR
          Attribute key that can be used to store a cell editor to use instead of the cell editor returned by getDefaultEditor(OptionItem).
static java.lang.String ATTRIBUTE_TABLE_RENDERER
          Attribute key that can be used to store a cell renderer to use instead of the cell renderer returned by getDefaultRenderer(OptionItem).
static java.lang.String ATTRIBUTE_THEME
          Attribute key that can be used to specify a color theme for the editor component.
static java.lang.String ATTRIBUTE_USE_ITEM_NAME_AS_TOOLTIP_FALLBACK
          Attribute key that controls whether the name of an OptionItem should be used as its tool tip text if no explicit tip text has been specified.
 
Constructor Summary
TableEditorFactory()
          Creates a new instance of TableEditorFactory.
 
Method Summary
 Editor createEditor(OptionHandler handler)
          Creates an editor for the specified option handler.
 Editor createEditor(OptionHandler handler, java.util.Map overrides)
          Creates an editor for the specified option handler.
static TableEditorFactory.Theme createTheme()
          Creates a new Theme object, which can be used to customize the look of editors created by a TableEditorFactory.
protected  javax.swing.table.TableCellEditor getDefaultEditor(OptionItem item)
          Returns the default editor for the specified OptionItem.
protected  javax.swing.table.TableCellRenderer getDefaultRenderer(OptionItem item)
          Returns the default renderer for the specified OptionItem.
 GuiFactory getGuiFactory()
          Returns the GuiFactory that is used for I18N by this factory.
 ItemEditorFactory getItemFactory()
          Returns the ItemEditorFactory used to create item editors for items that cannot be edited in the table.
 boolean isAutoAdopt()
          Returns whether this factory creates editors in autoAdopt state.
 boolean isAutoCommit()
          Returns whether this factory create editors in autoCommit state.
 void resetEditor(OptionHandler handler, Editor editor)
          Resets the specified editor for use with the specified handler.
 void resetEditor(OptionHandler handler, java.util.Map overrides, Editor editor)
          Resets the specified editor for use with the specified handler.
 void setAutoAdopt(boolean autoAdopt)
          Specifies whether this factory creates editors in autoAdopt state.
 void setAutoCommit(boolean autoCommit)
          Specifies whether this factory creates editors in autoCommit state.
 void setGuiFactory(GuiFactory factory)
          Specifies the GuiFactory used for I18N by this factory.
 void setItemFactory(ItemEditorFactory itemFactory)
          Sets the ItemEditorFactory used to create item editors for items that cannot be edited in the table.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

ATTRIBUTE_INFO_POSITION

public static final java.lang.String ATTRIBUTE_INFO_POSITION
Attribute key that can be used to specify the info style of the editor component. Attribute values have to be of type TableEditorFactory.InfoPosition. This attribute has to be set for an OptionHandler or in the overrides map.


ATTRIBUTE_THEME

public static final java.lang.String ATTRIBUTE_THEME
Attribute key that can be used to specify a color theme for the editor component. Attribute values have to be of type TableEditorFactory.Theme. This attribute has to be set for an OptionHandler or in the overrides map.

See Also:
createTheme()

ATTRIBUTE_TABLE_EDITOR

public static final java.lang.String ATTRIBUTE_TABLE_EDITOR
Attribute key that can be used to store a cell editor to use instead of the cell editor returned by getDefaultEditor(OptionItem). Attribute values have to implement TableCellEditor.


ATTRIBUTE_TABLE_RENDERER

public static final java.lang.String ATTRIBUTE_TABLE_RENDERER
Attribute key that can be used to store a cell renderer to use instead of the cell renderer returned by getDefaultRenderer(OptionItem). Attribute values have to implement TableCellRenderer.


ATTRIBUTE_STRING_REPRESENTATION

public static final java.lang.String ATTRIBUTE_STRING_REPRESENTATION
Attribute key used to store String representations of the option item or value. This representation is displayed when no suitable renderer exists.


ATTRIBUTE_USE_ITEM_NAME_AS_TOOLTIP_FALLBACK

public static final java.lang.String ATTRIBUTE_USE_ITEM_NAME_AS_TOOLTIP_FALLBACK
Attribute key that controls whether the name of an OptionItem should be used as its tool tip text if no explicit tip text has been specified. Attribute values have to be of type Boolean.


ATTRIBUTE_EDITOR_LOCATION

public static final java.lang.String ATTRIBUTE_EDITOR_LOCATION
Attribute key that can be used to specify where external item editors should appear. Attribute values have to be of type TableEditorFactory.EditorLocation. This attribute may be set for an OptionItem, an OptionHandler, or in the overrides map.


ATTRIBUTE_EDITOR_LOCATION_REFERENCE_COMPONENT

public static final java.lang.String ATTRIBUTE_EDITOR_LOCATION_REFERENCE_COMPONENT
Attribute key that can be used to specify a reference component for TableEditorFactory.EditorLocation.RELATIVE_TO_REFERENCE_COMPONENT. Attribute values have to be of type Component. This attribute may be set for an OptionItem, an OptionHandler, or in the overrides map.

Constructor Detail

TableEditorFactory

public TableEditorFactory()
Creates a new instance of TableEditorFactory.

Method Detail

getItemFactory

public ItemEditorFactory getItemFactory()
Returns the ItemEditorFactory used to create item editors for items that cannot be edited in the table.


setItemFactory

public void setItemFactory(ItemEditorFactory itemFactory)
Sets the ItemEditorFactory used to create item editors for items that cannot be edited in the table. Editors created in this way are displayed in an external dialog.

Parameters:
itemFactory - the ItemEditorFactory

resetEditor

public void resetEditor(OptionHandler handler,
                        Editor editor)
Resets the specified editor for use with the specified handler.

Note:
When resetting an Editor, the attribute info style is ignored.

Parameters:
handler - the OptionHandler
editor - the Editor
Throws:
java.lang.IllegalArgumentException - if the specified editor was not created by a TableEditorFactory

resetEditor

public void resetEditor(OptionHandler handler,
                        java.util.Map overrides,
                        Editor editor)
Resets the specified editor for use with the specified handler.

Note:
When resetting an Editor, the attribute info style is ignored.

Parameters:
handler - the OptionHandler
overrides - a Map specifying overrides for the handler attributes
editor - the Editor
Throws:
java.lang.IllegalArgumentException - if the specified editor was not created by a TableEditorFactory

isAutoCommit

public boolean isAutoCommit()
Returns whether this factory create editors in autoCommit state.


setAutoCommit

public void setAutoCommit(boolean autoCommit)
Specifies whether this factory creates editors in autoCommit state.

Parameters:
autoCommit - if true editors created by this factory will be in autoCommit state

isAutoAdopt

public boolean isAutoAdopt()
Returns whether this factory creates editors in autoAdopt state.


setAutoAdopt

public void setAutoAdopt(boolean autoAdopt)
Specifies whether this factory creates editors in autoAdopt state.

Parameters:
autoAdopt - if true editors created by this factory will be in autoAdopt state

createEditor

public Editor createEditor(OptionHandler handler)
Description copied from interface: EditorFactory
Creates an editor for the specified option handler.

Specified by:
createEditor in interface EditorFactory
Parameters:
handler - the OptionHandler
Returns:
an editor for the specified option handler

createEditor

public Editor createEditor(OptionHandler handler,
                           java.util.Map overrides)
Description copied from interface: EditorFactory
Creates an editor for the specified option handler.

Specified by:
createEditor in interface EditorFactory
Parameters:
handler - the OptionHandler
overrides - a Map specifying overrides for the handler attributes
Returns:
an editor for the specified option handler

getDefaultEditor

protected javax.swing.table.TableCellEditor getDefaultEditor(OptionItem item)
Returns the default editor for the specified OptionItem. Returning null implies that the value of the item is not editable. If the attribute "TableEditorFactory.tableEditor" is set, then the default editor returned by this method is ignored and the value of the mentioned attribute is used.

Parameters:
item - the OptionItem
Returns:
a default TableCellEditor used to edit the value of the specified item

getDefaultRenderer

protected javax.swing.table.TableCellRenderer getDefaultRenderer(OptionItem item)
Returns the default renderer for the specified OptionItem. Returning null implies that the display component may choose a renderer. If the attribute "TableEditorFactory.tableRenderer" is set, then the default renderer returned by this method is ignored and the value of the mentioned attribute is used.

Parameters:
item - the OptionItem
Returns:
a default TableCellRenderer used to render the value of the specified item

getGuiFactory

public GuiFactory getGuiFactory()
Description copied from interface: EditorFactory
Returns the GuiFactory that is used for I18N by this factory.

Specified by:
getGuiFactory in interface EditorFactory

setGuiFactory

public void setGuiFactory(GuiFactory factory)
Description copied from interface: EditorFactory
Specifies the GuiFactory used for I18N by this factory.

Specified by:
setGuiFactory in interface EditorFactory

createTheme

public static TableEditorFactory.Theme createTheme()
Creates a new Theme object, which can be used to customize the look of editors created by a TableEditorFactory. For the theme to be used, it has to be set as an OptionHandler attribute when creating or resetting an editor.

See Also:
ATTRIBUTE_THEME

© Copyright 2000-2022,
yWorks GmbH.
All rights reserved.