com.pentec.util
Class AUtil

java.lang.Object
  extended by com.pentec.util.AUtil

public class AUtil
extends java.lang.Object

The AUtil class is a collection of static utility methods intended for use with ADAPT.

Author:
Pender Technology

Field Summary
private static java.awt.Robot robot
          Robot used for cursor control
 
Constructor Summary
AUtil()
           
 
Method Summary
static java.lang.String byteArrayToHexString(byte[] ab)
           
static java.lang.String byteArrayToHexString(byte[] ab, int iOffset, int iLength)
           
static java.lang.String byteToHexString(byte number)
           
static javax.swing.JPanel createAutoManualPanel(java.lang.String $, javax.swing.JTextField jtf, javax.swing.JRadioButton jrbAuto, javax.swing.JRadioButton jrbMan)
          Create a panel containing a text field with "Auto" and "Manual" radio button options
static void createEtchedBorder(javax.swing.JPanel jp)
          This method adds an empty border around a panel, and then an etched border.
static javax.swing.JButton createTextButton(java.lang.String $, java.awt.event.ActionListener actionListener)
          This method provides a way of creating action buttons with standard margins.
static void dateStamp(java.io.Writer out)
           
static void disableScroll(javax.swing.JRootPane rootpane)
           
static void enableScroll(javax.swing.JRootPane rootpane)
           
static java.lang.String getByteArrayValue$(byte[] ab, int iOffset)
          Get an null terminated ASCII String value inside a byte[].
static int getByteArrayValueI(byte[] ab, int iOffset)
          Get an integer value inside a byte[] with the MSB first
static long getByteArrayValueL(byte[] ab, int iOffset)
          Get an integer value inside a byte[] with the MSB first
static java.lang.String[] getSerialPortNames()
          Get a list of serial port names
static void installHotKeys(DataFrame mainFrame, javax.swing.JRootPane rootpane)
          Register a set of keyboard functions that mimic a subset of the functions in the main frame drop down menu
static boolean mouseMove(java.awt.Point p)
          Move the mouse cursor to a specified point
static boolean mouseMove(java.awt.Rectangle r)
          Move the mouse cursor to the center of a rectangle
static void setByteArrayValue(byte[] ab, int iOffset, int iVal)
          Set an integer value inside a byte[] with the MSB first
static void setByteArrayValue(byte[] ab, int iOffset, long lVal)
          Set an long integer value inside a byte[] with the MSB first
static void setByteArrayValue(byte[] ab, int iOffset, java.lang.String $Val)
          Set an String value inside a byte[].
static void setEnabled(java.awt.Container container, boolean flag)
          This method sets the enabled flag of all components in a container.
static void setLAF(java.lang.String $LAF)
          Set the windowing system look and feel
static int showConfirm(java.awt.Component parentComponent, java.lang.String $Message, java.lang.String $Title)
           
static void showError(java.awt.Component parentComponent, java.lang.String $Message, java.lang.String $Title)
           
static void showOK(java.awt.Component parentComponent, java.lang.String $Message, java.lang.String $Title)
           
static void sleep(double dSeconds)
          Sleep for a specified number of seconds
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

robot

private static java.awt.Robot robot
Robot used for cursor control

Constructor Detail

AUtil

public AUtil()
Method Detail

byteArrayToHexString

public static java.lang.String byteArrayToHexString(byte[] ab)

byteArrayToHexString

public static java.lang.String byteArrayToHexString(byte[] ab,
                                                    int iOffset,
                                                    int iLength)

byteToHexString

public static java.lang.String byteToHexString(byte number)

createAutoManualPanel

public static javax.swing.JPanel createAutoManualPanel(java.lang.String $,
                                                       javax.swing.JTextField jtf,
                                                       javax.swing.JRadioButton jrbAuto,
                                                       javax.swing.JRadioButton jrbMan)
Create a panel containing a text field with "Auto" and "Manual" radio button options


createEtchedBorder

public static void createEtchedBorder(javax.swing.JPanel jp)
This method adds an empty border around a panel, and then an etched border. This is done in a way that allows width rubberbanding.


createTextButton

public static javax.swing.JButton createTextButton(java.lang.String $,
                                                   java.awt.event.ActionListener actionListener)
This method provides a way of creating action buttons with standard margins.


dateStamp

public static void dateStamp(java.io.Writer out)

disableScroll

public static void disableScroll(javax.swing.JRootPane rootpane)

enableScroll

public static void enableScroll(javax.swing.JRootPane rootpane)

getByteArrayValue$

public static java.lang.String getByteArrayValue$(byte[] ab,
                                                  int iOffset)
Get an null terminated ASCII String value inside a byte[].


getByteArrayValueI

public static int getByteArrayValueI(byte[] ab,
                                     int iOffset)
Get an integer value inside a byte[] with the MSB first


getByteArrayValueL

public static long getByteArrayValueL(byte[] ab,
                                      int iOffset)
Get an integer value inside a byte[] with the MSB first


getSerialPortNames

public static java.lang.String[] getSerialPortNames()
Get a list of serial port names

Returns:
array of serial port names

installHotKeys

public static void installHotKeys(DataFrame mainFrame,
                                  javax.swing.JRootPane rootpane)
Register a set of keyboard functions that mimic a subset of the functions in the main frame drop down menu

Parameters:
mainFrame - the frame in which the action listeners are contained
rootpane - the container that will capture the keyboard input

mouseMove

public static boolean mouseMove(java.awt.Point p)
Move the mouse cursor to a specified point

Parameters:
p - the point to move the mouse cursor to
Returns:
true if successful, false if not

mouseMove

public static boolean mouseMove(java.awt.Rectangle r)
Move the mouse cursor to the center of a rectangle

Parameters:
r - the point to move the mouse cursor to
Returns:
true if successful, false if not

setByteArrayValue

public static void setByteArrayValue(byte[] ab,
                                     int iOffset,
                                     int iVal)
Set an integer value inside a byte[] with the MSB first


setByteArrayValue

public static void setByteArrayValue(byte[] ab,
                                     int iOffset,
                                     long lVal)
Set an long integer value inside a byte[] with the MSB first


setByteArrayValue

public static void setByteArrayValue(byte[] ab,
                                     int iOffset,
                                     java.lang.String $Val)
Set an String value inside a byte[]. The array data written to the array will be null (0) terminated. If the value passed in is null, a single null byte will be written to the offset location.


setEnabled

public static void setEnabled(java.awt.Container container,
                              boolean flag)
This method sets the enabled flag of all components in a container.

Parameters:
container - the container to enable or disable
flag - true to enable components, false to disable components

setLAF

public static void setLAF(java.lang.String $LAF)
Set the windowing system look and feel

Parameters:
$LAF - the desired look and feel

showConfirm

public static int showConfirm(java.awt.Component parentComponent,
                              java.lang.String $Message,
                              java.lang.String $Title)

showError

public static void showError(java.awt.Component parentComponent,
                             java.lang.String $Message,
                             java.lang.String $Title)

showOK

public static void showOK(java.awt.Component parentComponent,
                          java.lang.String $Message,
                          java.lang.String $Title)

sleep

public static void sleep(double dSeconds)
Sleep for a specified number of seconds

Parameters:
dSeconds - the number of seconds to sleep