Package com.orchestranetworks.ui

# Interface UILabelRendererContext

All Superinterfaces:
  `UIBodyWriter`

All Known Subinterfaces:
  `UILabelRendererForHierarchyContext`

public interface UILabelRendererContext extends UIBodyWriter
Provides a context for displaying a record.

See Also:
  - `UILabelRenderer`

- ## Method Summary

  Modifier and Type
  Method
  Description
  `String`
  `displayOccurrenceValue(Path aPath, boolean useLabels)`
  Returns a user-friendly representation of the specified value, according the current locale.
  `Perspective`
  `getCurrentPerspective()`
  Returns the current perspective.
  `UICustomViewContext`
  `getCustomViewContext()`
  Returns the view context.
  `String`
  `getLabelFromDefaultPattern()`
  Returns the label resolved from the default pattern.
  `Locale`
  `getLocale()`
  Returns the current locale of the user session.
  `Adaptation`
  `getOccurrence()`
  Returns the current record that is being displayed.
  `Session`
  `getSession()`
  Returns the current user session.
  `String`
  `getURLForResource(ResourceType aResourceType, String aResourceName)`
  Returns the URL of the specified web resource, in the current module and for the current session locale.
  `String`
  `getURLForResource(ResourceType aResourceType, String aResourceName, Locale aLocale)`
  Returns the URL of the specified web resource, in the current module (that is, the module of the current adaptation).
  `String`
  `getURLForResource(String aModuleAliasOrName, ResourceType aResourceType, String aResourceName, Locale aLocale)`
  Returns the URL of the specified web resource.
  `boolean`
  `isHTMLForbidden()`
  Returns `true` if the HTML tags in the label are escaped.

  ### Methods inherited from interface com.orchestranetworks.ui.UIBodyWriter

  `add, add, add, add_cr, add_cr, addSafeAttribute, addSafeAttribute, addSafeInnerHTML, addSafeInnerHTML`

- ## Method Details

  - ### getLocale

    Locale getLocale()
    Returns the current locale of the user session.
    Throws:
      `RuntimeException` - if this method is called by a renderer defined inside a foreign key constraint.

  - ### getURLForResource

    String getURLForResource(ResourceType aResourceType, String aResourceName)
    Returns the URL of the specified web resource, in the current module and for the current session locale. Returns `null` if called outside the context of an HTTP request (for instance through `Adaptation.getLabel(Locale)`).
    Throws:
      `UnsupportedOperationException` - if the resource type is internal (not accessible from HTTP).
      `ModuleNotFoundException` - if the alias or name specified does not correspond to a module.
    See Also:
      - `getURLForResource(ResourceType, String, Locale)`
      - `getLocale()`

  - ### getURLForResource

    String getURLForResource(ResourceType aResourceType, String aResourceName, Locale aLocale)
    Returns the URL of the specified web resource, in the current module (that is, the module of the current adaptation). Returns `null` if called outside the context of an HTTP request (for instance through `Adaptation.getLabel(Locale)`).
    Throws:
      `UnsupportedOperationException` - if the resource type is internal (not accessible from HTTP).
      `ModuleNotFoundException` - if the alias or name specified does not correspond to a module.

  - ### getURLForResource

    String getURLForResource(String aModuleAliasOrName, ResourceType aResourceType, String aResourceName, Locale aLocale) throws ModuleNotFoundException
    Returns the URL of the specified web resource. Returns `null` if called outside the context of an HTTP request (for instance through `Adaptation.getLabel(Locale)`).
    Throws:
      `RuntimeException` - if the resource type is internal (not accessible from HTTP).
      `ModuleNotFoundException` - if the alias or name specified does not correspond to a module.

  - ### getOccurrence

    Adaptation getOccurrence()
    Returns the current record that is being displayed.

  - ### displayOccurrenceValue

    String displayOccurrenceValue(Path aPath, boolean useLabels)
    Returns a user-friendly representation of the specified value, according the current locale.

    ##### Value display

    A value can have be displayed differently from a standard XML formatted value since it can take into account locale-dependent formatting for numbers and dates and also, if `useLabels` is `true` for specific value labeling.

    For more information, see `value display section`.

    Parameters:
      `aPath` - specifies the value to display in the record (a relative path is interpreted based on the root node of this context).
      `useLabels` - If `true` and labeling is enabled (see above), specifies that the label associated with the value must be returned. Otherwise, the formatted value is returned.
    Throws:
      `IllegalStateException` - if this node is not for a record (see `getOccurrence()`).
      `RuntimeException` - if this method is called by a renderer defined inside a foreign key constraint.
    See Also:
      - `SchemaNode.formatToXsString(Object)`
      - `SchemaNode.displayOccurrence(Object, boolean, ValueContext, Locale)`

  - ### getLabelFromDefaultPattern

    String getLabelFromDefaultPattern()
    Returns the label resolved from the default pattern.

    If the table definition in the data model defines a pattern, then the returned label matches this pattern.

    The default pattern is looked up on the elements `<defaultLabel [xml:lang="..."]>`, which are specified by the table definition.

    If no pattern is defined, then the returned label is the formatted primary key. (The localized value of each node of the primary key separated by white spaces.)

    See Also:
      - Table Definition

  - ### getSession

    Session getSession()
    Returns the current user session.

  - ### isHTMLForbidden

    boolean isHTMLForbidden()
    Returns `true` if the HTML tags in the label are escaped. Returns `false` if they are interpreted.

    If this method returns `true`, then the HTML tags in the label are not interpreted and are displayed as plain text.

    Since:
      5.9.0

  - ### getCurrentPerspective

    Perspective getCurrentPerspective()
    Returns the current perspective.
    Since:
      6.0.0

  - ### getCustomViewContext

    UICustomViewContext getCustomViewContext()
    Returns the view context.
    Since:
      6.1.0