info.aduna.gee.publication.ui
Class WLabel

java.lang.Object
  extended by info.aduna.gee.publication.ui.WLabel

public class WLabel
extends Object


Field Summary
protected static String[] _htmlSpecialDsts
           
protected static String[] _htmlSpecialSrcs
           
protected static String[] _urlSpecialDsts
           
protected static String[] _urlSpecialSrcs
           
 
Constructor Summary
WLabel()
           
 
Method Summary
static String beautifyLabel(String label, boolean upper, boolean colon)
          Beautify label.
static String gsub(String olds, String news, String text)
          Substitute String "old" by String "new" in String "text" everywhere.
static String htmlProtect(int number)
           
static String htmlProtect(String text)
          Turn a String in an HTML save string.
static String jsArgument(int arg)
          Make the text an integer argument for a JavaScript function, including single quotes.
static String jsArgument(String text)
          Make the text an argument for a JavaScript function, including single quotes.
static String jsArgumentProtect(String text)
          Encode special characters in an argument of a JavaScript function.
static void sort(List l)
          Sort a list of strings according to Spectacle's natural ordening.
static void sortedInsert(Vector v, String s)
          Insert a string in a vector (of strings) and maintain the increasing sorting.
static String specialCharProtect(String text)
          Replace HTML special characters by their decimal references.
static String urlDeprotect(String text)
          Decode special characters in a URL.
static String urlProtect(String text)
          Encode special characters in a URL.
static String zDecode(String text)
          JavaScript functions (e.g.
static String zEncode(String text)
          The Java variant of the function applied by JavaScript too.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

_urlSpecialSrcs

protected static String[] _urlSpecialSrcs

_urlSpecialDsts

protected static String[] _urlSpecialDsts

_htmlSpecialSrcs

protected static String[] _htmlSpecialSrcs

_htmlSpecialDsts

protected static String[] _htmlSpecialDsts
Constructor Detail

WLabel

public WLabel()
Method Detail

sort

public static void sort(List l)
Sort a list of strings according to Spectacle's natural ordening.


sortedInsert

public static void sortedInsert(Vector v,
                                String s)
Insert a string in a vector (of strings) and maintain the increasing sorting. Sorting is case-sensitive and numeric sensitive. It is based on Spectacle's native sorting.


beautifyLabel

public static String beautifyLabel(String label,
                                   boolean upper,
                                   boolean colon)
Beautify label.

Parameters:
upper - If true, start with upperCase character.
colon - If true, end with colon character.

urlProtect

public static String urlProtect(String text)
Encode special characters in a URL. This method is the same as JavaScript's escape.


jsArgumentProtect

public static String jsArgumentProtect(String text)
Encode special characters in an argument of a JavaScript function.


jsArgument

public static String jsArgument(String text)
Make the text an argument for a JavaScript function, including single quotes.


jsArgument

public static String jsArgument(int arg)
Make the text an integer argument for a JavaScript function, including single quotes.


urlDeprotect

public static String urlDeprotect(String text)
Decode special characters in a URL. This method is the same as JavaScript's unescape.


zEncode

public static String zEncode(String text)
The Java variant of the function applied by JavaScript too.


zDecode

public static String zDecode(String text)
JavaScript functions (e.g. offerContent) zEncode their text. The zEncoded text runs fine through all passes until it arrives at ZPadTransfer. Still ZPadTransfer should not YET zDecode it. In the process to turn the String into a WProperties, the non-escaped "," is turned into "\n". So the escaped "," should be save and the escaped "\n" should be save too. The zDecode function is used in Entry.create(...). If we would have had base64 in JavaScript, that would have been a better alternative!


specialCharProtect

public static String specialCharProtect(String text)
Replace HTML special characters by their decimal references.


htmlProtect

public static String htmlProtect(String text)
Turn a String in an HTML save string.


htmlProtect

public static String htmlProtect(int number)

gsub

public static String gsub(String olds,
                          String news,
                          String text)
Substitute String "old" by String "new" in String "text" everywhere. NOTE: We only match in the original string, not in the intermediate results. So it is save to substitute e.g. "&" by "&&". This is static util function that I could not place anywhere more appropriate. The name of this function is from the good-old awk time.

Parameters:
olds - The String to be substituted.
news - The String is the new content.
text - The String in which the substitution is done.
Returns:
The result String containing the substitutions; if no substitutions were made, the result is 'text'.


Copyright © 1997-2008 Aduna. All Rights Reserved.