|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectjava.awt.geom.RectangularShape
java.awt.geom.Rectangle2D
java.awt.Rectangle
simtools.diagram.DiagramSelection
public class DiagramSelection
This class is used to define a selection area on a diagram
DiagramComponent
,
Serialized FormNested Class Summary | |
---|---|
class |
DiagramSelection.ShapeHorizontalPositionComparator
Sort shapes according their horizontal position. |
class |
DiagramSelection.ShapeVerticalPositionComparator
Sort shapes according their vertical position. |
Nested classes/interfaces inherited from class java.awt.geom.Rectangle2D |
---|
java.awt.geom.Rectangle2D.Double, java.awt.geom.Rectangle2D.Float |
Field Summary |
---|
Fields inherited from class java.awt.Rectangle |
---|
height, width, x, y |
Fields inherited from class java.awt.geom.Rectangle2D |
---|
OUT_BOTTOM, OUT_LEFT, OUT_RIGHT, OUT_TOP |
Constructor Summary | |
---|---|
DiagramSelection()
Creates a new empty diagram selection |
Method Summary | |
---|---|
protected boolean |
add(DiagramSelectedShape dss)
Adds a selected shape if it is not already selected |
protected boolean |
addAllShapes()
Add all the shapes to the selection By overriding this method, one can use an other iterator on the shapes. |
void |
addListener(DiagramSelectionListener dcpl)
Adds a new Listener on component selection |
boolean |
addPoint(int ox,
int oy)
Adds one shape to the selection at a given point. |
protected boolean |
addShapeAt(int ox,
int oy)
The first shape which contains the given coordinates is added to the selected shapes list. |
protected boolean |
addShapesInside()
All the shapes which are inside the selection area By overriding this method, one can use an other iterator on the shapes. |
void |
alignSelection()
Aligns the selected shapes |
void |
alignSelectionHCenter()
Align the content of the selection on its horizontal barycentre |
void |
alignSelectionToBottom()
Align the content of the selection on the bottom of the lowest shape |
void |
alignSelectionToLeft()
Align the content of the selection on the left of the leftmost shape |
void |
alignSelectionToRight()
Align the content of the selection on the right of the rightmost shape |
void |
alignSelectionToTop()
Align the content of the selection on the top of the highest shape |
void |
alignSelectionVCenter()
Align the content of the selection on its vertical barycentre |
void |
bringSelectionForward()
Brings the selected shapes one step closer to the top of the display |
void |
bringSelectionToFront()
Brings the selected shapes to the top of the display |
int |
checkResizeWay(int x,
int y)
Check if resize or translate is required This implementation can resize elements if the selection contains only one component that is not a DiagramConnection nor a DiagramConnector but a Resizable or a LineInterface object |
protected void |
clear()
Removes all the selected shapes |
java.awt.Shape |
copyConnectionShape(java.awt.Shape s,
DiagramConnector in,
DiagramConnector out)
Copies a connection shape This implementation creates nothing By overriding this method, specif shapes can be managed |
java.util.Vector |
copySelection(java.awt.Point p)
Creates a copy of the selected shapes. |
java.awt.Shape |
copyShape(java.awt.Shape s)
To copy a shape only Rectangle shapes are copied By overriding this method, specif shapes can be managed |
void |
deleteSelection()
Deletes the selected shapes |
void |
deleteShape(java.awt.Shape s)
Deletse a shape By overriding this method, one can use an other iterator on the shapes. |
void |
distributeSelectionHorizontally()
Distributes the selected shapes so there is equal horizontal distance between the edges of all them |
void |
distributeSelectionVertically()
Distributes the selected shapes so there is equal vertical distance between the edges of all them |
DiagramComponent |
getComponent()
Gets the component using this diagram selection. |
int |
getGrid()
Gets the grid step for translation computation |
DiagramSelectedShape |
getSelectedShape(int i)
Gets the nth DiagramSelectedShape in the selection |
DiagramSelectedShape |
getSelectedShape(java.awt.Shape s)
Checks if one shape is selected |
java.awt.Shape |
getSelectedShapeAt(int ox,
int oy)
Checks if a shape already selected contains a given point |
java.util.Vector |
getSelection()
Gets a list of selected diagram elements |
java.awt.Shape |
getShape(int i)
Gets the nth shape in the selection |
int |
getShapeCount()
Gets the amount of shape in the selection |
java.awt.Point |
getShapeOrigin(java.awt.Shape s,
java.awt.Point p)
Computes shape origin before its move for a rectangle the top-left point coordinate is returned for a default shape the top-left point coordinate of its bounds is returned By overriding this method, specif shapes can be managed |
int |
gridPosition(int v)
Gets the grid nearest position |
boolean |
isEmpty()
Checks if the selection is empty |
boolean |
isSelected(int ox,
int oy)
Checks if a shape already selected contains a given point |
boolean |
isSelected(java.awt.Shape s)
Checks if one shape is selected |
boolean |
isSizing()
Checks if the selection is defined by a rectangle shape and the user is modifiing its size |
protected void |
propagate()
Propagates to listeners |
void |
removeAllListeners()
Removes all Listeners on component selection |
void |
removeListener(DiagramSelectionListener dcpl)
Removes a Listener on component selection |
void |
removeShapeAt(int i)
Removes one shape |
void |
resizeSelection(int dx,
int dy,
int way)
Resize the selection This implementation can resize elements if the selection contains only one component and if this component is not a DaigramConnection nor a DiagramConnector but a Resizable object |
void |
resizeShape(java.awt.Shape s,
int dx,
int dy)
Resizes a shape By overriding this method, specif shapes can be managed |
boolean |
selectAll()
Selects all the shapes. |
boolean |
selectArea(int ox,
int oy,
int w,
int h)
Selects shapes inside an area Previous selected shapes are unselected. |
boolean |
selectAreaEnd()
End of the definition of the area size The area rectangle is no more needed Selected shapes are the one computed at the previous call of selectArea |
boolean |
selectPoint(int ox,
int oy)
Selects one shape at the given point. |
void |
sendSelectionBackward()
Sends the selected shapes one step deeper in the document |
void |
sendSelectionToBack()
Sends the selected shapes to the bottom of the document |
void |
setGrid(int grid)
Sets the grid step for translation computation |
void |
setShapes(java.util.Vector v)
Sets shapes which can be selected (test only) |
void |
translateConnectionShape(java.awt.Shape s,
DiagramConnector c,
int dx,
int dy)
Translates a shape connected to an other one This implementation translates nothing By overriding this method, specif shapes can be managed |
void |
translateSelection(int dx,
int dy)
Translates the selected shapes |
void |
translateShape(java.awt.Shape s,
int dx,
int dy)
Translates a shape only Rectangle shapes are translated By overriding this method, specif shapes can be managed |
void |
unselect()
Empties the selection |
Methods inherited from class java.awt.Rectangle |
---|
add, add, add, contains, contains, contains, contains, createIntersection, createUnion, equals, getBounds, getBounds2D, getHeight, getLocation, getSize, getWidth, getX, getY, grow, inside, intersection, intersects, move, outcode, reshape, resize, setBounds, setBounds, setLocation, setLocation, setRect, setSize, setSize, toString, translate, union |
Methods inherited from class java.awt.geom.Rectangle2D |
---|
add, add, add, contains, contains, getPathIterator, getPathIterator, hashCode, intersect, intersects, intersectsLine, intersectsLine, outcode, setFrame, setRect, union |
Methods inherited from class java.awt.geom.RectangularShape |
---|
clone, contains, contains, getCenterX, getCenterY, getFrame, getMaxX, getMaxY, getMinX, getMinY, intersects, setFrame, setFrame, setFrameFromCenter, setFrameFromCenter, setFrameFromDiagonal, setFrameFromDiagonal |
Methods inherited from class java.lang.Object |
---|
finalize, getClass, notify, notifyAll, wait, wait, wait |
Methods inherited from interface java.awt.Shape |
---|
contains, contains, contains, contains, getPathIterator, getPathIterator, intersects, intersects |
Constructor Detail |
---|
public DiagramSelection()
Method Detail |
---|
public DiagramComponent getComponent()
protected void propagate()
public void addListener(DiagramSelectionListener dcpl)
public void removeListener(DiagramSelectionListener dcpl)
public void removeAllListeners()
public void setShapes(java.util.Vector v)
v
- the list of diagram selectable shapespublic boolean isSelected(java.awt.Shape s)
s
- the shape
public DiagramSelectedShape getSelectedShape(java.awt.Shape s)
s
- the shape
public boolean isSelected(int ox, int oy)
ox
- point coordinate along X axisoy
- point coordinate along Y axis
public java.awt.Shape getSelectedShapeAt(int ox, int oy)
ox
- point coordinate along X axisoy
- point coordinate along Y axis
public boolean isEmpty()
isEmpty
in class java.awt.Rectangle
public boolean isSizing()
public void unselect()
public boolean selectPoint(int ox, int oy)
ox
- point coordinate along X axisoy
- point coordinate along Y axis
public boolean selectAll()
public int getShapeCount()
public java.awt.Shape getShape(int i)
i
- shape number
public DiagramSelectedShape getSelectedShape(int i)
i
- shape number
public void removeShapeAt(int i)
i
- the shape numberpublic boolean addPoint(int ox, int oy)
ox
- point coordinate along X axisoy
- point coordinate along Y axis
public boolean selectArea(int ox, int oy, int w, int h)
ox
- origin along X axisoy
- origin along Y axisw
- area widthh
- area height
public boolean selectAreaEnd()
public void setGrid(int grid)
gris
- the gid steppublic int getGrid()
public int gridPosition(int v)
v
- a coordinate
public java.util.Vector getSelection()
public java.util.Vector copySelection(java.awt.Point p)
p
- the selection origin
public void deleteSelection()
public void alignSelection()
public int checkResizeWay(int x, int y)
x
- the mouse locationy
- the mouse location
public void resizeSelection(int dx, int dy, int way)
dx
- resize value on X axisdy
- resize value on Y axisway
- the resize way : 1=N, 2=NE, ...public void translateSelection(int dx, int dy)
public void bringSelectionToFront()
public void bringSelectionForward()
public void sendSelectionBackward()
public void sendSelectionToBack()
public void alignSelectionToTop()
public void alignSelectionToBottom()
public void alignSelectionToLeft()
public void alignSelectionToRight()
public void alignSelectionVCenter()
public void alignSelectionHCenter()
public void distributeSelectionHorizontally()
public void distributeSelectionVertically()
public java.awt.Point getShapeOrigin(java.awt.Shape s, java.awt.Point p)
s
- the shapep
- a Point to put coordinates into
(if null then a new Point is returned)
public void translateShape(java.awt.Shape s, int dx, int dy)
s
- the shapedx
- x translationdy
- y translationpublic void resizeShape(java.awt.Shape s, int dx, int dy)
s
- the resizable shapedx
- x resizingdy
- y resizingpublic void translateConnectionShape(java.awt.Shape s, DiagramConnector c, int dx, int dy)
s
- the shapec
- the connectordx
- x translationdy
- y translationpublic java.awt.Shape copyShape(java.awt.Shape s)
s
- the shape
public java.awt.Shape copyConnectionShape(java.awt.Shape s, DiagramConnector in, DiagramConnector out)
s
- the shapein
- the input connectorout
- the output connector
public void deleteShape(java.awt.Shape s)
s
- the shapeprotected void clear()
protected boolean add(DiagramSelectedShape dss)
protected boolean addAllShapes()
protected boolean addShapeAt(int ox, int oy)
ox
- the x coordinateoy
- the y coordinateprotected boolean addShapesInside()
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |