org.jhotdraw.draw.action
Class ButtonFactory

java.lang.Object
  extended by org.jhotdraw.draw.action.ButtonFactory

public class ButtonFactory
extends java.lang.Object

ButtonFactory.

Design pattern:
Name: Abstract Factory.
Role: Abstract Factory.
Partners: DrawApplicationModel as Client, DrawView as Client, DrawingPanel as Client. FIXME - All buttons created using the ButtonFactory must automatically become disabled/enabled, when the DrawingEditor is disabled/enabled.

Version:
$Id: ButtonFactory.java 604 2010-01-09 12:00:29Z rawcoder $
Author:
Werner Randelshofer

Nested Class Summary
private static class ButtonFactory.ToolButtonListener
           
 
Field Summary
static java.util.List<ColorIcon> DEFAULT_COLORS
          Mac OS X 'Apple Color Palette'.
static int DEFAULT_COLORS_COLUMN_COUNT
           
static java.util.List<ColorIcon> HSV_COLORS
          HSV color palette.
static int HSV_COLORS_COLUMN_COUNT
           
static java.util.List<ColorIcon> WEBSAVE_COLORS
          Websave color palette as used by Macromedia Fireworks.
static int WEBSAVE_COLORS_COLUMN_COUNT
           
 
Constructor Summary
private ButtonFactory()
          Prevent instance creation.
 
Method Summary
static void addAlignmentButtonsTo(javax.swing.JToolBar bar, DrawingEditor editor)
          Creates toolbar buttons and adds them to the specified JToolBar
static void addAlignmentButtonsTo(javax.swing.JToolBar bar, DrawingEditor editor, java.util.List<Disposable> dsp)
          Creates toolbar buttons and adds them to the specified JToolBar.
static void addAttributesButtonsTo(javax.swing.JToolBar bar, DrawingEditor editor)
          Creates toolbar buttons and adds them to the specified JToolBar
static void addColorButtonsTo(javax.swing.JToolBar bar, DrawingEditor editor)
           
static void addColorButtonsTo(javax.swing.JToolBar bar, DrawingEditor editor, java.util.List<ColorIcon> colors, int columnCount)
           
static void addFontButtonsTo(javax.swing.JToolBar bar, DrawingEditor editor)
           
static javax.swing.JToggleButton addSelectionToolTo(javax.swing.JToolBar tb, DrawingEditor editor)
           
static javax.swing.JToggleButton addSelectionToolTo(javax.swing.JToolBar tb, DrawingEditor editor, java.util.Collection<javax.swing.Action> drawingActions, java.util.Collection<javax.swing.Action> selectionActions)
           
static javax.swing.JToggleButton addSelectionToolTo(javax.swing.JToolBar tb, DrawingEditor editor, Tool selectionTool)
           
static void addStrokeButtonsTo(javax.swing.JToolBar bar, DrawingEditor editor)
           
static javax.swing.JToggleButton addToolTo(javax.swing.JToolBar tb, DrawingEditor editor, Tool tool, java.lang.String labelKey, ResourceBundleUtil labels)
          Method addSelectionToolTo must have been invoked prior to this on the JToolBar.
static void addZoomButtonsTo(javax.swing.JToolBar bar, DrawingEditor editor)
           
static javax.swing.JButton createApplyAttributesButton(DrawingEditor editor)
          Creates a button that applies the default attributes of the editor to the current selection.
static javax.swing.JButton createApplyAttributesButton(DrawingEditor editor, java.util.List<Disposable> dsp)
           
static java.util.Collection<javax.swing.Action> createDrawingActions(DrawingEditor editor)
           
static java.util.Collection<javax.swing.Action> createDrawingActions(DrawingEditor editor, java.util.List<Disposable> dsp)
           
static JPopupButton createDrawingColorButton(DrawingEditor editor, AttributeKey<java.awt.Color> attributeKey, java.util.List<ColorIcon> swatches, int columnCount, java.lang.String labelKey, ResourceBundleUtil labels)
          Creates a color button, with an action region and a popup menu.
static JPopupButton createDrawingColorButton(DrawingEditor editor, AttributeKey<java.awt.Color> attributeKey, java.util.List<ColorIcon> swatches, int columnCount, java.lang.String labelKey, ResourceBundleUtil labels, java.util.Map<AttributeKey,java.lang.Object> defaultAttributes)
          Creates a color button, with an action region and a popup menu.
