|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object com.plumtree.uiinfrastructure.statichelpers.GeneralHelpers
public class GeneralHelpers
Constructor Summary | |
---|---|
GeneralHelpers()
|
Method Summary | |
---|---|
static java.lang.String |
BreakDownLongWordsInString(java.lang.String strIn,
int maxCharsPerWord)
Adds spaces into long strings so that it can be displayed with wrapping in HTML without having to truncate. |
static boolean |
ContainsUnsafeCharacters(java.lang.String _strStringIn,
boolean bLogErrors)
Helper method that checks whether or not a string contains unsafe characters, such as angle braces for HTML or curly braces for javascript. |
static int[] |
ConvertToInts(java.lang.String data)
This method takes a String with numbers separated by ','s and splits it into an int array. |
static java.lang.String |
ConvertToString(int[] nInts)
This method converts the expanded object types int[] into a comma separated String |
static java.lang.String |
EscapeJavascript(java.lang.String strInput)
This method escapes a String for use in Javascript. |
static java.lang.String |
FormatPath(java.lang.String _strPath,
java.lang.String _strDelimiter,
boolean _bForceEndsWith)
|
static java.lang.String |
Replace(java.lang.String s,
java.lang.String sub,
java.lang.String with)
replace substrings within string. |
static void |
SetUIError(AActivitySpace asOwner,
OpenLogComponent uiComponent,
java.lang.String strFunctionName,
java.lang.Exception e,
boolean bThrow,
UIErrorLevel uiErrorLevel,
java.lang.String strErrorMessage)
This helper function sets a UI Error with the messages specified, and optionally throws an exception. |
static java.lang.String |
TruncateLongString(java.lang.String strInput,
int nMaxChars,
boolean bMaximumWordLength)
Description: This function returns a shortened version of a string that is too long. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public GeneralHelpers()
Method Detail |
---|
public static final java.lang.String FormatPath(java.lang.String _strPath, java.lang.String _strDelimiter, boolean _bForceEndsWith)
public static final java.lang.String Replace(java.lang.String s, java.lang.String sub, java.lang.String with)
s
- string to be modifiedsub
- sub-string to search forwith
- string to replace sub-string
public static java.lang.String BreakDownLongWordsInString(java.lang.String strIn, int maxCharsPerWord)
public static java.lang.String TruncateLongString(java.lang.String strInput, int nMaxChars, boolean bMaximumWordLength)
strInput
- String to check.nMaxChars
- Maximum number of characters in a string before
truncation. The length truncated string will
be no longer than this number plus an additional
3 characters for the '...'.bMaximumWordLength
- variable is to specify that you want to
shorten the string only if it has a word in it
longer than nMaxChars.
bMaximumWordLength is used to determine whether or not any word in the
string will be too long and cause the HTML to look bad.
Warning: If the string is going to be HTML Encoded, remember to truncate it
first, and then HTML encode it. Otherwise you can get truncated international
language codes such as ... instead of an actual character.
Examples
--------
TruncateLongString("123456789 123456 12345678 123", 10, True)
Returns: "123456789 123456 12345678 123"
TruncateLongString("123456789 123456 12345678 123", 10, False)
Returns: "123456789..."
TruncateLongString("123456789 123456 1234567890123 123", 12, True)
Returns: "123456789 12..."
TruncateLongString("123456789 123456 1234567890123 123", 10, False)
Returns: "123456789..."
TruncateLongString("123456789 123456 1234567890123 123", 70, False)
Returns: "123456789 123456 1234567890123 123"
TruncateLongString("1234", 2, False)
Returns: "12..."public static java.lang.String EscapeJavascript(java.lang.String strInput)
String
- the String to be escaped
public static int[] ConvertToInts(java.lang.String data)
String
- the comma separated string of numbers to convert
public static final java.lang.String ConvertToString(int[] nInts)
int[]
-
public static void SetUIError(AActivitySpace asOwner, OpenLogComponent uiComponent, java.lang.String strFunctionName, java.lang.Exception e, boolean bThrow, UIErrorLevel uiErrorLevel, java.lang.String strErrorMessage)
asOwner
- - The activity space in which the error was thrownstrFunctionName
- - The function that trapped the error (e.g. MyModel::CheckEditorAccessAndStart)uiComponent
- - The UI component in which the error occurred, e.g. OpenLogService.GetComponent("Portal_UI_Infrastructure")e
- - The exception that has been thrownbThrow
- - Throw an XPException in addition to setting the error?uiErrorLevel
- - The error level (e.g. UIErrorLevel.SERIOUS)strErrorMessage
- - The error message string to be displayedpublic static final boolean ContainsUnsafeCharacters(java.lang.String _strStringIn, boolean bLogErrors)
String
- the string to process
|
|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |