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 Details

    • window

      private final ProgressReporterWindow window
    • 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 String 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 default
      • IProgressReportConstants.AUTO_CLOSE -- automatically disposes this panel when the given reporter is done
      • IProgressReportConstants.STANDALONE -- this panel will be hosted by itself in a window; the detail section of this panel will be given more height
      • IProgressReportConstants.BORDER -- this panel will be hosted by itself in a window; the detail section of this panel will be given more height
      Parameters:
      parent - the Composite hosting the panel
      reporter - the IProgressReporter to host
      style - one of the style bits listed above
  • Method Details

    • report

      public int report(IProgressReport pReport)
      Call-back method from IProgressReporterListener; this method is called when ever the reporter dispatches an event
      Specified by:
      report in interface IProgressReporterListener
      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 given IProgressReport
      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 class org.eclipse.swt.widgets.Control
    • handleEvents

      private int handleEvents(IProgressReport pReport)
      Process the event from the given ProgressReport
      Parameters:
      pReport -
    • synchProgressBar

      private void synchProgressBar(IProgressReport pReport)
      Synchronize the progress bar with the given IProgressReport
      Parameters:
      pReport -
    • updateStatusLabel

      private void updateStatusLabel(String text, boolean showAsError)
      Sets the defined color to the given label
      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 its GridData.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 String formatForDisplay(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(String value, boolean isError)
      Appends the given message to the detail panel; render the message in error color if specified
      Parameters:
      value -
      isError - if true 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 class org.eclipse.swt.widgets.Widget