org.jurvis.swing
Class JvSwingFactory

java.lang.Object
  extended by org.jurvis.swing.JvSwingFactory

public class JvSwingFactory
extends Object

A factory for creating Swing components.

Author:
Neil W. Weber

Constructor Summary
protected JvSwingFactory()
          Construct a new JvSwingFactory.
 
Method Summary
 void apply(Component component, Component parent)
          Apply any properties found for the named object object.
 Action applyAction(Action action, Component parent)
          Apply any properties and/or factory customizations to an Action.
 Action applyAction(Action action, Component parent, String name)
          Apply any properties and/or factory customizations to an Action.
 JvApplication applyApplication(JvApplication application)
          Apply any properties to an JvApplication.
 JButton applyButton(JButton button, Component parent, String name)
          Apply any properties to an JButton.
 JCheckBox applyCheckBox(JCheckBox checkBox, Component parent, String name)
          Apply any properties to an JCheckBox.
 JComboBox applyComboBox(JComboBox comboBox, Component parent, String name)
          Apply any properties to an JComboBox.
 JDialog applyDialog(JDialog dialog, Component parent, String name)
          Apply any properties to an JDialog.
 JEditorPane applyEditorPane(JEditorPane editorPane, Component parent, String name)
          Apply any properties to an JEditorPane.
 JFileChooser applyFileChooser(JFileChooser fileChooser, Component parent, String name)
          Apply any properties to an JFileChooser.
 JLabel applyLabel(JLabel label, Component parent, String name)
          Apply any properties to an JLabel.
 JList applyList(JList list, Component parent, String name)
          Apply any properties to an JList.
 JMenu applyMenu(JMenu menu, Component parent, String name)
          Apply any properties to an JMenu.
 JMenuBar applyMenuBar(JMenuBar menuBar, Component parent, String name)
          Apply any properties to an JMenuBar.
 JMenuItem applyMenuItem(JMenuItem menuItem, Component parent, String name)
          Apply any properties to a JMenuItem.
 JOptionPane applyOptionPane(JOptionPane optionPane, Component parent, String name)
          Apply any properties to an JOptionPane.
 JPanel applyPanel(JPanel panel, Component parent, String name)
          Apply any properties to an JPanel.
 JPasswordField applyPasswordField(JPasswordField passwordField, Component parent, String name)
          Apply any properties to an JPasswordField.
 JPopupMenu applyPopupMenu(JPopupMenu popupMenu, Component parent, String name)
          Apply any properties to an JPopupMenu.
 JRadioButton applyRadioButton(JRadioButton radioButton, Component parent, String name)
          Apply any properties to a JRadioButton.
 JScrollPane applyScrollPane(JScrollPane scrollPane, Component parent, String name)
          Apply any properties to an JScrollPane.
 JSplitPane applySplitPane(JSplitPane splitPane, Component parent, String name)
          Apply any properties to an JSplitPane.
 JvStatusBar applyStatusBar(JvStatusBar statusBar, Component parent, String name)
          Apply any properties to an JvStatusBar.
 JTabbedPane applyTabbedPane(JTabbedPane tabbedPane, Component parent, String name)
          Apply any properties to an JTabbedPane.
 JTable applyTable(JTable table, Component parent, String name)
          Apply any properties to an JTable.
 TableColumn applyTableColumn(TableColumn tableColumn, JTable parent, String name)
          Apply any properties to an JTableColumn.
 JTextField applyTextField(JTextField textField, Component parent, String name)
          Apply any properties to an JTextField.
 JToggleButton applyToggleButton(JToggleButton toggleButton, Component parent, String name)
          Apply any properties to an JToggleButton.
 JToolBar applyToolBar(JToolBar toolBar, Component parent, String name)
          Apply any properties to an JToolBar.
 JButton applyToolItem(JButton toolItem, Component parent, String name)
          Apply any properties to a JButton.
 JTree applyTree(JTree tree, Component parent, String name)
          Apply any properties to an JTree.
 JvView applyView(JvView view, Component parent, String name)
          Apply any properties to an NView.
 JDialog applyWaitDialog(JDialog dlg, Component parent, String name, String text, String imageName)
          Apply any properties on a JDialog to be used to display a wait message.
 Action createAboutAction(Component parent, String name, URL aboutURL)
          Construct a JvAboutAction with the given name that controls the specified details pane.
 JvApplication createApplication(String name)
          Construct an NApplication with the given name.
 JButton createButton(Component parent, Action action)
          Construct a JButton based on an Action.
 JButton createButton(Component parent, String name)
          Construct a JButton.
 JCheckBox createCheckBox(Component parent, String name)
          Construct a JCheckBox.
 JComboBox createComboBox(Component parent, String name, ComboBoxModel model)
          Construct a JComboBox.
 JComboBox createComboBox(Component parent, String name, Object[] items)
          Construct a JComboBox.
 JComboBox createComboBox(Component parent, String name, Vector items)
          Construct a JComboBox.
protected  JvField createdField(JvField field, JComponent fieldComp, JLabel label, String propertyName)
          Perform any final initialization of the newly created JvField.
 JEditorPane createEditorPane(Component parent, String name, String contentType)
          Construct a JEditorPane.
 JEditorPane createEditorPane(Component parent, String name, String contentType, String text)
          Construct a JEditorPane.
 JDialog createErrorDialog(Component parent, String name)
          Construct a dialog displaying a error message to the user.
 JDialog createErrorDialog(Component parent, String name, Object[] args)
          Construct a dialog displaying a error message to the user.
 JvField createField(Container parent, Class clazz, String property)
          Create a JvField named property to edit the property of instance of class clazz.
 JvField createField(Container parent, Class clazz, String property, Object[] values)
          Construct a JvField to edit the property of instance class clazz.
 JvField createField(Container parent, String name, Class propertyType)
          Create a JvField named name to edit a property of type propertyType.
 JvField createField(Container parent, String name, Class clazz, String property)
          Create a JvField named name to edit the property of instance of class clazz.
 JvField createField(Container parent, String name, String propertyName, Class propertyType)
          Create a JvField named name to edit a property of type propertyType.
 JFileChooser createFileChooser(Component parent, String name)
          Construct a JFileChooser.
 JMenuItem createHelpMenuItem(Component parent, String name)
          Construct a JMenuItem that invokes help and add it to its parent.
 void createHorizontalSpace(Container parent, GridBagConstraints gbc)
          Create a GUI that takes some horizontal space in the parent container.
 ImageIcon createIcon(String name)
          Finds an icon with the given name.
 JLabel createLabel(Component parent, String name)
          Construct a JLabel.
 JComponent createLineSeparator(JToolBar parent)
          Create a Microsoft Windows-style vertical-line separator for a toolbar.
 JList createList(Component parent, String name, ListModel model)
          Construct a JList.
 JMenu createMenu(Component parent, String name)
          Construct a JMenu and add it to its parent.
 JMenuBar createMenuBar(Component parent, String name)
          Construct a JMenuBar.
 JMenuItem createMenuItem(Component parent, Action action)
          Construct a JMenuItem and add it to its parent.
 JMenuItem createMenuItem(Component parent, String name)
          Construct a JMenuItem and add it to it's parent.
 JMenuItem createMenuItem(Component parent, String name, Action action)
          Construct a JMenuItem and add it to it's parent.
 JDialog createOptionDialog(Component parent, JOptionPane optionPane, String name)
          Construct a dialog displaying a JOptionPane to the user.
 JOptionPane createOptionPane(Component parent, String name, int messageType)
          Construct a JOptionPane.
 JOptionPane createOptionPane(Component parent, String name, int messageType, int optionType)
          Construct a JOptionPane.
 JOptionPane createOptionPane(Component parent, String name, int messageType, int optionType, Object message)
          Construct a JOptionPane.
 JOptionPane createOptionPane(Component parent, String name, int messageType, int optionType, Object[] args)
          Construct a JOptionPane.
 JPanel createPanel(Component parent, String name)
          Construct a JPanel.
 JPanel createPanel(Component parent, String name, LayoutManager layout)
          Construct a JPanel with the specified layout manager.
 JPasswordField createPasswordField(Component parent, String name)
          Construct a JPasswordField.
 JPopupMenu createPopupMenu(Component parent, String name)
          Construct a JPopupMenu and add it to its parent.
 JRadioButton createRadioButton(Component parent, String name)
          Construct a JRadioButton.
 JRadioButtonMenuItem createRadioMenuItem(Component parent, Action action)
          Construct a JRadioButtonMenuItem and add it to it's parent.
 JTextField createReadOnlyTextField(Component parent, String name)
          Construct a JTextField that is intended for only display purposes.
 JScrollPane createScrollPane(Component parent, String name, Component view)
          Construct a JScrollPane.
 JComponent createSpaceSeparator(JToolBar parent)
          Create a space separator for a toolbar.
 JSplitPane createSplitPane(Component parent, String name)
          Construct a JSplitPane.
 JvStatusBar createStatusBar(Component parent, String name)
          Construct a JvStatusBar.
 void createTab(JTabbedPane parent, Component component)
          Construct a new tab for a JTabbedPane.
 void createTab(JTabbedPane parent, String name, Component component)
          Construct a new tab for a JTabbedPane.
 JTabbedPane createTabbedPane(Component parent, String name)
          Construct a JTabbedPane.
 JTable createTable(Component parent, String name, TableModel model)
          Construct a JTable.
 TableColumn createTableColumn(JTable parent, String name, int modelIndex)
          Construct a JTableColumn.
 JTextField createTextField(Component parent, String name)
          Construct a JTextField.
 JvField createTextField(Container parent, Class clazz, String property, int maxLength)
          Create a JvField named named to edit the property of instance of class clazz.
 JToggleButton createToggleButton(Component parent, String name)
          Construct a JToggleButton.
 JToolBar createToolBar(Component parent, String name)
          Construct a JToolBar.
 JButton createToolItem(Component parent, Action action)
          Construct a JButton used in a tool bar and add it to its parent.
 JTree createTree(Component parent, String name, TreeModel model)
          Construct a JTree.
 Action createUnimplementedAction(Component parent, String name)
          Construct a placeholder for an unimplemented action.
 void createVerticalSpace(Container parent, GridBagConstraints gbc)
          Create a GUI that takes some vertical space in the parent container.
 Action createViewAction(Component parent, String name, Component component)
          Construct a JvViewAction with the given name that controls the specified component.
 Action createViewDetailsAction(JvExplorer explorer, String name, JvExplorerDetails details)
          Construct a JvViewExplorerDetailsAction with the given name that controls the specified details pane.
 JDialog createWaitDialog(Component parent, String name)
          Construct a JDialog to be used to display a wait message.
 JDialog createWarningDialog(Component parent, String name)
          Construct a dialog displaying a warning message to the user.
 ClassLoader getClassLoader()
          Return the ClassLoader used by this factory.
static JvSwingFactory getDefault()
          Return the default instance of the UI factory.
static JvSwingFactory getFactory(Component component)
          Get the factory used to create the given component or the default factory if there isn't one.
 javax.help.HelpBroker getHelpBroker()
          Return the HelpBroker used to provide online help for the components created by this factory.
 URL getIconURL(String name)
          Finds an icon with the given name and returns its URL.
 JvPropertyLocator getPropertyLocator()
          Return the JvPropertyLocator used by this factory.
 String getString(Component component, String key)
          Convience method to retrieve a property using the factory's JvPropertyLocator.
static void setDefault(JvSwingFactory factory)
          Set the default factory instance.
 void setHelpBroker(javax.help.HelpBroker helpBroker)
          Set the HelpBroker used to provide online help for the components created by this factory.
 void showErrorDialog(Component parent, String name)
          Display a dialog containing a error message.
 void showErrorDialog(Component parent, String name, Object[] args)
          Display a dialog containing a error message.
 void showErrorDialog(Component parent, String name, String message)
          Display a dialog containing a error message.
 int showOkCancelDialog(Component parent, String name)
          Display a dialog displaying a message with a Ok/Cancel prompt to the user.
 int showOkCancelDialog(Component parent, String name, Object[] args)
          Display a dialog displaying a message with a OK/Cancel prompt to the user.
 int showOkDialog(Component parent, String name)
          Display a dialog displaying a message with an Ok prompt to the user.
 int showOkDialog(Component parent, String name, Object[] args)
          Display a dialog displaying a message with an OK prompt to the user.
 int showOptionDialog(Component parent, JOptionPane optionPane, String name)
          Construct and display a modal dialog containing a JOptionPane to the user.
 int showOptionDialog(JDialog dialog, JOptionPane optionPane)
          Display a modal dialog containing a JOptionPane to the user.
 void showWarningDialog(Component parent, String name)
          Display a dialog containing a warning message.
 int showYesNoCancelDialog(Component parent, String name)
          Display a dialog displaying a message with a Yes/No/Cancel prompt to the user.
 int showYesNoCancelDialog(Component parent, String name, Object[] args)
          Display a dialog displaying a message with a Yes/No/Cancel prompt to the user.
 int showYesNoDialog(Component parent, String name)
          Display a dialog displaying a message with a Yes/No prompt to the user.
 int showYesNoDialog(Component parent, String name, Object[] args)
          Display a dialog displaying a message with a Yes/No prompt to the user.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

JvSwingFactory

protected JvSwingFactory()
Construct a new JvSwingFactory.

Method Detail

setDefault

public static void setDefault(JvSwingFactory factory)
Set the default factory instance.

Parameters:
factory - the instance to be used by default

getDefault

public static JvSwingFactory getDefault()
Return the default instance of the UI factory.

Returns:
the default factory instance

getFactory

public static JvSwingFactory getFactory(Component component)
Get the factory used to create the given component or the default factory if there isn't one.

Parameters:
component - the component from which to obtain the factory
Returns:
the factory used to create the component or the default factory

getHelpBroker

public javax.help.HelpBroker getHelpBroker()
Return the HelpBroker used to provide online help for the components created by this factory.

Returns:
the factory's HelpBroker

setHelpBroker

public void setHelpBroker(javax.help.HelpBroker helpBroker)
Set the HelpBroker used to provide online help for the components created by this factory.

Parameters:
helpBroker - the factory's HelpBroker

getPropertyLocator

public final JvPropertyLocator getPropertyLocator()
Return the JvPropertyLocator used by this factory.

Returns:
the factory's JvPropertyLocator

getClassLoader

public final ClassLoader getClassLoader()
Return the ClassLoader used by this factory.

Returns:
the factory's ClassLoader

getString

public String getString(Component component,
                        String key)
Convience method to retrieve a property using the factory's JvPropertyLocator.

Parameters:
component - the component providing context
key - the key of the property to return
Returns:
the property if found; null otherwise
See Also:
JvPropertyLocator.getString(java.lang.String)

apply

public void apply(Component component,
                  Component parent)
Apply any properties found for the named object object. This method uses the object's BeanInfo to determine the object's properties. For each writable property, the property is searched for using the factories JvPropertyLocator and within the given parent and name context.

Parameters:
component - the component to modify
parent - the parent of the object

applyAction

public Action applyAction(Action action,
                          Component parent)
Apply any properties and/or factory customizations to an Action. This method sets the action's name and uses the factory's JvPropertyLocator to find the action's icon ("name.icon"), tooltip ("name.toolTipText"), accelerator ("name.accelerator"), and mnemonic ("name.mnemonic").

Parameters:
action - the action to customize
parent - the parent of the action
Returns:
the customized action

applyAction

public Action applyAction(Action action,
                          Component parent,
                          String name)
Apply any properties and/or factory customizations to an Action. This method sets the action's name and uses the factory's JvPropertyLocator to find the action's icon ("name.icon"), tooltip ("name.toolTipText"), accelerator ("name.accelerator"), and mnemonic ("name.mnemonic").

Parameters:
action - the action to customize
parent - the parent of the action
name - the name of the action
Returns:
the customized action

createAboutAction

public Action createAboutAction(Component parent,
                                String name,
                                URL aboutURL)
Construct a JvAboutAction with the given name that controls the specified details pane.

Parameters:
parent - the parent of the Action
name - the name of the Action
aboutURL - for the application being describe.

createApplication

public JvApplication createApplication(String name)
Construct an NApplication with the given name.

Parameters:
name - the name of the application

applyApplication

public JvApplication applyApplication(JvApplication application)
Apply any properties to an JvApplication.

Parameters:
application - the application to modify

createButton

public JButton createButton(Component parent,
                            String name)
Construct a JButton.

Parameters:
parent - the parent of the JButton
name - the name of the JButton
Returns:
the new JButton

createButton

public JButton createButton(Component parent,
                            Action action)
Construct a JButton based on an Action. The name of the button is extracted from the Action as well as the icon, tooltip, and mnemonic.

Parameters:
parent - the parent of the JButton
action - the action
Returns:
the new JButton

applyButton

public JButton applyButton(JButton button,
                           Component parent,
                           String name)
Apply any properties to an JButton.

Parameters:
button - the button to modify
parent - the parent of the JButton
name - the name of the JButton

createCheckBox

public JCheckBox createCheckBox(Component parent,
                                String name)
Construct a JCheckBox.

Parameters:
parent - the parent of the JCheckBox
name - the name of the JCheckBox
Returns:
the new JCheckBox

applyCheckBox

public JCheckBox applyCheckBox(JCheckBox checkBox,
                               Component parent,
                               String name)
Apply any properties to an JCheckBox.

Parameters:
checkBox - the checkBox to modify
parent - the parent of the JCheckBox
name - the name of the JCheckBox

createRadioButton

public JRadioButton createRadioButton(Component parent,
                                      String name)
Construct a JRadioButton.

Parameters:
parent - the parent of the JRadioButton
name - the name of the JRadioButton
Returns:
the new JRadioButton

applyRadioButton

public JRadioButton applyRadioButton(JRadioButton radioButton,
                                     Component parent,
                                     String name)
Apply any properties to a JRadioButton.

Parameters:
radioButton - the JRadioButton to modify
parent - the parent of the JRadioButton
name - the name of the JRadioButton

createComboBox

public JComboBox createComboBox(Component parent,
                                String name,
                                ComboBoxModel model)
Construct a JComboBox.

Parameters:
parent - the parent of the JComboBox
name - the name of the JComboBox
model - the ComboBoxModel that provides the displayed list of items
Returns:
the new JComboBox

createComboBox

public JComboBox createComboBox(Component parent,
                                String name,
                                Object[] items)
Construct a JComboBox.

Parameters:
parent - the parent of the JComboBox
name - the name of the JComboBox
items - an array of objects to insert into the combo box
Returns:
the new JComboBox

createComboBox

public JComboBox createComboBox(Component parent,
                                String name,
                                Vector items)
Construct a JComboBox.

