Package ucar.unidata.ui.symbol
Class TextSymbol
java.lang.Object
ucar.unidata.ui.drawing.Glyph
ucar.unidata.ui.drawing.RectangleGlyph
ucar.unidata.ui.symbol.MetSymbol
ucar.unidata.ui.symbol.TextSymbol
- All Implemented Interfaces:
Cloneable
- Direct Known Subclasses:
LabelSymbol
,ValueSymbol
A representation of a text MetSymbol.
- Version:
- $Revision: 1.41 $
- Author:
- Metapps development team
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final String[]
Array of default font sizes used for incrementing/decrementing fonts.protected String
Format string for numbers.Fields inherited from class ucar.unidata.ui.symbol.MetSymbol
ATTR_PARAMID, canvas, propertiesDialog
Fields inherited from class ucar.unidata.ui.drawing.RectangleGlyph
ATTR_RECTTYPE, bounds, CIRCLE, FCIRCLE, FRECTANGLE, FROUNDRECT, RECTANGLE, ROUNDRECT, TYPE_CIRCLE, TYPE_RECT, TYPE_RRECT
Fields inherited from class ucar.unidata.ui.drawing.Glyph
ATTR_BGCOLOR, ATTR_CHILDREN, ATTR_CLASS, ATTR_COLOR, ATTR_FILL, ATTR_HEIGHT, ATTR_IMAGE, ATTR_LINEWIDTH, ATTR_PARENT, ATTR_PTS, ATTR_STRETCHY, ATTR_TEXT, ATTR_TYPE, ATTR_WIDTH, baseline, H_SEL_WIDTH, highlightColor, idToGlyph, MIN_DISTANCE_TO_STRETCH, PT_CENTER, PT_H_LEFT, PT_H_MIDDLE, PT_H_RIGHT, PT_LL, PT_LM, PT_LR, PT_ML, PT_MM, PT_MR, PT_P1, PT_P2, PT_PREFIX, PT_UL, PT_UM, PT_UR, PT_V_LOWER, PT_V_MIDDLE, PT_V_UPPER, RECTPOINTNAMES, RECTPOINTS, SEL_WIDTH, TAG_GLYPH, underline, url
-
Constructor Summary
ConstructorsConstructorDescriptionDefault constructor.TextSymbol
(int x, int y) Construct a TextSymbol at the position specified.TextSymbol
(int x, int y, String param, String paramDesc) Construct a TextSymbol at the position specified.TextSymbol
(String param, String paramDesc) Construct a TextSymbol with the name specified.TextSymbol
(DisplayCanvas canvas, int x, int y) Construct a TextSymbol to use on the canvas specified at the position specified.TextSymbol
(DisplayCanvas canvas, int x, int y, String param, String paramDesc) Construct a TextSymbol to use on the canvas specified at the position specified. -
Method Summary
Modifier and TypeMethodDescriptionvoid
Decrease the font size by one step in the fontSizes array.void
draw
(Graphics2D g, int x, int y, int width, int height) Draw this object to the graphics device.format
(double d) Format a double valuesformat
(float d) Format a floatFormat a RealformatNumber
(double d) Format a number using the format pattern set for this instance.int
Get the current font numbergetFont()
Get the currently used font.static Font[]
Get a list of fonts to use with this object.Get the metrics of the current font.int
Get the current font size.getLabel()
Get the label to show the user what I am in the propertiesGet the format pattern for numeric values.getParamValue
(int index) Get the parameter value for the index specified.getValue()
Get the string representation for the value of this object.protected String
Get the value stringvoid
Increase the font size by one step in the FONT_SIZES array.protected Font
Make a font from the size and using the default.void
setCurrFontNo
(int index) Set the index into the array of font sizes.void
Set the font to use when displaying this symbol.void
setFontSize
(int size) Set the font size.void
Set the format pattern for numeric values.void
setParamValue
(int index, Object v) Set the parameter value for the index specified.void
setValue
(double d) Set the value for this object.void
Set the value for this object.toString()
String representation of this object.Methods inherited from class ucar.unidata.ui.symbol.MetSymbol
addPropertyTabs, applyProperties, clone, cloneMe, closePropertiesDialog, decrSize, doAlignmentMenu, doAllObs, draw, getActive, getBounds, getColorMappings, getColorParam, getColorTable, getColorTableParam, getColorTableRange, getColorTableUnit, getColorTableUnitName, getDesc, getDisplayUnit, getDisplayUnitName, getMissing, getName, getParam, getParamDescs, getParamIds, getRectPoint, getRotateInfo, getRotateXInfo, getRotateYInfo, getRotateZInfo, getScale, getScaleDataRange, getScaleParam, getScaleRange, getScaleUnit, getScaleUnitName, getXOffset, getYOffset, incrSize, initialize, initPropertyComponents, makeShapes, makeShapes, paint, paintSelection, rotateOnEarth, setActive, setAttr, setColorMappings, setColorParam, setColorTable, setColorTableParam, setColorTableRange, setColorTableUnitName, setDisplayUnitName, setMissing, setOffset, setParamDescs, setParamIds, setRectPoint, setRotateDataRange, setRotateParam, setRotateRange, setRotateUnitName, setRotateXInfo, setRotateYInfo, setRotateZInfo, setScale, setScaleDataRange, setScaleParam, setScaleRange, setScaleUnitName, setTheDisplayUnit, shouldBeColored, shouldOffsetShape, shouldScaleShape, shouldShowColorTableGui, shouldShowRotateGui, shouldShowScaleGui, showDisplayUnitInProperties, showPropertiesDialog
Methods inherited from class ucar.unidata.ui.drawing.RectangleGlyph
distance, getBottom, getBounds, getEqualSides, getLeft, getPoint, getPositionAttr, getStretchPoint, getSymetricReshape, getTop, moveBy, moveTo, setPoints, setSize, setType, stretchTo
Methods inherited from class ucar.unidata.ui.drawing.Glyph
boundsChanged, canStretch, distance, doRemove, flipY, getAttrs, getBackground, getBackground, getBeingCreated, getCreateCommand, getCursor, getFilled, getForeground, getId, getLineWidth, getMoveCommand, getPersistent, getPointOnRect, getPointOnRect, getRectPointName, getRepaintBounds, getStretchPoint, getStretchy, getXml, initDone, makeAttr, notifyChange, paintHighlight, paintSelectionPoints, pickable, processAttrs, setBackground, setBeingCreated, setFilled, setForeground, setId, setLineWidth, setParent, setStretchy, stretchTo, stretchTo, toRect, transformOutput, transformOutput, transformOutputX, transformOutputY
-
Field Details
-
numberFormatString
Format string for numbers. -
FONT_SIZES
Array of default font sizes used for incrementing/decrementing fonts.- See Also:
-
-
Constructor Details
-
TextSymbol
public TextSymbol()Default constructor. -
TextSymbol
public TextSymbol(int x, int y) Construct a TextSymbol at the position specified. Use the default name and long name.- Parameters:
x
- x position on the canvasy
- y position on the canvas
-
TextSymbol
Construct a TextSymbol to use on the canvas specified at the position specified. Use the default name and long name.- Parameters:
canvas
- canvas to draw on.x
- x position on the canvasy
- y position on the canvas
-
TextSymbol
Construct a TextSymbol with the name specified.- Parameters:
param
- parameter to displayparamDesc
- description of the parameter (i.e., long name)
-
TextSymbol
Construct a TextSymbol at the position specified.- Parameters:
x
- x position on the canvasy
- y position on the canvasparam
- parameter to displayparamDesc
- description of the parameter (i.e., long name)
-
TextSymbol
Construct a TextSymbol to use on the canvas specified at the position specified.- Parameters:
canvas
- canvas to draw on.x
- x position on the canvasy
- y position on the canvasparam
- parameter to displayparamDesc
- description of the parameter (i.e., long name)
-
-
Method Details
-
getLabel
Get the label to show the user what I am in the properties -
setFont
Set the font to use when displaying this symbol.- Parameters:
font
- font to use.
-
getFont
Get the currently used font.- Returns:
- current font. May be
null
-
incrFontSize
public void incrFontSize()Increase the font size by one step in the FONT_SIZES array. -
decrFontSize
public void decrFontSize()Decrease the font size by one step in the fontSizes array. -
getFontList
Get a list of fonts to use with this object.- Returns:
- array of fonts
-
setCurrFontNo
public void setCurrFontNo(int index) Set the index into the array of font sizes.- Parameters:
index
- index into theFONT_SIZES
array
-
getCurrFontNo
public int getCurrFontNo()Get the current font number- Returns:
- index of current font in the
FONT_SIZES
array.
-
getFontMetrics
Get the metrics of the current font.- Returns:
- current font metrics.
-
setFontSize
public void setFontSize(int size) Set the font size.- Parameters:
size
- point size of font.
-
getFontSize
public int getFontSize()Get the current font size.- Returns:
- currentFontSize
-
getValueString
Get the value string- Returns:
- a string representation of the size
-
getNumberFormatString
Get the format pattern for numeric values.- Returns:
- formatting pattern string.
- See Also:
-
setNumberFormatString
Set the format pattern for numeric values.- Parameters:
s
- formatting pattern string.- See Also:
-
formatNumber
Format a number using the format pattern set for this instance.- Parameters:
d
- double to format- Returns:
- formatted number as a String
- See Also:
-
format
Format a Real- Parameters:
d
- the Real- Returns:
- the formatted value
-
format
Format a double values- Parameters:
d
- the double- Returns:
- formatted number
-
format
Format a float- Parameters:
d
- float- Returns:
- the formatted number
-
getValue
Get the string representation for the value of this object.- Returns:
- String representation of number.
-
setValue
public void setValue(double d) Set the value for this object.- Parameters:
d
- value
-
setValue
Set the value for this object.- Parameters:
s
- String representation of the value for this object.
-
getParamValue
Get the parameter value for the index specified.- Overrides:
getParamValue
in classMetSymbol
- Parameters:
index
- index of the parameter (ignored for this instance)- Returns:
- String value associated with this instance.
-
setParamValue
Set the parameter value for the index specified.- Overrides:
setParamValue
in classMetSymbol
- Parameters:
index
- index of the parameter (ignored for this instance)v
-Object
that this should represent
-
draw
Draw this object to the graphics device. -
toString
String representation of this object. -
makeDefaultFont
Make a font from the size and using the default.- Returns:
- a default Font
-