Portlet Factory, Version 6.1.2


 

Inheriting input and coordinator behavior

An input definition can inherit from any other input definition in the system, by setting the base attribute of the InputDefinition to the builder ID followed by the input name. For example, the following input inherits from the ServableContent input defined in com/bowstreet/core/Base.bdef:

<InputDefinition name="ImportedPage_URL" base="com.bowstreet.core.Base.ServableContent">
  <Prompt>URL</Prompt>
  <InitialValue />
  <HelpText />
  <Required>true</Required>
  <Visible>true</Visible>
  <ProfileType>Value</ProfileType>
  <Callable>true</Callable>
</InputDefinition>

Input definitions can inherit in this way from any IBM® WebSphere Portlet Factory or custom builders.

You can also inherit coordinator behavior from another builder. For example, if you have a coordinator that initializes a Select input with a list of files from a particular folder, you can inherit that behavior in any other builders. To do this, first set the base attribute for the input definition as described above. Then, add an element called UseAssociatedCoordinator to the input definition with a value of true. Here is an example from the Sample Input Types builder in the Tutorials and Samples - Builders feature set:

<InputDefinition name="SchemaFileName" base="com.bowstreet.samples.builders.SampleCoordinatorBuilder.SchemaFile">
    <Prompt>SchemaFileName</Prompt>
    <Required>false</Required>
    <Group>CustomPickers</Group>
    <HelpText>Example of inherited Coordinator behavior</HelpText>
    <UseAssociatedCoordinator>true</UseAssociatedCoordinator>
</InputDefinition>

The UseAssociatedCoordinator element can be set in the derived input, as in the example above, or it can be set in the base input. If it is set in the base input, any inputs that inherit using the base attribute will automatically inherit the coordinator behavior. This can provide a simple mechanism for creating your own set of pickers.

This coordinator inheritance can be used for individual input definitions as in the example above, or it can be used for sets of cooperating inputs, such as when a choice in one input is used to populate a list of choices in another input.

There is a companion element to UseSharedCoordinator called CoordinatorNamespace. This element allows you to give a name to one or more inputs to allow the coordinator sharing feature to distinguish these groups from each other. For example:

<InputDefinition name="Shared1" base="TheBaseBuilder.TheBaseInput">
    <UseAssociatedCoordinator>true</UseAssociatedCoordinator>
    <CoordinatorNamespace>FirstSharedInput</CoordinatorNamespace>
</InputDefinition>
<InputDefinition name="Shared2" base="TheBaseBuilder.TheBaseInput">
    <UseAssociatedCoordinator>true</UseAssociatedCoordinator>
    <CoordinatorNamespace>SecondSharedInput</CoordinatorNamespace>
</InputDefinition>

Parent topic: About creating builder definitions


Library | Support |