org.rhq.enterprise.gui.common.tag
Class FunctionTagLibrary

java.lang.Object
  extended by com.sun.facelets.tag.AbstractTagLibrary
      extended by org.rhq.enterprise.gui.common.tag.FunctionTagLibrary
All Implemented Interfaces:
com.sun.facelets.tag.TagLibrary

public class FunctionTagLibrary
extends com.sun.facelets.tag.AbstractTagLibrary

A Facelets tag library containing custom EL functions for use in RHQ GUI pages. *NOTE*: There are weird issues with Facelets function taglibs - whenever possible, managed beans should be used instead.

Author:
Ian Springer

Field Summary
static String ELLIPSIS
           
static FunctionTagLibrary INSTANCE
          Current instance of library.
static String NAMESPACE
          Namespace used to import this library in Facelets pages
 
Constructor Summary
FunctionTagLibrary()
           
 
Method Summary
static String contextFragmentURL()
           
static String contextFragmentURLForIndicatorsChart()
          This method is akin to contextFragmentURL() but produces a correct fragment for the indicators chart action (/resource/common/monitor/visibility/IndicatorCharts.do).
static String elideString(String str, int numChars, String mode)
          Elides given string using an ellipsis character.
static String elideStringCustom(String str, int numChars, String mode, String ellipsis)
          Elides given string using the specified ellipsis.
static String formatTimestamp(long timestamp)
          Deprecated. use f:convertDateTime tag instead
static String getAlertPriorityURL(org.rhq.core.domain.alert.AlertPriority priority)
           
static String getAlertSenderConfigurationPreview(org.rhq.core.domain.alert.notification.AlertNotification alertNotification)
           
static String getAvailabilityURL(org.rhq.core.domain.measurement.AvailabilityType type, int size)
           
static String getChartURLParams(org.rhq.core.domain.measurement.ui.MetricDisplaySummary summary)
           
static String getDefaultAutoGroupTabURL()
           
static String getDefaultContextTabURL(org.rhq.core.domain.common.EntityContext context)
           
static String getDefaultGroupTabURL()
           
static String getDefaultResourceTabURL()
           
static String getEventSeverityURL(org.rhq.core.domain.event.EventSeverity severity, boolean grouped)
           
static org.rhq.core.domain.resource.composite.ResourceFacets getFacets()
           
static org.rhq.core.domain.resource.composite.ResourcePermission getGroupPermission(int groupId)
          Returns a ResourcePermission object for the group with the specified id.
static
<T> List<T>
getListFromMap(Map<String,T> map)
           
static String getOperationStatusURL(org.rhq.core.domain.operation.OperationRequestStatus status)
           
static org.rhq.core.domain.resource.Resource getResource(int resourceId)
           
static String getResourceConfigStatusURL(org.rhq.core.domain.configuration.ConfigurationUpdateStatus status)
           
static org.rhq.core.domain.resource.composite.ResourceFacets getResourceFacets(int resourceTypeId)
          Returns a ResourceFacets object that represents the facets (measurement, configuration, etc.) that are supported by the resource type with the specified id.
static org.rhq.core.domain.resource.composite.ResourcePermission getResourcePermission()
          Returns a ResourcePermission object for the resource associated with the current request.
static WebUserPreferences getWebUserPreferences()
           
static boolean isIE6()
           
static
<T> int
length(T[] collection)
           
static void loadResource()
          Loads the Resource with the id specified via the 'id' query string parameter in the current request, and sticks the Resource into the request context as the "Resource" attribute.
static int sizeOf(Collection<?> collection)
           
 
Methods inherited from class com.sun.facelets.tag.AbstractTagLibrary
addComponent, addComponent, addConverter, addConverter, addFunction, addTagHandler, addUserTag, addValidator, addValidator, containsFunction, containsNamespace, containsTagHandler, createFunction, createTagHandler, getNamespace
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

ELLIPSIS

public static final String ELLIPSIS
See Also:
Constant Field Values

NAMESPACE

public static final String NAMESPACE
Namespace used to import this library in Facelets pages

See Also:
Constant Field Values

INSTANCE

public static final FunctionTagLibrary INSTANCE
Current instance of library.

Constructor Detail

FunctionTagLibrary

public FunctionTagLibrary()
Method Detail

loadResource

public static void loadResource()
Loads the Resource with the id specified via the 'id' query string parameter in the current request, and sticks the Resource into the request context as the "Resource" attribute.


getResourceFacets

