Class CmsProgressWidget


  • public class CmsProgressWidget
    extends java.lang.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:
    A_CmsListDialog
    • Field Summary

      Fields 
      Modifier and Type Field Description
      static java.lang.String PARAMETER_KEY
      The name of the key request parameter.
      static java.lang.String PARAMETER_REFRESHRATE
      The name of the refresh rate request parameter.
      static java.lang.String PARAMETER_SHOWWAITTIME
      The name of the show wait time request parameter.
    • Constructor Summary

      Constructors 
      Constructor Description
      CmsProgressWidget​(javax.servlet.jsp.PageContext context, javax.servlet.http.HttpServletRequest req, javax.servlet.http.HttpServletResponse res)
      Public constructor with JSP variables.
      CmsProgressWidget​(org.opencms.jsp.CmsJspActionElement jsp)
      Public constructor.
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      java.lang.String getActualProgress()
      Returns the actual progress in percent.
      java.lang.String getColor()
      Returns the color of the progress bar.
      java.lang.String getJsFinishMethod()
      Returns the name of the JavaScript method to call after progress is finished.
      java.lang.String getJsIncludes()
      Generates the necessary JavaScript inclusion code for this widget.
      org.opencms.jsp.CmsJspActionElement getJsp()
      Returns the current JSP action element.
      java.lang.String getKey()
      Returns the unique key of the thread belonging to this widget.
      static CmsProgressThread getProgressThread​(java.lang.String key)
      Returns the thread for the progress with the given key.
      int getRefreshRate()
      Returns the refresh rate in ms of the progress bar.
      int getShowWaitTime()
      Returns the time period the show the wait symbol before the progress bar is shown.
      java.lang.String getWidget()
      Generates the widget HTML for the progress bar.
      java.lang.String getWidth()
      Returns the width of the progress bar.
      static void removeProgressThread​(java.lang.String key)
      Removes the thread for the progress with the given key from the list with the actual threads.
      void setColor​(java.lang.String color)
      Sets the color of the progress bar.
      void setJsFinishMethod​(java.lang.String jsFinishMethod)
      Sets the name of the JavaScript method to call after progress is finished.
      void setRefreshRate​(int refreshRate)
      Sets the refresh rate in ms of the progress bar.
      void setShowWaitTime​(int showWaitTime)
      Sets the time period the show the wait symbol before the progress bar is shown.
      void setWidth​(java.lang.String width)
      Sets the width of the progress bar.
      void startProgress​(A_CmsListDialog list)
      Starts a thread for the progress on the given list.
      void startProgress​(A_CmsListDialog list, boolean abortExisting)
      Starts a thread for the progress on the given list.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • 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 Detail

      • getProgressThread

        public static CmsProgressThread getProgressThread​(java.lang.String key)
        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​(java.lang.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

        public java.lang.String 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 java.lang.String getColor()
        Returns the color of the progress bar.

        Returns:
        the color of the progress bar
      • getJsFinishMethod

        public java.lang.String 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

        public java.lang.String 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 java.lang.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 java.lang.String getWidget()
        Generates the widget HTML for the progress bar.

        Returns:
        the widget HTML for the progress bar
      • getWidth

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

        Returns:
        the width of the progress bar
      • setColor

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

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

        public void setJsFinishMethod​(java.lang.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​(java.lang.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