org.pietschy.command

Class DefaultToolbarFactory

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 JButton.isRolloverEnabled is true. All buttons are created with a margin of 1 pixel.
See Also:
setFloatable(boolean), setRolloverEnabled(boolean), setInsets(Insets)

Constructor Summary

DefaultToolbarFactory()
Creates a new factory that creates non-floatable toolbars and rollover enabled buttons.
DefaultToolbarFactory(Insets insets, boolean floatable, boolean rolloverEnabled)
Creates a new factory.

Method Summary

JButton
createButton()
Creates a new JButton.
JCheckBox
createCheckBox()
Creates a new JCheckBox.
JRadioButton
createRadioButton()
Creates a new JRadioButton.
AbstractButton
createToggleButton()
Creates a new JToggleButton.
JToolBar
createToolbar()
Creates a new JToolBar.
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(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.

Constructor Details

DefaultToolbarFactory

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

DefaultToolbarFactory

public DefaultToolbarFactory(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 Details

createButton

public JButton createButton()
Creates a new JButton.
Specified by:
createButton in interface ButtonFactory
Returns:
a new JButton.

createCheckBox

public JCheckBox createCheckBox()
Creates a new JCheckBox.
Specified by:
createCheckBox in interface ButtonFactory
Returns:
a new JCheckBox.

createRadioButton

public JRadioButton createRadioButton()
Creates a new JRadioButton.
Specified by:
createRadioButton in interface ButtonFactory
Returns:
a new JRadioButton.

createToggleButton

public AbstractButton createToggleButton()
Creates a new JToggleButton.
Specified by:
createToggleButton in interface ButtonFactory
Returns:
a new JToggleButton.

createToolbar

public JToolBar createToolbar()
Creates a new JToolBar.
Specified by:
createToolbar in interface ToolbarFactory
Returns:
a new JToolBar.

getInsets

public 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.

isFloatable

public boolean isFloatable()
Checks if this factory is creating floatable toolbars.
Returns:
true if this factory is setting floatable 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.

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.

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.

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.

setInsets

public void setInsets(Insets insets)
Sets the Insets this factory will apply to the buttons it creates.
Parameters:
insets - the Insets to use.

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.