Class JDObject
java.lang.Object
fr.esrf.tangoatk.widget.util.jdraw.JDObject
- Direct Known Subclasses:
JDLine,JDPolyline,JDRectangular
An abstract class for the JDraw graphics objects. This class handle all common properties
of JDObject.
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final intHatch fill stylestatic final intHatch fill stylestatic final intHatch fill stylestatic final intGradient fill stylestatic final intHatch fill stylestatic final intHatch fill stylestatic final intHatch fill stylestatic final intNo fillingstatic final intHatch fill stylestatic final intHatch fill stylestatic final intHatch fill stylestatic final intSolid fill stylestatic final intDash line stylestatic final intDash + Dot line stylestatic final intDot line stylestatic final intLong Dash line stylestatic final intSolid line stylestatic final intthe object value receive the x mouse coordinates when dragged (relative to left of object)static final intthe object value receive the x mouse coordinates when dragged (relative to right of object)static final intthe object value receive the y mouse coordinates when dragged (relative to bottom of object)static final intthe object value receive the y mouse coordinates when dragged (relative to top of object)static final intthe object value is incremented (+1) on clickstatic final intthe object value is incremented (+1) on mousePressed or mouseReleased -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidaddExtension(String name) Add an extension to this object.voidAdds the specified mouse listener to this object.voidAdds the specified value listener to this object.voidCenter the origin.voidRemove all mouse listener belonging to this object.voidRemove all value listener belonging to this object.abstract JDObjectcopy(int x, int y) Returns a copy of this object at the specified location.getExtendedParam(int extIdx) Returns the value of the specified extended param, an empty string if not found.getExtendedParam(String name) Returns the value of the specified extended param, an empty string if not found.getExtendedParamDesc(String extName) intgetExtendedParamIndex(String name) getExtendedParamName(int extIdx) Returns the name of the extended param at the specified index.intintintintintintintgetName()voidgetObjectsByName(Vector result, String name, boolean recurseGroup) Return all objects having the given name.intgetSummit(int id) intintgetValue()intbooleanbooleanhasExtendedParam(String name) booleanbooleanbooleanbooleanbooleanbooleanbooleanbooleanbooleanbooleanisFixedExtendedParam(String name) booleanisInsideObject(int x, int y) booleanbooleanbooleanabstract voidmoveSummit(int id, double x, double y) Moves the specifed summit to the specified position.voidmoveSummitH(int id, double x) Moves horizontaly the specifed summit to the specified position.voidmoveSummitV(int id, double y) Moves verticaly the specifed summit to the specified position.abstract voidpaint(JDrawEditor parent, Graphics g) Paints this object.voidPrepare this object to be repainted.voidrefresh()Refresh the JDObject on the screen by repainting its bounding rectangle.voidremoveExtension(int extIdx) Remove the extended param at the specified index.voidRemove the specified mouse listener from this object.voidRemove the specified value listener from this object.voidRestore original shape previously backuped by saveTransformvoidrotate90(double x, double y) Rotate the object by 90deg.voidBackup the shape.voidscale(double x, double y, double rx, double ry) Scale this object.voidscaleTranslate(double scaleX, double scaleY, double ratioX, double ratioY, double transX, double transY) Scale, then translate this object.voidsetAntiAlias(boolean aliasing) Enables or disables the anti aliasing for this object.voidSets the background color (usualy fill color) of this object.voidSets the value program for background color of this object.voidsetDisabled(boolean disabled) voidsetExtendedParam(int extIdx, String value) Sets the extended param value.voidsetExtendedParam(String name, String value) Sets the extended param value.voidsetExtensionList(String[] names) Sets the list of extended parameter name for this object.voidsetFillStyle(int style) Sets the fill style of this object.voidSets the foreground color (usualy line color) of this object.voidSets the value program for foreground color of this object.voidsetGradientFillParam(float x1, float y1, Color color1, float x2, float y2, Color color2, boolean cyclic) Sets the gradient of this object.voidSets the value program for horizontal translation of this object.voidsetInitValue(int i) Sets the init value of this object.voidsetInteractive(boolean b) Enables or disabled the interactivity.voidsetInverseShadow(boolean b) Sets inverse shadow for this object.voidSets the value program for invert shadow of this object.voidsetLineStyle(int style) Sets the line style.voidsetLineWidth(int width) Sets the line width of this object.voidsetMaxValue(int max) Sets the max value of this object.voidsetMinValue(int min) Sets the minimum value of this object.voidSets the name of this object.voidSets the origin of this object.voidsetShadow(boolean b) Enables or disabled shadow for this object.voidsetShadowWidth(int w) Sets the shadow thickness of this object.voidsetValue(int v) Sets the value of this object and execute the dynamic object program if enabled.voidsetValueChangeMode(int m) Sets the value change mode of this object for user interaction.voidSets the value program for visibility of this object.voidsetVisible(boolean b) Shows or hides this object.voidSets the value program for vertical translation of this object.toString()voidtranslate(double x, double y) Translate this object.
-
Field Details
-
LINE_STYLE_SOLID
public static final int LINE_STYLE_SOLIDSolid line style- See Also:
-
LINE_STYLE_DOT
public static final int LINE_STYLE_DOTDot line style- See Also:
-
LINE_STYLE_DASH
public static final int LINE_STYLE_DASHDash line style- See Also:
-
LINE_STYLE_LONG_DASH
public static final int LINE_STYLE_LONG_DASHLong Dash line style- See Also:
-
LINE_STYLE_DASH_DOT
public static final int LINE_STYLE_DASH_DOTDash + Dot line style- See Also:
-
FILL_STYLE_NONE
public static final int FILL_STYLE_NONENo filling- See Also:
-
FILL_STYLE_SOLID
public static final int FILL_STYLE_SOLIDSolid fill style- See Also:
-
FILL_STYLE_LARGE_RIGHT_HATCH
public static final int FILL_STYLE_LARGE_RIGHT_HATCHHatch fill style- See Also:
-
FILL_STYLE_LARGE_LEFT_HATCH
public static final int FILL_STYLE_LARGE_LEFT_HATCHHatch fill style- See Also:
-
FILL_STYLE_LARGE_CROSS_HATCH
public static final int FILL_STYLE_LARGE_CROSS_HATCHHatch fill style- See Also:
-
FILL_STYLE_SMALL_RIGHT_HATCH
public static final int FILL_STYLE_SMALL_RIGHT_HATCHHatch fill style- See Also:
-
FILL_STYLE_SMALL_LEFT_HATCH
public static final int FILL_STYLE_SMALL_LEFT_HATCHHatch fill style- See Also:
-
FILL_STYLE_SMALL_CROSS_HATCH
public static final int FILL_STYLE_SMALL_CROSS_HATCHHatch fill style- See Also:
-
FILL_STYLE_DOT_PATTERN_1
public static final int FILL_STYLE_DOT_PATTERN_1Hatch fill style- See Also:
-
FILL_STYLE_DOT_PATTERN_2
public static final int FILL_STYLE_DOT_PATTERN_2Hatch fill style- See Also:
-
FILL_STYLE_DOT_PATTERN_3
public static final int FILL_STYLE_DOT_PATTERN_3Hatch fill style- See Also:
-
FILL_STYLE_GRADIENT
public static final int FILL_STYLE_GRADIENTGradient fill style- See Also:
-
VALUE_INC_ON_CLICK
public static final int VALUE_INC_ON_CLICKthe object value is incremented (+1) on click- See Also:
-
VALUE_INC_ON_PRESSRELEASE
public static final int VALUE_INC_ON_PRESSRELEASEthe object value is incremented (+1) on mousePressed or mouseReleased- See Also:
-
VALUE_CHANGE_ON_XDRAG_LEFT
public static final int VALUE_CHANGE_ON_XDRAG_LEFTthe object value receive the x mouse coordinates when dragged (relative to left of object)- See Also:
-
VALUE_CHANGE_ON_XDRAG_RIGHT
public static final int VALUE_CHANGE_ON_XDRAG_RIGHTthe object value receive the x mouse coordinates when dragged (relative to right of object)- See Also:
-
VALUE_CHANGE_ON_YDRAG_TOP
public static final int VALUE_CHANGE_ON_YDRAG_TOPthe object value receive the y mouse coordinates when dragged (relative to top of object)- See Also:
-
VALUE_CHANGE_ON_YDRAG_BOTTOM
public static final int VALUE_CHANGE_ON_YDRAG_BOTTOMthe object value receive the y mouse coordinates when dragged (relative to bottom of object)- See Also:
-
-
Constructor Details
-
JDObject
public JDObject()
-
-
Method Details
-
getValue
public int getValue()- Returns:
- the value of this object.
- See Also:
-
setValue
public void setValue(int v) Sets the value of this object and execute the dynamic object program if enabled. If this object is a JDGroup, the specified value is spread all over children of this group.- Parameters:
v- New value
-
addValueListener
Adds the specified value listener to this object.- Parameters:
l- Value listener
-
addMouseListener
Adds the specified mouse listener to this object.- Parameters:
l- JDMouseListener
-
removeValueListener
Remove the specified value listener from this object.- Parameters:
l- Listener to be removed.
-
removeMouseListener
Remove the specified mouse listener from this object.- Parameters:
l- Listener to be removed.
-
clearValueListener
public void clearValueListener()Remove all value listener belonging to this object. -
clearMouseListener
public void clearMouseListener()Remove all mouse listener belonging to this object. -
paint
Paints this object.- Parameters:
parent- JdrawEditor parent (Can be null except for JDSwingObject)g- the specified Graphics window
-
getObjectsByName
Return all objects having the given name.- Parameters:
result- Result vector (must be constructed by the caller)name- JDObject name (Case sensitive)recurseGroup- true to perform a deep search whithin group, false otherwise.- See Also:
-
getBoundRect
- Returns:
- the bounding rectangle of this object.
-
isInsideObject
public boolean isInsideObject(int x, int y) - Parameters:
x- X coordinate (pixel)y- Y coordinate (pixel)- Returns:
- whether the specified point is inside this object.
-
getSummitNumber
public int getSummitNumber()- Returns:
- the summit number of this object.
-
getSummit
- Parameters:
id- Summit index- Returns:
- the summit at the specified position. Do not use this to change summit coordinates, Use moveSummit() instead.
- See Also:
-
moveSummit
public abstract void moveSummit(int id, double x, double y) Moves the specifed summit to the specified position. When using moveSummit() to animate objects, A call to refresh() of this object may be needed.- Parameters:
id- Summit indexx- Absolute X positiony- Absolute Y position- See Also:
-
moveSummitH
public void moveSummitH(int id, double x) Moves horizontaly the specifed summit to the specified position. When using moveSummit() to animate objects, A call to refresh() of this object may be needed.- Parameters:
id- Summit indexx- Absolute X position- See Also:
-
moveSummitV
public void moveSummitV(int id, double y) Moves verticaly the specifed summit to the specified position. When using moveSummit() to animate objects, A call to refresh() of this object may be needed.- Parameters:
id- Summit indexy- Absolute Y position- See Also:
-
copy
Returns a copy of this object at the specified location.- Parameters:
x- Horizontal position of the copied object (pixel)y- Vertical Position of the copied object (pixel)- Returns:
- The copy of this object.
-
translate
public void translate(double x, double y) Translate this object. A call to refresh() is needed after translation.- Parameters:
x- H translationy- V translation- See Also:
-
scaleTranslate
public void scaleTranslate(double scaleX, double scaleY, double ratioX, double ratioY, double transX, double transY) Scale, then translate this object. A call to refresh() is needed after transformation.- Parameters:
scaleX- Scaling originscaleY- Scaling originratioX- H scaling ratioratioY- V scaling rationtransX- H translationtransY- V translation- See Also:
-
scale
public void scale(double x, double y, double rx, double ry) Scale this object. A call to refresh() is needed after transformation.- Parameters:
x- Scaling originy- Scaling originrx- H scaling ratiory- V scaling ration- See Also:
-
rotate90
public void rotate90(double x, double y) Rotate the object by 90deg. A call to refresh() is needed after transformation.- Parameters:
x- Rotation center horizontal posy- Rotation center vertical pos- See Also:
-
restoreTransform
public void restoreTransform()Restore original shape previously backuped by saveTransform- See Also:
-
saveTransform
public void saveTransform()Backup the shape. This can be usefull when making scaling animation, after multiple scale the rounding may result in deformed shape. To avoid this you can use saveTransform() and restoreTransform(). Note: This is done once when JDrawEditor.loadFile() is called().- See Also:
-
setVisible
public void setVisible(boolean b) Shows or hides this object.- Parameters:
b- True to show, false otherwise.
-
isVisible
public boolean isVisible()- Returns:
- whether this object is visible.
-
setName
Sets the name of this object.- Parameters:
s- Object name
-
getName
- Returns:
- the current name of this object.
-
setBackground
Sets the background color (usualy fill color) of this object.- Parameters:
c- Background color
-
getBackground
- Returns:
- the current background color of this object.
- See Also:
-
setForeground
Sets the foreground color (usualy line color) of this object. This color is also used for base shadow color.- Parameters:
c- Foreground color
-
getForeground
- Returns:
- the current foreground color of this object.
- See Also:
-
setOrigin
Sets the origin of this object.- Parameters:
p- Origin point.
-
centerOrigin
public void centerOrigin()Center the origin. -
getOrigin
- Returns:
- the current origin.
-
toString
-
setFillStyle
public void setFillStyle(int style) Sets the fill style of this object.- Parameters:
style- Fill style- See Also:
-
getFillStyle
public int getFillStyle()- Returns:
- the current fill style of this object.
- See Also:
-
setLineStyle
public void setLineStyle(int style) Sets the line style.- Parameters:
style- Line style- See Also:
-
getLineStyle
public int getLineStyle()- Returns:
- the current line style of this object.
- See Also:
-
setAntiAlias
public void setAntiAlias(boolean aliasing) Enables or disables the anti aliasing for this object.- Parameters:
aliasing- True to enable antialiasing, false otherwise
-
isAntiAliased
public boolean isAntiAliased()- Returns:
- wheter this object is anti aliased.
-
setLineWidth
public void setLineWidth(int width) Sets the line width of this object.- Parameters:
width- Line width (pixel)
-
getLineWidth
public int getLineWidth()- Returns:
- the current line width of this object.
-
hasShadow
public boolean hasShadow()- Returns:
- true only if this object is shadowed.
-
setShadow
public void setShadow(boolean b) Enables or disabled shadow for this object. By default shadow represents a lowered bevel border. To change the shadow orientation, you can call setInverseShadow().- Parameters:
b- Shadow flag.- See Also:
-
setShadowWidth
public void setShadowWidth(int w) Sets the shadow thickness of this object.- Parameters:
w- Shadow thickness.
-
getShadowWidth
public int getShadowWidth()- Returns:
- the current shadow thickness.
- See Also:
-
hasInverseShadow
public boolean hasInverseShadow()- Returns:
- whether this object has inverse shadow.
- See Also:
-
setInverseShadow
public void setInverseShadow(boolean b) Sets inverse shadow for this object.- Parameters:
b- Inverse shadow flag.- See Also:
-
setMinValue
public void setMinValue(int min) Sets the minimum value of this object.- Parameters:
min- Min value- See Also:
-
getMinValue
public int getMinValue()- Returns:
- the minimum value of this object.
- See Also:
-
setMaxValue
public void setMaxValue(int max) Sets the max value of this object.- Parameters:
max- Max value- See Also:
-
getMaxValue
public int getMaxValue()- Returns:
- the maximum value of this object.
- See Also:
-
setInitValue
public void setInitValue(int i) Sets the init value of this object.- Parameters:
i- Initial value object.- See Also:
-
getInitValue
public int getInitValue()- Returns:
- the init value of this object.
- See Also:
-
isInteractive
public boolean isInteractive()- Returns:
- whether this object is interactive.
- See Also:
-
setInteractive
public void setInteractive(boolean b) Enables or disabled the interactivity. When enabled the object value change with user interaction.- Parameters:
b- Interactive flag.- See Also:
-
getValueChangeMode
public int getValueChangeMode()- Returns:
- the value change mode of this object for user interaction.
- See Also:
-
setValueChangeMode
public void setValueChangeMode(int m) Sets the value change mode of this object for user interaction.- Parameters:
m- Interaction mode- See Also:
-
hasBackgroundMapper
public boolean hasBackgroundMapper()- Returns:
- whether this object has a value program for background color.
- See Also:
-
setBackgroundMapper
Sets the value program for background color of this object.- Parameters:
m- Value program.- See Also:
-
getBackgroundMapper
- Returns:
- the current value program for background color of this object.
-
hasForegroundMapper
public boolean hasForegroundMapper()- Returns:
- whether this object has a value program for foreground color.
- See Also:
-
setForegroundMapper
Sets the value program for foreground color of this object.- Parameters:
m- Value program.- See Also:
-
getForegroundMapper
- Returns:
- the current value program for foreground color of this object.
-
hasVisibilityMapper
public boolean hasVisibilityMapper()- Returns:
- whether this object has a value program for visibility.
- See Also:
-
setVisibilityMapper
Sets the value program for visibility of this object.- Parameters:
m- Value program.- See Also:
-
getVisibilityMapper
- Returns:
- the current value program for visibility of this object.
-
hasInvertShadowMapper
public boolean hasInvertShadowMapper()- Returns:
- whether this object has a value program for invert shadow.
- See Also:
-
setInvertShadowMapper
Sets the value program for invert shadow of this object.- Parameters:
m- Value program.- See Also:
-
getInvertShadowMapper
- Returns:
- the current value program for invert shadow of this object.
-
hasHTranslationMapper
public boolean hasHTranslationMapper()- Returns:
- whether this object has a value program for horizontal translation.
- See Also:
-
setHTranslationMapper
Sets the value program for horizontal translation of this object.- Parameters:
m- Value program.- See Also:
-
getHTranslationMapper
- Returns:
- the current value program for horizontal translation of this object.
-
hasVTranslationMapper
public boolean hasVTranslationMapper()- Returns:
- whether this object has a value program for vertical translation.
- See Also:
-
setVTranslationMapper
Sets the value program for vertical translation of this object.- Parameters:
m- Value program.- See Also:
-
getVTranslationMapper
- Returns:
- the current value program for vertical translation of this object.
-
setGradientFillParam
public void setGradientFillParam(float x1, float y1, Color color1, float x2, float y2, Color color2, boolean cyclic) Sets the gradient of this object. Has effects only if fill style is FILL_STYLE_GRADIENT.- Parameters:
x1- x coordinate of the first specifiedPointin user spacey1- y coordinate of the first specifiedPointin user spacecolor1-Colorat the first specifiedPointx2- x coordinate of the second specifiedPointin user spacey2- y coordinate of the second specifiedPointin user spacecolor2-Colorat the second specifiedPointcyclic-trueif the gradient pattern should cycle repeatedly between the two colors;falseotherwise- See Also:
-
isProgrammed
public boolean isProgrammed()- Returns:
- whether this object has a programmed behavior. If this object is a JDGroup, the function return true if at least one of grouped JDObject is programmed.
- See Also:
-
refresh
public void refresh()Refresh the JDObject on the screen by repainting its bounding rectangle. This method shoud be called after a property change. -
preRefresh
public void preRefresh()Prepare this object to be repainted. Certain modifications of the object may need to be repainted outside the new bounding rectangle. So before applying modifcations to the object , a call to preRefresh() will memorize the current repaint region then a call to refresh() after mofications will repaint the union of the 2 rectangles.- See Also:
-
setExtensionList
Sets the list of extended parameter name for this object. Note: All value are reseted.- Parameters:
names- List of names
-
addExtension
Add an extension to this object.- Parameters:
name- Name of the extension.- See Also:
-
setExtendedParam
Sets the extended param value.- Parameters:
name- Param namevalue- Param value- See Also:
-
removeExtension
public void removeExtension(int extIdx) Remove the extended param at the specified index.- Parameters:
extIdx- Index of the extension.
-
setExtendedParam
Sets the extended param value.- Parameters:
extIdx- Index of the extensions.value- param value- See Also:
-
getExtendedParam
Returns the value of the specified extended param, an empty string if not found.- Parameters:
name- Extension name- Returns:
- param value
- See Also:
-
getExtendedParam
Returns the value of the specified extended param, an empty string if not found.- Parameters:
extIdx- Index of the extension.- Returns:
- param value
- See Also:
-
getExtendedParamName
Returns the name of the extended param at the specified index.- Parameters:
extIdx- Index of the extension.- Returns:
- param name
- See Also:
-
getExtendedParamDesc
- Parameters:
extName- Extension name- Returns:
- the description of the specified extension.
-
getExtendedParamNumber
public int getExtendedParamNumber()- Returns:
- the number of extensions
-
getExtendedParamIndex
- Parameters:
name- Param name- Returns:
- the index of the specified extended param , -1 when not found
-
hasExtendedParam
- Parameters:
name- Param name- Returns:
- true if the specified extended param exists , false otherwise
-
isFixedExtendedParam
- Parameters:
name- Param name- Returns:
- true if this parameters is fixed and cannot be removed.
-
isDisabled
public boolean isDisabled() -
setDisabled
public void setDisabled(boolean disabled)
-