public class WebUtils extends Object
Modifier and Type | Field and Description |
---|---|
static SimpleDateFormat |
dateFormatter
The default date formatting "yyyy-MM-dd HH:mm:ss"
|
Constructor and Description |
---|
WebUtils() |
Modifier and Type | Method and Description |
---|---|
static String |
bite(String s,
int length)
Split a string in to bites divide by "<BR/>".
|
static String |
bite(String s,
int length,
int maxLength)
Split a string in to bites divide by "<BR/>".
|
static String |
formatDate(Date date)
Formats a date to a string value.
|
static String |
formEnd()
Returns a FORM end tag.
|
static String |
formStartSetValue(dk.heick.properties.Property<?> property,
WebAction action,
String url)
Generates a string containing the web FORM start for action on a Property.
|
static String |
formStartSetValue(dk.heick.properties.PropertyIO io,
WebAction action,
String url)
Generates a string containing the web FORM start for action on a PropertyIO .
|
static String |
getBookmark(String name)
Gets a defined book mark name.
|
static String |
getPropertyBookmark(dk.heick.properties.Property<?> property)
Gets the bookmark name of the property.
|
static String |
getTableEnd()
Returns a TABLE end tag.
|
static String |
getTableStart()
Returns default TABLE start tag.
|
static String |
getTDClass(int value)
Gets the CSS class to be used in for a TD row tag.
|
static int |
parseInt(javax.servlet.http.HttpServletRequest request,
WebName webName)
Parses an request parameter value to an integer
|
static int |
parseInt(String s)
Parse a string to an integer, if not possible -1 is returned.
|
static String |
renderPropertyTypeRestrictions(dk.heick.properties.Property<?> property)
Generates PropertyType restrictions as list.
|
public static final SimpleDateFormat dateFormatter
public static String bite(String s, int length)
s
- the string to divide.length
- the max length of each line.public static String bite(String s, int length, int maxLength)
s
- the string to divide.length
- the max length of each line.maxLength
- the total max length that will be rendered, if the string is longer, it will be cut of and added "(more...)
". If maxLength is 0 or less, this is ignored.public static String formStartSetValue(dk.heick.properties.Property<?> property, WebAction action, String url)
action.name()
property.getName()
(property.getType().getClass().getName()
property
- the property which FORM has to be renderer.action
- the action.url
- the URL to redirect the form POST to.public static String formStartSetValue(dk.heick.properties.PropertyIO io, WebAction action, String url)
action.name()
io.getName()
io
- the PropertyIO which FORM has to be renderer.action
- the action.url
- the URL to redirect the form POST to.public static String formEnd()
public static String getTableStart()
public static String getTableEnd()
public static String getPropertyBookmark(dk.heick.properties.Property<?> property)
property
- the propertynull
otherwise "M_property.name".public static String getBookmark(String name)
name
- the namenull
otherwise "M_name".public static String formatDate(Date date)
date
- the date[NULL]
if the date is null, otherwise the formatted date.public static int parseInt(javax.servlet.http.HttpServletRequest request, WebName webName)
request
- the HttpServletRequest context.webName
- the paramenter namepublic static int parseInt(String s)
s
- the stringpublic static String renderPropertyTypeRestrictions(dk.heick.properties.Property<?> property)
property
- the property.public static String getTDClass(int value)
value
- the row indexCSSNames.TD_EVEN_ROW
if even, otherwise CSSNames.TD_ODD_ROW
.