Class ProgressReporterPanel

    • 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 specified
      org.eclipse.swt.graphics.Point computeSize​(int hint, int hint2, boolean changed)  
      private void createControls​(IProgressReport pReport)
      Creates all the controls for the panel
      private void createDetailSection​(IProgressReport pReport)
      Below the panel, taking up the entire width of the window, is the detail section
      private java.lang.String formatForDisplay​(java.lang.String string)
      Formats the string so it displays properly in an SWT text control
      IProgressReporter getProgressReporter()
      Returns the attached reporter
      int getStyle()  
      private int handleEvents​(IProgressReport pReport)
      Process the event from the given ProgressReport
      private void initControls​(IProgressReport pReport)
      Initialize the controls with information from the given IProgressReport
      void removeTwistieListener​(ITwistieListener listener)  
      int report​(IProgressReport pReport)
      Call-back method from IProgressReporterListener; this method is called when ever the reporter dispatches an event
      void resizeContent()
      Resizes the content of this panel to fit within the shell and to layout children control appropriately
      private void resizeContentSupport()  
      private void resizeDetailSection()
      Ensure that the detail does not take up too much vertical space
      private boolean showActionLabel​(org.eclipse.swt.widgets.Label label, boolean showIt)
      Convenience method for showing or hiding a label by setting its GridData.widthHint
      private boolean synchActionLabels​(IProgressReport pReport)
      Display the appropriate text for the action labels based on what action can be taken
      private void synchProgressBar​(IProgressReport pReport)
      Synchronize the progress bar with the given IProgressReport
      private void updateStatusLabel​(java.lang.String text, boolean showAsError)
      Sets the defined color to the given label
      • 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
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
    • Field Detail

      • normalColor

        private org.eclipse.swt.graphics.Color normalColor
      • errorColor

        private org.eclipse.swt.graphics.Color errorColor
      • 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
      • progressPanel

        private org.eclipse.swt.widgets.Composite progressPanel
      • 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
    • 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 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 Detail

      • 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​(java.lang.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 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 - 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