- All Implemented Interfaces:
Comparable<View>
-
Nested Class Summary
-
Field Summary
Modifier and TypeFieldDescriptionprotected static final String
The separator used between segments of the title. -
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionint
Orders by group, display, then name.void
configureResources
(ServletContext servletContext, HttpServletRequest req, HttpServletResponse resp, Theme theme, Page page, Registry requestRegistry) Configures the request-scope web resources that this view uses.abstract <__ extends FlowContent<__>>
voiddoView
(ServletContext servletContext, HttpServletRequest request, HttpServletResponse response, __ flow, Page page) Renders the view.boolean
Two views with the same name are considered equal.abstract boolean
getAllowRobots
(ServletContext servletContext, HttpServletRequest request, HttpServletResponse response, Page page) Gets whether robots are allowed to access this view to the given page.boolean
Checks if a view applies in global navigation context.getAuthors
(ServletContext servletContext, HttpServletRequest request, HttpServletResponse response, Page page) Gets the author(s) for the view on the given page.getCanonicalUrl
(ServletContext servletContext, HttpServletRequest request, HttpServletResponse response, Page page) Gets the canonical URL for the given page in this view.getCopyright
(ServletContext servletContext, HttpServletRequest request, HttpServletResponse response, Page page) Gets the copyright information for the view on the given page.abstract String
getDescription
(Page page) Gets the description for this view of the given page ornull
for none.abstract String
Gets the display name for this view.abstract View.Group
getGroup()
Gets the grouping for this view.abstract String
getKeywords
(Page page) Gets the keywords for this view of the given page ornull
for none.getLastModified
(ServletContext servletContext, HttpServletRequest request, HttpServletResponse response, Page page) Gets the effective last modified time, if known, for the given page in this view.getLinkCssClass
(ServletContext servletContext, HttpServletRequest request, HttpServletResponse response) Gets the CSS class to use for the main navigation link to this view.Gets an id to use for the main navigation link to this view.getLinkParams
(ServletContext servletContext, HttpServletRequest request, HttpServletResponse response, Page page) Gets the optional additional parameter to a view link.getLinks
(ServletContext servletContext, HttpServletRequest request, HttpServletResponse response, Page page) Gets an optional set of additional links to include for this view in the order they should be added.abstract String
getName()
Gets the unique name of this view.Gets any per-view scripts, when have the same name as globally registered scripts, must have matching src.getTitle
(ServletContext servletContext, HttpServletRequest request, HttpServletResponse response, Page page) Gets the page title for the view on the given page.int
hashCode()
Consistent with equals, hashCode based on name.boolean
isApplicable
(ServletContext servletContext, HttpServletRequest request, HttpServletResponse response, Page page) Checks if a view is applicable the given request and page.final boolean
Checks if this is the default view.toString()
-
Field Details
-
TITLE_SEPARATOR
The separator used between segments of the title. Should this be provided by the template?- See Also:
-
-
Constructor Details
-
View
public View()
-
-
Method Details
-
compareTo
Orders by group, display, then name.- Specified by:
compareTo
in interfaceComparable<View>
-
equals
Two views with the same name are considered equal. -
hashCode
public int hashCode()Consistent with equals, hashCode based on name. -
toString
-
getGroup
Gets the grouping for this view. -
getDisplay
Gets the display name for this view. -
getName
Gets the unique name of this view. -
isDefault
public final boolean isDefault()Checks if this is the default view. -
getAppliesGlobally
public boolean getAppliesGlobally()Checks if a view applies in global navigation context.Implementation Note:
returnstrue
by default -
isApplicable
public boolean isApplicable(ServletContext servletContext, HttpServletRequest request, HttpServletResponse response, Page page) throws ServletException, IOException Checks if a view is applicable the given request and page. For correct determination, the page must have been captured atCaptureLevel.META
level or higher.TODO: Store the captureLevel in effect when a page is captured, and confirm that here and other places where certain capture levels are required for correct behavior. Could also automatically re-capture at a higher level instead of throwing an exception.
Implementation Note:
returnstrue
by default- Throws:
ServletException
IOException
-
getLinkId
Gets an id to use for the main navigation link to this view.Implementation Note:
returnsnull
by default- Returns:
- the ID or null for none
-
getLinkCssClass
public String getLinkCssClass(ServletContext servletContext, HttpServletRequest request, HttpServletResponse response) Gets the CSS class to use for the main navigation link to this view.Implementation Note:
returnsnull
by default- Returns:
- the CSS class or null for none
-
getLinkParams
public Map<String,List<String>> getLinkParams(ServletContext servletContext, HttpServletRequest request, HttpServletResponse response, Page page) Gets the optional additional parameter to a view link.Implementation Note:
returns empty map by default -
getCanonicalUrl
public String getCanonicalUrl(ServletContext servletContext, HttpServletRequest request, HttpServletResponse response, Page page) throws ServletException, IOException Gets the canonical URL for the given page in this view. Can not get canonical URLs for missing books. This might be called even when a page is not applicable to this view, such as when browing to an empty TODO list. By default,link parameters
are not added.This URL is absolute and has already been response encoded.
- Throws:
ServletException
IOException
- See Also:
-
getLastModified
public ReadableInstant getLastModified(ServletContext servletContext, HttpServletRequest request, HttpServletResponse response, Page page) throws ServletException, IOException Gets the effective last modified time, if known, for the given page in this view. This is used for things such as sitemaps.Implementation Note:
This default implementation returnsnull
indicating not applicable to this view.- Returns:
- The effective last modified time or
null
if unknown or not applicable. - Throws:
ServletException
IOException
-
getCopyright
public Copyright getCopyright(ServletContext servletContext, HttpServletRequest request, HttpServletResponse response, Page page) throws ServletException, IOException Gets the copyright information for the view on the given page.- Throws:
ServletException
IOException
- See Also:
-
getAuthors
public Set<Author> getAuthors(ServletContext servletContext, HttpServletRequest request, HttpServletResponse response, Page page) throws ServletException, IOException Gets the author(s) for the view on the given page.- Throws:
ServletException
IOException
- See Also:
-
getTitle
public String getTitle(ServletContext servletContext, HttpServletRequest request, HttpServletResponse response, Page page) Gets the page title for the view on the given page.Defaults to: "view.display - page.title[ - page.pageRef.book.title]"
-
getDescription
Gets the description for this view of the given page ornull
for none. -
getKeywords
Gets the keywords for this view of the given page ornull
for none. -
configureResources
public void configureResources(ServletContext servletContext, HttpServletRequest req, HttpServletResponse resp, Theme theme, Page page, Registry requestRegistry) Configures the request-scope web resources that this view uses.Implementers should call
super.configureResources(…)
as a matter of convention, despite this default implementation doing nothing. -
getLinks
public Collection<Link> getLinks(ServletContext servletContext, HttpServletRequest request, HttpServletResponse response, Page page) throws ServletException, IOException Gets an optional set of additional links to include for this view in the order they should be added.Please note, that any links to stylesheets here are never optimized. Please prefer
configureResources(javax.servlet.ServletContext, javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse, com.semanticcms.core.servlet.Theme, com.semanticcms.core.model.Page, com.aoapps.web.resources.registry.Registry)
.- Throws:
ServletException
IOException
- See Also:
-
getScripts
Gets any per-view scripts, when have the same name as globally registered scripts, must have matching src.Implementation Note:
returns empty map by default- See Also:
-
getAllowRobots
public abstract boolean getAllowRobots(ServletContext servletContext, HttpServletRequest request, HttpServletResponse response, Page page) throws ServletException, IOException Gets whether robots are allowed to access this view to the given page. When true will include both "noindex, nofollow" in the head and put "nofollow" on links to this view.- Throws:
ServletException
IOException
-
doView
public abstract <__ extends FlowContent<__>> void doView(ServletContext servletContext, HttpServletRequest request, HttpServletResponse response, __ flow, Page page) throws ServletException, IOException, SkipPageException Renders the view. This is called by the template to fill-out the main content area.TODO: Is SkipPageException acceptable at the view rendering stage?
-