de.cbse.jeasy
Class JEUtil

java.lang.Object
  extended by de.cbse.jeasy.JEUtil

public class JEUtil
extends java.lang.Object

A few nice static methods used by the jeasy library and jeasy applications.

Author:
Harry Pfohl

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

ERROR

public static final char ERROR
Constants used in to check whether this log entry should be logged in this log level.

See Also:
Constant Field Values

WARNING

public static final char WARNING
See Also:
Constant Field Values

INFO

public static final char INFO
See Also:
Constant Field Values

EVENT

public static final char EVENT
See Also:
Constant Field Values

BEEP

public static java.lang.String BEEP
Constant for beep sound


timer

static long timer

c

char c

offset

int offset

sq

boolean sq

dq

boolean dq

cbHt

static java.util.Hashtable cbHt

cbHtPrev

static java.util.Hashtable cbHtPrev

rootpane

static javax.swing.JRootPane rootpane

layeredpane

static javax.swing.JLayeredPane layeredpane

stringCmp

public static java.util.Comparator stringCmp
A Comperator used for sorting a list. Example: Collections.sort(list, JEUtil.stringCmp);

Constructor Detail

JEUtil

public JEUtil()
Method Detail

XMLMethodInvocation

public static java.lang.Object XMLMethodInvocation(java.lang.String xmi)
Invokes a method of an JEasyObject out of an XML string. See JEMethodinvocation for description of the XML string If the given methodid (tagname id) exists in the hashtable built from the initial XML-File, the parameters JEObject, method, param1Class, param1value, ... are filled first out of the JEMethodinvocation object in the hashtable. If the same parameters are defined in the string xmi the entries will override the initial values. If no methodid is define all parameters for the specified method have to be defined in the string xmi

Parameters:
xmi - XML-String

setLogLevel

public static void setLogLevel(java.lang.String logConstants)
Sets the log constants that will be logged. Predefinded constants are: ERROR = "E" WARNING = "W" INFO = "I" EVENT = "V" You may define your own ones for separate modules for example.


XMLMethodInvocation

public 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

Parameters:
obj - object where the method is implemented
xmi - XML-String that defines the method and params

regex

public static boolean regex(java.lang.String regex,
                            java.lang.String input)
Checks a string with a regular expression

Parameters:
regex - regular expression
input - string to test
Returns:
boolean true if matches false otherwise

checkRegExPattern

public static boolean checkRegExPattern(java.lang.String regex)
                                 throws java.util.regex.PatternSyntaxException
Checks whether a regular expression is valid.

Parameters:
regex -
Returns:
Throws:
java.util.regex.PatternSyntaxException

XMLVectorMatch

public static boolean XMLVectorMatch(java.util.Vector v_search,
                                     java.util.Vector v_tags)
Matching of two Vectors

Parameters:
source - the string where it will be searched
Returns:
the vector

messageMatch

public 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

Parameters:
source - the string where it will be searched
search - the string to look for
separator - the string to look for
Returns:
the string is filled from the end of search until the first occurance of the separator.

str2vector

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

Parameters:
str - the string to convert
Returns:
a vector of strings

getFormattedSum

public 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 $


is2s

public static java.lang.String is2s(java.io.InputStream is)
Reads an InputStream into a String and appends a

after each line

Parameters:
is -
Returns:

l2s

public static java.lang.String l2s(java.io.BufferedReader din,
                                   java.lang.String end)
                            throws java.io.IOException
Reads lines in din until end was found. Comments after // are ignored. White spaces from both ends of the lines will be removed.

Parameters:
din - read by readLine()
end - terminates reading
Returns:
the string containing the lines
Throws:
java.io.IOException

l2s

public static java.lang.String l2s(java.io.BufferedReader din,
                                   java.lang.String end,
                                   java.lang.String separator)
                            throws java.io.IOException
Reads lines in din until end was found. Comments after // are ignored. White spaces from both ends of the lines will be removed.

Parameters:
din - read by readLine()
end - terminates reading
Returns:
the string containing the lines separated by separator
Throws:
java.io.IOException

log

public static void log(char logConstant,
                       java.lang.String method,
                       java.lang.String jeasyId,
                       java.lang.String text)

log

public static void log(char logConstant,
                       java.lang.String method,
                       java.lang.String text)

log

public static void log(char logConstant,
                       java.lang.String method,
                       java.lang.String jeasyId,
                       java.lang.Exception e)

logEvent

public static void logEvent(java.lang.String method,
                            java.lang.String id,
                            java.util.EventObject e)

getLayout

static java.awt.LayoutManager getLayout(java.lang.String layout)
Creates a new Layout specified by the string

Parameters:
layout - name of the Layout
Returns:
a new Layout

getConstraints

static java.awt.GridBagConstraints getConstraints(java.lang.String s)
Creates predefined GridBagConstraints

Parameters:
s - name of the GridBagConstraints
Returns:
a new GridBagConstraints

startTimer

public static long startTimer()
Gets and stores the nano system time

Returns:

getTimer

public static long getTimer()
Gets the differnce of the nano timer between now and the last call of startTimer(). Returns the time in nano seconds (1 nano second = 1/1000000 milli second)

Returns:

getTimerMS

public static long getTimerMS()
Gets the differnce of the nano timer between now and the last call of startTimer(). Returns the time in milli seconds

Returns:

generateJEasyIds

public static java.lang.String generateJEasyIds(JENode jen)
Generates a java source file string that should be stored as a java file. This file defines all jeasy ids as constants.

Parameters:
jen -

getPA

public static JEPanel getPA(java.lang.String s)
Gets a jeasy JEPanel out of the hashtable.

Parameters:
s -
Returns:

getJC

public static JEComponent getJC(java.lang.String s)
Gets a jeasy JEComponent out of the hashtable. If the developing mode is activ some suggestions are given out.

Parameters:
s -
Returns:

getDF

public static JEDataField getDF(java.lang.String s)
Gets a jeasy JEDataField out of the hashtable.

Parameters:
s -
Returns:

getCB

public static JEComboBox getCB(java.lang.String s)
Gets a jeasy JEComboBox out of the hashtable.

Parameters:
s -
Returns:

getCH

public static JECheckBox getCH(java.lang.String s)
Gets a jeasy JECheckBox out of the hashtable.

Parameters:
s -
Returns:

getRB

public static JERadioButton getRB(java.lang.String s)
Gets a jeasy JERadioButton out of the hashtable.

Parameters:
s -
Returns:

getJM

public static JEMessage getJM(java.lang.String s)
Gets a jeasy JEMessage out of the hashtable.

Parameters:
s -
Returns:

getJP

public static JEParentComponent getJP(java.lang.String s)
Gets a jeasy JEParentComponent out of the hashtable. If the developing mode is activ some suggestions are given out.

Parameters:
s -
Returns:

getJT

public static JETable getJT(java.lang.String s)
Gets a jeasy JETable out of the hashtable. If the developing mode is activ some suggestions are given out.

Parameters:
s -
Returns:

getJD

public static JEDataField getJD(java.lang.String s)
Gets a jeasy JEDataField out of the hashtable. If the developing mode is activ some suggestions are given out.

Parameters:
s -
Returns:

removeJO

public static void removeJO(java.lang.String s)
Removes a jeasy object out of the hashtable.

Parameters:
s -

isRegisteredJO

public static boolean isRegisteredJO(java.lang.String id)
Checks whether a name represents a registered jeasy object

Parameters:
s -
Returns:

getJO

public static JEObject getJO(java.lang.String s)
Gets a jeasy object out of the hashtable. If the developing mode is activ some suggestions are given out.

Parameters:
s -
Returns:

getDateTime

public 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

Parameters:
format -
Returns:

getNow

public static java.util.GregorianCalendar getNow()
Gets the GregorianCalendar of now

Returns:
GregorianCalendar

getDateTime

public 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

Parameters:
gc -
Returns:

getDateTime

public 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

Parameters:
gc -
Returns:

isDisjoint

public 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

Parameters:
from1 -
to1 -
from2 -
to2 -
Returns:
true wenn disjunkt, sonst false

getDiffInDays

public static int getDiffInDays(java.util.GregorianCalendar from,
                                java.util.GregorianCalendar to)
Gets the difference in days of two GregorianCalendar. If from after to the value is negativ. Attention: winter and sommertime may cause to problems, therefore add 1 hour to to !!!

Parameters:
from - first date
Returns:
to die Differenz in Tagen

isSubset

public 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.

Parameters:
from1 -
to1 -
from2 -
to2 -
Returns:

getDateTime

public static java.lang.String getDateTime()
Gets a formatted date time in format yyyy-MM-dd HH:mm:ss.S

Parameters:
format -
Returns:

isr2str

public static java.lang.String isr2str(java.io.InputStreamReader isr)
Reads all char out of an InputStreamReader to a string

Returns:
string

f2ba

public static byte[] f2ba(java.io.File f)
Reads all byte out of a File into a byte array. Should only used reading smaller files.

Parameters:
f -
Returns:

colorToHex

public static java.lang.String colorToHex(java.awt.Color c)
Gets the hex String of a Color object


hexToColor

public static java.awt.Color hexToColor(java.lang.String s)
Gets the hex String of a Color object


parseColor

public static java.awt.Color parseColor(java.lang.String hexcolor)
parse a hexstring into a Color


tag

public static java.lang.String tag(java.lang.String tag,
                                   java.lang.String value)
returns an XML element with tag and value

Parameters:
tag -
value -
Returns:

tagv

public 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

Parameters:
tagroot -
tagelement -
v -
Returns:

readJEObj

public static void readJEObj(java.io.BufferedReader din)
Reads JEObjects from an InputStream of Repository.xml. They will be created by there constructor. The id and the JEObject will be put to the static Hashtable

Throws:
java.io.IOException - when reading out of din is not possible
See Also:

readJEObj

public 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. They will be created by there constructor. The id and the Object will be put to the given Hashtable.

Throws:
java.io.IOException - when reading out of din is not possible
See Also:

readJEObj

public static void readJEObj(java.io.InputStream is)
Reads JEObjects their properties from an InputStream of Repository.xml. They will be created by there constructor. The id and the JEObject will be put to the static Hashtable

Throws:
java.io.IOException - when reading out of din is not possible
See Also:

readJEObj

public 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. They will be created by there constructor. The id and the Object will be put to the given HashMap.

Parameters:
is - InputStream to read
rootTag - root tag of the object repository
hm - the HashMap to store the objects by their id
packageName - the package name of the classes

createJEObjFromNode

public static void createJEObjFromNode(JENode tn)
Creates a class of package de.cbse.jeasy out of a JENode

Parameters:
tn -

createJEObjFromNode

public static void createJEObjFromNode(JENode tn,
                                       java.lang.String packageName)
Creates a class of the given package de.cbse.jeasy out of a JENode

Parameters:
tn -
packageName -

replace

public static java.lang.String replace(java.lang.String target,
                                       java.lang.String from,
                                       java.lang.String to)
Replaces String in String

Parameters:
s - String which is to be parsed
old - String which will be replaced by
Returns:
new String

replaceOnce

public static java.lang.String replaceOnce(java.lang.String target,
                                           java.lang.String from,
                                           java.lang.String to)
Replaces String in String one time

Parameters:
s - String which is to be parsed
old - String which will be replaced by
Returns:
new String

existsFile

public static boolean existsFile(java.lang.String source)
Tests if a file exists

Parameters:
source - source-file
Returns:
boolean true if the file exists false otherwise

copyFile

public static boolean copyFile(java.lang.String source,
                               java.lang.String destination)
copy a file

Parameters:
source - source-file
destination - destination-file
Returns:
boolean true if the file could be copied false otherwise

writeFile

public static boolean writeFile(java.lang.String s,
                                java.lang.String destination)
writes a file

Parameters:
data - string to write
destination - destination-file
Returns:
boolean true if the file could be copied false otherwise

str2f

public static boolean str2f(java.lang.String source,
                            java.lang.String destination)
Copy a string to a file

Parameters:
source - String
destination - destination-file
Returns:
boolean true if the file could be copied false otherwise

is2f

public static boolean is2f(java.io.InputStream is,
                           java.lang.String destination)
Stores an InputStream to a file

Parameters:
is -
destination - name of the file
Returns:

url2is

public static java.io.InputStream url2is(java.lang.String urlString)
Reads an URL and gives back an InputStream

Parameters:
urlString -
Returns:
InputStream or null

f2f

public static boolean f2f(java.lang.String source,
                          java.lang.String destination)
Copy a file to a file

Parameters:
source - String
destination - destination-file
Returns:
boolean true if the file could be copied false otherwise

deleteFile

public static boolean deleteFile(java.lang.String source)
Delete a file or (empty) directory

Parameters:
source - source-file
Returns:
boolean true if the file could be deleted or no file was found false otherwise

moveFile

public static boolean moveFile(java.lang.String source,
                               java.lang.String destination)
move a file

Parameters:
source - source-file
destination - destination-file
Returns:
boolean true if the file could be removed false otherwise

renameFile

public static boolean renameFile(java.lang.String source,
                                 java.lang.String destination)
rename a file

Parameters:
source - source-file
destination - destination-file
Returns:
boolean true if the file could be renamed false otherwise

f2str

public static java.lang.String f2str(java.lang.String source)
Reads a file into a String

Parameters:
file - file
Returns:
String file as a String or null if file couldn't be read

f2str

public static java.lang.String f2str(java.io.File file)
Reads a file into a String

Parameters:
file - file
Returns:
String file as a String or null if file couldn't be read

url2str

public static java.lang.String url2str(java.net.URL url)
Reads a Url into a String

Parameters:
url -
Returns:
String file as a String or null if file couldn't be read

replaceTagId

public 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 ...id...... --> newString

Parameters:
source - String where to replace
tag - tagname to replace
id - the id of the tag id
newString - the String wich replaces the old

customizeObject

public void customizeObject(java.lang.String s)
An easy XML interface to customize JEasy objects.

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>
 


