jfig.gui
Class AttribsControls

java.lang.Object
  extended byjfig.gui.AttribsControls

public class AttribsControls
extends java.lang.Object

create and manage the editor attribute controls.

AttribsControls: an utility class for jfig to create and manage the attribute control GUI components, e.g. to specify font name, size, alignment, line width, style, arrow mode, line and fill colors, etc.

AttribsControls is a Singleton class, while the individual components are not. Use getAttribsControls() to initialize the Singleton.

Note that not all XFIG attributes and attribute values are supported yet, e.g. fill styles and several fonts.

To retrieve the full set of currently selected attributes for a given instance of AttribsControls, just call getValues(). To update the GUI controls from a given attribute, just call showValues( master_attributes );


Field Summary
(package private)  java.awt.Image allicons
           
(package private)  StateButton arrowModeButton
           
(package private)  StateButton arrowStyleButton
           
(package private)  ChoiceWithHelpMessage centerFlushLeftChoice
           
(package private)  ColorCache colorCache
           
(package private)  TextFieldWithHelpMessage dashLengthField
           
(package private)  boolean debug
           
(package private)  NumericStateButton depthButton
           
(package private)  ColorStateButton fillColorButton
           
(package private)  FillPatternButton fillPatternButton
           
(package private)  StateButton fillStyleButton
           
(package private)  ChoiceWithHelpMessage fontFlagChoice
           
(package private)  FontStateButton fontSelectButton
           
(package private)  NumericStateButton fontSizeButton
           
(package private)  StatusMessage helper
           
(package private)  java.awt.Image[] iconImages
           
(package private)  ChoiceWithHelpMessage landscapePortraitChoice
           
(package private)  ColorStateButton lineColorButton
           
(package private)  StateButton lineStyleButton
           
(package private)  StateButton lineWidthButton
           
(package private)  StateButton objectAlignXButton
           
(package private)  StateButton objectAlignYButton
           
(package private)  NumericStateButton rotationAngleButton
           
(package private)  NumericStateButton roundRectButton
           
(package private)  StateButton smartLinksButton
           
(package private)  StateButton snapModeButton
           
(package private)  StateButton textAlignButton
           
(package private)  UpdateModeButton updateModeButton
           
 
Method Summary
 void addUpdateModeButtonListener(java.awt.event.ActionListener AL)
           
 java.awt.Panel buildPanel(java.awt.Component parent)
           
 StateButton createArrowModeButton(java.awt.Component parent)
           
 StateButton createArrowStyleButton(java.awt.Component parent)
           
 TextFieldWithHelpMessage createBackArrowLengthField(java.awt.Component parent)
           
 TextFieldWithHelpMessage createBackArrowThicknessField(java.awt.Component parent)
           
 TextFieldWithHelpMessage createBackArrowWidthField(java.awt.Component parent)
           
 ChoiceWithHelpMessage createCenterFlushLeftChoice(java.awt.Component parent)
           
 TextFieldWithHelpMessage createDashLengthField(java.awt.Component parent)
           
 NumericStateButton createDepthButton(java.awt.Component parent)
           
 ColorStateButton createFillColorButton(java.awt.Component parent)
           
 FillPatternButton createFillPatternButton(java.awt.Component parent)
           
 StateButton createFillStyleButton(java.awt.Component parent)
           
 ChoiceWithHelpMessage createFontFlagChoice(java.awt.Component parent)
           
 FontStateButton createFontSelectButton(java.awt.Component parent)
           
 NumericStateButton createFontSizeButton(java.awt.Component parent)
           
 TextFieldWithHelpMessage createFrontArrowLengthField(java.awt.Component parent)
           
 TextFieldWithHelpMessage createFrontArrowThicknessField(java.awt.Component parent)
           
 TextFieldWithHelpMessage createFrontArrowWidthField(java.awt.Component parent)
           
 ChoiceWithHelpMessage createLandscapePortraitChoice(java.awt.Component parent)
           
 ColorStateButton createLineColorButton(java.awt.Component parent)
           
 StateButton createLineStyleButton(java.awt.Component parent)
           
 StateButton createLineWidthButton(java.awt.Component parent)
           
 StateButton createObjectAlignXButton(java.awt.Component parent)
           
 StateButton createObjectAlignYButton(java.awt.Component parent)
           
 NumericStateButton createRotationButton(java.awt.Component parent)
           
 NumericStateButton createRoundRectButton(java.awt.Component parent)
           
 StateButton createSmartLinksButton(java.awt.Component parent)
           
 StateButton createSnapModeButton(java.awt.Component parent)
           
 StateButton createTextAlignButton(java.awt.Component parent)
           
 StateButton createUpdateMaskButton(java.awt.Component parent, java.lang.String callback, java.lang.String helpMessage)
           
 UpdateModeButton createUpdateModeButton(java.awt.Component parent)
           
 void dbg(java.lang.String msg)
           
