jet.api
Class API

java.lang.Object
  extended by jet.api.API
Direct Known Subclasses:
CatalogAPI, Designer

public abstract class API
extends java.lang.Object

API class is a abstract class. It provides a series of editing methods for users.


Field Summary
static int BOOLEAN
          Primitive property type values
static java.lang.String CAT
          The catalog file suffix.
static int CENTIMETER
          The unit type value.
static int COLOR
          Reference property type values
static int DOUBLE
          Primitive property type values
static int ENUM
          Reference property type values
static int FLOAT
          Primitive property type values
 java.util.Hashtable handles
           
static int INCH
          The unit type value.
static int INTEGER
          Primitive property type values
static int LONG
          Primitive property type values
static int PIXEL
          The unit type value.
static int REFERENCE
          Reference property type values
static java.lang.String RPT
          The report file suffix.
static java.lang.String SELFRPT
          The self contained report file suffix.
static int STRING
          Reference property type values
static java.lang.String TEXTRPT
          The text report file suffix.
static int UNKNOWN
          Primitive property type values
static java.lang.String XMLCAT
          The XML catalog file suffix.
static java.lang.String XMLRPT
          The XML report file suffix.
 
Constructor Summary
API()
           
 
Method Summary
 void clearError()
          Clears error message.
 void clearMsg()
          Clears message of warning and error.
 void clearWarning()
          Clears warning message.
 void closeLog()
          Closes log.
 boolean containPropName(java.lang.String handle, java.lang.String name)
          Check whether the property name exists.
abstract  boolean delete(java.lang.String handle)
          Deletes an object from its parent node.
 boolean getBool(java.lang.String handle, java.lang.String name)
          Gets property value.
 java.lang.String[] getChildren(java.lang.String objHandle)
          Gets all children's handle of a object.
 int getClassType(java.lang.String handle)
          Gets class type of an object.
 java.awt.Color getColor(java.lang.String handle, java.lang.String name)
          Gets property value.
 double getDouble(java.lang.String handle, java.lang.String name)
          Gets property value.
 java.lang.String getError()
          Gets error message.
 float getFloat(java.lang.String handle, java.lang.String name)
          Gets property value.
 java.lang.String[] getHandles()
          Gets all handles of API.
 java.lang.String[] getHandles(java.lang.String handle)
          Gets handles of sub node in current node.
 java.lang.String[] getHandles(java.lang.String handle, int type)
          Gets handles of sub node of the same types in current node.
 java.lang.String[] getHandles(java.lang.String handle, int type, int deepth)
          Gets handles of sub node of the same types in current node.
 java.lang.String getInstanceName(java.lang.String handle)
          Gets instance name of an object.
 int getInt(java.lang.String handle, java.lang.String name)
          Gets property value.
 long getLong(java.lang.String handle, java.lang.String name)
          Gets property value.
 java.lang.String getParent(java.lang.String handle)
          Gets parent handle of an object.
 java.lang.String[] getPropNames(java.lang.String handle)
          Gets property names.
 int getPropType(java.lang.String handle, java.lang.String name)
          Gets property type.
 java.lang.String getQualifyName(java.lang.String handle)
          Gets qualify name of an object.
 java.lang.String getString(java.lang.String handle, java.lang.String name)
          Gets property value.
 java.lang.String[] getStringArray(java.lang.String handle, java.lang.String name)
          Gets property value.
 int getUnit()
          Gets unit.
 java.lang.String getWarning()
          Gets warning message.
 boolean set(java.lang.String handle, java.lang.String name, boolean value)
          Changes property value of an object.
 boolean set(java.lang.String handle, java.lang.String name, java.awt.Color value)
          Changes color property value.
 boolean set(java.lang.String handle, java.lang.String name, double value)
          Changes property value of an object.
 boolean set(java.lang.String handle, java.lang.String name, float value)
          Changes property value of an object.
 boolean set(java.lang.String handle, java.lang.String name, int value)
          Changes property value of an object.
 boolean set(java.lang.String handle, java.lang.String name, long value)
          Changes property value of an object.
 boolean set(java.lang.String handle, java.lang.String name, java.lang.String value)
          Changes property value of an object.
 boolean setLog(java.io.OutputStream log, java.lang.String encoding)
          Sets log.
 boolean setLog(java.lang.String fileName)
          sets log.
 boolean setLog(java.lang.String fileName, boolean append)
          Sets log.
 boolean setReference(java.lang.String handle, java.lang.String name, java.lang.String refHandle)
          Changes reference property value of an object.
 boolean setUnit(int unit)
          Sets unit.
 void writeLog(java.lang.String msg)
          Writes message to the log.
 void writeLog(java.lang.String title, java.lang.Throwable e)
          Writes exception to the log.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

UNKNOWN

public static final int UNKNOWN
Primitive property type values

See Also:
Constant Field Values

BOOLEAN

public static final int BOOLEAN
Primitive property type values

See Also:
Constant Field Values

INTEGER

public static final int INTEGER
Primitive property type values

See Also:
Constant Field Values

