com.groiss.wf.html
Class HTMLUtils

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

public class HTMLUtils
extends java.lang.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 java.lang.String SELECTLIST_LIST
           
static java.lang.String SELECTLIST_TABLE
           
 
Constructor Summary
HTMLUtils()
           
 
Method Summary
protected static java.lang.String addPattern(java.lang.String searchString)
          adds % to the searchstring, based on the selectlist.search property (either infix, or prefix search)
 Page agentSelectList(javax.servlet.http.HttpServletRequest req)
          Deprecated. use selectUserOrRole(HttpServletRequest)
static void editConditionParams(java.util.Map<java.lang.String,java.lang.String> params)
           
static java.lang.String getDisplayValue(DMSForm form, java.lang.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.
static Link getDocumentsLink(ActivityInstance si)
           
static Link getDocumentsLink(ActivityInstance si, java.lang.String comingFrom)
           
static java.util.List getFormLinkList(ActivityInstance ai, int mode, java.lang.String comingFrom, java.lang.String target, boolean buttonsInToolbar, boolean withToolbar)
           
static java.lang.String getFormLinks(ActivityInstance ai, int mode, java.lang.String comingFrom, java.lang.String target)
           
static Link getNotesLink(ActivityInstance ai)
           
static
<T extends Persistent>
T
getObject(javax.servlet.http.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(javax.servlet.http.HttpServletRequest req, java.lang.String key)
           
static Persistent getObject(org.json.JSONObject obj)
           
static Persistent getObject(java.lang.String obj)
          Deprecated. since 8.0; use StoreUtil.getObject(Object) instead
static
<T extends Persistent>
java.util.List<T>
getObjectList(javax.servlet.http.HttpServletRequest req, java.lang.String key)
          Get list of objects (from multiple selection list) stored in request under key
static java.util.List<Pair<java.lang.String,java.lang.String>> getObjectListForComponent(java.util.List<Persistent> l)
           
static java.util.List<Persistent> getObjects(java.lang.Class c, java.util.Map<java.lang.String,java.lang.String> params, boolean isTable)
           
static java.util.Map<java.lang.String,java.lang.String> getParameters(javax.servlet.http.HttpServletRequest req, boolean avoidSqlInjection)
           
static Pair<java.lang.String,java.util.List<java.lang.Object>> getSearchCondition(Persistent o, java.lang.String searchAttrs, java.lang.String searchString)
          builds a condition for querying the given Persistent uses the global setting for smartSearch
static Pair<java.lang.String,java.util.List<java.lang.Object>> getSearchCondition(Persistent o, java.lang.String searchAttrs, java.lang.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 java.util.Collection<Pair> getSelectList2(javax.servlet.http.HttpServletRequest req)
           
static java.util.Collection<Pair> getSelectList2(java.util.Map<java.lang.String,java.lang.String> params)
           
static Pair getSelectListObject(java.util.Map<java.lang.String,java.lang.String> params)
          Used for object selection UI control to retrieve the initial display value for the selected list item.
static Pair getSelectObjectById(long oid, java.util.Map<java.lang.String,java.lang.String> params)
           
static java.lang.String getStandardSearchIdOfClass(java.lang.Class<?> c)
           
static Page refreshWorklist(javax.servlet.http.HttpServletRequest req, Application appl)
          Returns a page that redirects to the current worklist of this application
 Page roleList(javax.servlet.http.HttpServletRequest request)
           
 Page selectDocTemplates(javax.servlet.http.HttpServletRequest req)
           
static Page selectList(javax.servlet.http.HttpServletRequest req)
          Shows a list of objects for selection in form of a selectlist
static Page selectList(java.util.Map<java.lang.String,java.lang.String> params, javax.servlet.http.HttpServletRequest req)
           
static Page selectList2(javax.servlet.http.HttpServletRequest req)
          Shows a list of objects for selection in form of a selectlist
static Page selectTable(javax.servlet.http.HttpServletRequest req)
           
static Page selectUserOrRole(javax.servlet.http.HttpServletRequest req)
           
static Page showEmptyForm(DMSForm f, java.lang.String buttons, javax.servlet.http.HttpServletRequest req)
          Deprecated.  
static Page showForm(DMSForm form, java.util.List<Component> buttons, java.lang.String action, FormContext ctx)
          Show a form.
static Page showForm(javax.servlet.http.HttpServletRequest req)
           
static Page showForm(javax.servlet.http.HttpServletRequest r, ActivityInstance ai, java.lang.String formid, int mode)
          Show a process form.
static Page showForm(javax.servlet.http.HttpServletRequest r, ActivityInstance ai, java.lang.String formid, int mode, java.lang.String buttons)
          Deprecated.  
 Page showPrintForm(javax.servlet.http.HttpServletRequest req)
          This method returns a page containing a print version of a form.
static Page showProcessDetail(javax.servlet.http.HttpServletRequest req)
           
static Link showSubformLink(javax.servlet.http.HttpServletRequest req, java.lang.String title, java.lang.String subformid, int width, int height, java.lang.String tablehandler)
           
static Link showSubformLink(javax.servlet.http.HttpServletRequest req, java.lang.String title, java.lang.String subformid, int width, int height, java.lang.String tablehandler, java.lang.String actions)
           
static Link showSubformLink(javax.servlet.http.HttpServletRequest req, java.lang.String title, java.lang.String subformid, int width, int height, java.lang.String tablehandler, java.lang.String actions, java.lang.String defaultAction)
           
static Link showSubformLink(javax.servlet.http.HttpServletRequest req, java.lang.String title, java.lang.String subformid, int width, int height, java.lang.String tablehandler, java.lang.String actions, java.lang.String defaultAction, java.lang.String page)
           
static Link showSubformLink(Persistent obj, java.lang.String title, java.lang.String subformid, int width, int height, java.lang.String tablehandler, java.lang.String actions, java.lang.String defaultAction, java.lang.String page)
           
static void showWorklist(javax.servlet.http.HttpServletRequest r, javax.servlet.http.HttpServletResponse res, com.dec.avw.core.Application appl, int type, java.lang.String worklist, java.lang.String functions)
          sends the worklist to the browser.
static org.json.JSONObject toJSON(Persistent obj)
           
 Page userList(javax.servlet.http.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 java.lang.String SELECTLIST_TABLE
See Also:
Constant Field Values

SELECTLIST_LIST

public static final java.lang.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(javax.servlet.http.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(javax.servlet.http.HttpServletRequest r,
                                javax.servlet.http.HttpServletResponse res,
                                com.dec.avw.core.Application appl,
                                int type,
                                java.lang.String worklist,
                                java.lang.String functions)
                         throws java.lang.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:
java.lang.Exception

showForm

public static Page showForm(javax.servlet.http.HttpServletRequest req)
                     throws java.lang.Exception
Throws:
java.lang.Exception

showForm

public static Page showForm(javax.servlet.http.HttpServletRequest r,
                            ActivityInstance ai,
                            java.lang.String formid,
                            int mode)
                     throws java.lang.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
java.lang.Exception

showForm

public static Page showForm(DMSForm form,
                            java.util.List<Component> buttons,
                            java.lang.String action,
                            FormContext ctx)
                     throws java.lang.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:
java.lang.Exception

showPrintForm

public Page showPrintForm(javax.servlet.http.HttpServletRequest req)
                   throws java.lang.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:
java.lang.Exception

showProcessDetail

public static Page showProcessDetail(javax.servlet.http.HttpServletRequest req)
                              throws java.lang.Exception
Throws:
java.lang.Exception

selectList

public static Page selectList(javax.servlet.http.HttpServletRequest req)
                       throws java.lang.Exception
Shows a list of objects for selection in form of a selectlist

Throws:
java.lang.Exception

selectList

public static Page selectList(java.util.Map<java.lang.String,java.lang.String> params,
                              javax.servlet.http.HttpServletRequest req)
                       throws java.lang.Exception
Throws:
java.lang.Exception

selectTable

public static Page selectTable(javax.servlet.http.HttpServletRequest req)
                        throws java.lang.Exception
Throws:
java.lang.Exception

selectList2

public static Page selectList2(javax.servlet.http.HttpServletRequest req)
                        throws java.lang.Exception
Shows a list of objects for selection in form of a selectlist

Throws:
java.lang.Exception

getSelectListObject

public static Pair getSelectListObject(java.util.Map<java.lang.String,java.lang.String> params)
                                throws java.lang.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
java.lang.Exception

getParameters

public static java.util.Map<java.lang.String,java.lang.String> getParameters(javax.servlet.http.HttpServletRequest req,
                                                                             boolean avoidSqlInjection)

getSelectList2

public static java.util.Collection<Pair> getSelectList2(javax.servlet.http.HttpServletRequest req)
                                                 throws HTMLUtils.TooManyResultsException,
                                                        java.lang.Exception
Throws:
HTMLUtils.TooManyResultsException
java.lang.Exception

getSelectObjectById

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

editConditionParams

public static void editConditionParams(java.util.Map<java.lang.String,java.lang.String> params)

getObjects

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

getSelectList2

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

agentSelectList

@Deprecated
public Page agentSelectList(javax.servlet.http.HttpServletRequest req)
                     throws java.lang.Exception
Deprecated. use selectUserOrRole(HttpServletRequest)

Throws:
java.lang.Exception

roleList

public Page roleList(javax.servlet.http.HttpServletRequest request)
              throws java.lang.Exception
Throws:
java.lang.Exception

userList

public Page userList(javax.servlet.http.HttpServletRequest r)
              throws java.lang.Exception
Throws:
java.lang.Exception

getObject

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

toJSON

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

selectUserOrRole

public static Page selectUserOrRole(javax.servlet.http.HttpServletRequest req)
                             throws java.lang.Exception
Throws:
java.lang.Exception

getObject

public static <T extends Persistent> T getObject(javax.servlet.http.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(javax.servlet.http.HttpServletRequest req,
                                                 java.lang.String key)

getObject

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


getDocumentsLink

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

getDocumentsLink

public static Link getDocumentsLink(ActivityInstance si,
                                    java.lang.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 java.lang.Exception
Returns:
a link to the notes of a process
Throws:
java.lang.Exception

getFormLinks

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

getFormLinkList

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

showSubformLink

public static Link showSubformLink(javax.servlet.http.HttpServletRequest req,
                                   java.lang.String title,
                                   java.lang.String subformid,
                                   int width,
                                   int height,
                                   java.lang.String tablehandler)
                            throws java.lang.Exception
Throws:
java.lang.Exception

showSubformLink

public static Link showSubformLink(javax.servlet.http.HttpServletRequest req,
                                   java.lang.String title,
                                   java.lang.String subformid,
                                   int width,
                                   int height,
                                   java.lang.String tablehandler,
                                   java.lang.String actions)
                            throws java.lang.Exception
Throws:
java.lang.Exception

showSubformLink

public static Link showSubformLink(javax.servlet.http.HttpServletRequest req,
                                   java.lang.String title,
                                   java.lang.String subformid,
                                   int width,
                                   int height,
                                   java.lang.String tablehandler,
                                   java.lang.String actions,
                                   java.lang.String defaultAction)
                            throws java.lang.Exception
Throws:
java.lang.Exception

showSubformLink

public static Link showSubformLink(javax.servlet.http.HttpServletRequest req,
                                   java.lang.String title,
                                   java.lang.String subformid,
                                   int width,
                                   int height,
                                   java.lang.String tablehandler,
                                   java.lang.String actions,
                                   java.lang.String defaultAction,
                                   java.lang.String page)
                            throws java.lang.Exception
Throws:
java.lang.Exception

showSubformLink

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

getObjectList

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

Parameters:
req -
key -
Throws:
java.lang.Exception

getObjectListForComponent

public static java.util.List<Pair<java.lang.String,java.lang.String>> getObjectListForComponent(java.util.List<Persistent> l)

getDisplayValue

public static java.lang.String getDisplayValue(DMSForm form,
                                               java.lang.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,
                                            java.lang.String buttons,
                                            javax.servlet.http.HttpServletRequest req)
                          throws java.lang.Exception
Deprecated. 

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

showForm

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

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

getStandardSearchIdOfClass

public static java.lang.String getStandardSearchIdOfClass(java.lang.Class<?> c)

getSearchCondition

public static Pair<java.lang.String,java.util.List<java.lang.Object>> getSearchCondition(Persistent o,
                                                                                         java.lang.String searchAttrs,
                                                                                         java.lang.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<java.lang.String,java.util.List<java.lang.Object>> getSearchCondition(Persistent o,
                                                                                         java.lang.String searchAttrs,
                                                                                         java.lang.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 java.lang.String addPattern(java.lang.String searchString)
adds % to the searchstring, based on the selectlist.search property (either infix, or prefix search)

Parameters:
searchString -
Returns:

selectDocTemplates

public Page selectDocTemplates(javax.servlet.http.HttpServletRequest req)
                        throws java.lang.Exception
Throws:
java.lang.Exception


@enterprise 8.0.22989 Copyright © 2001-2017 Groiss Informatics GmbH. All Rights Reserved.