Parameters:
parent - the parent of the JComboBox
name - the name of the JComboBox
items - a vector of objects to insert into the combo box
Returns:
the new JComboBox

applyComboBox

public JComboBox applyComboBox(JComboBox comboBox,
                               Component parent,
                               String name)
Apply any properties to an JComboBox.

Parameters:
comboBox - the comboBox to modify
parent - the parent of the JComboBox
name - the name of the JComboBox

applyDialog

public JDialog applyDialog(JDialog dialog,
                           Component parent,
                           String name)
Apply any properties to an JDialog.

Parameters:
dialog - the dialog to modify
parent - the parent of the JDialog
name - the name or message of the JDialog

createErrorDialog

public JDialog createErrorDialog(Component parent,
                                 String name)
Construct a dialog displaying a error message to the user.

Parameters:
parent - the parent of the JDialog
name - the name or message of the JDialog

createErrorDialog

public JDialog createErrorDialog(Component parent,
                                 String name,
                                 Object[] args)
Construct a dialog displaying a error message to the user.

Parameters:
parent - the parent of the JDialog
name - the name or message of the JDialog
args - if non-null, treat the message as a MessageFormat pattern and use these args to format the message

showErrorDialog

public void showErrorDialog(Component parent,
                            String name)
Display a dialog containing a error message.

Parameters:
parent - the parent of the JDialog
name - the name or message of the JDialog

showErrorDialog

public void showErrorDialog(Component parent,
                            String name,
                            Object[] args)
Display a dialog containing a error message.

Parameters:
parent - the parent of the JDialog
name - the name or message of the JDialog
args - if non-null, treat the message as a MessageFormat pattern and use these args to format the message

showErrorDialog

public void showErrorDialog(Component parent,
                            String name,
                            String message)
Display a dialog containing a error message.

Parameters:
parent - the parent of the JDialog
name - the name of the JDialog
message - the error message

createEditorPane

public JEditorPane createEditorPane(Component parent,
                                    String name,
                                    String contentType)
Construct a JEditorPane.

Parameters:
parent - the parent of the JEditorPane
name - the name of the JEditorPane
contentType - the content type of the editor pane
Returns:
the new JEditorPane
See Also:
JEditorPane

createEditorPane

public JEditorPane createEditorPane(Component parent,
                                    String name,
                                    String contentType,
                                    String text)
Construct a JEditorPane.

Parameters:
parent - the parent of the JEditorPane
name - the name of the JEditorPane
contentType - the content type of the editor pane
text - the text to initialize with
Returns:
the new JEditorPane
See Also:
JEditorPane

applyEditorPane

public JEditorPane applyEditorPane(JEditorPane editorPane,
                                   Component parent,
                                   String name)
Apply any properties to an JEditorPane.

Parameters:
editorPane - the editorPane to modify
parent - the parent of the JEditorPane
name - the name of the JEditorPane

createField

public JvField createField(Container parent,
                           Class clazz,
                           String property)
Create a JvField named property to edit the property of instance of class clazz. Introspection is used to determine the type (class) of the property and find the appropriate PropertyEditor. The actual UI component used to edit the property depends on the property's type. If the property is of type JvEnumerator, an JvEnumeratorField is created to display the enumerated values within a JComboBox. If the property is of type JvHTMLText, a JvPropertyEditorField is created to display the text in a JEditorPane wrapped by a JScrollPane. If the property is of some other type, a JvPropertyEditorField is created to display the text in a JTextField.

Parameters:
parent - the UI parent of the created field
clazz - the class whose property will be edited
property - the name of the property to be edited
Returns:
an instance of JvField

createField

public JvField createField(Container parent,
                           String name,
                           Class clazz,
                           String property)
Create a JvField named name to edit the property of instance of class clazz. Introspection is used to determine the type (class) of the property and find the appropriate PropertyEditor. The actual UI component used to edit the property depends on the property's type. If the property is of type JvEnumerator, an JvEnumeratorField is created to display the enumerated values within a JComboBox. If the property is of type JvHTMLText, a JvPropertyEditorField is created to display the text in a JEditorPane wrapped by a JScrollPane. If the property is of some other type, a JvPropertyEditorField is created to display the text in a JTextField.

Parameters:
parent - the UI parent of the created field
name - the name of field
clazz - the class whose property will be edited
property - the name of the property to be edited
Returns:
an instance of JvField

createField

public JvField createField(Container parent,
                           String name,
                           Class propertyType)
Create a JvField named name to edit a property of type propertyType. The actual UI component used to edit the property depends on the property's type. If the property is of type JvEnumerator, an JvEnumeratorField is created to display the enumerated values within a JComboBox. If the property is of type JvHTMLText, a JvPropertyEditorField is created to display the text in a JEditorPane wrapped by a JScrollPane. If the property is of some other type, a JvPropertyEditorField is created to display the text in a JTextField.

Parameters:
parent - the UI parent of the created field
name - the name of field
propertyType - the type of the property to edit
Returns:
an instance of JvField

createField

public JvField createField(Container parent,
                           String name,
                           String propertyName,
                           Class propertyType)
Create a JvField named name to edit a property of type propertyType. The actual UI component used to edit the property depends on the property's type. If the property is of type JvEnumerator, an JvEnumeratorField is created to display the enumerated values within a JComboBox. If the property is of type JvHTMLText, a JvPropertyEditorField is created to display the text in a JEditorPane wrapped by a JScrollPane. If the property is of some other type, a JvPropertyEditorField is created to display the text in a JTextField.

Parameters:
parent - the UI parent of the created field
name - the name of field
propertyName - the name of the property to be edited; may be null
propertyType - the type of the property to edit
Returns:
an instance of JvField

createTextField

public JvField createTextField(Container parent,
                               Class clazz,
                               String property,
                               int maxLength)
Create a JvField named named to edit the property of instance of class clazz. Introspection is used to determine the type (class) of the property and find the appropriate PropertyEditor. The actual UI component used to edit the property depends on the property's type. If the property is of type JvHTMLText, a JvPropertyEditorField is created to display the text in a JEditorPane wrapped by a JScrollPane. If the property is of some other type, a JvPropertyEditorField is created to display the text in a JTextField. The maximum allowed length of the value is maxLength.

Parameters:
parent - the UI parent of the created field
clazz - the class whose property will be edited
property - the name of the property to be edited
maxLength - the maximum length allowed for the value
Returns:
an instance of JvField

createField

