\r
import gnu.trove.map.TObjectIntMap;\r
import gnu.trove.map.hash.TObjectIntHashMap;\r
-import gnu.trove.procedure.TIntProcedure;\r
import gnu.trove.procedure.TObjectProcedure;\r
\r
public class TrendNode extends G2DParentNode implements TrendLayout {\r
\r
TObjectIntMap<String> newItemMap = itemIndexMap(newSpec.items);\r
TObjectIntMap<String> currentItemMap = itemIndexMap(spec.items);\r
- TObjectIntMap<String> addedItemMap = subtract(newItemMap, currentItemMap);\r
TObjectIntMap<String> removedItemMap = subtract(currentItemMap, newItemMap);\r
Map<String, VertRuler> existingRulers = new HashMap<>();\r
if (this.spec.axisMode == YAxisMode.MultiAxis) {\r
for (int i=0; i<analogItems.size(); i++)\r
vertRulers.add( addNode(VertRuler.class) );\r
} else {\r
+ // Remove rulers of the items that were removed\r
+ // and add new rulers to have enough of them for\r
+ // each separate analog signal.\r
removedItemMap.forEachKey(new TObjectProcedure<String>() {\r
@Override\r
public boolean execute(String id) {\r
return true;\r
}\r
});\r
- addedItemMap.forEachValue(new TIntProcedure() {\r
- @Override\r
- public boolean execute(int index) {\r
- vertRulers.add( index, addNode(VertRuler.class) );\r
- return true;\r
- }\r
- });\r
+ // Ensure TODO: validate that this works also for keeping ruler settings \r
+ for (int i = vertRulers.size(); i < analogItems.size(); ++i) {\r
+ VertRuler ruler = addNode(VertRuler.class);\r
+ vertRulers.add(ruler);\r
+ }\r
}\r
\r
for (int i = 0; i < analogItems.size(); i++) {\r