Class HtmlReport
- All Implemented Interfaces:
InterfaceReport
- Direct Known Subclasses:
AbstractHtmlReport
-
Field Summary
Modifier and TypeFieldDescriptionstatic final int
Constant for the "Advanced" button in the build button methods.static final int
Constant for the "Back" button in the build button methods.static final int
Constant for the "Cancel" button in the build button methods.static final int
Constant for the "Close" button in the build button methods.static final int
Constant for the "Continue" button in the build button methods.static final int
Constant for the "Details" button in the build button methods.static final int
Constant for the "Discard" button in the build button methods (same function as "Cancel" button but different text on button.static final int
Constant for the "Download" button in the build button methods.static final int
Constant for the "Edit" button in the build button methods (same function as "Ok" button but different text on button.static final int
Constant for the "OK" button in the build button methods.static final int
Constant for the "OK" button in the build button methods (without form submission).static final int
Constant for the "Set" button in the build button methods.static final String
The delimiter that is used in the RESOURCE list request parameter.static final String
Request parameter value for the action: back.static final String
Request parameter value for the action: cancel.static final String
Request parameter value for the action: continue.static final String
Request parameter value for the action: set.static final String
static final String
static final int
Helper variable to deliver the html end part.static final int
Helper variable to deliver the html start part.protected static final String
Constant for a HTML linebreak with added "real" line break.protected static final String
Constant for a HTML linebreak with added "real" line break- traditional style for report threads that still use XML templates for their output.static final String
Request parameter name for the RESOURCE list.Fields inherited from class org.apache.ofbiz.htmlreport.AbstractReport
SESSION_REPORT_CLASS
Fields inherited from interface org.apache.ofbiz.htmlreport.InterfaceReport
FORMAT_DEFAULT, FORMAT_ERROR, FORMAT_HEADLINE, FORMAT_NOTE, FORMAT_OK, FORMAT_WARNING, REPORT_TYPE_EXTENDED, REPORT_TYPE_SIMPLE
-
Constructor Summary
ConstructorDescriptionHtmlReport
(HttpServletRequest request, HttpServletResponse response) Constructs a new report using the provided locale for the output language.HtmlReport
(HttpServletRequest request, HttpServletResponse response, boolean writeHtml, boolean isTransient) Constructs a new report using the provided locale for the output language. -
Method Summary
Modifier and TypeMethodDescriptionvoid
addLogFile
(String logFileName) Add a log file to the report.protected String
appendDelimiter
(String attribute) Appends a space char.bodyEnd()
Builds the end html of the body.Builds the start html of the body.Close log file if necessary.Builds the outer dialog window border.dialogButtonRow
(int segment) Builds the button row under the dialog content area without the buttons.dialogButtons
(int[] buttons, String[] attributes) Builds the html for the button row under the dialog content area, including buttons.dialogButtonsContinue
(String okAttrs, String cancelAttrs) Builds a button row with an "Ok" and a "Cancel" button.protected void
dialogButtonsHtml
(StringBuffer result, int button, String attribute) Renders the HTML for a single input button of a specified type.dialogButtonsOkCancel
(HttpServletRequest request, String okAttrs, String cancelAttrs) Builds a button row with an "OK" and a "Cancel" button.dialogButtonsOkCancelDownload
(HttpServletRequest request, String okAttrs, String cancelAttrs, String downloadAttrs) Builds a button row with an "OK", a "Cancel" and a "Download" button.dialogContent
(int segment, String title) Builds the content area of the dialog window.Returns the end html for the content area of the dialog window.dialogContentStart
(String title) Returns the start html for the content area of the dialog window.Returns the end html for the outer dialog window border.dialogHead
(String title) Builds the title of the dialog window.Builds the standard javascript for submitting the dialog.Returns the start html for the outer dialog window border.getDialogRealUri
(HttpServletRequest request) Returns the http URI of the current dialog, to be used as value for the "action" attribute of a html form.getFormRealUri
(HttpServletRequest request) Get the report form uri.static HtmlReport
getInstance
(HttpServletRequest request, HttpServletResponse response) static HtmlReport
getInstance
(HttpServletRequest request, HttpServletResponse response, boolean writeHtml, boolean isTransient) static HtmlReport
getInstance
(HttpServletRequest request, HttpServletResponse response, boolean writeHtml, boolean isTransient, String logFileName) protected String
Returns the correct line break notation depending on the output style of this report.Gets log file name.getParamAction
(HttpServletRequest request) Gets param action.Returns if the workplace must be refreshed.Returns the key name which contains the localized message for the continue checkbox.getParamResource
(HttpServletRequest request) Returns the value of the file parameter, or null if this parameter was not provided.getParamResourcelist
(HttpServletRequest request) Returns the value of the RESOURCE list parameter, or null if the parameter is not provided.getParamThread
(HttpServletRequest request) Returns the thread parameter value.getParamThreadHasNext
(HttpServletRequest request) Returns the threadhasnext parameter value.getParamTitle
(HttpServletRequest request) Returns the value of the title parameter, or null if this parameter was not provided.Updates this report, this processes all new output added since the last call to this method.getResourceList
(HttpServletRequest request) Returns the resources that are defined for the dialog operation.getResourceListAsParam
(HttpServletRequest request) Returns the value of the resourcelist parameter in form of a String separated withDELIMITER_RESOURCES
, or the value of the RESOURCE parameter if the first parameter is not provided (no multiple choice has been done.long
htmlEnd()
Builds the end html of the page.Builds the start html of the page, including setting of DOCTYPE and inserting a header with the content-type.htmlStart
(boolean loadStyles) Builds the start html of the page, including setting of DOCTYPE and inserting a header with the content-type.boolean
isAlive
(HttpServletRequest request) Returns true if the report Thread is still alive (i.e.boolean
isMultiOperation
(HttpServletRequest request) Returns true if the dialog operation has to be performed on multiple resources.boolean
Returns if the report writes html or javascript code.Builds the html of the body.pageHtml
(int segment, boolean loadStyles) Builds the start html of the page, including setting of DOCTYPE and inserting a header with the content-type.Returns the default html for a workplace page, including setting of DOCTYPE and inserting a header with the content-type.pageHtmlStyle
(int segment, String title, String stylesheet) Returns the default html for a workplace page, including setting of DOCTYPE and inserting a header with the content-type, allowing the selection of an individual style sheet.paramsAsHidden
(HttpServletRequest request) Returns all initialized parameters of the current workplace class as hidden field tags that can be inserted in a form.paramsAsHidden
(HttpServletRequest request, Collection<?> excludes) Returns all initialized parameters of the current workplace class that are not in the given exclusion list as hidden field tags that can be inserted in a form.paramValues
(HttpServletRequest request) Returns the values of all parameter methods of this workplace class instance.void
Prints a String to the report, using the indicated formatting.void
println()
Adds a line break to the report.void
Adds an Exception to the report, ensuring that the Exception content is processed to generate a valid output esp.void
printMessageWithParam
(int m, int n, String uiLabel, Object param) Convenience method to print a localized message, followed by a parameter and dots to the report.void
printMessageWithParam
(String uiLabel, Object param) Prints a localized message followed by a parameter and dots to the report.Returns an optional conclusion text to be displayed below the report output.Returns an optional introduction text to be displayed above the report output.void
setFormRealUri
(HttpServletRequest request, String formUri) Set the report form uri.void
setParamAction
(String action) Sets param action.void
setParamThread
(String name) Sets param thread.void
setSequenceNum
(long sequenceNum) Set log's sequence number.Methods inherited from class org.apache.ofbiz.htmlreport.AbstractReport
addError, addWarning, formatRuntime, getErrors, getLocale, getRuntime, getWarnings, hasError, hasWarning, init, print, println, println, resetRuntime
-
Field Details
-
DELIMITER_RESOURCES
The delimiter that is used in the RESOURCE list request parameter.- See Also:
-
PARAM_RESOURCELIST
Request parameter name for the RESOURCE list.- See Also:
-
LINEBREAK
Constant for a HTML linebreak with added "real" line break.- See Also:
-
LINEBREAK_TRADITIONAL
Constant for a HTML linebreak with added "real" line break- traditional style for report threads that still use XML templates for their output.- See Also:
-
HTML_END
public static final int HTML_ENDHelper variable to deliver the html end part.- See Also:
-
HTML_START
public static final int HTML_STARTHelper variable to deliver the html start part.- See Also:
-
BUTTON_OK
public static final int BUTTON_OKConstant for the "OK" button in the build button methods.- See Also:
-
BUTTON_CANCEL
public static final int BUTTON_CANCELConstant for the "Cancel" button in the build button methods.- See Also:
-
BUTTON_CLOSE
public static final int BUTTON_CLOSEConstant for the "Close" button in the build button methods.- See Also:
-
BUTTON_ADVANCED
public static final int BUTTON_ADVANCEDConstant for the "Advanced" button in the build button methods.- See Also:
-
BUTTON_SET
public static final int BUTTON_SETConstant for the "Set" button in the build button methods.- See Also:
-
BUTTON_DETAILS
public static final int BUTTON_DETAILSConstant for the "Details" button in the build button methods.- See Also:
-
BUTTON_OK_NO_SUBMIT
public static final int BUTTON_OK_NO_SUBMITConstant for the "OK" button in the build button methods (without form submission).- See Also:
-
BUTTON_EDIT
public static final int BUTTON_EDITConstant for the "Edit" button in the build button methods (same function as "Ok" button but different text on button.- See Also:
-
BUTTON_DISCARD
public static final int BUTTON_DISCARDConstant for the "Discard" button in the build button methods (same function as "Cancel" button but different text on button.- See Also:
-
BUTTON_BACK
public static final int BUTTON_BACKConstant for the "Back" button in the build button methods.- See Also:
-
BUTTON_CONTINUE
public static final int BUTTON_CONTINUEConstant for the "Continue" button in the build button methods.- See Also:
-
BUTTON_DOWNLOAD
public static final int BUTTON_DOWNLOADConstant for the "Download" button in the build button methods.- See Also:
-
DIALOG_BACK
Request parameter value for the action: back.- See Also:
-
DIALOG_CANCEL
Request parameter value for the action: cancel.- See Also:
-
DIALOG_CONTINUE
Request parameter value for the action: continue.- See Also:
-
DIALOG_SET
Request parameter value for the action: set.- See Also:
-
DIALOG_URI
- See Also:
-
FORM_URI
- See Also:
-
-
Constructor Details
-
HtmlReport
Constructs a new report using the provided locale for the output language.- Parameters:
request
- HttpServletRequestresponse
- HttpServletResponse
-
HtmlReport
public HtmlReport(HttpServletRequest request, HttpServletResponse response, boolean writeHtml, boolean isTransient) Constructs a new report using the provided locale for the output language.- Parameters:
request
- HttpServletRequestresponse
- HttpServletResponsewriteHtml
- iftrue
, this report should generate HTML instead of JavaScript outputisTransient
- If set totrue
nothing is kept in memory
-
-
Method Details
-
getInstance
-
getInstance
public static HtmlReport getInstance(HttpServletRequest request, HttpServletResponse response, boolean writeHtml, boolean isTransient) -
getInstance
public static HtmlReport getInstance(HttpServletRequest request, HttpServletResponse response, boolean writeHtml, boolean isTransient, String logFileName) -
getParamAction
Gets param action.- Parameters:
request
- the request- Returns:
- the param action
-
setParamAction
Sets param action.- Parameters:
action
- the action
-
setParamThread
Sets param thread.- Parameters:
name
- the name
-
getReportUpdate
Description copied from interface:InterfaceReport
Updates this report, this processes all new output added since the last call to this method.This is only required in case the output is written to a HTML page, if the shell output is used, this will just return an empty String.
- Returns:
- new elements that have been added to the report and not yet processed.
-
isWriteHtml
public boolean isWriteHtml()Returns if the report writes html or javascript code.- Returns:
true
if the report writes html, andfalse
if the report writes javascript code
-
print
Description copied from class:AbstractReport
Prints a String to the report, using the indicated formatting.Use the contants starting with
FORMAT
from this interface to indicate which formatting to use.- Specified by:
print
in interfaceInterfaceReport
- Specified by:
print
in classAbstractReport
- Parameters:
value
- the message container to addformat
- the formatting to use for the output
-
println
public void println()Description copied from interface:InterfaceReport
Adds a line break to the report. -
println
Description copied from interface:InterfaceReport
Adds an Exception to the report, ensuring that the Exception content is processed to generate a valid output esp. for HTML pages.The exception will be stored and the output will later be processed in a special way.
- Parameters:
t
- the exception to add
-
getLineBreak
Returns the correct line break notation depending on the output style of this report.- Returns:
- the correct line break notation
-
printMessageWithParam
Description copied from interface:InterfaceReport
Prints a localized message followed by a parameter and dots to the report.- Parameters:
uiLabel
- the Message to addparam
- the Parameter to add
-
printMessageWithParam
Description copied from interface:InterfaceReport
Convenience method to print a localized message, followed by a parameter and dots to the report.The output follows the pattern: ( 3 / 8 ) Deleting filename.txt ...
- Parameters:
m
- the number of the report outputn
- the total number of report outputsuiLabel
- the Message to addparam
- the Parameter to add
-
htmlStart
Builds the start html of the page, including setting of DOCTYPE and inserting a header with the content-type.This overloads the default method of the parent class.
- Returns:
- the start html of the page
-
htmlStart
Builds the start html of the page, including setting of DOCTYPE and inserting a header with the content-type.This overloads the default method of the parent class.
- Parameters:
loadStyles
- if true, the defaul style sheet will be loaded- Returns:
- the start html of the page
-
pageHtml
Builds the start html of the page, including setting of DOCTYPE and inserting a header with the content-type.This overloads the default method of the parent class.
- Parameters:
segment
- the HTML segment (START / END)loadStyles
- if true, the defaul style sheet will be loaded- Returns:
- the start html of the page
-
dialogScriptSubmit
Builds the standard javascript for submitting the dialog.- Returns:
- the standard javascript for submitting the dialog
-
isAlive
Returns true if the report Thread is still alive (i.e. running), false otherwise.- Returns:
- true if the report Thread is still alive
-
getParamThread
Returns the thread parameter value.- Returns:
- the thread parameter value
-
getParamThreadHasNext
Returns the threadhasnext parameter value.- Returns:
- the threadhasnext parameter value
-
bodyStart
Builds the start html of the body.- Parameters:
className
- optional class attribute to add to the body tagparameters
- optional parameters to add to the body tag- Returns:
- the start html of the body
-
pageBody
Builds the html of the body.- Parameters:
segment
- the HTML segment (START / END)className
- optional class attribute to add to the body tagparameters
- optional parameters to add to the body tag- Returns:
- the html of the body
-
bodyEnd
Builds the end html of the body.- Returns:
- the end html of the body
-
htmlEnd
Builds the end html of the page.- Returns:
- the end html of the page
-
pageHtml
Returns the default html for a workplace page, including setting of DOCTYPE and inserting a header with the content-type.- Parameters:
segment
- the HTML segment (START / END)title
- the title of the page, if null no title tag is inserted- Returns:
- the default html for a workplace page
-
pageHtmlStyle
Returns the default html for a workplace page, including setting of DOCTYPE and inserting a header with the content-type, allowing the selection of an individual style sheet.- Parameters:
segment
- the HTML segment (START / END)title
- the title of the page, if null no title tag is insertedstylesheet
- the used style sheet, if null the default stylesheet 'workplace.css' is inserted- Returns:
- the default html for a workplace page
-
dialogStart
Returns the start html for the outer dialog window border.- Returns:
- the start html for the outer dialog window border
-
dialog
Builds the outer dialog window border.- Parameters:
segment
- the HTML segment (START / END)attributes
- optional additional attributes for the opening dialog table- Returns:
- a dialog window start / end segment
-
dialogContentStart
Returns the start html for the content area of the dialog window.- Parameters:
title
- the title for the dialog- Returns:
- the start html for the content area of the dialog window
-
dialogContent
Builds the content area of the dialog window.- Parameters:
segment
- the HTML segment (START / END)title
- the title String for the dialog window- Returns:
- a content area start / end segment
-
dialogHead
Builds the title of the dialog window.- Parameters:
title
- the title String for the dialog window- Returns:
- the HTML title String for the dialog window
-
getParamTitle
Returns the value of the title parameter, or null if this parameter was not provided.This parameter is used to build the title of the dialog. It is a parameter so that the title can be passed to included elements.
- Returns:
- the value of the title parameter
-
paramsAsHidden
Returns all initialized parameters of the current workplace class as hidden field tags that can be inserted in a form.- Returns:
- all initialized parameters of the current workplace class as hidden field tags that can be inserted in a html form
-
paramsAsHidden
Returns all initialized parameters of the current workplace class that are not in the given exclusion list as hidden field tags that can be inserted in a form.- Parameters:
excludes
- the parameters to exclude- Returns:
- all initialized parameters of the current workplace class that are not in the given exclusion list as hidden field tags that can be inserted in a form
-
paramValues
Returns the values of all parameter methods of this workplace class instance.- Returns:
- the values of all parameter methods of this workplace class instance
-
reportIntroductionText
Returns an optional introduction text to be displayed above the report output.- Returns:
- an optional introduction text
-
reportConclusionText
Returns an optional conclusion text to be displayed below the report output.- Returns:
- an optional conclusion text
-
dialogContentEnd
Returns the end html for the content area of the dialog window.- Returns:
- the end html for the content area of the dialog window
-
dialogButtonsContinue
Builds a button row with an "Ok" and a "Cancel" button.This row is displayed when the first report is running.
- Parameters:
okAttrs
- optional attributes for the ok buttoncancelAttrs
- optional attributes for the cancel button- Returns:
- the button row
-
dialogButtonsOkCancel
Builds a button row with an "OK" and a "Cancel" button.This row is used when a single report is running or after the first report has finished.
- Parameters:
okAttrs
- optional attributes for the ok buttoncancelAttrs
- optional attributes for the cancel button- Returns:
- the button row
-
dialogButtonsOkCancelDownload
public String dialogButtonsOkCancelDownload(HttpServletRequest request, String okAttrs, String cancelAttrs, String downloadAttrs) Builds a button row with an "OK", a "Cancel" and a "Download" button.This row is used when a single report is running or after the first report has finished.
- Parameters:
okAttrs
- optional attributes for the ok buttoncancelAttrs
- optional attributes for the cancel buttondownloadAttrs
- optional attributes for the download button- Returns:
- the button row
-
dialogButtons
Builds the html for the button row under the dialog content area, including buttons.- Parameters:
buttons
- array of constants of which buttons to include in the rowattributes
- array of Strings for additional button attributes- Returns:
- the html for the button row under the dialog content area, including buttons
-
dialogButtonRow
Builds the button row under the dialog content area without the buttons.- Parameters:
segment
- the HTML segment (START / END)- Returns:
- the button row start / end segment
-
dialogButtonsHtml
Renders the HTML for a single input button of a specified type.- Parameters:
result
- a string buffer where the rendered HTML gets appended tobutton
- a integer key to identify the buttonattribute
- an optional string with possible tag attributes, or null
-
appendDelimiter
Appends a space char. between tag attributes.- Parameters:
attribute
- a tag attribute- Returns:
- the tag attribute with a leading space char
-
isMultiOperation
Returns true if the dialog operation has to be performed on multiple resources.- Returns:
- true if the dialog operation has to be performed on multiple resources, otherwise false
-
getResourceList
Returns the resources that are defined for the dialog operation. For single RESOURCE operations, the list contains one item: the RESOURCE name found in the request parameter value of the "RESOURCE" parameter.- Returns:
- the resources that are defined for the dialog operation
-
getParamResourcelist
Returns the value of the RESOURCE list parameter, or null if the parameter is not provided.This parameter selects the resources to perform operations on.
- Returns:
- the value of the RESOURCE list parameter or null, if the parameter is not provided
-
getParamResource
Returns the value of the file parameter, or null if this parameter was not provided.The file parameter selects the file on which the dialog action is to be performed.
- Returns:
- the value of the file parameter
-
getParamRefreshWorkplace
Returns if the workplace must be refreshed.- Returns:
"true"
if the workplace must be refreshed.
-
getParamReportContinueKey
Returns the key name which contains the localized message for the continue checkbox.- Returns:
- the key name which contains the localized message for the continue checkbox
-
getResourceListAsParam
Returns the value of the resourcelist parameter in form of a String separated withDELIMITER_RESOURCES
, or the value of the RESOURCE parameter if the first parameter is not provided (no multiple choice has been done.This may be used for jsps as value for the parameter for resources
PARAM_RESOURCELIST
.- Returns:
- the value of the resourcelist parameter or null, if the parameter is not provided
-
dialogEnd
Returns the end html for the outer dialog window border.- Returns:
- the end html for the outer dialog window border
-
getDialogRealUri
Returns the http URI of the current dialog, to be used as value for the "action" attribute of a html form.This URI is the real one.
- Returns:
- the http URI of the current dialog
-
setFormRealUri
Set the report form uri.- Parameters:
request
-formUri
-
-
getFormRealUri
Get the report form uri.- Parameters:
request
-- Returns:
-
addLogFile
Description copied from interface:InterfaceReport
Add a log file to the report. -
closeLogFile
Description copied from interface:InterfaceReport
Close log file if necessary. -
getLogFileName
Gets log file name.- Returns:
- the log file name
-
getSequenceNum
public long getSequenceNum() -
setSequenceNum
public void setSequenceNum(long sequenceNum) Description copied from interface:InterfaceReport
Set log's sequence number.
-