JIDE 3.5.15

com.jidesoft.grid
Class Property

java.lang.Object
  extended by com.jidesoft.grid.AbstractNode
      extended by com.jidesoft.grid.AbstractExpandable
          extended by com.jidesoft.grid.DefaultExpandable
              extended by com.jidesoft.grid.DefaultExpandableRow
                  extended by com.jidesoft.grid.Property
All Implemented Interfaces:
ConverterContextSupport, EditorContextSupport, EditorStyleSupport, Expandable, ExpandableCell, ExpandableRow, Node, Row, Serializable, Comparable<Property>
Direct Known Subclasses:
BeanProperty, DefaultProperty

public abstract class Property
extends DefaultExpandableRow
implements ExpandableCell, ConverterContextSupport, EditorContextSupport, EditorStyleSupport, Comparable<Property>, Serializable

The basic data for each row in PropertyTable. The main function of this class is to be able to get/set value from/to somewhere. It is an abstract class. Users need to implement several methods such as getValue, setValue and hasValue.

See Also:
Serialized Form

Field Summary
protected  String _category
          The category of the property.
protected  ObjectConverter _converter
           
protected  ConverterContext _converterContext
          The context of the converter.
protected  String _description
          The description of the property.
protected  String _displayName
          The display name of the property.
protected  boolean _editable
          true if the property is editable.
protected  EditorContext _editorContext
          The context of the editor.
protected  boolean _expert
          The "expert" flag is used to distinguish between properties that are intended for expert users from those that are intended for normal users.
protected  String _focusDisplayName
          The focus display name of the property.
protected  boolean _hidden
          The "hidden" flag is used to identify properties that are intended only for tool use, and which should not be exposed to humans.
protected  boolean _indentNonCategoryRow
           
protected  boolean _isCategoryRow
          true if the cell is a category row.
protected  String _name
          The name of the property.
protected  boolean _preferred
          The "preferred" flag is used to identify properties that are particularly important for presenting to humans.
protected  boolean _required
          The "required" flag is used to identify properties that are particularly important for presenting to humans.
protected  Class<?> _type
          The type of the property.
static String PROPERTY_CATEGORY
           
static String PROPERTY_CONVERTER_CONTEXT
           
static String PROPERTY_DEPENDING_PROPERTIES
           
static String PROPERTY_DESCRIPTION
           
static String PROPERTY_DISPLAY_NAME
           
static String PROPERTY_EDITABLE
           
static String PROPERTY_EDITOR_CONTEXT
           
static String PROPERTY_EXPERT
           
static String PROPERTY_FOCUS_DISPLAY_NAME
           
static String PROPERTY_HIDDEN
           
static String PROPERTY_NAME
           
static String PROPERTY_PREFERRED
           
static String PROPERTY_REQUIRED
           
static String PROPERTY_TYPE
           
static String PROPERTY_VALUE
           
 
Fields inherited from class com.jidesoft.grid.DefaultExpandable
_children, EMPTY_ENUMERATION, PROPERTY_CHILDREN
 
Fields inherited from class com.jidesoft.grid.AbstractExpandable
_expandable, _expanded
 
Fields inherited from class com.jidesoft.grid.AbstractNode
_parent, PROPERTY_PARENT
 
Fields inherited from interface com.jidesoft.grid.Expandable
PROPERTY_EXPANDABLE, PROPERTY_EXPANDED
 
Fields inherited from interface com.jidesoft.grid.Node
PROPERTY_ADJUSTING
 
Constructor Summary
protected Property()
           
  Property(String name)
          Creates a property just using name.
  Property(String name, String description)
          Creates a property if you don't need to specify child properties, converter context, category and type.
  Property(String name, String description, Class<?> type)
          Creates a property if you don't need to specify child properties, converter context and category.
  Property(String name, String description, Class<?> type, String category)
          Creates a property if you don't need to specify child properties and converter context.
  Property(String name, String description, Class<?> type, String category, ConverterContext context)
          Creates a property if you don't need to specify child properties.
  Property(String name, String description, Class<?> type, String category, ConverterContext context, List<Property> childProperties)
          Creates a Property.
 
