Class Widget
- All Implemented Interfaces:
- HtmlWidget
- Direct Known Subclasses:
- MenuItemWidget,- PoweredByApache,- PoweredByJuneau
Widgets must provide one of the following public constructors:
- public Widget();
- public Widget(ContextProperties);
Widgets can be defined as inner classes of REST resource classes.
See Also:
- 
Constructor SummaryConstructors
- 
Method SummaryModifier and TypeMethodDescriptionprotected FileFindergetFileFinder(RestRequest req) Returns the file finder to use for finding files on the file system.getHtml(RestRequest req, RestResponse res) Resolves the HTML content for this widget.getHtml(VarResolverSession session) Resolves the HTML content for this widget.getName()The widget key.getScript(RestRequest req, RestResponse res) Resolves any Javascript that should be added to the<head>/<script> element.getScript(VarResolverSession session) Resolves any Javascript that should be added to the<head>/<script> element.getStyle(RestRequest req, RestResponse res) Resolves any CSS styles that should be added to the<head>/<style> element.getStyle(VarResolverSession session) Resolves any CSS styles that should be added to the<head>/<style> element.protected StringloadHtml(RestRequest req, String name) Loads the specified HTML file and strips HTML comments from the file.protected StringloadHtmlWithVars(RestRequest req, RestResponse res, String name) Same asloadHtml(RestRequest,String)but replaces request-time SVL variables.protected StringloadScript(RestRequest req, String name) Loads the specified javascript file and strips any Javascript comments from the file.protected StringloadScriptWithVars(RestRequest req, RestResponse res, String name) Same asloadScript(RestRequest,String)but replaces request-time SVL variables.protected StringloadStyle(RestRequest req, String name) Loads the specified CSS file and strips CSS comments from the file.protected StringloadStyleWithVars(RestRequest req, RestResponse res, String name) Same asloadStyle(RestRequest,String)but replaces request-time SVL variables.
- 
Constructor Details- 
Widgetpublic Widget()
 
- 
- 
Method Details- 
getNameThe widget key.(i.e. The variable name inside the "$W{...}" variable).The returned value must not be null .If not overridden, the default value is the class simple name. - Specified by:
- getNamein interface- HtmlWidget
- Returns:
- The widget key.
 
- 
getHtmlDescription copied from interface:HtmlWidgetResolves the HTML content for this widget.A returned value of null will cause nothing to be added to the page.- Specified by:
- getHtmlin interface- HtmlWidget
- Parameters:
- session- The current serializer session.
- Returns:
- The HTML content of this widget.
 
- 
getScriptDescription copied from interface:HtmlWidgetResolves any Javascript that should be added to the<head>/<script> element.A returned value of null will cause nothing to be added to the page.- Specified by:
- getScriptin interface- HtmlWidget
- Parameters:
- session- The current serializer session.
- Returns:
- The Javascript needed by this widget.
 
- 
getStyleDescription copied from interface:HtmlWidgetResolves any CSS styles that should be added to the<head>/<style> element.A returned value of null will cause nothing to be added to the page.- Specified by:
- getStylein interface- HtmlWidget
- Parameters:
- session- The current serializer session.
- Returns:
- The CSS styles needed by this widget.
 
- 
getHtmlResolves the HTML content for this widget.A returned value of null will cause nothing to be added to the page.- Parameters:
- req- The HTTP request object.
- res- The current HTTP response.
- Returns:
- The HTML content of this widget.
 
- 
getScriptResolves any Javascript that should be added to the<head>/<script> element.A returned value of null will cause nothing to be added to the page.- Parameters:
- req- The HTTP request object.
- res- The current HTTP response.
- Returns:
- The Javascript needed by this widget.
 
- 
getStyleResolves any CSS styles that should be added to the<head>/<style> element.A returned value of null will cause nothing to be added to the page.- Parameters:
- req- The HTTP request object.
- res- The current HTTP response.
- Returns:
- The CSS styles needed by this widget.
 
- 
getFileFinderReturns the file finder to use for finding files on the file system.- Parameters:
- req- The HTTP request object.
- Returns:
- The file finder to used for finding files on the file system.
 
- 
loadScriptLoads the specified javascript file and strips any Javascript comments from the file.Comments are assumed to be Java-style block comments: "/*" .- Parameters:
- req- The HTTP request object.
- name- Name of the desired resource.
- Returns:
- The resource converted to a string, or null if the resource could not be found.
 
- 
loadScriptWithVarsprotected String loadScriptWithVars(RestRequest req, RestResponse res, String name) throws IOException Same asloadScript(RestRequest,String)but replaces request-time SVL variables.See Also:- Parameters:
- req- The current HTTP request.
- res- The current HTTP response.
- name- Name of the desired resource.
- Returns:
- The resource converted to a string, or null if the resource could not be found.
- Throws:
- IOException- Thrown by underlying stream.
 
- 
loadStyleLoads the specified CSS file and strips CSS comments from the file.Comments are assumed to be Java-style block comments: "/*" .- Parameters:
- req- The HTTP request object.
- name- Name of the desired resource.
- Returns:
- The resource converted to a string, or null if the resource could not be found.
 
- 
loadStyleWithVarsprotected String loadStyleWithVars(RestRequest req, RestResponse res, String name) throws IOException Same asloadStyle(RestRequest,String)but replaces request-time SVL variables.See Also:- Parameters:
- req- The current HTTP request.
- res- The current HTTP response.
- name- Name of the desired resource.
- Returns:
- The resource converted to a string, or null if the resource could not be found.
- Throws:
- IOException- Thrown by underlying stream.
 
- 
loadHtmlLoads the specified HTML file and strips HTML comments from the file.Comment are assumed to be "<!-- -->" code blocks.- Parameters:
- req- The HTTP request object.
- name- Name of the desired resource.
- Returns:
- The resource converted to a string, or null if the resource could not be found.
 
- 
loadHtmlWithVarsprotected String loadHtmlWithVars(RestRequest req, RestResponse res, String name) throws IOException Same asloadHtml(RestRequest,String)but replaces request-time SVL variables.See Also:- Parameters:
- req- The current HTTP request.
- res- The current HTTP response.
- name- Name of the desired resource.
- Returns:
- The resource converted to a string, or null if the resource could not be found.
- Throws:
- IOException- Thrown by underlying stream.
 
 
-