org.cafesip.gwtcomp.server
Class SimpleLiveDataSource

java.lang.Object
  extended by org.cafesip.gwtcomp.server.SimpleLiveDataSource
All Implemented Interfaces:
LiveDataSource

public class SimpleLiveDataSource
extends Object
implements LiveDataSource

This class implements a simple live data source that can be used for demonstration purposes.

Author:
Amit Chatterjee

Nested Class Summary
static class SimpleLiveDataSource.LiveDataStrategy
          Enumerates the data-generation strategy.
 
Constructor Summary
SimpleLiveDataSource()
          A constructor for this class.
 
Method Summary
 void close(Principal user, HttpSession session, LiveDataSessionInfo sessionData)
          This method is invoked by the LiveDataServiceImpl servlet to information the data source that the session is closed.
 ChartInitData getChartInfoAndInitialData(Principal user, HttpSession session, LiveDataSessionInfo sessionData)
          This method is invoked by the LiveDataServiceImpl servlet when the chart is intialized at the client-side.
 ChartData getNextData(Principal user, HttpSession session, LiveDataSessionInfo sessionData)
          This method is invoked by the LiveDataServiceImpl servlet periodically to retrieve data that is used to refresh the live data panel.
 int getNumSeries()
           
 double getRangeBottom()
           
 double getRangeTop()
           
 long getRefreshInterval()
           
 String[] getSeriesNames()
           
 SimpleLiveDataSource.LiveDataStrategy getStrategy()
           
 String getTitle()
           
 void setBottomRange(double rangeBottom)
           
 void setNumSeries(int numSeries)
           
 void setRangeTop(double rangeTop)
           
 void setRefreshInterval(long refreshInterval)
           
 void setSeriesNames(String[] seriesNames)
           
 void setStrategy(SimpleLiveDataSource.LiveDataStrategy strategy)
           
 void setTitle(String title)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SimpleLiveDataSource

public SimpleLiveDataSource()
A constructor for this class.

Method Detail

getChartInfoAndInitialData

public ChartInitData getChartInfoAndInitialData(Principal user,
                                                HttpSession session,
                                                LiveDataSessionInfo sessionData)
Description copied from interface: LiveDataSource
This method is invoked by the LiveDataServiceImpl servlet when the chart is intialized at the client-side. The method must return a ChartInitData object that specifies the property of the chart and the initial data. The client-side of the application displays the chart and the data accordingly.

Specified by:
getChartInfoAndInitialData in interface LiveDataSource
Parameters:
user - the user who is displaying the live data panel. The parameter has a null value of the user has not been authenticated by the servlet container.
session - the HTTPSession object is passed so that you application can use session-scope variables to maintain states.
sessionData - Session data.
Returns:
the ChartInitData object

getNextData

public ChartData getNextData(Principal user,
                             HttpSession session,
                             LiveDataSessionInfo sessionData)
Description copied from interface: LiveDataSource
This method is invoked by the LiveDataServiceImpl servlet periodically to retrieve data that is used to refresh the live data panel. The method returns the ChartData object that contains the data.

Specified by:
getNextData in interface LiveDataSource
Parameters:
user - the user who is displaying the live data panel. The parameter has a null value of the user has not been authenticated by the servlet container.
session - the HTTPSession object is passed so that you application can use session-scope variables to maintain states.
sessionData - Information on the session.
Returns:
the chart data

getStrategy

public SimpleLiveDataSource.LiveDataStrategy getStrategy()
Returns:
Returns the strategy.

setStrategy

public void setStrategy(SimpleLiveDataSource.LiveDataStrategy strategy)
Parameters:
strategy - The strategy to set.

getNumSeries

public int getNumSeries()
Returns:
Returns the numSeries.

setNumSeries

public void setNumSeries(int numSeries)
Parameters:
numSeries - The numSeries to set.

getRangeTop

public double getRangeTop()
Returns:
Returns the rangeTop.

setRangeTop

public void setRangeTop(double rangeTop)
Parameters:
rangeTop - The rangeTop to set.

getRangeBottom

public double getRangeBottom()
Returns:
Returns the rangeBottom.

setBottomRange

public void setBottomRange(double rangeBottom)
Parameters:
rangeBottom - The rangeBottom to set.

getSeriesNames

public String[] getSeriesNames()
Returns:
Returns the seriesNames.

setSeriesNames

public void setSeriesNames(String[] seriesNames)
Parameters:
seriesNames - The seriesNames to set.

getTitle

public String getTitle()
Returns:
Returns the title.

setTitle

public void setTitle(String title)
Parameters:
title - The title to set.

getRefreshInterval

public long getRefreshInterval()
Returns:
Returns the refreshInterval.

setRefreshInterval

public void setRefreshInterval(long refreshInterval)
Parameters:
refreshInterval - The refreshInterval to set.

close

public void close(Principal user,
                  HttpSession session,
                  LiveDataSessionInfo sessionData)
Description copied from interface: LiveDataSource
This method is invoked by the LiveDataServiceImpl servlet to information the data source that the session is closed. This gives the application a chance to perform cleanup.

Specified by:
close in interface LiveDataSource
Parameters:
user - the user who is displaying the live data panel. The parameter has a null value of the user has not been authenticated by the servlet container.
session - the HTTPSession object is passed so that you application can use session-scope variables to maintain states.
sessionData - Information on the session.


Copyright © 2010 Cafesip.org. All Rights Reserved.