public JvField createField(Container parent,
                           Class clazz,
                           String property,
                           Object[] values)
Construct a JvField to edit the property of instance class clazz. The property may only take one of the values specified in values. A non-editable JComboBox is used to display the current value and the choices.

Parameters:
parent - the UI parent of the created field
clazz - the class whose property will be edited
property - the name of the property to be edited
values - the values the property may take
Returns:
an instance of JvField

createdField

protected JvField createdField(JvField field,
                               JComponent fieldComp,
                               JLabel label,
                               String propertyName)
Perform any final initialization of the newly created JvField.

Parameters:
field - the newly created field
fieldComp - the main field component
label - the label for the field
propertyName - the name of the property edited within the field; may be null
Returns:
the initialized field

createFileChooser

public JFileChooser createFileChooser(Component parent,
                                      String name)
Construct a JFileChooser.

Parameters:
parent - the parent of the JFileChooser
name - the name of the JFileChooser
Returns:
the new JFileChooser

applyFileChooser

public JFileChooser applyFileChooser(JFileChooser fileChooser,
                                     Component parent,
                                     String name)
Apply any properties to an JFileChooser.

Parameters:
fileChooser - the fileChooser to modify
parent - the parent of the JFileChooser
name - the name of the JFileChooser

createHorizontalSpace

public void createHorizontalSpace(Container parent,
                                  GridBagConstraints gbc)
Create a GUI that takes some horizontal space in the parent container.

Parameters:
parent - the container needing the horizontal space
gbc - GridBagConstraints specifying the location of the space

getIconURL

public URL getIconURL(String name)
Finds an icon with the given name and returns its URL. The rules for searching resources associated with a given class are implemented by the class loader.

Parameters:
name - the name of the icon
Returns:
the icon's URL or null if not found

createIcon

public ImageIcon createIcon(String name)
Finds an icon with the given name. The rules for searching resources associated with a given class are implemented by the class loader.

Parameters:
name - the name of the icon
Returns:
the icon or null if not found

createLabel

public JLabel createLabel(Component parent,
                          String name)
Construct a JLabel.

Parameters:
parent - the parent of the JLabel
name - the name of the JLabel
Returns:
the new JLabel

applyLabel

public JLabel applyLabel(JLabel label,
                         Component parent,
                         String name)
Apply any properties to an JLabel.

Parameters:
label - the label to modify
parent - the parent of the JLabel
name - the name of the JLabel

createLineSeparator

public JComponent createLineSeparator(JToolBar parent)
Create a Microsoft Windows-style vertical-line separator for a toolbar.

Parameters:
parent - the parent of the separator
Returns:
a component implementing the separator

createList

public JList createList(Component parent,
                        String name,
                        ListModel model)
Construct a JList.

Parameters:
parent - the parent of the JList
name - the name of the JList
model - the ListModel to use
Returns:
the new JList

applyList

public JList applyList(JList list,
                       Component parent,
                       String name)
Apply any properties to an JList.

Parameters:
list - the list to modify
parent - the parent of the JList
name - the name of the JList

createMenu

public JMenu createMenu(Component parent,
                        String name)
Construct a JMenu and add it to its parent.

Parameters:
parent - the parent of the JMenu
name - the name of the JMenu

applyMenu

public JMenu applyMenu(JMenu menu,
                       Component parent,
                       String name)
Apply any properties to an JMenu.

Parameters:
menu - the menu to modify
parent - the parent of the JMenu
name - the name of the JMenu

createMenuBar

public JMenuBar createMenuBar(Component parent,
                              String name)
Construct a JMenuBar.

Parameters:
parent - the parent of the JMenuBar
name - the name of the JMenuBar

applyMenuBar

public JMenuBar applyMenuBar(JMenuBar menuBar,
                             Component parent,
                             String name)
Apply any properties to an JMenuBar.

Parameters:
menuBar - the menu bar to modify
parent - the parent of the JMenuBar
name - the name of the JMenuBar

createMenuItem

public JMenuItem createMenuItem(Component parent,
                                String name)
Construct a JMenuItem and add it to it's parent.

Parameters:
parent - the parent of the JMenuItem
name - the name of the JMenuItem

createHelpMenuItem

public JMenuItem createHelpMenuItem(Component parent,
                                    String name)
Construct a JMenuItem that invokes help and add it to its parent.

Parameters:
parent - the parent of the JMenuItem
name - the name of the JMenuItem

createMenuItem

public JMenuItem createMenuItem(Component parent,
                                Action action)
Construct a JMenuItem and add it to its parent. Use the name of action as the name of the menu item.

Parameters:
parent - the parent of the JMenuItem
action - the action performed by the menu item

createMenuItem

public JMenuItem createMenuItem(Component parent,
                                String name,
                                Action action)
Construct a JMenuItem and add it to it's parent.

Parameters:
parent - the parent of the JMenuItem
name - the name of the JMenuItem
action - the action performed by the menu item

applyMenuItem

public JMenuItem applyMenuItem(JMenuItem menuItem,
                               Component parent,
                               String name)
Apply any properties to a JMenuItem.

Parameters:
menuItem - the menu item to modify
parent - the parent of the JMenuItem
name - the name of the JMenuItem

createOptionPane

public JOptionPane createOptionPane(Component parent,
                                    String name,
                                    int messageType)
Construct a JOptionPane.

Parameters:
parent - the parent of the JOptionPane
name - the name of the JOptionPane
messageType - the type of message that is to be displayed: ERROR_MESSAGE, INFORMATION_MESSAGE, WARNING_MESSAGE, QUESTION_MESSAGE, or PLAIN_MESSAGE
Returns:
the new JOptionPane

createOptionPane

public JOptionPane createOptionPane(Component parent,
                                    String name,
                                    int messageType,
                                    int optionType)
Construct a JOptionPane.

Parameters:
parent - the parent of the JOptionPane
name - the name of the JOptionPane
messageType - the type of message that is to be displayed: ERROR_MESSAGE, INFORMATION_MESSAGE, WARNING_MESSAGE, QUESTION_MESSAGE, or PLAIN_MESSAGE
optionType - an int designating the options available on the dialog: YES_NO_OPTION, or YES_NO_CANCEL_OPTION
Returns:
the new JOptionPane

createOptionPane

public JOptionPane createOptionPane(Component parent,
                                    String name,
                                    int messageType,
                                    int optionType,
                                    Object[] args)