public static org.rhq.core.domain.resource.composite.ResourceFacets getResourceFacets(int resourceTypeId)
Returns a ResourceFacets object that represents the facets (measurement, configuration, etc.) that are supported by the resource type with the specified id. Individual facets can be checked easily via EL, e.g.: <c:set var="resourceFacets" value="${onf:getResourceFacets(Resource.resourceType.id)}"/> <c:if test="${resourceFacets.measurement}"> ...

Parameters:
resourceTypeId - a ResourceType id
Returns:
a ResourceFacets object for the resource type with the specified id

getFacets

public static org.rhq.core.domain.resource.composite.ResourceFacets getFacets()

getResourcePermission

public static org.rhq.core.domain.resource.composite.ResourcePermission getResourcePermission()
Returns a ResourcePermission object for the resource associated with the current request. Individual permissions can be checked easily via EL, e.g.: <c:set var="resourcePerm" value="${onf:getResourcePermission()}"/> <c:if test="${resourcePerm.measure}"> ...

Returns:
a ResourcePermission object for the resource with the specified id

getGroupPermission

public static org.rhq.core.domain.resource.composite.ResourcePermission getGroupPermission(int groupId)
Returns a ResourcePermission object for the group with the specified id. Individual permissions can be checked easily via EL, e.g.: <c:set var="groupPerm" value="${onf:getGroupPermission(groupId)}"/> <c:if test="${groupPerm.measure}"> ...

Parameters:
groupId - a ResourceGroup id
Returns:
a ResourcePermission object for the group with the specified id

formatTimestamp

@Deprecated
public static String formatTimestamp(long timestamp)
Deprecated. use f:convertDateTime tag instead

Formats the specified milliseconds-since-epoch timestamp as a String.

Parameters:
timestamp - a milliseconds-since-epoch timestamp
Returns:
a String representation of the timestamp

sizeOf

public static int sizeOf(Collection<?> collection)

length

public static <T> int length(T[] collection)

getWebUserPreferences

public static WebUserPreferences getWebUserPreferences()

contextFragmentURL

public static String contextFragmentURL()

contextFragmentURLForIndicatorsChart

public static String contextFragmentURLForIndicatorsChart()
This method is akin to contextFragmentURL() but produces a correct fragment for the indicators chart action (/resource/common/monitor/visibility/IndicatorCharts.do). This legacy struts action expects a "ctype" parameter where the new UI uses "type".

Returns:
context fragment of the URL based on the current entity.

getResource

public static org.rhq.core.domain.resource.Resource getResource(int resourceId)

elideString

public static String elideString(String str,
                                 int numChars,
                                 String mode)
Elides given string using an ellipsis character. The mode is one of "left", "right", "middle" (case insensitive).

See Also:
elideStringCustom(String, int, String, String)

elideStringCustom

public static String elideStringCustom(String str,
                                       int numChars,
                                       String mode,
                                       String ellipsis)
Elides given string using the specified ellipsis. The mode is one of "left", "right", "middle" (case insensitive). The resulting string has at most numChars characters.

Parameters:
str - the string to elide
numChars - the length of the elided string
mode - the elide mode
ellipsis - the ellipsis string
Returns:
the elided string

getChartURLParams

public static String getChartURLParams(org.rhq.core.domain.measurement.ui.MetricDisplaySummary summary)

getListFromMap

public static <T> List<T> getListFromMap(Map<String,T> map)

getDefaultContextTabURL

public static String getDefaultContextTabURL(org.rhq.core.domain.common.EntityContext context)

getDefaultResourceTabURL

public static String getDefaultResourceTabURL()

getDefaultGroupTabURL

public static String getDefaultGroupTabURL()

getDefaultAutoGroupTabURL

public static String getDefaultAutoGroupTabURL()

getAvailabilityURL

public static String getAvailabilityURL(org.rhq.core.domain.measurement.AvailabilityType type,
                                        int size)

getAlertPriorityURL

public static String getAlertPriorityURL(org.rhq.core.domain.alert.AlertPriority priority)

getResourceConfigStatusURL

public static String getResourceConfigStatusURL(org.rhq.core.domain.configuration.ConfigurationUpdateStatus status)

getOperationStatusURL

public static String getOperationStatusURL(org.rhq.core.domain.operation.OperationRequestStatus status)

getEventSeverityURL

public static String getEventSeverityURL(org.rhq.core.domain.event.EventSeverity severity,
                                         boolean grouped)

getAlertSenderConfigurationPreview

public static String getAlertSenderConfigurationPreview(org.rhq.core.domain.alert.notification.AlertNotification alertNotification)

isIE6

public static boolean isIE6()


Copyright © 2008-2012 Red Hat, Inc.. All Rights Reserved.