public class DrawItem extends BaseClass implements HasClickHandlers, HasMouseDownHandlers, HasMouseMoveHandlers, HasMouseOutHandlers, HasMouseOverHandlers, HasMouseUpHandlers, HasMovedHandlers, HasDragMoveHandlers, HasDragResizeMoveHandlers, HasDragResizeStartHandlers, HasDragResizeStopHandlers, HasDragStartHandlers, HasDragStopHandlers, HasResizedHandlers, HasShowContextMenuHandlers
Each DrawItem has its own local transform that maps its local coordinate system
to the drawing coordinate system that is shared by
all DrawItems in the same DrawPane (explained here
). The local
transform is a combination of rotation, scaling, and other affine transformations. The DrawItem is first translated
, then scaled
, then sheared
in the direction of the x-axis, then sheared
in the directiton of the y-axis, and then finally
rotated
.
Note that DrawItems as such should never
be created, only concrete subclasses such as DrawGroup
and DrawLine
.
See DrawPane
for the
different approaches to create DrawItems.
config, configOnly, factoryCreated, factoryProperties, id, scClassName
Constructor and Description |
---|
DrawItem() |
DrawItem(com.google.gwt.core.client.JavaScriptObject jsObj) |
Modifier and Type | Method and Description |
---|---|
com.google.gwt.event.shared.HandlerRegistration |
addClickHandler(ClickHandler handler)
Add a click handler.
|
com.google.gwt.event.shared.HandlerRegistration |
addDragMoveHandler(DragMoveHandler handler)
Add a dragMove handler.
|
com.google.gwt.event.shared.HandlerRegistration |
addDragResizeMoveHandler(DragResizeMoveHandler handler)
Add a dragResizeMove handler.
|
com.google.gwt.event.shared.HandlerRegistration |
addDragResizeStartHandler(DragResizeStartHandler handler)
Add a dragResizeStart handler.
|
com.google.gwt.event.shared.HandlerRegistration |
addDragResizeStopHandler(DragResizeStopHandler handler)
Add a dragResizeStop handler.
|
com.google.gwt.event.shared.HandlerRegistration |
addDragStartHandler(DragStartHandler handler)
Add a dragStart handler.
|
com.google.gwt.event.shared.HandlerRegistration |
addDragStopHandler(DragStopHandler handler)
Add a dragStop handler.
|
com.google.gwt.event.shared.HandlerRegistration |
addMouseDownHandler(MouseDownHandler handler)
Add a mouseDown handler.
|
com.google.gwt.event.shared.HandlerRegistration |
addMouseMoveHandler(MouseMoveHandler handler)
Add a mouseMove handler.
|
com.google.gwt.event.shared.HandlerRegistration |
addMouseOutHandler(MouseOutHandler handler)
Add a mouseOut handler.
|
com.google.gwt.event.shared.HandlerRegistration |
addMouseOverHandler(MouseOverHandler handler)
Add a mouseOver handler.
|
com.google.gwt.event.shared.HandlerRegistration |
addMouseUpHandler(MouseUpHandler handler)
Add a mouseUp handler.
|
com.google.gwt.event.shared.HandlerRegistration |
addMovedHandler(MovedHandler handler)
Add a moved handler.
|
com.google.gwt.event.shared.HandlerRegistration |
addResizedHandler(ResizedHandler handler)
Add a resized handler.
|
com.google.gwt.event.shared.HandlerRegistration |
addShowContextMenuHandler(ShowContextMenuHandler handler)
Add a showContextMenu handler.
|
static void |
changeAutoChildDefaults(java.lang.String autoChildName,
Canvas defaults)
Changes the defaults for Canvas AutoChildren named
autoChildName . |
static void |
changeAutoChildDefaults(java.lang.String autoChildName,
DrawItem defaults)
Changes the defaults for DrawItem AutoChildren named
autoChildName . |
static void |
changeAutoChildDefaults(java.lang.String autoChildName,
FormItem defaults)
Changes the defaults for FormItem AutoChildren named
autoChildName . |
static float |
computeAngle(double px1,
double py1,
double px2,
double py2)
Deprecated.
|
static double |
computeAngleAsDouble(double px1,
double py1,
double px2,
double py2)
Computes the angle in degrees from the positive X axis to the difference vector
|
com.google.gwt.core.client.JavaScriptObject |
create() |
void |
dragResizeMove(java.lang.String position,
java.lang.Integer x,
java.lang.Integer y,
java.lang.Integer dX,
java.lang.Integer dY)
If
canDrag is true and the control knobs include "resize" knobs, then this notification
method will be fired when the user drag-resizes the draw item. |
void |
draw()
Draws this item into its current
drawPane . |
void |
erase()
Erase this drawItem's visual representation and remove it from its DrawGroup (if any) and DrawPane.
|
protected int[] |
getAttributeAsIntArray(java.lang.String property) |
int[] |
getBoundingBox()
Returns the startPoint endPoint
|
java.lang.Double[] |
getBoundingBoxAsDouble()
Returns the startPoint endPoint
|
java.lang.Boolean |
getCanDrag()
Is this DrawItem draggable? If true, then the DrawItem can be drag-repositioned by the user.
|
java.lang.Boolean |
getCanHover()
Will this DrawItem fire hover events when the user hovers over it?
|
Canvas |
getCanvasAutoChild(java.lang.String autoChildName)
Returns the
Canvas AutoChild named autoChildName if already created. |
Point |
getCenter()
Returns the center point of this draw item in local coordinates.
|
Menu |
getContextMenu()
Context menu to show for this object, an instance of the Menu widget.
|
DrawKnob |
getCornerResizeKnob()
Note : This API is non-functional (always returns null) and exists only to make
you aware that this MultiAutoChild exists.
|
Cursor |
getCursor()
If set, specifies the cursor to display when the mouse pointer is over this DrawItem.
|
java.lang.Boolean |
getDestroyed()
Flag indicating a drawItem has been destroyed, similar to
Canvas.destroyed . |
java.lang.Boolean |
getDestroying()
Flag indicating a drawItem is mid-destruction, similar to
Canvas.destroying . |
int |
getDragStartDistance()
Number of pixels the cursor needs to move before the EventHandler starts a drag operation.
|
DrawGroup |
getDrawGroup()
DrawGroup this drawItem is a member of. |
DrawItem |
getDrawItemAutoChild(java.lang.String autoChildName)
Returns the
DrawItem AutoChild named autoChildName if already created. |
DrawPane |
getDrawPane()
DrawPane this drawItem should draw in. |
java.lang.String |
getEditProxyConstructor()
Default class used to construct the
EditProxy for this component when the component is
first placed into edit mode . |
ArrowStyle |
getEndArrow()
Style of arrowhead to draw at the end of the line or path.
|
DrawKnob |
getEndKnob()
If this item is showing
KnobType.ENDPOINT control knobs , this attribute specifies the AutoChild for the
DrawKnob for end point of current drawItem. |
boolean |
getEventOpaque()
Should events inside this DrawItem be attributed to it regardless of which pixels are actually set, if no fill is
specified? If set for DrawItems that aren't closed, will capture events occurring in the region that would filled if a
fill were specified.
|
java.lang.String |
getFillColor()
Fill color to use for shapes.
|
Gradient |
getFillGradient()
Fill gradient to use for shapes.
|
java.lang.String |
getFillGradientAsString()
Fill gradient to use for shapes.
|
float |
getFillOpacity()
Opacity of the fillColor, as a number between 0 (transparent) and 1 (opaque).
|
FormItem |
getFormItemAutoChild(java.lang.String autoChildName)
Returns the
FormItem AutoChild named autoChildName if already created. |
int |
getHoverDelay()
If
this.canHover is true, how long should the mouse be kept over this widget before the hover event is
fired |
java.lang.String |
getHoverHTML()
If
showHover is true, when the user holds the mouse
over this DrawItem for long enough to trigger a hover event, a hover canvas is shown by default. |
java.lang.Boolean |
getKeepInParentRect()
Constrains drag-resizing and drag-repositioning of this draw item to either the current visible area of the
draw pane or an arbitrary bounding box (if set to an array of the form
[left, top, left + width, top + height] ). |
KnobType[] |
getKnobs()
Array of control knobs to display for this item.
|
LineCap |
getLineCap()
Style of drawing the endpoints of a line.
|
java.lang.String |
getLineColor()
Line color
|
float |
getLineOpacity()
Opacity for lines, as a number between 0 (transparent) and 1 (opaque).
|
LinePattern |
getLinePattern()
Pattern for lines, eg "solid" or "dash".
|
int |
getLineWidth()
Pixel width for lines.
|
DrawKnob |
getMoveKnob()
If this item is showing
KnobType.MOVE control knobs , this attribute specifies the AutoChild for the
DrawKnob that allows a user to move the DrawItem with help of a knob located
at moveKnobPoint . |
int[] |
getMoveKnobOffset()
If this item is showing a
"move" control
knob , this attribute allows you to specify an offset in pixels from the moveKnobPoint for the move knob. |
MoveKnobPoint |
getMoveKnobPoint()
If this item is showing a
KnobType.MOVE control knob , this attribute specifies where the knob should
appear with respect to the draw item. |
static DrawItem |
getOrCreateRef(com.google.gwt.core.client.JavaScriptObject jsObj) |
int |
getPageLeft()
Returns the page-relative left coordinate of the widget on the page, in pixels.
|
int |
getPageTop()
Returns the page-relative top coordinate of the widget on the page, in pixels
|
java.lang.String |
getPrompt()
Default
hover HTML that is displayed in the global
hover canvas if the user hovers over this DrawItem and showHover is true. |
java.lang.String[] |
getProportionalResizeModifiers()
If
proportionalResizing is set to
ProportionalResizeMode.MODIFIER or
ProportionalResizeMode.MODIFIER_OFF then proportional resizing of the DrawItem
is activated or deactivated, respectively, whenever at least one key in this set of modifier keys is pressed. |
ProportionalResizeMode |
getProportionalResizing()
This property specifies the conditions for when proportional resizing is used.
|
static DrawItem |
getRef(com.google.gwt.core.client.JavaScriptObject jsObj) |
int[] |
getResizeBoundingBox()
Returns the bounding box of the shape reflected by the
resize outline shown when dragging the resize knobs . |
java.lang.Double[] |
getResizeBoundingBoxAsDouble()
Returns the bounding box of the shape reflected by the
resize outline shown when dragging the resize knobs . |
ResizeKnobPoint[] |
getResizeKnobPoints()
If this item is showing
KnobType.RESIZE control knobs , this attribute specifies the points with respect
to the draw item where resize knobs should appear. |
DrawRect |
getResizeOutline()
If this item is showing
KnobType.RESIZE control knobs , this attribute specifies the AutoChild for the
DrawRect that draws a rectangle frame which connects all resize knobs of
current DrawItem. |
boolean |
getResizeViaLocalTransformOnly()
If this DrawItem is showing
KnobType.RESIZE control knobs , should resizing the shape solely update the local
transform (for example, the DrawItem's scale or translation )?. |
float |
getRotation()
Deprecated.
|
double |
getRotationAsDouble()
Rotation in degrees about the
center point . |
float[] |
getScale()
Array holds 2 values representing scaling along x and y dimensions.
|
Shadow |
getShadow()
Shadow used for all DrawItem subtypes.
|
boolean |
getShowHover()
If
canHover is true, should we show the global hover
canvas by default when the user hovers over this DrawItem? |
boolean |
getShowResizeOutline()
If this item is showing
KnobType.RESIZE control knobs will the resize outline be shown or not. |
boolean |
getShowTitleLabelBackground()
If the
titleLabel is showing, should the titleLabelBackground be created and placed behind
the titleLabel ? |
DrawKnob |
getSideResizeKnob()
Note : This API is non-functional (always returns null) and exists only to make
you aware that this MultiAutoChild exists.
|
ArrowStyle |
getStartArrow()
Style of arrowhead to draw at the beginning of the line or path.
|
DrawKnob |
getStartKnob()
If this item is showing
KnobType.STARTPOINT control knobs , this attribute specifies the AutoChild for the
DrawKnob for start point of current drawItem. |
void |
getSvgString()
Generates a string containing the SVG source of this DrawItem.
|
java.lang.String |
getTitle()
A string to show at the
center point of this
DrawItem . |
DrawLabel |
getTitleLabel()
|
DrawRect |
getTitleLabelBackground()
When the
titleLabel is showing and showTitleLabelBackground is true ,
this DrawRect AutoChild is created and placed behind the
titleLabel . |
int |
getTitleLabelPadding()
If the
titleLabelBackground is visible, how
much padding should be left between the bounds of the titleLabel and the edges of the titleLabelBackground ? |
TitleRotationMode |
getTitleRotationMode()
The mode in which the
titleLabel (if shown) is
rotated with this draw item. |
float[] |
getTranslate()
Array holds two values representing translation along the x and y dimensions.
|
double |
getXShearFactor()
The slope of an x-shearing transformation applied to this DrawItem.
|
double |
getYShearFactor()
The slope of a y-shearing transformation applied to this DrawItem.
|
void |
hide()
Hide this drawItem.
|
void |
hideAllKnobs()
Hides all control knobs for this drawItem.
|
void |
hideKnobs(KnobType... knobType)
Hides a set of control knobs for this drawItem.
|
void |
hideKnobs(KnobType knobType)
Hides a set of control knobs for this drawItem.
|
boolean |
hover()
If
canHover is true for this DrawItem, the hover()
string method will be fired when the user hovers over this DrawItem. |
boolean |
isInBounds(int x,
int y)
Returns true if the given point in the drawing coordinate system, when converted to coordinates in this DrawItem's local
coordinate system, is within the
bounding box of
this DrawItem's shape. |
boolean |
isPointInPath(int x,
int y)
Returns true if the given point in the drawing coordinate system is within this DrawItem's shape, taking into account
local transforms.
|
void |
moveBy(int dX,
int dY)
Move the shape by the specified deltas for the left and top coordinate.
|
void |
moveTo(java.lang.Integer left,
java.lang.Integer top)
Move the DrawItem to the specified coordinates in the global coordinate system.
|
void |
resizeBy(int dX,
int dY)
Resize the shape by the specified deltas.
|
void |
resizeTo(java.lang.Integer width,
java.lang.Integer height)
Resize to the specified size
|
void |
rotateBy(double degrees)
Rotate the shape by the relative rotation in degrees
|
void |
rotateTo(double degrees)
Rotate the shape by the absolute rotation in degrees
|
void |
scaleBy(double x,
double y)
Scale the shape by the x, y multipliers
|
void |
scaleTo(double x,
double y)
Scale the shape by the x, y multipliers
|
protected void |
setAttribute(java.lang.String attribute,
float[] value,
boolean allowPostCreate) |
protected void |
setAttribute(java.lang.String attribute,
java.lang.Float[] value,
boolean allowPostCreate) |
void |
setAutoChildConstructor(java.lang.String autoChildName,
java.lang.String className)
Sets the SmartClient constructor for the AutoChild named
autoChildName . |
void |
setAutoChildProperties(java.lang.String autoChildName,
Canvas properties)
Sets the properties for creating a
Canvas AutoChild named autoChildName . |
void |
setAutoChildProperties(java.lang.String autoChildName,
DrawItem properties)
Sets the properties for creating a
DrawItem AutoChild named autoChildName . |
void |
setAutoChildProperties(java.lang.String autoChildName,
EditProxy properties)
Sets the properties for creating an AutoChild named
autoChildName . |
void |
setAutoChildProperties(java.lang.String autoChildName,
FormItem properties)
Sets the properties for creating a
FormItem AutoChild named autoChildName . |
void |
setAutoChildVisibility(java.lang.String autoChildName,
boolean visible)
Sets whether to create and show the AutoChild named
autoChildName . |
void |
setCanDrag(java.lang.Boolean canDrag)
Is this DrawItem draggable? If true, then the DrawItem can be drag-repositioned by the user.
|
void |
setCanHover(java.lang.Boolean canHover)
Will this DrawItem fire hover events when the user hovers over it?
|
void |
setCenterPoint(int left,
int top)
Change the center point for this DrawItem.
|
void |
setContextMenu(Menu contextMenu)
Context menu to show for this object, an instance of the Menu widget.
|
void |
setCursor(Cursor cursor)
If set, specifies the cursor to display when the mouse pointer is over this DrawItem.
|
static void |
setDefaultProperties(DrawItem drawItemProperties)
Class level method to set the default properties of this class.
|
void |
setDragStartDistance(int dragStartDistance)
Number of pixels the cursor needs to move before the EventHandler starts a drag operation.
|
void |
setDrawGroup(DrawGroup drawGroup)
DrawGroup this drawItem is a member of. |
void |
setDrawPane(DrawPane drawPane)
DrawPane this drawItem should draw in. |
void |
setEditProxyConstructor(java.lang.String editProxyConstructor)
Default class used to construct the
EditProxy for this component when the component is
first placed into edit mode . |
void |
setEndArrow(ArrowStyle endArrow)
Style of arrowhead to draw at the end of the line or path.
|
void |
setEventOpaque(boolean eventOpaque)
Should events inside this DrawItem be attributed to it regardless of which pixels are actually set, if no fill is
specified? If set for DrawItems that aren't closed, will capture events occurring in the region that would filled if a
fill were specified.
|
void |
setFillColor(java.lang.String fillColor)
Fill color to use for shapes.
|
void |
setFillGradient(Gradient fillGradient)
Fill gradient to use for shapes.
|
void |
setFillGradient(java.lang.String fillGradient)
Fill gradient to use for shapes.
|
void |
setFillOpacity(float fillOpacity)
Opacity of the fillColor, as a number between 0 (transparent) and 1 (opaque).
|
void |
setHoverDelay(int hoverDelay)
If
this.canHover is true, how long should the mouse be kept over this widget before the hover event is
fired |
void |
setKeepInParentRect(java.lang.Boolean keepInParentRect)
Constrains drag-resizing and drag-repositioning of this draw item to either the current visible area of the
draw pane or an arbitrary bounding box (if set to an array of the form
[left, top, left + width, top + height] ). |
void |
setKeepInParentRect(float... keepInParentRect)
Constrains drag-resizing and drag-repositioning of this draw item to either the current visible area of the
draw pane or an arbitrary bounding box (if set to an array of the form
[left, top, left + width, top + height] ). |
void |
setKnobs(KnobType... knobs)
Array of control knobs to display for this item.
|
void |
setLineCap(LineCap lineCap)
Style of drawing the endpoints of a line.
|
void |
setLineColor(java.lang.String lineColor)
Line color
If this method is called after the component has been drawn/initialized: Update lineColor for this drawItem. |
void |
setLineOpacity(float lineOpacity)
Opacity for lines, as a number between 0 (transparent) and 1 (opaque).
|
void |
setLinePattern(LinePattern linePattern)
Pattern for lines, eg "solid" or "dash".
|
void |
setLineWidth(int lineWidth)
Pixel width for lines.
|
void |
setMoveKnobOffset(int[] moveKnobOffset)
If this item is showing a
"move" control
knob , this attribute allows you to specify an offset in pixels from the moveKnobPoint for the move knob. |
void |
setMoveKnobPoint(MoveKnobPoint moveKnobPoint)
If this item is showing a
KnobType.MOVE control knob , this attribute specifies where the knob should
appear with respect to the draw item. |
void |
setPrompt(java.lang.String prompt)
Default
hover HTML that is displayed in the global
hover canvas if the user hovers over this DrawItem and showHover is true. |
void |
setPropertyValue(java.lang.String propertyName,
java.lang.Object newValue)
Sets a property on this DrawItem, calling the appropriate setter method if one is found and is supported.
|
void |
setProportionalResizeModifiers(java.lang.String... proportionalResizeModifiers)
If
proportionalResizing is set to
ProportionalResizeMode.MODIFIER or
ProportionalResizeMode.MODIFIER_OFF then proportional resizing of the DrawItem
is activated or deactivated, respectively, whenever at least one key in this set of modifier keys is pressed. |
void |
setProportionalResizing(ProportionalResizeMode proportionalResizing)
This property specifies the conditions for when proportional resizing is used.
|
void |
setResizeKnobPoints(ResizeKnobPoint... resizeKnobPoints)
If this item is showing
KnobType.RESIZE control knobs , this attribute specifies the points with respect
to the draw item where resize knobs should appear. |
void |
setResizeViaLocalTransformOnly(boolean resizeViaLocalTransformOnly)
If this DrawItem is showing
KnobType.RESIZE control knobs , should resizing the shape solely update the local
transform (for example, the DrawItem's scale or translation )?. |
void |
setRotation(double rotation)
Rotation in degrees about the
center point . |
void |
setRotation(float rotation)
Deprecated.
|
void |
setScale(float[] scale)
Array holds 2 values representing scaling along x and y dimensions.
|
void |
setShadow(Shadow shadow)
Shadow used for all DrawItem subtypes.
|
void |
setShapeData(java.util.Map shapeData)
An opaque object specifying the local transformation that should be applied to this
DrawItem , obtained
through a call to getShapeData() . |
void |
setShowHover(boolean showHover)
If
canHover is true, should we show the global hover
canvas by default when the user hovers over this DrawItem? |
void |
setShowResizeOutline(boolean showResizeOutline)
If this item is showing
KnobType.RESIZE control knobs will the resize outline be shown or not. |
void |
setShowTitleLabelBackground(boolean showTitleLabelBackground)
If the
titleLabel is showing, should the titleLabelBackground be created and placed behind
the titleLabel ? |
void |
setStartArrow(ArrowStyle startArrow)
Style of arrowhead to draw at the beginning of the line or path.
|
void |
setTitle(java.lang.String title)
A string to show at the
center point of this
DrawItem . |
void |
setTitleLabelPadding(int titleLabelPadding)
If the
titleLabelBackground is visible, how
much padding should be left between the bounds of the titleLabel and the edges of the titleLabelBackground ? |
void |
setTitleRotationMode(TitleRotationMode titleRotationMode)
The mode in which the
titleLabel (if shown) is
rotated with this draw item. |
void |
setTranslate(float[] translate)
Array holds two values representing translation along the x and y dimensions.
|
void |
setXShearFactor(double xShearFactor)
The slope of an x-shearing transformation applied to this DrawItem.
|
void |
setYShearFactor(double yShearFactor)
The slope of a y-shearing transformation applied to this DrawItem.
|
void |
show()
Make this drawItem visible.
|
void |
showAllKnobs()
Shows all supported control knobs for this drawItem.
|
void |
showKnobs(KnobType... knobType)
Shows a set of control knobs for this drawItem.
|
void |
showKnobs(KnobType knobType)
Shows a set of control knobs for this drawItem.
|
boolean |
supportsEndArrow()
Does this DrawItem support
setEndArrow() ? For example,
this is false for DrawRect and DrawOval , and true for DrawLine . |
boolean |
supportsStartArrow()
Does this DrawItem support
setStartArrow() ? For
example, this is false for DrawRect and DrawOval , and true for DrawLine . |
applyFactoryProperties, asSGWTComponent, createJsObj, 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, getTestInstance, hasAutoAssignedID, internalSetID, internalSetID, isConfigOnly, isCreated, isFactoryCreated, onBind, onInit, registerID, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setConfig, setConfigOnly, setFactoryCreated, setID, setJavaScriptObject, setProperty, setProperty, setProperty, setProperty, setScClassName
public DrawItem()
public DrawItem(com.google.gwt.core.client.JavaScriptObject jsObj)
public static DrawItem getOrCreateRef(com.google.gwt.core.client.JavaScriptObject jsObj)
public static void changeAutoChildDefaults(java.lang.String autoChildName, Canvas defaults)
autoChildName
.autoChildName
- name of an AutoChild to customize the defaults for.defaults
- Canvas defaults to apply. These defaults override any existing properties
without destroying or wiping out non-overridden properties. For usage tips on this
param, see SGWTProperties
.AutoChildUsage
public static void changeAutoChildDefaults(java.lang.String autoChildName, FormItem defaults)
autoChildName
.autoChildName
- name of an AutoChild to customize the defaults for.defaults
- FormItem defaults to apply. These defaults override any existing properties
without destroying or wiping out non-overridden properties. For usage tips on this
param, see SGWTProperties
.AutoChildUsage
public static void changeAutoChildDefaults(java.lang.String autoChildName, DrawItem defaults)
autoChildName
.autoChildName
- name of an AutoChild to customize the defaults for.defaults
- DrawItem defaults to apply. These defaults override any existing properties
without destroying or wiping out non-overridden properties. For usage tips on this
param, see SGWTProperties
.AutoChildUsage
public com.google.gwt.core.client.JavaScriptObject create()
public void setCanDrag(java.lang.Boolean canDrag)
canDrag
.
Note : This is an advanced setting
canDrag
- new value for this.canDrag
.. Default value is falsepublic java.lang.Boolean getCanDrag()
public void setCanHover(java.lang.Boolean canHover)
canHover
- Default value is nullsetShowHover(boolean)
public java.lang.Boolean getCanHover()
getShowHover()
public void setContextMenu(Menu contextMenu)
Note: if Canvas.destroy()
is called on a canvas, any specified context menu is not
automatically destroyed as well. This is in contrast to MenuButton
s which
automatically destroy their specified MenuButton.menu
by
default. The behavior is intentional as context menus are commonly reused across components.
contextMenu
- Default value is nullShowContextMenuEvent
,
Cues overview and related methods
,
Context menus Examplepublic Menu getContextMenu()
Note: if Canvas.destroy()
is called on a canvas, any specified context menu is not
automatically destroyed as well. This is in contrast to MenuButton
s which
automatically destroy their specified MenuButton.menu
by
default. The behavior is intentional as context menus are commonly reused across components.
ShowContextMenuEvent
,
Cues overview and related methods
,
Context menus Examplepublic DrawKnob getCornerResizeKnob()
Using AutoChildren
for details.
If this item is showing KnobType.RESIZE
control knobs
, this attribute specifies the MultiAutoChild for
the DrawKnob
that allows a user to resize the DrawItem with help of knobs
located at corners of a bounding rectangle of current DrawItem. Default shape is red circle.
public void setCursor(Cursor cursor)
Note : This is an advanced setting
cursor
- new cursor.. Default value is nullpublic Cursor getCursor()
public java.lang.Boolean getDestroyed() throws java.lang.IllegalStateException
Canvas.destroyed
.
Note : This method should be called only after the underlying component has been created.
java.lang.IllegalStateException
- if the underlying component has not yet been created.public java.lang.Boolean getDestroying() throws java.lang.IllegalStateException
Canvas.destroying
.
Note : This method should be called only after the underlying component has been created.
java.lang.IllegalStateException
- if the underlying component has not yet been created.public void setDragStartDistance(int dragStartDistance)
Note : This is an advanced setting
dragStartDistance
- Default value is 5Dragdrop overview and related methods
public int getDragStartDistance()
Dragdrop overview and related methods
public void setDrawGroup(DrawGroup drawGroup) throws java.lang.IllegalStateException
DrawGroup
this drawItem is a member of.drawGroup
- Default value is nulljava.lang.IllegalStateException
- this property cannot be changed after the underlying component has been createdpublic DrawGroup getDrawGroup()
DrawGroup
this drawItem is a member of.public void setDrawPane(DrawPane drawPane)
DrawPane
this drawItem should draw in. If this item has a DrawGroup
, the drawGroup's drawPane is automatically used.
If this method is called after the component has been drawn/initialized:
Setter for drawPane
.
drawPane
- new value for this.drawPane
.. Default value is nullpublic DrawPane getDrawPane()
DrawPane
this drawItem should draw in. If this item has a DrawGroup
, the drawGroup's drawPane is automatically used.
public void setEditProxyConstructor(java.lang.String editProxyConstructor) throws java.lang.IllegalStateException
EditProxy
for this component when the component is
first placed into edit mode
.editProxyConstructor
- See SCClassName
. Default value is "DrawItemEditProxy"java.lang.IllegalStateException
- this property cannot be changed after the underlying component has been createdpublic java.lang.String getEditProxyConstructor()
EditProxy
for this component when the component is
first placed into edit mode
.SCClassName
public void setEndArrow(ArrowStyle endArrow)
NOTE: Not all DrawItem classes support arrowheads. You can use supportsEndArrow()
to dynamically check whether a DrawItem instance supports this method.
endArrow
- style of arrow to use. Default value is nullpublic ArrowStyle getEndArrow()
public DrawKnob getEndKnob() throws java.lang.IllegalStateException
KnobType.ENDPOINT
control knobs
, this attribute specifies the AutoChild for the
DrawKnob
for end point of current drawItem.
For an overview of how to use and configure AutoChildren, see Using AutoChildren
.
java.lang.IllegalStateException
- if the underlying component has not yet been created.public void setEventOpaque(boolean eventOpaque) throws java.lang.IllegalStateException
Note : This is an advanced setting
eventOpaque
- Default value is variesjava.lang.IllegalStateException
- this property cannot be changed after the underlying component has been createdsetFillColor(java.lang.String)
,
setFillOpacity(float)
public boolean getEventOpaque()
getFillColor()
,
getFillOpacity()
public void setFillColor(java.lang.String fillColor)
fillColor
- new fillColor to use. Pass null for transparent. See CSSColor
. Default value is nullpublic java.lang.String getFillColor()
CSSColor
public void setFillGradient(Gradient fillGradient)
DrawPane.addGradient()
. Otherwise it expects one of SimpleGradient
, LinearGradient
or RadialGradient
.
fillGradient
- new gradient to use. Pass null for transparent.. Default value is nullGradient
public Gradient getFillGradient()
DrawPane.addGradient()
. Otherwise it expects one of SimpleGradient
, LinearGradient
or RadialGradient
.Gradient
public void setFillGradient(java.lang.String fillGradient)
DrawPane.addGradient()
. Otherwise it expects one of SimpleGradient
, LinearGradient
or RadialGradient
.
fillGradient
- new gradient to use. Pass null for transparent.. Default value is nullGradient
public java.lang.String getFillGradientAsString()
DrawPane.addGradient()
. Otherwise it expects one of SimpleGradient
, LinearGradient
or RadialGradient
.Gradient
public void setFillOpacity(float fillOpacity)
fillOpacity
- new opacity, as a number between 0 (transparent) and 1 (opaque).. Default value is 1.0public float getFillOpacity()
public void setHoverDelay(int hoverDelay)
this.canHover
is true, how long should the mouse be kept over this widget before the hover event is
firedhoverDelay
- Default value is 300setCanHover(java.lang.Boolean)
,
hover()
public int getHoverDelay()
this.canHover
is true, how long should the mouse be kept over this widget before the hover event is
firedgetCanHover()
,
hover()
public void setKeepInParentRect(java.lang.Boolean keepInParentRect)
draw pane
or an arbitrary bounding box (if set to an array of the form
[left, top, left + width, top + height]
). When using a bounding box-type argument the left/top values can
be negative, or the width/height values can be greater than the dimensions of the viewable area, to allow positioning or
resizing the draw item beyond the confines of the draw pane. Note: keepInParentRect affects only user drag interactions, not programmatic moves or resizes.
Note : This is an advanced setting
keepInParentRect
- Default value is nullpublic java.lang.Boolean getKeepInParentRect()
draw pane
or an arbitrary bounding box (if set to an array of the form
[left, top, left + width, top + height]
). When using a bounding box-type argument the left/top values can
be negative, or the width/height values can be greater than the dimensions of the viewable area, to allow positioning or
resizing the draw item beyond the confines of the draw pane. Note: keepInParentRect affects only user drag interactions, not programmatic moves or resizes.
public void setKeepInParentRect(float... keepInParentRect)
draw pane
or an arbitrary bounding box (if set to an array of the form
[left, top, left + width, top + height]
). When using a bounding box-type argument the left/top values can
be negative, or the width/height values can be greater than the dimensions of the viewable area, to allow positioning or
resizing the draw item beyond the confines of the draw pane. Note: keepInParentRect affects only user drag interactions, not programmatic moves or resizes.
Note : This is an advanced setting
keepInParentRect
- Default value is nullpublic void setKnobs(KnobType... knobs) throws java.lang.IllegalStateException
KnobType
specified in this array
will turn on UI element(s) allowing the user to manipulate this drawItem. To update the set of knobs at runtime use
showKnobs()
and hideKnobs()
. NOTE: Unless otherwise documented,
DrawItem types only support KnobType.RESIZE
and KnobType.MOVE
knobs.
knobs
- Default value is nulljava.lang.IllegalStateException
- this property cannot be changed after the underlying component has been createdpublic KnobType[] getKnobs()
KnobType
specified in this array
will turn on UI element(s) allowing the user to manipulate this drawItem. To update the set of knobs at runtime use
showKnobs()
and hideKnobs()
. NOTE: Unless otherwise documented,
DrawItem types only support KnobType.RESIZE
and KnobType.MOVE
knobs.
public void setLineCap(LineCap lineCap)
Note that for dashed and dotted lines, the lineCap style affects each dash
or dot.
If this method is called after the component has been drawn/initialized:
Update lineCap for this drawItem.
lineCap
- new lineCap to use. Default value is "round"public LineCap getLineCap()
Note that for dashed and dotted lines, the lineCap style affects each dash or dot.
public void setLineColor(java.lang.String lineColor)
lineColor
- new line color. Pass null for transparent. See CSSColor
. Default value is "#808080"public java.lang.String getLineColor()
CSSColor
public void setLineOpacity(float lineOpacity)
lineOpacity
- new opacity, as a number between 0 (transparent) and 1 (opaque).. Default value is 1.0public float getLineOpacity()
public void setLinePattern(LinePattern linePattern)
Note that support in old browsers, such as Internet Explorer versions
before IE11, is limited for drawingType
"bitmap" to
items with straight edges - DrawLine
s, DrawPath
s, and DrawRect
s with no
rounding
.
If this method is called after the component has been drawn/initialized:
Update linePattern for this drawItem.
linePattern
- new linePattern to use. Default value is "solid"public LinePattern getLinePattern()
Note that support in old browsers, such as Internet Explorer versions
before IE11, is limited for drawingType
"bitmap" to
items with straight edges - DrawLine
s, DrawPath
s, and DrawRect
s with no
rounding
.
public void setLineWidth(int lineWidth)
lineWidth
- new pixel lineWidth. Default value is 3public int getLineWidth()
public DrawKnob getMoveKnob() throws java.lang.IllegalStateException
KnobType.MOVE
control knobs
, this attribute specifies the AutoChild for the
DrawKnob
that allows a user to move the DrawItem with help of a knob located
at moveKnobPoint
. Default move knob shape is green
circle.
For an overview of how to use and configure AutoChildren, see Using AutoChildren
.
java.lang.IllegalStateException
- if the underlying component has not yet been created.public void setMoveKnobOffset(int[] moveKnobOffset)
"move"
control
knob
, this attribute allows you to specify an offset in pixels from the moveKnobPoint
for the move knob. Offset should be
specified as a 2-element array of [left offset, top offset]. This offset overrides the built-in offset used when
showing both resize and move knobs.
If this method is called after the component has been drawn/initialized:
Setter for moveKnobOffset
.
Note : This is an advanced setting
moveKnobOffset
- the new move knob offset. This is a 2-element array of [left offset, top offset]. If null, then new int[] {0,
0}
is assumed.. Default value is nullsetMoveKnobPoint(com.smartgwt.client.types.MoveKnobPoint)
public int[] getMoveKnobOffset()
"move"
control
knob
, this attribute allows you to specify an offset in pixels from the moveKnobPoint
for the move knob. Offset should be
specified as a 2-element array of [left offset, top offset]. This offset overrides the built-in offset used when showing both resize and move knobs.
getMoveKnobPoint()
public void setMoveKnobPoint(MoveKnobPoint moveKnobPoint) throws java.lang.IllegalStateException
KnobType.MOVE
control knob
, this attribute specifies where the knob should
appear with respect to the draw item. The resize and move knobs show at the same position by default. However, when
both knobs are shown the move knob is offset slightly to allow access to both. This position can be adjusted manually
with moveKnobOffset
.
moveKnobPoint
- Default value is "TL"java.lang.IllegalStateException
- this property cannot be changed after the underlying component has been createdsetMoveKnobOffset(int[])
public MoveKnobPoint getMoveKnobPoint()
KnobType.MOVE
control knob
, this attribute specifies where the knob should
appear with respect to the draw item. The resize and move knobs show at the same position by default. However, when
both knobs are shown the move knob is offset slightly to allow access to both. This position can be adjusted manually
with moveKnobOffset
.
getMoveKnobOffset()
public void setPrompt(java.lang.String prompt)
hover HTML
that is displayed in the global
hover canvas if the user hovers over this DrawItem and showHover
is true.prompt
- See HTMLString
. Default value is nullpublic java.lang.String getPrompt()
hover HTML
that is displayed in the global
hover canvas if the user hovers over this DrawItem and showHover
is true.HTMLString
public void setProportionalResizing(ProportionalResizeMode proportionalResizing) throws java.lang.IllegalStateException
By default the DrawItem is forced to
only resize proportionally while any modifier key specified in proportionalResizeModifiers
is pressed.
For example, the DrawItem will change its width and height by the same percentage as long as the "Shift" key is held
down.
Note that this property only has an effect if the DrawItem is showing KnobType.RESIZE
control knobs
.
proportionalResizing
- Default value is "modifier"java.lang.IllegalStateException
- this property cannot be changed after the underlying component has been createdpublic ProportionalResizeMode getProportionalResizing()
By default the DrawItem is forced to
only resize proportionally while any modifier key specified in proportionalResizeModifiers
is pressed.
For example, the DrawItem will change its width and height by the same percentage as long as the "Shift" key is held
down.
Note that this property only has an effect if the DrawItem is showing KnobType.RESIZE
control knobs
.
public void setResizeKnobPoints(ResizeKnobPoint... resizeKnobPoints) throws java.lang.IllegalStateException
KnobType.RESIZE
control knobs
, this attribute specifies the points with respect
to the draw item where resize knobs should appear.resizeKnobPoints
- Default value is ["TL","TR","BL","BR","T","R","B","L"]java.lang.IllegalStateException
- this property cannot be changed after the underlying component has been createdpublic ResizeKnobPoint[] getResizeKnobPoints()
KnobType.RESIZE
control knobs
, this attribute specifies the points with respect
to the draw item where resize knobs should appear.public DrawRect getResizeOutline() throws java.lang.IllegalStateException
KnobType.RESIZE
control knobs
, this attribute specifies the AutoChild for the
DrawRect
that draws a rectangle frame which connects all resize knobs of
current DrawItem.
For an overview of how to use and configure AutoChildren, see Using AutoChildren
.
java.lang.IllegalStateException
- if the underlying component has not yet been created.public void setResizeViaLocalTransformOnly(boolean resizeViaLocalTransformOnly) throws java.lang.IllegalStateException
KnobType.RESIZE
control knobs
, should resizing the shape solely update the local
transform (for example, the DrawItem's scale
or translation
)?. The default is false
, which
means that the DrawItem is allowed to modify its shape properties in order to fit within a given width and height. Some
examples:
DrawOval
might decrease its radius
when resized to a smaller size.DrawPath
might change its points
to lengthen all line segments in the path by some
proportion so that it fits into a larger size.line width
even as it is being resized. If this property
is set to true
then all visual aspects of the DrawItem, including the line width and the fill, will be
magnified or reduced during resizes as if the DrawItem were placed under a lens.
resizeViaLocalTransformOnly
- Default value is falsejava.lang.IllegalStateException
- this property cannot be changed after the underlying component has been createdpublic boolean getResizeViaLocalTransformOnly()
KnobType.RESIZE
control knobs
, should resizing the shape solely update the local
transform (for example, the DrawItem's scale
or translation
)?. The default is false
, which
means that the DrawItem is allowed to modify its shape properties in order to fit within a given width and height. Some
examples:
DrawOval
might decrease its radius
when resized to a smaller size.DrawPath
might change its points
to lengthen all line segments in the path by some
proportion so that it fits into a larger size.line width
even as it is being resized. If this property
is set to true
then all visual aspects of the DrawItem, including the line width and the fill, will be
magnified or reduced during resizes as if the DrawItem were placed under a lens.
public void setRotation(float rotation) throws java.lang.IllegalStateException
GwtFloatVsDouble
center point
. The positive
direction is clockwise.rotation
- Default value is 0.0java.lang.IllegalStateException
- this property cannot be changed after the underlying component has been createdpublic float getRotation()
GwtFloatVsDouble
center point
. The positive
direction is clockwise.public void setRotation(double rotation) throws java.lang.IllegalStateException
center point
. The positive
direction is clockwise.rotation
- Default value is 0.0java.lang.IllegalStateException
- this property cannot be changed after the underlying component has been createdpublic double getRotationAsDouble()
center point
. The positive
direction is clockwise.public void setScale(float[] scale) throws java.lang.IllegalStateException
Note : This is an advanced setting
scale
- Default value is nulljava.lang.IllegalStateException
- this property cannot be changed after the underlying component has been createdpublic float[] getScale()
public void setShadow(Shadow shadow)
shadow
- new shadow. Default value is nullpublic Shadow getShadow()
public void setShapeData(java.util.Map shapeData) throws java.lang.IllegalStateException
DrawItem
, obtained
through a call to getShapeData()
. Note: if
this property is specified, you should avoid also specifying a translate
, scale
, xShearFactor
, yShearFactor
, or rotation
.
shapeData
- Default value is nulljava.lang.IllegalStateException
- this property cannot be changed after the underlying component has been createdpublic void setShowHover(boolean showHover)
canHover
is true, should we show the global hover
canvas by default when the user hovers over this DrawItem?showHover
- Default value is truegetHoverHTML()
public boolean getShowHover()
canHover
is true, should we show the global hover
canvas by default when the user hovers over this DrawItem?getHoverHTML()
public void setShowResizeOutline(boolean showResizeOutline)
KnobType.RESIZE
control knobs
will the resize outline be shown or not.showResizeOutline
- Default value is truecom.smartgwt.client.widgets.drawing.DrawItem#setResizeOutline
public boolean getShowResizeOutline()
KnobType.RESIZE
control knobs
will the resize outline be shown or not.getResizeOutline()
public void setShowTitleLabelBackground(boolean showTitleLabelBackground) throws java.lang.IllegalStateException
titleLabel
is showing, should the titleLabelBackground
be created and placed behind
the titleLabel
? This defaults to true for DrawSector
s and
shapes that are not commonly filled (e.g. DrawLine
s).
Note : This is an advanced setting
showTitleLabelBackground
- Default value is falsejava.lang.IllegalStateException
- this property cannot be changed after the underlying component has been createdpublic boolean getShowTitleLabelBackground()
titleLabel
is showing, should the titleLabelBackground
be created and placed behind
the titleLabel
? This defaults to true for DrawSector
s and
shapes that are not commonly filled (e.g. DrawLine
s).
public DrawKnob getSideResizeKnob()
Using AutoChildren
for details.
If this item is showing KnobType.RESIZE
control knobs
, this attribute specifies the MultiAutoChild for
the DrawKnob
that allows a user to resize the DrawItem with help of knobs
located at centers of edges of a bounding rectangle of current DrawItem. Default shape is red square.
public void setStartArrow(ArrowStyle startArrow)
NOTE: Not all DrawItem classes support arrowheads. You can use supportsStartArrow()
to dynamically check whether a DrawItem instance supports this method.
startArrow
- style of arrow to use. Default value is nullpublic ArrowStyle getStartArrow()
public DrawKnob getStartKnob() throws java.lang.IllegalStateException
KnobType.STARTPOINT
control knobs
, this attribute specifies the AutoChild for the
DrawKnob
for start point of current drawItem.
For an overview of how to use and configure AutoChildren, see Using AutoChildren
.
java.lang.IllegalStateException
- if the underlying component has not yet been created.public void setTitle(java.lang.String title)
center point
of this
DrawItem
. When set to a non-null value (including an empty string), the titleLabel
DrawLabel
AutoChild will be created automatically and positioned at the center of
this DrawItem
.
If this method is called after the component has been drawn/initialized:
Setter for the title
of this DrawItem
.
Note : This is an advanced setting
title
- new title
.. Default value is nullsetTitleRotationMode(com.smartgwt.client.types.TitleRotationMode)
public java.lang.String getTitle()
center point
of this
DrawItem
. When set to a non-null value (including an empty string), the titleLabel
DrawLabel
AutoChild will be created automatically and positioned at the center of
this DrawItem
.
getTitleRotationMode()
public DrawLabel getTitleLabel() throws java.lang.IllegalStateException
title
is set, this AutoChild is created
automatically and positioned at the center
of this
DrawItem
. The titleLabel
moves with this DrawItem
and, depending on titleRotationMode
, can rotate with this DrawItem
as well.
The following passthrough
applies:
title
for DrawLabel.contents
.
Related to the
titleLabel
is the titleLabelBackground
which allows a border to be placed around the titleLabel
and/or a background added.
By default, shapes that are commonly filled such as DrawTriangle
s, with the
exception of DrawSector
s, do not show the titleLabelBackground
(see showTitleLabelBackground
).
For an overview of how to use and configure AutoChildren, see Using AutoChildren
.
java.lang.IllegalStateException
- if the underlying component has not yet been created.getShowTitleLabelBackground()
public DrawRect getTitleLabelBackground() throws java.lang.IllegalStateException
titleLabel
is showing and showTitleLabelBackground
is true
,
this DrawRect
AutoChild is created and placed behind the
titleLabel
.
For an overview of how to use and configure AutoChildren, see Using AutoChildren
.
java.lang.IllegalStateException
- if the underlying component has not yet been created.getTitleLabelPadding()
public void setTitleLabelPadding(int titleLabelPadding) throws java.lang.IllegalStateException
titleLabelBackground
is visible, how
much padding should be left between the bounds of the titleLabel
and the edges of the titleLabelBackground
?
Note : This is an advanced setting
titleLabelPadding
- Default value is 2java.lang.IllegalStateException
- this property cannot be changed after the underlying component has been createdpublic int getTitleLabelPadding()
titleLabelBackground
is visible, how
much padding should be left between the bounds of the titleLabel
and the edges of the titleLabelBackground
?public void setTitleRotationMode(TitleRotationMode titleRotationMode) throws java.lang.IllegalStateException
titleLabel
(if shown) is
rotated with this draw item.
Note : This is an advanced setting
titleRotationMode
- Default value is "neverRotate"java.lang.IllegalStateException
- this property cannot be changed after the underlying component has been createdsetTitle(java.lang.String)
public TitleRotationMode getTitleRotationMode()
titleLabel
(if shown) is
rotated with this draw item.getTitle()
public void setTranslate(float[] translate) throws java.lang.IllegalStateException
Note : This is an advanced setting
translate
- Default value is nulljava.lang.IllegalStateException
- this property cannot be changed after the underlying component has been createdpublic float[] getTranslate()
public void setXShearFactor(double xShearFactor) throws java.lang.IllegalStateException
Note : This is an advanced setting
xShearFactor
- Default value is 0.0java.lang.IllegalStateException
- this property cannot be changed after the underlying component has been createdpublic double getXShearFactor()
public void setYShearFactor(double yShearFactor) throws java.lang.IllegalStateException
Note : This is an advanced setting
yShearFactor
- Default value is 0.0java.lang.IllegalStateException
- this property cannot be changed after the underlying component has been createdpublic double getYShearFactor()
public com.google.gwt.event.shared.HandlerRegistration addClickHandler(ClickHandler handler)
Notification fired when the user clicks on this DrawItem.
Note that if this item is part of a DrawGroup
, then the group's useGroupRect
setting affects whether this item receives
the notification. If useGroupRect is true, then this item will not receive the notification. Otherwise, the
item receives the notification and notification bubbles up to the group.
addClickHandler
in interface HasClickHandlers
handler
- the click handlerHandlerRegistration
used to remove this handlerpublic void dragResizeMove(java.lang.String position, java.lang.Integer x, java.lang.Integer y, java.lang.Integer dX, java.lang.Integer dY)
canDrag
is true and the control knobs
include "resize" knobs, then this notification
method will be fired when the user drag-resizes the draw item.position
- provides which knob of the resizeKnobPoints
was
draggedx
- new x-coordinate of the knoby
- new y-coordinate of the knobdX
- horizontal distance moveddY
- vertical distance movedpublic void draw()
drawPane
. NOTE:
For performance reasons, the DrawPane
may draw this item on a delay to allow multiple items to be added and
drawn at one time. The DrawPane.refreshNow()
API will
force this item to be drawn immediately.
public void erase()
To re-draw the
item within the DrawPane, call draw()
again, or use DrawPane.addDrawItem()
to move to another DrawGroup.
public Point getCenter()
bounding box
, but some item types may use a different
point. For example, DrawTriangle
uses the incenter of the triangle.public java.lang.String getHoverHTML()
showHover
is true, when the user holds the mouse
over this DrawItem for long enough to trigger a hover event, a hover canvas is shown by default. This method returns the
contents of that hover canvas. Default implementation returns prompt
- override for custom hover HTML. Note that returning
null
or an empty string will suppress the hover canvas altogether.public int getPageLeft()
Positioning overview and related methods
public int getPageTop()
Positioning overview and related methods
public void getSvgString()
NOTE: The generated SVG source assumes that the
default namespace is http://www.w3.org/2000/svg
and that namespace prefix xlink
refers to
namespace name http://www.w3.org/1999/xlink
.
public void hide()
public void hideAllKnobs()
knobs
to remove all knobTypes and clears any drawn knobs.public void hideKnobs(KnobType knobType)
knobs
to remove the specified knobType, and clears any drawn knobs for this knobType.knobType
- knobs to hidepublic void hideKnobs(KnobType... knobType)
knobs
to remove the specified knobType, and clears any drawn knobs for this knobType.knobType
- knobs to hidepublic boolean hover()
canHover
is true for this DrawItem, the hover()
string method will be fired when the user hovers over this DrawItem. If this method returns false, it will suppress the
default behavior of showing a hover canvas if showHover
is true.public boolean isInBounds(int x, int y)
bounding box
of
this DrawItem's shape. This method can be used to quickly check whether the given point is definitely not
within the DrawItem shape. To check whether the point is within the DrawItem shape, use the slower but exact isPointInPath()
method.
x
- X coordinate of the point in the drawing coordinate system.y
- Y coordinate of the point in the drawing coordinate system.public boolean isPointInPath(int x, int y)
x
- X coordinate of the test point.y
- Y coordinate of the test point.public com.google.gwt.event.shared.HandlerRegistration addMouseDownHandler(MouseDownHandler handler)
Notification fired when the user presses the left mouse button on this DrawItem.
Note that if this item is part of a
DrawGroup
, then the group's useGroupRect
setting affects whether this item receives
the notification. If useGroupRect is true, then this item will not receive the notification. Otherwise, the
item receives the notification and notification bubbles up to the group.
addMouseDownHandler
in interface HasMouseDownHandlers
handler
- the mouseDown handlerHandlerRegistration
used to remove this handlerpublic com.google.gwt.event.shared.HandlerRegistration addMouseMoveHandler(MouseMoveHandler handler)
Notification fired when the user moves the mouse over this DrawItem.
Note that if this item is part of a DrawGroup
, then the group's useGroupRect
setting affects whether this item receives
the notification. If useGroupRect is true, then this item will not receive the notification. Otherwise, the
item receives the notification and notification bubbles up to the group.
addMouseMoveHandler
in interface HasMouseMoveHandlers
handler
- the mouseMove handlerHandlerRegistration
used to remove this handlerpublic com.google.gwt.event.shared.HandlerRegistration addMouseOutHandler(MouseOutHandler handler)
Notification fired when the mouse leaves this DrawItem.
Note that if this item is part of a DrawGroup
, then the group's useGroupRect
setting affects whether this item receives
the notification. If useGroupRect is true, then this item will not receive the notification. Otherwise, the
item receives the notification and notification bubbles up to the group.
addMouseOutHandler
in interface HasMouseOutHandlers
handler
- the mouseOut handlerHandlerRegistration
used to remove this handlerpublic com.google.gwt.event.shared.HandlerRegistration addMouseOverHandler(MouseOverHandler handler)
Notification fired when the mouse enters this DrawItem.
Note that if this item is part of a DrawGroup
, then the group's useGroupRect
setting affects whether this item receives
the notification. If useGroupRect is true, then this item will not receive the notification. Otherwise, the
item receives the notification and notification bubbles up to the group.
addMouseOverHandler
in interface HasMouseOverHandlers
handler
- the mouseOver handlerHandlerRegistration
used to remove this handlerpublic com.google.gwt.event.shared.HandlerRegistration addMouseUpHandler(MouseUpHandler handler)
Notification fired when the user releases the left mouse button on this DrawItem.
Note that if this item is part of
a DrawGroup
, then the group's useGroupRect
setting affects whether this item receives
the notification. If useGroupRect is true, then this item will not receive the notification. Otherwise, the
item receives the notification and notification bubbles up to the group.
addMouseUpHandler
in interface HasMouseUpHandlers
handler
- the mouseUp handlerHandlerRegistration
used to remove this handlerpublic void moveBy(int dX, int dY)
dX
- change to left coordinate in pixelsdY
- change to top coordinate in pixelspublic com.google.gwt.event.shared.HandlerRegistration addMovedHandler(MovedHandler handler)
Notification method fired when this component is explicitly moved. Note that a component's position on the screen may
also be changed due to an ancestor being moved. The parentMoved()
method provides a notification entry point to catch that case as well.
addMovedHandler
in interface HasMovedHandlers
handler
- the moved handlerHandlerRegistration
used to remove this handlerpublic void moveTo(java.lang.Integer left, java.lang.Integer top)
resize bounding box
.left
- new left coordinate in pixelstop
- new top coordinate in pixelspublic com.google.gwt.event.shared.HandlerRegistration addDragMoveHandler(DragMoveHandler handler)
If DrawItem.canDrag
is true, this notification method
will be fired when the user drags the draw item.
addDragMoveHandler
in interface HasDragMoveHandlers
handler
- the dragMove handlerHandlerRegistration
used to remove this handlerpublic com.google.gwt.event.shared.HandlerRegistration addDragResizeMoveHandler(DragResizeMoveHandler handler)
If DrawItem.canDrag
is true and the control knobs
include "resize" knobs then this notification
method will be fired when the user drags the resize knobs of the draw item.
addDragResizeMoveHandler
in interface HasDragResizeMoveHandlers
handler
- the dragResizeMove handlerHandlerRegistration
used to remove this handlerpublic com.google.gwt.event.shared.HandlerRegistration addDragResizeStartHandler(DragResizeStartHandler handler)
If DrawItem.canDrag
is true and the control knobs
include "resize" knobs then this notification
method will be fired when the user starts to drag the resize knobs of the draw item.
addDragResizeStartHandler
in interface HasDragResizeStartHandlers
handler
- the dragResizeStart handlerHandlerRegistration
used to remove this handlerpublic com.google.gwt.event.shared.HandlerRegistration addDragResizeStopHandler(DragResizeStopHandler handler)
If DrawItem.canDrag
is true and the control knobs
include "resize" knobs then this notification
method will be fired when the user completes a drag on the resize knobs of the draw item.
addDragResizeStopHandler
in interface HasDragResizeStopHandlers
handler
- the dragResizeStop handlerHandlerRegistration
used to remove this handlerpublic com.google.gwt.event.shared.HandlerRegistration addDragStartHandler(DragStartHandler handler)
If DrawItem.canDrag
is true, this notification method
will be fired when the user starts to drag the draw item.
addDragStartHandler
in interface HasDragStartHandlers
handler
- the dragStart handlerHandlerRegistration
used to remove this handlerpublic com.google.gwt.event.shared.HandlerRegistration addDragStopHandler(DragStopHandler handler)
If DrawItem.canDrag
is true, this notification method
will be fired when the user completes a drag on the draw item.
addDragStopHandler
in interface HasDragStopHandlers
handler
- the dragStop handlerHandlerRegistration
used to remove this handlerpublic void resizeBy(int dX, int dY)
dX
- number of pixels to resize by horizontallydY
- number of pixels to resize by verticallypublic com.google.gwt.event.shared.HandlerRegistration addResizedHandler(ResizedHandler handler)
Observable method called whenever a DrawItem changes size.
addResizedHandler
in interface HasResizedHandlers
handler
- the resized handlerHandlerRegistration
used to remove this handlerpublic void resizeTo(java.lang.Integer width, java.lang.Integer height)
width
- new widthheight
- new heightpublic void rotateBy(double degrees)
degrees
- number of degrees to rotate from current orientation.public void rotateTo(double degrees)
degrees
- number of degrees to rotatepublic void scaleBy(double x, double y)
x
- scale in the x directiony
- scale in the y directionpublic void scaleTo(double x, double y)
x
- scale in the x directiony
- scale in the y directionpublic void setCenterPoint(int left, int top)
left
- X coordinate of the center point (in the global coordinate system).top
- Y coordinate of the center point (in the global coordinate system).public void setPropertyValue(java.lang.String propertyName, java.lang.Object newValue)
propertyName
- name of the property to setnewValue
- new value for the propertypublic void show()
public void showAllKnobs()
knobs
to include the supported knobTypes and if necessary draws
out the appropriate control knobs.public com.google.gwt.event.shared.HandlerRegistration addShowContextMenuHandler(ShowContextMenuHandler handler)
Executed when the right mouse button is clicked. The default implementation of this method auto-creates a Menu
from the Canvas.contextMenu
property on this component and then calls Menu.showContextMenu()
on it to show it.
If you want to show a standard context menu, you can simply define your Menu and set it as the contextMenu property on your component - you do not need to override this method.
If you want to do some other processing before showing a menu or do something else entirely, then you should override this method. Note that the return value from this method controls whether or not the native browser context menu is shown.
addShowContextMenuHandler
in interface HasShowContextMenuHandlers
handler
- the showContextMenu handlerHandlerRegistration
used to remove this handlerpublic void showKnobs(KnobType knobType)
knobs
to include the specified knobType, and if necessary draws out the appropriate control knobs.knobType
- knobs to showpublic void showKnobs(KnobType... knobType)
knobs
to include the specified knobType, and if necessary draws out the appropriate control knobs.knobType
- knobs to showpublic boolean supportsEndArrow()
setEndArrow()
? For example,
this is false for DrawRect
and DrawOval
, and true for DrawLine
.public boolean supportsStartArrow()
setStartArrow()
? For
example, this is false for DrawRect
and DrawOval
, and true for DrawLine
.public static void setDefaultProperties(DrawItem drawItemProperties)
Note: This method is intended for setting default attributes only and will affect 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. Calling this method after instances have been created can result in undefined behavior, since it bypasses any setters and a class instance may have already examined a particular property and not be expecting any changes through this route.
drawItemProperties
- properties that should be used as new defaults when instances of this class are createdSGWTProperties
public static DrawItem getRef(com.google.gwt.core.client.JavaScriptObject jsObj)
public static float computeAngle(double px1, double py1, double px2, double py2)
GwtFloatVsDouble
px1
- X coordinate of v1py1
- Y coordinate of v1px2
- X coordinate of v2py2
- Y coordinate of v2public static double computeAngleAsDouble(double px1, double py1, double px2, double py2)
px1
- X coordinate of v1py1
- Y coordinate of v1px2
- X coordinate of v2py2
- Y coordinate of v2public java.lang.Double[] getBoundingBoxAsDouble()
public int[] getBoundingBox()
public java.lang.Double[] getResizeBoundingBoxAsDouble()
resize outline
shown when dragging the resize knobs
. This method is similar to getBoundingBoxAsDouble
except that the coordinates returned by this method are in the global coordinate system (described here
).getBoundingBoxAsDouble()
public int[] getResizeBoundingBox()
resize outline
shown when dragging the resize knobs
. This method is similar to getBoundingBox
except that the coordinates returned by this method are in the global coordinate system (described here
).getBoundingBox()
protected int[] getAttributeAsIntArray(java.lang.String property)
protected void setAttribute(java.lang.String attribute, java.lang.Float[] value, boolean allowPostCreate)
setAttribute
in class BaseClass
protected void setAttribute(java.lang.String attribute, float[] value, boolean allowPostCreate)
setAttribute
in class BaseClass
public void setAutoChildConstructor(java.lang.String autoChildName, java.lang.String className)
autoChildName
.autoChildName
- the name of the AutoChildclassName
- the SmartClient class name to use when constructing the AutoChild.AutoChildUsage
public void setAutoChildProperties(java.lang.String autoChildName, Canvas properties) throws java.lang.IllegalStateException
Canvas
AutoChild named autoChildName
.
properties
must not have already been created
(properties.isCreated()
must be false
).
NOTE: Overrides at override points are not applied to AutoChildren created from
properties
; that is, if the Java Class
of properties
overrides a Smart GWT override point, the custom method implementation will not be called.
java.lang.IllegalStateException
- if properties
has been created.AutoChildUsage
public void setAutoChildProperties(java.lang.String autoChildName, FormItem properties) throws java.lang.IllegalStateException
FormItem
AutoChild named autoChildName
.
properties
must not have already been created
(properties.isCreated()
must be false
).
NOTE: Overrides at override points are not applied to AutoChildren created from
properties
; that is, if the Java Class
of properties
overrides a Smart GWT override point, the custom method implementation will not be called.
java.lang.IllegalStateException
- if properties
has been created.AutoChildUsage
public void setAutoChildProperties(java.lang.String autoChildName, DrawItem properties) throws java.lang.IllegalStateException
DrawItem
AutoChild named autoChildName
.
properties
must not have already been created
(properties.isCreated()
must be false
).
NOTE: Overrides at override points are not applied to AutoChildren created from
properties
; that is, if the Java Class
of properties
overrides a Smart GWT override point, the custom method implementation will not be called.
java.lang.IllegalStateException
- if properties
has been created.AutoChildUsage
public void setAutoChildProperties(java.lang.String autoChildName, EditProxy properties) throws java.lang.IllegalStateException
autoChildName
.
properties
must not have already been created
(properties.isCreated()
must be false
).
java.lang.IllegalStateException
- if properties
has been created.AutoChildUsage
public void setAutoChildVisibility(java.lang.String autoChildName, boolean visible)
autoChildName
.
NOTE: This API is not valid for all AutoChildren because some AutoChildren cannot be hidden without destroying the main functions of the component.
autoChildName
- name of an AutoChildvisible
- whether to show the AutoChildpublic final Canvas getCanvasAutoChild(java.lang.String autoChildName)
Canvas
AutoChild named autoChildName
if already created.autoChildName
- name of an AutoChild to return.java.lang.RuntimeException
- if the AutoChild is not a SmartClient Canvas
object.public final FormItem getFormItemAutoChild(java.lang.String autoChildName)
FormItem
AutoChild named autoChildName
if already created.autoChildName
- name of an AutoChild to return.java.lang.RuntimeException
- if the AutoChild is not a SmartClient FormItem
object.public final DrawItem getDrawItemAutoChild(java.lang.String autoChildName)
DrawItem
AutoChild named autoChildName
if already created.autoChildName
- name of an AutoChild to return.java.lang.RuntimeException
- if the AutoChild is not a SmartClient DrawItem
object.public void setProportionalResizeModifiers(java.lang.String... proportionalResizeModifiers) throws java.lang.IllegalStateException
proportionalResizing
is set to
ProportionalResizeMode.MODIFIER
or
ProportionalResizeMode.MODIFIER_OFF
then proportional resizing of the DrawItem
is activated or deactivated, respectively, whenever at least one key in this set of modifier keys is pressed.
The keys allowed in this set are: "Alt", "Ctrl", and "Shift". If this set of keys is empty then proportional
resizing is always used if proportionalResizing
is MODIFIER
and is never used if
proportionalResizing
is MODIFIER_OFF
.
proportionalResizeModifiers
- Default value is ["Shift"]java.lang.IllegalStateException
- this property cannot be changed after the underlying component has been createdpublic java.lang.String[] getProportionalResizeModifiers()
proportionalResizing
is set to
ProportionalResizeMode.MODIFIER
or
ProportionalResizeMode.MODIFIER_OFF
then proportional resizing of the DrawItem
is activated or deactivated, respectively, whenever at least one key in this set of modifier keys is pressed.
The keys allowed in this set are: "Alt", "Ctrl", and "Shift". If this set of keys is empty then proportional
resizing is always used if proportionalResizing
is MODIFIER
and is never used if
proportionalResizing
is MODIFIER_OFF
.