rjw.dc.console.components
Class ComponentFactory

java.lang.Object
  |
  +--rjw.dc.console.components.ComponentFactory

public class ComponentFactory
extends java.lang.Object

This class is the Component holder for the UI. The look and feel, as well as all the other preference are set here

Since:
1.3
Version:
DC0.50
Author:
Robert-Jan van der Waals

Nested Class Summary
static class ComponentFactory.RefreshSoftwareCategoriesAction
           
 
Field Summary
static int _CHECKBOX
           
static int _LONGTEXTFIELD
           
static int _MP3GENRECOMBO
           
static int _NUMBERFIELD
           
static int _SHORTTEXTFIELD
           
static int _SOFTWARETYPECOMBO
           
static int _URLFIELD
           
static int _YEARCOMBO
           
static int _YESNOCOMBO
           
 
Constructor Summary
ComponentFactory()
           
 
Method Summary
static javax.swing.JComboBox fillSoftwareCatagories(javax.swing.JComboBox typeComboBox)
          Adds the software catagories to the Software type combobox.
static java.awt.Color getApplicationColor()
          Returns the color for the application background
static javax.swing.border.TitledBorder getBorder(java.lang.String title)
          Returns a standard border with a title
static javax.swing.JButton getButton(javax.swing.ImageIcon icon)
          Returns a standard button
static javax.swing.JButton getButton(java.lang.String buttonText)
          Returns a standard button
static javax.swing.JButton getButton(java.lang.String buttonText, int length)
          Returns a standard button
static javax.swing.JCheckBox getCheckBox(java.lang.String labelText)
          Returns a standard checkbox
static javax.swing.JColorChooser getColorChooser()
           
static javax.swing.JComboBox getComboBox()
          Returns an empty combobox
static javax.swing.JComboBox getComboBox(int length)
          Returns an empty combobox
static javax.swing.JComponent getComponent(int componentIndex, java.lang.String sLabel, int maxTextLength)
           
static java.lang.Object getComponentValue(int fieldType, javax.swing.JComponent comp)
           
static java.awt.Color getDisabledColor()
          Returns the color for displaying disabled fields
static javax.swing.JEditorPane getEditorPane()
          Returns a standard editor pane
static javax.swing.JComboBox getFieldsComboBox(DataCrowObject o)
          Returns a combobox with the Software database field names
static javax.swing.Icon getIcon(java.lang.String iconLocation)
          Returns a standard icon
static javax.swing.JLabel getLabel(java.lang.String labelText)
          Returns a standard label with a text
static javax.swing.JLabel getLabel(java.lang.String labelText, int length)
          Returns a standard label with a text
static java.awt.GridBagLayout getLayoutManager()
           
static javax.swing.JList getList(java.util.Vector vData)
           
static LongTextField getLongTextField(int maxTextLength)
          Returns a text area with all the defaults set
static javax.swing.JMenuBar getMenuBar()
          Returns a standard menubar
static javax.swing.JButton getMenuButton(java.lang.String imageFile, java.lang.String buttonText)
           
static javax.swing.JComboBox getMP3GenreComboBox()
          Returns a combobox with MP3 genres
static NumberField getNumberField()
           
static javax.swing.JComboBox getRealYesNoComboBox()
          Returns a combobox with the items "yes" and "no", not starting with and empty String
static java.awt.Color getRequiredColor()
          Returns the color for displaying required fields
static javax.swing.table.DefaultTableCellRenderer getRequiredTableHeaderRenderer()
           
static ShortTextField getShortTextField(int maxTextLength)
           
static javax.swing.JTable getSimpleTable(javax.swing.table.DefaultTableModel tableModel, boolean autoScrolls)
           