regardLocale

public static java.lang.String regardLocale(java.lang.String message,
                                            java.lang.String locale)
Excludes all locales exclude the given locale out of the message

Parameters:
message -
locale -
Returns:
the message except of all locales that are not the given locale

removeLocales

public static java.lang.String removeLocales(java.lang.String message)

compress

public byte[] compress(byte[] ba,
                       javax.crypto.Cipher ec)
                throws java.lang.Exception
Throws:
java.lang.Exception

compress

public byte[] compress(java.lang.String s)
                throws java.lang.Exception
Throws:
java.lang.Exception

compress

public byte[] compress(java.lang.String s,
                       javax.crypto.Cipher ec)
                throws java.lang.Exception
Throws:
java.lang.Exception

decompress

public java.lang.String decompress(java.io.InputStream in)
                            throws java.lang.Exception
Throws:
java.lang.Exception

decompress

public java.lang.String decompress(java.io.InputStream in,
                                   javax.crypto.Cipher dc)
                            throws java.lang.Exception
Throws:
java.lang.Exception

compress

public byte[] compress(byte[] ba)

decompress

public byte[] decompress(byte[] ba)

decrypt

public byte[] decrypt(byte[] ba,
                      javax.crypto.Cipher decryptCipher)
               throws java.lang.Exception
Throws:
java.lang.Exception

encrypt

public byte[] encrypt(byte[] ba,
                      javax.crypto.Cipher encryptCipher)
               throws java.lang.Exception
Throws:
java.lang.Exception

registerJECallBack

public static boolean registerJECallBack(JECallBack jeCallBack,
                                         java.lang.String jeasyId)
Registers a JECallBack to a JEasyId.

Parameters:
jeCallBack -
jeasyId -
Returns:

registerPreviewJECallBack

public static boolean registerPreviewJECallBack(JECallBack jeCallBack,
                                                java.lang.String jeasyId)
Registers a JECallBack to a JEasyId shown in the preview panel. Only for internal use!

Parameters:
jeCallBack -
jeasyId -
Returns:

isIdDescendantOf

public static boolean isIdDescendantOf(java.lang.String jeasyId,
                                       java.lang.String parentId)
Returns true if the jeasyId is a subelement of the parentId

Parameters:
jeasyId -
parentId -
Returns:

getRegisteredJECallBack

public static JECallBack getRegisteredJECallBack(java.lang.String jeasyId,
                                                 JEObject jeo)
Gets the JECallBack object that is registered to the given JEasy object or his parent

Parameters:
jeCallBack -
jeasyId -
Returns:

getSeparatedList

public 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

Parameters:
v -
entries -
separator -
Returns:

getMemory

public static java.lang.String getMemory()

getMemory

public static java.lang.String getMemory(java.lang.String label)
Gets the used memorys

Parameters:
label -

adjustLocationToScreen

public static java.awt.Point adjustLocationToScreen(java.awt.Component cmp,
                                                    int xposition,
                                                    int yposition)
To position a component always inside the screen.

Parameters:
cmp - Component to show
xposition - desired x position
yposition - desired y position
Returns:

setProperties

public static boolean setProperties(JEObject jeo,
                                    JENode jen)
Puts the properties out of a JENode to the proprties of the jeobject. If a property has a local attribute, it will be stored in the locale hashmap.

Parameters:
jeo -
jen -
Returns:

setProperties

public static boolean setProperties(JEObject jeo,
                                    java.lang.String s)

isSubclass

public static boolean isSubclass(java.lang.Object subObject,
                                 java.lang.Object superObject)

isSubclass

public static boolean isSubclass(java.lang.Class sub,
                                 java.lang.Class sup)

minimum

public static int minimum(int a,
                          int b,
                          int c)
Minimum of three int

Parameters:
a -
b -
c -
Returns:

getDistance

public static int getDistance(java.lang.String s,
                              java.lang.String t)
Gets the levenstein distance between two strings

Parameters:
s -
t -
Returns:

doBeep

public static void doBeep()
Gives out a beep.


str2html

public 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.

Parameters:
description -

v2str

public static java.lang.String v2str(java.util.Vector v)
Gets a String out of a vector, with LineFeeds after each element

Parameters:
v -
Returns:

isDevelopMode

public static boolean isDevelopMode()

setDevelopMode

public static void setDevelopMode(boolean developMode)

waitForAllEventsDone

public static void waitForAllEventsDone()
Gets the System event Queue for AWTEvents and wait since no event is in the queue


playSound

public static void playSound(java.io.InputStream in)
Plays a sound out of an InputStream

Parameters:
in -

str2XMLTagname

public static java.lang.String str2XMLTagname(java.lang.String s)
Eliminates characters not allowed in XML tagnames.

Parameters:
s -
Returns: