|
JIDE 3.5.15 | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectjavax.swing.table.AbstractTableModel
com.jidesoft.grid.TreeTableModel<T>
com.jidesoft.grid.PropertyTableModel<T>
public class PropertyTableModel<T extends Property>
The table model is used by PropertyTable.
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 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 |
---|
public static final int CATEGORIZED
public static final int SORTED
public static final int UNSORTED
protected boolean _indentNonCategoryRow
Constructor Detail |
---|
public PropertyTableModel()
public PropertyTableModel(List<T> properties)
properties
- list of propertiespublic PropertyTableModel(List<T> properties, String[] categories)
properties
- list of propertiescategories
- the categoriespublic PropertyTableModel(List<T> properties, int categoryOrder)
properties
- the list of propertiescategoryOrder
- the order of category. 0 means unsorted, 1 means ascending and -1 means descending.Method Detail |
---|
public void setOriginalProperties(List<T> properties)
properties
- the list of propertiespublic Comparator<? super T> getComparator()
public void setComparator(Comparator<? super T> comparator)
comparator
- the comparator to sort the properties.protected List<T> buildProperties(List<T> properties)
properties
- the original properties list.
protected Property createCategory(String category)
Property.setCategoryRow(boolean)
and set it to true.
category
- the category name.
protected boolean filterProperty(T property)
property
- the property to be checked if it should be filtered.
protected boolean shouldBeFiltered(T row)
shouldBeFiltered
in class TreeTableModel<T extends Property>
public int getOrder()
public void setOrder(int order)
order
- the order.public List<T> getProperties()
public List<T> getProperties(boolean includeChildren)
includeChildren
- whether to include all the children when asking for the list of properties.
public List<T> getOriginalProperties()
public List<T> getOriginalProperties(boolean includeChildren)
includeChildren
- true to include the children of all the properties.
public void reloadProperties()
public void setOriginalRows(List<? extends T> rows)
setOriginalProperties(java.util.List)
. For backward compatible reason, we made
this method do the same thing as setOriginalProperties.
setOriginalRows
in class TreeTableModel<T extends Property>
rows
- the original properties list.public void refresh()
refresh
in class TreeTableModel<T extends Property>
public void setValueAt(Object aValue, int rowIndex, int columnIndex)
setValueAt
in interface TableModel
setValueAt
in class TreeTableModel<T extends Property>
aValue
- value to assign to cellrowIndex
- row of cellcolumnIndex
- column of cellprotected boolean compares(Object value1, Object value2)
value1
- the first value.value2
- the second value.
public boolean isCellEditable(int rowIndex, int columnIndex)
isCellEditable
in interface TableModel
isCellEditable
in class TreeTableModel<T extends Property>
rowIndex
- the row being queriedcolumnIndex
- the column being queried
public String getColumnName(int column)
getColumnName
in interface TableModel
getColumnName
in class AbstractTableModel
column
- the column being queried
column
public int getColumnCount()
JTable
uses this method to determine how many columns
it should create and display by default.
getColumnCount
in interface TableModel
TreeTableModel.getRowCount()
public T getPropertyAt(int row)
row
.
row
- the row whose Property is to be queried
public int getPropertyIndex(T property)
property
- property
@Deprecated public T findProperty(String fullName)
getVisibleProperty(String)
. If you want to
find property either is either visible or invisible, use getProperty(String)
.
fullName
- the full name of the property
public T getVisibleProperty(String fullName)
fullName
- property full name
findProperty(String).
public T getProperty(String fullName)
fullName
- property full name
public ConverterContext getConverterContextAt(int row, int column)
ContextSensitiveTableModel
getConverterContextAt
in interface ContextSensitiveTableModel
getConverterContextAt
in class TreeTableModel<T extends Property>
row
- the row indexcolumn
- the column index
public EditorContext getEditorContextAt(int row, int column)
ContextSensitiveTableModel
getEditorContextAt
in interface ContextSensitiveTableModel
getEditorContextAt
in class TreeTableModel<T extends Property>
row
- the row indexcolumn
- the column index
public Class<?> getCellClassAt(int row, int column)
ContextSensitiveTableModel
getCellClassAt
in interface ContextSensitiveTableModel
getCellClassAt
in class TreeTableModel<T extends Property>
row
- the row indexcolumn
- the column index
public boolean isCategoryRow(int rowIndex)
CategorizedTableModel
isCategoryRow
in interface CategorizedTableModel
rowIndex
- the index of the row to be checked.
public void addPropertyChangeListener(PropertyChangeListener listener)
listener
- the PropertyChangeListener to be addedremovePropertyChangeListener(java.beans.PropertyChangeListener)
,
getPropertyChangeListeners()
,
addPropertyChangeListener(java.lang.String, java.beans.PropertyChangeListener)
public void removePropertyChangeListener(PropertyChangeListener listener)
listener
- the PropertyChangeListener to be removedaddPropertyChangeListener(java.beans.PropertyChangeListener)
,
getPropertyChangeListeners()
,
removePropertyChangeListener(java.lang.String, java.beans.PropertyChangeListener)
public PropertyChangeListener[] getPropertyChangeListeners()
PropertyChangeListener
s or an empty array if no property change
listeners are currently registeredaddPropertyChangeListener(java.beans.PropertyChangeListener)
,
removePropertyChangeListener(java.beans.PropertyChangeListener)
,
getPropertyChangeListeners(java.lang.String)
,
PropertyChangeSupport.getPropertyChangeListeners()
public void addPropertyChangeListener(String propertyName, PropertyChangeListener listener)
propertyName
- one of the property names listed abovelistener
- the PropertyChangeListener to be addedremovePropertyChangeListener(java.lang.String, java.beans.PropertyChangeListener)
,
getPropertyChangeListeners(java.lang.String)
,
addPropertyChangeListener(java.lang.String, java.beans.PropertyChangeListener)
public void removePropertyChangeListener(String propertyName, PropertyChangeListener listener)
propertyName
- a valid property namelistener
- the PropertyChangeListener to be removedaddPropertyChangeListener(java.lang.String, java.beans.PropertyChangeListener)
,
getPropertyChangeListeners(java.lang.String)
,
removePropertyChangeListener(java.beans.PropertyChangeListener)
public PropertyChangeListener[] getPropertyChangeListeners(String propertyName)
propertyName
- the property name
PropertyChangeListeners
associated with the named property or an empty array if
no listeners have been addedaddPropertyChangeListener(java.lang.String, java.beans.PropertyChangeListener)
,
removePropertyChangeListener(java.lang.String, java.beans.PropertyChangeListener)
,
getPropertyChangeListeners()
protected void firePropertyChange(String propertyName, Object oldValue, Object newValue)
propertyName
- the property whose value has changedoldValue
- the property's previous valuenewValue
- the property's new valueprotected void firePropertyChange(String propertyName, boolean oldValue, boolean newValue)
propertyName
- the property whose value has changedoldValue
- the property's previous valuenewValue
- the property's new valueprotected void firePropertyChange(String propertyName, int oldValue, int newValue)
propertyName
- the property whose value has changedoldValue
- the property's previous valuenewValue
- the property's new valuepublic boolean isIndentNonCategoryRow()
@Deprecated public void setIndentNonCategoryRow(boolean indent)
Property.setIndentNonCategoryRow(boolean)
.
indent
- true or false.public String getMiscCategoryName()
public void setMiscCategoryName(String miscCategoryName)
miscCategoryName
- the name for misc category.public void renameCategory(String currentCategory, String newCategory)
currentCategory
- the current category namenewCategory
- the new category namepublic void setCategories(String[] categories)
categories
- an array of categoriespublic Property[] getCategories()
public int getCategoryOrder()
public void setCategoryOrder(int categoryOrder)
categoryOrder
- the order of category. 0 means unsorted, 1 means ascending and -1 means descending.public boolean isShowExpert()
public void setShowExpert(boolean showExpert)
showExpert
- true or false.public CellSpan getCellSpanAt(int rowIndex, int columnIndex)
SpanModel
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).
getCellSpanAt
in interface SpanModel
rowIndex
- the row index.columnIndex
- the column index.
public boolean isCellSpanOn()
SpanModel
isCellSpanOn
in interface SpanModel
public void addRow(int index, T row, boolean before)
getOriginalProperties()
to get the
original property list and add a new property to the list, then call refresh()
to update the view.
addRow
in class TreeTableModel<T extends Property>
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.public void addRows(T parentRow, int position, List<? extends T> rows)
TreeTableModel
addRows
in class TreeTableModel<T extends Property>
parentRow
- the parent row.position
- the insert position relative to the parent row.rows
- the rows to be added.public void addRows(int index, List<? extends T> rows, boolean before)
TreeTableModel
addRows
in class TreeTableModel<T extends Property>
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.public void removeRow(int rowIndex)
getOriginalProperties()
to get the
original property list and remove a property from the list, then call refresh()
to update the view.
removeRow
in class TreeTableModel<T extends Property>
rowIndex
- the row index of the row to be removedpublic void bind(Object beanObject) throws Exception
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.
beanObject
- the object
Exception
- if the object doesn't have addPropertyChangeListener method.public void unbind(Object beanObject) throws Exception
PropertyTableModel
which is previously bounded using bind(Object)
.
beanObject
- the object
Exception
- if the object doesn't have removePropertyChangeListener method.public void propertyChange(PropertyChangeEvent evt)
propertyChange
in interface PropertyChangeListener
public Map<Object,Boolean> getExpansionState()
setExpansionState(java.util.Map)
to restore the property expansion state after the PropertyTableModel is
recreated.
getExpansionState
in class TreeTableModel<T extends Property>
public void setExpansionState(Map<Object,Boolean> state)
setExpansionState
in class TreeTableModel<T extends Property>
state
- a map of the expansion state.public int getEditorStyleAt(int rowIndex, int columnIndex)
EditorStyleTableModel.EDITOR_STYLE_NORMAL
by default
getEditorStyleAt
in interface EditorStyleTableModel
rowIndex
- the row indexcolumnIndex
- the column index
|
JIDE 3.5.15 | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |