
com.extjs.gxt.charts.client.model.DataProvider Maven / Gradle / Ivy
/*
* Ext GWT - Ext for GWT
* Copyright(c) 2007-2009, Ext JS, LLC.
* [email protected]
*
* http://extjs.com/license
*/
package com.extjs.gxt.charts.client.model;
import com.extjs.gxt.charts.client.Chart;
import com.extjs.gxt.charts.client.ChartManager;
import com.extjs.gxt.charts.client.model.charts.ChartConfig;
import com.extjs.gxt.ui.client.data.ModelData;
import com.extjs.gxt.ui.client.data.ModelStringProvider;
import com.extjs.gxt.ui.client.store.ListStore;
import com.extjs.gxt.ui.client.store.StoreEvent;
import com.extjs.gxt.ui.client.store.StoreListener;
/**
* Base class for objects that provide chart data form models in a store.
*/
public abstract class DataProvider {
protected ChartConfig chartConfig;
protected String labelProperty, textProperty;
protected ModelStringProvider labelProvider, textProvider;
protected ListStore store;
protected double maxYValue, minYValue;
private String chartId;
private StoreListener storeListener;
/**
* Creates a new data provider.
*/
public DataProvider() {
storeListener = new StoreListener() {
@Override
public void handleEvent(StoreEvent e) {
onStoreChange(e);
}
};
}
/**
* Binds the data provider the the given store.
*
* @param store the store
*/
@SuppressWarnings("unchecked")
public void bind(ListStore store) {
if (this.store != null) {
this.store.removeStoreListener(storeListener);
}
this.store = store;
this.store.addStoreListener(storeListener);
}
public abstract void populateData(ChartConfig config);
protected String getLabel(ModelData model, String valueProperty) {
String label = null;
if (labelProperty != null) {
Object o = model.
© 2015 - 2025 Weber Informatics LLC | Privacy Policy