static JPopupButton createDrawingColorButton(DrawingEditor editor, AttributeKey<java.awt.Color> attributeKey, java.util.List<ColorIcon> swatches, int columnCount, java.lang.String labelKey, ResourceBundleUtil labels, java.util.Map<AttributeKey,java.lang.Object> defaultAttributes, java.awt.Shape colorShape)
          Creates a color button, with an action region and a popup menu.
static JPopupButton createDrawingColorButton(DrawingEditor editor, AttributeKey<java.awt.Color> attributeKey, java.util.List<ColorIcon> swatches, int columnCount, java.lang.String labelKey, ResourceBundleUtil labels, java.util.Map<AttributeKey,java.lang.Object> defaultAttributes, java.awt.Shape colorShape, java.util.List<Disposable> dsp)
          Creates a color button, with an action region and a popup menu.
static JPopupButton createEditorColorButton(DrawingEditor editor, AttributeKey<java.awt.Color> attributeKey, java.util.List<ColorIcon> swatches, int columnCount, java.lang.String labelKey, ResourceBundleUtil labels)
          Creates a color button, with an action region and a popup menu.
static JPopupButton createEditorColorButton(DrawingEditor editor, AttributeKey<java.awt.Color> attributeKey, java.util.List<ColorIcon> swatches, int columnCount, java.lang.String labelKey, ResourceBundleUtil labels, java.util.Map<AttributeKey,java.lang.Object> defaultAttributes)
          Creates a color button, with an action region and a popup menu.
static JPopupButton createEditorColorButton(DrawingEditor editor, AttributeKey<java.awt.Color> attributeKey, java.util.List<ColorIcon> swatches, int columnCount, java.lang.String labelKey, ResourceBundleUtil labels, java.util.Map<AttributeKey,java.lang.Object> defaultAttributes, java.awt.Shape colorShape)
          Creates a color button, with an action region and a popup menu.
static JPopupButton createFontButton(DrawingEditor editor)
           
static JPopupButton createFontButton(DrawingEditor editor, AttributeKey<java.awt.Font> key, ResourceBundleUtil labels)
           
static JPopupButton createFontButton(DrawingEditor editor, AttributeKey<java.awt.Font> key, ResourceBundleUtil labels, java.util.List<Disposable> dsp)
           
static JPopupButton createFontButton(DrawingEditor editor, ResourceBundleUtil labels)
           
static javax.swing.JButton createFontStyleBoldButton(DrawingEditor editor)
           
static javax.swing.JButton createFontStyleBoldButton(DrawingEditor editor, ResourceBundleUtil labels)
           
static javax.swing.JButton createFontStyleBoldButton(DrawingEditor editor, ResourceBundleUtil labels, java.util.List<Disposable> dsp)
           
static javax.swing.JButton createFontStyleItalicButton(DrawingEditor editor)
           
static javax.swing.JButton createFontStyleItalicButton(DrawingEditor editor, ResourceBundleUtil labels)
           
static javax.swing.JButton createFontStyleItalicButton(DrawingEditor editor, ResourceBundleUtil labels, java.util.List<Disposable> dsp)
           
static javax.swing.JButton createFontStyleUnderlineButton(DrawingEditor editor)
           
static javax.swing.JButton createFontStyleUnderlineButton(DrawingEditor editor, ResourceBundleUtil labels)
           
static javax.swing.JButton createFontStyleUnderlineButton(DrawingEditor editor, ResourceBundleUtil labels, java.util.List<Disposable> dsp)
           
static javax.swing.JButton createPickAttributesButton(DrawingEditor editor)
           
static javax.swing.JButton createPickAttributesButton(DrawingEditor editor, java.util.List<Disposable> dsp)
           
static java.util.Collection<javax.swing.Action> createSelectionActions(DrawingEditor editor)
           
static JPopupButton createSelectionColorButton(DrawingEditor editor, AttributeKey<java.awt.Color> attributeKey, java.util.List<ColorIcon> swatches, int columnCount, java.lang.String labelKey, ResourceBundleUtil labels)
          Creates a color button, with an action region and a popup menu.
static JPopupButton createSelectionColorButton(DrawingEditor editor, AttributeKey<java.awt.Color> attributeKey, java.util.List<ColorIcon> swatches, int columnCount, java.lang.String labelKey, ResourceBundleUtil labels, java.util.Map<AttributeKey,java.lang.Object> defaultAttributes)
          Creates a color button, with an action region and a popup menu.
static JPopupButton createSelectionColorButton(DrawingEditor editor, AttributeKey<java.awt.Color> attributeKey, java.util.List<ColorIcon> swatches, int columnCount, java.lang.String labelKey, ResourceBundleUtil labels, java.util.Map<AttributeKey,java.lang.Object> defaultAttributes, java.awt.Shape colorShape)
          Creates a color button, with an action region and a popup menu.
static JPopupButton createSelectionColorButton(DrawingEditor editor, AttributeKey<java.awt.Color> attributeKey, java.util.List<ColorIcon> swatches, int columnCount, java.lang.String labelKey, ResourceBundleUtil labels, java.util.Map<AttributeKey,java.lang.Object> defaultAttributes, java.awt.Shape colorShape, java.util.List<Disposable> dsp)
          Creates a color button, with an action region and a popup menu.
static JPopupButton createStrokeCapButton(DrawingEditor editor)
           
static JPopupButton createStrokeCapButton(DrawingEditor editor, ResourceBundleUtil labels)
           
static JPopupButton createStrokeCapButton(DrawingEditor editor, ResourceBundleUtil labels, java.util.List<Disposable> dsp)
           
static JPopupButton createStrokeDashesButton(DrawingEditor editor)
           
static JPopupButton createStrokeDashesButton(DrawingEditor editor, double[][] dashes)
           
static JPopupButton createStrokeDashesButton(DrawingEditor editor, double[][] dashes, ResourceBundleUtil labels)
           
static JPopupButton createStrokeDashesButton(DrawingEditor editor, double[][] dashes, ResourceBundleUtil labels, java.util.List<Disposable> dsp)
           
static JPopupButton createStrokeDashesButton(DrawingEditor editor, ResourceBundleUtil labels)
           
static JPopupButton createStrokeDecorationButton(DrawingEditor editor)
           
static JPopupButton createStrokeJoinButton(DrawingEditor editor)
           
static JPopupButton createStrokeJoinButton(DrawingEditor editor, ResourceBundleUtil labels)
           
static JPopupButton createStrokeJoinButton(DrawingEditor editor, ResourceBundleUtil labels, java.util.List<Disposable> dsp)
           
static JPopupButton createStrokePlacementButton(DrawingEditor editor)
           
static JPopupButton createStrokeTypeButton(DrawingEditor editor)
           
static JPopupButton createStrokeWidthButton(DrawingEditor editor)
           
static JPopupButton createStrokeWidthButton(DrawingEditor editor, double[] widths)
           
static JPopupButton createStrokeWidthButton(DrawingEditor editor, double[] widths, ResourceBundleUtil labels)
           
static JPopupButton createStrokeWidthButton(DrawingEditor editor, ResourceBundleUtil labels)
           
static javax.swing.AbstractButton createToggleGridButton(DrawingView view)
          Creates a button which toggles between two GridConstrainer for a DrawingView.
static javax.swing.AbstractButton createZoomButton(DrawingEditor editor)
           
static javax.swing.AbstractButton createZoomButton(DrawingView view)
           
static javax.swing.AbstractButton createZoomButton(DrawingView view, double[] factors)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DEFAULT_COLORS

public static final java.util.List<ColorIcon> DEFAULT_COLORS
Mac OS X 'Apple Color Palette'. This palette has 8 columns.


DEFAULT_COLORS_COLUMN_COUNT

public static final int DEFAULT_COLORS_COLUMN_COUNT
See Also:
Constant Field Values

WEBSAVE_COLORS

public static final java.util.List<ColorIcon> WEBSAVE_COLORS
Websave color palette as used by Macromedia Fireworks. This palette has 19 columns. The leftmost column contains a redundant set of color icons to make selection of gray scales and of the primary colors easier.


WEBSAVE_COLORS_COLUMN_COUNT

public static final int WEBSAVE_COLORS_COLUMN_COUNT
See Also:
Constant Field Values

HSV_COLORS

public static final java.util.List<ColorIcon> HSV_COLORS
HSV color palette. This is a 'human friendly' color palette which arranges the color in a way that makes it (hopefully) easy for humans to select the desired color.

This palette has 12 columns. The topmost row contains a null-color and gray scales.


HSV_COLORS_COLUMN_COUNT

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

ButtonFactory

private ButtonFactory()
Prevent instance creation.

Method Detail

createDrawingActions

public static java.util.Collection<javax.swing.Action> createDrawingActions(DrawingEditor editor)

createDrawingActions

public static java.util.Collection<javax.swing.Action> createDrawingActions(DrawingEditor editor,
                                                                            java.util.List<Disposable> dsp)

createSelectionActions

public static java.util.Collection<javax.swing.Action> createSelectionActions(DrawingEditor editor)

addSelectionToolTo

public static javax.swing.JToggleButton addSelectionToolTo(javax.swing.JToolBar tb,
                                                           DrawingEditor editor)

addSelectionToolTo

public static javax.swing.JToggleButton addSelectionToolTo(javax.swing.JToolBar tb,
                                                           DrawingEditor editor,
                                                           java.util.Collection<javax.swing.Action> drawingActions,
                                                           java.util.Collection<javax.swing.Action> selectionActions)

addSelectionToolTo

public static javax.swing.JToggleButton addSelectionToolTo(javax.swing.JToolBar tb,
                                                           DrawingEditor editor,
                                                           Tool selectionTool)

addToolTo

public static javax.swing.JToggleButton addToolTo(javax.swing.JToolBar tb,
                                                  DrawingEditor editor,
                                                  Tool tool,
                                                  java.lang.String labelKey,
                                                  ResourceBundleUtil labels)
Method addSelectionToolTo must have been invoked prior to this on the JToolBar.


addZoomButtonsTo

public static void addZoomButtonsTo(javax.swing.JToolBar bar,
                                    DrawingEditor editor)

createZoomButton

public static javax.swing.AbstractButton createZoomButton(DrawingEditor editor)

createZoomButton

public static javax.swing.AbstractButton createZoomButton(DrawingView view)

createZoomButton

public static javax.swing.AbstractButton createZoomButton(DrawingView view,
                                                          double[] factors)

addAttributesButtonsTo

public static void addAttributesButtonsTo(javax.swing.JToolBar bar,
                                          DrawingEditor editor)
Creates toolbar buttons and adds them to the specified JToolBar


addColorButtonsTo

public static void addColorButtonsTo(javax.swing.JToolBar bar,
                                     DrawingEditor editor)

addColorButtonsTo

public static void addColorButtonsTo(javax.swing.JToolBar bar,
                                     DrawingEditor editor,
                                     java.util.List<ColorIcon> colors,
                                     int columnCount)

createEditorColorButton

public static JPopupButton createEditorColorButton(DrawingEditor editor,
                                                   AttributeKey<java.awt.Color> attributeKey,
                                                   java.util.List<ColorIcon> swatches,
                                                   int columnCount,
                                                   java.lang.String labelKey,
                                                   ResourceBundleUtil labels)
Creates a color button, with an action region and a popup menu. The button works like the color button in Microsoft Office:

Parameters:
editor - The DrawingEditor.
attributeKey - The AttributeKey of the color.
swatches - A list with labeled colors containing the color palette of the popup menu. The actual labels are retrieved from the supplied resource bundle. This is usually a LinkedMap, so that the colors have a predictable order.
columnCount - The number of columns of the color palette.
labelKey - The resource bundle key used for retrieving the icon and the tooltip of the button.
labels - The resource bundle.

createEditorColorButton

public static JPopupButton createEditorColorButton(DrawingEditor editor,
                                                   AttributeKey<java.awt.Color> attributeKey,
                                                   java.util.List<ColorIcon> swatches,
                                                   int columnCount,
                                                   java.lang.String labelKey,
                                                   ResourceBundleUtil labels,
                                                   java.util.Map<AttributeKey,java.lang.Object> defaultAttributes)
Creates a color button, with an action region and a popup menu. The button works like the color button in Microsoft Office:

Parameters:
editor - The DrawingEditor.
attributeKey - The AttributeKey of the color.
swatches - A list with labeled colors containing the color palette of the popup menu. The actual labels are retrieved from the supplied resource bundle. This is usually a LinkedMap, so that the colors have a predictable order.
columnCount - The number of columns of the color palette.
labelKey - The resource bundle key used for retrieving the icon and the tooltip of the button.
labels - The resource bundle.
defaultAttributes - A set of attributes which are also applied to the selected figures, when a color is selected. This can be used, to set attributes that otherwise prevent the color from being shown. For example, when the color attribute is set, we wan't the gradient attribute of the Figure to be cleared.

createEditorColorButton

public static JPopupButton createEditorColorButton(DrawingEditor editor,
                                                   AttributeKey<java.awt.Color> attributeKey,
                                                   java.util.List<ColorIcon> swatches,
                                                   int columnCount,
                                                   java.lang.String labelKey,
                                                   ResourceBundleUtil labels,
                                                   java.util.Map<AttributeKey,java.lang.Object> defaultAttributes,
                                                   java.awt.Shape colorShape)
Creates a color button, with an action region and a popup menu. The button works like the color button in Microsoft Office:

Parameters:
editor - The DrawingEditor.
attributeKey - The AttributeKey of the color.
swatches - A list with labeled colors containing the color palette of the popup menu. The actual labels are retrieved from the supplied resource bundle. This is usually a LinkedHashMap, so that the colors have a predictable order.
columnCount - The number of columns of the color palette.
labelKey - The resource bundle key used for retrieving the icon and the tooltip of the button.
labels - The resource bundle.
defaultAttributes - A set of attributes which are also applied to the selected figures, when a color is selected. This can be used, to set attributes that otherwise prevent the color from being shown. For example, when the color attribute is set, we wan't the gradient attribute of the Figure to be cleared.
colorShape - This shape is superimposed on the icon of the button. The shape is drawn with the default color of the DrawingEditor.

createSelectionColorButton

public static JPopupButton createSelectionColorButton(DrawingEditor editor,
                                                      AttributeKey<java.awt.Color> attributeKey,
                                                      java.util.List<ColorIcon> swatches,
                                                      int columnCount,
                                                      java.lang.String labelKey,
                                                      ResourceBundleUtil labels)
Creates a color button, with an action region and a popup menu. The button works like the color button in Adobe Fireworks:

Parameters:
editor - The DrawingEditor.
attributeKey - The AttributeKey of the color.
swatches - A list with labeled colors containing the color palette of the popup menu. The actual labels are retrieved from the supplied resource bundle. This is usually a LinkedHashMap, so that the colors have a predictable order.
columnCount - The number of columns of the color palette.
labelKey - The resource bundle key used for retrieving the icon and the tooltip of the button.
labels - The resource bundle.

createSelectionColorButton

public static JPopupButton createSelectionColorButton(DrawingEditor editor,
                                                      AttributeKey<java.awt.Color> attributeKey,
                                                      java.util.List<ColorIcon> swatches,
                                                      int columnCount,
                                                      java.lang.String labelKey,
                                                      ResourceBundleUtil labels,
                                                      java.util.Map<AttributeKey,java.lang.Object> defaultAttributes)
Creates a color button, with an action region and a popup menu. The button works like the color button in Adobe Fireworks:

Parameters:
editor - The DrawingEditor.
attributeKey - The AttributeKey of the color.
swatches - A list with labeled colors containing the color palette of the popup menu. The actual labels are retrieved from the supplied resource bundle. This is usually a LinkedHashMap, so that the colors have a predictable order.
columnCount - The number of columns of the color palette.
labelKey - The resource bundle key used for retrieving the icon and the tooltip of the button.
labels - The resource bundle.
defaultAttributes - A set of attributes which are also applied to the selected figures, when a color is selected. This can be used, to set attributes that otherwise prevent the color from being shown. For example, when the color attribute is set, we wan't the gradient attribute of the Figure to be cleared.

createSelectionColorButton

public static JPopupButton createSelectionColorButton(DrawingEditor editor,
                                                      AttributeKey<java.awt.Color> attributeKey,
                                                      java.util.List<ColorIcon> swatches,
                                                      int columnCount,
                                                      java.lang.String labelKey,
                                                      ResourceBundleUtil labels,
                                                      java.util.Map<AttributeKey,java.lang.Object> defaultAttributes,
                                                      java.awt.Shape colorShape)
Creates a color button, with an action region and a popup menu. The button works like the color button in Adobe Fireworks:

Parameters:
editor - The DrawingEditor.
attributeKey - The AttributeKey of the color.
swatches - A list with labeled colors containing the color palette of the popup menu. The actual labels are retrieved from the supplied resource bundle. This is usually a LinkedHashMap, so that the colors have a predictable order.
columnCount - The number of columns of the color palette.
labelKey - The resource bundle key used for retrieving the icon and the tooltip of the button.
labels - The resource bundle.
defaultAttributes - A set of attributes which are also applied to the selected figures, when a color is selected. This can be used, to set attributes that otherwise prevent the color from being shown. For example, when the color attribute is set, we wan't the gradient attribute of the Figure to be cleared.
colorShape - This shape is superimposed on the icon of the button. The shape is drawn with the default color of the DrawingEditor.

createSelectionColorButton

public static JPopupButton createSelectionColorButton(DrawingEditor editor,
                                                      AttributeKey<java.awt.Color> attributeKey,
                                                      java.util.List<ColorIcon> swatches,
                                                      int columnCount,
                                                      java.lang.String labelKey,
                                                      ResourceBundleUtil labels,
                                                      java.util.Map<AttributeKey,java.lang.Object> defaultAttributes,
                                                      java.awt.Shape colorShape,
                                                      java.util.List<Disposable> dsp)
Creates a color button, with an action region and a popup menu. The button works like the color button in Adobe Fireworks:

Parameters:
editor - The DrawingEditor.
attributeKey - The AttributeKey of the color.
swatches - A list with labeled colors containing the color palette of the popup menu. The actual labels are retrieved from the supplied resource bundle. This is usually a LinkedHashMap, so that the colors have a predictable order.
columnCount - The number of columns of the color palette.
labelKey - The resource bundle key used for retrieving the icon and the tooltip of the button.
labels - The resource bundle.
defaultAttributes - A set of attributes which are also applied to the selected figures, when a color is selected. This can be used, to set attributes that otherwise prevent the color from being shown. For example, when the color attribute is set, we wan't the gradient attribute of the Figure to be cleared.
colorShape - This shape is superimposed on the icon of the button. The shape is drawn with the default color of the DrawingEditor.

createDrawingColorButton

public static JPopupButton createDrawingColorButton(DrawingEditor editor,
                                                    AttributeKey<java.awt.Color> attributeKey,
                                                    java.util.List<ColorIcon> swatches,
                                                    int columnCount,
                                                    java.lang.String labelKey,
                                                    ResourceBundleUtil labels)
Creates a color button, with an action region and a popup menu. The button acts on attributes of the Drawing object in the current DrawingView of the DrawingEditor.

Parameters:
editor - The DrawingEditor.
attributeKey - The AttributeKey of the color.
swatches - A list with labeled colors containing the color palette of the popup menu. The actual labels are retrieved from the supplied resource bundle. This is usually a LinkedHashMap, so that the colors have a predictable order.
columnCount - The number of columns of the color palette.
labelKey - The resource bundle key used for retrieving the icon and the tooltip of the button.
labels - The resource bundle.

createDrawingColorButton

public static JPopupButton createDrawingColorButton(DrawingEditor editor,
                                                    AttributeKey<java.awt.Color> attributeKey,
                                                    java.util.List<ColorIcon> swatches,
                                                    int columnCount,
                                                    java.lang.String labelKey,
                                                    ResourceBundleUtil labels,
                                                    java.util.Map<AttributeKey,java.lang.Object> defaultAttributes)
Creates a color button, with an action region and a popup menu. The button acts on attributes of the Drawing object in the current DrawingView of the DrawingEditor.

Parameters:
editor - The DrawingEditor.
attributeKey - The AttributeKey of the color.
swatches - A list with labeled colors containing the color palette of the popup menu. The actual labels are retrieved from the supplied resource bundle. This is usually a LinkedHashMap, so that the colors have a predictable order.
columnCount - The number of columns of the color palette.
labelKey - The resource bundle key used for retrieving the icon and the tooltip of the button.
labels - The resource bundle.
defaultAttributes - A set of attributes which are also applied to the selected figures, when a color is selected. This can be used, to set attributes that otherwise prevent the color from being shown. For example, when the color attribute is set, we wan't the gradient attribute of the Figure to be cleared.

createDrawingColorButton

public static JPopupButton createDrawingColorButton(DrawingEditor editor,
                                                    AttributeKey<java.awt.Color> attributeKey,
                                                    java.util.List<ColorIcon> swatches,
                                                    int columnCount,
                                                    java.lang.String labelKey,
                                                    ResourceBundleUtil labels,
                                                    java.util.Map<AttributeKey,java.lang.Object> defaultAttributes,
                                                    java.awt.Shape colorShape)
Creates a color button, with an action region and a popup menu. The button acts on attributes of the Drawing object in the current DrawingView of the DrawingEditor.

Parameters:
editor - The DrawingEditor.
attributeKey - The AttributeKey of the color.
swatches - A list with labeled colors containing the color palette of the popup menu. The actual labels are retrieved from the supplied resource bundle. This is usually a LinkedHashMap, so that the colors have a predictable order.
columnCount - The number of columns of the color palette.
labelKey - The resource bundle key used for retrieving the icon and the tooltip of the button.
labels - The resource bundle.
defaultAttributes - A set of attributes which are also applied to the selected figures, when a color is selected. This can be used, to set attributes that otherwise prevent the color from being shown. For example, when the color attribute is set, we wan't the gradient attribute of the Figure to be cleared.
colorShape - This shape is superimposed on the icon of the button. The shape is drawn with the default color of the DrawingEditor.

createDrawingColorButton

public static JPopupButton createDrawingColorButton(DrawingEditor editor,
                                                    AttributeKey<java.awt.Color> attributeKey,
                                                    java.util.List<ColorIcon> swatches,
                                                    int columnCount,
                                                    java.lang.String labelKey,
                                                    ResourceBundleUtil labels,
                                                    java.util.Map<AttributeKey,java.lang.Object> defaultAttributes,
                                                    java.awt.Shape colorShape,
                                                    java.util.List<Disposable> dsp)
Creates a color button, with an action region and a popup menu. The button acts on attributes of the Drawing object in the current DrawingView of the DrawingEditor.

Parameters:
editor - The DrawingEditor.
attributeKey - The AttributeKey of the color.
swatches - A list with labeled colors containing the color palette of the popup menu. The actual labels are retrieved from the supplied resource bundle. This is usually a LinkedHashMap, so that the colors have a predictable order.
columnCount - The number of columns of the color palette.
labelKey - The resource bundle key used for retrieving the icon and the tooltip of the button.
labels - The resource bundle.
defaultAttributes - A set of attributes which are also applied to the selected figures, when a color is selected. This can be used, to set attributes that otherwise prevent the color from being shown. For example, when the color attribute is set, we wan't the gradient attribute of the Figure to be cleared.
colorShape - This shape is superimposed on the icon of the button. The shape is drawn with the default color of the DrawingEditor.

addStrokeButtonsTo

public static void addStrokeButtonsTo(javax.swing.JToolBar bar,
                                      DrawingEditor editor)

createStrokeWidthButton

public static JPopupButton createStrokeWidthButton(DrawingEditor editor)

createStrokeWidthButton

public static JPopupButton createStrokeWidthButton(DrawingEditor editor,
                                                   ResourceBundleUtil labels)

createStrokeWidthButton

public static JPopupButton createStrokeWidthButton(DrawingEditor editor,
                                                   double[] widths)

createStrokeWidthButton

public static JPopupButton createStrokeWidthButton(DrawingEditor editor,
                                                   double[] widths,
                                                   ResourceBundleUtil labels)

createStrokeDecorationButton

public static JPopupButton createStrokeDecorationButton(DrawingEditor editor)

createStrokeDashesButton

public static JPopupButton createStrokeDashesButton(DrawingEditor editor)

createStrokeDashesButton

public static JPopupButton createStrokeDashesButton(DrawingEditor editor,
                                                    ResourceBundleUtil labels)

createStrokeDashesButton

public static JPopupButton createStrokeDashesButton(DrawingEditor editor,
                                                    double[][] dashes)

createStrokeDashesButton

public static JPopupButton createStrokeDashesButton(DrawingEditor editor,
                                                    double[][] dashes,
                                                    ResourceBundleUtil labels)

createStrokeDashesButton

public static JPopupButton createStrokeDashesButton(DrawingEditor editor,
                                                    double[][] dashes,
                                                    ResourceBundleUtil labels,
                                                    java.util.List<Disposable> dsp)

createStrokeTypeButton

public static JPopupButton createStrokeTypeButton(DrawingEditor editor)

createStrokePlacementButton

public static JPopupButton createStrokePlacementButton(DrawingEditor editor)

