From 30230534133c59a76cb1f7808c69c64eddc45501 Mon Sep 17 00:00:00 2001 From: kascade Date: Sat, 4 Aug 2007 11:33:52 +0000 Subject: [PATCH] logger overlay bugfix git-svn-id: http://svn.3splooges.com/romraider-arch/trunk@760 d2e2e1cd-ba16-0410-be16-b7c4453c7c2d --- .../ui/handler/table/TableUpdateHandler.java | 39 ++++++++++++++++--- 1 file changed, 33 insertions(+), 6 deletions(-) diff --git a/src/enginuity/logger/ecu/ui/handler/table/TableUpdateHandler.java b/src/enginuity/logger/ecu/ui/handler/table/TableUpdateHandler.java index 9f2ec08b..0ff2a154 100644 --- a/src/enginuity/logger/ecu/ui/handler/table/TableUpdateHandler.java +++ b/src/enginuity/logger/ecu/ui/handler/table/TableUpdateHandler.java @@ -25,6 +25,9 @@ import enginuity.logger.ecu.comms.query.Response; import enginuity.logger.ecu.definition.LoggerData; import enginuity.logger.ecu.ui.handler.DataUpdateHandler; import enginuity.maps.Table; +import enginuity.maps.Table2D; +import enginuity.maps.Table3D; +import static enginuity.util.ParamChecker.isNullOrEmpty; import java.util.ArrayList; import static java.util.Collections.synchronizedMap; @@ -65,13 +68,16 @@ public final class TableUpdateHandler implements DataUpdateHandler { public void registerTable(Table table) { String logParam = table.getLogParam(); - if (!tableMap.containsKey(logParam)) { - tableMap.put(logParam, new ArrayList()); - } - List
tables = tableMap.get(logParam); - if (!tables.contains(table)) { - tables.add(table); + if (!isNullOrEmpty(logParam)) { + if (!tableMap.containsKey(logParam)) { + tableMap.put(logParam, new ArrayList
()); + } + List
tables = tableMap.get(logParam); + if (!tables.contains(table)) { + tables.add(table); + } } + registerAxes(table); } public void deregisterTable(Table table) { @@ -83,10 +89,31 @@ public final class TableUpdateHandler implements DataUpdateHandler { tableMap.remove(logParam); } } + deregisterAxes(table); } public static TableUpdateHandler getInstance() { return INSTANCE; } + private void registerAxes(Table table) { + if (table instanceof Table2D) { + registerTable(((Table2D) table).getAxis()); + } + if (table instanceof Table3D) { + registerTable(((Table3D) table).getXAxis()); + registerTable(((Table3D) table).getYAxis()); + } + } + + private void deregisterAxes(Table table) { + if (table instanceof Table2D) { + deregisterTable(((Table2D) table).getAxis()); + } + if (table instanceof Table3D) { + deregisterTable(((Table3D) table).getXAxis()); + deregisterTable(((Table3D) table).getYAxis()); + } + } + }