Construct a JOptionPane.

Parameters:
parent - the parent of the JOptionPane
name - the name of the JOptionPane
messageType - the type of message that is to be displayed: ERROR_MESSAGE, INFORMATION_MESSAGE, WARNING_MESSAGE, QUESTION_MESSAGE, or PLAIN_MESSAGE
optionType - an int designating the options available on the dialog: YES_NO_OPTION, or YES_NO_CANCEL_OPTION
args - if non-null, treat the message as a MessageFormat pattern and use these args to format the message
Returns:
the new JOptionPane

createOptionPane

public JOptionPane createOptionPane(Component parent,
                                    String name,
                                    int messageType,
                                    int optionType,
                                    Object message)
Construct a JOptionPane.

Parameters:
parent - the parent of the JOptionPane
name - the name of the JOptionPane
messageType - the type of message that is to be displayed: ERROR_MESSAGE, INFORMATION_MESSAGE, WARNING_MESSAGE, QUESTION_MESSAGE, or PLAIN_MESSAGE
optionType - an int designating the options available on the dialog: YES_NO_OPTION, or YES_NO_CANCEL_OPTION
message - the message of the JOptionPane
Returns:
the new JOptionPane

applyOptionPane

public JOptionPane applyOptionPane(JOptionPane optionPane,
                                   Component parent,
                                   String name)
Apply any properties to an JOptionPane.

Parameters:
optionPane - the optionPane to modify
parent - the parent of the JOptionPane
name - the name or message of the JOptionPane

createOptionDialog

public JDialog createOptionDialog(Component parent,
                                  JOptionPane optionPane,
                                  String name)
Construct a dialog displaying a JOptionPane to the user.

Parameters:
parent - the parent of the JDialog
optionPane - the JOptionPane
name - the name or message of the JDialog
Returns:
the JDialog

showOptionDialog

public int showOptionDialog(Component parent,
                            JOptionPane optionPane,
                            String name)
Construct and display a modal dialog containing a JOptionPane to the user. This method does not return until the user closes the dialog or presses one of the dialog buttons.

Parameters:
parent - the parent of the JDialog
optionPane - the JOptionPane
name - the name or message of the JDialog
Returns:
an integer indicating the option chosen by the user, or CLOSED_OPTION if the user closed the Dialog
See Also:
JOptionPane.showOptionDialog(java.awt.Component, java.lang.Object, java.lang.String, int, int, javax.swing.Icon, java.lang.Object[], java.lang.Object)

showOptionDialog

public int showOptionDialog(JDialog dialog,
                            JOptionPane optionPane)
Display a modal dialog containing a JOptionPane to the user. This method does not return until the user closes the dialog or presses one of the dialog buttons.

Parameters:
dialog - the modal dialog to display
optionPane - the JOptionPane contained within dialog
Returns:
an integer indicating the option chosen by the user, or CLOSED_OPTION if the user closed the Dialog
See Also:
JOptionPane.showOptionDialog(java.awt.Component, java.lang.Object, java.lang.String, int, int, javax.swing.Icon, java.lang.Object[], java.lang.Object)

createPanel

public JPanel createPanel(Component parent,
                          String name)
Construct a JPanel.

Parameters:
parent - the parent of the JPanel
name - the name of the JPanel
Returns:
the new JPanel

createPanel

public JPanel createPanel(Component parent,
                          String name,
                          LayoutManager layout)
Construct a JPanel with the specified layout manager.

Parameters:
parent - the parent of the JPanel
name - the name of the JPanel
layout - the layout manager
Returns:
the new JPanel

applyPanel

public JPanel applyPanel(JPanel panel,
                         Component parent,
                         String name)
Apply any properties to an JPanel.

Parameters:
panel - the panel to modify
parent - the parent of the JPanel
name - the name of the JPanel

createPasswordField

public JPasswordField createPasswordField(Component parent,
                                          String name)
Construct a JPasswordField.

Parameters:
parent - the parent of the JPasswordField
name - the name of the JPasswordField
Returns:
the new JPasswordField

applyPasswordField

public JPasswordField applyPasswordField(JPasswordField passwordField,
                                         Component parent,
                                         String name)
Apply any properties to an JPasswordField.

Parameters:
passwordField - the passwordField to modify
parent - the parent of the JPasswordField
name - the name of the JPasswordField

createPopupMenu

public JPopupMenu createPopupMenu(Component parent,
                                  String name)
Construct a JPopupMenu and add it to its parent.

Parameters:
parent - the parent of the JPopupMenu
name - the name of the JPopupMenu

applyPopupMenu

public JPopupMenu applyPopupMenu(JPopupMenu popupMenu,
                                 Component parent,
                                 String name)
Apply any properties to an JPopupMenu.

Parameters:
popupMenu - the popupMenu to modify
parent - the parent of the JPopupMenu
name - the name of the JPopupMenu

showOkDialog

public int showOkDialog(Component parent,
                        String name)
Display a dialog displaying a message with an Ok prompt to the user.

Parameters:
parent - the parent of the JDialog
name - the name or message of the JDialog
Returns:
an integer indicating the option chosen by the user, or CLOSED_OPTION if the user closed the Dialog
See Also:
JOptionPane.showOptionDialog(java.awt.Component, java.lang.Object, java.lang.String, int, int, javax.swing.Icon, java.lang.Object[], java.lang.Object)

showOkDialog

public int showOkDialog(Component parent,
                        String name,
                        Object[] args)
Display a dialog displaying a message with an OK prompt to the user.

Parameters:
parent - the parent of the JDialog
name - the name or message of the JDialog
args - if non-null, treat the message as a MessageFormat pattern and use these args to format the message
Returns:
an integer indicating the option chosen by the user, or CLOSED_OPTION if the user closed the Dialog
See Also:
JOptionPane.showOptionDialog(java.awt.Component, java.lang.Object, java.lang.String, int, int, javax.swing.Icon, java.lang.Object[], java.lang.Object)

showOkCancelDialog

public int showOkCancelDialog(Component parent,
                              String name)
Display a dialog displaying a message with a Ok/Cancel prompt to the user.

Parameters:
parent - the parent of the JDialog
name - the name or message of the JDialog
Returns:
an integer indicating the option chosen by the user, or CLOSED_OPTION if the user closed the Dialog
See Also:
JOptionPane.showOptionDialog(java.awt.Component, java.lang.Object, java.lang.String, int, int, javax.swing.Icon, java.lang.Object[], java.lang.Object)

