Oracle™ Business Intelligence Beans Java API Reference
Release 10
g (9.0.4)
Part number B12159_01


oracle.dss.dataView
Interface TokenSubstitution

All Known Implementing Classes:
TokenSubstitutionAdapter

public interface TokenSubstitution

This interface is defined in context with the Insert tab in the UI panels. It defines methods that allow you to substitute text for a token in a String.

To use this interface, you must create four strings for each token that will be replaced by text:

In addition, you must provide conversion between these strings, which are used as follows:

  1. The UI asks you for the array of ListItem strings, so that it knows how to display the Insert drop down list box.
  2. When the end user selects one of the list items, the UI gets the selected ListItem, passes it to you, and asks you for the token to display in the JTextField.
  3. The UI inserts the token into the JTextField.
  4. The UI gives you the String from the JTextField, including the token, and asks you for a String that has the key instead of the token.
  5. The UI gives you the String with the key, to ask you for the parsed String to display in the graph.

When a graph is persisted, the String with key is stored in the XML, and this String is given to your implementation of this interface to restore the parsed String in the graph.


Method Summary
 java.lang.String getKey(java.lang.String listItem)
          Retrieves a keyword for a list item.
 java.lang.String getKeyString(java.lang.String tokenString)
          Retrieves a String that includes unlocalizable keywords instead of localizable tokens.
 java.lang.String[] getListItems()
          Retrieves an array of items for the "Insert" drop-down list box.
 java.lang.String getParsedString(java.lang.String keyString)
          Retrieves a parsed String that is displayed in the view.
 java.lang.String getToken(java.lang.String listItem)
          Retrieves a token that corresponds to a list item.
 java.lang.String getTokenString(java.lang.String keyString)
          Retrieves a String that includes localizable tokens instead of unlocalizable keywords.
 void setLocale(java.util.Locale locale)
          Specifies the Locale for this TokenSubstitution.

 

Method Detail

getListItems

public java.lang.String[] getListItems()
Retrieves an array of items for the "Insert" drop-down list box.
Returns:
The array of items for the UI to display.

getToken

public java.lang.String getToken(java.lang.String listItem)
Retrieves a token that corresponds to a list item. The UI displays this token in the JTextField. The token usually includes an indicator that it will be replaced in the actual view. For example, if the list item is "Date", the token might be "&Date". The UI places this token in the text field with any other text. For example, the text field might then display "Sales Report for &Date".
Parameters:
listItem - The list item that the user selected from the drop-down list.
Returns:
A token for the UI to display in the JTextField.

getKeyString

public java.lang.String getKeyString(java.lang.String tokenString)
Retrieves a String that includes unlocalizable keywords instead of localizable tokens. When the view saves itself in XML, it uses this string to identify the text that it represents. Currently, this key string is also passed to setText methods in graph components. If you present your own UI that allows token substitution, and you call setText methods, you should call this method in your implementation of this interface to get the String to pass to setText.
Parameters:
tokenString - The String that the JTextField displays. This is the String that the user has entered into the text field, including any tokens for replaceable text. tokenString does not have to contain tokens. It might have plain text only.
Returns:
The String that has unlocalizable keys instead of any localizable tokens.

getTokenString

public java.lang.String getTokenString(java.lang.String keyString)
Retrieves a String that includes localizable tokens instead of unlocalizable keywords. The String that this method returns is displayed in the JTextField. The view calls this method when it applies XML that includes a setting for the Text property. The view uses the key string as the Text value in XML.
Parameters:
keyString - The String that can include unlocalizable keys. keyString does not have to include keys. It might have plain text only.
Returns:
A String that contains localizable tokens instead of any keys in keyString.

getParsedString

public java.lang.String getParsedString(java.lang.String keyString)
Retrieves a parsed String that is displayed in the view. The String that this method returns has replacement text in place of the keys in keyString. The setText methods in a graph call this method to retrieve the text to display in the graph text component. If you call setText, be sure to pass a key string and not a token string.
Parameters:
keyString - The string that the view stores as the setting of the Text property.
Returns:
A parsed String that contains localized text instead of any keys in keyString.
See Also:
getKeyString(java.lang.String)

getKey

public java.lang.String getKey(java.lang.String listItem)
Retrieves a keyword for a list item. This method returns a key that corresponds to a specified list item. This method is not used in the 1.5 graph.
Parameters:
listItem - A String that represents a list item from the drop-down "Insert" list.
Returns:
The unlocalizable keyword that corresponds to listItem.

setLocale

public void setLocale(java.util.Locale locale)
Specifies the Locale for this TokenSubstitution. The setLocale method of the view that uses this TokenSubstitution calls this method.
Parameters:
locale - The Locale for this TokenSubstitution.

Oracle™ Business Intelligence Beans Java API Reference
Release 10
g (9.0.4)
Part number B12159_01


Copyright © 2003, Oracle. All Rights Reserved.