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 JaxoExtendedObject
SELECT_DX, SELECT_DY, SELECT_P2Fields inherited from class 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 TypeMethodDescriptionbooleancanBeSelected(int handle, int mode) Determines if the object can be selected (moved, edited, etc) from the given point in a given edit mode.final voidRemoves all JaxoObjects from the Group.final booleancontainsInstanceOf(Class<?> clazz) Determines whether there are instances of the given Class in this group.final JaxoObjectcopy()Returns an exact copy of this JaxoGroup.voidSets all parameters from the given object to the current one.final intgetAmp()Returns the groupAmp property of this group object.Returns the bounding box of this object.final FontgetFont()Returns the groupTextFont property of this text object.final intgetGrabbedHandle(int clickX, int clickY, JaxoHandle h) Determines which handle the user has selected to move/resize/edit an object.final intReturns the groupTeXSize property of this group object.final JaxoList<JaxoObject> Returns the JaxoObjects in this group.final booleanisCopy(JaxoObject comp) Determines if this JaxoObject is a copy of the specified one.final StringlatexCommand(float scale, Dimension canvasDim) The latex command of this group (obsolete because every JaxoObject has its own latex command).final StringThe latex command setting the width of this group (obsolete because every JaxoObject has its own latexWidth).final voidmoveBy(int deltaX, int deltaY) Displaces the group.final voidpaint(JaxoGraphics2D g2) The method that paints the JaxoObject.final voidpaintHandles(JaxoGraphics2D g2, JaxoHandle h, int editMode) Paints the handles of this JaxoObject that allow to move/resize/edit it.final voidPaints a visual aid for the user during dragging (moving or resizing) of this JaxoObject.voidprepareEditPanel(JaxoObjectEditPanel editPanel) Initializes the given editPanel to edit properties of this JaxoObject.final voidrescaleObject(int orx, int ory, float scale) Rescale this JaxoObject by the scale factor scale, keeping the point (orx, ory) fixed.final voidsetAmp(int amp) Sets the groupAmp property of this group object.final voidSets the color for all objects in this group.If newColor !final voidSets the groupTextFont property of this group.final voidsetFontName(String name) Sets the font name of this group.final voidsetFontSize(int size) Sets the font size of this group.final voidsetFontStyle(int style) Sets the font style of this group.final voidsetLatexTextSize(int teXSize) Sets the groupTeXSize property of this group object.final voidsetNewScale(float scale) Rescales the group with the given scale factor, leaving the first point fixed.final voidsetObjectList(JaxoList<JaxoObject> obList) Sets the JaxoObjects of this group.voidRestore state to the values of 'o'.final voidsetStrokeWidth(float newStroke) Sets the strokeWidth property of this group object.final intsize()Returns the number of JaxoObjects in this group.final floatsmallestDistanceTo(int px, int py) Determines the smallest distance of any of the handles of this JaxoObject from the given point.Methods inherited from class 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, strokeIsMethods inherited from class 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:
copyin classJaxoObject- Returns:
- A copy of this JaxoGroup.
-
isCopy
Determines if this JaxoObject is a copy of the specified one.- Overrides:
isCopyin 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:
setStatein classJaxoExtendedObject- Parameters:
o- the object to copy from.
-
getGrabbedHandle
Determines which handle the user has selected to move/resize/edit an object.- Overrides:
getGrabbedHandlein 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:
canBeSelectedin 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:
paintHandlesin 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:
smallestDistanceToin 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:
paintVisualAidin classJaxoObject- Parameters:
g2- The graphics context to paint the visual aid.
-
paint
The method that paints the JaxoObject.- Specified by:
paintin 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:
moveByin 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:
latexCommandin 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:
latexWidthin 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:
rescaleObjectin 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:
setStrokeWidthin 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:
setColorin 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:
prepareEditPanelin classJaxoObject- Parameters:
editPanel- the panel to prepare.
-