Package com.orchestranetworks.schema

# Interface TableRefDisplay

public interface TableRefDisplay
Defines a custom renderer for displaying a foreign key constraint depending on the context of a node.

For example, a data model contains the following:

>      <xs:annotation>
>                     <xs:appinfo>
>                             <osd:otherFacets>
>                              <osd:tableRef>
>                                     <tablePath>../catalog</tablePath>
>                                     <display osd:class="com.foo.CatalogRenderer">
>                                             <param1>...</param1>
>                                             <param2>...</param2>
>                                     </display>
>                              </osd:tableRef>
>                             </osd:otherFacets>
>                     </xs:appinfo>
>     </xs:annotation>

where `com.foo.CatalogRenderer` is the fully qualified name of the class that implement this interface.

The declaration may use parameters, `param1` and `param2` in the example, which are are JavaBean properties of the `com.foo.CatalogRenderer` class.

For more information, see the JavaBean specification.

### Life cycle

1. When the data model is loaded:
   1. the specified class is instantiated through its default constructor and its JavaBean property setters are called (in the example above, the setter methods would be `setParam1(...)` and `setParam2(...)`);
   2. the method `setup(TableRefDisplayContext)` is called on the new instance.
2. During the operational phase: the method `displayOccurrence(Adaptation, Locale)` is called each time an associated element is to be displayed.

- ## Method Summary

  Modifier and Type
  Method
  Description
  `String`
  `displayOccurrence(Adaptation aRecord, Locale aLocale)`
  Returns an end-user label for the specified record.
  `void`
  `setup(TableRefDisplayContext aContext)`
  This method is called when the data model is loaded, to check and prepare this instance.

- ## Method Details

  - ### setup

    void setup(TableRefDisplayContext aContext)
    This method is called when the data model is loaded, to check and prepare this instance.

    This method can also declare a specific sort criteria.

  - ### displayOccurrence

    String displayOccurrence(Adaptation aRecord, Locale aLocale) throws InvalidSchemaException
    Returns an end-user label for the specified record.

    ##### Internationalization strategy

    This method returns `null` if the specified locale is not handled by the current implementation. The container tries several locales when handling a partial internationalization of this method's implementation and/or a mismatch between the locales declared by the associated module and the locales supported by EBX®. In such cases, locales are tried in the following order:

    1. User's preferred locale for the data model (see `Session.getLocaleForSchemaNode(SchemaNode)`);
    2. Session's current locale;
    3. Default locale declared in the file `module.xml`;

    ##### Multi-threading

    For a single instance of this interface, this method may be called concurrently by several threads.

    Parameters:
      `aRecord` - The record to be displayed, never `null`.
      `aLocale` - The current locale, never `null`. see Internationalization strategy above.
    Throws:
      `InvalidSchemaException` - if a dynamic condition in the data model prevents the execution of this method.