Class SimplePageExtension
- java.lang.Object
-
- jetbrains.buildServer.web.openapi.SimplePageExtension
-
- All Implemented Interfaces:
PageExtension
- Direct Known Subclasses:
AdminBeforeContentExtension
,BuildInfoFragmentTab
,ChangeDetailsExtension
,EditBuildRunnerSettingsExtension
,HealthStatusItemPageExtension
,ProjectPortlet
,SetupObjectFromResourcePageExtension
,SimpleCustomTab
,UsagesReportPageExtension
,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
Fields Modifier and Type Field Description protected java.util.List<java.lang.String>
myCssPaths
protected java.util.List<java.lang.String>
myJsPaths
protected PagePlaces
myPagePlaces
-
Constructor Summary
Constructors Constructor Description SimplePageExtension(PagePlaces pagePlaces)
SimplePageExtension(PagePlaces pagePlaces, PlaceId placeId, java.lang.String id, java.lang.String includeUrl)
Creates a simple UI extension.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description SimplePageExtension
addCssFile(java.lang.String path)
Add reference to CSS file to the page which includes this extensionSimplePageExtension
addJsFile(java.lang.String path)
Add reference to Javascript file to the page which includes this extensionvoid
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 extensionjava.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 extensionPlaceId
getPlaceId()
Required by spring frameworkjava.lang.String
getPluginName()
Returns some identifier unique among all extensions within one extension point.boolean
isAvailable(javax.servlet.http.HttpServletRequest request)
Returns true if this extension is available (should be included on the page) for the specified request.protected boolean
isGet(javax.servlet.http.HttpServletRequest request)
protected boolean
isPost(javax.servlet.http.HttpServletRequest 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 pagevoid
setPlaceId(PlaceId placeId)
Set location for this extensionvoid
setPluginName(java.lang.String pluginName)
Set plugin identifiervoid
setPosition(PositionConstraint positionConstraint)
Sets extension position constraintjava.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
-
Methods inherited from interface jetbrains.buildServer.web.openapi.PageExtension
getDisplayName
-
-
-
-
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
@Autowired public SimplePageExtension(PagePlaces pagePlaces)
-
SimplePageExtension
public SimplePageExtension(@NotNull PagePlaces pagePlaces, @NotNull PlaceId placeId, @NotNull @NonNls java.lang.String id, @NonNls java.lang.String includeUrl)
Creates a simple UI extension. Should be registered viaregister()
method to become active.- Parameters:
pagePlaces
- can obtained via SpringplaceId
- determines the UI location where the content will be shownid
- custom id of this extension. Should be unique throughout all the extensions plugged into the same PageIdincludeUrl
- absolute path without web application context of the resource, for plugin resources usePluginDescriptor.getPluginResourcesPath(String)
to obtain it- See Also:
register()
-
-
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. For plugin resources usePluginDescriptor.getPluginResourcesPath(String)
to obtain the path.- Specified by:
getIncludeUrl
in interfacePageExtension
- Returns:
- URL of the page extension content
-
getPluginName
@NotNull public java.lang.String getPluginName()
Description copied from interface:PageExtension
Returns some identifier unique among all extensions within one extension point. Despite its probably confusing name, the result of this method may not be related to any existing plugin names, its just an arbitrary string used to distinguish extensions within one extension point (PlaceId).
Before TeamCity 5.1 plugin name used to determine paths to plugin resources, but since 5.1 it only plays a role of identifier.
- Specified by:
getPluginName
in interfacePageExtension
- Returns:
- extension identifier.
-
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 interfacePageExtension
- 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 interfacePageExtension
- 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. If extension needs to be shown for some pages only, it can obtain original page URL via request attribute called "pageUrl":String pageUrl = (String)request.getAttribute("pageUrl");
- Specified by:
isAvailable
in interfacePageExtension
- 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 interfacePageExtension
- Parameters:
model
- model to modifyrequest
- HTTP request
-
setPlaceId
public void setPlaceId(@NotNull PlaceId placeId)
Set location for this extension- Parameters:
placeId
- location identifier
-
getPlaceId
@NotNull public PlaceId getPlaceId()
Required by spring framework- Returns:
- place for this extension
-
setIncludeUrl
public void setIncludeUrl(@NotNull 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(@NotNull java.lang.String pluginName)
Set plugin identifier- Parameters:
pluginName
- plugin identifier
-
setPosition
public void setPosition(@NotNull PositionConstraint positionConstraint)
Sets extension position constraint- Parameters:
positionConstraint
- positionConstraint
-
addCssFile
@NotNull public SimplePageExtension addCssFile(@NotNull java.lang.String path)
Add reference to CSS file to the page which includes this extension- Parameters:
path
- absolute path without web application context of the CSS file, for plugin resources usePluginDescriptor.getPluginResourcesPath(String)
to obtain it- Returns:
- self
-
addJsFile
@NotNull public SimplePageExtension addJsFile(@NotNull java.lang.String path)
Add reference to Javascript file to the page which includes this extension- Parameters:
path
- absolute path without web application context of the JS file, for plugin resources usePluginDescriptor.getPluginResourcesPath(String)
to obtain it- Returns:
- self
-
isGet
protected boolean isGet(@NotNull javax.servlet.http.HttpServletRequest request)
-
isPost
protected boolean isPost(@NotNull javax.servlet.http.HttpServletRequest request)
-
toString
@NonNls public java.lang.String toString()
- Overrides:
toString
in classjava.lang.Object
-
-