|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectsimtools.shapes.AbstractShape
jsynoptic.builtin.Abstract1DShape
jsynoptic.builtin.Abstract2DShape
jsynoptic.builtin.TextShape
public class TextShape
This shape displays some texts, and fits it to its dimensions.
Nested Class Summary | |
---|---|
static class |
TextShape.TextShapePropertiesNames
|
Nested classes/interfaces inherited from class jsynoptic.builtin.Abstract2DShape |
---|
Abstract2DShape.Abstract2DShapePropertiesNames |
Nested classes/interfaces inherited from class jsynoptic.builtin.Abstract1DShape |
---|
Abstract1DShape.Abstract1DShapePropertiesNames |
Nested classes/interfaces inherited from class simtools.shapes.AbstractShape |
---|
AbstractShape.AbstractShapePropertiesNames |
Field Summary | |
---|---|
protected int |
baseline
|
protected boolean |
boldFont
|
protected java.lang.Integer |
charNumber
When frame is locked, number of charcter to dispay in frame |
protected java.awt.Font |
currentFont
|
static java.lang.String |
dateFormatPattern
|
protected java.text.DateFormat |
dateTimeFormatter
|
protected java.text.NumberFormat |
decimalFormatter
|
static boolean |
DEFAULT_DISPLAY_COMMENTS
|
static boolean |
DEFAULT_DISPLAY_NAME
|
static boolean |
DEFAULT_DISPLAY_UNIT
|
static boolean |
DEFAULT_DISPLAY_VALUE
|
static boolean |
DEFAULT_FIXED_FONT
|
static boolean |
DEFAULT_FIXED_FRAME
|
static int |
DEFAULT_FORMAT
|
static java.lang.String |
DEFAULT_TEXT_FONT
|
static int |
DEFAULT_TEXT_SIZE
|
static int |
DEFAUT_CHAR_NUMBER
|
protected boolean |
dirtyColor
|
protected boolean |
dirtyState
|
protected boolean |
dirtyText
|
protected java.lang.Boolean |
displayDsComments
|
protected java.lang.Boolean |
displayDsName
|
protected java.lang.Boolean |
displayDsUnit
|
protected java.lang.Boolean |
displayDsValue
|
protected java.lang.String |
displayPattern
Deprecated. use printf format instead |
protected java.lang.String |
fontName
|
protected int |
fontSize
|
protected double |
fontYScaleFactor
when the margin is not enabled, it is necessary to multiply the size of the font in Y to remove the line spacing, so that the text can be framed directly with the bounding box |
protected int |
format
|
static int |
FORMAT_BINARY
|
static int |
FORMAT_DATE
|
static int |
FORMAT_DATE_TIME
|
static int |
FORMAT_DECIMAL
|
static int |
FORMAT_HEXADECIMAL
|
static int |
FORMAT_MAPPER
|
static int |
FORMAT_OCTAL
|
static int |
FORMAT_PRINTF
|
static int |
FORMAT_SCIENTIFIC
|
static int |
FORMAT_STRING
|
static int |
FORMAT_TIME
|
static int |
FORMAT_USE_DATA_SOURCE
|
static boolean |
groupTextDigits
|
protected boolean |
italicFont
|
protected boolean |
lockedFont
When the font is locked, the text never auto-adjusts to the size Default is true |
protected boolean |
lockedFrame
When the frame is locked, - the text never auto-adjusts to the size - The frame is determinated according to a number of characters to display, and cannot be rezized Default is false |
static java.lang.String |
longTimeFormatPattern
|
protected TextMapper |
mapper
|
protected boolean |
marginEnabled
When margin is enabled, the text is not framed directly with the bounding box, but has margins with MARGINX and MARGINY values Default is true |
static int |
MARGINX
|
static int |
MARGINY
|
static int |
MIN_HEIGHT
|
static int |
MIN_WIDTH
|
protected java.lang.String |
printfFormat
|
protected PrintfFormat |
printfFormater
|
protected java.awt.Font |
referenceFont
|
protected java.awt.FontMetrics |
referenceFontMetrics
|
protected static java.awt.Graphics |
referenceGraphics
|
protected static java.lang.Object |
referenceMutex
|
static java.util.ResourceBundle |
resources
|
protected java.text.NumberFormat |
scientificFormatter
|
static java.lang.String |
shortTimeFormatPattern
|
protected DataSource |
source
|
protected long |
sourceIndex
|
protected java.lang.String |
text
|
protected java.awt.Color |
textColor
|
protected java.awt.Color |
textDynamicColor
|
protected ColorMapper |
textMapper
|
protected long |
textMapperIndex
|
protected DataSource |
textMapperSource
|
static java.lang.String |
timeZone
|
Fields inherited from class jsynoptic.builtin.Abstract2DShape |
---|
dirtyFillColor, fillColor, fillDynamicColor, fillMapper, fillMapperIndex, fillMapperSource |
Fields inherited from class jsynoptic.builtin.Abstract1DShape |
---|
allowResize, bounds2D, delegateEndNotificationListener, dirty, dirtyDrawColor, dirtyRectangle, drawColor, drawDynamicColor, drawMapper, drawMapperIndex, drawMapperSource, fixedRatio, link, MIN_SIZE, ratio, stroke, strokeParams, transform |
Fields inherited from class simtools.shapes.AbstractShape |
---|
_h, _ox, _oy, _propertyNames, _w, _x, _y, ANTI_ALIASING, currentDialogBox, FONT_NAMES, listeners, REFRESH_PERIOD |
Fields inherited from interface jsynoptic.base.ContextualActionProvider |
---|
EDITOR_CONTEXT, MOUSE_OUT_CONTEXT, MOUSE_OVER_CONTEXT, MOUSE_PRESSED_CONTEXT, SHAPELIST_CONTEXT, SOURCELIST_CONTEXT |
Constructor Summary | |
---|---|
TextShape(java.lang.String text,
int width,
int height)
|
|
TextShape(java.lang.String text,
int x,
int y,
int width,
int height)
|
Method Summary | |
---|---|
boolean |
addDataSource(DataSource d)
|
boolean |
canAddDataSource(DataSource d)
|
protected boolean |
canResize()
Allow resize: it is possible to forbid shape resizing even the allow resize property has been set to true by user. |
protected AbstractShape |
cloneShape()
Performs a copy of the shape This method has to be overriden to deal with concrete shapes |
protected void |
computeBaseLine()
Compute base line used with a not scaled font |
protected void |
constructor()
|
JPropertiesPanel |
createPanel()
|
JPropertiesPanel |
createPanel(boolean showTransfrom)
|
void |
DataSourceIndexRangeChanged(DataSource ds,
long startIndex,
long lastIndex)
Called when the range of valid index changed |
void |
DataSourceReplaced(DataSource oldData,
DataSource newData)
Called when a data source is replaced by another one |
void |
DataSourceValueChanged(DataSource ds,
long minIndex,
long maxIndex)
Called when at least a value changed in the data source. |
boolean |
doAction(double x,
double y,
java.lang.Object o,
java.lang.String action,
javax.swing.undo.CompoundEdit undoableEdit)
Do one of the actions previously declared by getAction. |
protected void |
drawHook(java.awt.Graphics2D g,
boolean shapeDrawn)
For subclasses, called before restoring original graphics properties, after the delegate shape is drawn if shapeDrawn is true, or after saving the current context, before the delegate shape is drawn if shapeDrawn is false |
void |
fitBounds()
Used to make the bounds best fit the current size text size |
void |
fitText()
Used to make the text best fit the current size |
java.lang.String |
formatSourceValue(java.lang.Object o)
Gets a new text value for this shape. |
java.lang.String[] |
getActions(double x,
double y,
java.lang.Object o,
int context)
Return list of possible actions the contect information may be used, or not. |
java.util.LinkedHashMap |
getCollectiveActions(DiagramSelection sel,
double x,
double y,
java.lang.Object o,
int context)
Return list of possible collective actions |
protected java.awt.Shape |
getDelegateShape()
|
java.lang.String[] |
getPropertyNames()
Get the list of property names |
java.lang.Object |
getPropertyValue(java.lang.String name)
Get the value of the property named name |
protected java.lang.Object |
getSourceValue()
|
java.lang.String |
getText()
|
java.awt.Color |
getTextColor()
|
boolean |
isDirtyState()
|
void |
mappingChanged(GenericMapper mapper)
Called when the mapping of the specified mapper changed |
void |
notificationEnd(java.lang.Object referer)
This callback is called after all notifications were processed. |
protected void |
notifyChange(java.awt.Rectangle changedArea)
|
void |
resize(int dx,
int dy)
Resize uses an increment for width and height. |
protected void |
setCharNumber(java.lang.Integer charNumber)
|
void |
setDelegateEndNotificationListener(EndNotificationListener denl)
This is useful if this shape belongs to an array of multiple text shapes, in which cas it is better to register the delegate if is is notified only once at each notification end Note1 : take care of read Objects too Note2 : don't forget to use this shape default handler if necessary |
void |
setDimensions(int width,
int height)
Set dimensions and fits the text to the new dimensions. |
void |
setDirtyState(boolean dirtyState)
|
boolean |
setFont(java.awt.Font f)
|
protected void |
setFormat(int f)
|
void |
setLockedFont(boolean lockedFont)
|
void |
setLockedFrame(boolean lockedFrame)
|
void |
setPrintfFormat(java.lang.String printfFormat)
|
void |
setPropertyValue(java.lang.String name,
java.lang.Object value)
Assigns value to the property named name |
void |
setSource(DataSource ds)
|
void |
setText(java.lang.String text)
Set current text. |
protected void |
synchronizeFormat()
|
void |
updateFont()
|
boolean |
updateText()
Updates the current text, by reading the data source value if connected to a data source Then, notify the system to update the display |
Methods inherited from class jsynoptic.builtin.Abstract2DShape |
---|
createPanel, draw, fillHook, getFillColor |
Methods inherited from class jsynoptic.builtin.Abstract1DShape |
---|
canDoAction, contains, contains, contains, contains, DataSourceInfoChanged, DataSourceOrderChanged, DataSourceValueRangeChanged, doCollectiveAction, getBounds, getBounds2D, getDelegateEndNotificationListener, getDrawColor, getDx, getDy, getLink, getPathIterator, getPathIterator, intersects, intersects, setAnchor, setLink, translate, updateBounds, updateTransform |
Methods inherited from class simtools.shapes.AbstractShape |
---|
addListener, getAnchor, getInnerProperties, getMax, getMaxTranslated, getMin, notifyChange, refresh, removeListener, setAnchor, setProperties, wipeOff |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Methods inherited from interface jsynoptic.base.SelectionContextualActionProvider |
---|
doCollectiveAction |
Methods inherited from interface jsynoptic.base.ContextualActionProvider |
---|
canDoAction |
Methods inherited from interface simtools.data.DataSourceListener |
---|
DataSourceInfoChanged, DataSourceOrderChanged, DataSourceValueRangeChanged |
Field Detail |
---|
public static java.util.ResourceBundle resources
public static final int FORMAT_STRING
public static final int FORMAT_DECIMAL
public static final int FORMAT_SCIENTIFIC
public static final int FORMAT_HEXADECIMAL
public static final int FORMAT_OCTAL
public static final int FORMAT_BINARY
public static final int FORMAT_MAPPER
public static final int FORMAT_DATE
public static final int FORMAT_TIME
public static final int FORMAT_DATE_TIME
public static final int FORMAT_PRINTF
public static final int FORMAT_USE_DATA_SOURCE
public static final int MIN_WIDTH
public static final int MIN_HEIGHT
public static final int MARGINX
public static final int MARGINY
public static boolean DEFAULT_FIXED_FONT
public static boolean DEFAULT_FIXED_FRAME
public static int DEFAUT_CHAR_NUMBER
public static int DEFAULT_TEXT_SIZE
public static java.lang.String DEFAULT_TEXT_FONT
public static int DEFAULT_FORMAT
public static boolean DEFAULT_DISPLAY_NAME
public static boolean DEFAULT_DISPLAY_VALUE
public static boolean DEFAULT_DISPLAY_UNIT
public static boolean DEFAULT_DISPLAY_COMMENTS
public static java.lang.String dateFormatPattern
public static java.lang.String shortTimeFormatPattern
public static java.lang.String longTimeFormatPattern
protected int format
protected java.lang.String printfFormat
protected transient PrintfFormat printfFormater
protected java.text.NumberFormat decimalFormatter
protected java.text.NumberFormat scientificFormatter
public static boolean groupTextDigits
protected java.text.DateFormat dateTimeFormatter
public static java.lang.String timeZone
protected TextMapper mapper
protected java.lang.String displayPattern
protected java.lang.Boolean displayDsName
protected java.lang.Boolean displayDsValue
protected java.lang.Boolean displayDsUnit
protected java.lang.Boolean displayDsComments
protected java.lang.String text
protected transient DataSource source
protected transient long sourceIndex
protected java.awt.Color textColor
protected transient java.awt.Color textDynamicColor
protected ColorMapper textMapper
protected transient DataSource textMapperSource
protected transient long textMapperIndex
protected static java.lang.Object referenceMutex
protected static java.awt.Graphics referenceGraphics
protected transient int baseline
protected transient java.awt.Font currentFont
protected transient java.awt.FontMetrics referenceFontMetrics
protected transient java.awt.Font referenceFont
protected transient boolean dirtyText
protected transient boolean dirtyColor
protected transient boolean dirtyState
protected java.lang.String fontName
protected int fontSize
protected boolean boldFont
protected boolean italicFont
protected boolean lockedFont
protected boolean lockedFrame
protected java.lang.Integer charNumber
protected boolean marginEnabled
protected final transient double fontYScaleFactor
Constructor Detail |
---|
public TextShape(java.lang.String text, int width, int height)
public TextShape(java.lang.String text, int x, int y, int width, int height)
Method Detail |
---|
public void setPrintfFormat(java.lang.String printfFormat)
printfFormat
- the string value to apply to printf formatprotected void setFormat(int f)
format
- public java.lang.String getText()
public void setText(java.lang.String text)
text
- protected java.lang.Object getSourceValue() throws DataException
DataException
public java.lang.String formatSourceValue(java.lang.Object o)
o.
- Any object. If this is a Number, it will be
formatted.Otherwise, toString() is used.
protected java.awt.Shape getDelegateShape()
getDelegateShape
in class Abstract1DShape
protected void constructor()
public boolean setFont(java.awt.Font f)
public void setLockedFont(boolean lockedFont)
public void setLockedFrame(boolean lockedFrame)
protected void setCharNumber(java.lang.Integer charNumber)
protected boolean canResize()
Abstract1DShape
canResize
in class Abstract1DShape
public void updateFont()
public void setDelegateEndNotificationListener(EndNotificationListener denl)
Abstract1DShape
setDelegateEndNotificationListener
in class Abstract2DShape
protected void drawHook(java.awt.Graphics2D g, boolean shapeDrawn)
Abstract1DShape
drawHook
in class Abstract1DShape
public void setDimensions(int width, int height)
public void resize(int dx, int dy)
resize
in interface Resizable
resize
in class Abstract1DShape
dx
- value on x axisdy
- value on y axispublic void fitBounds()
protected void computeBaseLine()
public void fitText()
public boolean updateText()
readAgainFromSource
- Can be set to false to prevent reading the text from the
sourcepublic void DataSourceValueChanged(DataSource ds, long minIndex, long maxIndex)
DataSourceListener
DataSourceValueChanged
in interface DataSourceListener
DataSourceValueChanged
in class Abstract2DShape
ds
- The data source that changedminIndex
- Lower bound of the range where values changedmaxIndex
- Higher bound of the range where values changedpublic void DataSourceIndexRangeChanged(DataSource ds, long startIndex, long lastIndex)
DataSourceListener
DataSourceIndexRangeChanged
in interface DataSourceListener
DataSourceIndexRangeChanged
in class Abstract2DShape
ds
- The data source that changedstartIndex
- The new start IndexlastIndex
- The new last indexpublic void DataSourceReplaced(DataSource oldData, DataSource newData)
DataSourceListener
DataSourceReplaced
in interface DataSourceListener
DataSourceReplaced
in class Abstract2DShape
public java.awt.Color getTextColor()
public void notificationEnd(java.lang.Object referer)
EndNotificationListener
notificationEnd
in interface EndNotificationListener
notificationEnd
in class Abstract2DShape
public java.lang.String[] getActions(double x, double y, java.lang.Object o, int context)
ContextualActionProvider
getActions
in interface ContextualActionProvider
getActions
in class Abstract1DShape
x
- Coordinate, mouse position in the same unit as contains(x,y)y
- Coordinate, mouse position in the same unit as contains(x,y)o
- Object the actions should work on. Possibly null => default or all actionscontext
- one of the context defined in the ContextualActionProvider class
public void setSource(DataSource ds)
public java.util.LinkedHashMap getCollectiveActions(DiagramSelection sel, double x, double y, java.lang.Object o, int context)
SelectionContextualActionProvider
getCollectiveActions
in interface SelectionContextualActionProvider
getCollectiveActions
in class Abstract1DShape
sel
- the current selectionx
- Coordinate, mouse position in the same unit as contains(x,y)y
- Coordinate, mouse position in the same unit as contains(x,y)o
- Object the collective actions should work on. Possibly null => default or all actionscontext
- one of the context defined in the ContextualActionProvider class
public boolean doAction(double x, double y, java.lang.Object o, java.lang.String action, javax.swing.undo.CompoundEdit undoableEdit)
ContextualActionProvider
doAction
in interface ContextualActionProvider
doAction
in class Abstract1DShape
x
- Coordinate, for example mouse positiony
- Coordinate, for example mouse positiono
- Object the action should work on.action
- An action returned by a previous getActions call with the same x, y, o parameters
It may be null, in which case the default action is requested for this x,y,o.undoableEdit
- current edit for undo/redo operation
If not null, this action is undoable.
public JPropertiesPanel createPanel()
createPanel
in class Abstract1DShape
public JPropertiesPanel createPanel(boolean showTransfrom)
protected void synchronizeFormat()
protected AbstractShape cloneShape()
Abstract2DShape
cloneShape
in class Abstract2DShape
public void mappingChanged(GenericMapper mapper)
MapperListener
mappingChanged
in interface MapperListener
protected void notifyChange(java.awt.Rectangle changedArea)
notifyChange
in class AbstractShape
public boolean isDirtyState()
public void setDirtyState(boolean dirtyState)
dirtyState
- The dirtyState to set.public boolean addDataSource(DataSource d)
addDataSource
in interface DataSourceConsumer
d
- the data source to be added
public boolean canAddDataSource(DataSource d)
canAddDataSource
in interface DataSourceConsumer
d
- the data source to be added
public java.lang.Object getPropertyValue(java.lang.String name)
AbstractShape
name
getPropertyValue
in interface NamedProperties
getPropertyValue
in class Abstract2DShape
name
- the name of the property to get
AbstractShape.getPropertyValue(String)
public void setPropertyValue(java.lang.String name, java.lang.Object value)
AbstractShape
value
to the property named name
setPropertyValue
in interface NamedProperties
setPropertyValue
in class Abstract2DShape
name
- the name of the property to getvalue
- its new valueAbstractShape.setPropertyValue(String, Object)
public java.lang.String[] getPropertyNames()
NamedProperties
getPropertyNames
in interface NamedProperties
getPropertyNames
in class Abstract2DShape
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |