jetbrains.buildServer.web.openapi
Class SimplePageExtension

java.lang.Object
  extended by jetbrains.buildServer.web.openapi.SimplePageExtension
All Implemented Interfaces:
PageExtension
Direct Known Subclasses:
BuildInfoFragmentTab, ChangeDetailsExtension, EditBuildRunnerSettingsExtension, GraphExtension, ProjectPortlet, SimpleCustomTab, ViewBuildRunnerSettingsExtension

public class SimplePageExtension
extends java.lang.Object
implements PageExtension

Simple bean-like component for page extensions. Initialization method - 'register'. You have to specify properties includeUrl, pluginName, placeId


Field Summary
protected  java.util.List<java.lang.String> myCssPaths
           
protected  java.util.List<java.lang.String> myJsPaths
           
protected  PagePlaces myPagePlaces
           
 
Constructor Summary
SimplePageExtension(PagePlaces pagePlaces)
           
SimplePageExtension(PagePlaces pagePlaces, PlaceId placeId, java.lang.String pluginName, java.lang.String includeUrl)
           
 
Method Summary
 SimplePageExtension addCssFile(java.lang.String path)
          Add reference to CSS file to the page which includes this extension
 SimplePageExtension addJsFile(java.lang.String path)
          Add reference to Javascript file to the page which includes this extension
 void fillModel(java.util.Map<java.lang.String,java.lang.Object> model, javax.servlet.http.HttpServletRequest request)
          This method is useful for extensions that do not have controllers (such extensions usually return path to JSP as their include URL).
 java.util.List<java.lang.String> getCssPaths()
          Returns list of additional CSS files paths required by this extension
 java.lang.String getIncludeUrl()
          Returns URL by which this page extension is included.
 java.util.List<java.lang.String> getJsPaths()
          Returns list of additional JavaScript files paths required by this extension
 PlaceId getPlaceId()
          Required by spring framework
 java.lang.String getPluginName()
          Returns name of the plugin to which this extension corresponds.
 boolean isAvailable(javax.servlet.http.HttpServletRequest request)
          Returns true if this extension is available (should be included on the page) for the specified request
 void register()
          Initialization method, makes this extension available.
 void setIncludeUrl(java.lang.String includeUrl)
          Set included URL, may be either jsp file or reference to other page
 void setPlaceId(PlaceId placeId)
          Set location for this extension
 void setPluginName(java.lang.String pluginName)
          Set plugin identifier
 java.lang.String toString()
           
 void unregister()
          Dispose method, makes this extension unavailable.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

myPagePlaces

protected final PagePlaces myPagePlaces

myCssPaths

protected java.util.List<java.lang.String> myCssPaths

myJsPaths

protected java.util.List<java.lang.String> myJsPaths
Constructor Detail

SimplePageExtension

public SimplePageExtension(PagePlaces pagePlaces)

SimplePageExtension

public SimplePageExtension(PagePlaces pagePlaces,
                           PlaceId placeId,
                           @NonNls
                           java.lang.String pluginName,
                           @NonNls
                           java.lang.String includeUrl)
Method Detail

register

public void register()
Initialization method, makes this extension available. Must be called after full initialization of the extension, for instance, via Spring init-method


unregister

public void unregister()
Dispose method, makes this extension unavailable.


getIncludeUrl

@NotNull
public java.lang.String getIncludeUrl()
Description copied from interface: PageExtension
Returns URL by which this page extension is included. This url may point to a JSP file or to a controller. If URL is absolute it must not include context path.

Specified by:
getIncludeUrl in interface PageExtension
Returns:
URL of the page extension content

getPluginName

public java.lang.String getPluginName()
Description copied from interface: PageExtension
Returns name of the plugin to which this extension corresponds. Plugin name is required to make paths to the extension resources.

Specified by:
getPluginName in interface PageExtension
Returns:
name of the plugin to which this extension corresponds.

getCssPaths

@NotNull
public java.util.List<java.lang.String> getCssPaths()
Description copied from interface: PageExtension
Returns list of additional CSS files paths required by this extension

Specified by:
getCssPaths in interface PageExtension
Returns:
list of CSS paths used by extension, see addCssFile(String)

getJsPaths

@NotNull
public java.util.List<java.lang.String> getJsPaths()
Description copied from interface: PageExtension
Returns list of additional JavaScript files paths required by this extension

Specified by:
getJsPaths in interface PageExtension
Returns:
list of Javascript paths used by extension, see addJsFile(String)

isAvailable

public boolean isAvailable(@NotNull
                           javax.servlet.http.HttpServletRequest request)
Description copied from interface: PageExtension
Returns true if this extension is available (should be included on the page) for the specified request

Specified by:
isAvailable in interface PageExtension
Parameters:
request - HTTP request
Returns:
true if extension should be included in the page place

fillModel

public void fillModel(@NotNull
                      java.util.Map<java.lang.String,java.lang.Object> model,
                      @NotNull
                      javax.servlet.http.HttpServletRequest request)
Description copied from interface: PageExtension
This method is useful for extensions that do not have controllers (such extensions usually return path to JSP as their include URL). method is called before processing is passed to JSP. It allows page extension to modify model passed to JSP. Note that since main page controller also uses this model for storing its parameters in case of parameter name conflict extension parameter will be removed and warning message will be logged into the server log.

Specified by:
fillModel in interface PageExtension
Parameters:
model - model to modify
request - HTTP request

setPlaceId

public void setPlaceId(PlaceId placeId)
Set location for this extension

Parameters:
placeId - location identifier

getPlaceId

public PlaceId getPlaceId()
Required by spring framework

Returns:
place for this extension

setIncludeUrl

public void setIncludeUrl(java.lang.String includeUrl)
Set included URL, may be either jsp file or reference to other page

Parameters:
includeUrl - included url specification

setPluginName

public void setPluginName(java.lang.String pluginName)
Set plugin identifier

Parameters:
pluginName - plugin identifier

addCssFile

public SimplePageExtension addCssFile(java.lang.String path)
Add reference to CSS file to the page which includes this extension

Parameters:
path - path to CSS file
Returns:
self

addJsFile

public SimplePageExtension addJsFile(java.lang.String path)
Add reference to Javascript file to the page which includes this extension

Parameters:
path - path to JS file
Returns:
self

toString

@NonNls
public java.lang.String toString()
Overrides:
toString in class java.lang.Object