LONG

public static final int LONG
Primitive property type values

See Also:
Constant Field Values

FLOAT

public static final int FLOAT
Primitive property type values

See Also:
Constant Field Values

DOUBLE

public static final int DOUBLE
Primitive property type values

See Also:
Constant Field Values

STRING

public static final int STRING
Reference property type values

See Also:
Constant Field Values

COLOR

public static final int COLOR
Reference property type values

See Also:
Constant Field Values

ENUM

public static final int ENUM
Reference property type values

See Also:
Constant Field Values

REFERENCE

public static final int REFERENCE
Reference property type values

See Also:
Constant Field Values

INCH

public static final int INCH
The unit type value.


CENTIMETER

public static final int CENTIMETER
The unit type value.


PIXEL

public static final int PIXEL
The unit type value.


RPT

public static final java.lang.String RPT
The report file suffix.


XMLRPT

public static final java.lang.String XMLRPT
The XML report file suffix.


SELFRPT

public static final java.lang.String SELFRPT
The self contained report file suffix.


TEXTRPT

public static final java.lang.String TEXTRPT
The text report file suffix.


CAT

public static final java.lang.String CAT
The catalog file suffix.


XMLCAT

public static final java.lang.String XMLCAT
The XML catalog file suffix.


handles

public java.util.Hashtable handles
Constructor Detail

API

public API()
Method Detail

setUnit

public boolean setUnit(int unit)
Sets unit.

Parameters:
unit - it must be either of INCH or CENTIMETER.
Returns:
true if sets successfully. Otherwise returns false.

getUnit

public int getUnit()
Gets unit.

Returns:
It must be either of INCH or CENTIMETER.

delete

public abstract boolean delete(java.lang.String handle)
Deletes an object from its parent node.

Parameters:
handle - handle of the object to be deleted.
Returns:
true if an object is removed from its parent node. Otherwise returns false.

getPropNames

public java.lang.String[] getPropNames(java.lang.String handle)
Gets property names.

Parameters:
handle - handle of the selected object.
Returns:
name array. It will return null, if an error occurs.

containPropName

public boolean containPropName(java.lang.String handle,
                               java.lang.String name)
Check whether the property name exists.

Parameters:
handle - handle of the selected object.
name - property name .
Returns:
true if it exists. Otherwise returns false.

getPropType

public int getPropType(java.lang.String handle,
                       java.lang.String name)
Gets property type.

Parameters:
handle - handle of the selected object.
name - name of property.
Returns:
type of property. The type values are defined in API class.

set

public boolean set(java.lang.String handle,
                   java.lang.String name,
                   boolean value)
Changes property value of an object.

Parameters:
handle - handle of the target object.
name - property name.
value - property value.
Returns:
true if the property value is changed.

set

public boolean set(java.lang.String handle,
                   java.lang.String name,
                   int value)
Changes property value of an object.

Parameters:
handle - handle of the target object.
name - property name.
value - property value.
Returns:
true if the property value is changed.

set

public boolean set(java.lang.String handle,
                   java.lang.String name,
                   long value)
Changes property value of an object.

Parameters:
handle - handle of the target object.
name - property name.
value - property value.
Returns:
true if the property value is changed.

set

public boolean set(java.lang.String handle,
                   java.lang.String name,
                   float value)
Changes property value of an object.

Parameters:
handle - handle of the target object.
name - property name.
value - property value.
Returns:
true if the property value is changed.

set

public boolean set(java.lang.String handle,
                   java.lang.String name,
                   double value)
Changes property value of an object.

Parameters:
handle - handle of the target object.
name - property name.
value - property value.
Returns:
true if the property value is changed.

set

public boolean set(java.lang.String handle,
                   java.lang.String name,
                   java.lang.String value)
Changes property value of an object.

Parameters:
handle - handle of the target object.
name - property name.
value - property value.
Returns:
true if the property value is changed.

set

public boolean set(java.lang.String handle,
                   java.lang.String name,
                   java.awt.Color value)
Changes color property value.

Parameters:
handle - handle of the target object.
name - property name.
value - Color property value.
Returns:
true if the property value is changed.

setReference

public boolean setReference(java.lang.String handle,
                            java.lang.String name,
                            java.lang.String refHandle)
Changes reference property value of an object.

Parameters:
handle - handle of the target object.
name - property name.
refHandle - handle of the referenced object.
Returns:
true if the property value is changed.

getBool

public boolean getBool(java.lang.String handle,
                       java.lang.String name)
Gets property value. After calling this method, you must immediately check error message. If error message is not null, the return value will be invaluable.

Parameters:
handle - handle of the target object.
name - property name.
Returns:
property value.

getInt

public int getInt(java.lang.String handle,
                  java.lang.String name)
Gets property value. After calling this method,you must immediately check error message. If error message is not null, the return value will be invaluable.

Parameters:
handle - handle of the target object.
name - property name.
Returns:
property value.

getLong

public long getLong(java.lang.String handle,
                    java.lang.String name)
