/** * Set <code>PanelHolder</code> <code>Map</code>. * * @param panelList Map */ public void setPanelList(Map panelList) { if (Page.DEBUG) System.out.println("PanelModel.setPanelList(): size = " + panelList.size()); this.panelList = panelList; Iterator iter = panelIterator(); while (iter.hasNext()) { PanelHolder ph = (PanelHolder) iter.next(); ph.addChangeListener(this); } firePropertyChange("panelList", 0, panelList.size()); // should this be fired? }
/** * Registers ChangeListeners and sets back references in <code>PanelModel</code> and its children. */ private void repair() { // traverse PanelModel and create all event links Iterator iter = panelIterator(); while (iter.hasNext()) { PanelHolder ph = (PanelHolder) iter.next(); ph.removeAllChangeListeners(); ph.addChangeListener(this); ph.setPanelModel(this); Iterator dgIter = ph.dataGroupIterator(); while (dgIter.hasNext()) { DataGroup dg = (DataGroup) dgIter.next(); dg.removeAllChangeListeners(); dg.addChangeListener(ph); dg.setPanelHolder(ph); dg.getXAxisHolder().removeAllChangeListeners(); dg.getXAxisHolder().addChangeListener(dg); dg.getXAxisHolder().setDataGroup(dg); dg.getYAxisHolder().removeAllChangeListeners(); dg.getYAxisHolder().addChangeListener(dg); dg.getYAxisHolder().setDataGroup(dg); } Iterator lbIter = ph.labelIterator(); while (lbIter.hasNext()) { Label lb = (Label) lbIter.next(); lb.removeAllChangeListeners(); lb.addChangeListener(ph); lb.setPanelHolder(ph); } Iterator lgIter = ph.legendIterator(); while (lgIter.hasNext()) { Legend lg = (Legend) lgIter.next(); lg.removeAllChangeListeners(); lg.addChangeListener(ph); lg.setPanelHolder(ph); } } }
/** * Remove Panel from <code>PanelModel</code>. * * @param ph PanelHolder */ public void removePanel(PanelHolder ph) { int sze = panelList.size(); ph.removeChangeListener(this); panelList.remove(ph.getId()); firePropertyChange("panelList", sze, panelList.size()); }
/** * Add a <code>PanelHolder</code> to <code>PanelModel</code>. * * @param ph PanelHolder */ public void addPanel(PanelHolder ph) { int sze = panelList.size(); ph.addChangeListener(this); panelList.put(ph.getId(), ph); firePropertyChange("panelList", sze, panelList.size()); }