org.pietschy.command
Class DefaultToolbarFactory

java.lang.Object
  extended by org.pietschy.command.DefaultToolbarFactory
All Implemented Interfaces:
ButtonFactory, ToolbarFactory

public class DefaultToolbarFactory
extends java.lang.Object
implements ToolbarFactory

Provides the default implementation of ToolbarFactory. In its default configuration this factory creates toolbars for which JToolBar.isFloatable() is false and buttons for which AbstractButton.isRolloverEnabled() is true. All buttons are created with a margin of 1 pixel.

See Also:
setFloatable(boolean), setRolloverEnabled(boolean), setInsets(java.awt.Insets)

Constructor Summary
DefaultToolbarFactory()
          Creates a new factory that creates non-floatable toolbars and rollover enabled buttons.
DefaultToolbarFactory(java.awt.Insets insets, boolean floatable, boolean rolloverEnabled)
          Creates a new factory.
 
Method Summary
 javax.swing.JButton createButton()
          Creates a new JButton.
 javax.swing.JCheckBox createCheckBox()
          Creates a new JCheckBox.
 javax.swing.JRadioButton createRadioButton()
          Creates a new JRadioButton.
 javax.swing.AbstractButton createToggleButton()
          Creates a new JToggleButton.
 javax.swing.JToolBar createToolbar()
          Creates a new JToolBar.
 java.awt.Insets getInsets()
          Gets the Insets this factory is applying to the buttons it creates.
 boolean isFloatable()
          Checks if this factory is creating floatable toolbars.
 boolean isFocusable()
          Checks if the factory is building focusable toolbars.
 boolean isRolloverEnabled()
          Checks if this factory is creating rollover enabled buttons.
 void setFloatable(boolean floatable)
          Configures if this factory is creating floatable toolbars.
 void setFocusable(boolean focusable)
          Configure the factory to create focusable toolbars.
 void setInsets(java.awt.Insets insets)
          Sets the Insets this factory will apply to the buttons it creates.
 void setRolloverEnabled(boolean rolloverEnabled)
          Configures if this factory is creating rollover enabled buttons.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DefaultToolbarFactory

public DefaultToolbarFactory()
Creates a new factory that creates non-floatable toolbars and rollover enabled buttons.


DefaultToolbarFactory

public DefaultToolbarFactory(java.awt.Insets insets,
                             boolean floatable,
                             boolean rolloverEnabled)
Creates a new factory.

Parameters:
insets - the insets to use for all buttons.
floatable - true if the toolbars created are to be floatable, false otherwise.
rolloverEnabled - true if buttons created are to be rollover enabled, false otherwise.
Method Detail

createButton

public javax.swing.JButton createButton()
Creates a new JButton.

Specified by:
createButton in interface ButtonFactory
Returns:
a new JButton.

createCheckBox

public javax.swing.JCheckBox createCheckBox()
Creates a new JCheckBox.

Specified by:
createCheckBox in interface ButtonFactory
Returns:
a new JCheckBox.

createRadioButton

public javax.swing.JRadioButton createRadioButton()
Creates a new JRadioButton.

Specified by:
createRadioButton in interface ButtonFactory
Returns:
a new JRadioButton.

createToggleButton

public javax.swing.AbstractButton createToggleButton()
Creates a new JToggleButton.

Specified by:
createToggleButton in interface ButtonFactory
Returns:
a new JToggleButton.

createToolbar

public javax.swing.JToolBar createToolbar()
Creates a new JToolBar.

Specified by:
createToolbar in interface ToolbarFactory
Returns:
a new JToolBar.

getInsets

public java.awt.Insets getInsets()
Gets the Insets this factory is applying to the buttons it creates.

Returns:
the Insets this factory is applying to the buttons it creates.

setInsets

public void setInsets(java.awt.Insets insets)
Sets the Insets this factory will apply to the buttons it creates.

Parameters:
insets - the Insets to use.

isFloatable

public boolean isFloatable()
Checks if this factory is creating floatable toolbars.

Returns:
true if this factory is setting floatable to true, false otherwise.

setFloatable

public void setFloatable(boolean floatable)
Configures if this factory is creating floatable toolbars.

Parameters:
floatable - true to make this factory set floateable to true, false otherwise.

isRolloverEnabled

public boolean isRolloverEnabled()
Checks if this factory is creating rollover enabled buttons.

Returns:
true if this factory is setting rollover enabled to true, false otherwise.

setRolloverEnabled

public void setRolloverEnabled(boolean rolloverEnabled)
Configures if this factory is creating rollover enabled buttons.

Parameters:
rolloverEnabled - true to make this factory set rollover enabled to true, false otherwise.

isFocusable

public boolean isFocusable()
Checks if the factory is building focusable toolbars. The default is false.

Returns:
true if the factory is building focusable toolbars, false otherwise.

setFocusable

public void setFocusable(boolean focusable)
Configure the factory to create focusable toolbars. The default is false.

Parameters:
focusable - true to create focusable toolbars, false otherwise.