60 lines
1.8 KiB
Java
60 lines
1.8 KiB
Java
package com.flaremicro.visualforecast.api;
|
|
|
|
import com.flaremicro.visualforecast.PropertyManager;
|
|
import com.flaremicro.visualforecast.RenderPanel;
|
|
import com.flaremicro.visualforecast.forecast.ForecastDetails;
|
|
|
|
public abstract class ForecastProvider {
|
|
ForecastProviderManager forecastProviderManager;
|
|
/**
|
|
* Initialize the provider. This is called in a separate thread to any other function call.
|
|
* The VisualForecast 1000 software will wait on the BootupDisplay until this function completes.
|
|
*/
|
|
public abstract void init();
|
|
|
|
/**
|
|
* Get the current forecast.
|
|
* This should delay as little as possible, as this is called in the main action thread.
|
|
*
|
|
* @return ForecastDetails
|
|
*/
|
|
public abstract ForecastDetails getForecast();
|
|
|
|
/**
|
|
* Should generally be true unless forecast information is collected somewhere other than init.
|
|
* In the case that forecast information is still unavailable by the time this is called,
|
|
* this should return false and upon completion and state change, should notify listeners by calling
|
|
* notifyForecastProviderUpdate()
|
|
* @return
|
|
*/
|
|
public abstract boolean isForecastReady();
|
|
|
|
public abstract void deinit();
|
|
|
|
public final void notifyForecastProviderUpdate()
|
|
{
|
|
getRenderPanel().notifyForecastProviderUpdate();
|
|
}
|
|
|
|
public final ForecastProviderManager getManager()
|
|
{
|
|
return forecastProviderManager;
|
|
}
|
|
|
|
public final RenderPanel getRenderPanel()
|
|
{
|
|
return forecastProviderManager.getRenderPanel();
|
|
}
|
|
|
|
/**
|
|
* Gets a property manager specific to the forecast provider.
|
|
* The property manager is already loaded.
|
|
* @return
|
|
*/
|
|
public PropertyManager getOwnPropertyManager() {
|
|
PropertyManager propertyManager = new PropertyManager(forecastProviderManager.getProviderName(this));
|
|
propertyManager.load();
|
|
return propertyManager;
|
|
}
|
|
}
|