Class ProgressReporterWindow
java.lang.Object
com.biglybt.ui.swt.progress.ProgressReporterWindow
- All Implemented Interfaces:
IProgressReportConstants, ITwistieListener, EventListener, org.eclipse.swt.events.DisposeListener
public class ProgressReporterWindow
extends Object
implements IProgressReportConstants, ITwistieListener, org.eclipse.swt.events.DisposeListener
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionprivate classListener to reporters so we can remove the correspondingProgressReporterPanelis the optionisAutoRemove=true -
Field Summary
FieldsModifier and TypeFieldDescription(package private) static final intSet initial size and layout for the window then open it(package private) static intprivate intThe default width for the shell upon first openingprivate intThe maximum number of panels to show when the window first openprivate booleanConvenience variable tied to the parameter "auto_remove_inactive_items"private static booleanA 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(package private) static LinkedList<ProgressReporterWindow> private IProgressReporter[]private static final ArrayListA registry to keep track of all reporters that are being displayed in all instances of this window.private org.eclipse.swt.custom.ScrolledCompositeprivate org.eclipse.swt.widgets.Compositeprivate org.eclipse.swt.widgets.Shellprivate intThe style bits to use for this panelFields inherited from interface 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
ConstructorsModifierConstructorDescriptionprivateProgressReporterWindow(IProgressReporter[] pReporters, int style) Construct a singleProgressReporterWindowshowing allProgressReporter's in the given arrayprivateProgressReporterWindow(IProgressReporter pReporter, int style) Construct aProgressReporterWindowfor a singleProgressReporter -
Method Summary
Modifier and TypeMethodDescriptionprivate voidprivate voidCreates just an empty panel with a message indicating there are no reports to displayprivate voidprivate voidCreates a the toolbar at the bottom of the windowprivate voidformatLastPanel(ProgressReporterPanel panelToIgnore) Formats the lastProgressReporterPanelin the window to extend to the bottom of the window.intgetStyle()voidisCollapsed(boolean value) When anyProgressReporterPanelin this window is expanded or collapsed re-layout the controls and window appropriatelystatic booleanisOpened(IProgressReporter pReporter) Returns whether the givenIProgressReporteris 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 booleanReturns whether this window is already opened and is showing the empty panelstatic voidopen(IProgressReporter[] pReporters, int style) Opens the window and display the given array ofIProgressReporter'sstylecould 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 voidopen(IProgressReporter pReporter, int style) Opens the window and display the givenIProgressReporterstylecould 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 voidprivate voidRemoves all panels whose reporter is no longer activeprivate voidremoveReporter(IProgressReporter reporter) Remove the givenIProgressReporterfrom thepReportersarray; resize the array if requiredvoidwidgetDisposed(org.eclipse.swt.events.DisposeEvent e) When anyProgressReporterPanelin this window is disposed re-layout the controls and window appropriately
-
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
-
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 isShowingEmptyA 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 defaultShellWidthThe default width for the shell upon first opening -
initialMaxNumberOfPanels
private int initialMaxNumberOfPanelsThe maximum number of panels to show when the window first open -
style
private int styleThe style bits to use for this panel -
isAutoRemove
private boolean isAutoRemoveConvenience variable tied to the parameter "auto_remove_inactive_items" -
ACTIVE_WINDOW_LIMIT
static final int ACTIVE_WINDOW_LIMITSet initial size and layout for the window then open it- See Also:
-
active_windows
static int active_windows -
pending_windows
-
-
Constructor Details
-
ProgressReporterWindow
Construct aProgressReporterWindowfor a singleProgressReporter- Parameters:
pReporter-
-
ProgressReporterWindow
Construct a singleProgressReporterWindowshowing allProgressReporter's in the given array- Parameters:
pReporters-
-
-
Method Details
-
open
Opens the window and display the givenIProgressReporterstylecould 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
Opens the window and display the given array ofIProgressReporter'sstylecould 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
Returns whether the givenIProgressReporteris 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
Formats the lastProgressReporterPanelin 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
Remove the givenIProgressReporterfrom thepReportersarray; resize the array if required- Parameters:
reporter-
-
isCollapsed
public void isCollapsed(boolean value) When anyProgressReporterPanelin this window is expanded or collapsed re-layout the controls and window appropriately- Specified by:
isCollapsedin interfaceITwistieListener- Parameters:
value-
-
widgetDisposed
public void widgetDisposed(org.eclipse.swt.events.DisposeEvent e) When anyProgressReporterPanelin this window is disposed re-layout the controls and window appropriately- Specified by:
widgetDisposedin interfaceorg.eclipse.swt.events.DisposeListener
-