Class DefaultFigureCollection
- java.lang.Object
- 
- com.bc.ceres.swing.figure.AbstractFigure
- 
- com.bc.ceres.swing.figure.support.DefaultFigureCollection
 
 
- 
- All Implemented Interfaces:
- Figure,- FigureCollection,- Restorable,- Cloneable
 - Direct Known Subclasses:
- DefaultFigureSelection
 
 public class DefaultFigureCollection extends AbstractFigure implements FigureCollection 
- 
- 
Nested Class Summary- 
Nested classes/interfaces inherited from interface com.bc.ceres.swing.figure.FigureFigure.Rank
 
- 
 - 
Field Summary- 
Fields inherited from class com.bc.ceres.swing.figure.AbstractFigureNO_FIGURES, NO_HANDLES
 
- 
 - 
Constructor SummaryConstructors Constructor Description DefaultFigureCollection()DefaultFigureCollection(Figure[] figures)
 - 
Method SummaryAll Methods Instance Methods Concrete Methods Modifier and Type Method Description protected booleanaddFigureImpl(int index, Figure figure)The default implementation throws an [@code IllegalStateException}.protected booleanaddFigureImpl(Figure figure)Objectclone()protected Rectangle2DcomputeBounds()booleancontains(Figure figure)The default implementation returnsfalse.Handle[]createHandles(int selectionStage)The default implementation returns an empty array.ObjectcreateMemento()The default implementation returns [@code null}.voiddispose()Disposes this figure.voiddraw(Rendering rendering)Draws this figure using the given rendering.Rectangle2DgetBounds()FiguregetFigure(int index)The default implementation throws an [@code IllegalStateException}.FiguregetFigure(Point2D p, AffineTransform m2v)The default implementation returnsnull.intgetFigureCount()The default implementation returns0.intgetFigureIndex(Figure figure)The default implementation returns0.Figure[]getFigures()The default implementation returns an empty array.Figure[]getFigures(Shape shape)The default implementation returns an empty array.intgetMaxSelectionStage()The default implementation returns zero.Figure.RankgetRank()booleanisCloseTo(Point2D point, AffineTransform m2v)Tests if the given point is "close to" this figure.booleanisCollection()Tests if this figure is a figure collection.booleanisSelectable()The default implementation returnsfalse.booleanisSelected()Tests if the figure is selected.voidmove(double dx, double dy)Moves the figure by the given delta in model coordinates.protected booleanremoveFigureImpl(Figure figure)The default implementation throws an [@code IllegalStateException}.protected Figure[]removeFiguresImpl()voidrotate(Point2D point, double theta)Rotates the figure by the given angle.voidscale(Point2D refPoint, double sx, double sy)Scales the figure by the given scale factors.voidsetMemento(Object memento)The default implementation does nothing.voidsetSelected(boolean selected)Sets the selected state.- 
Methods inherited from class com.bc.ceres.swing.figure.AbstractFigureaddChangeListener, addFigure, addFigure, addFigures, addFiguresImpl, addSegment, createScaleHandles, fireFigureChanged, fireFigureChanged, fireFiguresAdded, fireFiguresRemoved, getChangeListeners, getEffectiveStyle, getHandleStyle, getNormalStyle, getSegment, getSelectedHandleStyle, getSelectedStyle, removeAllFigures, removeChangeListener, removeFigure, removeFigures, removeFiguresImpl, removeSegment, setNormalStyle, setSegment, setSelectable, setSelectedStyle
 - 
Methods inherited from class java.lang.Objectequals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 - 
Methods inherited from interface com.bc.ceres.swing.figure.FigureaddChangeListener, addFigure, addFigure, addFigures, addSegment, getChangeListeners, getEffectiveStyle, getNormalStyle, getSegment, getSelectedStyle, removeAllFigures, removeChangeListener, removeFigure, removeFigures, removeSegment, setNormalStyle, setSegment, setSelectedStyle
 
