public FilterManager(Graph graph) { this.graph = graph; NodeAndArcTypeListener listener = new NodeAndArcTypeListener(); // this listens for when a new model is set this.graph.addPropertyChangeListener(listener); // this listens for changes to the model (node/arc types added etc) // by adding it to the graph it will always be attached to the current model even when a new model is set this.graph.addGraphModelListener(listener); this.listeners = new ArrayList<FilterChangedListener>(); this.filters = new ArrayList<GraphFilter>(); this.nodeTypesVisibilityMap = new HashMap<Object, Boolean>(); this.arcTypesVisibilityMap = new HashMap<Object, Boolean>(); // populate the node and arc types map (all visible by default) updateNodeAndArcTypes(); // add the node and arc type filters filters.add(new NodeTypeFilter()); filters.add(new ArcTypeFilter()); }