DefaultTextProvider gets texts from only the default resource bundles associated with the
LocalizedTextUtil.
| Method from com.opensymphony.xwork2.DefaultTextProvider Detail: |
public String getText(String key) {
return LocalizedTextUtil.findDefaultText(key, ActionContext.getContext().getLocale());
}
|
public String getText(String key,
String defaultValue) {
String text = getText(key);
if (text == null) {
return defaultValue;
}
return text;
}
|
public String getText(String key,
List<Object> args) {
Object[] params;
if (args != null) {
params = args.toArray();
} else {
params = EMPTY_ARGS;
}
return LocalizedTextUtil.findDefaultText(key, ActionContext.getContext().getLocale(), params);
}
|
public String getText(String key,
String[] args) {
Object[] params;
if (args != null) {
params = args;
} else {
params = EMPTY_ARGS;
}
return LocalizedTextUtil.findDefaultText(key, ActionContext.getContext().getLocale(), params);
}
|
public String getText(String key,
String defaultValue,
List<Object> args) {
String text = getText(key, args);
if(text == null && defaultValue == null) {
defaultValue = key;
}
if (text == null && defaultValue != null) {
MessageFormat format = new MessageFormat(defaultValue);
format.setLocale(ActionContext.getContext().getLocale());
format.applyPattern(defaultValue);
Object[] params;
if (args != null) {
params = args.toArray();
} else {
params = EMPTY_ARGS;
}
return format.format(params);
}
return text;
}
|
public String getText(String key,
String defaultValue,
String[] args) {
String text = getText(key, args);
if (text == null) {
MessageFormat format = new MessageFormat(defaultValue);
format.setLocale(ActionContext.getContext().getLocale());
format.applyPattern(defaultValue);
if (args == null) {
return format.format(EMPTY_ARGS);
}
return format.format(args);
}
return text;
}
|
public String getText(String key,
String defaultValue,
String obj) {
List< Object > args = new ArrayList< Object >(1);
args.add(obj);
return getText(key, defaultValue, args);
}
|
public String getText(String key,
String defaultValue,
List<Object> args,
ValueStack stack) {
//we're not using the value stack here
return getText(key, defaultValue, args);
}
|
public String getText(String key,
String defaultValue,
String[] args,
ValueStack stack) {
//we're not using the value stack here
List< Object > values = new ArrayList< Object >(Arrays.asList(args));
return getText(key, defaultValue, values);
}
|
public ResourceBundle getTexts() {
return null;
}
|
public ResourceBundle getTexts(String bundleName) {
return LocalizedTextUtil.findResourceBundle(bundleName, ActionContext.getContext().getLocale());
}
|
public boolean hasKey(String key) {
return getText(key) != null;
}
|