public void onPageAttached(Page newpage, Page oldpage) { super.onPageAttached(newpage, oldpage); if (_model != null) { smartDrawChart(); if (_dataListener != null) { _model.removeChartDataListener(_dataListener); _model.addChartDataListener(_dataListener); } } }
public void onPageDetached(Page page) { super.onPageDetached(page); if (_model != null && _dataListener != null) _model.removeChartDataListener(_dataListener); } }
private void initDataListener() { if (_dataListener == null) { _dataListener = new MyChartDataListener(); _model.addChartDataListener(_dataListener); } }
/** 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(); }