Package com.biglybt.ui.swt.progress
Class ProgressReporterWindow
- java.lang.Object
-
- com.biglybt.ui.swt.progress.ProgressReporterWindow
-
- All Implemented Interfaces:
IProgressReportConstants
,ITwistieListener
,java.util.EventListener
,org.eclipse.swt.events.DisposeListener
,org.eclipse.swt.internal.SWTEventListener
public class ProgressReporterWindow extends java.lang.Object implements IProgressReportConstants, ITwistieListener, org.eclipse.swt.events.DisposeListener
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description private class
ProgressReporterWindow.AutoRemoveListener
Listener to reporters so we can remove the correspondingProgressReporterPanel
is the optionisAutoRemove
=true
-
Field Summary
Fields Modifier and Type Field Description private int
defaultShellWidth
The default width for the shell upon first openingprivate int
initialMaxNumberOfPanels
The maximum number of panels to show when the window first openprivate boolean
isAutoRemove
Convenience variable tied to the parameter "auto_remove_inactive_items"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 withprivate IProgressReporter[]
pReporters
private static java.util.ArrayList
reportersRegistry
A registry to keep track of all reporters that are being displayed in all instances of this window.private org.eclipse.swt.custom.ScrolledComposite
scrollable
private org.eclipse.swt.widgets.Composite
scrollChild
private org.eclipse.swt.widgets.Shell
shell
private int
style
The style bits to use for this panel-
Fields inherited from interface com.biglybt.ui.swt.progress.IProgressReportConstants
AUTO_CLOSE, BORDER, MANAGER_EVENT_ADDED, MANAGER_EVENT_REMOVED, MANAGER_EVENT_UPDATED, MODAL, MSG_TYPE_ERROR, MSG_TYPE_INFO, MSG_TYPE_LOG, NONE, REPORT_TYPE_CANCEL, REPORT_TYPE_DISPOSED, REPORT_TYPE_DONE, REPORT_TYPE_ERROR, REPORT_TYPE_INIT, REPORT_TYPE_MODE_CHANGE, REPORT_TYPE_PROPERTY_CHANGED, REPORT_TYPE_RETRY, REPORTER_TYPE_DEFAULT, REPORTER_VISIBILITY_SYSTEM, REPORTER_VISIBILITY_USER, RETVAL_OK, RETVAL_OK_TO_DISPOSE, SHOW_TOOLBAR, STANDALONE
-
-
Constructor Summary
Constructors Modifier Constructor Description private
ProgressReporterWindow(IProgressReporter[] pReporters, int style)
Construct a singleProgressReporterWindow
showing allProgressReporter
's in the given arrayprivate
ProgressReporterWindow(IProgressReporter pReporter, int style)
Construct aProgressReporterWindow
for a singleProgressReporter
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description private void
createControls()
private void
createEmptyPanel()
Creates just an empty panel with a message indicating there are no reports to displayprivate void
createPanels()
private void
createToolbar()
Creates a the toolbar at the bottom of the windowprivate void
formatLastPanel(ProgressReporterPanel panelToIgnore)
Formats the lastProgressReporterPanel
in the window to extend to the bottom of the window.void
isCollapsed(boolean value)
When anyProgressReporterPanel
in this window is expanded or collapsed re-layout the controls and window appropriatelystatic boolean
isOpened(IProgressReporter pReporter)
Returns whether the givenIProgressReporter
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.static boolean
isShowingEmpty()
Returns whether this window is already opened and is showing the empty panelstatic void
open(IProgressReporter[] pReporters, int style)
Opens the window and display the given array ofIProgressReporter
'sstyle
could be one or more of these:IProgressReportConstants.NONE
-- the defaultIProgressReportConstants.AUTO_CLOSE
-- automatically disposes this panel when the given reporter is doneIProgressReportConstants.MODAL
-- this window will be application modalIProgressReportConstants.SHOW_TOOLBAR
-- shows the toolbar for removing inactive reportersstatic void
open(IProgressReporter pReporter, int style)
Opens the window and display the givenIProgressReporter
style
could be one or more of these:IProgressReportConstants.NONE
-- the defaultIProgressReportConstants.AUTO_CLOSE
-- automatically disposes this panel when the given reporter is doneIProgressReportConstants.MODAL
-- this window will be application modalIProgressReportConstants.SHOW_TOOLBAR
-- shows the toolbar for removing inactive reportersprivate void
openWindow()
Set initial size and layout for the window then open itprivate void
removeInActivePanels()
Removes all panels whose reporter is no longer activeprivate void
removeReporter(IProgressReporter reporter)
Remove the givenIProgressReporter
from thepReporters
array; resize the array if requiredvoid
widgetDisposed(org.eclipse.swt.events.DisposeEvent e)
When anyProgressReporterPanel
in this window is disposed re-layout the controls and window appropriately
-
-
-
Field Detail
-
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 java.util.ArrayList reportersRegistry
A registry to keep track of all reporters that are being displayed in all instances of this window.- See Also:
isOpened(IProgressReporter)
-
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"
-
-
Constructor Detail
-
ProgressReporterWindow
private ProgressReporterWindow(IProgressReporter pReporter, int style)
Construct aProgressReporterWindow
for a singleProgressReporter
- Parameters:
pReporter
-
-
ProgressReporterWindow
private ProgressReporterWindow(IProgressReporter[] pReporters, int style)
Construct a singleProgressReporterWindow
showing allProgressReporter
's in the given array- Parameters:
pReporters
-
-
-
Method Detail
-
open
public static void open(IProgressReporter pReporter, int style)
Opens the window and display the givenIProgressReporter
style
could be one or more of these:IProgressReportConstants.NONE
-- the defaultIProgressReportConstants.AUTO_CLOSE
-- automatically disposes this panel when the given reporter is doneIProgressReportConstants.MODAL
-- this window will be application modalIProgressReportConstants.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 ofIProgressReporter
'sstyle
could be one or more of these:IProgressReportConstants.NONE
-- the defaultIProgressReportConstants.AUTO_CLOSE
-- automatically disposes this panel when the given reporter is doneIProgressReportConstants.MODAL
-- this window will be application modalIProgressReportConstants.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 givenIProgressReporter
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()
Set initial size and layout for the window then open it
-
createPanels
private void createPanels()
-
formatLastPanel
private void formatLastPanel(ProgressReporterPanel panelToIgnore)
Formats the lastProgressReporterPanel
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 givenIProgressReporter
from thepReporters
array; resize the array if required- Parameters:
reporter
-
-
isCollapsed
public void isCollapsed(boolean value)
When anyProgressReporterPanel
in this window is expanded or collapsed re-layout the controls and window appropriately- Specified by:
isCollapsed
in interfaceITwistieListener
-
widgetDisposed
public void widgetDisposed(org.eclipse.swt.events.DisposeEvent e)
When anyProgressReporterPanel
in this window is disposed re-layout the controls and window appropriately- Specified by:
widgetDisposed
in interfaceorg.eclipse.swt.events.DisposeListener
-
-