fireTableRowsUpdated(0, getRowCount() - 1);
}
}
public Comparator<CatalogPieceOfFurniture> getFurnitureComparator(final String propertyKey) {
final Collator collator = Collator.getInstance();
Comparator<CatalogPieceOfFurniture> furnitureComparator = null;
if (FurnitureLibrary.FURNITURE_ID_PROPERTY.equals(propertyKey)) {
furnitureComparator = new Comparator<CatalogPieceOfFurniture>() {
public int compare(CatalogPieceOfFurniture piece1, CatalogPieceOfFurniture piece2) {
if (piece1.getId() == null) {
return -1;
} else if (piece2.getId() == null) {
return 1;
} else {
return collator.compare(piece1.getId(), piece2.getId());
}
}
};
} else if (FurnitureLibrary.FURNITURE_NAME_PROPERTY.equals(propertyKey)) {
furnitureComparator = new Comparator<CatalogPieceOfFurniture>() {
public int compare(CatalogPieceOfFurniture piece1, CatalogPieceOfFurniture piece2) {
String piece1Name = (String)furnitureLibrary.getPieceOfFurnitureLocalizedData(
piece1, controller.getFurnitureLangauge(), propertyKey, piece1.getName());
String piece2Name = (String)furnitureLibrary.getPieceOfFurnitureLocalizedData(
piece2, controller.getFurnitureLangauge(), propertyKey, piece2.getName());
return collator.compare(piece1Name, piece2Name);
}
};
} else if (FurnitureLibrary.FURNITURE_DESCRIPTION_PROPERTY.equals(propertyKey)) {
furnitureComparator = new Comparator<CatalogPieceOfFurniture>() {
public int compare(CatalogPieceOfFurniture piece1, CatalogPieceOfFurniture piece2) {
String piece1Description = (String)furnitureLibrary.getPieceOfFurnitureLocalizedData(
piece1, controller.getFurnitureLangauge(), propertyKey, piece1.getDescription());
if (piece1Description == null) {
return -1;
} else {
String piece2Description = (String)furnitureLibrary.getPieceOfFurnitureLocalizedData(
piece2, controller.getFurnitureLangauge(), propertyKey, piece2.getDescription());
if (piece2Description == null) {
return 1;
} else {
return collator.compare(piece1Description, piece2Description);
}
}
}
};
} else if (FurnitureLibrary.FURNITURE_CREATOR_PROPERTY.equals(propertyKey)) {
furnitureComparator = new Comparator<CatalogPieceOfFurniture>() {
public int compare(CatalogPieceOfFurniture piece1, CatalogPieceOfFurniture piece2) {
return collator.compare(piece1.getCreator(), piece2.getCreator());
}
};
} else if (FurnitureLibrary.FURNITURE_CATEGORY_PROPERTY.equals(propertyKey)) {
furnitureComparator = new Comparator<CatalogPieceOfFurniture>() {
public int compare(CatalogPieceOfFurniture piece1, CatalogPieceOfFurniture piece2) {
String piece1Category = (String)furnitureLibrary.getPieceOfFurnitureLocalizedData(
piece1, controller.getFurnitureLangauge(), propertyKey, piece1.getCategory().getName());
String piece2Category = (String)furnitureLibrary.getPieceOfFurnitureLocalizedData(
piece2, controller.getFurnitureLangauge(), propertyKey, piece2.getCategory().getName());
return collator.compare(piece1Category, piece2Category);
}
};
} else if (FurnitureLibrary.FURNITURE_PRICE_PROPERTY.equals(propertyKey)) {
furnitureComparator = new Comparator<CatalogPieceOfFurniture>() {
public int compare(CatalogPieceOfFurniture piece1, CatalogPieceOfFurniture piece2) {