freemind.main
Class Tools

java.lang.Object
  extended byfreemind.main.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 java.util.Set executableExtensions
           
 
Constructor Summary
Tools()
           
 
Method Summary
static java.lang.String colorToXml(java.awt.Color col)
           
static boolean executableByExtension(java.lang.String file)
           
static java.lang.String expandFileName(java.lang.String file)
          Replaces a ~ in a filename with the users home directory
static java.lang.String expandPlaceholders(java.lang.String message, java.lang.String s1)
          Example: expandPlaceholders("Hello $1."
static java.lang.String expandPlaceholders(java.lang.String message, java.lang.String s1, java.lang.String s2)
           
static java.lang.String expandPlaceholders(java.lang.String message, java.lang.String s1, java.lang.String s2, java.lang.String s3)
           
static java.lang.String firstLetterCapitalized(java.lang.String text)
           
static java.util.Set getAvailableFontFamilyNames()
           
static java.util.Vector getAvailableFontFamilyNamesAsVector()
           
static java.lang.String getExtension(java.io.File f)
          Returns the lowercase of the extension of a file.
static java.lang.String getExtension(java.lang.String s)
          Returns the lowercase of the extension of a file name.
static boolean isAbsolutePath(java.lang.String path)
           
static boolean isAvailableFontFamily(java.lang.String fontFamilyName)
           
static java.lang.String listToString(java.util.List list)
           
static java.lang.String removeExtension(java.lang.String s)
           
static boolean safeEquals(java.lang.String string1, java.lang.String string2)
           
static void setHidden(java.io.File file, boolean hidden, boolean synchronously)
           
static java.util.List stringToList(java.lang.String string)
          Converts a String in the format "value;value;value" to a List with the values (as strings)
static java.lang.String toRelativeURL(java.net.URL base, java.net.URL target)
          This method converts an absolute url to an url relative to a given base-url.
static java.lang.String toXMLEscapedText(java.lang.String text)
           
static java.lang.String toXMLEscapedTextWithNBSPizedSpaces(java.lang.String text)
           
static java.lang.String toXMLUnescapedText(java.lang.String text)
           
static java.lang.String urlGetFile(java.net.URL url)
          This is a correction of a method getFile of a class URL.
static java.awt.Color xmlToColor(java.lang.String string)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

executableExtensions

public static final java.util.Set executableExtensions
Constructor Detail

Tools

public Tools()
Method Detail

executableByExtension

public static boolean executableByExtension(java.lang.String file)

colorToXml

public static java.lang.String colorToXml(java.awt.Color col)

xmlToColor

public static java.awt.Color xmlToColor(java.lang.String string)

stringToList

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


listToString

public static java.lang.String listToString(java.util.List list)

expandFileName

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


getAvailableFontFamilyNames

public static java.util.Set getAvailableFontFamilyNames()

getAvailableFontFamilyNamesAsVector

public static java.util.Vector getAvailableFontFamilyNamesAsVector()

isAvailableFontFamily

public static boolean isAvailableFontFamily(java.lang.String fontFamilyName)

getExtension

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


getExtension

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


removeExtension

public static java.lang.String removeExtension(java.lang.String s)

toXMLEscapedText

public static java.lang.String toXMLEscapedText(java.lang.String text)

toXMLUnescapedText

public static java.lang.String toXMLUnescapedText(java.lang.String text)

toXMLEscapedTextWithNBSPizedSpaces

public static java.lang.String toXMLEscapedTextWithNBSPizedSpaces(java.lang.String text)

isAbsolutePath

public static boolean isAbsolutePath(java.lang.String path)

urlGetFile

public static java.lang.String urlGetFile(java.net.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.


toRelativeURL

public static java.lang.String toRelativeURL(java.net.URL base,
                                             java.net.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)".


safeEquals

public static boolean safeEquals(java.lang.String string1,
                                 java.lang.String string2)

firstLetterCapitalized

public static java.lang.String firstLetterCapitalized(java.lang.String text)

setHidden

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

expandPlaceholders

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


expandPlaceholders

public static java.lang.String expandPlaceholders(java.lang.String message,
                                                  java.lang.String s1,
                                                  java.lang.String s2)

expandPlaceholders

public static java.lang.String expandPlaceholders(java.lang.String message,
                                                  java.lang.String s1,
                                                  java.lang.String s2,
                                                  java.lang.String s3)