|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectnet.sf.jaxodraw.object.JaxoObject
public abstract class JaxoObject
A general JaxoObject.
Field Summary | |
---|---|
static DecimalFormat |
D_FORMAT
The decimal format used for numbers in LaTeX output. |
static DecimalFormat |
GRAY_SCALE_FORMAT
The decimal format used gray scales in LaTeX output. |
static int |
SELECT_NONE
An integer that indicates that the user did not grab any object. |
static int |
SELECT_P1
First point (index 0). |
Constructor Summary | |
---|---|
JaxoObject()
|
Method Summary | |
---|---|
void |
addPropertyChangeListener(PropertyChangeListener listener)
Add a PropertyChangeListener to this object. |
abstract boolean |
canBeSelected(int handle,
int mode)
Determines if the object can be selected (moved, edited, etc) from the given point in a given edit mode. |
boolean |
contains(double x0,
double y0)
Tests if the specified coordinates are inside the boundary of this JaxoObject. |
boolean |
contains(double x0,
double y0,
double w,
double h)
Tests if the specified rectangular shape is entirely inside the boundary of this JaxoObject. |
boolean |
contains(Point2D p)
Tests if the specified point is inside the boundary of this JaxoObject. |
boolean |
contains(Rectangle2D r)
Tests if the specified rectangle is entirely inside the boundary of this JaxoObject. |
JaxoObject |
copy()
Returns an exact copy of the given JaxoObject. |
void |
copyFrom(JaxoObject temp)
Sets all parameters from the given object to the current one. |
protected void |
firePropertyChange(String propertyName,
Object oldValue,
Object newValue)
Notify all registered listeners of a changed property. |
Rectangle2D |
getBounds2D()
Return a high-precision bounding box of this JaxoObject. |
Rectangle2D |
getBoundsWithHandles(JaxoHandle h)
Return a Rectangle that contains this object and all its handles. |
Color |
getColor()
Returns the color of this object. |
protected GeneralPath |
getGeneralPath()
Returns the GeneralPath that can be used while painting this JaxoObject. |
int |
getGrabbedHandle(int clickX,
int clickY,
JaxoHandle h)
Determines which handle the user has selected to move/resize/edit an object. |
int |
getHeight()
Returns the height of this object. |
protected Point2D |
getLaTexLocation(float scaleFactor,
int canvasHeight)
Returns the latex (ie axodraw) coordinates of the first point of this JaxoObject. |
String |
getName()
Returns the name of this JaxoObject. |
PathIterator |
getPathIterator(AffineTransform at)
Returns an iterator that iterates along the the shape boundary of this JaxoObject. |
PathIterator |
getPathIterator(AffineTransform at,
double flatness)
Returns an iterator that iterates along the the shape boundary of this JaxoObject. |
int |
getPointCount()
Returns the number of points it takes to draw this object. |
Point[] |
getPoints()
All points, in order. |
int |
getWidth()
Returns the width of this object. |
int |
getX()
Returns the x coordinate of this object. |
int |
getX(int index)
X coordinate of Point 0 <= index < getPointCount(). |
int |
getY()
Returns the y coordinate of this object. |
int |
getY(int index)
Y coordinate of Point 0 <= index < getPointCount(). |
boolean |
intersects(double x0,
double y0,
double w,
double h)
Test if the interior of this JaxoObject intersects the interior of the given rectangular area. |
boolean |
intersects(Rectangle2D r)
Test if the interior of this JaxoObject intersects the interior of the given rectangular area. |
boolean |
isAround(int select,
int clickX,
int clickY,
JaxoHandle handle)
Determines if the given coordinates are contained within the given handle at the given point of this object. |
boolean |
isCopy(JaxoObject comp)
Determines if this JaxoObject is a copy of the specified one. |
boolean |
isMarked()
Determines whether this JaxoObject is marked as an element of a group or not. |
abstract String |
latexCommand(float scale,
Dimension canvasDim)
The LaTeX command that is necessary to draw the given JaxoObject using the axodraw.sty package. |
abstract String |
latexWidth()
The LaTeX command that sets the width for this JaxoObject, using the axodraw.sty package. |
void |
moveBy(int deltaX,
int deltaY)
Reset the coordinates of the object when it is moved by deltaX and deltaY. |
abstract void |
paint(JaxoGraphics2D g2)
The method that paints the JaxoObject. |
abstract void |
paintHandles(JaxoGraphics2D g2,
JaxoHandle h,
int editMode)
Paints the handles of this JaxoObject that allow to move/resize/edit it. |
void |
paintVisualAid(JaxoGraphics2D g2)
Paints a visual aid for the user during dragging (moving or resizing) of this JaxoObject. |
abstract void |
prepareEditPanel(JaxoObjectEditPanel editPanel)
Initializes the given editPanel to edit properties of this JaxoObject. |
void |
propertyChange(PropertyChangeEvent evt)
Set a new property. |
void |
removePropertyChangeListener(PropertyChangeListener listener)
Remove the given PropertyChangeListener from this Object. |
abstract void |
rescaleObject(int orx,
int ory,
float scale)
Rescale this JaxoObject by the scale factor scale, keeping the point (orx, ory) fixed. |
void |
setAsMarked(boolean mark)
Sets this JaxoObject as element of a group. |
void |
setColor(Color c)
Sets the color of this object. |
void |
setLocation(int newX,
int newY)
Sets the x and y coordinate of this object. |
void |
setParameter(String name,
boolean value)
Invokes a setter method for the given parameter name and value. |
void |
setParameter(String name,
Class<?> type,
Object value)
Invokes a setter method for the given parameter name using reflection. |
void |
setParameter(String name,
Class<?> type,
Object value,
boolean failOnError)
Invokes a setter method for the given parameter name using reflection. |
void |
setParameter(String name,
Color value)
Invokes a setter method for the given parameter name and value. |
void |
setParameter(String name,
float value)
Invokes a setter method for the given parameter name and value. |
void |
setParameter(String name,
int value)
Invokes a setter method for the given parameter name and value. |
void |
setParameter(String name,
String value)
Invokes a setter method for the given parameter name and value. |
void |
setPointCount(int value)
Set point count; currently only used for bean creation of objects, where setPoints is used. |
void |
setPoints(Point[] value)
Set all points; currently only used for bean creation of objects. |
void |
setPreferences()
Applies default values to this JaxoObject. |
void |
setState(JaxoObject o)
Restore state to the values of 'o'. |
protected static void |
setTransient(Class<?> c,
String[] propertyNames)
Make all 'properties' in the bean info for class 'c' transient. |
void |
setX(int newX)
Sets the x coordinate of this object. |
void |
setX(int index,
int value)
Set X coordinate of Point 0 <= index < getPointCount() to 'value'. |
void |
setXPosition(int newX)
Deprecated. unused. Use moveBy(int,int) instead. |
void |
setY(int newY)
Sets the y coordinate of this object. |
void |
setY(int index,
int value)
Set Y coordinate of Point 0 <= index < getPointCount() to 'value'. |
void |
setYPosition(int newY)
Deprecated. unused. Use moveBy(int,int) instead. |
float |
smallestDistanceTo(int px,
int py)
Determines the smallest distance of any of the handles of this JaxoObject from the given point. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Methods inherited from interface java.awt.Shape |
---|
getBounds |
Field Detail |
---|
public static final int SELECT_NONE
public static final int SELECT_P1
public static final DecimalFormat D_FORMAT
public static final DecimalFormat GRAY_SCALE_FORMAT
Constructor Detail |
---|
public JaxoObject()
Method Detail |
---|
public void addPropertyChangeListener(PropertyChangeListener listener)
listener
- a listener to add.public void removePropertyChangeListener(PropertyChangeListener listener)
listener
- the listener to remove.protected void firePropertyChange(String propertyName, Object oldValue, Object newValue)
propertyName
- the name of the changed property.
This should be equal to the corresponding bean name.oldValue
- the old value.newValue
- the new value.protected static void setTransient(Class<?> c, String[] propertyNames)
c
- the class.propertyNames
- set of properties to make transient.public int getPointCount()
public void setPointCount(int value)
getPointCount()
.
value
- The value to set.public Point[] getPoints()
getPointCount()
,
getX(int)
,
getY(int)
public void setPoints(Point[] value)
value
- The points to set.public int getX(int index)
index
- The index of the point to get.
public int getY(int index)
index
- The index of the point to get.
public void setX(int index, int value)
index
- The index of the point to set.value
- The value to set.public void setY(int index, int value)
index
- The index of the point to set.value
- The value to set.public int getX()
public void setX(int newX)
newX
- The x coordinate of this object.public int getY()
public void setY(int newY)
newY
- The y coordinate of this object.public int getWidth()
public int getHeight()
public Color getColor()
public void setColor(Color c)
c
- The color of this object.public void setLocation(int newX, int newY)
newX
- The x coordinate of this object.newY
- The y coordinate of this object.protected final GeneralPath getGeneralPath()
public final void setAsMarked(boolean mark)
mark
- A boolean variable indicating whether this
JaxoObject should be set as an element of a group or not.public final boolean isMarked()
public void moveBy(int deltaX, int deltaY)
deltaX
- The x displacement.deltaY
- The y displacement.public void setXPosition(int newX)
moveBy(int,int)
instead.
newX
- the new x position.public void setYPosition(int newY)
moveBy(int,int)
instead.
newY
- the new y position.public void paintVisualAid(JaxoGraphics2D g2)
g2
- The graphics context to paint the visual aid.public boolean isCopy(JaxoObject comp)
comp
- The JaxoObject to compare against.
public void copyFrom(JaxoObject temp)
temp
- The object to copy from.public void setState(JaxoObject o)
copy()
.
o
- the object to copy from.public float smallestDistanceTo(int px, int py)
px
- The x coordinate of the test point.py
- The y coordinate of the test point.
public JaxoObject copy()
public boolean isAround(int select, int clickX, int clickY, JaxoHandle handle)
select
- One of the constants SELECT_* defined for this objects.clickX
- The x coordinate of the point.clickY
- The y coordinate of the point.handle
- The test handle.
public int getGrabbedHandle(int clickX, int clickY, JaxoHandle h)
clickX
- The x coordinate where the mouse click has ocurred.clickY
- The y coordinate where the mouse click has ocurred.h
- A handle object.
public Rectangle2D getBoundsWithHandles(JaxoHandle h)
h
- the handle.
protected Point2D getLaTexLocation(float scaleFactor, int canvasHeight)
scaleFactor
- A scalefactor.canvasHeight
- The current height of the canvas.
public void setPreferences()
preferences
.
public final String getName()
public final void setParameter(String name, Class<?> type, Object value, boolean failOnError)
name
- the name of the parameter to set.
Must not be null or empty.type
- the class type of the parameter.value
- the object value of the parameter to set.failOnError
- false if any Exceptions should be swallowed.public final void setParameter(String name, Class<?> type, Object value)
name
- the name of the parameter to set.type
- the class type of the parameter.value
- the object value of the parameter to set.public final void setParameter(String name, int value)
name
- the name of the parameter to set.value
- the object value of the parameter to set.setParameter(String,Class,Object)
public final void setParameter(String name, float value)
name
- the name of the parameter to set.value
- the object value of the parameter to set.setParameter(String,Class,Object)
public final void setParameter(String name, boolean value)
name
- the name of the parameter to set.value
- the object value of the parameter to set.setParameter(String,Class,Object)
public final void setParameter(String name, Color value)
name
- the name of the parameter to set.value
- the object value of the parameter to set.setParameter(String,Class,Object)
public final void setParameter(String name, String value)
name
- the name of the parameter to set.value
- the object value of the parameter to set.setParameter(String,Class,Object)
public void propertyChange(PropertyChangeEvent evt)
propertyChange
in interface PropertyChangeListener
evt
- the PropertyChangeEvent.public boolean contains(double x0, double y0)
contains
in interface Shape
x0
- the x coordinate to test.y0
- the y coordinate to test.
Shape.getBounds()
contains the given point.Shape.contains(double,double).
public boolean contains(double x0, double y0, double w, double h)
contains
in interface Shape
x0
- the x coordinate to test.y0
- the y coordinate to test.w
- the width of the rectangle.h
- the height of the rectangle.
Shape.getBounds()
contains the given rectangle.Shape.contains(double,double,double,double).
public boolean contains(Point2D p)
contains
in interface Shape
p
- the point to test.
Shape.getBounds()
contains the given point.Shape.contains(java.awt.geom.Point2D).
public boolean contains(Rectangle2D r)
contains
in interface Shape
r
- the rectangle to test.
Shape.getBounds()
contains the given rectangle.Shape.contains(java.awt.geom.Rectangle2D).
public Rectangle2D getBounds2D()
getBounds2D
in interface Shape
Shape.getBounds2D().
public PathIterator getPathIterator(AffineTransform at)
getPathIterator
in interface Shape
at
- an optional AffineTransformation to be applied to be
applied to the coordinates of this object, or null for untransformed
coordinates.
Shape.getPathIterator(java.awt.geom.AffineTransform).
public PathIterator getPathIterator(AffineTransform at, double flatness)
getPathIterator
in interface Shape
at
- an optional AffineTransformation to be applied to be
applied to the coordinates of this object, or null for untransformed
coordinates.flatness
- the flatness parameter.
Shape.getPathIterator(java.awt.geom.AffineTransform,double).
public boolean intersects(double x0, double y0, double w, double h)
intersects
in interface Shape
x0
- the x-coordinate of the test rectangle.y0
- the y-coordinate of the test rectangle.w
- the width of the test rectangle.h
- the height of the test rectangle.
Shape.intersects(double,double,double,double).
public boolean intersects(Rectangle2D r)
intersects
in interface Shape
r
- the rectangle to test.
Shape.intersects(java.awt.geom.Rectangle2D).
public abstract void paint(JaxoGraphics2D g2)
g2
- The graphics context where the object has to be painted.public abstract void paintHandles(JaxoGraphics2D g2, JaxoHandle h, int editMode)
g2
- The corresponding graphics context.h
- A handle object to be used for painting.editMode
- The edit mode that the handles are being painted in.public abstract boolean canBeSelected(int handle, int mode)
handle
- One of the static variables SELECT_* defined for
this JaxoObject.mode
- The current edit mode.
public abstract String latexCommand(float scale, Dimension canvasDim)
scale
- A scale factor to translate Java coordinates to
LaTeX coordinates.canvasDim
- The current dimension of the canvas.
public abstract String latexWidth()
public abstract void rescaleObject(int orx, int ory, float scale)
orx
- The x-coordinate of the fixed point.ory
- The y-coordinate of the fixed point.scale
- The scale parameter.public abstract void prepareEditPanel(JaxoObjectEditPanel editPanel)
editPanel
- the panel to prepare.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |