com.indexdata.mkjsf.utils
Class UiUtils

java.lang.Object
  extended by com.indexdata.mkjsf.utils.UiUtils

@Named(value="pzui")
@ApplicationScoped
public class UiUtils
extends Object

UI utilities

Author:
Niels Erik

Constructor Summary
UiUtils()
           
 
Method Summary
static String concat(String... strings)
          Concatenates a list of strings
static String concatMaxLength(int maxTotalLength, String... strings)
           
 List<ResponseDataObject> getMaxElements(ResponseDataObject container, String elementName, int maxElements, int maxTotalValueLength, boolean hardLimit)
          Gets at most maxElements data objects, up to a total string length of maxTotalValueLength
static List<ResponseDataObject> getMaxNumElements(ResponseDataObject container, String elementName, int maxElements)
          Gets at most maxElements elements of the given elementName
static String maxLength(String string, int maxLength)
           
static String maxLengthMoreLabel(String string, int maxLength, String moreLabel)
           
static String quote(String string)
          Encloses a string with quotation marks
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

UiUtils

public UiUtils()
Method Detail

concat

public static String concat(String... strings)
Concatenates a list of strings

Parameters:
strings -
Returns:

concatMaxLength

public static String concatMaxLength(int maxTotalLength,
                                     String... strings)

maxLength

public static String maxLength(String string,
                               int maxLength)

maxLengthMoreLabel

public static String maxLengthMoreLabel(String string,
                                        int maxLength,
                                        String moreLabel)

quote

public static String quote(String string)
Encloses a string with quotation marks

Parameters:
string -
Returns:

getMaxNumElements

public static List<ResponseDataObject> getMaxNumElements(ResponseDataObject container,
                                                         String elementName,
                                                         int maxElements)
Gets at most maxElements elements of the given elementName

Parameters:
container - The parent element containing the elements to retrieve
elementName - The name of the element(s) to retrieve
maxElements - Maximum number of elements to retrieve
Returns:
At most maxElements data objects of the given type

getMaxElements

public List<ResponseDataObject> getMaxElements(ResponseDataObject container,
                                               String elementName,
                                               int maxElements,
                                               int maxTotalValueLength,
                                               boolean hardLimit)
Gets at most maxElements data objects, up to a total string length of maxTotalValueLength

Parameters:
container - The parent element containing the elements to retrieve
elementName - The name of the element(s) to retrieve
maxElements - Maximum number of elements to retrieve
maxTotalValueLength - The maximum total string length of the values of the elements retrieved
hardLimit - If set to true, the list will be cut of at or below the total string length, if false, the list will contain the first element that exceeds the length limit - for instance thus guaranteeing that at least one of the elements will be returned, no matter it's length.
Returns:
Delimited list of elements


Copyright © 2013. All Rights Reserved.