EspressReport
v 5.5

quadbase.common.util.internal
Class QbUtil

java.lang.Object
  |
  +--quadbase.common.util.internal.QbUtil

public class QbUtil
extends java.lang.Object

A collection of miscellaneous utility functions


Field Summary
static char[] NON_PARAMETER_DELIMITERS
          any character(s) between '#', '"' and '\'' are not parameters
static char[] PARAMETER_DELIMITERS
          the characters ')' and ' ' can be used to end a parameter name, such as in the case of Customers.id IN (:custid), in which case the parameter name is "custid"
static int PIXEL_PER_INCH
           
static int PIXEL_PER_INCH_EXPORT
           
static boolean usePatch
           
 
Constructor Summary
QbUtil()
           
 
Method Summary
static void add(java.awt.Container x, java.awt.Component c, java.awt.GridBagLayout gbl, java.awt.GridBagConstraints gbc, int gx, int gy, int w, int h)
           
static void addArrayToVector(java.util.Vector vec, java.lang.Object[] array)
           
static java.lang.String buildSelectQuery(quadbase.common.client.ReadDatabase readDB, java.lang.String columnName, java.lang.String tableName)
           
static java.lang.String convertToHTMLFileName(java.lang.String str)
           
static int[] convertVectorToIntArray(java.util.Vector v)
           
static java.lang.String escapeSqlString(java.lang.String s)
          transforms a string by doubling any single quote marks found inside of it; this allows the string to be inserted directly into an SQL statement without having to use a dynamic parameter
static java.lang.String findName(java.lang.String url)
           
static int getAdjustedFont(int size, boolean isViewerAdjustFont)
          To get the default font for designer.
static java.lang.String getDecodedString(java.lang.String str)
           
static java.awt.Font getDefaultFont(java.awt.Font oldFont, java.awt.Font newFont)
          If user has patch.jar in classpath, use old defaultFont
static java.lang.String getDHTMLTempFileName(java.lang.String name)
           
static java.lang.String getDoubleString(java.lang.String text)
           
static java.lang.String getEncodedString(java.lang.String str)
           
static java.lang.String getEncodedString(java.lang.String str, java.lang.String encoding)
           
static java.lang.String[] getEncodedStringArray(java.lang.String[] str)
           
static java.lang.String[] getEncodedStringArray(java.lang.String[] str, java.lang.String encoding)
           
static java.lang.String[] getExtension()
           
static java.lang.String getFileName(java.lang.String path)
           
static java.lang.String getFullName(java.lang.String fileName)
           
static java.util.Hashtable getHashTable(char[] names)
           
static java.lang.String getHTMLTempFileName(java.lang.String name)
           
static java.lang.String getIntegerString(java.lang.String text)
           
static int getPixelPerInch_export()
           
static int getPixelPerInch()
           
static double getPosAfterSnapToGrid(double x)
           
static int getPosAfterSnapToGrid(int x)
           
static java.lang.String getPrefixFileName(java.lang.String name)
           
static java.lang.String[] getQueryParamNames(java.lang.String[] conditions)
           
static java.lang.String getValidFilename(java.lang.String filename)
          The filename argument should consist only of the file and should not include any directories.
static java.awt.FontMetrics getViewerFontMetrics(java.awt.FontMetrics fm, boolean isAdjustFont)
          to get the font metrics for viewer UI, for RTF filed export
static boolean isValidName(java.lang.String s)
           
static java.awt.Panel labelComponent(java.lang.String label, java.awt.Component component)
           
static java.awt.Panel makeButtonPanel(java.lang.String buttonNames, int alignment)
           
static java.lang.String makeNewLine(java.lang.String str)
           
static int nextNumber()
           
static java.lang.String[] parseMultiValues(java.lang.String in)
           
static float pixelToPoints(int pixel)
           
static double pointsToInch(float points)
           
static java.util.Vector readMultiValues(java.lang.String valueString)
           
static java.lang.String removeSkipChar(java.lang.String originalString)
           
static java.lang.String replace(java.lang.String sOriginal, java.lang.String sReplace, java.lang.String sNew)
           
static java.lang.String replaceUnicode(java.lang.String sOriginal)
           
static int resizeExportFont(int size, boolean isViewerAdjustFont)
          resize pdf font, this is for report that isViewerAdjustFont = false;
static java.awt.Font resizeViewerFont(java.awt.Font font, boolean adjust)
           
static int resizeViewerFont(int size, boolean isViewerAdjustFont)
          for adjust the font, if true use pixel wise font, if false, use point size font
static void setCM_UNIT(double CmGridStepSize)
           
static void setPixelPerInchForExport(int ppi)
           
static java.lang.Object[] toArray(IDataSet vec)
           
static java.lang.Object[] toArray(java.util.Vector vec)
           
static double toInch_export(double pixel)
           
static double toInch(double pixel)
           
static int toPixel_export(double inch)
           
static int toPixel(double inch)
           
static float toPoints(double inch)
          POINTS This is for export to PDF format 1 inch = 72 points
static java.lang.String[] toStringArray(java.util.LinkedList list)
           
static java.io.File urlToFile(java.net.URL url)
          translates a URL, assumed to be with "file:" protocol, into a File
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

PIXEL_PER_INCH

public static int PIXEL_PER_INCH

PIXEL_PER_INCH_EXPORT

public static int PIXEL_PER_INCH_EXPORT

usePatch

public static boolean usePatch

NON_PARAMETER_DELIMITERS

public static final char[] NON_PARAMETER_DELIMITERS
any character(s) between '#', '"' and '\'' are not parameters

PARAMETER_DELIMITERS

public static final char[] PARAMETER_DELIMITERS
the characters ')' and ' ' can be used to end a parameter name, such as in the case of Customers.id IN (:custid), in which case the parameter name is "custid"
Constructor Detail

QbUtil

public QbUtil()
Method Detail

urlToFile

public static java.io.File urlToFile(java.net.URL url)
translates a URL, assumed to be with "file:" protocol, into a File

add

public static final void add(java.awt.Container x,
                             java.awt.Component c,
                             java.awt.GridBagLayout gbl,
                             java.awt.GridBagConstraints gbc,
                             int gx,
                             int gy,
                             int w,
                             int h)

makeButtonPanel

public static java.awt.Panel makeButtonPanel(java.lang.String buttonNames,
                                             int alignment)

escapeSqlString

public static java.lang.String escapeSqlString(java.lang.String s)
transforms a string by doubling any single quote marks found inside of it; this allows the string to be inserted directly into an SQL statement without having to use a dynamic parameter
Parameters:
s - the unescaped string
Returns:
the escaped string

labelComponent

public static java.awt.Panel labelComponent(java.lang.String label,
                                            java.awt.Component component)

convertToHTMLFileName

public static java.lang.String convertToHTMLFileName(java.lang.String str)

replace

public static java.lang.String replace(java.lang.String sOriginal,
                                       java.lang.String sReplace,
                                       java.lang.String sNew)

replaceUnicode

public static java.lang.String replaceUnicode(java.lang.String sOriginal)

getDefaultFont

public static java.awt.Font getDefaultFont(java.awt.Font oldFont,
                                           java.awt.Font newFont)
If user has patch.jar in classpath, use old defaultFont
Parameters:
oldFont - default font for earlier version
newFont - default font for newer version

setPixelPerInchForExport

public static void setPixelPerInchForExport(int ppi)

getPixelPerInch

public static int getPixelPerInch()

getPixelPerInch_export

public static int getPixelPerInch_export()

toPixel

public static int toPixel(double inch)

toPixel_export

public static int toPixel_export(double inch)

toInch

public static double toInch(double pixel)

toInch_export

public static double toInch_export(double pixel)

toPoints

public static float toPoints(double inch)
POINTS This is for export to PDF format 1 inch = 72 points

pointsToInch

public static double pointsToInch(float points)

pixelToPoints

public static float pixelToPoints(int pixel)

resizeViewerFont

public static int resizeViewerFont(int size,
                                   boolean isViewerAdjustFont)
for adjust the font, if true use pixel wise font, if false, use point size font

getAdjustedFont

public static int getAdjustedFont(int size,
                                  boolean isViewerAdjustFont)
To get the default font for designer. If isViewerAdjustFont = true, then adjust the font This is the opposite of resizeViewerFont

resizeExportFont

public static int resizeExportFont(int size,
                                   boolean isViewerAdjustFont)
resize pdf font, this is for report that isViewerAdjustFont = false;

resizeViewerFont

public static java.awt.Font resizeViewerFont(java.awt.Font font,
                                             boolean adjust)

getViewerFontMetrics

public static java.awt.FontMetrics getViewerFontMetrics(java.awt.FontMetrics fm,
                                                        boolean isAdjustFont)
to get the font metrics for viewer UI, for RTF filed export

toArray

public static java.lang.Object[] toArray(java.util.Vector vec)

toArray

public static java.lang.Object[] toArray(IDataSet vec)

addArrayToVector

public static void addArrayToVector(java.util.Vector vec,
                                    java.lang.Object[] array)

getExtension

public static java.lang.String[] getExtension()

getFullName

public static java.lang.String getFullName(java.lang.String fileName)

getPrefixFileName

public static java.lang.String getPrefixFileName(java.lang.String name)

getDHTMLTempFileName

public static java.lang.String getDHTMLTempFileName(java.lang.String name)

getHTMLTempFileName

public static java.lang.String getHTMLTempFileName(java.lang.String name)

getFileName

public static java.lang.String getFileName(java.lang.String path)

convertVectorToIntArray

public static int[] convertVectorToIntArray(java.util.Vector v)

getValidFilename

public static java.lang.String getValidFilename(java.lang.String filename)
The filename argument should consist only of the file and should not include any directories. This method will replace all illegal characters with '_'.

isValidName

public static boolean isValidName(java.lang.String s)

getIntegerString

public static java.lang.String getIntegerString(java.lang.String text)

getDoubleString

public static java.lang.String getDoubleString(java.lang.String text)

removeSkipChar

public static java.lang.String removeSkipChar(java.lang.String originalString)

makeNewLine

public static java.lang.String makeNewLine(java.lang.String str)

buildSelectQuery

public static java.lang.String buildSelectQuery(quadbase.common.client.ReadDatabase readDB,
                                                java.lang.String columnName,
                                                java.lang.String tableName)

getPosAfterSnapToGrid

public static int getPosAfterSnapToGrid(int x)

getPosAfterSnapToGrid

public static double getPosAfterSnapToGrid(double x)

setCM_UNIT

public static void setCM_UNIT(double CmGridStepSize)

readMultiValues

public static java.util.Vector readMultiValues(java.lang.String valueString)

getQueryParamNames

public static java.lang.String[] getQueryParamNames(java.lang.String[] conditions)

getHashTable

public static java.util.Hashtable getHashTable(char[] names)

toStringArray

public static java.lang.String[] toStringArray(java.util.LinkedList list)

getEncodedString

public static java.lang.String getEncodedString(java.lang.String str)
                                         throws java.io.UnsupportedEncodingException

getDecodedString

public static java.lang.String getDecodedString(java.lang.String str)
                                         throws java.io.UnsupportedEncodingException

getEncodedString

public static java.lang.String getEncodedString(java.lang.String str,
                                                java.lang.String encoding)
                                         throws java.io.UnsupportedEncodingException

getEncodedStringArray

public static java.lang.String[] getEncodedStringArray(java.lang.String[] str)
                                                throws java.io.UnsupportedEncodingException

getEncodedStringArray

public static java.lang.String[] getEncodedStringArray(java.lang.String[] str,
                                                       java.lang.String encoding)
                                                throws java.io.UnsupportedEncodingException

findName

public static java.lang.String findName(java.lang.String url)

nextNumber

public static int nextNumber()

parseMultiValues

public static java.lang.String[] parseMultiValues(java.lang.String in)

EspressReport
v 5.5