com.groiss.wf.html
Class HTMLUtils

java.lang.Object
  extended by com.groiss.wf.html.HTMLUtils

public class HTMLUtils
extends Object

Some utility methods for building HTML GUIs


Nested Class Summary
static class HTMLUtils.TooManyResultsException
          Exception is thrown in case the total count of entries exceeds the configured maximum.
 
Field Summary
static int COMP_MODE
           
static int SAFE_MODE
           
static String SELECTLIST_LIST
           
static String SELECTLIST_TABLE
           
 
Constructor Summary
HTMLUtils()
           
 
Method Summary
protected static String addPattern(String searchString)
          adds % to the searchstring, based on the selectlist.search property (either infix, or prefix search)
 Page agentSelectList(HttpServletRequest req)
          Deprecated. use selectUserOrRole(HttpServletRequest)
static void editConditionParams(Map<String,String> params)
           
static String getDisplayValue(DMSForm form, String field)
          returns the given field's display value this can be: for dates: can be either a CalUtil.showDate(Object) or the CalUtil.showDateTime(Object) representation of the value for selectlist-values: the localized display-value of the selectlist-option for decimal fields: the formatted value using Settings.getDecimalFormatter() with the max. fraction and integer digits set as defined for the field
static Link getDocumentsLink(ActivityInstance si)
           
static Link getDocumentsLink(ActivityInstance si, String comingFrom)
           
static List getFormLinkList(ActivityInstance ai, int mode, String comingFrom, String target, boolean buttonsInToolbar, boolean withToolbar)
           
static String getFormLinks(ActivityInstance ai, int mode, String comingFrom, String target)
           
static Link getNotesLink(ActivityInstance ai)
           
static
<T extends Persistent>
T
getObject(HttpServletRequest req)
          This method returns a persistent object when the request contains a parameter "object" with a value in the form <classname>:<oid>.
static
<T extends Persistent>
T
getObject(HttpServletRequest req, String key)
           
static Persistent getObject(JSONObject obj)
           
static Persistent getObject(String obj)
          Deprecated. since 8.0; use StoreUtil.getObject(Object) instead
static
<T extends Persistent>
List<T>
getObjectList(HttpServletRequest req, String key)
          Get list of objects (from multiple selection list) stored in request under key
static List<Pair<String,String>> getObjectListForComponent(List<Persistent> l)
           
static List<Persistent> getObjects(Class c, Map<String,String> params, boolean isTable)
           
static Map<String,String> getParameters(HttpServletRequest req, boolean avoidSqlInjection)
           
static Pair<String,List<Object>> getSearchCondition(Persistent o, String searchAttrs, String searchString)
          builds a condition for querying the given Persistent uses the global setting for smartSearch
static Pair<String,List<Object>> getSearchCondition(Persistent o, String searchAttrs, String searchString, boolean smartSearch)
          builds a condition querying the given Persistent if smartSearch is true, the given searchString will be splitted, and searched in each searchAttr on it's own
static Collection<Pair> getSelectList2(HttpServletRequest req)
           
static Collection<Pair> getSelectList2(Map<String,String> params)
           
static Pair getSelectListObject(Map<String,String> params)
          Used for object selection UI control to retrieve the initial display value for the selected list item.
static Pair getSelectObjectById(long oid, Map<String,String> params)
           
static String getStandardSearchIdOfClass(Class<?> c)
           
static Page refreshWorklist(HttpServletRequest req, Application appl)
          Returns a page that redirects to the current worklist of this application
 Page roleList(HttpServletRequest request)
           
 Page selectDocTemplates(HttpServletRequest req)
           
static Page selectList(HttpServletRequest req)
          Shows a list of objects for selection in form of a selectlist
static Page selectList(Map<String,String> params, HttpServletRequest req)
           
static Page selectList2(HttpServletRequest req)
          Shows a list of objects for selection in form of a selectlist
static Page selectTable(HttpServletRequest req)
           