addFontButtonsTo

public static void addFontButtonsTo(javax.swing.JToolBar bar,
                                    DrawingEditor editor)

createFontButton

public static JPopupButton createFontButton(DrawingEditor editor)

createFontButton

public static JPopupButton createFontButton(DrawingEditor editor,
                                            ResourceBundleUtil labels)

createFontButton

public static JPopupButton createFontButton(DrawingEditor editor,
                                            AttributeKey<java.awt.Font> key,
                                            ResourceBundleUtil labels)

createFontButton

public static JPopupButton createFontButton(DrawingEditor editor,
                                            AttributeKey<java.awt.Font> key,
                                            ResourceBundleUtil labels,
                                            java.util.List<Disposable> dsp)

createFontStyleBoldButton

public static javax.swing.JButton createFontStyleBoldButton(DrawingEditor editor)

createFontStyleBoldButton

public static javax.swing.JButton createFontStyleBoldButton(DrawingEditor editor,
                                                            ResourceBundleUtil labels)

createFontStyleBoldButton

public static javax.swing.JButton createFontStyleBoldButton(DrawingEditor editor,
                                                            ResourceBundleUtil labels,
                                                            java.util.List<Disposable> dsp)

createFontStyleItalicButton

public static javax.swing.JButton createFontStyleItalicButton(DrawingEditor editor)

createFontStyleItalicButton

public static javax.swing.JButton createFontStyleItalicButton(DrawingEditor editor,
                                                              ResourceBundleUtil labels)

createFontStyleItalicButton

public static javax.swing.JButton createFontStyleItalicButton(DrawingEditor editor,
                                                              ResourceBundleUtil labels,
                                                              java.util.List<Disposable> dsp)

createFontStyleUnderlineButton

public static javax.swing.JButton createFontStyleUnderlineButton(DrawingEditor editor)

createFontStyleUnderlineButton

public static javax.swing.JButton createFontStyleUnderlineButton(DrawingEditor editor,
                                                                 ResourceBundleUtil labels)

createFontStyleUnderlineButton

public static javax.swing.JButton createFontStyleUnderlineButton(DrawingEditor editor,
                                                                 ResourceBundleUtil labels,
                                                                 java.util.List<Disposable> dsp)

addAlignmentButtonsTo

public static void addAlignmentButtonsTo(javax.swing.JToolBar bar,
                                         DrawingEditor editor)
Creates toolbar buttons and adds them to the specified JToolBar


addAlignmentButtonsTo

public static void addAlignmentButtonsTo(javax.swing.JToolBar bar,
                                         DrawingEditor editor,
                                         java.util.List<Disposable> dsp)
Creates toolbar buttons and adds them to the specified JToolBar.


createToggleGridButton

public static javax.swing.AbstractButton createToggleGridButton(DrawingView view)
Creates a button which toggles between two GridConstrainer for a DrawingView.


createStrokeCapButton

public static JPopupButton createStrokeCapButton(DrawingEditor editor)

createStrokeCapButton

public static JPopupButton createStrokeCapButton(DrawingEditor editor,
                                                 ResourceBundleUtil labels)

createStrokeCapButton

public static JPopupButton createStrokeCapButton(DrawingEditor editor,
                                                 ResourceBundleUtil labels,
                                                 java.util.List<Disposable> dsp)

createStrokeJoinButton

public static JPopupButton createStrokeJoinButton(DrawingEditor editor)

createStrokeJoinButton

public static JPopupButton createStrokeJoinButton(DrawingEditor editor,
                                                  ResourceBundleUtil labels)

createStrokeJoinButton

public static JPopupButton createStrokeJoinButton(DrawingEditor editor,
                                                  ResourceBundleUtil labels,
                                                  java.util.List<Disposable> dsp)

createPickAttributesButton

public static javax.swing.JButton createPickAttributesButton(DrawingEditor editor)

createPickAttributesButton

public static javax.swing.JButton createPickAttributesButton(DrawingEditor editor,
                                                             java.util.List<Disposable> dsp)

createApplyAttributesButton

public static javax.swing.JButton createApplyAttributesButton(DrawingEditor editor)
Creates a button that applies the default attributes of the editor to the current selection.


createApplyAttributesButton

public static javax.swing.JButton createApplyAttributesButton(DrawingEditor editor,
                                                              java.util.List<Disposable> dsp)