showOkCancelDialog

public int showOkCancelDialog(Component parent,
                              String name,
                              Object[] args)
Display a dialog displaying a message with a OK/Cancel prompt to the user.

Parameters:
parent - the parent of the JDialog
name - the name or message of the JDialog
args - if non-null, treat the message as a MessageFormat pattern and use these args to format the message
Returns:
an integer indicating the option chosen by the user, or CLOSED_OPTION if the user closed the Dialog
See Also:
JOptionPane.showOptionDialog(java.awt.Component, java.lang.Object, java.lang.String, int, int, javax.swing.Icon, java.lang.Object[], java.lang.Object)

createRadioMenuItem

public JRadioButtonMenuItem createRadioMenuItem(Component parent,
                                                Action action)
Construct a JRadioButtonMenuItem and add it to it's parent.

Parameters:
parent - the parent of the JMenuRadioButtonItem
action - the Action to be associated with the menu item
Returns:
the new JRadioButtonMenuItem

createReadOnlyTextField

public JTextField createReadOnlyTextField(Component parent,
                                          String name)
Construct a JTextField that is intended for only display purposes. The user will be able to select and copy text from the field and can scroll within the field, but will not be allowed to modify it.

Parameters:
parent - the parent of the JTextField
name - the name of the JTextField
Returns:
the new JTextField

createScrollPane

public JScrollPane createScrollPane(Component parent,
                                    String name,
                                    Component view)
Construct a JScrollPane.

Parameters:
parent - the parent of the JScrollPane
name - the name of the JScrollPane
view - the component to display in the scrollpanes viewport
Returns:
the new JScrollPane

applyScrollPane

public JScrollPane applyScrollPane(JScrollPane scrollPane,
                                   Component parent,
                                   String name)
Apply any properties to an JScrollPane.

Parameters:
scrollPane - the scrollPane to modify
parent - the parent of the JScrollPane
name - the name of the JScrollPane

createSpaceSeparator

public JComponent createSpaceSeparator(JToolBar parent)
Create a space separator for a toolbar.

Parameters:
parent - the parent of the separator
Returns:
a component implementing the separator

createSplitPane

public JSplitPane createSplitPane(Component parent,
                                  String name)
Construct a JSplitPane.

Parameters:
parent - the parent of the JSplitPane
name - the name of the JSplitPane
Returns:
the new JSplitPane

applySplitPane

public JSplitPane applySplitPane(JSplitPane splitPane,
                                 Component parent,
                                 String name)
Apply any properties to an JSplitPane.

Parameters:
splitPane - the splitPane to modify
parent - the parent of the JSplitPane
name - the name of the JSplitPane

createStatusBar

public JvStatusBar createStatusBar(Component parent,
                                   String name)
Construct a JvStatusBar.

Parameters:
parent - the parent of the JvStatusBar
name - the name of the JvStatusBar

applyStatusBar

public JvStatusBar applyStatusBar(JvStatusBar statusBar,
                                  Component parent,
                                  String name)
Apply any properties to an JvStatusBar.

Parameters:
statusBar - the status bar to modify
parent - the parent of the JvStatusBar
name - the name of the JvStatusBar

createTab

public void createTab(JTabbedPane parent,
                      Component component)
Construct a new tab for a JTabbedPane. The name of the component is used for the name of the tab. This method uses the factory's JvPropertyLocator to find the tab's text ("name.tab").

Parameters:
parent - the parent JTabbedPane of the new tab
component - the component to display in the new tab

createTab

public void createTab(JTabbedPane parent,
                      String name,
                      Component component)
Construct a new tab for a JTabbedPane. This method uses the factory's JvPropertyLocator to find the tab's text ("name.tab").

Parameters:
parent - the parent JTabbedPane of the new tab
name - the name of the new tab
component - the component to display in the new tab

createTabbedPane

public JTabbedPane createTabbedPane(Component parent,
                                    String name)
Construct a JTabbedPane.

Parameters:
parent - the parent of the JTabbedPane
name - the name of the JTabbedPane
Returns:
the new JTabbedPane

applyTabbedPane

public JTabbedPane applyTabbedPane(JTabbedPane tabbedPane,
                                   Component parent,
                                   String name)
Apply any properties to an JTabbedPane.

Parameters:
tabbedPane - the tabbedPane to modify
parent - the parent of the JTabbedPane
name - the name of the JTabbedPane

createTable

public JTable createTable(Component parent,
                          String name,
                          TableModel model)
Construct a JTable.

Parameters:
parent - the parent of the JTable
name - the name of the JTable
model - the TableModel to use
Returns:
the new JTable

applyTable

public JTable applyTable(JTable table,
                         Component parent,
                         String name)
Apply any properties to an JTable.

Parameters:
table - the table to modify
parent - the parent of the JTable
name - the name of the JTable

createTableColumn

public TableColumn createTableColumn(JTable parent,
                                     String name,
                                     int modelIndex)
Construct a JTableColumn.

Parameters:
parent - the parent of the JTableColumn
name - the name of the JTableColumn
Returns:
the new JTableColumn

applyTableColumn

public TableColumn applyTableColumn(TableColumn tableColumn,
                                    JTable parent,
                                    String name)
Apply any properties to an JTableColumn.

Parameters:
tableColumn - the tableColumn to modify
parent - the parent of the JTableColumn
name - the name of the JTableColumn

createTextField

public JTextField createTextField(Component parent,
                                  String name)
Construct a JTextField.

Parameters:
parent - the parent of the JTextField
name - the name of the JTextField
Returns:
the new JTextField

applyTextField

public JTextField applyTextField(JTextField textField,
                                 Component parent,
                                 String name)
Apply any properties to an JTextField.

Parameters:
textField - the textField to modify
parent - the parent of the JTextField
name - the name of the JTextField

createToggleButton

public JToggleButton createToggleButton(Component parent,
                                        String name)
Construct a JToggleButton.

Parameters:
parent - the parent of the JToggleButton
name - the name of the JToggleButton
Returns:
the new JToggleButton

applyToggleButton

public JToggleButton applyToggleButton(JToggleButton toggleButton,
                                       Component parent,
                                       String name)
Apply any properties to an JToggleButton.

