Interface DesignableDelegate
-
- All Known Implementing Classes:
BlockDiagramItemDelegate
,JComponentItemDelegate
,StandaloneDelegate
public interface DesignableDelegate
Defines many functions required for the design panel to interact with a DesignableContainer.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description void
addObject(javax.swing.JComponent parent, javax.swing.JComponent newChild, java.awt.geom.Rectangle2D newBounds)
Adds the child into the given parent (which must be a container) at the given bounds, relative to the parent.void
copyMove(java.util.List<javax.swing.JComponent> objects, double dX, double dY)
java.util.Iterator<? extends javax.swing.JComponent>
findChildren(javax.swing.JComponent container)
Returns an iterator that iterates through the children of the given container in decreasing Z-order (highest layer to lowest layer)java.util.List<javax.swing.JComponent>
findObjectsAt(DesignableContainer container, java.awt.Point point)
Performs a basic "hit-test" to find objects in a container underneath a point.java.awt.geom.Rectangle2D
getBounds(javax.swing.JComponent item, javax.swing.JComponent relativeTo, java.awt.geom.Rectangle2D rect)
Fetch the current bounds of the given item, relative to the supplied JComponent.int
getChildCount(javax.swing.JComponent container)
Returns the count of the number of items currently held in the given containerjava.lang.String
getName(javax.swing.JComponent object)
Returns the "name" of the object.javax.swing.JComponent
getOffsettingParent(javax.swing.JComponent source)
Find the parent component for whose bounds the component is relative to.javax.swing.JComponent
getParent(javax.swing.JComponent child)
Finds the given item's parent in the container hierarchyjava.awt.geom.Point2D
getRotationAnchor(javax.swing.JComponent object)
Get the initial or last-used rotation anchor for an object.java.awt.Shape
getShapeBounds(javax.swing.JComponent item, javax.swing.JComponent relativeTo, java.awt.Rectangle rect)
Return non-rectangular bounds of the given item relative to the supplied JComponent.boolean
isContainer(javax.swing.JComponent item)
Determines whether any given object is a container.boolean
isLocked(javax.swing.JComponent item)
Returns whether a normally movable object is currently locked or notboolean
isMovable(javax.swing.JComponent item)
Defines whether or not an item is inherently movable or not.boolean
isOffsettingParent(javax.swing.JComponent container)
Tests whether this container is an offsetting parent or notboolean
isRotateCapable(javax.swing.JComponent item)
Returns whether or not an item supports being rotated.void
moveObject(javax.swing.JComponent object, java.awt.geom.Point2D newLocation)
Move the given item to the new location.void
notifyObjectsMoved(java.util.List<javax.swing.JComponent> objects, java.util.Map<javax.swing.JComponent,java.awt.geom.Rectangle2D> originalPositions)
void
notifyObjectsRotated(java.util.List<javax.swing.JComponent> objects, double angle, java.awt.geom.Point2D rotationAnchor)
void
rotateObject(javax.swing.JComponent object, double angle, java.awt.geom.Point2D rotationAnchor)
Rotate the object around the given point by the angle specified.void
scaleObject(javax.swing.JComponent object, java.awt.geom.Rectangle2D newBounds)
Scale the given item to the new bounds.void
setRotationAnchor(javax.swing.JComponent object, java.awt.geom.Point2D point)
When the rotation anchor gets moved, this is used to store the rotation anchor so that it can be retrieved next time the object is selected.void
setZOrderPosition(javax.swing.JComponent item, int position)
-
-
-
Method Detail
-
getBounds
java.awt.geom.Rectangle2D getBounds(javax.swing.JComponent item, javax.swing.JComponent relativeTo, java.awt.geom.Rectangle2D rect)
Fetch the current bounds of the given item, relative to the supplied JComponent. If the rect argument is null, a new Rectangle should be instantiated and returned. Otherwise, rect should be modified and returned to avoid unnecessary Rectangle instantiation, because this function is called very frequently.
-
getShapeBounds
java.awt.Shape getShapeBounds(javax.swing.JComponent item, javax.swing.JComponent relativeTo, java.awt.Rectangle rect)
Return non-rectangular bounds of the given item relative to the supplied JComponent. If the bounds happen to be rectangular, you may alter the supplied rectangle to avoid instantiating a new shape.
-
getOffsettingParent
javax.swing.JComponent getOffsettingParent(javax.swing.JComponent source)
Find the parent component for whose bounds the component is relative to.
-
isOffsettingParent
boolean isOffsettingParent(javax.swing.JComponent container)
Tests whether this container is an offsetting parent or not
-
isMovable
boolean isMovable(javax.swing.JComponent item)
Defines whether or not an item is inherently movable or not. Note that a normally movable object that is currently "locked" would still return true for this function.
-
isLocked
boolean isLocked(javax.swing.JComponent item)
Returns whether a normally movable object is currently locked or not
-
isRotateCapable
boolean isRotateCapable(javax.swing.JComponent item)
Returns whether or not an item supports being rotated.
-
isContainer
boolean isContainer(javax.swing.JComponent item)
Determines whether any given object is a container. That is - whether it contains other selectable objects inside itself.- Parameters:
item
- The item to test- Returns:
- true if item is a container.
-
findObjectsAt
java.util.List<javax.swing.JComponent> findObjectsAt(DesignableContainer container, java.awt.Point point)
Performs a basic "hit-test" to find objects in a container underneath a point.- Parameters:
point
- The point in question, relative to the DesignableContainer
-
findChildren
java.util.Iterator<? extends javax.swing.JComponent> findChildren(javax.swing.JComponent container)
Returns an iterator that iterates through the children of the given container in decreasing Z-order (highest layer to lowest layer)
-
getChildCount
int getChildCount(javax.swing.JComponent container)
Returns the count of the number of items currently held in the given container
-
getParent
javax.swing.JComponent getParent(javax.swing.JComponent child)
Finds the given item's parent in the container hierarchy
-
moveObject
void moveObject(javax.swing.JComponent object, java.awt.geom.Point2D newLocation)
Move the given item to the new location. Location is relative to its parent. This is used for realtime, transient moves, so it shouldn't add an undo action.
-
scaleObject
void scaleObject(javax.swing.JComponent object, java.awt.geom.Rectangle2D newBounds)
Scale the given item to the new bounds. Bounds location is relative to its parent. This is used for realtime, transient scales, so it shouldn't add an undo action.
-
rotateObject
void rotateObject(javax.swing.JComponent object, double angle, java.awt.geom.Point2D rotationAnchor)
Rotate the object around the given point by the angle specified.- Parameters:
object
- The object to rotate.angle
- The angle to rotate, specified in radians.rotationAnchor
- The rotation center, relative to the object's parent.
-
getRotationAnchor
java.awt.geom.Point2D getRotationAnchor(javax.swing.JComponent object)
Get the initial or last-used rotation anchor for an object. Point should be specified as a percentage of the object's bounds relative to its position. For example, the center of its bounding rectangle is (0.5, 0.5)
-
setRotationAnchor
void setRotationAnchor(javax.swing.JComponent object, java.awt.geom.Point2D point)
When the rotation anchor gets moved, this is used to store the rotation anchor so that it can be retrieved next time the object is selected.
-
setZOrderPosition
void setZOrderPosition(javax.swing.JComponent item, int position)
-
notifyObjectsMoved
void notifyObjectsMoved(java.util.List<javax.swing.JComponent> objects, java.util.Map<javax.swing.JComponent,java.awt.geom.Rectangle2D> originalPositions)
-
notifyObjectsRotated
void notifyObjectsRotated(java.util.List<javax.swing.JComponent> objects, double angle, java.awt.geom.Point2D rotationAnchor)
-
getName
java.lang.String getName(javax.swing.JComponent object)
Returns the "name" of the object.
-
copyMove
void copyMove(java.util.List<javax.swing.JComponent> objects, double dX, double dY)
-
addObject
void addObject(javax.swing.JComponent parent, javax.swing.JComponent newChild, java.awt.geom.Rectangle2D newBounds)
Adds the child into the given parent (which must be a container) at the given bounds, relative to the parent. If the bounds rectangle is null, then the component is assumed to already have it's location set on it.
-
-