java.lang.Object
java.awt.Component
java.awt.Container
javax.swing.JComponent
javax.swing.JPanel
org.jfree.chart.ChartPanel
com.inductiveautomation.factorypmi.application.components.chart.PMIChartPanel
All Implemented Interfaces:
LocaleListener, ComponentLifecycle, ExtensibleComponent, QualityMonitor, VisionComponent, ActionListener, MouseListener, MouseMotionListener, ImageObserver, MenuContainer, Printable, Serializable, EventListener, Accessible, org.jfree.chart.event.ChartChangeListener, org.jfree.chart.event.ChartProgressListener
Direct Known Subclasses:
AbstractVisionChartComponent, PMIBarChart, PMIBoxWhiskerChart, PMIGanttChart, PMILineChartPanel, PMIPieChart, PMIStatusChart

public class PMIChartPanel extends org.jfree.chart.ChartPanel implements VisionComponent, LocaleListener, ExtensibleComponent
A subclass of JFreeChart's ChartPanel that overrides doSaveAs() and createChartPrintJob() to have FPMI compatible popup windows for FSE mode.
See Also:
  • Field Details

    • context

      protected VisionClientContext context
      The current ClientContext that is set on startupComponent()
    • cursorCode

      protected int cursorCode
    • antialias

      protected boolean antialias
    • extensionFunctions

      protected Map<String,ExtensionFunction> extensionFunctions
    • properties

      protected boolean properties
    • save

      protected boolean save
    • print

      protected boolean print
    • zoom

      protected boolean zoom
    • showPopup

      protected boolean showPopup
  • Constructor Details

    • PMIChartPanel

      public PMIChartPanel(org.jfree.chart.JFreeChart chart)
    • PMIChartPanel

      public PMIChartPanel(org.jfree.chart.JFreeChart chart, int minimumDrawWidth, int minimumDrawHeight)
    • PMIChartPanel

      public PMIChartPanel(org.jfree.chart.JFreeChart chart, boolean properties, boolean save, boolean print, boolean zoom, boolean tooltips)
    • PMIChartPanel

      public PMIChartPanel(org.jfree.chart.JFreeChart chart, boolean properties, boolean save, boolean print, boolean zoom, boolean tooltips, int minimumDrawWidth, int minimumDrawHeight)
    • PMIChartPanel

      public PMIChartPanel(org.jfree.chart.JFreeChart chart, int width, int height, int minimumDrawWidth, int minimumDrawHeight, int maximumDrawWidth, int maximumDrawHeight, boolean useBuffer, boolean properties, boolean save, boolean print, boolean zoom, boolean tooltips)
  • Method Details

    • getCursorCode

      public int getCursorCode()
    • setCursorCode

      public void setCursorCode(int cursorCode)
    • isShowPopup

      public boolean isShowPopup()
    • setShowPopup

      public void setShowPopup(boolean showPopup)
    • setVisible

      public void setVisible(boolean visible)
      Overrides:
      setVisible in class JComponent
    • setName

      public void setName(String newName)
      Overrides:
      setName in class Component
    • getToolTipText

      public String getToolTipText()
      Overrides:
      getToolTipText in class JComponent
    • getToolTipText

      public String getToolTipText(MouseEvent event)
      Overrides:
      getToolTipText in class org.jfree.chart.ChartPanel
    • isAntialias

      public boolean isAntialias()
    • setAntialias

      public void setAntialias(boolean ignored)
    • doSaveAs

      public void doSaveAs() throws IOException
      Opens a file chooser and gives the user an opportunity to save the chart in PNG format.
      Overrides:
      doSaveAs in class org.jfree.chart.ChartPanel
      Throws:
      IOException - if there is an I/O error.
    • print

      public void print()
    • createChartPrintJob

      public void createChartPrintJob()
      Creates a print job for the chart.
      Overrides:
      createChartPrintJob in class org.jfree.chart.ChartPanel
    • translate

      protected String translate(String key)
    • translateTerm

      protected String translateTerm(String term)
    • createPopupMenu

      protected JPopupMenu createPopupMenu(boolean properties, boolean save, boolean print, boolean zoom)
      Creates a popup menu for the panel. Overridden here to get the localized properties from BundleUtil.
      Overrides:
      createPopupMenu in class org.jfree.chart.ChartPanel
      Parameters:
      properties - include a menu item for the chart property editor.
      save - include a menu item for saving the chart.
      print - include a menu item for printing the chart.
      zoom - include menu items for zooming.
      Returns:
      The popup menu.
    • getQuality

      public QualityCode getQuality()
      Description copied from interface: QualityMonitor
      Retrieves the data quality code.
      Specified by:
      getQuality in interface QualityMonitor
    • getDataQuality

      public int getDataQuality()
      Description copied from interface: QualityMonitor
      For backwards compatibility with scripts. Would be awesome if this could just be a default method, but there's a bug (JDK-8071693) that makes that not work with property introspection.
      Specified by:
      getDataQuality in interface QualityMonitor
    • setDataQuality

      public void setDataQuality(int value)
      Specified by:
      setDataQuality in interface QualityMonitor
    • setQuality

      public void setQuality(QualityCode value)
      Description copied from interface: QualityMonitor
      Sets the current data quality to the given value
      Specified by:
      setQuality in interface QualityMonitor
    • updateQuality

      public void updateQuality(String propName, QualityCode quality)
      Description copied from interface: QualityMonitor
      Updates the quality for the given property name. The monitor will then evaluate a new quality based on the quality of its other properties. Overall, the worst quality is chosen.
      Specified by:
      updateQuality in interface QualityMonitor
    • paintChildren

      protected void paintChildren(Graphics g)
      Overrides:
      paintChildren in class JComponent
    • startupComponent

      public final void startupComponent(VisionClientContext context)
      Description copied from interface: ComponentLifecycle
      Called when the component is first shown.
      Specified by:
      startupComponent in interface ComponentLifecycle
    • shutdownComponent

      public final void shutdownComponent()
      Description copied from interface: ComponentLifecycle
      Called when the component is now shown anymore. Any long-running processes should be stopped. All bindings will have also been shutdown.
      Specified by:
      shutdownComponent in interface ComponentLifecycle
    • getAppContext

      public VisionClientContext getAppContext()
      Specified by:
      getAppContext in interface ComponentLifecycle
    • onStartup

      protected void onStartup()
      Subclasses should override this to provide startup logic.
    • onShutdown

      protected void onShutdown()
      Subclasses should override this to provide shutdown logic.
    • displayPopupMenu

      protected void displayPopupMenu(int x, int y)
      The idea is to modify the zooming options depending on the type of chart being displayed by the panel.
      Overrides:
      displayPopupMenu in class org.jfree.chart.ChartPanel
      Parameters:
      x - horizontal position of the popup.
      y - vertical position of the popup.
    • localeChanged

      public void localeChanged(Locale newLocale)
      Specified by:
      localeChanged in interface LocaleListener
    • getScientificNumberFormat

      protected NumberFormat getScientificNumberFormat()
      Returns:
      A ScientificNumberFormat instance with significant digits of SIG_DIGITS and threshold of THRESHOLD.
    • getExtensionFunctions

      public Map<String,ExtensionFunction> getExtensionFunctions()
      Specified by:
      getExtensionFunctions in interface ExtensibleComponent
    • setExtensionFunctions

      public void setExtensionFunctions(Map<String,ExtensionFunction> map)
      Specified by:
      setExtensionFunctions in interface ExtensibleComponent