Package com.biglybt.ui.swt.progress
Class ProgressReporterPanel
java.lang.Object
org.eclipse.swt.widgets.Widget
org.eclipse.swt.widgets.Control
org.eclipse.swt.widgets.Scrollable
org.eclipse.swt.widgets.Composite
com.biglybt.ui.swt.progress.ProgressReporterPanel
- All Implemented Interfaces:
IProgressReportConstants
,IProgressReporterListener
,org.eclipse.swt.graphics.Drawable
public class ProgressReporterPanel
extends org.eclipse.swt.widgets.Composite
implements IProgressReportConstants, IProgressReporterListener
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate org.eclipse.swt.widgets.Label
private org.eclipse.swt.widgets.Label
private org.eclipse.swt.widgets.Label
private org.eclipse.swt.custom.StyledText
private TwistieSection
private org.eclipse.swt.layout.GridData
(package private) FrequencyLimitedDispatcher
private org.eclipse.swt.graphics.Color
private org.eclipse.swt.widgets.Label
private String
we persist the last error to avoid it being overwritten by subsequent non-error messagesprivate int
The height of the detail panel when the window first appears.private int
The preferred maximum height for the detail section on initializationprivate int
The preferred maximum width for the panel.private org.eclipse.swt.widgets.Label
private org.eclipse.swt.graphics.Color
private AZProgressBar
private org.eclipse.swt.widgets.Composite
private org.eclipse.swt.widgets.Label
private int
private final ProgressReporterWindow
Fields inherited from class org.eclipse.swt.widgets.Composite
embeddedHandle
Fields inherited from class org.eclipse.swt.widgets.Widget
handle
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
ConstructorsConstructorDescriptionProgressReporterPanel
(ProgressReporterWindow _window, org.eclipse.swt.widgets.Composite parent, IProgressReporter reporter, int style) Create a panel for the given reporter. -
Method Summary
Modifier and TypeMethodDescriptionvoid
addTwistieListener
(ITwistieListener listener) private void
appendToDetail
(String value, boolean isError) Appends the given message to the detail panel; render the message in error color if specifiedorg.eclipse.swt.graphics.Point
computeSize
(int hint, int hint2, boolean changed) private void
createControls
(IProgressReport pReport) Creates all the controls for the panelprivate void
createDetailSection
(IProgressReport pReport) Below the panel, taking up the entire width of the window, is the detail sectionprivate String
formatForDisplay
(String string) Formats the string so it displays properly in an SWT text controlReturns the attached reporterint
getStyle()
private int
handleEvents
(IProgressReport pReport) Process the event from the givenProgressReport
private void
initControls
(IProgressReport pReport) Initialize the controls with information from the givenIProgressReport
void
removeTwistieListener
(ITwistieListener listener) int
report
(IProgressReport pReport) Call-back method fromIProgressReporterListener
; this method is called when ever the reporter dispatches an eventvoid
Resizes the content of this panel to fit within the shell and to layout children control appropriatelyprivate void
private void
Ensure that the detail does not take up too much vertical spaceprivate boolean
showActionLabel
(org.eclipse.swt.widgets.Label label, boolean showIt) Convenience method for showing or hiding a label by setting itsGridData.widthHint
private boolean
synchActionLabels
(IProgressReport pReport) Display the appropriate text for the action labels based on what action can be takenprivate void
synchProgressBar
(IProgressReport pReport) Synchronize the progress bar with the givenIProgressReport
private void
updateStatusLabel
(String text, boolean showAsError) Sets the defined color to the givenlabel
Methods inherited from class org.eclipse.swt.widgets.Composite
changed, checkSubclass, drawBackground, getBackgroundMode, getChildren, getLayout, getLayoutDeferred, getTabList, isLayoutDeferred, layout, layout, layout, layout, layout, setBackgroundMode, setFocus, setLayout, setLayoutDeferred, setTabList, toString
Methods inherited from class org.eclipse.swt.widgets.Scrollable
computeTrim, getClientArea, getHorizontalBar, getScrollbarsMode, getVerticalBar
Methods inherited from class org.eclipse.swt.widgets.Control
addControlListener, addDragDetectListener, addFocusListener, addGestureListener, addHelpListener, addKeyListener, addMenuDetectListener, addMouseListener, addMouseMoveListener, addMouseTrackListener, addMouseWheelListener, addPaintListener, addTouchListener, addTraverseListener, computeSize, dragDetect, dragDetect, forceFocus, getAccessible, getBackground, getBackgroundImage, getBorderWidth, getBounds, getCursor, getDragDetect, getEnabled, getFont, getForeground, getLayoutData, getLocation, getMenu, getMonitor, getOrientation, getParent, getRegion, getShell, getSize, getTextDirection, getToolTipText, getTouchEnabled, getVisible, internal_dispose_GC, internal_new_GC, isAutoScalable, isEnabled, isFocusControl, isReparentable, isVisible, moveAbove, moveBelow, pack, pack, print, redraw, redraw, removeControlListener, removeDragDetectListener, removeFocusListener, removeGestureListener, removeHelpListener, removeKeyListener, removeMenuDetectListener, removeMouseListener, removeMouseMoveListener, removeMouseTrackListener, removeMouseWheelListener, removePaintListener, removeTouchListener, removeTraverseListener, requestLayout, setBackground, setBackgroundImage, setBounds, setBounds, setCapture, setCursor, setDragDetect, setEnabled, setFont, setForeground, setLayoutData, setLocation, setLocation, setMenu, setOrientation, setParent, setRedraw, setRegion, setSize, setSize, setTextDirection, setToolTipText, setTouchEnabled, setVisible, toControl, toControl, toDisplay, toDisplay, traverse, traverse, traverse, update
Methods inherited from class org.eclipse.swt.widgets.Widget
addDisposeListener, addListener, checkWidget, dispose, getData, getData, getDisplay, getListeners, isAutoDirection, isDisposed, isListening, notifyListeners, removeDisposeListener, removeListener, removeListener, reskin, setData, setData
-
Field Details
-
window
-
normalColor
private org.eclipse.swt.graphics.Color normalColor -
errorColor
private org.eclipse.swt.graphics.Color errorColor -
pReporter
-
imageLabel
private org.eclipse.swt.widgets.Label imageLabel -
nameLabel
private org.eclipse.swt.widgets.Label nameLabel -
statusLabel
private org.eclipse.swt.widgets.Label statusLabel -
detailListWidget
private org.eclipse.swt.custom.StyledText detailListWidget -
detailSectionData
private org.eclipse.swt.layout.GridData detailSectionData -
pBar
-
progressPanel
private org.eclipse.swt.widgets.Composite progressPanel -
detailSection
-
style
private int style -
actionLabel_cancel
private org.eclipse.swt.widgets.Label actionLabel_cancel -
actionLabel_remove
private org.eclipse.swt.widgets.Label actionLabel_remove -
actionLabel_retry
private org.eclipse.swt.widgets.Label actionLabel_retry -
maxPreferredDetailPanelHeight
private int maxPreferredDetailPanelHeightThe height of the detail panel when the window first appears. This only takes effect when there is some detail messages to display and when that list of messages is too long; this value limits the height of the panel so that the window does not grow to take up too much of the screen in such instances. -
maxPreferredDetailPanelHeight_Standalone
private int maxPreferredDetailPanelHeight_StandaloneThe preferred maximum height for the detail section on initialization -
maxPreferredWidth
private int maxPreferredWidthThe preferred maximum width for the panel. When the longest line of the detail messages of the width of the title is too wide we use this limit to prevent the panel from taking up too much width; the user is still free to manually make the panel wider of narrower as desired -
lastStatusError
we persist the last error to avoid it being overwritten by subsequent non-error messages -
disp
-
-
Constructor Details
-
ProgressReporterPanel
public ProgressReporterPanel(ProgressReporterWindow _window, org.eclipse.swt.widgets.Composite parent, IProgressReporter reporter, int style) Create a panel for the given reporter.style
could be one or more of these:IProgressReportConstants.NONE
-- the defaultIProgressReportConstants.AUTO_CLOSE
-- automatically disposes this panel when the given reporter is doneIProgressReportConstants.STANDALONE
-- this panel will be hosted by itself in a window; the detail section of this panel will be given more heightIProgressReportConstants.BORDER
-- this panel will be hosted by itself in a window; the detail section of this panel will be given more height
- Parameters:
parent
- theComposite
hosting the panelreporter
- theIProgressReporter
to hoststyle
- one of the style bits listed above
-
-
Method Details
-
report
Call-back method fromIProgressReporterListener
; this method is called when ever the reporter dispatches an event- Specified by:
report
in interfaceIProgressReporterListener
- Parameters:
pReport
-- Returns:
-
createControls
Creates all the controls for the panel- Parameters:
pReport
-
-
initControls
Initialize the controls with information from the givenIProgressReport
- Parameters:
pReport
-
-
createDetailSection
Below the panel, taking up the entire width of the window, is the detail section -
resizeDetailSection
private void resizeDetailSection()Ensure that the detail does not take up too much vertical space -
computeSize
public org.eclipse.swt.graphics.Point computeSize(int hint, int hint2, boolean changed) - Overrides:
computeSize
in classorg.eclipse.swt.widgets.Control
-
handleEvents
Process the event from the givenProgressReport
- Parameters:
pReport
-
-
synchProgressBar
Synchronize the progress bar with the givenIProgressReport
- Parameters:
pReport
-
-
updateStatusLabel
Sets the defined color to the givenlabel
- Parameters:
text
-showAsError
-true
to show as error;false
otherwiselabel
-
-
synchActionLabels
Display the appropriate text for the action labels based on what action can be taken -
showActionLabel
private boolean showActionLabel(org.eclipse.swt.widgets.Label label, boolean showIt) Convenience method for showing or hiding a label by setting itsGridData.widthHint
- Parameters:
label
-showIt
-
-
resizeContent
public void resizeContent()Resizes the content of this panel to fit within the shell and to layout children control appropriately -
resizeContentSupport
private void resizeContentSupport() -
formatForDisplay
Formats the string so it displays properly in an SWT text control- Parameters:
string
-- Returns:
-
addTwistieListener
-
removeTwistieListener
-
appendToDetail
Appends the given message to the detail panel; render the message in error color if specified- Parameters:
value
-isError
- iftrue
then render the message in the system error color; otherwise render in default color
-
getProgressReporter
Returns the attached reporter- Returns:
-
getStyle
public int getStyle()- Overrides:
getStyle
in classorg.eclipse.swt.widgets.Widget
-