/**
* Update the display to show the current values
*/
public void updateDisplay() {
PlanarImage image = imageDisplay.getImageProcessor().getSourceImage();
if (image == null)
return;
String[] columnNames = {"Property Name", "Value"};
String[] propertyNames = image.getPropertyNames();
if (propertyNames == null)
return;
int numProperties = propertyNames.length;
// Sort the property keyword and remove the ones that can't be displayed
// (they might not all be strings...)
Set<String> treeSet = new TreeSet<String>();
for (int i = 0; i < numProperties; i++) {
String name = propertyNames[i];
// note: special properties may start with "#" and are not listed
if (name == null || name.length() == 0 || name.startsWith("#")) {
continue;
}
// XXX who is converting the keywords to lower case?
treeSet.add(name.toUpperCase());
}
Object[] keys = treeSet.toArray();
numProperties = keys.length;
String[][] values = new String[numProperties][2];
for (int i = 0; i < numProperties; i++) {
String name = (String) (keys[i]);
values[i][0] = name;
Object property = image.getProperty(name);
if (property == null)
continue;
values[i][1] = property.toString();
}
table.setModel(new DefaultTableModel(values, columnNames));