* Adds <code>PropertyChange</code> and {@link FurnitureListener FurnitureListener} listeners
* to home to update furniture sort in table when <code>furnitureSortedProperty</code>,
* <code>furnitureAscendingSorted</code> or furniture in <code>home</code> changes.
*/
private void addHomeListener(final Home home) {
PropertyChangeListener sortListener =
new PropertyChangeListener () {
public void propertyChange(PropertyChangeEvent ev) {
((FurnitureTableModel)getModel()).filterAndSortFurniture();
// Update selected rows
updateTableSelectedFurniture(home.getSelectedItems());
getTableHeader().repaint();
}
};
home.addPropertyChangeListener(Home.Property.FURNITURE_SORTED_PROPERTY, sortListener);
home.addPropertyChangeListener(Home.Property.FURNITURE_DESCENDING_SORTED, sortListener);
final PropertyChangeListener furnitureChangeListener =
new PropertyChangeListener () {
public void propertyChange(PropertyChangeEvent ev) {
// As furniture properties values change may alter sort order, update sort and whole table
((FurnitureTableModel)getModel()).filterAndSortFurniture();
// Update selected rows
updateTableSelectedFurniture(home.getSelectedItems());