org.datamanager.tools
Class Toolbox

java.lang.Object
  |
  +--org.datamanager.tools.Toolbox

public final class Toolbox
extends Object

A mish-mash of KnownSpace convenience functions.

Author:
Matt Liggett

Field Summary
static String HELIUM_FOLDER
           
 
Constructor Summary
Toolbox()
           
 
Method Summary
static Entity getFirstAttributeNamed(Entity base, String name)
          Returns the first attribute of the given Entity whose name equals the given name.
static Entity getFirstAttributeNamedIgnoringCase(Entity base, String name)
          Returns the first attribute of the given Entity whose name equals the given name, ignoring case in the name.
static File getHeliumDirectory()
          Returns the Helium directory, wherein we should place things like persistence files.
static void launchURL(String urlString)
           
static void launchURL(URL url)
          Fires the LaunchBrowserURLEvent to cause the provided url to be displayed in a browser.
static String searchAndReplace(String content, String regexp, String replacement)
          Replaces regexp in content with replacement.
static String textToPreHtml(String content)
          Returns the String content with new pre tags inserted and all http: or https: URLs manually hreffed.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

HELIUM_FOLDER

public static String HELIUM_FOLDER
Constructor Detail

Toolbox

public Toolbox()
Method Detail

getFirstAttributeNamed

public static final Entity getFirstAttributeNamed(Entity base,
                                                  String name)
                                           throws DataManagerException
Returns the first attribute of the given Entity whose name equals the given name.

DataManagerException

getFirstAttributeNamedIgnoringCase

public static final Entity getFirstAttributeNamedIgnoringCase(Entity base,
                                                              String name)
                                                       throws DataManagerException
Returns the first attribute of the given Entity whose name equals the given name, ignoring case in the name.

DataManagerException

textToPreHtml

public static final String textToPreHtml(String content)
Returns the String content with new pre tags inserted and all http: or https: URLs manually hreffed. This should *not* be invoked on Strings that are already HTML-enated

Parameters:
content - String to be scanned/converted for URLs
Returns:
String converted into
 styled HTML, with
         ..
 links inserted for all http or https URLs.
 
 FIXME: hard-coded bufferOffset constants can be hidden away with an
 insertIntoBuffer method that uses the to-be-added String's length to
 recompute the new bufferOffset.

searchAndReplace

public static final String searchAndReplace(String content,
                                            String regexp,
                                            String replacement)
Replaces regexp in content with replacement.


getHeliumDirectory

public static File getHeliumDirectory()
                               throws FileNotFoundException
Returns the Helium directory, wherein we should place things like persistence files.

FileNotFoundException

launchURL

public static void launchURL(URL url)
Fires the LaunchBrowserURLEvent to cause the provided url to be displayed in a browser.


launchURL

public static void launchURL(String urlString)


See the Helium Website