Eclipse Rich Ajax Platform

org.eclipse.rwt.branding
Class AbstractBranding

java.lang.Object
  extended by org.eclipse.rwt.branding.AbstractBranding

public abstract class AbstractBranding
extends java.lang.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

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

Constructor Summary
AbstractBranding()
           
 
Method Summary
 java.lang.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.
 java.lang.String getDefaultEntryPoint()
          Returns the default entry point.
 java.lang.String[] getEntryPoints()
          Returns an array of entry points which are allowed to be the started with this branding (or servlet name).
 java.lang.String getExitConfirmationText()
          Returns the message to display in the exit confirmation.
 java.lang.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.
 java.lang.String getId()
          Returns the id of this branding extension.
 java.lang.String getServletName()
          Returns the name of the servlet on which the application should be available.
 java.lang.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.
 java.lang.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
 

Constructor Detail

AbstractBranding

public AbstractBranding()
Method Detail

getServletName

public java.lang.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 http://<host>:<port>/<servletName>.

The default behavior is to return null.

Returns:
the servlet name, must not return null

getDefaultEntryPoint

public java.lang.String getDefaultEntryPoint()
Returns the default entry point. Returning null or an empty string indicates that there is no default entry point. A URL like http://<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 java.lang.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 java.lang.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 java.lang.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 java.lang.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 java.lang.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 java.lang.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 some browsers do not support at all and others only partly (i.e. showing a generic message instead of the one provided by getExitConfirmationText()).

Returns:
true if an exit confirmation should be shown
Since:
1.1.1
See Also:
getExitConfirmationText()

getExitConfirmationText

public java.lang.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 java.io.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:
java.io.IOException - if an I/O error occurs

Eclipse Rich Ajax Platform

Copyright (c) EclipseSource and others 2002, 2012. All rights reserved.