Adding Tokens to the Insert Button in the Titles Panel

In the user interface for Java-client applications and applets, the Insert button in the Titles panel has a list of kinds of tokens that users can insert in a title, subtitle, or footnote. The tokens are substitutes for variable information, such as the name of the dimension, a dimension member, the current date, and so on. The TokenSubstitution interface, in the oracle.dss.dataView package, defines methods for a handler that manages the substitution of the text for the token.

The default token substitution handler is the TokenSubstitutionAdapter class, which implements the TokenSubstitution interface. The TokenSubstitutionAdapter class is also in the oracle.dss.dataView package. The TokenSubstitutionAdapter provides substitution for a dimension token, a dimension member token, and a token that includes both the dimension name and the dimension member.

You can either replace the default handler or extend it to add your own tokens to the tokens that the default handler supplies.

Strings that you must provide for each token

For each token that you want to use, you must provide the following strings:

Providing conversion between different strings

The user interface asks the token substitution handler for the different strings that it needs. The user interface passes one kind of string to the handler as it requests another kind of string. For example, the user clicks on an item in the drop-down list, to identify the kind of token that they want in the text. In response, the user interface gets the selected ListItem and calls the getToken method in the TokenSubstitution, to get the token that should be displayed in the text field of the panel.

Your implementation of the TokenSubstitution is responsible for providing the kind of string that the user interface requests.

Where each kind of string is needed

The user interface uses the different kinds of strings as follows:

Registering the token substitution handler

When you implement the TokenSubstitution interface, you must register your implementation with the Dataview, in order for your handler to be effective.

To register your token substitution handler, call the setTokenSubstitution method of the Dataview.

Extending the default token substitution handler

You can extend oracle.dss.dataView.TokenSubstitutionAdapter to add tokens to the default list. In the extension of the default handler, your override of the getListItems method should call super.getListItems and then add your ListItems to the list from the superclass. In your overrides of other methods, you should check the parameter value to see if it corresponds to one of your tokens. If it is one of your tokens, your method should handle it. If not, you call the method of the superclass.