Method Summary
 boolean addDependingProperty(String name)
          Adds a property specified by name as depending property.
 boolean addDependingProperty(String[] names)
          Adds several properties specified by names array as depending properties.
 void clearDependingProperties()
          Removes all depending properties.
 int compareTo(Property property)
           
 String getCategory()
          Gets the category of the property.
 CellEditor getCellEditor()
          Gets the cell editor for this property.
 CellEditor getCellEditor(int column)
          Gets the cell editor for this property.
 ConverterContext getConverterContext()
          Gets the converter context.
 List<String> getDependingProperties()
          Gets the names of all depending properties.
 String getDescription()
          Gets the description of the property.
 String getDisplayName()
          Gets the display name of the property.
 EditorContext getEditorContext()
          Gets the editor context.
 int getEditorStyle()
          Gets editor style for the property.
 String getFocusDisplayName()
          Gets the focus display name of the property.
 String getFullName()
          Gets the full name of the property.
 int getLevel()
          Gets the level of the property.
 String getName()
          Gets the name of the property.
 TableCellRenderer getTableCellRenderer()
          Gets the cell renderer for this property.
 TableCellRenderer getTableCellRenderer(int column)
          Gets the cell renderer for this property.
 Class<?> getType()
          Gets the type of the property.
abstract  Object getValue()
          Gets the value from the property.
 Object getValueAt(int columnIndex)
          Gets the value for cell at columnIndex
 boolean hasValue()
          Checks if the property has value.
 boolean isCategoryRow()
          If the property is a category row.
 boolean isEditable()
          If the property is editable.
 boolean isEditorStyleSupported(int editorStyle)
          Checks if the editor style is supported by the cell editor.
 boolean isExpert()
          The "expert" flag is used to distinguish between those properties that are intended for expert users from those that are intended for normal users.
 boolean isHidden()
          The "hidden" flag is used to identify properties that are intended only for tool use, and which should not be exposed to humans.
 boolean isIndentNonCategoryRow()
          Checks if the non-category row should indent.
 boolean isPreferred()
          The "preferred" flag is used to identify properties that are particularly important for presenting to humans.
 boolean isRequired()
          The "required" flag is used to identify properties that are required to fill in.
 boolean removeDependingProperty(String name)
          Removes the property specified by name from depending property.
 void setCategory(String category)
          Sets the category of the property.
 void setCategoryRow(boolean categoryRow)
          Sets the property as category row.
 void setCellEditor(CellEditor cellEditor)
          Sets the cell editor for this property.
 void setConverterContext(ConverterContext converterContext)
          Sets the converter context.
 void setDescription(String description)
          Sets the description of the property.
 void setDisplayName(String displayName)
          Sets the display name of the property.
 void setEditable(boolean editable)
          Sets if the property is editable.
 void setEditorContext(EditorContext editorContext)
          Sets the editor context.
 void setEditorStyle(int editorStyle)
          Sets the editor style to the cell editor.
 void setExpert(boolean expert)
          The "expert" flag is used to distinguish between properties that are intended for expert users from those that are intended for normal users.
 void setFocusDisplayName(String focusDisplayName)
          Sets the focus display name of the property.
 void setHidden(boolean hidden)
          The "hidden" flag is used to identify properties that are intended only for tool use, and which should not be exposed to humans.
 void setIndentNonCategoryRow(boolean indent)
          Sets if first level non-category row indent from category row.
 void setName(String name)
          Sets the name of the property.
 void setPreferred(boolean preferred)
          The "preferred" flag is used to identify properties that are particularly important for presenting to humans.
 void setRequired(boolean required)
          The "required" flag is used to identify properties that are required to fill in.
 void setTableCellRenderer(TableCellRenderer tableCellRenderer)
          Sets the cell renderer for this property.
 void setType(Class<?> type)
          Sets the type of the property.
