freemind.main

Class Tools

public class Tools extends Object

Nested Class Summary
static classTools.BooleanHolder
static classTools.IntHolder
static classTools.ObjectHolder
static classTools.Pair
Field Summary
static SetexecutableExtensions
Method Summary
static StringBooleanToXml(boolean col)
static StringcolorToXml(Color col)
static booleanexecutableByExtension(String file)
static StringexpandFileName(String file)
Replaces a ~ in a filename with the users home directory
static StringexpandPlaceholders(String message, String s1)
Example: expandPlaceholders("Hello $1.","Dolly"); => "Hello Dolly."
static StringexpandPlaceholders(String message, String s1, String s2)
static StringexpandPlaceholders(String message, String s1, String s2, String s3)
static StringfirstLetterCapitalized(String text)
static SetgetAvailableFontFamilyNames()
static VectorgetAvailableFontFamilyNamesAsVector()
static StringgetExtension(File f)
Returns the lowercase of the extension of a file.
static StringgetExtension(String s)
Returns the lowercase of the extension of a file name.
static booleanisAbsolutePath(String path)
static booleanisAvailableFontFamily(String fontFamilyName)
static StringlistToString(List list)
static StringPointToXml(Point col)
static StringremoveExtension(String s)
static booleansafeEquals(String string1, String string2)
static voidsetHidden(File file, boolean hidden, boolean synchronously)
static ListstringToList(String string)
Converts a String in the format "value;value;value" to a List with the values (as strings)
static StringtoRelativeURL(URL base, URL target)
This method converts an absolute url to an url relative to a given base-url.
static StringtoXMLEscapedText(String text)
static StringtoXMLEscapedTextWithNBSPizedSpaces(String text)
static StringtoXMLUnescapedText(String text)
static StringurlGetFile(URL url)
This is a correction of a method getFile of a class URL.
static booleanxmlToBoolean(String string)
static ColorxmlToColor(String string)
static PointxmlToPoint(String string)

Field Detail

executableExtensions

public static final Set executableExtensions

Method Detail

BooleanToXml

public static String BooleanToXml(boolean 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)

PointToXml

public static String PointToXml(Point col)

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)