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
Fields Modifier and Type Field Description private org.eclipse.swt.widgets.Label
actionLabel_cancel
private org.eclipse.swt.widgets.Label
actionLabel_remove
private org.eclipse.swt.widgets.Label
actionLabel_retry
private org.eclipse.swt.custom.StyledText
detailListWidget
private TwistieSection
detailSection
private org.eclipse.swt.layout.GridData
detailSectionData
(package private) FrequencyLimitedDispatcher
disp
private org.eclipse.swt.graphics.Color
errorColor
private org.eclipse.swt.widgets.Label
imageLabel
private java.lang.String
lastStatusError
we persist the last error to avoid it being overwritten by subsequent non-error messagesprivate int
maxPreferredDetailPanelHeight
The height of the detail panel when the window first appears.private int
maxPreferredDetailPanelHeight_Standalone
The preferred maximum height for the detail section on initializationprivate int
maxPreferredWidth
The preferred maximum width for the panel.private org.eclipse.swt.widgets.Label
nameLabel
private org.eclipse.swt.graphics.Color
normalColor
private AZProgressBar
pBar
IProgressReporter
pReporter
private org.eclipse.swt.widgets.Composite
progressPanel
private org.eclipse.swt.widgets.Label
statusLabel
private int
style
-
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 Constructor Description ProgressReporterPanel(org.eclipse.swt.widgets.Composite parent, IProgressReporter reporter, int style)
Create a panel for the given reporter.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addTwistieListener(ITwistieListener listener)
private void
appendToDetail(java.lang.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 java.lang.String
formatForDisplay(java.lang.String string)
Formats the string so it displays properly in an SWT text controlIProgressReporter
getProgressReporter()
Returns 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
resizeContent()
Resizes the content of this panel to fit within the shell and to layout children control appropriatelyprivate void
resizeContentSupport()
private void
resizeDetailSection()
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(java.lang.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
-
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, toString
-
-
-
-
Field Detail
-
normalColor
private org.eclipse.swt.graphics.Color normalColor
-
errorColor
private org.eclipse.swt.graphics.Color errorColor
-
pReporter
public IProgressReporter 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
private AZProgressBar pBar
-
progressPanel
private org.eclipse.swt.widgets.Composite progressPanel
-
detailSection
private TwistieSection 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 maxPreferredDetailPanelHeight
The 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_Standalone
The preferred maximum height for the detail section on initialization
-
maxPreferredWidth
private int maxPreferredWidth
The 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
private java.lang.String lastStatusError
we persist the last error to avoid it being overwritten by subsequent non-error messages
-
disp
FrequencyLimitedDispatcher disp
-
-
Constructor Detail
-
ProgressReporterPanel
public ProgressReporterPanel(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 Detail
-
report
public int report(IProgressReport pReport)
Call-back method fromIProgressReporterListener
; this method is called when ever the reporter dispatches an event- Specified by:
report
in interfaceIProgressReporterListener
- Returns:
-
createControls
private void createControls(IProgressReport pReport)
Creates all the controls for the panel- Parameters:
pReport
-
-
initControls
private void initControls(IProgressReport pReport)
Initialize the controls with information from the givenIProgressReport
- Parameters:
pReport
-
-
createDetailSection
private void createDetailSection(IProgressReport pReport)
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
private int handleEvents(IProgressReport pReport)
Process the event from the givenProgressReport
- Parameters:
pReport
-
-
synchProgressBar
private void synchProgressBar(IProgressReport pReport)
Synchronize the progress bar with the givenIProgressReport
- Parameters:
pReport
-
-
updateStatusLabel
private void updateStatusLabel(java.lang.String text, boolean showAsError)
Sets the defined color to the givenlabel
- Parameters:
label
-text
-showAsError
-true
to show as error;false
otherwise
-
synchActionLabels
private boolean synchActionLabels(IProgressReport pReport)
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
private java.lang.String formatForDisplay(java.lang.String string)
Formats the string so it displays properly in an SWT text control- Parameters:
string
-- Returns:
-
addTwistieListener
public void addTwistieListener(ITwistieListener listener)
-
removeTwistieListener
public void removeTwistieListener(ITwistieListener listener)
-
appendToDetail
private void appendToDetail(java.lang.String value, boolean isError)
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
public IProgressReporter getProgressReporter()
Returns the attached reporter- Returns:
-
getStyle
public int getStyle()
- Overrides:
getStyle
in classorg.eclipse.swt.widgets.Widget
-
-