Gets property value. After calling this method, you must immediately check error message. If error message is not null,the return value will be invaluable.

Parameters:
handle - handle of the target object.
name - property name.
Returns:
property value.

getFloat

public float getFloat(java.lang.String handle,
                      java.lang.String name)
Gets property value. After calling this method, you must immediately check error message. If error message is not null,the return value will be invaluable.

Parameters:
handle - handle of the target object.
name - property name.
Returns:
property value.

getDouble

public double getDouble(java.lang.String handle,
                        java.lang.String name)
Gets property value. After calling this method you must immediately check error message. If error message is not null, the return value will be invaluable.

Parameters:
handle - handle of the target object.
name - property name.
Returns:
property value.

getString

public java.lang.String getString(java.lang.String handle,
                                  java.lang.String name)
Gets property value. After calling this method, you must immediately check error message. If error message is not null, the return value is invaluable.

Parameters:
handle - handle of the target object.
name - property name.
Returns:
property value.

getStringArray

public java.lang.String[] getStringArray(java.lang.String handle,
                                         java.lang.String name)
Gets property value. After calling this method, you must immediately check error message. If error message is not null, the return value is invaluable.

Parameters:
handle - handle of the target object.
name - property name.
Returns:
property value.

getColor

public java.awt.Color getColor(java.lang.String handle,
                               java.lang.String name)
Gets property value. After calling this method, you must immediately check error message. If error message is not null, the return value will be invaluable.

Parameters:
handle - handle of the target object.
name - the property name.
Returns:
property value.

getHandles

public java.lang.String[] getHandles()
Gets all handles of API.

Returns:
handle array.

getHandles

public java.lang.String[] getHandles(java.lang.String handle)
Gets handles of sub node in current node.

Parameters:
handle - parent node handle.
Returns:
null if fails to get handles. Otherwise returns a handle array.

getHandles

public java.lang.String[] getHandles(java.lang.String handle,
                                     int type)
Gets handles of sub node of the same types in current node.

Parameters:
type - class type value that is defined in API class.
handle - parent node handle.
Returns:
null if fails to get handles. Otherwise returns a handle array.

getHandles

public java.lang.String[] getHandles(java.lang.String handle,
                                     int type,
                                     int deepth)
Gets handles of sub node of the same types in current node.

Parameters:
type - class type value that is defined in API class.
handle - parent node handle.
deepth - level depth related to the current level in the report tree. When the depth is -1, all the handles of the report will be got. When the depth is 0, the handles of the current level will be got. When the depth is number n, the handles of n levels and the current level will be got.
Returns:
null if fails to get handles. Otherwise returns a handle array.

getInstanceName

public java.lang.String getInstanceName(java.lang.String handle)
Gets instance name of an object.

Parameters:
handle - handle of an object.
Returns:
null if fails to get the name. Otherwise returns an instance name.

getQualifyName

public java.lang.String getQualifyName(java.lang.String handle)
Gets qualify name of an object.

Parameters:
handle - handle of an object.
Returns:
null if fails to get the name. Otherwise returns an instance name.

getClassType

public int getClassType(java.lang.String handle)
Gets class type of an object.

Parameters:
handle - handle of the object.
Returns:
UNKNOWN if an error or a warning occurs. Otherwise returns one of the class type values that are defined in API class.

getParent

public java.lang.String getParent(java.lang.String handle)
Gets parent handle of an object.

Parameters:
handle - handle of the object.
Returns:
null if an error or a warning occurs. Otherwise returns parent handle.

getWarning

public java.lang.String getWarning()
Gets warning message.

Returns:
warning message if operation is successfully execute return null.

clearWarning

public void clearWarning()
Clears warning message.


getError

public java.lang.String getError()
Gets error message.

Returns:
error message if operation is successfully execute return null.

clearError

public void clearError()
Clears error message.


clearMsg

public void clearMsg()
Clears message of warning and error.


setLog

public boolean setLog(java.io.OutputStream log,
                      java.lang.String encoding)
Sets log.

Parameters:
log - the output stream of log message to be output.
encoding - the encoding of message.

setLog

public boolean setLog(java.lang.String fileName,
                      boolean append)
Sets log.

Parameters:
log - the output log file that message to be output.
append - if true, then message will be written to the end of the file rather than the beginning.
encoding - the encoding of message.

setLog

public boolean setLog(java.lang.String fileName)
sets log.

Parameters:
fileName - the log file name. if not define the path, write to the current path.

writeLog

public void writeLog(java.lang.String msg)
Writes message to the log.

Parameters:
msg - the message to be output into the log.

writeLog

public void writeLog(java.lang.String title,
                     java.lang.Throwable e)
Writes exception to the log.

Parameters:
title - the title to be output into the log.
e - the Exception to be output into the log.

closeLog

public void closeLog()
              throws java.io.IOException
Closes log.

Throws:
java.io.IOException

getChildren

public java.lang.String[] getChildren(java.lang.String objHandle)
Gets all children's handle of a object.

Parameters:
objHandle - the handle of object
Returns:
chaildren's handle array