From fbf3238f8098eb0f7829b43577a6de2fa466a37a Mon Sep 17 00:00:00 2001 From: "Ray J. Greenwell" Date: Tue, 3 Mar 2026 14:05:50 -0800 Subject: [PATCH] Have FieldEditor update on ElementUpdatedEvents; Require match NamedEvent! - It would update if an AttributeChangedEvent was received, but not an ElementUpdatedEvent! - If you have 50 fields and 50 editors, then every one was updating whenever an event arrived? Filter by the field that actually changed? Does this break something? --- .../threerings/admin/client/FieldEditor.java | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) diff --git a/core/src/main/java/com/threerings/admin/client/FieldEditor.java b/core/src/main/java/com/threerings/admin/client/FieldEditor.java index 6496b2a04..01adf1e81 100644 --- a/core/src/main/java/com/threerings/admin/client/FieldEditor.java +++ b/core/src/main/java/com/threerings/admin/client/FieldEditor.java @@ -23,6 +23,9 @@ import com.samskivert.swing.HGroupLayout; import com.threerings.presents.dobj.AttributeChangeListener; import com.threerings.presents.dobj.AttributeChangedEvent; import com.threerings.presents.dobj.DObject; +import com.threerings.presents.dobj.ElementUpdateListener; +import com.threerings.presents.dobj.ElementUpdatedEvent; +import com.threerings.presents.dobj.NamedEvent; import com.threerings.presents.util.PresentsContext; import static com.threerings.admin.Log.log; @@ -31,7 +34,7 @@ import static com.threerings.admin.Log.log; * Used to display and edit a particular distributed object field. */ public abstract class FieldEditor extends JPanel - implements AttributeChangeListener, ActionListener, FocusListener + implements AttributeChangeListener, ElementUpdateListener, ActionListener, FocusListener { /** The interface defining how the editor interacts with its data. */ public interface Accessor @@ -88,7 +91,19 @@ public abstract class FieldEditor extends JPanel // documentation inherited from interface public void attributeChanged (AttributeChangedEvent event) { - noteUpdatedExternally(); + noteUpdatedExternally(event); + } + + // from ElementUpdateListener + public void elementUpdated (ElementUpdatedEvent event) + { + noteUpdatedExternally(event); + } + + /** Update ourselves to reflect a change if the event is regarding our field. */ + protected void noteUpdatedExternally (NamedEvent event) + { + if (_field.getName().equals(event.getName())) noteUpdatedExternally(); } /** Update ourselves to reflect a change from outside the editor. */