Class ProgressReporterWindow

java.lang.Object
com.biglybt.ui.swt.progress.ProgressReporterWindow
All Implemented Interfaces:
IProgressReportConstants, ITwistieListener, EventListener, org.eclipse.swt.events.DisposeListener, org.eclipse.swt.internal.SWTEventListener

public class ProgressReporterWindow extends Object implements IProgressReportConstants, ITwistieListener, org.eclipse.swt.events.DisposeListener
  • Field Details

    • shell

      private org.eclipse.swt.widgets.Shell shell
    • scrollable

      private org.eclipse.swt.custom.ScrolledComposite scrollable
    • scrollChild

      private org.eclipse.swt.widgets.Composite scrollChild
    • pReporters

      private IProgressReporter[] pReporters
    • reportersRegistry

      private static final ArrayList reportersRegistry
      A registry to keep track of all reporters that are being displayed in all instances of this window.
      See Also:
    • isShowingEmpty

      private static boolean isShowingEmpty
      A special boolean to track whether this window is opened and is showing the empty panel; mainly used to prevent opening more than one of these window when there are no reporters to work with
    • defaultShellWidth

      private int defaultShellWidth
      The default width for the shell upon first opening
    • initialMaxNumberOfPanels

      private int initialMaxNumberOfPanels
      The maximum number of panels to show when the window first open
    • style

      private int style
      The style bits to use for this panel
    • isAutoRemove

      private boolean isAutoRemove
      Convenience variable tied to the parameter "auto_remove_inactive_items"
    • ACTIVE_WINDOW_LIMIT

      static final int ACTIVE_WINDOW_LIMIT
      Set initial size and layout for the window then open it
      See Also:
    • active_windows

      static int active_windows
    • pending_windows

      static LinkedList<ProgressReporterWindow> pending_windows
  • Constructor Details

    • ProgressReporterWindow

      private ProgressReporterWindow(IProgressReporter pReporter, int style)
      Construct a ProgressReporterWindow for a single ProgressReporter
      Parameters:
      pReporter -
    • ProgressReporterWindow

      private ProgressReporterWindow(IProgressReporter[] pReporters, int style)
      Construct a single ProgressReporterWindow showing all ProgressReporter's in the given array
      Parameters:
      pReporters -
  • Method Details

    • open

      public static void open(IProgressReporter pReporter, int style)
      Opens the window and display the given IProgressReporter style could be one or more of these:
      • IProgressReportConstants.NONE -- the default
      • IProgressReportConstants.AUTO_CLOSE -- automatically disposes this panel when the given reporter is done
      • IProgressReportConstants.MODAL -- this window will be application modal
      • IProgressReportConstants.SHOW_TOOLBAR -- shows the toolbar for removing inactive reporters
      Parameters:
      pReporter -
      style -
    • open

      public static void open(IProgressReporter[] pReporters, int style)
      Opens the window and display the given array of IProgressReporter's style could be one or more of these:
      • IProgressReportConstants.NONE -- the default
      • IProgressReportConstants.AUTO_CLOSE -- automatically disposes this panel when the given reporter is done
      • IProgressReportConstants.MODAL -- this window will be application modal
      • IProgressReportConstants.SHOW_TOOLBAR -- shows the toolbar for removing inactive reporters
      Parameters:
      pReporters -
      style -
    • isShowingEmpty

      public static boolean isShowingEmpty()
      Returns whether this window is already opened and is showing the empty panel
      Returns:
    • isOpened

      public static boolean isOpened(IProgressReporter pReporter)
      Returns whether the given IProgressReporter is opened in any instance of this window; processes can query this method before opening another window to prevent opening multiple windows for the same reporter. This is implemented explicitly instead of having the window automatically recycle instances because there are times when it is desirable to open a reporter in more than one instances of this window.
      Parameters:
      pReporter -
      Returns:
    • createControls

      private void createControls()
    • createToolbar

      private void createToolbar()
      Creates a the toolbar at the bottom of the window
    • removeInActivePanels

      private void removeInActivePanels()
      Removes all panels whose reporter is no longer active
    • createEmptyPanel

      private void createEmptyPanel()
      Creates just an empty panel with a message indicating there are no reports to display
    • openWindow

      private void openWindow()
    • getStyle

      public int getStyle()
    • createPanels

      private void createPanels()
    • formatLastPanel

      private void formatLastPanel(ProgressReporterPanel panelToIgnore)
      Formats the last ProgressReporterPanel in the window to extend to the bottom of the window. This method will iterate from the last panel backward to the first, skipping over the given panel.
      Parameters:
      panelToIgnore -
    • removeReporter

      private void removeReporter(IProgressReporter reporter)
      Remove the given IProgressReporter from the pReporters array; resize the array if required
      Parameters:
      reporter -
    • isCollapsed

      public void isCollapsed(boolean value)
      When any ProgressReporterPanel in this window is expanded or collapsed re-layout the controls and window appropriately
      Specified by:
      isCollapsed in interface ITwistieListener
      Parameters:
      value -
    • widgetDisposed

      public void widgetDisposed(org.eclipse.swt.events.DisposeEvent e)
      When any ProgressReporterPanel in this window is disposed re-layout the controls and window appropriately
      Specified by:
      widgetDisposed in interface org.eclipse.swt.events.DisposeListener