JHotDraw 7.5.1

org.jhotdraw.draw.action
Class ButtonFactory

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

@NotNull
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 661 2010-07-13 07:06:50Z rawcoder $
Author:
Werner Randelshofer

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> HSB_COLORS
          HSB color palette with a set of colors chosen based on a physical criteria.
static java.util.List<ColorIcon> HSB_COLORS_AS_RGB
          This is the same palette as HSB_COLORS, but all color values are specified in the sRGB color space.
static int HSB_COLORS_AS_RGB_COLUMN_COUNT
           
static int HSB_COLORS_COLUMN_COUNT
           
static java.util.List<ColorIcon> WEBSAVE_COLORS
          Websave color palette as used by Macromedia Fireworks.
static int WEBSAVE_COLORS_COLUMN_COUNT
           
 
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 createDrawingColorChooserButton(DrawingEditor editor, AttributeKey<java.awt.Color> attributeKey, java.lang.String labelKey, ResourceBundleUtil labels, java.util.Map<AttributeKey,java.lang.Object> defaultAttributes, java.awt.Shape colorShape, java.lang.Class uiclass, java.util.List<Disposable> dsp)
           
static JPopupButton createDrawingColorChooserButton(DrawingEditor editor, AttributeKey<java.awt.Color> attributeKey, java.lang.String labelKey, ResourceBundleUtil labels, java.util.Map<AttributeKey,java.lang.Object> defaultAttributes, java.awt.Shape colorShape, java.util.List<Disposable> dsp)
           
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 createSelectionColorChooserButton(DrawingEditor editor, AttributeKey<java.awt.Color> attributeKey, java.lang.String labelKey, ResourceBundleUtil labels, java.util.Map<AttributeKey,java.lang.Object> defaultAttributes, java.awt.Shape colorShape, java.lang.Class uiclass, java.util.List<Disposable> dsp)
           
static JPopupButton createSelectionColorChooserButton(DrawingEditor editor, AttributeKey<java.awt.Color> attributeKey, java.lang.String labelKey, ResourceBundleUtil labels, java.util.Map<AttributeKey,java.lang.Object> defaultAttributes, java.awt.Shape colorShape, java.util.List<Disposable> dsp)
           
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

HSB_COLORS

public static final java.util.List<ColorIcon> HSB_COLORS
HSB color palette with a set of colors chosen based on a physical criteria.

This is a 'human friendly' color palette which arranges the color in a way that makes it easy for humans to select the desired color. The colors are ordered in a way which minimizes the color contrast effect in the human visual system.

This palette has 12 columns and 10 rows.

The topmost row contains a null-color and a gray scale from white to black in 10 percent steps.

The remaining rows contain colors taken from the outer hull of the HSB color model:

The columns are ordered by hue starting with red - the lowest wavelength - and ending with purple - the highest wavelength. There are 12 different hues, so that all primary colors with their additive complements can be selected.

The rows are orderd by brightness with the brightest color at the top (sky) and the darkest color at the bottom (earth). The first 5 rows contain colors with maximal brightness and a saturation ranging form 20% up to 100%. The remaining 4 rows contain colors with maximal saturation and a brightness ranging from 90% to 20% (this also makes for a range from 100% to 20% if the 5th row is taken into account).


HSB_COLORS_COLUMN_COUNT

public static final int HSB_COLORS_COLUMN_COUNT
See Also:
Constant Field Values

HSB_COLORS_AS_RGB

public static final java.util.List<ColorIcon> HSB_COLORS_AS_RGB
This is the same palette as HSB_COLORS, but all color values are specified in the sRGB color space.


HSB_COLORS_AS_RGB_COLUMN_COUNT

public static final int HSB_COLORS_AS_RGB_COLUMN_COUNT
See Also:
Constant Field Values
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,
                                                      @Nullable
                                                      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,
                                                      @Nullable
                                                      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,
                                                      @Nullable
                                                      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.

createSelectionColorChooserButton

public static JPopupButton createSelectionColorChooserButton(DrawingEditor editor,
                                                             AttributeKey<java.awt.Color> attributeKey,
                                                             java.lang.String labelKey,
                                                             ResourceBundleUtil labels,
                                                             java.util.Map<AttributeKey,java.lang.Object> defaultAttributes,
                                                             java.awt.Shape colorShape,
                                                             java.util.List<Disposable> dsp)

createSelectionColorChooserButton

public static JPopupButton createSelectionColorChooserButton(DrawingEditor editor,
                                                             AttributeKey<java.awt.Color> attributeKey,
                                                             java.lang.String labelKey,
                                                             ResourceBundleUtil labels,
                                                             java.util.Map<AttributeKey,java.lang.Object> defaultAttributes,
                                                             java.awt.Shape colorShape,
                                                             @Nullable
                                                             java.lang.Class uiclass,
                                                             @Nullable
                                                             java.util.List<Disposable> dsp)

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,
                                                    @Nullable
                                                    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.

createDrawingColorChooserButton

public static JPopupButton createDrawingColorChooserButton(DrawingEditor editor,
                                                           AttributeKey<java.awt.Color> attributeKey,
                                                           java.lang.String labelKey,
                                                           ResourceBundleUtil labels,
                                                           @Nullable
                                                           java.util.Map<AttributeKey,java.lang.Object> defaultAttributes,
                                                           java.awt.Shape colorShape,
                                                           @Nullable
                                                           java.util.List<Disposable> dsp)

createDrawingColorChooserButton

public static JPopupButton createDrawingColorChooserButton(DrawingEditor editor,
                                                           AttributeKey<java.awt.Color> attributeKey,
                                                           java.lang.String labelKey,
                                                           ResourceBundleUtil labels,
                                                           @Nullable
                                                           java.util.Map<AttributeKey,java.lang.Object> defaultAttributes,
                                                           java.awt.Shape colorShape,
                                                           @Nullable
                                                           java.lang.Class uiclass,
                                                           @Nullable
                                                           java.util.List<Disposable> dsp)

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)

Copyright 1996-2010 (c) by the authors and contributors of the JHotDraw project.
Some rights reserved.