abstract  void setValue(Object value)
          Sets the value of the property.
 
Methods inherited from class com.jidesoft.grid.DefaultExpandableRow
cellUpdated, getCellClassAt, getConverterContextAt, getEditorContextAt, isCellEditable, notifyCellUpdated, rowUpdated, setValueAt
 
Methods inherited from class com.jidesoft.grid.DefaultExpandable
breadthFirstEnumeration, depthFirstEnumeration, getChildren, postorderEnumeration, preorderEnumeration, setChildren
 
Methods inherited from class com.jidesoft.grid.AbstractExpandable
addChild, addChild, addChildren, getAllChildrenCount, getAllVisibleChildrenCount, getChildAt, getChildIndex, getChildrenCount, getNumberOfVisibleChildren, getNumberOfVisibleExpandable, getTreeTableModel, hasChildren, hasVisibleChildren, isAdjusting, isExpandable, isExpanded, moveDownChild, moveUpChild, notifyChildDeleted, notifyChildInserted, notifyChildrenDeleted, notifyChildrenInserted, notifyChildrenUpdated, notifyChildUpdated, removeAllChildren, removeChild, removeChildren, setAdjusting, setExpandable, setExpanded
 
Methods inherited from class com.jidesoft.grid.AbstractNode
addPropertyChangeListener, addPropertyChangeListener, firePropertyChange, firePropertyChange, firePropertyChange, getNextSibling, getParent, getPreviousSibling, getPropertyChangeListeners, getPropertyChangeListeners, removePropertyChangeListener, removePropertyChangeListener, setParent
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface com.jidesoft.grid.Expandable
addChild, addChild, addChildren, getAllVisibleChildrenCount, getChildAt, getChildIndex, getChildren, getChildrenCount, getNumberOfVisibleExpandable, hasChildren, isExpandable, isExpanded, moveDownChild, moveUpChild, notifyChildDeleted, notifyChildInserted, notifyChildrenDeleted, notifyChildrenInserted, notifyChildrenUpdated, notifyChildUpdated, removeAllChildren, removeChild, removeChildren, setChildren, setExpandable, setExpanded
 
Methods inherited from interface com.jidesoft.grid.Node
getNextSibling, getParent, getPreviousSibling, setParent
 

Field Detail

_name

protected String _name
The name of the property. The name should be unique within the same property grid.


_displayName

protected String _displayName
The display name of the property.


_focusDisplayName

protected String _focusDisplayName
The focus display name of the property.


_description

protected String _description
The description of the property.


_type

protected Class<?> _type
The type of the property.


_converterContext

protected ConverterContext _converterContext
The context of the converter.


_editorContext

protected EditorContext _editorContext
The context of the editor.


_category

protected String _category
The category of the property.


_isCategoryRow

protected boolean _isCategoryRow
true if the cell is a category row.


_expert

protected boolean _expert
The "expert" flag is used to distinguish between properties that are intended for expert users from those that are intended for normal users.


_hidden

protected boolean _hidden
The "hidden" flag is used to identify properties that are intended only for tool use, and which should not be exposed to humans.


_preferred

protected boolean _preferred
The "preferred" flag is used to identify properties that are particularly important for presenting to humans.


_required

protected boolean _required
The "required" flag is used to identify properties that are particularly important for presenting to humans.


_editable

protected boolean _editable
true if the property is editable.


_converter

protected ObjectConverter _converter

PROPERTY_NAME

public static final String PROPERTY_NAME
See Also:
Constant Field Values

PROPERTY_DISPLAY_NAME

public static final String PROPERTY_DISPLAY_NAME
See Also:
Constant Field Values

PROPERTY_FOCUS_DISPLAY_NAME

public static final String PROPERTY_FOCUS_DISPLAY_NAME
See Also:
Constant Field Values

PROPERTY_VALUE

public static final String PROPERTY_VALUE
See Also:
Constant Field Values

PROPERTY_TYPE

public static final String PROPERTY_TYPE
See Also:
Constant Field Values

PROPERTY_DESCRIPTION

public static final String PROPERTY_DESCRIPTION
See Also:
Constant Field Values

PROPERTY_DEPENDING_PROPERTIES

public static final String PROPERTY_DEPENDING_PROPERTIES
See Also:
Constant Field Values

PROPERTY_CATEGORY

public static final String PROPERTY_CATEGORY
See Also:
Constant Field Values

PROPERTY_CONVERTER_CONTEXT

public static final String PROPERTY_CONVERTER_CONTEXT
See Also:
Constant Field Values

PROPERTY_EDITOR_CONTEXT

public static final String PROPERTY_EDITOR_CONTEXT
See Also:
Constant Field Values

PROPERTY_EDITABLE

public static final String PROPERTY_EDITABLE
See Also:
Constant Field Values

PROPERTY_EXPERT

public static final String PROPERTY_EXPERT
See Also:
Constant Field Values

PROPERTY_HIDDEN

public static final String PROPERTY_HIDDEN
See Also:
Constant Field Values

PROPERTY_PREFERRED

public static final String PROPERTY_PREFERRED
See Also:
Constant Field Values

PROPERTY_REQUIRED

public static final String PROPERTY_REQUIRED
See Also:
Constant Field Values

_indentNonCategoryRow

protected boolean _indentNonCategoryRow
Constructor Detail

Property

public Property(String name,
                String description,
                Class<?> type,
                String category,
                ConverterContext context,
                List<Property> childProperties)
Creates a Property.

Parameters:
name - name of the property
description - description of the property
type - type of the property
category - which category this property belongs to
context - converter context used by this property
childProperties - child properties of this property

Property

public Property(String name,
                String description,
                Class<?> type,
                String category,
                ConverterContext context)
Creates a property if you don't need to specify child properties.

Parameters:
name - name of the property
description - description of the property
type - type of the property
category - which category this property belongs to
context - converter context used by this property

Property

public Property(String name,
                String description,
                Class<?> type,
                String category)
Creates a property if you don't need to specify child properties and converter context.

Parameters:
name - name of the property
description - description of the property
type - type of the property
category - which category this property belongs to

Property

public Property(String name,
                String description,
                Class<?> type)
Creates a property if you don't need to specify child properties, converter context and category.

Parameters:
name - name of the property
description - description of the property
type - type of the property

Property

public Property(String name,
                String description)
Creates a property if you don't need to specify child properties, converter context, category and type.

Parameters:
name - name of the property
description - description of the property

Property

public Property(String name)
Creates a property just using name. Empty string will be the description.

Parameters:
name - name of the property

Property

protected Property()
Method Detail

setValue

public abstract void setValue(Object value)
Sets the value of the property. The method should call firePropertyChange(PROPERTY_VALUE, oldValue, newValue).

Parameters:
value - the new value

getValue

public abstract Object getValue()
Gets the value from the property.

Returns:
the value.

hasValue

public boolean hasValue()
Checks if the property has value.

Returns:
if the property has value.

getName

public String getName()
Gets the name of the property.

Returns:
the name of the property

setName

public void setName(String name)
Sets the name of the property.

Parameters:
name - the new name of the property

getDisplayName

public String getDisplayName()
Gets the display name of the property. If display name is never set before, name will be used as display name.

Returns:
the display name of the property

setDisplayName

public void setDisplayName(String displayName)
Sets the display name of the property.

Parameters:
displayName - the display name of the property.

getFocusDisplayName

public String getFocusDisplayName()
Gets the focus display name of the property. If focus display name is never set before, name will be used as focus display name.

Returns:
the focus display name of the property
See Also:
setFocusDisplayName(String)

setFocusDisplayName

public void setFocusDisplayName(String focusDisplayName)
Sets the focus display name of the property.

Parameters:
focusDisplayName - the focus display name of the property.

getDescription

public String getDescription()
Gets the description of the property.