static Page selectUserOrRole(HttpServletRequest req)
           
static Page showEmptyForm(DMSForm f, String buttons, HttpServletRequest req)
          Deprecated.  
static Page showForm(DMSForm form, List<Component> buttons, String action, FormContext ctx)
          Show a form.
static Page showForm(HttpServletRequest req)
           
static Page showForm(HttpServletRequest r, ActivityInstance ai, String formid, int mode)
          Show a process form.
static Page showForm(HttpServletRequest r, ActivityInstance ai, String formid, int mode, String buttons)
          Deprecated.  
 Page showPrintForm(HttpServletRequest req)
          This method returns a page containing a print version of a form.
static Page showProcessDetail(HttpServletRequest req)
           
static Link showSubformLink(HttpServletRequest req, String title, String subformid, int width, int height, String tablehandler)
           
static Link showSubformLink(HttpServletRequest req, String title, String subformid, int width, int height, String tablehandler, String actions)
           
static Link showSubformLink(HttpServletRequest req, String title, String subformid, int width, int height, String tablehandler, String actions, String defaultAction)
           
static Link showSubformLink(HttpServletRequest req, String title, String subformid, int width, int height, String tablehandler, String actions, String defaultAction, String page)
           
static Link showSubformLink(Persistent obj, String title, String subformid, int width, int height, String tablehandler, String actions, String defaultAction, String page)
           
static void showWorklist(HttpServletRequest r, HttpServletResponse res, com.dec.avw.core.Application appl, int type, String worklist, String functions)
          sends the worklist to the browser.
static JSONObject toJSON(Persistent obj)
           
 Page userList(HttpServletRequest r)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

SELECTLIST_TABLE

public static final String SELECTLIST_TABLE
See Also:
Constant Field Values

SELECTLIST_LIST

public static final String SELECTLIST_LIST
See Also:
Constant Field Values

SAFE_MODE

public static final int SAFE_MODE
See Also:
Constant Field Values

COMP_MODE

public static final int COMP_MODE
See Also:
Constant Field Values
Constructor Detail

HTMLUtils

public HTMLUtils()
Method Detail

refreshWorklist

public static Page refreshWorklist(HttpServletRequest req,
                                   Application appl)
Returns a page that redirects to the current worklist of this application

Parameters:
req - the HTTP request
appl - the application

showWorklist

public static void showWorklist(HttpServletRequest r,
                                HttpServletResponse res,
                                com.dec.avw.core.Application appl,
                                int type,
                                String worklist,
                                String functions)
                         throws Exception
sends the worklist to the browser.

Parameters:
r - the HTTP request
res - the HTTP response
appl - the application
type - the type: 0..user, 1..role, 2..suspension list
worklist - a worklist implementation (implements com.groiss.wf.html.Worklist)
functions - a space-separated list of function ids
Throws:
Exception

showForm

public static Page showForm(HttpServletRequest req)
                     throws Exception
Throws:
Exception

showForm

public static Page showForm(HttpServletRequest r,
                            ActivityInstance ai,
                            String formid,
                            int mode)
                     throws Exception
Show a process form.

Parameters:
r - the request
ai - the current activity
formid - the id of the form in the process definition
mode - the mode
Throws:
HTMLUtils.TooManyResultsException
Exception

showForm

public static Page showForm(DMSForm form,
                            List<Component> buttons,
                            String action,
                            FormContext ctx)
                     throws Exception
Show a form.

Parameters:
form - the form object
buttons - a list of components, buttons are shown on the bottom of the form, hidden fields are included in the form.
action - the submit action (Hint: If a XForm is used, the submit action must be defined at the Submit button!)
ctx - the form context
Returns:
a HTMLPage for HTML-forms, else an XHTMLPage
Throws:
Exception

showPrintForm

public Page showPrintForm(HttpServletRequest req)
                   throws Exception
This method returns a page containing a print version of a form. It requires that the req contains a parameter 'object' with the classname:oid of the form. The method removes all buttons and adds a header and footer to the page.

