/*
* Tiene traccia delle modifiche apportate al modello
*/
public void actionPerformed(ActionObservable observable, Action action) {
if(action instanceof ActionPutArea) {
AreaData areaNew = ((ActionPutArea)action).getArea();
cacheObjectToChildren.get(root).add(areaNew);
cacheObjectToChildren.put(areaNew, new Vector<Object>());
fireTreeNodesInserted(
this,
new Object[] { root },
new int[] { getIndexOfChild(root, areaNew) },
new Object[] { areaNew }
);
} else if(action instanceof ActionRemoveArea) {
AreaData areaOld = ((ActionRemoveArea)action).getArea();
final int idxRemoved = getIndexOfChild(root, areaOld);
fireTreeNodesRemoved(
this,
new Object[] { root },
new int[] { idxRemoved },
new Object[] { areaOld }
);
cacheObjectToChildren.get(root).remove(areaOld);
cacheObjectToChildren.remove(areaOld);
} else if(action instanceof ActionPutOption) {
OptionData optionNew = ((ActionPutOption)action).getOption();
AreaData area = optionNew.getAreaData();
cacheObjectToChildren.get(area).add(optionNew);
fireTreeNodesInserted(
this,
new Object[] { root, area },
new int[] { getIndexOfChild(area, optionNew) },
new Object[] { optionNew }
);
} else if(action instanceof ActionRemoveOption) {
OptionData optionOld = ((ActionRemoveOption)action).getOption();
AreaData area = optionOld.getAreaData();
fireTreeNodesRemoved(
this,
new Object[] { root, area },
new int[] { getIndexOfChild(area, optionOld) },