|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectde.cbse.jeasy.JEUtil
public class JEUtil
A few nice static methods used by the jeasy library and jeasy applications.
| Field Summary | |
|---|---|
static java.lang.String |
BEEP
Constant for beep sound |
(package private) char |
c
|
(package private) static java.util.Hashtable |
cbHt
|
(package private) static java.util.Hashtable |
cbHtPrev
|
(package private) boolean |
dq
|
static char |
ERROR
Constants used in to check whether this log entry should be logged in this log level. |
static char |
EVENT
|
static char |
INFO
|
(package private) static javax.swing.JLayeredPane |
layeredpane
|
(package private) int |
offset
|
(package private) static javax.swing.JRootPane |
rootpane
|
(package private) boolean |
sq
|
static java.util.Comparator |
stringCmp
A Comperator used for sorting a list. |
(package private) static long |
timer
|
static char |
WARNING
|
| Constructor Summary | |
|---|---|
JEUtil()
|
|
| Method Summary | |
|---|---|
static java.awt.Point |
adjustLocationToScreen(java.awt.Component cmp,
int xposition,
int yposition)
To position a component always inside the screen. |
static boolean |
checkRegExPattern(java.lang.String regex)
Checks whether a regular expression is valid. |
static java.lang.String |
colorToHex(java.awt.Color c)
Gets the hex String of a Color object |
byte[] |
compress(byte[] ba)
|
byte[] |
compress(byte[] ba,
javax.crypto.Cipher ec)
|
byte[] |
compress(java.lang.String s)
|
byte[] |
compress(java.lang.String s,
javax.crypto.Cipher ec)
|
static boolean |
copyFile(java.lang.String source,
java.lang.String destination)
copy a file |
static void |
createJEObjFromNode(JENode tn)
Creates a class of package de.cbse.jeasy out of a JENode |
static void |
createJEObjFromNode(JENode tn,
java.lang.String packageName)
Creates a class of the given package de.cbse.jeasy out of a JENode |
void |
customizeObject(java.lang.String s)
An easy XML interface to customize JEasy objects. |
byte[] |
decompress(byte[] ba)
|
java.lang.String |
decompress(java.io.InputStream in)
|
java.lang.String |
decompress(java.io.InputStream in,
javax.crypto.Cipher dc)
|
byte[] |
decrypt(byte[] ba,
javax.crypto.Cipher decryptCipher)
|
static boolean |
deleteFile(java.lang.String source)
Delete a file or (empty) directory |
static void |
doBeep()
Gives out a beep. |
byte[] |
encrypt(byte[] ba,
javax.crypto.Cipher encryptCipher)
|
static boolean |
existsFile(java.lang.String source)
Tests if a file exists |
static byte[] |
f2ba(java.io.File f)
Reads all byte out of a File into a byte array. |
static boolean |
f2f(java.lang.String source,
java.lang.String destination)
Copy a file to a file |
static java.lang.String |
f2str(java.io.File file)
Reads a file into a String |
static java.lang.String |
f2str(java.lang.String source)
Reads a file into a String |
static java.lang.String |
generateJEasyIds(JENode jen)
Generates a java source file string that should be stored as a java file. |
static JEComboBox |
getCB(java.lang.String s)
Gets a jeasy JEComboBox out of the hashtable. |
static JECheckBox |
getCH(java.lang.String s)
Gets a jeasy JECheckBox out of the hashtable. |
(package private) static java.awt.GridBagConstraints |
getConstraints(java.lang.String s)
Creates predefined GridBagConstraints |
static java.lang.String |
getDateTime()
Gets a formatted date time in format yyyy-MM-dd HH:mm:ss.S |
static java.lang.String |
getDateTime(java.util.GregorianCalendar gc)
Gets a formatted date time String Example yyyy-MM-dd HH:mm:ss.S --> 2006-11-26 17:13:26.143 out of an GregorianCalendar |
static java.lang.String |
getDateTime(java.util.GregorianCalendar gc,
java.lang.String format)
Gets a formatted date time String Example yyyy-MM-dd HH:mm:ss.S --> 2006-11-26 17:13:26.143 out of an GregorianCalendar |
static java.lang.String |
getDateTime(java.lang.String format)
Gets a formatted date time String Example yyyy-MM-dd HH:mm:ss.S --> 2006-11-26 17:13:26.143 |
static JEDataField |
getDF(java.lang.String s)
Gets a jeasy JEDataField out of the hashtable. |
static int |
getDiffInDays(java.util.GregorianCalendar from,
java.util.GregorianCalendar to)
Gets the difference in days of two GregorianCalendar. |
static int |
getDistance(java.lang.String s,
java.lang.String t)
Gets the levenstein distance between two strings |
static java.lang.String |
getFormattedSum(java.util.Vector v)
Reads Strings of a vector and tries to build a formattad sum The method should build a sum out of formatted values and a String behind example 1.234,56 EUR or 1,234.56 $ |
static JEComponent |
getJC(java.lang.String s)
Gets a jeasy JEComponent out of the hashtable. |
static JEDataField |
getJD(java.lang.String s)
Gets a jeasy JEDataField out of the hashtable. |
static JEMessage |
getJM(java.lang.String s)
Gets a jeasy JEMessage out of the hashtable. |
static JEObject |
getJO(java.lang.String s)
Gets a jeasy object out of the hashtable. |
static JEParentComponent |
getJP(java.lang.String s)
Gets a jeasy JEParentComponent out of the hashtable. |
static JETable |
getJT(java.lang.String s)
Gets a jeasy JETable out of the hashtable. |
(package private) static java.awt.LayoutManager |
getLayout(java.lang.String layout)
Creates a new Layout specified by the string |
static java.lang.String |
getMemory()
|
static java.lang.String |
getMemory(java.lang.String label)
Gets the used memorys |
static java.util.GregorianCalendar |
getNow()
Gets the GregorianCalendar of now |
static JEPanel |
getPA(java.lang.String s)
Gets a jeasy JEPanel out of the hashtable. |
static JERadioButton |
getRB(java.lang.String s)
Gets a jeasy JERadioButton out of the hashtable. |
static JECallBack |
getRegisteredJECallBack(java.lang.String jeasyId,
JEObject jeo)
Gets the JECallBack object that is registered to the given JEasy object or his parent |
static java.util.Vector |
getSeparatedList(java.util.Vector v,
java.lang.String entries,
java.lang.String separator)
Appends the entries out of a string separated by separator string to a vector or creates a new vector |
static long |
getTimer()
Gets the differnce of the nano timer between now and the last call of startTimer(). |
static long |
getTimerMS()
Gets the differnce of the nano timer between now and the last call of startTimer(). |
static java.awt.Color |
hexToColor(java.lang.String s)
Gets the hex String of a Color object |
static boolean |
is2f(java.io.InputStream is,
java.lang.String destination)
Stores an InputStream to a file |
static java.lang.String |
is2s(java.io.InputStream is)
Reads an InputStream into a String and appends a after each line |
static boolean |
isDevelopMode()
|
static boolean |
isDisjoint(java.util.GregorianCalendar from1,
java.util.GregorianCalendar to1,
java.util.GregorianCalendar from2,
java.util.GregorianCalendar to2)
Checks whether two intervalls are disjoint |
static boolean |
isIdDescendantOf(java.lang.String jeasyId,
java.lang.String parentId)
Returns true if the jeasyId is a subelement of the parentId |
static java.lang.String |
isr2str(java.io.InputStreamReader isr)
Reads all char out of an InputStreamReader to a string |
static boolean |
isRegisteredJO(java.lang.String id)
Checks whether a name represents a registered jeasy object |
static boolean |
isSubclass(java.lang.Class sub,
java.lang.Class sup)
|
static boolean |
isSubclass(java.lang.Object subObject,
java.lang.Object superObject)
|
static boolean |
isSubset(java.util.GregorianCalendar from1,
java.util.GregorianCalendar to1,
java.util.GregorianCalendar from2,
java.util.GregorianCalendar to2)
Returns true if from2 to to2 is inside from1 to to1. |
static java.lang.String |
l2s(java.io.BufferedReader din,
java.lang.String end)
Reads lines in din until end was found. |
static java.lang.String |
l2s(java.io.BufferedReader din,
java.lang.String end,
java.lang.String separator)
Reads lines in din until end was found. |
static void |
log(char logConstant,
java.lang.String method,
java.lang.String text)
|
static void |
log(char logConstant,
java.lang.String method,
java.lang.String jeasyId,
java.lang.Exception e)
|
static void |
log(char logConstant,
java.lang.String method,
java.lang.String jeasyId,
java.lang.String text)
|
static void |
logEvent(java.lang.String method,
java.lang.String id,
java.util.EventObject e)
|
static boolean |
messageMatch(java.lang.String searchmessage,
java.lang.String message)
Searches the string search in the source and gives the following chars until the seperator back as a string |
static int |
minimum(int a,
int b,
int c)
Minimum of three int |
static boolean |
moveFile(java.lang.String source,
java.lang.String destination)
move a file |
static java.awt.Color |
parseColor(java.lang.String hexcolor)
parse a hexstring into a Color |
static void |
playSound(java.io.InputStream in)
Plays a sound out of an InputStream |
static void |
readJEObj(java.io.BufferedReader din)
Reads JEObjects from an InputStream of Repository.xml. |
static void |
readJEObj(java.io.BufferedReader din,
java.lang.String rootTag,
java.util.HashMap hm,
java.lang.String packageName)
Reads Objects from a BufferedReader of a Repository.xml. |
static void |
readJEObj(java.io.InputStream is)
Reads JEObjects their properties from an InputStream of Repository.xml. |
static void |
readJEObj(java.io.InputStream is,
java.lang.String rootTag,
java.lang.String packageName)
Reads Objects and their properties from an InputStream of a Repository.xml. |
static java.lang.String |
regardLocale(java.lang.String message,
java.lang.String locale)
Excludes all locales exclude the given locale out of the message |
static boolean |
regex(java.lang.String regex,
java.lang.String input)
Checks a string with a regular expression |
static boolean |
registerJECallBack(JECallBack jeCallBack,
java.lang.String jeasyId)
Registers a JECallBack to a JEasyId. |
static boolean |
registerPreviewJECallBack(JECallBack jeCallBack,
java.lang.String jeasyId)
Registers a JECallBack to a JEasyId shown in the preview panel. |
static void |
removeJO(java.lang.String s)
Removes a jeasy object out of the hashtable. |
static java.lang.String |
removeLocales(java.lang.String message)
|
static boolean |
renameFile(java.lang.String source,
java.lang.String destination)
rename a file |
static java.lang.String |
replace(java.lang.String target,
java.lang.String from,
java.lang.String to)
Replaces String in String |
static java.lang.String |
replaceOnce(java.lang.String target,
java.lang.String from,
java.lang.String to)
Replaces String in String one time |
static java.lang.String |
replaceTagId(java.lang.String source,
java.lang.String tag,
java.lang.String id,
java.lang.String newString)
replaces the tag tag with the tag id inside with newString and copys all tag after the root tag ... |
static void |
setDevelopMode(boolean developMode)
|
static void |
setLogLevel(java.lang.String logConstants)
Sets the log constants that will be logged. |
static boolean |
setProperties(JEObject jeo,
JENode jen)
Puts the properties out of a JENode to the proprties of the jeobject. |
static boolean |
setProperties(JEObject jeo,
java.lang.String s)
|
static long |
startTimer()
Gets and stores the nano system time |
static boolean |
str2f(java.lang.String source,
java.lang.String destination)
Copy a string to a file |
static java.lang.String |
str2html(java.lang.String ttip)
Converts a long string ionto beginning String with CRLFs for better display long strings as tooltips. |
(package private) static java.util.Vector |
str2vector(java.lang.String str)
Converts the string in a vector by setting each line as an element of the vector |
static java.lang.String |
str2XMLTagname(java.lang.String s)
Eliminates characters not allowed in XML tagnames. |
static java.lang.String |
tag(java.lang.String tag,
java.lang.String value)
returns an XML element with tag and value |
static java.lang.String |
tagv(java.lang.String tagroot,
java.lang.String tagelement,
java.util.Vector v)
returns an XML element with tagroot and a number of tagelement containig the string in the vector |
static java.io.InputStream |
url2is(java.lang.String urlString)
Reads an URL and gives back an InputStream |
static java.lang.String |
url2str(java.net.URL url)
Reads a Url into a String |
static java.lang.String |
v2str(java.util.Vector v)
Gets a String out of a vector, with LineFeeds after each element |
static void |
waitForAllEventsDone()
Gets the System event Queue for AWTEvents and wait since no event is in the queue |
static boolean |
writeFile(java.lang.String s,
java.lang.String destination)
writes a file |
static java.lang.Object |
XMLMethodInvocation(java.lang.Object object,
java.lang.String xmi)
Invokes a method defined in the XML-String xmi of the given Object object |
static java.lang.Object |
XMLMethodInvocation(java.lang.String xmi)
Invokes a method of an JEasyObject out of an XML string. |
static boolean |
XMLVectorMatch(java.util.Vector v_search,
java.util.Vector v_tags)
Matching of two Vectors |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public static final char ERROR
public static final char WARNING
public static final char INFO
public static final char EVENT
public static java.lang.String BEEP
static long timer
char c
int offset
boolean sq
boolean dq
static java.util.Hashtable cbHt
static java.util.Hashtable cbHtPrev
static javax.swing.JRootPane rootpane
static javax.swing.JLayeredPane layeredpane
public static java.util.Comparator stringCmp
| Constructor Detail |
|---|
public JEUtil()
| Method Detail |
|---|
public static java.lang.Object XMLMethodInvocation(java.lang.String xmi)
xmi - XML-Stringpublic static void setLogLevel(java.lang.String logConstants)
public static java.lang.Object XMLMethodInvocation(java.lang.Object object,
java.lang.String xmi)
obj - object where the method is implementedxmi - XML-String that defines the method and params
public static boolean regex(java.lang.String regex,
java.lang.String input)
regex - regular expressioninput - string to test
public static boolean checkRegExPattern(java.lang.String regex)
throws java.util.regex.PatternSyntaxException
regex -
java.util.regex.PatternSyntaxException
public static boolean XMLVectorMatch(java.util.Vector v_search,
java.util.Vector v_tags)
source - the string where it will be searched
public static boolean messageMatch(java.lang.String searchmessage,
java.lang.String message)
source - the string where it will be searchedsearch - the string to look forseparator - the string to look for
static java.util.Vector str2vector(java.lang.String str)
str - the string to convert
public static java.lang.String getFormattedSum(java.util.Vector v)
public static java.lang.String is2s(java.io.InputStream is)
after each line
is -
public static java.lang.String l2s(java.io.BufferedReader din,
java.lang.String end)
throws java.io.IOException
din - read by readLine()end - terminates reading
java.io.IOException
public static java.lang.String l2s(java.io.BufferedReader din,
java.lang.String end,
java.lang.String separator)
throws java.io.IOException
din - read by readLine()end - terminates reading
java.io.IOException
public static void log(char logConstant,
java.lang.String method,
java.lang.String jeasyId,
java.lang.String text)
public static void log(char logConstant,
java.lang.String method,
java.lang.String text)
public static void log(char logConstant,
java.lang.String method,
java.lang.String jeasyId,
java.lang.Exception e)
public static void logEvent(java.lang.String method,
java.lang.String id,
java.util.EventObject e)
static java.awt.LayoutManager getLayout(java.lang.String layout)
layout - name of the Layout
static java.awt.GridBagConstraints getConstraints(java.lang.String s)
s - name of the GridBagConstraints
public static long startTimer()
public static long getTimer()
public static long getTimerMS()
public static java.lang.String generateJEasyIds(JENode jen)
jen - public static JEPanel getPA(java.lang.String s)
s -
public static JEComponent getJC(java.lang.String s)
s -
public static JEDataField getDF(java.lang.String s)
s -
public static JEComboBox getCB(java.lang.String s)
s -
public static JECheckBox getCH(java.lang.String s)
s -
public static JERadioButton getRB(java.lang.String s)
s -
public static JEMessage getJM(java.lang.String s)
s -
public static JEParentComponent getJP(java.lang.String s)
s -
public static JETable getJT(java.lang.String s)
s -
public static JEDataField getJD(java.lang.String s)
s -
public static void removeJO(java.lang.String s)
s - public static boolean isRegisteredJO(java.lang.String id)
s -
public static JEObject getJO(java.lang.String s)
s -
public static java.lang.String getDateTime(java.lang.String format)
format -
public static java.util.GregorianCalendar getNow()
public static java.lang.String getDateTime(java.util.GregorianCalendar gc)
gc -
public static java.lang.String getDateTime(java.util.GregorianCalendar gc,
java.lang.String format)
gc -
public static boolean isDisjoint(java.util.GregorianCalendar from1,
java.util.GregorianCalendar to1,
java.util.GregorianCalendar from2,
java.util.GregorianCalendar to2)
from1 - to1 - from2 - to2 -
public static int getDiffInDays(java.util.GregorianCalendar from,
java.util.GregorianCalendar to)
from - first date
public static boolean isSubset(java.util.GregorianCalendar from1,
java.util.GregorianCalendar to1,
java.util.GregorianCalendar from2,
java.util.GregorianCalendar to2)
from1 - to1 - from2 - to2 -
public static java.lang.String getDateTime()
format -
public static java.lang.String isr2str(java.io.InputStreamReader isr)
public static byte[] f2ba(java.io.File f)
f -
public static java.lang.String colorToHex(java.awt.Color c)
public static java.awt.Color hexToColor(java.lang.String s)
public static java.awt.Color parseColor(java.lang.String hexcolor)
public static java.lang.String tag(java.lang.String tag,
java.lang.String value)
tag - value -
public static java.lang.String tagv(java.lang.String tagroot,
java.lang.String tagelement,
java.util.Vector v)
tagroot - tagelement - v -
public static void readJEObj(java.io.BufferedReader din)
java.io.IOException - when reading out of din is not possible
public static void readJEObj(java.io.BufferedReader din,
java.lang.String rootTag,
java.util.HashMap hm,
java.lang.String packageName)
java.io.IOException - when reading out of din is not possiblepublic static void readJEObj(java.io.InputStream is)
java.io.IOException - when reading out of din is not possible
public static void readJEObj(java.io.InputStream is,
java.lang.String rootTag,
java.lang.String packageName)
is - InputStream to readrootTag - root tag of the object repositoryhm - the HashMap to store the objects by their idpackageName - the package name of the classespublic static void createJEObjFromNode(JENode tn)
tn -
public static void createJEObjFromNode(JENode tn,
java.lang.String packageName)
tn - packageName -
public static java.lang.String replace(java.lang.String target,
java.lang.String from,
java.lang.String to)
s - String which is to be parsedold - String which will be replaced by
public static java.lang.String replaceOnce(java.lang.String target,
java.lang.String from,
java.lang.String to)
s - String which is to be parsedold - String which will be replaced by
public static boolean existsFile(java.lang.String source)
source - source-file
public static boolean copyFile(java.lang.String source,
java.lang.String destination)
source - source-filedestination - destination-file
public static boolean writeFile(java.lang.String s,
java.lang.String destination)
data - string to writedestination - destination-file
public static boolean str2f(java.lang.String source,
java.lang.String destination)
source - Stringdestination - destination-file
public static boolean is2f(java.io.InputStream is,
java.lang.String destination)
is - destination - name of the file
public static java.io.InputStream url2is(java.lang.String urlString)
urlString -
public static boolean f2f(java.lang.String source,
java.lang.String destination)
source - Stringdestination - destination-file
public static boolean deleteFile(java.lang.String source)
source - source-file
public static boolean moveFile(java.lang.String source,
java.lang.String destination)
source - source-filedestination - destination-file
public static boolean renameFile(java.lang.String source,
java.lang.String destination)
source - source-filedestination - destination-file
public static java.lang.String f2str(java.lang.String source)
file - file
public static java.lang.String f2str(java.io.File file)
file - file
public static java.lang.String url2str(java.net.URL url)
url -
public static java.lang.String replaceTagId(java.lang.String source,
java.lang.String tag,
java.lang.String id,
java.lang.String newString)
source - String where to replacetag - tagname to replaceid - the id of the tag idnewString - the String wich replaces the oldpublic void customizeObject(java.lang.String s)
It should be used to change properties of jeasy objects. You define the jeasy object the property and the value. The method will perform the setting of the property. You may define the customize string as a JEString object in JEasy or read it out of a file. The example explains the syntax:
<custom> <br> <id>JEasyObjectId</id> <br> <method>methodname</method> <br> <param>String</param> <br> <method>methodname</method> <br> <param>true|false</param> <br> </custom> <br> Example: <br> <pre><custom> <br> <id>DF_Name</id> <br> <method>setText</method> <br> <param>Miller</param> <br> <method>setEnabled</method> <br> <param>false</param> <br> </custom> <br> </pre>
public static java.lang.String regardLocale(java.lang.String message,
java.lang.String locale)
message - locale -
public static java.lang.String removeLocales(java.lang.String message)
public byte[] compress(byte[] ba,
javax.crypto.Cipher ec)
throws java.lang.Exception
java.lang.Exception
public byte[] compress(java.lang.String s)
throws java.lang.Exception
java.lang.Exception
public byte[] compress(java.lang.String s,
javax.crypto.Cipher ec)
throws java.lang.Exception
java.lang.Exception
public java.lang.String decompress(java.io.InputStream in)
throws java.lang.Exception
java.lang.Exception
public java.lang.String decompress(java.io.InputStream in,
javax.crypto.Cipher dc)
throws java.lang.Exception
java.lang.Exceptionpublic byte[] compress(byte[] ba)
public byte[] decompress(byte[] ba)
public byte[] decrypt(byte[] ba,
javax.crypto.Cipher decryptCipher)
throws java.lang.Exception
java.lang.Exception
public byte[] encrypt(byte[] ba,
javax.crypto.Cipher encryptCipher)
throws java.lang.Exception
java.lang.Exception
public static boolean registerJECallBack(JECallBack jeCallBack,
java.lang.String jeasyId)
jeCallBack - jeasyId -
public static boolean registerPreviewJECallBack(JECallBack jeCallBack,
java.lang.String jeasyId)
jeCallBack - jeasyId -
public static boolean isIdDescendantOf(java.lang.String jeasyId,
java.lang.String parentId)
jeasyId - parentId -
public static JECallBack getRegisteredJECallBack(java.lang.String jeasyId,
JEObject jeo)
jeCallBack - jeasyId -
public static java.util.Vector getSeparatedList(java.util.Vector v,
java.lang.String entries,
java.lang.String separator)
v - entries - separator -
public static java.lang.String getMemory()
public static java.lang.String getMemory(java.lang.String label)
label -
public static java.awt.Point adjustLocationToScreen(java.awt.Component cmp,
int xposition,
int yposition)
cmp - Component to showxposition - desired x positionyposition - desired y position
public static boolean setProperties(JEObject jeo,
JENode jen)
jeo - jen -
public static boolean setProperties(JEObject jeo,
java.lang.String s)
public static boolean isSubclass(java.lang.Object subObject,
java.lang.Object superObject)
public static boolean isSubclass(java.lang.Class sub,
java.lang.Class sup)
public static int minimum(int a,
int b,
int c)
a - b - c -
public static int getDistance(java.lang.String s,
java.lang.String t)
s - t -
public static void doBeep()
public static java.lang.String str2html(java.lang.String ttip)
description - public static java.lang.String v2str(java.util.Vector v)
v -
public static boolean isDevelopMode()
public static void setDevelopMode(boolean developMode)
public static void waitForAllEventsDone()
public static void playSound(java.io.InputStream in)
in - public static java.lang.String str2XMLTagname(java.lang.String s)
s -
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||