Package net.sf.jaxodraw.object.group
Class JaxoGroup
java.lang.Object
net.sf.jaxodraw.object.JaxoObject
net.sf.jaxodraw.object.JaxoExtendedObject
net.sf.jaxodraw.object.group.JaxoGroup
- All Implemented Interfaces:
Shape
,PropertyChangeListener
,Serializable
,Cloneable
,EventListener
Groups together a number of JaxoObjects.
- Since:
- 2.0
- See Also:
-
Field Summary
Fields inherited from class net.sf.jaxodraw.object.JaxoExtendedObject
SELECT_DX, SELECT_DY, SELECT_P2
Fields inherited from class net.sf.jaxodraw.object.JaxoObject
D_FORMAT, GRAY_SCALE_FORMAT, SELECT_NONE, SELECT_P1
-
Constructor Summary
ConstructorsConstructorDescriptionConstructor: creates a new empty vector and sets the dimensions to a default value. -
Method Summary
Modifier and TypeMethodDescriptionboolean
canBeSelected
(int handle, int mode) Determines if the object can be selected (moved, edited, etc) from the given point in a given edit mode.final void
Removes all JaxoObjects from the Group.final boolean
containsInstanceOf
(Class<?> clazz) Determines whether there are instances of the given Class in this group.final JaxoObject
copy()
Returns an exact copy of this JaxoGroup.void
Sets all parameters from the given object to the current one.final int
getAmp()
Returns the groupAmp property of this group object.Returns the bounding box of this object.final Font
getFont()
Returns the groupTextFont property of this text object.final int
getGrabbedHandle
(int clickX, int clickY, JaxoHandle h) Determines which handle the user has selected to move/resize/edit an object.final int
Returns the groupTeXSize property of this group object.final JaxoList<JaxoObject>
Returns the JaxoObjects in this group.final boolean
isCopy
(JaxoObject comp) Determines if this JaxoObject is a copy of the specified one.final String
latexCommand
(float scale, Dimension canvasDim) The latex command of this group (obsolete because every JaxoObject has its own latex command).final String
The latex command setting the width of this group (obsolete because every JaxoObject has its own latexWidth).final void
moveBy
(int deltaX, int deltaY) Displaces the group.final void
paint
(JaxoGraphics2D g2) The method that paints the JaxoObject.final void
paintHandles
(JaxoGraphics2D g2, JaxoHandle h, int editMode) Paints the handles of this JaxoObject that allow to move/resize/edit it.final void
Paints a visual aid for the user during dragging (moving or resizing) of this JaxoObject.void
prepareEditPanel
(JaxoObjectEditPanel editPanel) Initializes the given editPanel to edit properties of this JaxoObject.final void
rescaleObject
(int orx, int ory, float scale) Rescale this JaxoObject by the scale factor scale, keeping the point (orx, ory) fixed.final void
setAmp
(int amp) Sets the groupAmp property of this group object.final void
Sets the color for all objects in this group.If newColor !final void
Sets the groupTextFont property of this group.final void
setFontName
(String name) Sets the font name of this group.final void
setFontSize
(int size) Sets the font size of this group.final void
setFontStyle
(int style) Sets the font style of this group.final void
setLatexTextSize
(int teXSize) Sets the groupTeXSize property of this group object.final void
setNewScale
(float scale) Rescales the group with the given scale factor, leaving the first point fixed.final void
setObjectList
(JaxoList<JaxoObject> obList) Sets the JaxoObjects of this group.void
Restore state to the values of 'o'.final void
setStrokeWidth
(float newStroke) Sets the strokeWidth property of this group object.final int
size()
Returns the number of JaxoObjects in this group.final 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 net.sf.jaxodraw.object.JaxoExtendedObject
copyFrom, getHeight, getPointCount, getRadius, getRelh, getRelSize, getRelw, getSize, getStroke, getStrokeWidth, getWidth, getX, getX2, getY, getY2, resetStroke, setLocation, setPreferences, setRadius, setRelativeHeight, setRelativeWidth, setRelWAndH, setStroke, setX, setX2, setY, setY2, strokeIs
Methods inherited from class net.sf.jaxodraw.object.JaxoObject
addPropertyChangeListener, contains, contains, contains, contains, copyFrom, firePropertyChange, getBounds2D, getBoundsWithHandles, getColor, getGeneralPath, getLaTexLocation, getName, getPathIterator, getPathIterator, getPoints, getX, getY, intersects, intersects, isAround, isMarked, propertyChange, removePropertyChangeListener, setAsMarked, setLocation, setParameter, setParameter, setParameter, setParameter, setParameter, setParameter, setParameter, setPointCount, setPoints, setTransient, setX, setXPosition, setY, setYPosition
-
Constructor Details
-
JaxoGroup
public JaxoGroup()Constructor: creates a new empty vector and sets the dimensions to a default value.
-
-
Method Details
-
copy
Returns an exact copy of this JaxoGroup.- Overrides:
copy
in classJaxoObject
- Returns:
- A copy of this JaxoGroup.
-
isCopy
Determines if this JaxoObject is a copy of the specified one.- Overrides:
isCopy
in classJaxoExtendedObject
- Parameters:
comp
- The JaxoObject to compare against.- Returns:
- True if the JaxoObjects are identical.
-
copyFrom
Sets all parameters from the given object to the current one.- Parameters:
temp
- The object to copy from.
-
setState
Restore state to the values of 'o'. The object 'o' must be an object of the same "type" obtained byJaxoObject.copy()
.- Overrides:
setState
in classJaxoExtendedObject
- Parameters:
o
- the object to copy from.
-
getGrabbedHandle
Determines which handle the user has selected to move/resize/edit an object.- Overrides:
getGrabbedHandle
in classJaxoExtendedObject
- Parameters:
clickX
- The x coordinate where the mouse click has ocurred.clickY
- The y coordinate where the mouse click has ocurred.h
- A handle object.- Returns:
- One of the static variables SELECT_* defined for this JaxoObject that specifies the handle which the user has clicked.
-
canBeSelected
public 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.- Overrides:
canBeSelected
in classJaxoExtendedObject
- Parameters:
handle
- One of the static variables SELECT_* defined for this JaxoObject.mode
- The current edit mode.- Returns:
- True if the object may be selected from the given point, false otherwise.
-
paintHandles
Paints the handles of this JaxoObject that allow to move/resize/edit it.- Overrides:
paintHandles
in classJaxoExtendedObject
- Parameters:
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.
-
smallestDistanceTo
public final float smallestDistanceTo(int px, int py) Determines the smallest distance of any of the handles of this JaxoObject from the given point.- Overrides:
smallestDistanceTo
in classJaxoExtendedObject
- Parameters:
px
- The x coordinate of the test point.py
- The y coordinate of the test point.- Returns:
- The smallest distance.
-
paintVisualAid
Paints a visual aid for the user during dragging (moving or resizing) of this JaxoObject.- Overrides:
paintVisualAid
in classJaxoObject
- Parameters:
g2
- The graphics context to paint the visual aid.
-
paint
The method that paints the JaxoObject.- Specified by:
paint
in classJaxoObject
- Parameters:
g2
- The graphics context where the object has to be painted.
-
moveBy
public final void moveBy(int deltaX, int deltaY) Displaces the group.- Overrides:
moveBy
in classJaxoExtendedObject
- Parameters:
deltaX
- The displacement in x directiondeltaY
- The displacement in y direction
-
latexCommand
The latex command of this group (obsolete because every JaxoObject has its own latex command).- Specified by:
latexCommand
in classJaxoObject
- Parameters:
scale
- A scale factor to translate Java coordinates to LaTeX coordinates.canvasDim
- The current dimension of the canvas.- Returns:
- The string "%"
-
latexWidth
The latex command setting the width of this group (obsolete because every JaxoObject has its own latexWidth).- Overrides:
latexWidth
in classJaxoExtendedObject
- Returns:
- The string "%".
-
getBounds
Returns the bounding box of this object. Note that this returns null if the group is empty.- Returns:
- the bounding box of this object.
-
clearGroup
public final void clearGroup()Removes all JaxoObjects from the Group. -
getObjectList
Returns the JaxoObjects in this group.- Returns:
- A list containing all the JaxoObjects of this group
-
setObjectList
Sets the JaxoObjects of this group.- Parameters:
obList
- A list containing all the JaxoObjects to be set for this group
-
size
public final int size()Returns the number of JaxoObjects in this group.- Returns:
- The size of the list of JaxoObjects in this group
-
rescaleObject
public final void rescaleObject(int orx, int ory, float scale) Rescale this JaxoObject by the scale factor scale, keeping the point (orx, ory) fixed.- Specified by:
rescaleObject
in classJaxoObject
- Parameters:
orx
- The x-coordinate of the fixed point.ory
- The y-coordinate of the fixed point.scale
- The scale parameter.
-
setNewScale
public final void setNewScale(float scale) Rescales the group with the given scale factor, leaving the first point fixed.- Parameters:
scale
- the scale factor.
-
setStrokeWidth
public final void setStrokeWidth(float newStroke) Sets the strokeWidth property of this group object.- Overrides:
setStrokeWidth
in classJaxoExtendedObject
- Parameters:
newStroke
- The strokeWidth property of this group object.
-
getAmp
public final int getAmp()Returns the groupAmp property of this group object.- Returns:
- The groupAmp property of this group object.
-
setAmp
public final void setAmp(int amp) Sets the groupAmp property of this group object. If amp != 0, applies the value to all WiggleObjects in the group.- Parameters:
amp
- The groupAmp property of this group object.
-
getLatexTextSize
public final int getLatexTextSize()Returns the groupTeXSize property of this group object.- Returns:
- The groupTeXSize property of this group object.
-
setLatexTextSize
public final void setLatexTextSize(int teXSize) Sets the groupTeXSize property of this group object. If teXSize != 0, applies the value to all LatexText objects in the group.- Parameters:
teXSize
- The groupTeXSize property of this group object.
-
getFont
Returns the groupTextFont property of this text object.- Returns:
- The groupTextFont property of this text object.
-
setFont
Sets the groupTextFont property of this group. If textFont != null, applies the value to all PSText objects in the group.- Parameters:
textFont
- The groupTextFont property of this group object.
-
setFontName
Sets the font name of this group. If the current font is null, the style and size of the font are taken from the preferences.- Parameters:
name
- the font name to set.
-
setFontStyle
public final void setFontStyle(int style) Sets the font style of this group. If the current font is null, the name and size of the font are taken from the preferences.- Parameters:
style
- the font style to set.
-
setFontSize
public final void setFontSize(int size) Sets the font size of this group. If the current font is null, the style and name of the font are taken from the preferences.- Parameters:
size
- the font size to set.
-
setColor
Sets the color for all objects in this group.If newColor != null, applies the value to all objects in the group.- Overrides:
setColor
in classJaxoObject
- Parameters:
newColor
- The color to be set.
-
containsInstanceOf
Determines whether there are instances of the given Class in this group.- Parameters:
clazz
- a Class to look for.- Returns:
- True if the group contains any Object ob for which clazz.isInstance(ob) returns true.
-
prepareEditPanel
Initializes the given editPanel to edit properties of this JaxoObject.- Specified by:
prepareEditPanel
in classJaxoObject
- Parameters:
editPanel
- the panel to prepare.
-