freemind.main

Class Tools


public class Tools
extends java.lang.Object

Nested Class Summary

static class
Tools.BooleanHolder
static class
Tools.IntHolder
static class
Tools.ObjectHolder
static class
Tools.Pair

Field Summary

static Set
executableExtensions

Method Summary

static String
BooleanToXml(boolean col)
static String
PointToXml(Point col)
static String
colorToXml(Color col)
static boolean
executableByExtension(String file)
static String
expandFileName(String file)
Replaces a ~ in a filename with the users home directory
static String
expandPlaceholders(String message, String s1)
Example: expandPlaceholders("Hello $1.","Dolly"); => "Hello Dolly."
static String
expandPlaceholders(String message, String s1, String s2)
static String
expandPlaceholders(String message, String s1, String s2, String s3)
static String
firstLetterCapitalized(String text)
static Set
getAvailableFontFamilyNames()
static Vector
getAvailableFontFamilyNamesAsVector()
static String
getExtension(File f)
Returns the lowercase of the extension of a file.
static String
getExtension(String s)
Returns the lowercase of the extension of a file name.
static boolean
isAbsolutePath(String path)
static boolean
isAvailableFontFamily(String fontFamilyName)
static String
listToString(List list)
static String
removeExtension(String s)
static boolean
safeEquals(String string1, String string2)
static void
setHidden(File file, boolean hidden, boolean synchronously)
static List
stringToList(String string)
Converts a String in the format "value;value;value" to a List with the values (as strings)
static String
toRelativeURL(URL base, URL target)
This method converts an absolute url to an url relative to a given base-url.
static String
toXMLEscapedText(String text)
static String
toXMLEscapedTextWithNBSPizedSpaces(String text)
static String
toXMLUnescapedText(String text)
static String
urlGetFile(URL url)
This is a correction of a method getFile of a class URL.
static boolean
xmlToBoolean(String string)
static Color
xmlToColor(String string)
static Point
xmlToPoint(String string)

Field Details

executableExtensions

public static final Set executableExtensions

Method Details

BooleanToXml

public static String BooleanToXml(boolean col)

PointToXml

public static String PointToXml(Point col)

colorToXml

public static String colorToXml(Color col)

executableByExtension

public static boolean executableByExtension(String file)

expandFileName

public static String expandFileName(String file)
Replaces a ~ in a filename with the users home directory

expandPlaceholders

public static String expandPlaceholders(String message,
                                        String s1)
Example: expandPlaceholders("Hello $1.","Dolly"); => "Hello Dolly."

expandPlaceholders

public static String expandPlaceholders(String message,
                                        String s1,
                                        String s2)

expandPlaceholders

public static String expandPlaceholders(String message,
                                        String s1,
                                        String s2,
                                        String s3)

firstLetterCapitalized

public static String firstLetterCapitalized(String text)

getAvailableFontFamilyNames

public static Set getAvailableFontFamilyNames()

getAvailableFontFamilyNamesAsVector

public static Vector getAvailableFontFamilyNamesAsVector()

getExtension

public static String getExtension(File f)
Returns the lowercase of the extension of a file. Example: getExtension("fork.pork.MM") == "mm"

getExtension

public static String getExtension(String s)
Returns the lowercase of the extension of a file name. Example: getExtension("fork.pork.MM") == "mm"

isAbsolutePath

public static boolean isAbsolutePath(String path)

isAvailableFontFamily

public static boolean isAvailableFontFamily(String fontFamilyName)

listToString

public static String listToString(List list)

removeExtension

public static String removeExtension(String s)

safeEquals

public static boolean safeEquals(String string1,
                                 String string2)

setHidden

public static void setHidden(File file,
                             boolean hidden,
                             boolean synchronously)

stringToList

public static List stringToList(String string)
Converts a String in the format "value;value;value" to a List with the values (as strings)

toRelativeURL

public static String toRelativeURL(URL base,
                                   URL target)
This method converts an absolute url to an url relative to a given base-url. The algorithm is somewhat chaotic, but it works (Maybe rewrite it). Be careful, the method is ".mm"-specific. Something like this should be included in the librarys, but I couldn't find it. You can create a new absolute url with "new URL(URL context, URL relative)".

toXMLEscapedText

public static String toXMLEscapedText(String text)

toXMLEscapedTextWithNBSPizedSpaces

public static String toXMLEscapedTextWithNBSPizedSpaces(String text)

toXMLUnescapedText

public static String toXMLUnescapedText(String text)

urlGetFile

public static String urlGetFile(URL url)
This is a correction of a method getFile of a class URL. Namely, on Windows it returned file paths like /C: etc., which are not valid on Windows. This correction is heuristic to a great extend. One of the reasons is that file:// is basically no protocol at all, but rather something every browser and every system uses slightly differently.

xmlToBoolean

public static boolean xmlToBoolean(String string)

xmlToColor

public static Color xmlToColor(String string)

xmlToPoint

public static Point xmlToPoint(String string)