- 
 
- 
- 
- 
Constructor Detail- 
DefaultFigureCollectionpublic DefaultFigureCollection() 
 - 
DefaultFigureCollectionpublic DefaultFigureCollection(Figure[] figures) 
 
- 
 - 
Method Detail- 
isSelectablepublic boolean isSelectable() Description copied from class:AbstractFigureThe default implementation returnsfalse.- Specified by:
- isSelectablein interface- Figure
- Overrides:
- isSelectablein class- AbstractFigure
- Returns:
- Always false.
 
 - 
isSelectedpublic boolean isSelected() Description copied from interface:FigureTests if the figure is selected.- Specified by:
- isSelectedin interface- Figure
- Overrides:
- isSelectedin class- AbstractFigure
- Returns:
- true, if so.
 
 - 
setSelectedpublic void setSelected(boolean selected) Description copied from interface:FigureSets the selected state.- Specified by:
- setSelectedin interface- Figure
- Overrides:
- setSelectedin class- AbstractFigure
- Parameters:
- selected- The selected state.
 
 - 
isCollectionpublic boolean isCollection() Description copied from interface:FigureTests if this figure is a figure collection.- Specified by:
- isCollectionin interface- Figure
- Returns:
- true, if so.
 
 - 
getRankpublic Figure.Rank getRank() 
 - 
disposepublic void dispose() Description copied from interface:FigureDisposes this figure. Indicates that it will no longer be used.- Specified by:
- disposein interface- Figure
- Overrides:
- disposein class- AbstractFigure
 
 - 
clonepublic Object clone() - Specified by:
- clonein interface- Figure
- Overrides:
- clonein class- AbstractFigure
- Returns:
- A clone of this figure.
 
 - 
getMaxSelectionStagepublic int getMaxSelectionStage() Description copied from class:AbstractFigureThe default implementation returns zero.- Specified by:
- getMaxSelectionStagein interface- Figure
- Overrides:
- getMaxSelectionStagein class- AbstractFigure
- Returns:
- Always 0.
 
 - 
createHandlespublic Handle[] createHandles(int selectionStage) Description copied from class:AbstractFigureThe default implementation returns an empty array. Clients should override in order to create an array of handles suitable for the given selection stage.- Specified by:
- createHandlesin interface- Figure
- Overrides:
- createHandlesin class- AbstractFigure
- Parameters:
- selectionStage- The selection stage.- 1 <= selectionLevel <=- AbstractFigure.getMaxSelectionStage()
- Returns:
- The array of handles.
 
 - 
isCloseTopublic boolean isCloseTo(Point2D point, AffineTransform m2v) Description copied from interface:FigureTests if the given point is "close to" this figure.
 - 
containspublic boolean contains(Figure figure) Description copied from class:AbstractFigureThe default implementation returnsfalse.- Specified by:
- containsin interface- Figure
- Overrides:
- containsin class- AbstractFigure
- Parameters:
- figure- A figure.
- Returns:
- Always false.
 
 - 
getFigureCountpublic int getFigureCount() Description copied from class:AbstractFigureThe default implementation returns0.- Specified by:
- getFigureCountin interface- Figure
- Overrides:
- getFigureCountin class- AbstractFigure
- Returns:
- Always 0.
 
 - 
getFigureIndexpublic int getFigureIndex(Figure figure) Description copied from class:AbstractFigureThe default implementation returns0.- Specified by:
- getFigureIndexin interface- Figure
- Overrides:
- getFigureIndexin class- AbstractFigure
- Parameters:
- figure- The child figure to look up.
- Returns:
- Always 0.
 
 - 
getFigurepublic Figure getFigure(int index) Description copied from class:AbstractFigureThe default implementation throws an [@code IllegalStateException}.- Specified by:
- getFigurein interface- Figure
- Overrides:
- getFigurein class- AbstractFigure
- Parameters:
- index- The child index.
- Returns:
- Does never return normally.
 
 - 
getFigurepublic Figure getFigure(Point2D p, AffineTransform m2v) Description copied from class:AbstractFigureThe default implementation returnsnull.- Specified by:
- getFigurein interface- Figure
- Overrides:
- getFigurein class- AbstractFigure
- Parameters:
- p- Point in model coordinates.
- m2v- Current model-to-view transformation.
- Returns:
- Always null.
 
 - 
getFigurespublic Figure[] getFigures(Shape shape) Description copied from class:AbstractFigureThe default implementation returns an empty array.- Specified by:
- getFiguresin interface- Figure
- Overrides:
- getFiguresin class- AbstractFigure
- Parameters:
- shape- The shape defining the area in which the figures must be contained.
- Returns:
- Always an empty array.
 
 - 
getFigurespublic Figure[] getFigures() Description copied from class:AbstractFigureThe default implementation returns an empty array.- Specified by:
- getFiguresin interface- Figure
- Overrides:
- getFiguresin class- AbstractFigure
- Returns:
- Always an empty array.
 
 - 
addFigureImplprotected boolean addFigureImpl(Figure figure) - Overrides:
- addFigureImplin class- AbstractFigure
 
 - 
addFigureImplprotected boolean addFigureImpl(int index, Figure figure)Description copied from class:AbstractFigureThe default implementation throws an [@code IllegalStateException}.- Overrides:
- addFigureImplin class- AbstractFigure
- Parameters:
- index- The index.
- figure- The figure.
- Returns:
- Does never return normally.
 
 - 
removeFigureImplprotected boolean removeFigureImpl(Figure figure) Description copied from class:AbstractFigureThe default implementation throws an [@code IllegalStateException}.- Overrides:
- removeFigureImplin class- AbstractFigure
- Parameters:
- figure- The figure.
- Returns:
- Does never return normally.
 
 - 
removeFiguresImplprotected Figure[] removeFiguresImpl() - Overrides:
- removeFiguresImplin class- AbstractFigure
 
 - 
getBoundspublic Rectangle2D getBounds() 
 - 
movepublic void move(double dx, double dy)Description copied from interface:FigureMoves the figure by the given delta in model coordinates.- Specified by:
- movein interface- Figure
- Overrides:
- movein class- AbstractFigure
- Parameters:
- dx- Delta X in model coordinates.
- dy- Delta Y in model coordinates.
 
 - 
scalepublic void scale(Point2D refPoint, double sx, double sy) Description copied from interface:FigureScales the figure by the given scale factors.- Specified by:
- scalein interface- Figure
- Overrides:
- scalein class- AbstractFigure
- Parameters:
- refPoint- The reference point in model coordinates.
- sx- Scale X factor.
- sy- Scale Y factor.
 
 - 
rotatepublic void rotate(Point2D point, double theta) Description copied from interface:FigureRotates the figure by the given angle.- Specified by:
- rotatein interface- Figure
- Overrides:
- rotatein class- AbstractFigure
- Parameters:
- point- The reference point in model coordinates.
- theta- The rotation angle in degree.
 
 - 
drawpublic void draw(Rendering rendering) Description copied from interface:FigureDraws this figure using the given rendering.
 - 
createMementopublic Object createMemento() Description copied from class:AbstractFigureThe default implementation returns [@code null}. Clients should override in order to produce something more meaningful.- Specified by:
- createMementoin interface- Restorable
- Overrides:
- createMementoin class- AbstractFigure
- Returns:
- Always null.
 
 - 
setMementopublic void setMemento(Object memento) Description copied from class:AbstractFigureThe default implementation does nothing. Clients should override in order to evaluate the passed inmemento. object.- Specified by:
- setMementoin interface- Restorable
- Overrides:
- setMementoin class- AbstractFigure
- Parameters:
- memento- A memento object.
 
 - 
computeBoundsprotected Rectangle2D computeBounds() 
 
- 
 
-