diff options
author | Peter Johnson <johnson.peter@gmail.com> | 2016-01-04 15:34:44 -0800 |
---|---|---|
committer | Peter Johnson <johnson.peter@gmail.com> | 2016-01-04 15:34:44 -0800 |
commit | 8792ee04d0405df10386706e4eb138e475c20737 (patch) | |
tree | 33db35ac3c48b66a115ddd48320d6a6a8fb837cd | |
parent | d349ed504110a52cadf9483a77f2247fb001861e (diff) |
LWSubsystem: Prevent duplicate elements.
Change-Id: I0f87478b9448910a35cbc7effc24649a1ecd974e
-rw-r--r-- | smartdashboard/src/edu/wpi/first/smartdashboard/livewindow/elements/LWSubsystem.java | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/smartdashboard/src/edu/wpi/first/smartdashboard/livewindow/elements/LWSubsystem.java b/smartdashboard/src/edu/wpi/first/smartdashboard/livewindow/elements/LWSubsystem.java index a42226c..d1d8ea0 100644 --- a/smartdashboard/src/edu/wpi/first/smartdashboard/livewindow/elements/LWSubsystem.java +++ b/smartdashboard/src/edu/wpi/first/smartdashboard/livewindow/elements/LWSubsystem.java @@ -76,6 +76,11 @@ public class LWSubsystem extends AbstractTableWidget { }
private void addSubsystemElement(String key, ITable value) {
+ // don't add duplicate widgets
+ for (Widget widget : widgets) {
+ if (widget != null && widget.getFieldName().equals(key))
+ return;
+ }
try {
System.out.println("\nSubsystem \"" + getFieldName() + "\" does not contain widget \"" + key + "\"");
System.out.println("Table: " + value);
|