Class JPPFChartBuilder

All Implemented Interfaces:
ImageObserver, MenuContainer, Serializable, EventListener, Accessible, SwingConstants, StatsHandlerListener

public class JPPFChartBuilder extends JTabbedPane implements StatsHandlerListener
This class is used as a factory to create different charts, as well as for propagating the data updates to all defined charts.
Author:
Laurent Cohen
See Also:
  • Constructor Details

    • JPPFChartBuilder

      public JPPFChartBuilder()
      Initialize this charts builder.
  • Method Details

    • createChart

      public ChartConfiguration createChart(ChartConfiguration config, boolean preview)
      Create a chart based on a chart configuration.
      Parameters:
      config - holds the configuration parameters for the chart created, modified by this method.
      preview - determines whether the configuration should be added to the list of active configurations or not. A negative value means it's simply appended.
      Returns:
      the configuration with its created chart set.
    • addTab

      public void addTab(TabConfiguration tab)
      Remove a tab from the list of tabs.
      Parameters:
      tab - the configuration information for the tab to remove.
    • removeTab

      public void removeTab(TabConfiguration tab)
      Remove a tab from the list of tabs.
      Parameters:
      tab - the configuration information for the tab to remove.
    • addChart

      public void addChart(TabConfiguration tab, ChartConfiguration config)
      Add a chart to a tab.
      Parameters:
      tab - the tab to add a chart to.
      config - the chart to add.
    • removeChart

      public void removeChart(TabConfiguration tab, ChartConfiguration config)
      Remove a specified configuration from the list of active configurations.
      Parameters:
      tab - the configuration information for the tab containing the chart.
      config - the configuration to remove.
    • dataUpdated

      public void dataUpdated(StatsHandlerEvent event)
      Update the data displayed in the charts.
      Specified by:
      dataUpdated in interface StatsHandlerListener
      Parameters:
      event - holds the new stats values.
    • getTabbedPane

      public JTabbedPane getTabbedPane()
      Get the tabbed pane in which each pane contains user-defined charts.
      Returns:
      a JTabbedPane instance.
    • getTabList

      public List<TabConfiguration> getTabList()
      Get the list of active tabs in this chart builder.
      Returns:
      a list of tabs names.
    • getTabPanel

      public JPanel getTabPanel(String tabName)
      Get the tab chartPanel with the specified name.
      Parameters:
      tabName - the name of the tab to lookup.
      Returns:
      a JPanel instance.
    • createInitialCharts

      public void createInitialCharts()
      Create a set of default charts if none is defined.
    • getStorage

      public PreferencesStorage getStorage()
      Get the object used to store and retrieve the configuration, to and from the preferences tree.
      Returns:
      a PreferencesStorage object.
    • reset

      public void reset()
      Remove all chart configurationss and rebuild from the stored preferences.