static AttribsControls getAttribsControls(FigBasicEditor editor)
          create a return a collection of all FIG attribute controls (e.g.
 java.awt.Point[] getCoords(java.lang.String s)
          parse the text from the coordsTextArea and reconstruct the world coordinates, put them into an array and return a reference to this array.
 int getObjectAlignXMode()
           
 int getObjectAlignYMode()
           
 int getSmartLinksMode()
           
 FigAttribs getValues(FigAttribs attr)
          getValues --- set the values for 'attr' from the currently selected GUI values.
 void invertUpdateStatus()
           
static void main(java.lang.String[] argv)
          simple self test
static void msg(java.lang.String msg)
           
 void retrievePoints(FigObject object, java.awt.TextArea coordsTextArea)
           
 void retrievePoints(FigObject object, java.awt.TextField coordsTextField)
           
 void selectFont(FigAttribs attr, FontStateButton fontSelectButton)
           
 void setArrowMode(FigAttribs attr, StateButton arrowModeButton)
          the arrowModeButton has icons 'none', 'forward', 'backward', 'both'
 void setArrowStyle(FigAttribs attr, StateButton arrowStyleButton)
          the arrowStyleButton has icons 'simple arrow' ...
 void setBArrowLength(FigAttribs attr, TextFieldWithHelpMessage field)
           
 void setBArrowThickness(FigAttribs attr, TextFieldWithHelpMessage field)
           
 void setBArrowWidth(FigAttribs attr, TextFieldWithHelpMessage field)
           
 void setCornerRadius(FigAttribs attr, NumericStateButton roundRectButton)
          cornerRadius in pixels (at 2400dpi) is 96*cornerRadius in mm
 void setDashLength(FigAttribs attr, TextFieldWithHelpMessage dashLengthField)
           
 void setDepth(FigAttribs attr, NumericStateButton depthButton)
          get depth (layer) within [0 ..
 void setFArrowLength(FigAttribs attr, TextFieldWithHelpMessage field)
           
 void setFArrowThickness(FigAttribs attr, TextFieldWithHelpMessage field)
           
 void setFArrowWidth(FigAttribs attr, TextFieldWithHelpMessage field)
           
 void setFillColor(FigAttribs attr, ColorStateButton fillColorButton)
           
 void setFillPattern(FigAttribs attr, FillPatternButton FBP)
          set the fill style / fill pattern variables in the FigAttribs "attr" object from the current settings of FillPatternButton FBP.
 void setFillStyleOld(FigAttribs attr, StateButton fillStyleButton)
          the fillStyleButton has icons 'none', 'solid', 'pattern'
 void setFontFlags(FigAttribs attr, ChoiceWithHelpMessage fontFlagChoice)
           
 void setFontSize(FigAttribs attr, NumericStateButton fontSizeButton)
           
 void setJustificationMode(FigAttribs attr, ChoiceWithHelpMessage centerFlushLeftChoice)
           
 void setLandscapeMode(FigAttribs attr, ChoiceWithHelpMessage landscapePortraitChoice)
           
 void setLineColor(FigAttribs attr, ColorStateButton lineColorButton)
          set the attribs line color to the lineColorButton selection
 void setLineStyle(FigAttribs attr, StateButton lineStyleButton)
          the lineStyleButton has icons 'solid', 'dashed', 'dotted'
 void setLineWidth(FigAttribs attr, StateButton lineWidthButton)
           
 void setRotationAngle(FigAttribs attr, NumericStateButton rotationAngleButton)
           
 void setSnapMode(FigAttribs attr, StateButton snapModeButton)
           
 void setStatusMessage(StatusMessage _helper)
           
 void setTextAlignment(FigAttribs attr, StateButton textAlignButton)
          the textAlignButton has icons 'left', 'center', 'right'
 void setUpdateMode(boolean enable)
           
 void setUpdateStatusAll()
           
 void setUpdateStatusNone()
           
 void showArrowMode(FigAttribs attr, StateButton arrowModeButton)
           
 void showArrowStyle(FigAttribs attr, StateButton arrowStyleButton)
           
 void showBArrowLength(FigAttribs attr, TextFieldWithHelpMessage field)
           
 void showBArrowThickness(FigAttribs attr, TextFieldWithHelpMessage field)
           
 void showBArrowWidth(FigAttribs attr, TextFieldWithHelpMessage field)
           
 void showCoords(java.awt.Point[] wcp, java.awt.TextArea coordsTextArea)
          display the (2400 dpi world) coordinates given by the Points in wcp[] in editable form in our coordsTextArea.
 void showCoords(java.awt.Point[] wcp, java.awt.TextField coordsTextField)
           
 void showCoords(java.awt.Point wcp, java.awt.TextField coordsTextField)
           
 void showCornerRadius(FigAttribs attr, NumericStateButton roundRectButton)
           
 void showDashLength(FigAttribs attr, TextFieldWithHelpMessage dashLengthField)
           
 void showDepth(FigAttribs attr, NumericStateButton depthButton)
           
 void showFArrowLength(FigAttribs attr, TextFieldWithHelpMessage field)
           
 void showFArrowThickness(FigAttribs attr, TextFieldWithHelpMessage field)
           
 void showFArrowWidth(FigAttribs attr, TextFieldWithHelpMessage field)
           
 void showFillColor(FigAttribs attr, ColorStateButton fillColorButton)
           
 void showFillPattern(FigAttribs attr, FillPatternButton FPB)
           
 void showFillStyle(FigAttribs attr, StateButton fillStyleButton)
           
 void showFontFlags(FigAttribs attr, ChoiceWithHelpMessage fontFlagChoice)
           
 void showFontName(FigAttribs attr, FontStateButton fontButton)
           
 void showFontSize(FigAttribs attr, NumericStateButton fontSizeButton)
           
 void showJustificationMode(FigAttribs attr, ChoiceWithHelpMessage centerFlushLeftChoice)
           
 void showLandscapeMode(FigAttribs attr, ChoiceWithHelpMessage landscapePortraitChoice)
           
 void showLineColor(FigAttribs attr, ColorStateButton lineColorButton)
           
 void showLineStyle(FigAttribs attr, StateButton lineStyleButton)
           
 void showLineWidth(FigAttribs attr, StateButton lineWidthButton)
          set current line Width, lineWidthButton has icons '0' '1' ..
 void showRotationAngle(FigAttribs attr, NumericStateButton rotationAngleButton)
           
 void showTextAlignment(FigAttribs attr, StateButton textAlignButton)
           
 void showValues(FigAttribs attr)
          update all the GUI controls to reflect the current attribute values from object 'attr'
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

debug

boolean debug

updateModeButton

UpdateModeButton updateModeButton

snapModeButton

StateButton snapModeButton

landscapePortraitChoice

ChoiceWithHelpMessage landscapePortraitChoice

centerFlushLeftChoice

ChoiceWithHelpMessage centerFlushLeftChoice

lineStyleButton

StateButton lineStyleButton

lineWidthButton

StateButton lineWidthButton

lineColorButton

ColorStateButton lineColorButton

arrowModeButton

StateButton arrowModeButton

arrowStyleButton

StateButton arrowStyleButton

fillStyleButton

StateButton fillStyleButton

fillPatternButton

FillPatternButton fillPatternButton

fillColorButton

ColorStateButton fillColorButton

textAlignButton

StateButton textAlignButton

fontSelectButton

FontStateButton fontSelectButton

fontSizeButton

NumericStateButton fontSizeButton

fontFlagChoice

ChoiceWithHelpMessage fontFlagChoice

objectAlignXButton

StateButton objectAlignXButton

objectAlignYButton

StateButton objectAlignYButton

roundRectButton

NumericStateButton roundRectButton

depthButton

NumericStateButton depthButton

dashLengthField

TextFieldWithHelpMessage dashLengthField

rotationAngleButton

NumericStateButton rotationAngleButton

smartLinksButton

StateButton smartLinksButton

colorCache

ColorCache colorCache

helper

StatusMessage helper

allicons

java.awt.Image allicons

iconImages

java.awt.Image[] iconImages
Method Detail

getAttribsControls

public static AttribsControls getAttribsControls(FigBasicEditor editor)
create a return a collection of all FIG attribute controls (e.g. line width, line style, line color, ... text rotation angle). The "editor" argument is just used to decide whether to create a new set of controls or to return a reference to a previously created for the same editor.


setStatusMessage

public void setStatusMessage(StatusMessage _helper)

createUpdateModeButton

public UpdateModeButton createUpdateModeButton(java.awt.Component parent)

createLineStyleButton

public StateButton createLineStyleButton(java.awt.Component parent)

createLineColorButton

public ColorStateButton createLineColorButton(java.awt.Component parent)

createFillPatternButton

public FillPatternButton createFillPatternButton(java.awt.Component parent)

createFillStyleButton

public StateButton createFillStyleButton(java.awt.Component parent)

createSmartLinksButton

public StateButton createSmartLinksButton(java.awt.Component parent)

createFillColorButton

public ColorStateButton createFillColorButton(java.awt.Component parent)

createArrowStyleButton

public StateButton createArrowStyleButton(java.awt.Component parent)

createArrowModeButton

public StateButton createArrowModeButton(java.awt.Component parent)

createFrontArrowWidthField

public TextFieldWithHelpMessage createFrontArrowWidthField(java.awt.Component parent)

createFrontArrowLengthField

public TextFieldWithHelpMessage createFrontArrowLengthField(java.awt.Component parent)

createFrontArrowThicknessField

public TextFieldWithHelpMessage createFrontArrowThicknessField(java.awt.Component parent)

createBackArrowWidthField

public TextFieldWithHelpMessage createBackArrowWidthField(java.awt.Component parent)

createBackArrowLengthField

public TextFieldWithHelpMessage createBackArrowLengthField(java.awt.Component parent)

createBackArrowThicknessField

public TextFieldWithHelpMessage createBackArrowThicknessField(java.awt.Component parent)

createTextAlignButton

public StateButton createTextAlignButton(java.awt.Component parent)

createFontSelectButton

public FontStateButton createFontSelectButton(java.awt.Component parent)

createFontSizeButton

public NumericStateButton createFontSizeButton(java.awt.Component parent)

createFontFlagChoice

public ChoiceWithHelpMessage createFontFlagChoice(java.awt.Component parent)

createLineWidthButton

public StateButton createLineWidthButton(java.awt.Component parent)

createRoundRectButton

public NumericStateButton createRoundRectButton(java.awt.Component parent)

createDepthButton

public NumericStateButton createDepthButton(java.awt.Component parent)

createDashLengthField

public TextFieldWithHelpMessage createDashLengthField(java.awt.Component parent)

createSnapModeButton

public StateButton createSnapModeButton(java.awt.Component parent)

createObjectAlignXButton

public StateButton createObjectAlignXButton(java.awt.Component parent)

createObjectAlignYButton

public StateButton createObjectAlignYButton(java.awt.Component parent)

createRotationButton

public NumericStateButton createRotationButton(java.awt.Component parent)

createLandscapePortraitChoice

public ChoiceWithHelpMessage createLandscapePortraitChoice(java.awt.Component parent)

createCenterFlushLeftChoice

public ChoiceWithHelpMessage createCenterFlushLeftChoice(java.awt.Component parent)

createUpdateMaskButton

public StateButton createUpdateMaskButton(java.awt.Component parent,
                                          java.lang.String callback,
                                          java.lang.String helpMessage)

buildPanel

public java.awt.Panel buildPanel(java.awt.Component parent)

getObjectAlignXMode

public int getObjectAlignXMode()

getObjectAlignYMode

public int getObjectAlignYMode()

getSmartLinksMode

public int getSmartLinksMode()

getValues

public FigAttribs getValues(FigAttribs attr)
getValues --- set the values for 'attr' from the currently selected GUI values.

Parameters:
attr - the FigAttribs class object to modify. A new object will be created if this parameter is null.
Returns:
values a FigAttribs class object with all attributes.

setDepth

public void setDepth(FigAttribs attr,
                     NumericStateButton depthButton)
get depth (layer) within [0 .. 999]. Values outside this range are silently truncated. Illegal numbers result in the value '10'.


setDashLength

public void setDashLength(FigAttribs attr,
                          TextFieldWithHelpMessage dashLengthField)

setLineWidth

public void setLineWidth(FigAttribs attr,
                         StateButton lineWidthButton)

setLineStyle

public void setLineStyle(FigAttribs attr,
                         StateButton lineStyleButton)
the lineStyleButton has icons 'solid', 'dashed', 'dotted'


setCornerRadius

public void setCornerRadius(FigAttribs attr,
                            NumericStateButton roundRectButton)
cornerRadius in pixels (at 2400dpi) is 96*cornerRadius in mm


setLineColor

public void setLineColor(FigAttribs attr,
                         ColorStateButton lineColorButton)
set the attribs line color to the lineColorButton selection


setFillColor

public void setFillColor(FigAttribs attr,
                         ColorStateButton fillColorButton)

setFillPattern

public void setFillPattern(FigAttribs attr,
                           FillPatternButton FBP)
set the fill style / fill pattern variables in the FigAttribs "attr" object from the current settings of FillPatternButton FBP. This method is also responsible to handle the special cases required by the FIG file format for black or white fill colors. Especially, it will convert the out-of-range fill pattern values of 21-40 to the last legal value 20 (the pure color) for black or white fill color. All values from -1, 0, to 56 are legal for other fill colors.


setFillStyleOld

public void setFillStyleOld(FigAttribs attr,
                            StateButton fillStyleButton)
the fillStyleButton has icons 'none', 'solid', 'pattern'


setArrowStyle

public void setArrowStyle(FigAttribs attr,
                          StateButton arrowStyleButton)
the arrowStyleButton has icons 'simple arrow' ... 'solder dot'


setFArrowWidth

public void setFArrowWidth(FigAttribs attr,
                           TextFieldWithHelpMessage field)

setFArrowLength

public void setFArrowLength(FigAttribs attr,
                            TextFieldWithHelpMessage field)

setFArrowThickness

public void setFArrowThickness(FigAttribs attr,
                               TextFieldWithHelpMessage field)

setBArrowWidth

public void setBArrowWidth(FigAttribs attr,
                           TextFieldWithHelpMessage field)

setBArrowLength

public void setBArrowLength(FigAttribs attr,
                            TextFieldWithHelpMessage field)

setBArrowThickness

public void setBArrowThickness(FigAttribs attr,
                               TextFieldWithHelpMessage field)

setArrowMode

public void setArrowMode(FigAttribs attr,
                         StateButton arrowModeButton)
the arrowModeButton has icons 'none', 'forward', 'backward', 'both'


setTextAlignment

public void setTextAlignment(FigAttribs attr,
                             StateButton textAlignButton)
the textAlignButton has icons 'left', 'center', 'right'


setFontSize

public void setFontSize(FigAttribs attr,
                        NumericStateButton fontSizeButton)

setFontFlags

public void setFontFlags(FigAttribs attr,
                         ChoiceWithHelpMessage fontFlagChoice)

selectFont

public void selectFont(FigAttribs attr,
                       FontStateButton fontSelectButton)

setSnapMode

public void setSnapMode(FigAttribs attr,
                        StateButton snapModeButton)

setLandscapeMode

public void setLandscapeMode(FigAttribs attr,
                             ChoiceWithHelpMessage landscapePortraitChoice)

setJustificationMode

public void setJustificationMode(FigAttribs attr,
                                 ChoiceWithHelpMessage centerFlushLeftChoice)

setRotationAngle

public void setRotationAngle(FigAttribs attr,
                             NumericStateButton rotationAngleButton)

showValues

public void showValues(FigAttribs attr)
update all the GUI controls to reflect the current attribute values from object 'attr'


showDepth

public void showDepth(FigAttribs attr,
                      NumericStateButton depthButton)

showDashLength

public void showDashLength(FigAttribs attr,
                           TextFieldWithHelpMessage dashLengthField)

showLineWidth

public void showLineWidth(FigAttribs attr,
                          StateButton lineWidthButton)
set current line Width, lineWidthButton has icons '0' '1' .. '8'


showLineStyle

public void showLineStyle(FigAttribs attr,
                          StateButton lineStyleButton)

showLineColor

public void showLineColor(FigAttribs attr,
                          ColorStateButton lineColorButton)

showFillPattern

public void showFillPattern(FigAttribs attr,
                            FillPatternButton FPB)

showFillStyle

public void showFillStyle(FigAttribs attr,
                          StateButton fillStyleButton)

showFillColor

public void showFillColor(FigAttribs attr,
                          ColorStateButton fillColorButton)

showArrowMode

public void showArrowMode(FigAttribs attr,
                          StateButton arrowModeButton)

showArrowStyle

public void showArrowStyle(FigAttribs attr,
                           StateButton arrowStyleButton)

showFArrowWidth

public void showFArrowWidth(FigAttribs attr,
                            TextFieldWithHelpMessage field)

showFArrowLength

public void showFArrowLength(FigAttribs attr,
                             TextFieldWithHelpMessage field)

showBArrowWidth

public void showBArrowWidth(FigAttribs attr,
                            TextFieldWithHelpMessage field)

showBArrowLength

public void showBArrowLength(FigAttribs attr,
                             TextFieldWithHelpMessage field)

showFArrowThickness

public void showFArrowThickness(FigAttribs attr,
                                TextFieldWithHelpMessage field)

showBArrowThickness

public void showBArrowThickness(FigAttribs attr,
                                TextFieldWithHelpMessage field)

showTextAlignment

public void showTextAlignment(FigAttribs attr,
                              StateButton textAlignButton)

showFontSize

public void showFontSize(FigAttribs attr,
                         NumericStateButton fontSizeButton)

showFontFlags

public void showFontFlags(FigAttribs attr,
                          ChoiceWithHelpMessage fontFlagChoice)

showCornerRadius

public void showCornerRadius(FigAttribs attr,
                             NumericStateButton roundRectButton)

showFontName

public void showFontName(FigAttribs attr,
                         FontStateButton fontButton)

showLandscapeMode

public void showLandscapeMode(FigAttribs attr,
                              ChoiceWithHelpMessage landscapePortraitChoice)

showJustificationMode

public void showJustificationMode(FigAttribs attr,
                                  ChoiceWithHelpMessage centerFlushLeftChoice)

showRotationAngle

public void showRotationAngle(FigAttribs attr,
                              NumericStateButton rotationAngleButton)

setUpdateMode

public void setUpdateMode(boolean enable)

setUpdateStatusAll

public void setUpdateStatusAll()

setUpdateStatusNone

public void setUpdateStatusNone()

invertUpdateStatus

public void invertUpdateStatus()

addUpdateModeButtonListener

public void addUpdateModeButtonListener(java.awt.event.ActionListener AL)

showCoords

public void showCoords(java.awt.Point[] wcp,
                       java.awt.TextArea coordsTextArea)
display the (2400 dpi world) coordinates given by the Points in wcp[] in editable form in our coordsTextArea.


showCoords

public void showCoords(java.awt.Point[] wcp,
                       java.awt.TextField coordsTextField)

showCoords

public void showCoords(java.awt.Point wcp,
                       java.awt.TextField coordsTextField)

retrievePoints

public void retrievePoints(FigObject object,
                           java.awt.TextArea coordsTextArea)

retrievePoints

public void retrievePoints(FigObject object,
                           java.awt.TextField coordsTextField)

getCoords

public java.awt.Point[] getCoords(java.lang.String s)
parse the text from the coordsTextArea and reconstruct the world coordinates, put them into an array and return a reference to this array.


msg

public static void msg(java.lang.String msg)

dbg

public void dbg(java.lang.String msg)

main

public static void main(java.lang.String[] argv)
simple self test