ABLE 2.0.0 07/02/2003 10:25:01

com.ibm.able
Class AblePanelHelper

java.lang.Object
  |
  +--com.ibm.able.AblePanelHelper

public class AblePanelHelper
extends java.lang.Object

This class provides graphical helper methods to assure consistency of controls for AbleCustomizer panels. It contains only static methods.

See Also:
AbleObjectCustomizer

Method Summary
static javax.swing.JButton addButton(javax.swing.JPanel thePanel, int theX, int theY, int theWidth, java.lang.String theLabel, java.awt.event.ActionListener theAction, java.lang.String theToolTip)
          Construct a JButton and place it on the panel provided at the specified location.
static javax.swing.JButton addButton(javax.swing.JPanel thePanel, java.lang.String theLabel, java.awt.event.ActionListener theAction, java.lang.String theToolTip)
          Construct a JButton and place it on the panel.
static javax.swing.JCheckBox addCheckBox(javax.swing.JPanel thePanel, int theX, int theY, int theWidth, java.lang.String theLabel)
          Construct a JCheckBox and place it on the panel provided at the specified location.
static javax.swing.JCheckBox addCheckBox(javax.swing.JPanel thePanel, int theX, int theY, java.lang.String theLabel)
          Construct a JCheckBox and place it on the panel provided at the specified location.
static javax.swing.JComboBox addComboBox(javax.swing.JPanel thePanel, int theX, int theY, int theWidth)
          Construct a JComboBox and place it on the panel provided at the specified location.
static javax.swing.JComboBox addComboBox(javax.swing.JPanel thePanel, int theX, int theY, int theWidth, java.util.Vector model)
          Construct a JComboBox and place it on the panel provided at the specified location.
static AbleJTextAreaHandler addJTextAreaHandler(AbleLogger theLogger, java.lang.String handlerName, long level, javax.swing.JTextArea area)
          Add an AbleJTextAreaHandler handler to a logger.
static javax.swing.JLabel addLabel(javax.swing.JPanel thePanel, int theX, int theY, int theWidth, java.lang.String theLabel)
          Construct a JLabel and place it on the panel provided at the specified location.
static javax.swing.JList addList(javax.swing.JPanel thePanel, int theX, int theY, int theWidth, int theHeight, int theMode)
          Construct a JList and place it in a JScrollPane on the panel provided at the specified location.
static javax.swing.JPasswordField addPasswordField(javax.swing.JPanel thePanel, int theX, int theY, int theWidth)
          Construct a JPasswordField and place it on the panel provided at the specified location.
static javax.swing.JTextArea addTextArea(javax.swing.JPanel thePanel, int theX, int theY, int theWidth, int theHeight, int theRows, int theColumns)
          Construct a JTextArea and place it in a JScrollPane on the panel provided at the specified location.
static javax.swing.JTextField addTextField(javax.swing.JPanel thePanel, int theX, int theY, int theWidth)
          Construct a JTextField and place it on the panel provided at the specified location.
static AbleJTextAreaHandler addTraceJTextAreaHandler(AbleBean theBean, long level, javax.swing.JTextArea area)
          Add a new JTextAreaHandler to a bean's trace logger.
static java.lang.String Copyright()
          Determine the copyright of this class.
static java.lang.String[] getFileDialog(java.awt.Window theParent, java.lang.String theChooserTitle, java.lang.String theFileTitle, java.lang.String[] theFileSpec, java.lang.String theDirectory, int theDialogType)
          Construct a modal JFileChooser and use it to obtain a file and path.
static java.lang.String[] getFileDialog(java.awt.Window theParent, java.lang.String theChooserTitle, java.lang.String theFileTitle, java.lang.String theFileExtension, java.lang.String theDirectory, int theDialogType)
          Construct a modal JFileChooser and use it to obtain a file and path.
static void removeTraceJTextAreaHandler(AbleBean theBean)
          Remove the Able.TraceLog file handler from a bean's trace logger.
static void setFileDialog(javax.swing.JTextField theTextField, java.lang.String theDialogTitle, java.lang.String theFileSpec)
          Deprecated. Use setTextFieldFromFileDialog instead.
static java.lang.String setTextFieldFromFileDialog(javax.swing.JTextField theTextField, java.lang.String theDirectory)
          Construct a OPEN JFileChooser dialog and use it to set the text of a JTextField.
static java.lang.String setTextFieldFromFileDialog(javax.swing.JTextField theTextField, java.lang.String theFileTitle, java.lang.String[] theFileExtensions, java.lang.String theDirectory)
          Construct a OPEN JFileChooser dialog and use it to set the text of a JTextField.
static java.lang.String setTextFieldFromFileDialog(javax.swing.JTextField theTextField, java.lang.String theFileTitle, java.lang.String theFileExtension, java.lang.String theDirectory)
          Construct a OPEN JFileChooser dialog and use it to set the text of a JTextField.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

addButton

public static javax.swing.JButton addButton(javax.swing.JPanel thePanel,
                                            int theX,
                                            int theY,
                                            int theWidth,
                                            java.lang.String theLabel,
                                            java.awt.event.ActionListener theAction,
                                            java.lang.String theToolTip)
Construct a JButton and place it on the panel provided at the specified location.
Parameters:
thePanel - add the new button to this JPanel.
theX - place the new button at this X location.
theY - place the new button at this Y location.
theWidth - the button width.
theLabel - use this label for the new button.
theAction - the action listener to use when the button is pressed.
theToolTip - the text to display when the mouse hovers over the button.

addButton

public static javax.swing.JButton addButton(javax.swing.JPanel thePanel,
                                            java.lang.String theLabel,
                                            java.awt.event.ActionListener theAction,
                                            java.lang.String theToolTip)
Construct a JButton and place it on the panel.
Parameters:
thePanel - add the new button to this JPanel.
theLabel - use this label for the new button.
theAction - the action listener to use when the button is pressed.
theToolTip - the text to display when the mouse hovers over the button.

addCheckBox

public static javax.swing.JCheckBox addCheckBox(javax.swing.JPanel thePanel,
                                                int theX,
                                                int theY,
                                                java.lang.String theLabel)
Construct a JCheckBox and place it on the panel provided at the specified location.
Parameters:
thePanel - add the new checkbox to this JPanel.
theX - place the new checkbox at this X location.
theY - place the new checkbox at this Y location.
theLabel - use this label for the new checkbox.

addCheckBox

public static javax.swing.JCheckBox addCheckBox(javax.swing.JPanel thePanel,
                                                int theX,
                                                int theY,
                                                int theWidth,
                                                java.lang.String theLabel)
Construct a JCheckBox and place it on the panel provided at the specified location.
Parameters:
thePanel - add the new checkbox to this JPanel.
theX - place the new checkbox at this X location.
theY - place the new checkbox at this Y location.
theWidth - the checkbox width.
theLabel - use this label for the new checkbox.

addComboBox

public static javax.swing.JComboBox addComboBox(javax.swing.JPanel thePanel,
                                                int theX,
                                                int theY,
                                                int theWidth)
Construct a JComboBox and place it on the panel provided at the specified location.
Parameters:
thePanel - add the new combobox to this JPanel.
theX - place the new combobox at this X location.
theY - place the new combobox at this Y location.
theWidth - the combobox width.

addComboBox

public static javax.swing.JComboBox addComboBox(javax.swing.JPanel thePanel,
                                                int theX,
                                                int theY,
                                                int theWidth,
                                                java.util.Vector model)
Construct a JComboBox and place it on the panel provided at the specified location.
Parameters:
thePanel - add the new combobox to this JPanel.
theX - place the new combobox at this X location.
theY - place the new combobox at this Y location.
theWidth - the combobox width.

addLabel

public static javax.swing.JLabel addLabel(javax.swing.JPanel thePanel,
                                          int theX,
                                          int theY,
                                          int theWidth,
                                          java.lang.String theLabel)
Construct a JLabel and place it on the panel provided at the specified location.
Parameters:
thePanel - add the new label to this JPanel.
theX - place the new label at this X location.
theY - place the new label at this Y location.
theWidth - the new label width.
theLabel - use this label for the text.

addList

public static javax.swing.JList addList(javax.swing.JPanel thePanel,
                                        int theX,
                                        int theY,
                                        int theWidth,
                                        int theHeight,
                                        int theMode)
Construct a JList and place it in a JScrollPane on the panel provided at the specified location.
Parameters:
thePanel - add the new list to this JPanel.
theX - place the new list at this X location.
theY - place the new list at this Y location.
theWidth - the list width.
theHeight - the list height.
theMode - the selection mode for the ListSelectionModel.
See Also:
ListSelectionModel

addTextArea

public static javax.swing.JTextArea addTextArea(javax.swing.JPanel thePanel,
                                                int theX,
                                                int theY,
                                                int theWidth,
                                                int theHeight,
                                                int theRows,
                                                int theColumns)
Construct a JTextArea and place it in a JScrollPane on the panel provided at the specified location.
Parameters:
thePanel - add the new text area to this JPanel.
theX - place the new text area at this X location.
theY - place the new text area at this Y location.
theWidth - the text area width.
theHeight - the text area height.
theRows - the number of rows in the text area. Provide -1 to avoid setting the row size.
theColumns - the number of rows in the text area. Provide -1 to avoid setting the column size.

addTextField

public static javax.swing.JTextField addTextField(javax.swing.JPanel thePanel,
                                                  int theX,
                                                  int theY,
                                                  int theWidth)
Construct a JTextField and place it on the panel provided at the specified location.
Parameters:
thePanel - add the new text field to this JPanel.
theX - place the new text field at this X location.
theY - place the new text field at this Y location.
theWidth - the text field width.

addPasswordField

public static javax.swing.JPasswordField addPasswordField(javax.swing.JPanel thePanel,
                                                          int theX,
                                                          int theY,
                                                          int theWidth)
Construct a JPasswordField and place it on the panel provided at the specified location.
Parameters:
thePanel - add the new text field to this JPanel.
theX - place the new text field at this X location.
theY - place the new text field at this Y location.
theWidth - the text field width.

setFileDialog

public static void setFileDialog(javax.swing.JTextField theTextField,
                                 java.lang.String theDialogTitle,
                                 java.lang.String theFileSpec)
Deprecated. Use setTextFieldFromFileDialog instead.

Construct a FileDialog and use it to populate a JTextField. The FileDialog will be placed 20 pels below and 20 pels to the right of the parent of the JTextField.
Parameters:
theTextField - The textfield to be populated with the FileDialog selection.
theDialogTitle - The title to be used for the FileDialog box.
theFileSpec - The filter to be used to select files.

getFileDialog

public static java.lang.String[] getFileDialog(java.awt.Window theParent,
                                               java.lang.String theChooserTitle,
                                               java.lang.String theFileTitle,
                                               java.lang.String theFileExtension,
                                               java.lang.String theDirectory,
                                               int theDialogType)
Construct a modal JFileChooser and use it to obtain a file and path.
Parameters:
theParent - The Window that represents the JFileChooser's parent.
theChooserTitle - A String containing the JFileChooser's title.
theFileTitle - The description used to identify the file selection. Suggested format: "Description of File (*.xyz)"
theFileExtension - The extension used to filter the search, for example: "xyz".
theDirectory - A String containing the starting directory.
theDialogType - An integer representing the type of dialog:
JFileChooser.OPEN_DIALOG
JFileChooser.OPEN_DIALOG
Returns:
A String array where:
[0]
Path, where null indicates no file was chosen
[1]
FileName.extension, where null indicates no file was chosen
[2]
FileName only, where null indicates no file was chosen
See Also:
JFileChooser

getFileDialog

public static java.lang.String[] getFileDialog(java.awt.Window theParent,
                                               java.lang.String theChooserTitle,
                                               java.lang.String theFileTitle,
                                               java.lang.String[] theFileSpec,
                                               java.lang.String theDirectory,
                                               int theDialogType)
Construct a modal JFileChooser and use it to obtain a file and path.
Parameters:
theParent - The Window that represents the JFileChooser's parent.
theChooserTitle - A String containing the JFileChooser's title.
theFileTitle - The description used to identify the file selection. Suggested format: "Description of File (*.xyz)"
theFileExtensions - A String array of file extensions used to filter the search, for example: {"ser", "xlt"}.
theDirectory - A String containing the starting directory.
theDialogType - An integer representing the type of dialog:
JFileChooser.OPEN_DIALOG
JFileChooser.OPEN_DIALOG
Returns:
A String array where:
[0]
Path, where null indicates no file was chosen
[1]
FileName.extension, where null indicates no file was chosen
[2]
FileName only, where null indicates no file was chosen
See Also:
JFileChooser

setTextFieldFromFileDialog

public static java.lang.String setTextFieldFromFileDialog(javax.swing.JTextField theTextField,
                                                          java.lang.String theFileTitle,
                                                          java.lang.String theFileExtension,
                                                          java.lang.String theDirectory)
Construct a OPEN JFileChooser dialog and use it to set the text of a JTextField. The dialog parent is obtained from the JTextField.
Parameters:
theTextField - The textfield to be populated with the JFileChooser selection.
theFileTitle - The description used to identify the file selection. Suggested format: "Description of File (*.xyz)"
theFileExtension - The extension used to filter the search, for example: "xyz".
theDirectory - A String containing the starting directory.
Returns:
A String representing the path to the selected file, where null indicates nothing was selected.

setTextFieldFromFileDialog

public static java.lang.String setTextFieldFromFileDialog(javax.swing.JTextField theTextField,
                                                          java.lang.String theFileTitle,
                                                          java.lang.String[] theFileExtensions,
                                                          java.lang.String theDirectory)
Construct a OPEN JFileChooser dialog and use it to set the text of a JTextField. The dialog parent is obtained from the JTextField.
Parameters:
theTextField - The textfield to be populated with the JFileChooser selection.
theFileTitle - The description used to identify the file selection. Suggested format: "Description of File (*.xyz)"
theFileExtensions - A String array of extensions used to filter the search, for example: {"ser","xlt"}.
theDirectory - A String containing the starting directory.
Returns:
A String representing the path to the selected file, where null indicates nothing was selected.

setTextFieldFromFileDialog

public static java.lang.String setTextFieldFromFileDialog(javax.swing.JTextField theTextField,
                                                          java.lang.String theDirectory)
Construct a OPEN JFileChooser dialog and use it to set the text of a JTextField. The dialog parent is obtained from the JTextField.
Parameters:
theTextField - The textfield to be populated with the JFileChooser selection.
theDirectory - A String containing the starting directory.
Returns:
A String representing the path to the selected file, where null indicates nothing was selected.

addTraceJTextAreaHandler

public static AbleJTextAreaHandler addTraceJTextAreaHandler(AbleBean theBean,
                                                            long level,
                                                            javax.swing.JTextArea area)
                                                     throws AbleException
Add a new JTextAreaHandler to a bean's trace logger. The bean must be in bean logging mode - see Able.startBeanTraceLogging(com.ibm.able.AbleBean) or no action will be taken. If the bean's logger already has a JTextAreaHandler, it is removed and a new handler is constructed.
Parameters:
theBean - An AbleBean whose trace output is to be sent to its own JTextArea.
level - A level from AbleTraceLogger.TraceLogLevelValuesVector used to calculate a mask.
fileName - The path and file name used to store the trace output.
Returns:
The Handler added; null returned if the bean trace logger is the global Able.TraceLog logger or adding a handler fails.
See Also:
addJTextAreaHandler(AbleLogger, String, long, JTextArea)

addJTextAreaHandler

public static AbleJTextAreaHandler addJTextAreaHandler(AbleLogger theLogger,
                                                       java.lang.String handlerName,
                                                       long level,
                                                       javax.swing.JTextArea area)
Add an AbleJTextAreaHandler handler to a logger. If a handler by the name provided exists, all its filters are removed and a new AnyMaskFilter AnyMaskFilteris calculated from the level. If Able.Debug is true, the AbleTraceFormatter is used to display output.
Parameters:
theLogger - The logger instance to use the new handler.
handlerName - A String containing the name of the handler to add.
level - A level used to calculate the mask for an AnyMaskFilter.
JTextArea - A JTextArea to display the output.
Returns:
The AbleJTextAreaHandler with the name provided.

removeTraceJTextAreaHandler

public static void removeTraceJTextAreaHandler(AbleBean theBean)
                                        throws AbleException
Remove the Able.TraceLog file handler from a bean's trace logger. No action is taken if the bean logger has no file handler.
Parameters:
theBean - An AbleBean whose trace output is no longer to be filed.

Copyright

public static java.lang.String Copyright()
Determine the copyright of this class.
Returns:
A String containing this class's copyright statement.


ABLE 2.0.0 07/02/2003 10:25:01

(C) Copyright IBM Corporation 1999, 2003