public abstract class HelperBase extends Object
| Modifier and Type | Field and Description |
|---|---|
protected RouterContext |
_context
the router context
|
protected Writer |
_out
the writer for output
|
static String |
CHECKED
Checked attribute for HTML checkboxes.
|
static String |
PROP_ADVANCED
Property key for advanced mode.
|
static String |
SELECTED
Selected attribute for HTML select options.
|
| Constructor and Description |
|---|
HelperBase() |
| Modifier and Type | Method and Description |
|---|---|
String |
_t(String s)
Translate a string.
|
String |
_t(String s,
Object o)
Translate a string with a parameter.
|
String |
_t(String s,
Object o,
Object o2)
Translate a string with two parameters.
|
static String |
_x(String s)
Mark a string for extraction by xgettext and translation.
|
protected String |
getChecked(String prop)
Get the checked attribute for a boolean property.
|
protected String |
getCheckedDefaultTrue(String prop)
Get the checked attribute for a boolean property that defaults to true.
|
boolean |
isAdvanced()
Check if advanced mode is enabled.
|
String |
ngettext(String s,
String p,
int n)
Translate a string with plural forms (ngettext).
|
void |
setContextId(String contextId)
Configure this bean to query a particular router context.
|
void |
storeWriter(Writer out)
Store the writer for output.
|
protected RouterContext _context
protected Writer _out
public static final String CHECKED
public static final String PROP_ADVANCED
public static final String SELECTED
public String _t(String s)
s - the string to translatepublic String _t(String s, Object o)
s - string to be translated containing {0}
The {0} will be replaced by the parameter.
Single quotes must be doubled, i.e. ' -> '' in the string.o - parameter, not translated.
To translate parameter also, use _t("foo {0} bar", _t("baz"))
Do not double the single quotes in the parameter.
Use autoboxing to call with ints, longs, floats, etc.public String _t(String s, Object o, Object o2)
s - string to be translated containing {0} and {1}o - first parametero2 - second parameterpublic static String _x(String s)
s - the string to markprotected String getChecked(String prop)
prop - the property name, must default to falseprotected String getCheckedDefaultTrue(String prop)
prop - the property namepublic boolean isAdvanced()
public String ngettext(String s, String p, int n)
s - singular formp - plural formn - the count to determine which form to usepublic void setContextId(String contextId)
contextId - beginning few characters of the routerHash, or null to pick
the first one we come across.public void storeWriter(Writer out)
out - the writer to store