| java.lang.Object org.netbeans.modules.visualweb.gravy.Bundle
Bundle | public class Bundle (Code) | | Helper class to get strings from NetBeans Bundle.properties files.
Everytime someone wants to identify a component by its title, label, caption or whatever,
he should not use hard coded string in his test case but he should use
Bundle.getString(bundleName, key) to obtain string from bundle.
Then test cases can be executed on different than English locale because
getString() methods returns string according to current locale.
Usage:
// "OK"
Bundle.getString("org.netbeans.core.Bundle", "OK_OPTION_CAPTION");
// "Properties of AnObject"
Bundle.getString("org.netbeans.core.Bundle", "CTL_FMT_LocalProperties", new Object[] {new Integer(1), "AnObject"});
// "View"
Bundle.getStringTrimmed("org.netbeans.core.Bundle", "Menu/View");
|
Method Summary | |
public static ResourceBundle | getBundle(String bundle) Returns ResourceBundle from specified path.
Parameters: bundle - path to bundle (e.g. | public static String | getString(ResourceBundle bundle, String key) Gets string from specified ResourceBundle. | public static String | getString(ResourceBundle bundle, String key, Object[] params) Gets string from bundle specified by path to bundle and format it.
Parameters: bundle - path to bundle (e.g. | public static String | getString(String bundle, String key) Gets string from bundle specified by path to bundle.
Parameters: bundle - path to bundle (e.g. | public static String | getString(String bundle, String key, Object[] params) Gets string from bundle specified by path to bundle and format it.
Parameters: bundle - path to bundle (e.g. | public static String | getStringTrimmed(String bundle, String key) Gets string from bundle, removes mnemonic (i.e. | public static String | getStringTrimmed(String bundle, String key, Object[] params) Gets string from bundle and formats it. |
getBundle | public static ResourceBundle getBundle(String bundle)(Code) | | Returns ResourceBundle from specified path.
Parameters: bundle - path to bundle (e.g. "org.netbeans.core.Bundle") ResourceBundle instance |
getString | public static String getString(ResourceBundle bundle, String key)(Code) | | Gets string from specified ResourceBundle.
Parameters: bundle - instance of ResourceBundle Parameters: key - key of requested string string from bundle in current locale |
getString | public static String getString(ResourceBundle bundle, String key, Object[] params)(Code) | | Gets string from bundle specified by path to bundle and format it.
Parameters: bundle - path to bundle (e.g. "org.netbeans.core.Bundle") Parameters: key - key of requested string Parameters: params - parameters to be formatted string from bundle in current locale with formatted parameters |
getString | public static String getString(String bundle, String key)(Code) | | Gets string from bundle specified by path to bundle.
Parameters: bundle - path to bundle (e.g. "org.netbeans.core.Bundle") Parameters: key - key of requested string string from bundle in current locale |
getString | public static String getString(String bundle, String key, Object[] params)(Code) | | Gets string from bundle specified by path to bundle and format it.
Parameters: bundle - path to bundle (e.g. "org.netbeans.core.Bundle") Parameters: key - key of requested string Parameters: params - parameter to be formatted string from bundle in current locale with formatted parameters |
getStringTrimmed | public static String getStringTrimmed(String bundle, String key)(Code) | | Gets string from bundle, removes mnemonic (i.e. '&' or '(&X)') from it
and cuts parameters like {0} from the end.
Parameters: bundle - path to bundle (e.g. "org.netbeans.core.Bundle") Parameters: key - key of requested string string from bundle in current locale. Mnemonic (i.e. '&' or '(&X)')is removed and parameter patterns are also removed starting by first '{'. |
getStringTrimmed | public static String getStringTrimmed(String bundle, String key, Object[] params)(Code) | | Gets string from bundle and formats it. It removes mnemonic (i.e. '&' or '(&X)')
from it and cuts parameters like {0} from the end if any.
Parameters: bundle - path to bundle (e.g. "org.netbeans.core.Bundle") Parameters: key - key of requested string Parameters: params - parameter to be formatted string from bundle in current locale. Mnemonic and parameters like {0} removed from the end. |
|
|