public abstract class JDObject
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
static int |
FILL_STYLE_DOT_PATTERN_1
Hatch fill style
|
static int |
FILL_STYLE_DOT_PATTERN_2
Hatch fill style
|
static int |
FILL_STYLE_DOT_PATTERN_3
Hatch fill style
|
static int |
FILL_STYLE_GRADIENT
Gradient fill style
|
static int |
FILL_STYLE_LARGE_CROSS_HATCH
Hatch fill style
|
static int |
FILL_STYLE_LARGE_LEFT_HATCH
Hatch fill style
|
static int |
FILL_STYLE_LARGE_RIGHT_HATCH
Hatch fill style
|
static int |
FILL_STYLE_NONE
No filling
|
static int |
FILL_STYLE_SMALL_CROSS_HATCH
Hatch fill style
|
static int |
FILL_STYLE_SMALL_LEFT_HATCH
Hatch fill style
|
static int |
FILL_STYLE_SMALL_RIGHT_HATCH
Hatch fill style
|
static int |
FILL_STYLE_SOLID
Solid fill style
|
static int |
LINE_STYLE_DASH
Dash line style
|
static int |
LINE_STYLE_DASH_DOT
Dash + Dot line style
|
static int |
LINE_STYLE_DOT
Dot line style
|
static int |
LINE_STYLE_LONG_DASH
Long Dash line style
|
static int |
LINE_STYLE_SOLID
Solid line style
|
static int |
VALUE_CHANGE_ON_XDRAG_LEFT
the object value receive the x mouse coordinates when dragged (relative to left of object)
|
static int |
VALUE_CHANGE_ON_XDRAG_RIGHT
the object value receive the x mouse coordinates when dragged (relative to right of object)
|
static int |
VALUE_CHANGE_ON_YDRAG_BOTTOM
the object value receive the y mouse coordinates when dragged (relative to bottom of object)
|
static int |
VALUE_CHANGE_ON_YDRAG_TOP
the object value receive the y mouse coordinates when dragged (relative to top of object)
|
static int |
VALUE_INC_ON_CLICK
the object value is incremented (+1) on click
|
static int |
VALUE_INC_ON_PRESSRELEASE
the object value is incremented (+1) on mousePressed or mouseReleased
|
Constructor and Description |
---|
JDObject() |
Modifier and Type | Method and Description |
---|---|
void |
addExtension(java.lang.String name)
Add an extension to this object.
|
void |
addMouseListener(JDMouseListener l)
Adds the specified mouse listener to this object.
|
void |
addValueListener(JDValueListener l)
Adds the specified value listener to this object.
|
void |
centerOrigin()
Center the origin.
|
void |
clearMouseListener()
Remove all mouse listener belonging to this object.
|
void |
clearValueListener()
Remove all value listener belonging to this object.
|
abstract JDObject |
copy(int x,
int y)
Returns a copy of this object at the specified location.
|
java.awt.Color |
getBackground()
Returns the current background color of this object.
|
JDValueProgram |
getBackgroundMapper()
Returns the current value program for background color of this object.
|
java.awt.Rectangle |
getBoundRect()
Gets the bounding rectangle of this object.
|
java.lang.String |
getExtendedParam(int extIdx)
Returns the value of the specified extended param, an empty string if not found.
|
java.lang.String |
getExtendedParam(java.lang.String name)
Returns the value of the specified extended param, an empty string if not found.
|
java.lang.String |
getExtendedParamDesc(java.lang.String extName)
Returns the description of the specified extension.
|
int |
getExtendedParamIndex(java.lang.String name)
Returns the index of the specified extended param , -1 when not found
|
java.lang.String |
getExtendedParamName(int extIdx)
Returns the name of the extended param at the specified index.
|
int |
getExtendedParamNumber()
Returns the number of extensions
|
int |
getFillStyle()
Returns the current fill style of this object.
|
java.awt.Color |
getForeground()
Returns the current foreground color of this object.
|
JDValueProgram |
getForegroundMapper()
Returns the current value program for foreground color of this object.
|
JDValueProgram |
getHTranslationMapper()
Returns the current value program for horizontal translation of this object.
|
int |
getInitValue()
Returns the init value of this object.
|
JDValueProgram |
getInvertShadowMapper()
Returns the current value program for invert shadow of this object.
|
int |
getLineStyle()
Returns the current line style of this object.
|
int |
getLineWidth()
Returns the current line width of this object.
|
int |
getMaxValue()
Returns the maximum value of this object.
|
int |
getMinValue()
Returns the minimum value of this object.
|
java.lang.String |
getName()
Returns the current name of this object.
|
void |
getObjectsByName(java.util.Vector result,
java.lang.String name,
boolean recurseGroup)
Returns all objects having the given name.
|
java.awt.geom.Point2D.Double |
getOrigin()
Returns the current origin.
|
int |
getShadowWidth()
Returns the current shadow thickness.
|
java.awt.geom.Point2D.Double |
getSummit(int id)
Returns the summit at the specified position.
|
int |
getSummitNumber()
Returns the summit number of this object.
|
int |
getValue()
Returns the value of this object.
|
int |
getValueChangeMode()
Returns the value change mode of this object for user interaction.
|
JDValueProgram |
getVisibilityMapper()
Returns the current value program for visibility of this object.
|
JDValueProgram |
getVTranslationMapper()
Returns the current value program for vertical translation of this object.
|
boolean |
hasBackgroundMapper()
Determines whether this object has a value program for background color.
|
boolean |
hasExtendedParam(java.lang.String name)
returns true if the specified extended param exists , false otherwise
|
boolean |
hasForegroundMapper()
Determines whether this object has a value program for foreground color.
|
boolean |
hasHTranslationMapper()
Determines whether this object has a value program for horizontal translation.
|
boolean |
hasInverseShadow()
Determines whether this object has inverse shadow.
|
boolean |
hasInvertShadowMapper()
Determines whether this object has a value program for invert shadow.
|
boolean |
hasShadow()
Returns true only if this object is shadowed.
|
boolean |
hasVisibilityMapper()
Determines whether this object has a value program for visibility.
|
boolean |
hasVTranslationMapper()
Determines whether this object has a value program for vertical translation.
|
boolean |
isAntiAliased()
Determines wheter this object is anti aliased.
|
boolean |
isDisabled()
returns disabled state (external usage)
|
boolean |
isFixedExtendedParam(java.lang.String name)
returns true if this parameters is fixed and cannot be removed.
|
boolean |
isInsideObject(int x,
int y)
Determines whether the specified point is inside this object.
|
boolean |
isInteractive()
Determines whether this object is interactive.
|
boolean |
isProgrammed()
Determines whether this object has a programmed behavior.
|
boolean |
isVisible()
Determines whether this object is visible.
|
abstract void |
moveSummit(int id,
double x,
double y)
Moves the specifed summit to the specified position.
|
void |
moveSummitH(int id,
double x)
Moves horizontaly the specifed summit to the specified position.
|
void |
moveSummitV(int id,
double y)
Moves verticaly the specifed summit to the specified position.
|
abstract void |
paint(JDrawEditor parent,
java.awt.Graphics g)
Paints this object.
|
void |
preRefresh()
Prepare this object to be repainted.
|
void |
refresh()
Refresh the JDObject on the screen by repainting
its bounding rectangle.
|
void |
removeExtension(int extIdx)
Remove the extended param at the specified index.
|
void |
removeMouseListener(JDMouseListener l)
Remove the specified mouse listener from this object.
|
void |
removeValueListener(JDValueListener l)
Remove the specified value listener from this object.
|
void |
restoreTransform()
Restore original shape previously backuped by saveTransform
|
void |
rotate90(double x,
double y)
Rotate the object by 90deg.
|
void |
saveTransform()
Backup the shape.
|
void |
scale(double x,
double y,
double rx,
double ry)
Scale this object.
|
void |
scaleTranslate(double scaleX,
double scaleY,
double ratioX,
double ratioY,
double transX,
double transY)
Scale, then translate this object.
|
void |
setAntiAlias(boolean aliasing)
Enables or disables the anti aliasing for this object.
|
void |
setBackground(java.awt.Color c)
Sets the background color (usualy fill color) of this object.
|
void |
setBackgroundMapper(JDValueProgram m)
Sets the value program for background color of this object.
|
void |
setDisabled(boolean disabled)
sets disabled state (external usage)
|
void |
setExtendedParam(int extIdx,
java.lang.String value)
Sets the extended param value.
|
void |
setExtendedParam(java.lang.String name,
java.lang.String value)
Sets the extended param value.
|
void |
setExtensionList(java.lang.String[] names)
Sets the list of extended parameter name for this object.
|
void |
setFillStyle(int style)
Sets the fill style of this object.
|
void |
setForeground(java.awt.Color c)
Sets the foreground color (usualy line color) of this object.
|
void |
setForegroundMapper(JDValueProgram m)
Sets the value program for foreground color of this object.
|
void |
setGradientFillParam(float x1,
float y1,
java.awt.Color color1,
float x2,
float y2,
java.awt.Color color2,
boolean cyclic)
Sets the gradient of this object.
|
void |
setHTranslationMapper(JDValueProgram m)
Sets the value program for horizontal translation of this object.
|
void |
setInitValue(int i)
Sets the init value of this object.
|
void |
setInteractive(boolean b)
Enables or disabled the interactivity.
|
void |
setInverseShadow(boolean b)
Sets inverse shadow for this object.
|
void |
setInvertShadowMapper(JDValueProgram m)
Sets the value program for invert shadow of this object.
|
void |
setLineStyle(int style)
Sets the line style.
|
void |
setLineWidth(int width)
Sets the line width of this object.
|
void |
setMaxValue(int max)
Sets the max value of this object.
|
void |
setMinValue(int min)
Sets the minimum value of this object.
|
void |
setName(java.lang.String s)
Sets the name of this object.
|
void |
setOrigin(java.awt.geom.Point2D.Double p)
Sets the origin of this object.
|
void |
setShadow(boolean b)
Enables or disabled shadow for this object.
|
void |
setShadowWidth(int w)
Sets the shadow thickness of this object.
|
void |
setValue(int v)
Sets the value of this object and execute the dynamic object program if enabled.
|
void |
setValueChangeMode(int m)
Sets the value change mode of this object for user interaction.
|
void |
setVisibilityMapper(JDValueProgram m)
Sets the value program for visibility of this object.
|
void |
setVisible(boolean b)
Shows or hides this object.
|
void |
setVTranslationMapper(JDValueProgram m)
Sets the value program for vertical translation of this object.
|
java.lang.String |
toString() |
void |
translate(double x,
double y)
Translate this object.
|
public static final int LINE_STYLE_SOLID
public static final int LINE_STYLE_DOT
public static final int LINE_STYLE_DASH
public static final int LINE_STYLE_LONG_DASH
public static final int LINE_STYLE_DASH_DOT
public static final int FILL_STYLE_NONE
public static final int FILL_STYLE_SOLID
public static final int FILL_STYLE_LARGE_RIGHT_HATCH
public static final int FILL_STYLE_LARGE_LEFT_HATCH
public static final int FILL_STYLE_LARGE_CROSS_HATCH
public static final int FILL_STYLE_SMALL_RIGHT_HATCH
public static final int FILL_STYLE_SMALL_LEFT_HATCH
public static final int FILL_STYLE_SMALL_CROSS_HATCH
public static final int FILL_STYLE_DOT_PATTERN_1
public static final int FILL_STYLE_DOT_PATTERN_2
public static final int FILL_STYLE_DOT_PATTERN_3
public static final int FILL_STYLE_GRADIENT
public static final int VALUE_INC_ON_CLICK
public static final int VALUE_INC_ON_PRESSRELEASE
public static final int VALUE_CHANGE_ON_XDRAG_LEFT
public static final int VALUE_CHANGE_ON_XDRAG_RIGHT
public static final int VALUE_CHANGE_ON_YDRAG_TOP
public static final int VALUE_CHANGE_ON_YDRAG_BOTTOM
public int getValue()
setValue(int)
public void setValue(int v)
v
- New valuepublic void addValueListener(JDValueListener l)
l
- Value listenerpublic void addMouseListener(JDMouseListener l)
l
- JDMouseListenerpublic void removeValueListener(JDValueListener l)
l
- Listener to be removed.public void removeMouseListener(JDMouseListener l)
l
- Listener to be removed.public void clearValueListener()
public void clearMouseListener()
public abstract void paint(JDrawEditor parent, java.awt.Graphics g)
parent
- JdrawEditor parent (Can be null except for JDSwingObject)g
- the specified Graphics windowpublic void getObjectsByName(java.util.Vector result, java.lang.String name, boolean recurseGroup)
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.JDrawEditor.getObjectsByName(java.lang.String, boolean)
public java.awt.Rectangle getBoundRect()
public boolean isInsideObject(int x, int y)
x
- X coordinate (pixel)y
- Y coordinate (pixel)public int getSummitNumber()
public java.awt.geom.Point2D.Double getSummit(int id)
id
- Summit indexgetSummitNumber()
,
moveSummit(int, double, double)
,
moveSummitH(int, double)
,
moveSummitV(int, double)
public abstract void moveSummit(int id, double x, double y)
id
- Summit indexx
- Absolute X positiony
- Absolute Y positionrefresh()
public void moveSummitH(int id, double x)
id
- Summit indexx
- Absolute X positionrefresh()
,
moveSummit(int, double, double)
,
moveSummitV(int, double)
public void moveSummitV(int id, double y)
id
- Summit indexy
- Absolute Y positionrefresh()
,
moveSummit(int, double, double)
,
moveSummitH(int, double)
public abstract JDObject copy(int x, int y)
x
- Horizontal position of the copied object (pixel)y
- Vertical Position of the copied object (pixel)public void translate(double x, double y)
x
- H translationy
- V translationrestoreTransform()
,
saveTransform()
,
refresh()
public void scaleTranslate(double scaleX, double scaleY, double ratioX, double ratioY, double transX, double transY)
scaleX
- Scaling originscaleY
- Scaling originratioX
- H scaling ratioratioY
- V scaling rationtransX
- H translationtransY
- V translationrestoreTransform()
,
saveTransform()
,
refresh()
public void scale(double x, double y, double rx, double ry)
x
- Scaling originy
- Scaling originrx
- H scaling ratiory
- V scaling rationrestoreTransform()
,
saveTransform()
,
refresh()
public void rotate90(double x, double y)
x
- Rotation center horizontal posy
- Rotation center vertical posrefresh()
public void restoreTransform()
saveTransform()
public void saveTransform()
restoreTransform()
public void setVisible(boolean b)
b
- True to show, false otherwise.public boolean isVisible()
public void setName(java.lang.String s)
s
- Object namepublic java.lang.String getName()
public void setBackground(java.awt.Color c)
c
- Background colorpublic java.awt.Color getBackground()
setBackground(java.awt.Color)
public void setForeground(java.awt.Color c)
c
- Foreground colorpublic java.awt.Color getForeground()
setForeground(java.awt.Color)
public void setOrigin(java.awt.geom.Point2D.Double p)
p
- Origin point.public void centerOrigin()
public java.awt.geom.Point2D.Double getOrigin()
public java.lang.String toString()
toString
in class java.lang.Object
public void setFillStyle(int style)
style
- Fill styleFILL_STYLE_NONE
,
FILL_STYLE_SOLID
,
FILL_STYLE_LARGE_RIGHT_HATCH
,
FILL_STYLE_LARGE_LEFT_HATCH
,
FILL_STYLE_LARGE_CROSS_HATCH
,
FILL_STYLE_SMALL_RIGHT_HATCH
,
FILL_STYLE_SMALL_LEFT_HATCH
,
FILL_STYLE_SMALL_CROSS_HATCH
,
FILL_STYLE_DOT_PATTERN_1
,
FILL_STYLE_DOT_PATTERN_2
,
FILL_STYLE_DOT_PATTERN_3
,
FILL_STYLE_GRADIENT
public int getFillStyle()
setFillStyle(int)
public void setLineStyle(int style)
style
- Line styleLINE_STYLE_SOLID
,
LINE_STYLE_DOT
,
LINE_STYLE_DASH
,
LINE_STYLE_LONG_DASH
,
LINE_STYLE_DASH_DOT
public int getLineStyle()
setLineStyle(int)
public void setAntiAlias(boolean aliasing)
aliasing
- True to enable antialiasing, false otherwisepublic boolean isAntiAliased()
public void setLineWidth(int width)
width
- Line width (pixel)public int getLineWidth()
public boolean hasShadow()
public void setShadow(boolean b)
b
- Shadow flag.setInverseShadow(boolean)
public void setShadowWidth(int w)
w
- Shadow thickness.public int getShadowWidth()
setShadowWidth(int)
public boolean hasInverseShadow()
setInverseShadow(boolean)
public void setInverseShadow(boolean b)
b
- Inverse shadow flag.setShadow(boolean)
public void setMinValue(int min)
min
- Min valuesetInitValue(int)
,
setMaxValue(int)
,
setValue(int)
public int getMinValue()
setMinValue(int)
public void setMaxValue(int max)
max
- Max valuesetInitValue(int)
,
setMinValue(int)
,
setValue(int)
public int getMaxValue()
setMaxValue(int)
public void setInitValue(int i)
i
- Initial value object.setMaxValue(int)
,
setMinValue(int)
,
setValue(int)
public int getInitValue()
setInitValue(int)
public boolean isInteractive()
setInteractive(boolean)
public void setInteractive(boolean b)
b
- Interactive flag.setValueChangeMode(int)
,
setValue(int)
public int getValueChangeMode()
setValueChangeMode(int)
public void setValueChangeMode(int m)
m
- Interaction modeVALUE_INC_ON_PRESSRELEASE
,
VALUE_CHANGE_ON_XDRAG_LEFT
,
VALUE_CHANGE_ON_XDRAG_RIGHT
,
VALUE_CHANGE_ON_YDRAG_TOP
,
VALUE_CHANGE_ON_YDRAG_BOTTOM
public boolean hasBackgroundMapper()
public void setBackgroundMapper(JDValueProgram m)
m
- Value program.isProgrammed()
public JDValueProgram getBackgroundMapper()
public boolean hasForegroundMapper()
public void setForegroundMapper(JDValueProgram m)
m
- Value program.isProgrammed()
public JDValueProgram getForegroundMapper()
public boolean hasVisibilityMapper()
public void setVisibilityMapper(JDValueProgram m)
m
- Value program.isProgrammed()
public JDValueProgram getVisibilityMapper()
public boolean hasInvertShadowMapper()
public void setInvertShadowMapper(JDValueProgram m)
m
- Value program.isProgrammed()
public JDValueProgram getInvertShadowMapper()
public boolean hasHTranslationMapper()
public void setHTranslationMapper(JDValueProgram m)
m
- Value program.isProgrammed()
public JDValueProgram getHTranslationMapper()
public boolean hasVTranslationMapper()
public void setVTranslationMapper(JDValueProgram m)
m
- Value program.isProgrammed()
public JDValueProgram getVTranslationMapper()
public void setGradientFillParam(float x1, float y1, java.awt.Color color1, float x2, float y2, java.awt.Color color2, boolean cyclic)
x1
- x coordinate of the first specified
Point
in user spacey1
- y coordinate of the first specified
Point
in user spacecolor1
- Color
at the first specified
Point
x2
- x coordinate of the second specified
Point
in user spacey2
- y coordinate of the second specified
Point
in user spacecolor2
- Color
at the second specified
Point
cyclic
- true
if the gradient pattern should cycle
repeatedly between the two colors; false
otherwisesetFillStyle(int)
public boolean isProgrammed()
setValue(int)
public void refresh()
public void preRefresh()
refresh()
public void setExtensionList(java.lang.String[] names)
names
- List of namespublic void addExtension(java.lang.String name)
name
- Name of the extension.setExtensionList(java.lang.String[])
public void setExtendedParam(java.lang.String name, java.lang.String value)
name
- Param namevalue
- Param valuesetExtensionList(java.lang.String[])
public void removeExtension(int extIdx)
extIdx
- Index of the extension.public void setExtendedParam(int extIdx, java.lang.String value)
extIdx
- Index of the extensions.value
- param valuesetExtensionList(java.lang.String[])
public java.lang.String getExtendedParam(java.lang.String name)
name
- Extension namesetExtensionList(java.lang.String[])
public java.lang.String getExtendedParam(int extIdx)
extIdx
- Index of the extension.setExtensionList(java.lang.String[])
public java.lang.String getExtendedParamName(int extIdx)
extIdx
- Index of the extension.setExtensionList(java.lang.String[])
public java.lang.String getExtendedParamDesc(java.lang.String extName)
extName
- Extension namepublic int getExtendedParamNumber()
public int getExtendedParamIndex(java.lang.String name)
public boolean hasExtendedParam(java.lang.String name)
public boolean isFixedExtendedParam(java.lang.String name)
public boolean isDisabled()
public void setDisabled(boolean disabled)