Returns:
the description of the property

setDescription

public void setDescription(String description)
Sets the description of the property.

Parameters:
description - the description of the property

getType

public Class<?> getType()
Gets the type of the property.

Specified by:
getType in interface ConverterContextSupport
Returns:
the type of the property

setType

public void setType(Class<?> type)
Sets the type of the property.

Specified by:
setType in interface ConverterContextSupport
Parameters:
type - the type of the property

getCategory

public String getCategory()
Gets the category of the property.

Returns:
the category of the property

setCategory

public void setCategory(String category)
Sets the category of the property.

Parameters:
category - the category of the property

getFullName

public String getFullName()
Gets the full name of the property. The getName() will return you the short name. Since the several property can form a hierarchy so the full name will keep start from its top level parent and concat all the names together into a "." separated string which as the full name of a property.
If the property doesn't have any parent, the full name equals the name.

Returns:
the full name of the property

isEditable

public boolean isEditable()
If the property is editable.

Returns:
if the property is editable

setEditable

public void setEditable(boolean editable)
Sets if the property is editable.

Parameters:
editable - if the property is editable

isCategoryRow

public boolean isCategoryRow()
If the property is a category row. Category row is different from normal row as it likes a header row for all its child properties and shown as gray color.

Returns:
if the row is category

setCategoryRow

public void setCategoryRow(boolean categoryRow)
Sets the property as category row.

Parameters:
categoryRow - true or false.

getLevel

public int getLevel()
Gets the level of the property. If it's category row, it always returns 0. If not, property with no parent is level 0 and all its children has level 1, etc.

Specified by:
getLevel in interface Node
Overrides:
getLevel in class AbstractNode
Returns:
the level

getConverterContext

public ConverterContext getConverterContext()
Gets the converter context.

Specified by:
getConverterContext in interface ConverterContextSupport
Returns:
the converter context

setConverterContext

public void setConverterContext(ConverterContext converterContext)
Sets the converter context.

Specified by:
setConverterContext in interface ConverterContextSupport
Parameters:
converterContext - the converter context

getEditorContext

public EditorContext getEditorContext()
Gets the editor context.

Specified by:
getEditorContext in interface EditorContextSupport
Returns:
the editor context

setEditorContext

public void setEditorContext(EditorContext editorContext)
Sets the editor context.

Specified by:
setEditorContext in interface EditorContextSupport
Parameters:
editorContext - the editor context

getCellEditor

public CellEditor getCellEditor()
Gets the cell editor for this property.

It will return the cell editor you set by setCellEditor(javax.swing.CellEditor). By default, it's null.

Since 2.10.4, this method could return null which is not the case before and include 2.10.3.

Returns:
the cell editor associate with this property.

setCellEditor

public void setCellEditor(CellEditor cellEditor)
Sets the cell editor for this property.

Parameters:
cellEditor - the cell editor

getCellEditor

public CellEditor getCellEditor(int column)
Gets the cell editor for this property. By default, the cell editor registered in CellEditorMangaer will be used. User can override this method to have their own cell editor. For column 0, it will always return null.

Parameters:
column - the column index as in the table model.
Returns:
the cell editor associate with this property.

getTableCellRenderer

public TableCellRenderer getTableCellRenderer()
Gets the cell renderer for this property.

It will return the cell renderer you set by setTableCellRenderer(javax.swing.table.TableCellRenderer). By default, it's null.

Since 2.10.4, this method could return null which is not the case before and include 2.10.3.

Returns:
the cell renderer associate with this property.

setTableCellRenderer

public void setTableCellRenderer(TableCellRenderer tableCellRenderer)
Sets the cell renderer for this property.

Parameters:
tableCellRenderer - the cell renderer

getTableCellRenderer

public TableCellRenderer getTableCellRenderer(int column)
Gets the cell renderer for this property. By default, the cell renderer registered in CellRendererMangaer will be used. User can override this method to have their own cell renderer.