Throws:
Exception

showProcessDetail

public static Page showProcessDetail(HttpServletRequest req)
                              throws Exception
Throws:
Exception

selectList

public static Page selectList(HttpServletRequest req)
                       throws Exception
Shows a list of objects for selection in form of a selectlist

Throws:
Exception

selectList

public static Page selectList(Map<String,String> params,
                              HttpServletRequest req)
                       throws Exception
Throws:
Exception

selectTable

public static Page selectTable(HttpServletRequest req)
                        throws Exception
Throws:
Exception

selectList2

public static Page selectList2(HttpServletRequest req)
                        throws Exception
Shows a list of objects for selection in form of a selectlist

Throws:
Exception

getSelectListObject

public static Pair getSelectListObject(Map<String,String> params)
                                throws Exception
Used for object selection UI control to retrieve the initial display value for the selected list item.

Parameters:
params - the map of parameters
Returns:
the Pair object with the key and display value for the selected object
Throws:
HTMLUtils.TooManyResultsException - in case of an error
Exception

getParameters

public static Map<String,String> getParameters(HttpServletRequest req,
                                               boolean avoidSqlInjection)

getSelectList2

public static Collection<Pair> getSelectList2(HttpServletRequest req)
                                       throws HTMLUtils.TooManyResultsException,
                                              Exception
Throws:
HTMLUtils.TooManyResultsException
Exception

getSelectObjectById

public static Pair getSelectObjectById(long oid,
                                       Map<String,String> params)
                                throws Exception
Throws:
Exception

editConditionParams

public static void editConditionParams(Map<String,String> params)

getObjects

public static List<Persistent> getObjects(Class c,
                                          Map<String,String> params,
                                          boolean isTable)
                                   throws Exception
Throws:
Exception

getSelectList2

public static Collection<Pair> getSelectList2(Map<String,String> params)
                                       throws Exception
Throws:
Exception

agentSelectList

@Deprecated
public Page agentSelectList(HttpServletRequest req)
                     throws Exception
Deprecated. use selectUserOrRole(HttpServletRequest)

Throws:
Exception

roleList

public Page roleList(HttpServletRequest request)
              throws Exception
Throws:
Exception

userList

public Page userList(HttpServletRequest r)
              throws Exception
Throws:
Exception

getObject

public static Persistent getObject(JSONObject obj)
                            throws JSONException
Throws:
JSONException

toJSON

public static JSONObject toJSON(Persistent obj)
                         throws JSONException
Throws:
JSONException

selectUserOrRole

public static Page selectUserOrRole(HttpServletRequest req)
                             throws Exception
Throws:
Exception

getObject

public static <T extends Persistent> T getObject(HttpServletRequest req)
This method returns a persistent object when the request contains a parameter "object" with a value in the form <classname>:<oid>. The method returns null if no such parameter is present or the object is not in the database. if the oid is 0 it returrns a new instance of the class.

Parameters:
req -
Returns:
a persistent object or null
Throws:
HTMLUtils.TooManyResultsException

getObject

public static <T extends Persistent> T getObject(HttpServletRequest req,
                                                 String key)

getObject

@Deprecated
public static Persistent getObject(String obj)
Deprecated. since 8.0; use StoreUtil.getObject(Object) instead


getDocumentsLink

public static Link getDocumentsLink(ActivityInstance si)
                             throws Exception
Returns:
a link to the document folder
Throws:
Exception

getDocumentsLink

public static Link getDocumentsLink(ActivityInstance si,
                                    String comingFrom)
Parameters:
comingFrom - the url for the back button in the document table
Returns:
a link to the document folder

getNotesLink

public static Link getNotesLink(ActivityInstance ai)
                         throws Exception
Returns:
a link to the notes of a process
Throws:
Exception

getFormLinks

public static String getFormLinks(ActivityInstance ai,
                                  int mode,
                                  String comingFrom,
                                  String target)

