Class CmsProgressWidget

java.lang.Object
org.opencms.workplace.commons.CmsProgressWidget

public class CmsProgressWidget extends Object
This is a widget to be used in a dialog which should show a progress bar based on a list.

The progress bar uses Ajax to not reload the whole page. The code which runs inside the thread has to update the progress in the current thread.

The progress to be displayed is the progress of building large lists which can take some time until they are finished.

There is a progress bar shown with the percentages on the left. Additionaly it is possible to show a description above the progress bar.

Since:
7.0.0
See Also:
  • Field Details

  • Constructor Details

    • CmsProgressWidget

      public CmsProgressWidget(org.opencms.jsp.CmsJspActionElement jsp)
      Public constructor.

      Parameters:
      jsp - an initialized JSP action element
    • CmsProgressWidget

      public CmsProgressWidget(javax.servlet.jsp.PageContext context, javax.servlet.http.HttpServletRequest req, javax.servlet.http.HttpServletResponse res)
      Public constructor with JSP variables.

      Parameters:
      context - the JSP page context
      req - the JSP request
      res - the JSP response
  • Method Details

    • getProgressThread

      Returns the thread for the progress with the given key.

      Parameters:
      key - the key of the thread
      Returns:
      the thread for the progress with the given key
    • removeProgressThread

      public static void removeProgressThread(String key)
      Removes the thread for the progress with the given key from the list with the actual threads.

      Parameters:
      key - the key of the thread for the progress to remove from the list
    • getActualProgress

      Returns the actual progress in percent.

      The return value depends on the state of the progress/thread. This can be

      • the actual progress in percent with an optional description.
      • the result as the html code for the list.
      • an error message.

      The result will be interpreted by the JavaScript method "updateProgressbar()".

      Returns:
      the actual progress as a String
    • getColor

      public String getColor()
      Returns the color of the progress bar.

      Returns:
      the color of the progress bar
    • getJsFinishMethod

      Returns the name of the JavaScript method to call after progress is finished.

      Returns:
      the name of the JavaScript method to call after progress is finished
    • getJsIncludes

      Generates the necessary JavaScript inclusion code for this widget.

      Returns:
      the JavaScript inclusion code
    • getJsp

      public org.opencms.jsp.CmsJspActionElement getJsp()
      Returns the current JSP action element.

      Returns:
      the the current JSP action element
    • getKey

      public String getKey()
      Returns the unique key of the thread belonging to this widget.

      Returns:
      the unique key of the thread belonging to this widget
    • getRefreshRate

      public int getRefreshRate()
      Returns the refresh rate in ms of the progress bar.

      Returns:
      the refresh rate in ms of the progress bar
    • getShowWaitTime

      public int getShowWaitTime()
      Returns the time period the show the wait symbol before the progress bar is shown.

      Returns:
      the time period the show the wait symbol before the progress bar is shown
    • getWidget

      public String getWidget()
      Generates the widget HTML for the progress bar.

      Returns:
      the widget HTML for the progress bar
    • getWidth

      public String getWidth()
      Returns the width of the progress bar.

      Returns:
      the width of the progress bar
    • setColor

      public void setColor(String color)
      Sets the color of the progress bar.

      Parameters:
      color - the color of the progress bar to set
    • setJsFinishMethod

      public void setJsFinishMethod(String jsFinishMethod)
      Sets the name of the JavaScript method to call after progress is finished.

      Parameters:
      jsFinishMethod - the name of the JavaScript method to call after progress is finished to set
    • setRefreshRate

      public void setRefreshRate(int refreshRate)
      Sets the refresh rate in ms of the progress bar.

      Parameters:
      refreshRate - the refresh rate in ms of the progress bar to set
    • setShowWaitTime

      public void setShowWaitTime(int showWaitTime)
      Sets the time period the show the wait symbol before the progress bar is shown.

      Parameters:
      showWaitTime - the time period the show the wait symbol before the progress bar is shown to set
    • setWidth

      public void setWidth(String width)
      Sets the width of the progress bar.

      Parameters:
      width - the width of the progress bar to set
    • startProgress

      public void startProgress(A_CmsListDialog list)
      Starts a thread for the progress on the given list.

      Parameters:
      list - the list to use for the progress bar
    • startProgress

      public void startProgress(A_CmsListDialog list, boolean abortExisting)
      Starts a thread for the progress on the given list.

      Parameters:
      list - the list to use for the progress bar
      abortExisting - if true then an already existing thread will be killed