static javax.swing.JComboBox getSoftwareCatagoriesComboBox()
          Returns a combobox with Sofware types (Catagories
static java.awt.Font getStandardFont()
          Returns the default font
static javax.swing.JTabbedPane getTabbedPane()
          Returns a standard tabbed pane
static java.awt.Color getTableColor()
          Returns the color for the background of tables
static javax.swing.JTable getTableForObject(DataCrowObject o, javax.swing.table.DefaultTableModel tableModel)
           
static java.awt.Color getTableHeaderColor()
          Returns the color for the table header
static javax.swing.table.DefaultTableCellRenderer getTableHeaderRenderer()
           
static javax.swing.JTextArea getTextArea()
          Returns a long text field with all the defaults set
static javax.swing.JTextField getTextField()
          Returns a textfield
static javax.swing.JTextField getTextField(int length)
          Returns a textfield
static javax.swing.JTree getTree(javax.swing.tree.DefaultMutableTreeNode model)
           
static URLField getURLField(int maxLength)
           
static javax.swing.JComboBox getYearComboBox()
           
static javax.swing.JComboBox getYesNoCombo()
          Returns a combobox with the items " ", "yes" and "no"
static void setComponentValue(int fieldType, javax.swing.JComponent comp, java.lang.Object value)
           
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

_SOFTWARETYPECOMBO

public static final int _SOFTWARETYPECOMBO
See Also:
Constant Field Values

_YESNOCOMBO

public static final int _YESNOCOMBO
See Also:
Constant Field Values

_MP3GENRECOMBO

public static final int _MP3GENRECOMBO
See Also:
Constant Field Values

_LONGTEXTFIELD

public static final int _LONGTEXTFIELD
See Also:
Constant Field Values

_YEARCOMBO

public static final int _YEARCOMBO
See Also:
Constant Field Values

_CHECKBOX

public static final int _CHECKBOX
See Also:
Constant Field Values

_NUMBERFIELD

public static final int _NUMBERFIELD
See Also:
Constant Field Values

_SHORTTEXTFIELD

public static final int _SHORTTEXTFIELD
See Also:
Constant Field Values

_URLFIELD

public static final int _URLFIELD
See Also:
Constant Field Values
Constructor Detail

ComponentFactory

public ComponentFactory()
Method Detail

getComponent

public static javax.swing.JComponent getComponent(int componentIndex,
                                                  java.lang.String sLabel,
                                                  int maxTextLength)

getList

public static javax.swing.JList getList(java.util.Vector vData)

getURLField

public static URLField getURLField(int maxLength)

getColorChooser

public static javax.swing.JColorChooser getColorChooser()

getTree

public static javax.swing.JTree getTree(javax.swing.tree.DefaultMutableTreeNode model)

getLayoutManager

public static java.awt.GridBagLayout getLayoutManager()

getNumberField

public static NumberField getNumberField()

getFieldsComboBox

public static javax.swing.JComboBox getFieldsComboBox(DataCrowObject o)
Returns a combobox with the Software database field names

Returns:
(JComboBox) combobox filled with the database field names. The first item in the list is an empty String

getYearComboBox

public static javax.swing.JComboBox getYearComboBox()

getMP3GenreComboBox

public static javax.swing.JComboBox getMP3GenreComboBox()
Returns a combobox with MP3 genres

Returns:
(JComboBox) combobox filled with MP3 genres. The first item is an empty String

getSoftwareCatagoriesComboBox

public static javax.swing.JComboBox getSoftwareCatagoriesComboBox()
Returns a combobox with Sofware types (Catagories

Returns:
(JComboBox) combobox filled with Software types. The first item is an empty String.

fillSoftwareCatagories

public static javax.swing.JComboBox fillSoftwareCatagories(javax.swing.JComboBox typeComboBox)
Adds the software catagories to the Software type combobox. The Software types are loaded from the CatagoryCollection class.


getComboBox

public static javax.swing.JComboBox getComboBox(int length)
Returns an empty combobox

Parameters:
length - length of this field
Returns:
(JComboBox) an empty combobox

getComboBox

public static javax.swing.JComboBox getComboBox()
Returns an empty combobox

Returns:
(JComboBox) an empty combobox

getRealYesNoComboBox

public static javax.swing.JComboBox getRealYesNoComboBox()
Returns a combobox with the items "yes" and "no", not starting with and empty String

Returns:
(JComboBox) combobox with the items "yes" and "no"

getCheckBox

public static javax.swing.JCheckBox getCheckBox(java.lang.String labelText)
Returns a standard checkbox

Returns:
(JCheckBox) simple checbox, no prefenrences are set

getMenuButton

public static javax.swing.JButton getMenuButton(java.lang.String imageFile,
                                                java.lang.String buttonText)

getButton

public static javax.swing.JButton getButton(java.lang.String buttonText,
                                            int length)
Returns a standard button

Parameters:
buttonText - display String, also used for naming the button
length - length of this button
Returns:
(JButton) button, height 23

getButton

public static javax.swing.JButton getButton(javax.swing.ImageIcon icon)
Returns a standard button

Returns:
(JButton) button, height 23

getButton

public static javax.swing.JButton getButton(java.lang.String buttonText)
Returns a standard button

Parameters:
buttonText - display String, also used for naming the button
Returns:
(JButton) button, height 23

getTextArea

public static javax.swing.JTextArea getTextArea()
Returns a long text field with all the defaults set


getLongTextField

public static LongTextField getLongTextField(int maxTextLength)
Returns a text area with all the defaults set


getLabel

public static javax.swing.JLabel getLabel(java.lang.String labelText,
                                          int length)
Returns a standard label with a text

Parameters:
length - length of this field
Returns:
(JLabel) label, no preferemces are set

getLabel

public static javax.swing.JLabel getLabel(java.lang.String labelText)
Returns a standard label with a text

Returns:
(JLabel) label, no preferemces are set

getEditorPane

public static javax.swing.JEditorPane getEditorPane()
Returns a standard editor pane

Returns:
(JEditorPane) editor pane, no preferences are set

getShortTextField

public static ShortTextField getShortTextField(int maxTextLength)

getTextField

public static javax.swing.JTextField getTextField(int length)
Returns a textfield

Parameters:
length - length of this field

getTextField

public static javax.swing.JTextField getTextField()
Returns a textfield

Returns:
JTextField textfield, height 23

getTabbedPane

public static javax.swing.JTabbedPane getTabbedPane()
Returns a standard tabbed pane

Returns:
(JTabbedPane) tabbed pane, no prefences are set

getIcon

public static javax.swing.Icon getIcon(java.lang.String iconLocation)
Returns a standard icon

Parameters:
iconLocation - location of the icon image
Returns:
(Icon) normal icon

getMenuBar

public static javax.swing.JMenuBar getMenuBar()
Returns a standard menubar

Returns:
(JMenuBar) standard menubar, no prefences are set

getYesNoCombo

public static javax.swing.JComboBox getYesNoCombo()
Returns a combobox with the items " ", "yes" and "no"

Returns:
(JComboBox) a combox with the items "yes" and "no", the first item is an empty String

getTableForObject

public static javax.swing.JTable getTableForObject(DataCrowObject o,
                                                   javax.swing.table.DefaultTableModel tableModel)

getSimpleTable

public static javax.swing.JTable getSimpleTable(javax.swing.table.DefaultTableModel tableModel,
                                                boolean autoScrolls)

getRequiredTableHeaderRenderer

public static javax.swing.table.DefaultTableCellRenderer getRequiredTableHeaderRenderer()

getTableHeaderRenderer

public static javax.swing.table.DefaultTableCellRenderer getTableHeaderRenderer()

getBorder

public static javax.swing.border.TitledBorder getBorder(java.lang.String title)
Returns a standard border with a title

Parameters:
title - display String
Returns:
(TitledBorder) border with text

getStandardFont

public static java.awt.Font getStandardFont()
Returns the default font

Returns:
(Font) Verdana font, pixelheight 11, true type

getApplicationColor

public static java.awt.Color getApplicationColor()
Returns the color for the application background


getDisabledColor

public static java.awt.Color getDisabledColor()
Returns the color for displaying disabled fields


getRequiredColor

public static java.awt.Color getRequiredColor()
Returns the color for displaying required fields


getTableHeaderColor

public static java.awt.Color getTableHeaderColor()
Returns the color for the table header


getTableColor

public static java.awt.Color getTableColor()
Returns the color for the background of tables


setComponentValue

public static void setComponentValue(int fieldType,
                                     javax.swing.JComponent comp,
                                     java.lang.Object value)

getComponentValue

public static java.lang.Object getComponentValue(int fieldType,
                                                 javax.swing.JComponent comp)