public class DrawGroup extends DrawItem
A DrawGroup has no local visual representation other than that of its drawItems. Adding items to a drawGroup allows for central event handling, and allows them to be manipulated (drawn, scaled, etc) together.
DrawItems are added to a DrawGroup by creating the DrawItems with drawGroup
set to a drawGroup, or by calling addItem
.
DrawGroups handle events by having an explicitly
specified group rectangle (see getGroupRect
).
This rectangle has no visual representation within the draw pane (is not visible) but any user-interactions within the
specified coordinates will trigger group level events.
DrawGroups may contain other DrawGroups.
config, id, scClassName
Constructor and Description |
---|
DrawGroup() |
DrawGroup(com.google.gwt.core.client.JavaScriptObject jsObj) |
Modifier and Type | Method and Description |
---|---|
java.lang.Boolean |
click()
Executed when the left mouse is clicked (pressed and then released) on this widget.
|
com.google.gwt.core.client.JavaScriptObject |
create() |
void |
erase()
Erases all DrawItems in the DrawGroup.
|
int[] |
getBoundingBox()
Returns the top, left, top+height, left+width
|
int[] |
getCenter()
Get the center coordinates of the rectangle
|
DrawItem[] |
getDrawItems()
Initial list of DrawItems for this DrawGroup.
|
Rectangle |
getGroupRect()
This method will return an array of integers mapping out the coordinates (left, top, width, height) of the "group
rectangle" for the group.
|
int |
getHeight()
Height of the
group rectangle in pixels relative to
the DrawPane. |
KnobType[] |
getKnobs()
NOTE: DrawGroups do not support knobs.
|
int |
getLeft()
Left coordinate of the
group rectangle in pixels
relative to the DrawPane. |
static DrawGroup |
getOrCreateRef(com.google.gwt.core.client.JavaScriptObject jsObj) |
int |
getTop()
Top coordinate of the
group rectangle in pixels
relative to the DrawPane. |
int |
getWidth()
Width of the
group rectangle in pixels relative to
the DrawPane. |
java.lang.Boolean |
mouseDown()
Executed when the left mouse down is pressed on this widget.
|
java.lang.Boolean |
mouseMove()
Executed when the mouse moves within this widget.
|
java.lang.Boolean |
mouseOut()
Executed when the mouse leaves this widget.
|
java.lang.Boolean |
mouseOver()
Executed when mouse enters this widget.
|
java.lang.Boolean |
mouseUp()
Executed when the left mouse is released on this widget.
|
void |
moveBy(int left,
int top)
Move all member drawItems by the specified number of pixels.
|
void |
moveTo(int left,
int top)
Set both the left and top coordinate of this drawGroup
group rectangle . |
void |
rotateBy(java.lang.String degrees)
Rotate the group by degrees.
|
void |
rotateTo(java.lang.String degrees)
Rotate the group to degrees.
|
void |
scaleBy(double x,
double y)
Scale all drawItem[] shapes by the x, y multipliers
|
void |
scaleBy(float x,
float y)
Scale all drawItem[] shapes by the x, y multipliers
|
void |
scaleTo(double x,
double y)
Scale the each item in the drawGroup by the x, y multipliers
|
void |
scaleTo(float x,
float y)
Scale the each item in the drawGroup by the x, y multipliers
|
static void |
setDefaultProperties(DrawGroup drawGroupProperties)
Class level method to set the default properties of this class.
|
void |
setDrawItems(DrawItem... drawItems)
Initial list of DrawItems for this DrawGroup.
|
void |
setHeight(int height)
Height of the
group rectangle in pixels relative to
the DrawPane. |
void |
setJavaScriptObject(com.google.gwt.core.client.JavaScriptObject jsObj) |
void |
setKnobs(KnobType... knobs)
NOTE: DrawGroups do not support knobs.
|
void |
setLeft(int left)
Left coordinate of the
group rectangle in pixels
relative to the DrawPane. |
void |
setTop(int top)
Top coordinate of the
group rectangle in pixels
relative to the DrawPane. |
void |
setWidth(int width)
Width of the
group rectangle in pixels relative to
the DrawPane. |
addClickHandler, addDragMoveHandler, addDragResizeMoveHandler, addDragStartHandler, addDragStopHandler, addMouseDownHandler, addMouseMoveHandler, addMouseOutHandler, addMouseOverHandler, addMouseUpHandler, addMovedHandler, addResizedHandler, addShowContextMenuHandler, computeAngle, computeAngleAsDouble, dragResizeMove, draw, getAttributeAsIntArray, getCanDrag, getCanHover, getContextMenu, getCursor, getDestroyed, getDestroying, getDragStartDistance, getDrawGroup, getDrawPane, getEndArrow, getFillColor, getFillGradient, getFillOpacity, getHoverHTML, getKeepInParentRect, getLineCap, getLineColor, getLineOpacity, getLinePattern, getLineWidth, getMoveKnobOffset, getMoveKnobPoint, getPageLeft, getPageTop, getPrompt, getRef, getResizeKnobPoints, getRotation, getScale, getShadow, getShowHover, getStartArrow, getSvgString, hide, hideKnobs, hover, isInBounds, isPointInPath, resizeBy, resizeTo, rotateBy, rotateBy, rotateTo, rotateTo, setAttribute, setCanDrag, setCanHover, setContextMenu, setCursor, setDefaultProperties, setDragStartDistance, setDrawGroup, setDrawPane, setEndArrow, setFillColor, setFillGradient, setFillOpacity, setKeepInParentRect, setKeepInParentRect, setLineCap, setLineColor, setLineOpacity, setLinePattern, setLineWidth, setMoveKnobOffset, setMoveKnobPoint, setPrompt, setResizeKnobPoints, setRotation, setScale, setShadow, setShowHover, setStartArrow, show, showKnobs
asSGWTComponent, destroy, doAddHandler, doInit, error, error, errorIfNotCreated, fireEvent, getAttribute, getAttributeAsBoolean, getAttributeAsDate, getAttributeAsDouble, getAttributeAsElement, getAttributeAsFloat, getAttributeAsInt, getAttributeAsJavaScriptObject, getAttributeAsMap, getAttributeAsString, getAttributeAsStringArray, getClassName, getConfig, getHandlerCount, getID, getJsObj, getOrCreateJsObj, getScClassName, internalSetID, internalSetID, isCreated, onBind, onInit, registerID, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setID, setProperty, setProperty, setProperty, setProperty, setScClassName
public DrawGroup()
public DrawGroup(com.google.gwt.core.client.JavaScriptObject jsObj)
public static DrawGroup getOrCreateRef(com.google.gwt.core.client.JavaScriptObject jsObj)
public void setJavaScriptObject(com.google.gwt.core.client.JavaScriptObject jsObj)
setJavaScriptObject
in class DrawItem
public com.google.gwt.core.client.JavaScriptObject create()
public void setHeight(int height)
group rectangle
in pixels relative to
the DrawPane.
group rectangle
. Note that setting this attribute will not move or resize the drawItems in this group.height
- new height for the event rect. Default value is 1public int getHeight()
group rectangle
in pixels relative to
the DrawPane.public void setKnobs(KnobType... knobs)
public KnobType[] getKnobs()
public void setLeft(int left)
group rectangle
in pixels
relative to the DrawPane.
group rectangle
. Note that setting this attribute will not move the drawItems in this group.left
- new left coordinate in pixels. Default value is 0public int getLeft()
group rectangle
in pixels
relative to the DrawPane.public void setTop(int top)
group rectangle
in pixels
relative to the DrawPane.
group rectangle
. Note that setting this attribute will not move the drawItems in this group.top
- new top coordinate in pixels. Default value is 0public int getTop()
group rectangle
in pixels
relative to the DrawPane.public void setWidth(int width)
group rectangle
in pixels relative to
the DrawPane.
group rectangle
. Note that setting this attribute will not move or resize the drawItems in this group.width
- new width for the event rect. Default value is 1public int getWidth()
group rectangle
in pixels relative to
the DrawPane.public java.lang.Boolean click()
Canvas.getOffsetX()
,
Canvas.getOffsetY()
public java.lang.Boolean mouseDown()
Canvas.getOffsetX()
,
Canvas.getOffsetY()
public java.lang.Boolean mouseMove()
Canvas.getOffsetX()
,
Canvas.getOffsetY()
,
Mouse events Examplepublic java.lang.Boolean mouseOut()
public java.lang.Boolean mouseOver()
Canvas.getOffsetX()
,
Canvas.getOffsetY()
public java.lang.Boolean mouseUp()
Canvas.getOffsetX()
,
Canvas.getOffsetY()
,
Mouse events Examplepublic void moveBy(int left, int top)
group rectangle
, moving it by the same offset.public void moveTo(int left, int top)
group rectangle
. Unlike DrawGroup.moveBy
, this will not
move the drawItems in this group.left
- new left coordinate in pixelstop
- new top coordinate in pixelspublic void scaleBy(float x, float y)
public void scaleBy(double x, double y)
public void scaleTo(float x, float y)
public void scaleTo(double x, double y)
public static void setDefaultProperties(DrawGroup drawGroupProperties)
Note: This method is intended for setting default attributes only and will effect all instances of the underlying class (including those automatically generated in JavaScript). This method should not be used to apply standard EventHandlers or override methods for a class - use a custom subclass instead.
drawGroupProperties
- properties that should be used as new defaults when instances of this class are createdpublic void rotateBy(java.lang.String degrees)
degrees
- public void rotateTo(java.lang.String degrees)
degrees
- public int[] getBoundingBox()
getBoundingBox
in class DrawItem
public int[] getCenter()
public void setDrawItems(DrawItem... drawItems) throws java.lang.IllegalStateException
DrawItems can be added to a DrawGroup after initialization by setting
drawGroup
.
drawItems
- drawItems Default value is nulljava.lang.IllegalStateException
- this property cannot be changed after the underlying component has been createdpublic DrawItem[] getDrawItems()
DrawItems can be added to a DrawGroup after initialization by setting
drawGroup
.
public Rectangle getGroupRect()
Developers may also use left
, top
, width
and height
to manage each coordinate directly.