/** Sets the chart model associated with this chart. * If a non-null model is assigned, no matter whether it is the same as * the previous, it will always cause re-render. * * @param model the chart model to associate, or null to dissociate * any previous model. * @exception UiException if failed to initialize with the model */ public void setModel(ChartModel model) { if (_model != model) { if (_model != null) { _model.removeChartDataListener(_dataListener); } _model = model; initDataListener(); } //Always redraw smartDrawChart(); }
public Object clone() { final Chart clone = (Chart) super.clone(); // Due to the not unique ID of the area component creating in JFreeChartEngine, we have to clear // all its children first. clone.getChildren().clear(); clone._smartDrawChartListener = null; clone._smartDrawChart = false; clone.init(); clone.doSmartDraw(); if (clone._model != null) { if (clone._model instanceof ComponentCloneListener) { final ChartModel model = (ChartModel) ((ComponentCloneListener) clone._model).willClone(clone); if (model != null) clone._model = model; } clone._dataListener = null; clone.initDataListener(); } return clone; }