Class XProgressBarListener

  • All Implemented Interfaces:
    XProgressListener

    public class XProgressBarListener
    extends java.lang.Object
    implements XProgressListener
    This class implements a progress listener for controlling an attached Swing progress bar. The progress bar will then reflect the progress as received by this listener.
    Author:
    Christian W. Guenther (christian@deckfour.org)
    • Field Summary

      Fields 
      Modifier and Type Field Description
      protected javax.swing.JProgressBar progressBar
      Controlled progress bar.
      protected int startValue
      Start value to use in progress bar.
      protected int stopValue
      Stop value to use in progress bar.
    • Constructor Summary

      Constructors 
      Constructor Description
      XProgressBarListener​(javax.swing.JProgressBar progressBar)
      Creates a new progress bar listener with the specified progress bar for display.
      XProgressBarListener​(javax.swing.JProgressBar progressBar, int startValue, int stopValue)
      Creates a new progress bar listener with the specified progress bar for display.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      boolean isAborted()
      Checks whether the monitored process has been canceled.
      void updateProgress​(int progress, int maxProgress)
      Notifies the listener about progress being made.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • progressBar

        protected javax.swing.JProgressBar progressBar
        Controlled progress bar.
      • startValue

        protected int startValue
        Start value to use in progress bar. When the progress listener begins, this will be the displayed value on the progress bar.
      • stopValue

        protected int stopValue
        Stop value to use in progress bar. When the progress listener is completed, this will be the displayed value on the progress bar.
    • Constructor Detail

      • XProgressBarListener

        public XProgressBarListener​(javax.swing.JProgressBar progressBar)
        Creates a new progress bar listener with the specified progress bar for display. The progress bar will accurately and completely reflect the progress, as received by this listener.
        Parameters:
        progressBar - Progress bar to display progress.
      • XProgressBarListener

        public XProgressBarListener​(javax.swing.JProgressBar progressBar,
                                    int startValue,
                                    int stopValue)
        Creates a new progress bar listener with the specified progress bar for display. Allows the specification of start and stop values for the progress bar, so that this listener may control only part of a more higher-level progress (e.g., the loading of one from a number of files).
        Parameters:
        progressBar - Progress bar to display progress.
        startValue - When the progress listener begins, this will be the displayed value on the progress bar.
        stopValue - When the progress listener is completed, this will be the displayed value on the progress bar.
    • Method Detail

      • updateProgress

        public void updateProgress​(int progress,
                                   int maxProgress)
        Description copied from interface: XProgressListener
        Notifies the listener about progress being made.
        Specified by:
        updateProgress in interface XProgressListener
        Parameters:
        progress - Current progress step achieved.
        maxProgress - Maximal progress steps available.
      • isAborted

        public boolean isAborted()
        Checks whether the monitored process has been canceled.
        Specified by:
        isAborted in interface XProgressListener