protected EditorModelHandler getHandler(String propertyName) { EditorModelHandler handler = propertyHandlerMap.get(propertyName); if (handler == null) { try { for (WidgetModel widget : widgets) { if (widget.getWidgetEditor() instanceof DefaultTableWidgetPropertiesEditor) { handler = ((DefaultTableWidgetPropertiesEditor) widget.getWidgetEditor()) .propertyHandlerMap.get(propertyName); if (handler != null) break; } } } catch (Exception e) { // the below comment isn't clear. I wish I knew when to expect this. Logger.getLogger(DefaultTableWidgetPropertiesEditor.class) .error("couldn't get a handler for: " + propertyName, e); // no registered editor, or unknown property } if (handler == null) { Logger.getLogger(DefaultTableWidgetPropertiesEditor.class) .error("", new Exception("No handler for: " + propertyName)); } } return handler; }
protected void configureTableModel(DefaultTableModel model) { Set<String> ids = new TreeSet<String>(); // build list of common properties for (WidgetModel widget : widgets) ids.addAll(widget.getDynamicPropertyIds()); for (WidgetModel widget : widgets) ids.retainAll(widget.getDynamicPropertyIds()); IDS: for (String id : ids) { Object value = widgets.isEmpty() ? null : widgets.iterator().next().getDynamicProperty(id); for (WidgetModel widget : widgets) { if (widget.getWidgetEditor() instanceof DefaultTableWidgetPropertiesEditor) { if (!((DefaultTableWidgetPropertiesEditor) widget.getWidgetEditor()) .propertyHandlerMap.containsKey(id)) continue IDS; } Object o = widget.getDynamicProperty(id); if (value != null && !value.equals(o)) { value = null; break; } } model.addRow(new Object[] {id, value}); } }