org.eclipse.rwt.branding
Class AbstractBranding
java.lang.Object
org.eclipse.rwt.branding.AbstractBranding
- public abstract class AbstractBranding
- extends
Object
This abstract class is intended to be implemented by clients that want
to have control over various aspects of the web application such as
- the servlet name at which the application can be accessed,
- the default entry point and the list of entry points that may
be accessed
- appearance of the startup page (favorites icon, markup of the page
body, etc.),
- the theme to be used
It serves as a callback that answers requests to the above outlined
aspects via its getter methods.
Note: Instances of this class are expected to be
immutable. All getter methods should return the same values whenever
they are called.
Brandings can be registered via a <context-param>
s
in the web.xml
. Specify org.eclipse.rwt.brandings
in the param-name element and a comma-separated list of fully qualified
class names that extend this class in the param-value element.
The following is an example snippet that registers two brandings.
...
<context-param>
<param-name>org.eclipse.rwt.brandings</param-name>
<param-value>org.demo.MyBranding1,org.demo.MyBranding2</param-value>
</context-param>
...
-
Since:
- 1.0.1
Method Summary
|
String
|
getBody
()
Returns HTML code to be placed inside the <body> tag or
null if no custom HTML code should be placed inside the
<body> tag. |
String
|
getDefaultEntryPoint
()
Returns the default entry point. |
String[]
|
getEntryPoints
()
Returns an array of entry points which are allowed to be the started with
this branding (or servlet name). |
String
|
getExitConfirmationText
()
Returns the message to display in the exit confirmation. |
String
|
getFavIcon
()
Returns the resource name for the favorites icon or null to
indicate that no favorites icon is available. |
Header[]
|
getHeaders
()
Returns an array of HTML header tags or null if no additional headers
are provided. |
String
|
getId
()
Returns the id of this branding extension. |
String
|
getServletName
()
Returns the name of the servlet on which the application should be
available. |
String
|
getThemeId
()
Returns the id of the theme to be used with this branding or
null to indicate that the default theme should be used. |
String
|
getTitle
()
Returns the title that will be displayed in the browser window or
null to indicate that no title should be displayed. |
void
|
registerResources
()
This method is called before the branding is applied for the first time. |
boolean
|
showExitConfirmation
()
Indicates whether an exit confirmation should be shown. |
Methods inherited from class java.lang.
Object
|
clone,
equals,
finalize,
getClass,
hashCode,
notify,
notifyAll,
toString,
wait,
wait,
wait
|
AbstractBranding
public AbstractBranding()
getServletName
public
String getServletName()
- Returns the name of the servlet on which the application should be
available. Defining this attribute will cause your application to
be available at
https://<host>:<port>/<servletName>
.
The default behavior is to return null
.
-
-
Returns:
- the servlet name, must not return
null
getDefaultEntryPoint
public
String getDefaultEntryPoint()
- Returns the default entry point. Returning
null
or an
empty string indicates that there is no default entry point.
A URL like https://<host>:<port>/<servletName>
would automatically execute the entry point returned here.
The default behavior is to return null
.
-
-
Returns:
- the default entry point or
null
getEntryPoints
public
String[] getEntryPoints()
- Returns an array of entry points which are allowed to be the started with
this branding (or servlet name). If
null
or an empty array
is returned, every entrypoint is allowed to be started.
The default behavior is to return null
.
-
-
Returns:
- an array of string, denoting the allowed entry points or
null
getThemeId
public
String getThemeId()
- Returns the id of the theme to be used with this branding or
null
to indicate that the default theme should be used.
The default behavior is to return null
.
-
-
Returns:
- the theme id or
null
getId
public
String getId()
- Returns the id of this branding extension.
The default behavior is to return null
.
-
-
Returns:
- the branding extension's id or
null
. -
Since:
- 1.1
getFavIcon
public
String getFavIcon()
- Returns the resource name for the favorites icon or
null
to
indicate that no favorites icon is available.
Note: if a fav icon is provided, the application code
must register the resource at the ResourceManager
.
Preferrably, this should be done in the registerResources
callback method.
The default behavior is to return null
.
-
-
Returns:
- the favorites icon or
null
-
See Also:
-
IResourceManager
,
registerResources()
getTitle
public
String getTitle()
- Returns the title that will be displayed in the browser window or
null
to indicate that no title should be displayed.
The default behavior is to return null
.
-
-
Returns:
- the title or
null
getHeaders
public
Header[] getHeaders()
- Returns an array of HTML header tags or null if no additional headers
are provided.
The default behavior is to return null
.
-
-
Returns:
- an array of
Header
instances or null
-
See Also:
-
Header
getBody
public
String getBody()
- Returns HTML code to be placed inside the
<body>
tag or
null
if no custom HTML code should be placed inside the
<body> tag.
Be aware that the HTML code returned by this method is taken as-is
and may break the surrounding HTML page.
The default behavior is to return null
.
-
-
Returns:
- body HTML code or
null
showExitConfirmation
public boolean showExitConfirmation()
- Indicates whether an exit confirmation should be shown.
The exit confirmation is shown whenever the user tries to close the
browser window or tab or to navigate to another URL. Usually, browsers
pop up a dialog that allows the user to cancel the operation.
Note that this is a hint that is not supported by every browser.
-
-
Returns:
-
true
if an exit confirmation should be shown -
Since:
- 1.1.1
-
See Also:
-
getExitConfirmationText()
getExitConfirmationText
public
String getExitConfirmationText()
- Returns the message to display in the exit confirmation. Note that
showExitConfirmation()
must return true
to enable
this message.
-
-
Returns:
- the message to be displayed in the exit confirmation
-
Since:
- 1.1.1
-
See Also:
-
showExitConfirmation()
registerResources
public void registerResources()
throws
IOException
- This method is called before the branding is applied for the first time.
Clients may use this to register resources used by the branding such as
the
favIcon
.
The default behavior is to do nothing.
-
-
Throws:
-
IOException
Copyright (c) Innoopract Informationssysteme GmbH and others 2002, 2008. All rights reserved.