JIDE 3.5.15

com.jidesoft.grid
Class PropertyTableModel<T extends Property>

java.lang.Object
  extended by javax.swing.table.AbstractTableModel
      extended by com.jidesoft.grid.TreeTableModel<T>
          extended by com.jidesoft.grid.PropertyTableModel<T>
All Implemented Interfaces:
CategorizedTableModel, ContextSensitiveTableModel, EditorStyleTableModel, IndexChangeEventGenerator, ITreeTableModel<T>, MultiTableModel, SpanModel, PropertyChangeListener, Serializable, EventListener, TableModel
Direct Known Subclasses:
AbstractPropertyTableModel

public class PropertyTableModel<T extends Property>
extends TreeTableModel<T>
implements SpanModel, CategorizedTableModel, PropertyChangeListener, EditorStyleTableModel

The table model is used by PropertyTable.

See Also:
Serialized Form

Field Summary
protected  boolean _indentNonCategoryRow
           
static int CATEGORIZED
          Constant used by setOrder().
static int SORTED
          Constant used by setOrder().
static int UNSORTED
          Constant used by setOrder().
 
Fields inherited from class com.jidesoft.grid.TreeTableModel
_filtersApplied
 
Fields inherited from class javax.swing.table.AbstractTableModel
listenerList
 
Fields inherited from interface com.jidesoft.grid.EditorStyleTableModel
EDITOR_STYLE_EDITABLE, EDITOR_STYLE_NORMAL, EDITOR_STYLE_READ_ONLY, EDITOR_STYLE_SELECT_ONLY
 
Fields inherited from interface com.jidesoft.grid.MultiTableModel
FOOTER_COLUMN, HEADER_COLUMN, REGULAR_COLUMN
 
Constructor Summary
PropertyTableModel()
          Creates an empty PropertyTableModel.
PropertyTableModel(List<T> properties)
          Creates PropertyTableModel from a list of properties.
PropertyTableModel(List<T> properties, int categoryOrder)
          Creates PropertyTableModel from a list of properties.
PropertyTableModel(List<T> properties, String[] categories)
          Creates PropertyTableModel from a list of properties.
 
Method Summary
 void addPropertyChangeListener(PropertyChangeListener listener)
          Adds a PropertyChangeListener to the listener list.
 void addPropertyChangeListener(String propertyName, PropertyChangeListener listener)
          Adds a PropertyChangeListener to the listener list for a specific property.
 void addRow(int index, T row, boolean before)
          Overrides the method in TreeTableModel to always throw IllegalStateException.
 void addRows(int index, List<? extends T> rows, boolean before)
          Adds a row at the specified index.
 void addRows(T parentRow, int position, List<? extends T> rows)
          Adds row to the parentRow.
 void bind(Object beanObject)
          Binds an object with the PropertyTableModel.
protected  List<T> buildProperties(List<T> properties)
          This method will convert from the original properties to the list that can be displayed as in TreeTableModel.
protected  boolean compares(Object value1, Object value2)
          Compares the two values.
protected  Property createCategory(String category)
          Creates the Category type.
protected  boolean filterProperty(T property)
          Filter the property.
 T findProperty(String fullName)
          Deprecated. If you want to find property that is visible, use getVisibleProperty(String). If you want to find property either is either visible or invisible, use getProperty(String).
protected  void firePropertyChange(String propertyName, boolean oldValue, boolean newValue)
          Support for reporting bound property changes for boolean properties.
protected  void firePropertyChange(String propertyName, int oldValue, int newValue)
          Support for reporting bound property changes for integer properties.
protected  void firePropertyChange(String propertyName, Object oldValue, Object newValue)
          Support for reporting bound property changes for Object properties.
 Property[] getCategories()
          Get all the category row instances.
 int getCategoryOrder()
          Gets the category sort order.
 Class<?> getCellClassAt(int row, int column)
          Gets the type at cell (row, column).
 CellSpan getCellSpanAt(int rowIndex, int columnIndex)
          Gets the cell span at the specified row and column.
 int getColumnCount()
          Returns the number of columns in the model.
 String getColumnName(int column)
          Returns "Name" is column is 0 and "Value" is column is 1.
 Comparator<? super T> getComparator()
          Gets the comparator that is used to sort properties when the property table is in SORTED display mode.
 ConverterContext getConverterContextAt(int row, int column)
          Gets the converter context at cell (row, column).
 EditorContext getEditorContextAt(int row, int column)
          Gets the editor context at cell (row, column).
 int getEditorStyleAt(int rowIndex, int columnIndex)
          Gets editor style at the cell.
 Map<Object,Boolean> getExpansionState()
          Gets the expansion state of all properties.
 String getMiscCategoryName()
          Gets misc category name.
 int getOrder()
          Gets the order.
 List<T> getOriginalProperties()
          Gets the list of properties used by the table mode.
 List<T> getOriginalProperties(boolean includeChildren)
          Gets the list of properties used by the table mode.
 List<T> getProperties()
          Gets the list of properties used by the table model.
 List<T> getProperties(boolean includeChildren)
          Gets the list of properties used by the table model.
 T getProperty(String fullName)
          Gets Property whose full name is specified in parameter fullName.
 T getPropertyAt(int row)
          Returns the Property at row specified by row.
 PropertyChangeListener[] getPropertyChangeListeners()
          Returns an array of all the property change listeners registered on this component.
 PropertyChangeListener[] getPropertyChangeListeners(String propertyName)
          Returns an array of all the listeners which have been associated with the named property.
 int getPropertyIndex(T property)
          Gets the index of the property.
 T getVisibleProperty(String fullName)
          Gets Property whose full name is specified in parameter fullName.
 boolean isCategoryRow(int rowIndex)
          Checks if the row at rowIndex is a category row.
 boolean isCellEditable(int rowIndex, int columnIndex)
          Returns false if column is 0 and return the isEditable of the property if column is 1.
 boolean isCellSpanOn()
          Checks if the span is on.
 boolean isIndentNonCategoryRow()
          Checks if the non-category row should indent.
 boolean isShowExpert()
          If the expert properties should be shown.
 void propertyChange(PropertyChangeEvent evt)
           
 void refresh()
          Refreshes the table model when the original properties changed.
 void reloadProperties()
          If you changed the properties list directly, you need to call this method to refresh the internal data structure.
 void removePropertyChangeListener(PropertyChangeListener listener)
          Removes a PropertyChangeListener from the listener list.
 void removePropertyChangeListener(String propertyName, PropertyChangeListener listener)
          Removes a PropertyChangeListener from the listener list for a specific property.
 void removeRow(int rowIndex)
          /** Overrides the method in TreeTableModel to always throw IllegalStateException.
 void renameCategory(String currentCategory, String newCategory)
          Changes the category name.
 void setCategories(String[] categories)
          Sets the category list.
 void setCategoryOrder(int categoryOrder)
          Sets category sort order.
 void setComparator(Comparator<? super T> comparator)
          Sets the comparator which will be used to sort properties when the table is in SORTED display mode.
 void setExpansionState(Map<Object,Boolean> state)
          Restores the expansion state of all properties.
 void setIndentNonCategoryRow(boolean indent)
          Deprecated. the indention is now controlled by each Property. Please use Property.setIndentNonCategoryRow(boolean).
 void setMiscCategoryName(String miscCategoryName)
          Sets the misc category name.
 void setOrder(int order)
          Sets the order.
 void setOriginalProperties(List<T> properties)
          Sets the original property list.
 void setOriginalRows(List<? extends T> rows)
          Override the method in TreeTableModel.
 void setShowExpert(boolean showExpert)
          Sets to true if the expert properties should be shown.
 void setValueAt(Object aValue, int rowIndex, int columnIndex)
          Sets the value the underlying property of that cell.
protected  boolean shouldBeFiltered(T row)
           
 void unbind(Object beanObject)
          Unbinds an object with the PropertyTableModel which is previously bounded using bind(Object).
 
Methods inherited from class com.jidesoft.grid.TreeTableModel
addIndexChangeListener, addRow, addRow, addRow, addRow, addRows, addRows, addRows, buildRows, cacheAll, collapseAll, collapseFirstLevel, collapseLastLevel, collapseRows, createCompoundTableModelEvent, createRoot, createRows, expandAll, expandFirstLevel, expandNextLevel, expandRow, expandRows, expandTreePath, fireTableRowsUpdated, getChild, getChildCount, getColumnType, getIndexChangeListeners, getIndexOfChild, getOriginalRows, getRoot, getRowAt, getRowCount, getRowCount, getRowIndex, getRows, getRows, getTableIndex, getValueAt, invalidateCache, isAdjusting, isAutoExpand, isFilterParent, isFiltersApplied, isInitialized, isLeaf, moveDownRow, moveUpRow, removeIndexChangeListener, removeRow, setAdjusting, setAutoExpand, setChildren, setFilterParent, setFiltersApplied
 
Methods inherited from class javax.swing.table.AbstractTableModel
addTableModelListener, findColumn, fireTableCellUpdated, fireTableChanged, fireTableDataChanged, fireTableRowsDeleted, fireTableRowsInserted, fireTableStructureChanged, getColumnClass, getListeners, getTableModelListeners, removeTableModelListener
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface javax.swing.table.TableModel
addTableModelListener, getColumnClass, removeTableModelListener
 

Field Detail

CATEGORIZED

public static final int CATEGORIZED
Constant used by setOrder().

See Also:
Constant Field Values

SORTED

public static final int SORTED
Constant used by setOrder().

See Also:
Constant Field Values

UNSORTED

public static final int UNSORTED
Constant used by setOrder().

See Also:
Constant Field Values

_indentNonCategoryRow

protected boolean _indentNonCategoryRow
Constructor Detail

PropertyTableModel

public PropertyTableModel()
Creates an empty PropertyTableModel.


PropertyTableModel

public PropertyTableModel(List<T> properties)
Creates PropertyTableModel from a list of properties.

Parameters:
properties - list of properties

PropertyTableModel

public PropertyTableModel(List<T> properties,
                          String[] categories)
Creates PropertyTableModel from a list of properties.

Parameters:
properties - list of properties
categories - the categories

PropertyTableModel

public PropertyTableModel(List<T> properties,
                          int categoryOrder)
Creates PropertyTableModel from a list of properties.

Parameters:
properties - the list of properties
categoryOrder - the order of category. 0 means unsorted, 1 means ascending and -1 means descending.
Method Detail

setOriginalProperties

public void setOriginalProperties(List<T> properties)
Sets the original property list.

Parameters:
properties - the list of properties

getComparator

public Comparator<? super T> getComparator()
Gets the comparator that is used to sort properties when the property table is in SORTED display mode.

Returns:
comparator. If it's null, the default comparator will be used to sort by the property name

setComparator

public void setComparator(Comparator<? super T> comparator)
Sets the comparator which will be used to sort properties when the table is in SORTED display mode.

Parameters:
comparator - the comparator to sort the properties.

buildProperties

protected List<T> buildProperties(List<T> properties)
This method will convert from the original properties to the list that can be displayed as in TreeTableModel.

Parameters:
properties - the original properties list.
Returns:
the list that will be used for TreeTableModel.

createCategory

protected Property createCategory(String category)
Creates the Category type. Please note, if you subclass Property to use the generic feature provided by PropertyTableModel, make sure you create your own subclass of Property here. Make sure you call Property.setCategoryRow(boolean) and set it to true.

Parameters:
category - the category name.
Returns:
the Property which is used for the category rows.

filterProperty

protected boolean filterProperty(T property)
Filter the property. If it returns true, PropertyTable will not show that property. By default, it will return true when Property isHidden() is true, or Property isExpert() is true and PropertyTableModel isShowExpert() is false. Subclass can override this method to customize the behavior.

Parameters:
property - the property to be checked if it should be filtered.
Returns:
true or false. If it is true, PropertyTable will not show that property.

shouldBeFiltered

protected boolean shouldBeFiltered(T row)
Overrides:
shouldBeFiltered in class TreeTableModel<T extends Property>

getOrder

public int getOrder()
Gets the order. It could be one of the three values - CATEGORIZED, SORTED or UNSORTED.

Returns:
the order.

setOrder

public void setOrder(int order)
Sets the order. It could be one of the three values - CATEGORIZED, SORTED or UNSORTED.

Parameters:
order - the order.

getProperties

public List<T> getProperties()
Gets the list of properties used by the table model. If it is in CATEGORIZED order, this method will return a list of categories. If it is in SORTED or UNSORTED order, it will return a list of properties. The order of the properties is as displayed.

Returns:
the list of properties

getProperties

public List<T> getProperties(boolean includeChildren)
Gets the list of properties used by the table model. The order is as displayed.

Parameters:
includeChildren - whether to include all the children when asking for the list of properties.
Returns:
the list of properties

getOriginalProperties

public List<T> getOriginalProperties()
Gets the list of properties used by the table mode. The order is as it is passed in constructor.

Returns:
the list of properties as it is passed in constructor

getOriginalProperties

public List<T> getOriginalProperties(boolean includeChildren)
Gets the list of properties used by the table mode. The order is as it is passed in constructor.

Parameters:
includeChildren - true to include the children of all the properties.
Returns:
the list of properties as it is passed in constructor

reloadProperties

public void reloadProperties()
If you changed the properties list directly, you need to call this method to refresh the internal data structure.


setOriginalRows

public void setOriginalRows(List<? extends T> rows)
Override the method in TreeTableModel. If you want to change the original properties list of PropertyTableModel, you should always use setOriginalProperties(java.util.List). For backward compatible reason, we made this method do the same thing as setOriginalProperties.

Overrides:
setOriginalRows in class TreeTableModel<T extends Property>
Parameters:
rows - the original properties list.

refresh

public void refresh()
Refreshes the table model when the original properties changed.

Overrides:
refresh in class TreeTableModel<T extends Property>

setValueAt

public void setValueAt(Object aValue,
                       int rowIndex,
                       int columnIndex)
Sets the value the underlying property of that cell.

Specified by:
setValueAt in interface TableModel
Overrides:
setValueAt in class TreeTableModel<T extends Property>
Parameters:
aValue - value to assign to cell
rowIndex - row of cell
columnIndex - column of cell

compares

protected boolean compares(Object value1,
                           Object value2)
Compares the two values.

Parameters:
value1 - the first value.
value2 - the second value.
Returns:
true or false.

isCellEditable

public boolean isCellEditable(int rowIndex,
                              int columnIndex)
Returns false if column is 0 and return the isEditable of the property if column is 1.

Specified by:
isCellEditable in interface TableModel
Overrides:
isCellEditable in class TreeTableModel<T extends Property>
Parameters:
rowIndex - the row being queried
columnIndex - the column being queried
Returns:
false

getColumnName

public String getColumnName(int column)
Returns "Name" is column is 0 and "Value" is column is 1.

Specified by:
getColumnName in interface TableModel
Overrides:
getColumnName in class AbstractTableModel
Parameters:
column - the column being queried
Returns:
a string containing the default name of column

getColumnCount

public int getColumnCount()
Returns the number of columns in the model. A JTable uses this method to determine how many columns it should create and display by default.

Specified by:
getColumnCount in interface TableModel
Returns:
the number of columns in the model
See Also:
TreeTableModel.getRowCount()

getPropertyAt

public T getPropertyAt(int row)
Returns the Property at row specified by row.

Parameters:
row - the row whose Property is to be queried
Returns:
the Property at the specified row

getPropertyIndex

public int getPropertyIndex(T property)
Gets the index of the property.

Parameters:
property - property
Returns:
the index of the property

findProperty

@Deprecated
public T findProperty(String fullName)
Deprecated. If you want to find property that is visible, use getVisibleProperty(String). If you want to find property either is either visible or invisible, use getProperty(String).

Parameters:
fullName - the full name of the property
Returns:
the property.

getVisibleProperty

public T getVisibleProperty(String fullName)
Gets Property whose full name is specified in parameter fullName. Please note, this method will only find the property that is visible. If its parent is collapsed, this method will not find the property.

Parameters:
fullName - property full name
Returns:
the index of the property
See Also:
findProperty(String).

getProperty

public T getProperty(String fullName)
Gets Property whose full name is specified in parameter fullName.

Parameters:
fullName - property full name
Returns:
the index of the property

getConverterContextAt

public ConverterContext getConverterContextAt(int row,
                                              int column)
Description copied from interface: ContextSensitiveTableModel
Gets the converter context at cell (row, column).

For a special row index like -1, please return the default converter context for the entire column if there is any.

Specified by:
getConverterContextAt in interface ContextSensitiveTableModel
Overrides:
getConverterContextAt in class TreeTableModel<T extends Property>
Parameters:
row - the row index
column - the column index
Returns:
converter context

getEditorContextAt

public EditorContext getEditorContextAt(int row,
                                        int column)
Description copied from interface: ContextSensitiveTableModel
Gets the editor context at cell (row, column).

For a special row index like -1, please return the default editor context for the entire column if there is any.

Specified by:
getEditorContextAt in interface ContextSensitiveTableModel
Overrides:
getEditorContextAt in class TreeTableModel<T extends Property>
Parameters:
row - the row index
column - the column index
Returns:
editor context

getCellClassAt

public Class<?> getCellClassAt(int row,
                               int column)
Description copied from interface: ContextSensitiveTableModel
Gets the type at cell (row, column).

For a special row index like -1, please return the default column class for the entire column if there is any.

Specified by:
getCellClassAt in interface ContextSensitiveTableModel
Overrides:
getCellClassAt in class TreeTableModel<T extends Property>
Parameters:
row - the row index
column - the column index
Returns:
type

isCategoryRow

public boolean isCategoryRow(int rowIndex)
Description copied from interface: CategorizedTableModel
Checks if the row at rowIndex is a category row.

Specified by:
isCategoryRow in interface CategorizedTableModel
Parameters:
rowIndex - the index of the row to be checked.
Returns:
true if the row at rowIndex is a category row.

addPropertyChangeListener

public void addPropertyChangeListener(PropertyChangeListener listener)
Adds a PropertyChangeListener to the listener list.

Parameters:
listener - the PropertyChangeListener to be added
See Also:
removePropertyChangeListener(java.beans.PropertyChangeListener), getPropertyChangeListeners(), addPropertyChangeListener(java.lang.String, java.beans.PropertyChangeListener)

removePropertyChangeListener

public void removePropertyChangeListener(PropertyChangeListener listener)
Removes a PropertyChangeListener from the listener list. This method should be used to remove PropertyChangeListeners that were registered for all bound properties of this class.

If listener is null, no exception is thrown and no action is performed.

Parameters:
listener - the PropertyChangeListener to be removed
See Also:
addPropertyChangeListener(java.beans.PropertyChangeListener), getPropertyChangeListeners(), removePropertyChangeListener(java.lang.String, java.beans.PropertyChangeListener)

getPropertyChangeListeners

public PropertyChangeListener[] getPropertyChangeListeners()
Returns an array of all the property change listeners registered on this component.

Returns:
all of this component's PropertyChangeListeners or an empty array if no property change listeners are currently registered
Since:
1.4
See Also:
addPropertyChangeListener(java.beans.PropertyChangeListener), removePropertyChangeListener(java.beans.PropertyChangeListener), getPropertyChangeListeners(java.lang.String), PropertyChangeSupport.getPropertyChangeListeners()

addPropertyChangeListener

public void addPropertyChangeListener(String propertyName,
                                      PropertyChangeListener listener)
Adds a PropertyChangeListener to the listener list for a specific property.

Parameters:
propertyName - one of the property names listed above
listener - the PropertyChangeListener to be added
See Also:
removePropertyChangeListener(java.lang.String, java.beans.PropertyChangeListener), getPropertyChangeListeners(java.lang.String), addPropertyChangeListener(java.lang.String, java.beans.PropertyChangeListener)

removePropertyChangeListener

public void removePropertyChangeListener(String propertyName,
                                         PropertyChangeListener listener)
Removes a PropertyChangeListener from the listener list for a specific property. This method should be used to remove PropertyChangeListeners that were registered for a specific bound property.

If listener is null, no exception is thrown and no action is performed.

Parameters:
propertyName - a valid property name
listener - the PropertyChangeListener to be removed
See Also:
addPropertyChangeListener(java.lang.String, java.beans.PropertyChangeListener), getPropertyChangeListeners(java.lang.String), removePropertyChangeListener(java.beans.PropertyChangeListener)

getPropertyChangeListeners

public PropertyChangeListener[] getPropertyChangeListeners(String propertyName)
Returns an array of all the listeners which have been associated with the named property.

Parameters:
propertyName - the property name
Returns:
all of the PropertyChangeListeners associated with the named property or an empty array if no listeners have been added
Since:
1.4
See Also:
addPropertyChangeListener(java.lang.String, java.beans.PropertyChangeListener), removePropertyChangeListener(java.lang.String, java.beans.PropertyChangeListener), getPropertyChangeListeners()

firePropertyChange

protected void firePropertyChange(String propertyName,
                                  Object oldValue,
                                  Object newValue)
Support for reporting bound property changes for Object properties. This method can be called when a bound property has changed and it will send the appropriate PropertyChangeEvent to any registered PropertyChangeListeners.

Parameters:
propertyName - the property whose value has changed
oldValue - the property's previous value
newValue - the property's new value

firePropertyChange

protected void firePropertyChange(String propertyName,
                                  boolean oldValue,
                                  boolean newValue)
Support for reporting bound property changes for boolean properties. This method can be called when a bound property has changed and it will send the appropriate PropertyChangeEvent to any registered PropertyChangeListeners.

Parameters:
propertyName - the property whose value has changed
oldValue - the property's previous value
newValue - the property's new value

firePropertyChange

protected void firePropertyChange(String propertyName,
                                  int oldValue,
                                  int newValue)
Support for reporting bound property changes for integer properties. This method can be called when a bound property has changed and it will send the appropriate PropertyChangeEvent to any registered PropertyChangeListeners.

Parameters:
propertyName - the property whose value has changed
oldValue - the property's previous value
newValue - the property's new value

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

@Deprecated
public void setIndentNonCategoryRow(boolean indent)
Deprecated. the indention is now controlled by each Property. Please use Property.setIndentNonCategoryRow(boolean).

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.

getMiscCategoryName

public String getMiscCategoryName()
Gets misc category name. Misc category is for property which doesn't specify a category.

Returns:
misc category name. If it has never been set before, it will use the string from a resource bundle in com.jidesoft.grid. In English, it will be "Misc".

setMiscCategoryName

public void setMiscCategoryName(String miscCategoryName)
Sets the misc category name.

Parameters:
miscCategoryName - the name for misc category.

renameCategory

public void renameCategory(String currentCategory,
                           String newCategory)
Changes the category name.

Parameters:
currentCategory - the current category name
newCategory - the new category name

setCategories

public void setCategories(String[] categories)
Sets the category list. After calling this method, you should call reloadProperties() for it to take effect. We have this method so that you can specify the order of categories using the string array.

Parameters:
categories - an array of categories

getCategories

public Property[] getCategories()
Get all the category row instances. You don't have to invoke setCategories() to make it work. As long as you defined category for every single property, you would be able to retrieve the category row instances.

Returns:
the category row array.

getCategoryOrder

public int getCategoryOrder()
Gets the category sort order.

Returns:
0 means unsorted, 1 means ascending and -1 means descending.

setCategoryOrder

public void setCategoryOrder(int categoryOrder)
Sets category sort order.

Parameters:
categoryOrder - the order of category. 0 means unsorted, 1 means ascending and -1 means descending.

isShowExpert

public boolean isShowExpert()
If the expert properties should be shown.

Returns:
true if expert properties should be shown.

setShowExpert

public void setShowExpert(boolean showExpert)
Sets to true if the expert properties should be shown. Otherwise set it to false. By default it's true. By default, all properties are shown in PropertyTableModel, including export properties. However if you call PropertyTableModel#setShowExpert(false), export properties will be hidden. You can use this if you don't want non-expert users to touch some of the properties which are considered as for experts only.

Parameters:
showExpert - true or false.

getCellSpanAt

public CellSpan getCellSpanAt(int rowIndex,
                              int columnIndex)
Description copied from interface: SpanModel
Gets the cell span at the specified row and column. To avoid creating many instances of CellSpan, you can return the same instance by changing its values only. For example, the code below is a good example.

 private final CellSpan span = new CellSpan(0,0,1,1);
 public CellSpan getCellSpanAt(int row, int col) {
     span.setRow(...);
     span.setColumn(...);
     span.setRowSpan(...);
     span.setColumnSpan(...);
     return span;
 }
 
For performance consideration, if the cell span has 1 row span and 1 column span, it is better to return null instead of new CellSpan(row, column, 1, 1).

Specified by:
getCellSpanAt in interface SpanModel
Parameters:
rowIndex - the row index.
columnIndex - the column index.
Returns:
CellSpan object.

isCellSpanOn

public boolean isCellSpanOn()
Description copied from interface: SpanModel
Checks if the span is on. The CellSpanTable will ignore all the CellSpans defined in this model if this method returns false.

Since 3.5.12, please fire table data changed event if the returned value of this method is changed. Otherwise the CellSpanTable might still use the cached value to improve performance.

Specified by:
isCellSpanOn in interface SpanModel
Returns:
true if span is on. Otherwise false.

addRow

public void addRow(int index,
                   T row,
                   boolean before)
Overrides the method in TreeTableModel to always throw IllegalStateException. Since PropertyTableModel has its own way to manage the order of properties, it'd better to call getOriginalProperties() to get the original property list and add a new property to the list, then call refresh() to update the view.

Overrides:
addRow in class TreeTableModel<T extends Property>
Parameters:
index - the row index. The index can be -1. If it is -1 and before == false, it will be append at the end. If before == true, it will insert at the first position.
row - row to be added.
before - if it should be added before index or after index.

addRows

public void addRows(T parentRow,
                    int position,
                    List<? extends T> rows)
Description copied from class: TreeTableModel
Adds row to the parentRow. The parentRow has to be an instance of ExpandableRow. Otherwise, there is no effect.

Overrides:
addRows in class TreeTableModel<T extends Property>
Parameters:
parentRow - the parent row.
position - the insert position relative to the parent row.
rows - the rows to be added.

addRows

public void addRows(int index,
                    List<? extends T> rows,
                    boolean before)
Description copied from class: TreeTableModel
Adds a row at the specified index. You can also use the last boolean parameter to control if it is added before the index or after the index. The new row will be at the same level as the row at the index.

Overrides:
addRows in class TreeTableModel<T extends Property>
Parameters:
index - the row index. The index can be -1. If it is -1 and before == false, it will be append at the end. If before == true, it will insert at the first position.
rows - row to be added.
before - if it should be added before index or after index.

removeRow

public void removeRow(int rowIndex)
/** Overrides the method in TreeTableModel to always throw IllegalStateException. Since PropertyTableModel has its own way to manage the order of properties, it'd better to call getOriginalProperties() to get the original property list and remove a property from the list, then call refresh() to update the view.

Overrides:
removeRow in class TreeTableModel<T extends Property>
Parameters:
rowIndex - the row index of the row to be removed

bind

public void bind(Object beanObject)
          throws Exception
Binds an object with the PropertyTableModel. This is used if the PropertyTableModel is created from BeanIntrospector.createPropertyTableModel(Object) method. If the table model is changed, it will set the value on the object. But if the object is modified outside the table model, the table model is not aware of the change, thus it will not update automatically to show the change. This bind method will call addPropertyChangeListener method on the object to listen to the property change event so that it knows when the object's property is changed.

Parameters:
beanObject - the object
Throws:
Exception - if the object doesn't have addPropertyChangeListener method.

unbind

public void unbind(Object beanObject)
            throws Exception
Unbinds an object with the PropertyTableModel which is previously bounded using bind(Object).

Parameters:
beanObject - the object
Throws:
Exception - if the object doesn't have removePropertyChangeListener method.

propertyChange

public void propertyChange(PropertyChangeEvent evt)
Specified by:
propertyChange in interface PropertyChangeListener

getExpansionState

public Map<Object,Boolean> getExpansionState()
Gets the expansion state of all properties. You can use this method along with setExpansionState(java.util.Map) to restore the property expansion state after the PropertyTableModel is recreated.

Overrides:
getExpansionState in class TreeTableModel<T extends Property>
Returns:
a map contains the expansion state of all properties.

setExpansionState

public void setExpansionState(Map<Object,Boolean> state)
Restores the expansion state of all properties. You can use this method to restore the expansion state after the PropertyTableModel is created but property names remain. For newly added property, this method will not change its expansion state.

Overrides:
setExpansionState in class TreeTableModel<T extends Property>
Parameters:
state - a map of the expansion state.

getEditorStyleAt

public int getEditorStyleAt(int rowIndex,
                            int columnIndex)
Gets editor style at the cell.

By default, it will try to get the editor style from the property if column index is 1. Otherwise it returns EditorStyleTableModel.EDITOR_STYLE_NORMAL by default

Specified by:
getEditorStyleAt in interface EditorStyleTableModel
Parameters:
rowIndex - the row index
columnIndex - the column index
Returns:
the editor style

JIDE 3.5.15