Parameters:
column - the column index as in the table model
Returns:
the cell editor associate with this property.

getDependingProperties

public List<String> getDependingProperties()
Gets the names of all depending properties. Depending properties are the properties whose value depending on this property. in the case of PropertyTable, if property Foo depends on property Bar, it means when Bar value changes, Foo will be recalculated.

Returns:
the list containing the names of all depending properties.

addDependingProperty

public boolean addDependingProperty(String name)
Adds a property specified by name as depending property.

Parameters:
name - the name of the property.
Returns:
always true

addDependingProperty

public boolean addDependingProperty(String[] names)
Adds several properties specified by names array as depending properties.

Parameters:
names - the names of all the properties.
Returns:
always true.

removeDependingProperty

public boolean removeDependingProperty(String name)
Removes the property specified by name from depending property.

Parameters:
name - the name of the property.
Returns:
true if it is removed successfully. Otherwise false.

clearDependingProperties

public void clearDependingProperties()
Removes all depending properties.


compareTo

public int compareTo(Property property)
Specified by:
compareTo in interface Comparable<Property>

isExpert

public boolean isExpert()
The "expert" flag is used to distinguish between those properties that are intended for expert users from those that are intended for normal users.

Returns:
True if this property is intended for use by experts only.

setExpert

public void setExpert(boolean expert)
The "expert" flag is used to distinguish between properties that are intended for expert users from those that are intended for normal users.

Parameters:
expert - True if this property is intended for use by experts only.

isHidden

public boolean isHidden()
The "hidden" flag is used to identify properties that are intended only for tool use, and which should not be exposed to humans.

Returns:
True if this property should be hidden from human users.

setHidden

public void setHidden(boolean hidden)
The "hidden" flag is used to identify properties that are intended only for tool use, and which should not be exposed to humans.

Parameters:
hidden - True if this property should be hidden from human users.

isPreferred

public boolean isPreferred()
The "preferred" flag is used to identify properties that are particularly important for presenting to humans.

Returns:
True if this property should be preferentially shown to human users.

setPreferred

public void setPreferred(boolean preferred)
The "preferred" flag is used to identify properties that are particularly important for presenting to humans.

Parameters:
preferred - True if this property should be preferentially shown to human users.

isRequired

public boolean isRequired()
The "required" flag is used to identify properties that are required to fill in.

Returns:
True if this property is required to fill in.
Since:
3.3.3

setRequired

public void setRequired(boolean required)
The "required" flag is used to identify properties that are required to fill in.

Parameters:
required - True if this property is required to fill in.
Since:
3.3.3

isIndentNonCategoryRow

public boolean isIndentNonCategoryRow()
Checks if the non-category row should indent. By default there is no indent of first level non-category row.

Returns:
true if non category row should indent.

setIndentNonCategoryRow

public void setIndentNonCategoryRow(boolean indent)
Sets if first level non-category row indent from category row. By default the first level non-category row has the same indent as category row. We do this because we want to save the space.

Parameters:
indent - true or false.

getValueAt

public Object getValueAt(int columnIndex)
Description copied from interface: Row
Gets the value for cell at columnIndex

Specified by:
getValueAt in interface Row
Parameters:
columnIndex - the column whose value to be queried
Returns:
the value at the specified cell.

isEditorStyleSupported

public boolean isEditorStyleSupported(int editorStyle)
Description copied from interface: EditorStyleSupport
Checks if the editor style is supported by the cell editor.

Specified by:
isEditorStyleSupported in interface EditorStyleSupport
Parameters:
editorStyle - the editor style
Returns:
true if it is supported. Otherwise false.

setEditorStyle

public void setEditorStyle(int editorStyle)
Description copied from interface: EditorStyleSupport
Sets the editor style to the cell editor.

Specified by:
setEditorStyle in interface EditorStyleSupport
Parameters:
editorStyle - the editor style

getEditorStyle

public int getEditorStyle()
Gets editor style for the property.

Returns:
the editor style.

JIDE 3.5.15