|
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object jpicedt.MiscUtilities
public class MiscUtilities
A collection of static utilities methods.
Developpers, be careful before adding new methods here : keep in mind that this class MUST remain independent of the jpicedt.ui.* package (as well as of jpicedt.JPicEdt), since it's shipped with the jpicedt's library, which only contains the jpicedt.graphic.* and jpicedt.format.* packages !
Nested Class Summary | |
---|---|
static class |
MiscUtilities.ContentTypeBasics
|
Field Summary | |
---|---|
static int |
DEFAULT_CONTENT_TYPE_INDEX
default index in array returned by getAvailableContentTypes |
static String |
KEY_RECENT_FILE
key used to retrieve the list of recent files from a properties file a ".X" string, where X is a number starting from 1, should be appended to the key beforehands. |
Method Summary | |
---|---|
static void |
addRecentFile(Properties preferences,
String newName)
Add the given file name to the list of recent files in the given Properties object, trimming the length of the list to 10. |
static ExtractionParsing |
createParser()
Return a parser dynamically created from the sub-trees found in directory jpicedt.format |
static String |
formatFontAsProperties(Font font)
format a given Font to a string, following "Font.decode()" format, ie fontname-style-pointsize, fontname-pointsize, fontname-style or fontname, where style is one of "BOLD", "ITALIC", "BOLDITALIC" (default being PLAIN) |
static void |
formatRenderingHints(RenderingHints rh,
Properties preferences)
store the given RenderingHints to a Properties object |
static String[] |
getAvailableContentTypes()
|
static String[][] |
getAvailableContentTypesFileExtensions()
|
static String[] |
getAvailableContentTypesNames()
|
static String |
getClipboardStringContent(Clipboard clipboard)
|
static ContentType |
getContentTypeFromClassName(String contentTypeClassName)
|
static int |
getContentTypeIndex(String contentTypeClassName)
Utility to retrieve the index of the given content-type class name in the array returned by getAvailableContentTypes ; to be used by JComboBox'es. |
static String |
getJPicEdtHome()
Returns JPicEdt's install directory w/o trailing "/", provided the command line looks like : java -classpath other-class-paths:jpicedt-install-dir/lib/jpicedt.jar jpicedt.JPicEdt
(where / may be replaced by the actual
respective separator for files on the underlying
platform). |
static File |
getOSTmpDir()
Return the platform standard tmp dir, or null if none is standardly defined. |
static void |
main(String[] args)
|
static double |
parseDouble(String val)
Return a double parsed from the given string, possibly formatted with a "%" sign |
static boolean |
parseProperty(Properties preferences,
String key,
boolean def)
|
static Color |
parseProperty(Properties preferences,
String key,
Color def)
|
static double |
parseProperty(Properties preferences,
String key,
double def)
|
static int |
parseProperty(Properties preferences,
String key,
int def)
Return a integer parsed from the value associated with the given key, or "def" in key wasn't found. |
static ArrayList<String> |
parseRecentFiles(Properties preferences)
|
static RenderingHints |
parseRenderingHints(Properties preferences)
Returns a RenderingHints parsed from the given Properties |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final int DEFAULT_CONTENT_TYPE_INDEX
public static String KEY_RECENT_FILE
Method Detail |
---|
public static String[] getAvailableContentTypes()
public static String[] getAvailableContentTypesNames()
public static String[][] getAvailableContentTypesFileExtensions()
public static int getContentTypeIndex(String contentTypeClassName)
getAvailableContentTypes
; to be used by JComboBox'es.
contentTypeClassName
- e.g. "jpicedt.format.latex.LatexContentType"
public static ContentType getContentTypeFromClassName(String contentTypeClassName)
public static ExtractionParsing createParser()
public static boolean parseProperty(Properties preferences, String key, boolean def)
public static Color parseProperty(Properties preferences, String key, Color def)
public static double parseProperty(Properties preferences, String key, double def)
NumberFormat.getPercentInstance
to convert it to a double.public static int parseProperty(Properties preferences, String key, int def)
public static RenderingHints parseRenderingHints(Properties preferences)
public static void formatRenderingHints(RenderingHints rh, Properties preferences)
public static double parseDouble(String val) throws NumberFormatException, ParseException
NumberFormatException
ParseException
public static String formatFontAsProperties(Font font)
public static ArrayList<String> parseRecentFiles(Properties preferences)
public static void addRecentFile(Properties preferences, String newName)
public static String getClipboardStringContent(Clipboard clipboard)
public static String getJPicEdtHome()
java -classpath other-class-paths:jpicedt-install-dir/lib/jpicedt.jar jpicedt.JPicEdt
(where /
may be replaced by the actual
respective separator for files on the underlying
platform).
For Windows platform, the install directory is tried
to be detected 1st with the MSWindows file-separator (\
), and if this
does not work, a subsequent trial is made with /
.
That is, the old way (java -jar jpicedt.jar) won't work. However, classpath can contain relative pathname (then user.dir get prepended).
Code snippet was adapted from jEdit/JEdit.java (http://www.jedit.org).
public static void main(String[] args)
public static File getOSTmpDir()
|
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |