Package org.opencms.workplace.commons
Class CmsProgressWidget
java.lang.Object
org.opencms.workplace.commons.CmsProgressWidget
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 Summary
-
Constructor Summary
ConstructorDescriptionCmsProgressWidget
(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
Modifier and TypeMethodDescriptionReturns the actual progress in percent.getColor()
Returns the color of the progress bar.Returns the name of the JavaScript method to call after progress is finished.Generates the necessary JavaScript inclusion code for this widget.org.opencms.jsp.CmsJspActionElement
getJsp()
Returns the current JSP action element.getKey()
Returns the unique key of the thread belonging to this widget.static CmsProgressThread
getProgressThread
(String key) Returns the thread for the progress with the given key.int
Returns the refresh rate in ms of the progress bar.int
Returns the time period the show the wait symbol before the progress bar is shown.Generates the widget HTML for the progress bar.getWidth()
Returns the width of the progress bar.static void
Removes the thread for the progress with the given key from the list with the actual threads.void
Sets the color of the progress bar.void
setJsFinishMethod
(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
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.
-
Field Details
-
PARAMETER_KEY
The name of the key request parameter.- See Also:
-
PARAMETER_REFRESHRATE
The name of the refresh rate request parameter.- See Also:
-
PARAMETER_SHOWWAITTIME
The name of the show wait time request parameter.- See Also:
-
-
Constructor Details
-
CmsProgressWidget
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 contextreq
- the JSP requestres
- 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
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
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
Returns the current JSP action element.- Returns:
- the the current JSP action element
-
getKey
Returns the unique key of the thread belonging to this widget.- Returns:
- the unique key of the thread belonging to this widget
-
getRefreshRate
Returns the refresh rate in ms of the progress bar.- Returns:
- the refresh rate in ms of the progress bar
-
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
Generates the widget HTML for the progress bar.- Returns:
- the widget HTML for the progress bar
-
getWidth
Returns the width of the progress bar.- Returns:
- the width of the progress bar
-
setColor
Sets the color of the progress bar.- Parameters:
color
- the color of the progress bar to set
-
setJsFinishMethod
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
Sets the refresh rate in ms of the progress bar.- Parameters:
refreshRate
- the refresh rate in ms of the progress bar to set
-
setShowWaitTime
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
Sets the width of the progress bar.- Parameters:
width
- the width of the progress bar to set
-
startProgress
Starts a thread for the progress on the given list.- Parameters:
list
- the list to use for the progress bar
-
startProgress
Starts a thread for the progress on the given list.- Parameters:
list
- the list to use for the progress barabortExisting
- if true then an already existing thread will be killed
-