getFormLinkList

public static List getFormLinkList(ActivityInstance ai,
                                   int mode,
                                   String comingFrom,
                                   String target,
                                   boolean buttonsInToolbar,
                                   boolean withToolbar)
Returns:
links to the forms

showSubformLink

public static Link showSubformLink(HttpServletRequest req,
                                   String title,
                                   String subformid,
                                   int width,
                                   int height,
                                   String tablehandler)
                            throws Exception
Throws:
Exception

showSubformLink

public static Link showSubformLink(HttpServletRequest req,
                                   String title,
                                   String subformid,
                                   int width,
                                   int height,
                                   String tablehandler,
                                   String actions)
                            throws Exception
Throws:
Exception

showSubformLink

public static Link showSubformLink(HttpServletRequest req,
                                   String title,
                                   String subformid,
                                   int width,
                                   int height,
                                   String tablehandler,
                                   String actions,
                                   String defaultAction)
                            throws Exception
Throws:
Exception

showSubformLink

public static Link showSubformLink(HttpServletRequest req,
                                   String title,
                                   String subformid,
                                   int width,
                                   int height,
                                   String tablehandler,
                                   String actions,
                                   String defaultAction,
                                   String page)
                            throws Exception
Throws:
Exception

showSubformLink

public static Link showSubformLink(Persistent obj,
                                   String title,
                                   String subformid,
                                   int width,
                                   int height,
                                   String tablehandler,
                                   String actions,
                                   String defaultAction,
                                   String page)
                            throws Exception
Throws:
Exception

getObjectList

public static <T extends Persistent> List<T> getObjectList(HttpServletRequest req,
                                                           String key)
                                                throws Exception
Get list of objects (from multiple selection list) stored in request under key

Parameters:
req -
key -
Throws:
Exception

getObjectListForComponent

public static List<Pair<String,String>> getObjectListForComponent(List<Persistent> l)

getDisplayValue

public static String getDisplayValue(DMSForm form,
                                     String field)
returns the given field's display value this can be:

Parameters:
form - the form
field - the field, the text will be returned
Returns:
the fields display value or null if no text was found

showEmptyForm

@Deprecated
public static Page showEmptyForm(DMSForm f,
                                            String buttons,
                                            HttpServletRequest req)
                          throws Exception
Deprecated. 

Throws:
Exception
See Also:
showForm(DMSForm, List, String, FormContext)

showForm

@Deprecated
public static Page showForm(HttpServletRequest r,
                                       ActivityInstance ai,
                                       String formid,
                                       int mode,
                                       String buttons)
                     throws Exception
Deprecated. 

Throws:
Exception
See Also:
or, showForm(HttpServletRequest, ActivityInstance, String, int)

getStandardSearchIdOfClass

public static String getStandardSearchIdOfClass(Class<?> c)

getSearchCondition

public static Pair<String,List<Object>> getSearchCondition(Persistent o,
                                                           String searchAttrs,
                                                           String searchString)
builds a condition for querying the given Persistent uses the global setting for smartSearch

Parameters:
o -
searchAttrs - the attrs, comma separated
searchString - the search-string
Returns:

getSearchCondition

public static Pair<String,List<Object>> getSearchCondition(Persistent o,
                                                           String searchAttrs,
                                                           String searchString,
                                                           boolean smartSearch)
builds a condition querying the given Persistent if smartSearch is true, the given searchString will be splitted, and searched in each searchAttr on it's own

Parameters:
o -
searchAttrs -
searchString -
smartSearch - use smartSearch?
Returns:

addPattern

protected static String addPattern(String searchString)
adds % to the searchstring, based on the selectlist.search property (either infix, or prefix search)

Parameters:
searchString -
Returns:

selectDocTemplates

public Page selectDocTemplates(HttpServletRequest req)
                        throws Exception
Throws:
Exception


@enterprise 8.0.10809 Copyright © 2001-2012 Groiss Informatics GmbH. All Rights Reserved.