org.devaki.nextobjects.util
Class NOTools

java.lang.Object
  extended byorg.devaki.nextobjects.util.NOTools

public class NOTools
extends java.lang.Object

This class containts all properties load-dump plus some usefull functions

Author:
eflorent

Field Summary
static java.lang.String APP_HOME
          Directory of nextObjects
static java.lang.String NEXTOBJECT_USER_HOME
          Directory of nextObjects in the user home directory
static java.awt.Color NO_LOG_BACKGROUND
          Logger window background color
static java.awt.Color NO_LOG_FOREGROUND
          Logger window foreground color
static java.lang.String NO_LOG_PATTERN
          Logger window log pattern
static java.util.Properties NO_PROPS
          Properties of nextObjects
static boolean save
          Do we save properties whille quitting
static java.lang.String TMP_DIR
          Temporary Directory
static java.util.Vector TORQUE_DB
          List of supported database engines
static java.lang.String TORQUE_HOME
          Directory of Torque in the user home directory
static java.util.Vector TORQUE_TYPES
          List of supported datatypes
static java.lang.String TORQUE_VERSION
          Torque Version
static java.lang.String USER_HOME
          Home directory of the user currently using nextObjects
 
Constructor Summary
NOTools()
          Construct a 'NOHelper' object.
 
Method Summary
static void createDirectory(java.lang.String path)
          Given a path string create all the directories in the path.
static boolean deleteFile(java.io.File file)
          Deletes a file or a directory along with all files and directories it contains.
static int distance(java.awt.Point p1, java.awt.Point p2)
          Calcultate distance
static int getCardType(Association theAssociation)
          return the type of the relation (11,1N,1N) so we know wich Merise rule to apply for a given association (cardinalities) card_is 01 11 0N 1N (right) is_card -------------------------------- 01 | 11 11 1N 1N 11 | 11 11 1N 1N 0N | 1N 1N NM NM 1N | 1N 1N NM NM (left)
static java.lang.String getJavaName(java.lang.String schemaName)
          Converts a database schema name to java object name.
static java.awt.Point getMiddle(java.awt.Point pA, java.awt.Point pB)
          Calculate middle
static java.util.Properties getNOProperties()
          Give a reference to the app Properties.
static javax.swing.ImageIcon loadIconResource(java.lang.String pImgName)
          Load an icon
 void loadProperties()
          Load preferences from the 'NO_PREFS' properties file
 void loadTorqueType()
          Load torque types.
static void saveProperties()
          Save preferences to the 'NO_PREFS' properties file
static void unzip(java.lang.String file, java.lang.String dest, javax.swing.JProgressBar jProgressBar)
          Unzip a fie
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

save

public static boolean save
Do we save properties whille quitting


TORQUE_VERSION

public static final java.lang.String TORQUE_VERSION
Torque Version

See Also:
Constant Field Values

APP_HOME

public static final java.lang.String APP_HOME
Directory of nextObjects


USER_HOME

public static final java.lang.String USER_HOME
Home directory of the user currently using nextObjects


NEXTOBJECT_USER_HOME

public static final java.lang.String NEXTOBJECT_USER_HOME
Directory of nextObjects in the user home directory


TORQUE_HOME

public static final java.lang.String TORQUE_HOME
Directory of Torque in the user home directory


TMP_DIR

public static final java.lang.String TMP_DIR
Temporary Directory


NO_PROPS

public static java.util.Properties NO_PROPS
Properties of nextObjects


TORQUE_DB

public static final java.util.Vector TORQUE_DB
List of supported database engines


TORQUE_TYPES

public static final java.util.Vector TORQUE_TYPES
List of supported datatypes


NO_LOG_FOREGROUND

public static final java.awt.Color NO_LOG_FOREGROUND
Logger window foreground color


NO_LOG_BACKGROUND

public static final java.awt.Color NO_LOG_BACKGROUND
Logger window background color


NO_LOG_PATTERN

public static final java.lang.String NO_LOG_PATTERN
Logger window log pattern

See Also:
Constant Field Values
Constructor Detail

NOTools

public NOTools()
Construct a 'NOHelper' object. Fill in vectors TORQUE_DB and TORQUE_TYPES

Method Detail

loadTorqueType

public void loadTorqueType()
Load torque types.


loadIconResource

public static final javax.swing.ImageIcon loadIconResource(java.lang.String pImgName)
Load an icon

Parameters:
pImgName - the name of the image
Returns:
the image icon

loadProperties

public void loadProperties()
Load preferences from the 'NO_PREFS' properties file


saveProperties

public static void saveProperties()
Save preferences to the 'NO_PREFS' properties file


deleteFile

public static final boolean deleteFile(java.io.File file)
Deletes a file or a directory along with all files and directories it contains.

Parameters:
file - the file or directory to delete
Returns:
whether delete was successful

createDirectory

public static void createDirectory(java.lang.String path)
Given a path string create all the directories in the path. For example, if the path string is "java/applet", the method will create directory "java" and then "java/applet" if they don't exist. The file separator string "/" is platform dependent system property.

Parameters:
path - Directory path string.

distance

public static int distance(java.awt.Point p1,
                           java.awt.Point p2)
Calcultate distance

Parameters:
p1 - the A point
p2 - the B point
Returns:
the distance

getMiddle

public static java.awt.Point getMiddle(java.awt.Point pA,
                                       java.awt.Point pB)
Calculate middle

Parameters:
pA - the A point
pB - the B point
Returns:
the point at the middle

unzip

public static void unzip(java.lang.String file,
                         java.lang.String dest,
                         javax.swing.JProgressBar jProgressBar)
                  throws java.util.zip.ZipException,
                         java.io.IOException
Unzip a fie

Parameters:
file - the file
dest - the destination directory
jProgressBar - the load advance
Throws:
java.util.zip.ZipException
java.io.IOException

getCardType

public static int getCardType(Association theAssociation)
return the type of the relation (11,1N,1N) so we know wich Merise rule to apply for a given association (cardinalities) card_is 01 11 0N 1N (right) is_card -------------------------------- 01 | 11 11 1N 1N 11 | 11 11 1N 1N 0N | 1N 1N NM NM 1N | 1N 1N NM NM (left)

Parameters:
theAssociation - the association to indentify
Returns:
the card type

getJavaName

public static java.lang.String getJavaName(java.lang.String schemaName)
Converts a database schema name to java object name. Operates same as underscoreMethod but does not convert anything to lowercase.

Parameters:
schemaName - name to be converted.
Returns:
converted name.
See Also:
org.apache.torque.engine.database.model.NameGenerator, #underscoreMethod(String)

getNOProperties

public static java.util.Properties getNOProperties()
Give a reference to the app Properties.

Returns:
the java.util.properties for this app


Copyright © 2002-2004 devaki.org. All Rights Reserved.