Parameters:
toggleButton - the toggleButton to modify
parent - the parent of the JToggleButton
name - the name of the JToggleButton

createToolBar

public JToolBar createToolBar(Component parent,
                              String name)
Construct a JToolBar.

Parameters:
parent - the parent of the JToolBar
name - the name of the JToolBar

applyToolBar

public JToolBar applyToolBar(JToolBar toolBar,
                             Component parent,
                             String name)
Apply any properties to an JToolBar.

Parameters:
toolBar - the tool bar to modify
parent - the parent of the JToolBar
name - the name of the JToolBar

createToolItem

public JButton createToolItem(Component parent,
                              Action action)
Construct a JButton used in a tool bar and add it to its parent. The name of the button is extracted from action.

Parameters:
parent - the parent of the JButton
action - the Action to be associated with the button
Returns:
the new JButton toolbar item
See Also:
createButton(Component, Action)

applyToolItem

public JButton applyToolItem(JButton toolItem,
                             Component parent,
                             String name)
Apply any properties to a JButton.

Parameters:
toolItem - the tool item to modify
parent - the parent of the JButton
name - the name of the JButton

createTree

public JTree createTree(Component parent,
                        String name,
                        TreeModel model)
Construct a JTree.

Parameters:
parent - the parent of the JTree
name - the name of the JTree
model - the TreeModel to use
Returns:
the new JTree

applyTree

public JTree applyTree(JTree tree,
                       Component parent,
                       String name)
Apply any properties to an JTree.

Parameters:
tree - the tree to modify
parent - the parent of the JTree
name - the name of the JTree

createUnimplementedAction

public Action createUnimplementedAction(Component parent,
                                        String name)
Construct a placeholder for an unimplemented action. Invoking the action warns the user that it is unimplemented.

Parameters:
parent - the parent of the Action
name - the name of the Action

createVerticalSpace

public void createVerticalSpace(Container parent,
                                GridBagConstraints gbc)
Create a GUI that takes some vertical space in the parent container.

Parameters:
parent - the container needing the vertical space
gbc - GridBagConstraints specifying the location of the space

applyView

public JvView applyView(JvView view,
                        Component parent,
                        String name)
Apply any properties to an NView.

Parameters:
view - the view to modify

createViewAction

public Action createViewAction(Component parent,
                               String name,
                               Component component)
Construct a JvViewAction with the given name that controls the specified component.

Parameters:
parent - the parent of the Action
name - the name of the Action
component - the controlled component
Returns:
the new JvViewAction

createViewDetailsAction

public Action createViewDetailsAction(JvExplorer explorer,
                                      String name,
                                      JvExplorerDetails details)
Construct a JvViewExplorerDetailsAction with the given name that controls the specified details pane.

Parameters:
explorer - the explorer displaying the details panel
name - the name of the Action
details - the controlled details panel
Returns:
the new JvViewExplorerDetailsAction

createWaitDialog

public JDialog createWaitDialog(Component parent,
                                String name)
Construct a JDialog to be used to display a wait message.

The name is used to pick up the dialog title, message text and the image name from the properties file.

Parameters:
parent - the parent of the JDialog
name - the name of the JDialog
Returns:
the new JDialog

applyWaitDialog

public JDialog applyWaitDialog(JDialog dlg,
                               Component parent,
                               String name,
                               String text,
                               String imageName)
Apply any properties on a JDialog to be used to display a wait message.

Parameters:
dlg - a reference to the JDialog object
parent - the parent of the JPanel
name - the name of the JPanel
text - the text to be displayed inside the wait dialog
imageName - the name of the gif file to be used in the dialog
Returns:
the new JDialog

createWarningDialog

public JDialog createWarningDialog(Component parent,
                                   String name)
Construct a dialog displaying a warning message to the user.

Parameters:
parent - the parent of the JDialog
name - the name or message of the JDialog

showWarningDialog

public void showWarningDialog(Component parent,
                              String name)
Display a dialog containing a warning message.

Parameters:
parent - the parent of the JDialog
name - the name or message of the JDialog

showYesNoDialog

public int showYesNoDialog(Component parent,
                           String name)
Display a dialog displaying a message with a Yes/No prompt to the user.

Parameters:
parent - the parent of the JDialog
name - the name or message of the JDialog
Returns:
an integer indicating the option chosen by the user, or CLOSED_OPTION if the user closed the Dialog
See Also:
JOptionPane.showOptionDialog(java.awt.Component, java.lang.Object, java.lang.String, int, int, javax.swing.Icon, java.lang.Object[], java.lang.Object)

showYesNoDialog

public int showYesNoDialog(Component parent,
                           String name,
                           Object[] args)
Display a dialog displaying a message with a Yes/No prompt to the user.

Parameters:
parent - the parent of the JDialog
name - the name or message of the JDialog
args - if non-null, treat the message as a MessageFormat pattern and use these args to format the message
Returns:
an integer indicating the option chosen by the user, or CLOSED_OPTION if the user closed the Dialog
See Also:
JOptionPane.showOptionDialog(java.awt.Component, java.lang.Object, java.lang.String, int, int, javax.swing.Icon, java.lang.Object[], java.lang.Object)

showYesNoCancelDialog

public int showYesNoCancelDialog(Component parent,
                                 String name)
Display a dialog displaying a message with a Yes/No/Cancel prompt to the user.

Parameters:
parent - the parent of the JDialog
name - the name or message of the JDialog
Returns:
an integer indicating the option chosen by the user, or CLOSED_OPTION if the user closed the Dialog
See Also:
JOptionPane.showOptionDialog(java.awt.Component, java.lang.Object, java.lang.String, int, int, javax.swing.Icon, java.lang.Object[], java.lang.Object)

showYesNoCancelDialog

public int showYesNoCancelDialog(Component parent,
                                 String name,
                                 Object[] args)
Display a dialog displaying a message with a Yes/No/Cancel prompt to the user.

Parameters:
parent - the parent of the JDialog
name - the name or message of the JDialog
args - if non-null, treat the message as a MessageFormat pattern and use these args to format the message
Returns:
an integer indicating the option chosen by the user, or CLOSED_OPTION if the user closed the Dialog
See Also:
JOptionPane.showOptionDialog(java.awt.Component, java.lang.Object, java.lang.String, int, int, javax.swing.Icon, java.lang.Object[], java.lang.Object)


Copyright © 1999-2004 Neil W. Weber. All Rights Reserved.