Class DrawItem
- All Implemented Interfaces:
HasAttachHandlers
,HasHandlers
,EventListener
,HasVisibility
,IsWidget
,LogicalStructure
,HasClickHandlers
,HasDragMoveHandlers
,HasDragResizeMoveHandlers
,HasDragResizeStartHandlers
,HasDragResizeStopHandlers
,HasDragStartHandlers
,HasDragStopHandlers
,HasDrawEndHandlers
,HasDrawStartHandlers
,HasMouseDownHandlers
,HasMouseMoveHandlers
,HasMouseOutHandlers
,HasMouseOverHandlers
,HasMouseUpHandlers
,HasMovedHandlers
,HasResizedHandlers
,HasShowContextMenuHandlers
- Direct Known Subclasses:
DrawCurve
,DrawDiamond
,DrawGroup
,DrawImage
,DrawLabel
,DrawLine
,DrawLinePath
,DrawOval
,DrawPath
,DrawRect
,DrawSector
,DrawShape
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.
-
Nested Class Summary
Nested classes/interfaces inherited from class com.google.gwt.user.client.ui.UIObject
UIObject.DebugIdImpl, UIObject.DebugIdImplEnabled
-
Field Summary
Fields inherited from class com.smartgwt.client.widgets.BaseWidget
config, configOnly, factoryCreated, factoryProperties, id, nativeObject, scClassName
Fields inherited from class com.google.gwt.user.client.ui.UIObject
DEBUG_ID_PREFIX
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionaddClickHandler
(ClickHandler handler) Add a click handler.addDragMoveHandler
(DragMoveHandler handler) Add a dragMove handler.Add a dragResizeMove handler.Add a dragResizeStart handler.Add a dragResizeStop handler.addDragStartHandler
(DragStartHandler handler) Add a dragStart handler.addDragStopHandler
(DragStopHandler handler) Add a dragStop handler.addDrawEndHandler
(DrawEndHandler handler) Add a drawEnd handler.addDrawStartHandler
(DrawStartHandler handler) Add a drawStart handler.addMouseDownHandler
(MouseDownHandler handler) Add a mouseDown handler.addMouseMoveHandler
(MouseMoveHandler handler) Add a mouseMove handler.addMouseOutHandler
(MouseOutHandler handler) Add a mouseOut handler.addMouseOverHandler
(MouseOverHandler handler) Add a mouseOver handler.addMouseUpHandler
(MouseUpHandler handler) Add a mouseUp handler.addMovedHandler
(MovedHandler handler) Add a moved handler.addResizedHandler
(ResizedHandler handler) Add a resized handler.Add a showContextMenu handler.void
static void
changeAutoChildDefaults
(String autoChildName, Canvas defaults) Changes the defaults for Canvas AutoChildren namedautoChildName
.static void
changeAutoChildDefaults
(String autoChildName, DrawItem defaults) Changes the defaults for DrawItem AutoChildren namedautoChildName
.static void
changeAutoChildDefaults
(String autoChildName, FormItem defaults) Changes the defaults for FormItem AutoChildren namedautoChildName
.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 vectorv2 - v1 between the two given vectors.protected JavaScriptObject
create()
void
IfcanDrag
is true and thecontrol 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 currentdrawPane
.void
erase()
Erase this drawItem's visual representation and remove it from its DrawGroup (if any) and DrawPane.getAttributeAsBoolean
(String property) getAttributeAsDate
(String property) getAttributeAsDouble
(String property) getAttributeAsElement
(String property) getAttributeAsFloat
(String property) getAttributeAsInt
(String property) getAttributeAsJavaScriptObject
(String property) getAttributeAsMap
(String property) getAttributeAsString
(String property) Expose as public the getAttributeAsXXX() methods of BaseWidgetint[]
Returns the startPoint endPointDouble[]
Returns the startPoint endPointstatic DrawItem
Retrieve a DrawItem by its globalID
.static DrawItem
getByJSObject
(JavaScriptObject jsObj) Retrieve a DrawItem from itsJavaScriptObject
.Is this DrawItem draggable? If true, then the DrawItem can be drag-repositioned by the user.Will this DrawItem fire hover events when the user hovers over it?final Canvas
getCanvasAutoChild
(String autoChildName) Returns theCanvas
AutoChild namedautoChildName
if already created.Returns the center point of this draw item in local coordinates.Context menu to show for this object, an instance of the Menu widget.Note : This API is non-functional (always returns null) and exists only to make you aware that this MultiAutoChild exists.If set, specifies the cursor to display when the mouse pointer is over this DrawItem.Flag indicating a drawItem has been destroyed, similar toCanvas.destroyed
.Flag indicating a drawItem is mid-destruction, similar toCanvas.destroying
.int
Number of pixels the cursor needs to move before the EventHandler starts a drag operation.DrawGroup
this drawItem is a member of.final DrawItem
getDrawItemAutoChild
(String autoChildName) Returns theDrawItem
AutoChild namedautoChildName
if already created.Default class used to construct theEditProxy
for this component when the component isfirst placed into edit mode
.Style of arrow head to draw at the end of the line or path.If this item is showingKnobType.ENDPOINT
control knobs
, this attribute specifies the AutoChild for theDrawKnob
for end point of current drawItem.boolean
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.Fill color to use for shapes.Fill gradient to use for shapes.Fill gradient to use for shapes.float
Opacity of the fillColor, as a number between 0 (transparent) and 1 (opaque).final FormItem
getFormItemAutoChild
(String autoChildName) Returns theFormItem
AutoChild namedautoChildName
if already created.int
Ifthis.canHover
is true, how long should the mouse be kept over this widget before the hover event is firedIfshowHover
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.Constrains drag-resizing and drag-repositioning of this draw item to either the current visible area of thedraw 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.Style of drawing the endpoints of a line.Line colorfloat
Opacity for lines, as a number between 0 (transparent) and 1 (opaque).Pattern for lines, eg "solid" or "dash".int
Pixel width for lines.Getter implementing theLogicalStructure
interface, which supports Eclipse's logical structure debugging facility.If this item is showingKnobType.MOVE
control knobs
, this attribute specifies the AutoChild for theDrawKnob
that allows a user to move the DrawItem with help of a knob located atmoveKnobPoint
.int[]
If this item is showing a"move"
control knob
, this attribute allows you to specify an offset in pixels from themoveKnobPoint
for the move knob.If this item is showing aKnobType.MOVE
control knob
, this attribute specifies where the knob should appear with respect to the draw item.static DrawItem
getOrCreateRef
(JavaScriptObject jsObj) int
Returns the page-relative left coordinate of the widget on the page, in pixels.int
Returns the page-relative top coordinate of the widget on the page, in pixelsThis method returns a Map of config properties suitable for use as the "defaults" attribute of aPaletteNode
.Defaulthover HTML
that is displayed in the global hover canvas if the user hovers over this DrawItem andshowHover
is true.String[]
IfproportionalResizing
is set toProportionalResizeMode.MODIFIER
orProportionalResizeMode.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.This property specifies the conditions for when proportional resizing is used.static DrawItem
getRef
(JavaScriptObject jsObj) int[]
Returns the bounding box of the shape reflected by theresize outline
shown when dragging theresize knobs
.Double[]
Returns the bounding box of the shape reflected by theresize outline
shown when dragging theresize knobs
.If this item is showingKnobType.RESIZE
control knobs
, this attribute specifies the points with respect to the draw item where resize knobs should appear.If this item is showingKnobType.RESIZE
control knobs
, this attribute specifies the AutoChild for theDrawRect
that draws a rectangle frame which connects all resize knobs of current DrawItem.boolean
If this DrawItem is showingKnobType.RESIZE
control knobs
, should resizing the shape solely update the local transform (for example, the DrawItem'sscale
ortranslation
)?.If this item is showingKnobType.ROTATE
control knobs
, this attribute specifies the AutoChild for theDrawKnob
that allows a user to rotate the DrawItem with help of a knob located above.float
Deprecated.double
Rotation in degrees about thecenter point
.float[]
getScale()
Array holds 2 values representing scaling along x and y dimensions.Shadow used for all DrawItem subtypes.boolean
IfcanHover
is true, should we show the global hover canvas by default when the user hovers over this DrawItem?boolean
If this item is showingKnobType.RESIZE
control knobs
will the resize outline be shown or not.boolean
If thetitleLabel
is showing, should thetitleLabelBackground
be created and placed behind thetitleLabel
?Note : This API is non-functional (always returns null) and exists only to make you aware that this MultiAutoChild exists.Style of arrow head to draw at the beginning of the line or path.If this item is showingKnobType.STARTPOINT
control knobs
, this attribute specifies the AutoChild for theDrawKnob
for start point of current drawItem.void
Generates a string containing the SVG source of this DrawItem.getTitle()
A string to show at thecenter point
of thisDrawItem
.boolean
Whether thetitleLabel
should be scaled to the maximum possible size that fits inside the bounds of this item.int
Specifies margin between label and item edges when usingtitleAutoFit
.Whether to rotate thetitleLabel
90 degrees clockwise while trying to maximize its size in accordance withtitleAutoFit
.When thetitleLabel
is showing andshowTitleLabelBackground
istrue
, thisDrawRect
AutoChild is created and placed behind thetitleLabel
.int
If thetitleLabelBackground
is visible, how much padding should be left between the bounds of thetitleLabel
and the edges of thetitleLabelBackground
?The mode in which thetitleLabel
(if shown) is rotated with this draw item.float[]
Array holds two values representing translation along the x and y dimensions.Returns the GWT Canvas associated with this DrawItem.boolean
double
The slope of an x-shearing transformation applied to this DrawItem.double
The slope of a y-shearing transformation applied to this DrawItem.void
hide()
Hide this drawItem.void
Hides all control knobs for this drawItem.void
Hides a set of control knobs for this drawItem.void
Hides a set of control knobs for this drawItem.boolean
hover()
IfcanHover
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 thebounding 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
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
Resize to the specified sizevoid
rotateBy
(double degrees) Rotate the shape by the relative rotation in degreesvoid
rotateTo
(double degrees) Rotate the shape by the absolute rotation in degreesvoid
scaleBy
(double x, double y) Scale the shape by the x, y multipliersvoid
scaleTo
(double x, double y) Scale the shape by the x, y multipliersvoid
setAttribute
(String attribute, double value, boolean allowPostCreate) setAttribute
(String attribute, int[] value, boolean allowPostCreate) setAttribute
(String attribute, JavaScriptObject value, boolean allowPostCreate) setAttribute
(String attribute, Element value, boolean allowPostCreate) setAttribute
(String attribute, BaseClass[] value, boolean allowPostCreate) setAttribute
(String attribute, DataClass[] value, boolean allowPostCreate) setAttribute
(String attribute, DataClass value, boolean allowPostCreate) setAttribute
(String attribute, ValueEnum[] value, boolean allowPostCreate) setAttribute
(String attribute, Boolean value, boolean allowPostCreate) setAttribute
(String attribute, String[] value, boolean allowPostCreate) setAttribute
(String attribute, String value, boolean allowPostCreate) Expose as public the setAttribute() methods of BaseWidgetsetAttribute
(String attribute, Date value, boolean allowPostCreate) setAttribute
(String attribute, Map value, boolean allowPostCreate) void
setAutoChildConstructor
(String autoChildName, String className) Sets the SmartClient constructor for the AutoChild namedautoChildName
.void
setAutoChildProperties
(String autoChildName, EditProxy properties) Sets the properties for creating an AutoChild namedautoChildName
.void
setAutoChildProperties
(String autoChildName, Canvas properties) Sets the properties for creating aCanvas
AutoChild namedautoChildName
.void
setAutoChildProperties
(String autoChildName, DrawItem properties) Sets the properties for creating aDrawItem
AutoChild namedautoChildName
.void
setAutoChildProperties
(String autoChildName, FormItem properties) Sets the properties for creating aFormItem
AutoChild namedautoChildName
.void
setAutoChildVisibility
(String autoChildName, boolean visible) Sets whether to create and show the AutoChild namedautoChildName
.setCanDrag
(Boolean canDrag) Is this DrawItem draggable? If true, then the DrawItem can be drag-repositioned by the user.setCanHover
(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.setContextMenu
(Menu contextMenu) Context menu to show for this object, an instance of the Menu widget.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.setDragStartDistance
(int dragStartDistance) Number of pixels the cursor needs to move before the EventHandler starts a drag operation.setDrawGroup
(DrawGroup drawGroup) DrawGroup
this drawItem is a member of.setDrawPane
(DrawPane drawPane) setDrawPane
(String drawPane) setEditProxyConstructor
(String editProxyConstructor) Default class used to construct theEditProxy
for this component when the component isfirst placed into edit mode
.setEndArrow
(ArrowStyle endArrow) Style of arrow head to draw at the end of the line or path.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.setFillColor
(String fillColor) Fill color to use for shapes.setFillGradient
(Gradient fillGradient) Fill gradient to use for shapes.setFillGradient
(String fillGradient) Fill gradient to use for shapes.setFillOpacity
(float fillOpacity) Opacity of the fillColor, as a number between 0 (transparent) and 1 (opaque).setHoverDelay
(int hoverDelay) Ifthis.canHover
is true, how long should the mouse be kept over this widget before the hover event is firedsetKeepInParentRect
(float... keepInParentRect) Constrains drag-resizing and drag-repositioning of this draw item to either the current visible area of thedraw pane
or an arbitrary bounding box (if set to an array of the form[left, top, left + width, top + height]
).setKeepInParentRect
(Boolean keepInParentRect) Constrains drag-resizing and drag-repositioning of this draw item to either the current visible area of thedraw pane
or an arbitrary bounding box (if set to an array of the form[left, top, left + width, top + height]
).Array of control knobs to display for this item.setLineCap
(LineCap lineCap) Style of drawing the endpoints of a line.setLineColor
(String lineColor) Line color
If this method is called after the component has been drawn/initialized: Update lineColor for this drawItem.setLineOpacity
(float lineOpacity) Opacity for lines, as a number between 0 (transparent) and 1 (opaque).setLinePattern
(LinePattern linePattern) Pattern for lines, eg "solid" or "dash".setLineWidth
(int lineWidth) Pixel width for lines.Setter implementing theLogicalStructure
interface, which supports Eclipse's logical structure debugging facility.setMoveKnobOffset
(int[] moveKnobOffset) If this item is showing a"move"
control knob
, this attribute allows you to specify an offset in pixels from themoveKnobPoint
for the move knob.setMoveKnobPoint
(MoveKnobPoint moveKnobPoint) If this item is showing aKnobType.MOVE
control knob
, this attribute specifies where the knob should appear with respect to the draw item.Defaulthover HTML
that is displayed in the global hover canvas if the user hovers over this DrawItem andshowHover
is true.void
setPropertyValue
(String propertyName, Object newValue) Sets a property on this DrawItem, calling the appropriate setter method if one is found and is supported.void
setProportionalResizeModifiers
(String... proportionalResizeModifiers) IfproportionalResizing
is set toProportionalResizeMode.MODIFIER
orProportionalResizeMode.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.setProportionalResizing
(ProportionalResizeMode proportionalResizing) This property specifies the conditions for when proportional resizing is used.setResizeKnobPoints
(ResizeKnobPoint... resizeKnobPoints) If this item is showingKnobType.RESIZE
control knobs
, this attribute specifies the points with respect to the draw item where resize knobs should appear.setResizeViaLocalTransformOnly
(boolean resizeViaLocalTransformOnly) If this DrawItem is showingKnobType.RESIZE
control knobs
, should resizing the shape solely update the local transform (for example, the DrawItem'sscale
ortranslation
)?.setRotation
(double rotation) Rotation in degrees about thecenter point
.setRotation
(float rotation) Deprecated.setScale
(float[] scale) Array holds 2 values representing scaling along x and y dimensions.Shadow used for all DrawItem subtypes.setShapeData
(Map shapeData) An opaque object specifying the local transformation that should be applied to thisDrawItem
, obtained through a call togetShapeData()
.setShowHover
(boolean showHover) IfcanHover
is true, should we show the global hover canvas by default when the user hovers over this DrawItem?setShowResizeOutline
(boolean showResizeOutline) If this item is showingKnobType.RESIZE
control knobs
will the resize outline be shown or not.setShowTitleLabelBackground
(boolean showTitleLabelBackground) If thetitleLabel
is showing, should thetitleLabelBackground
be created and placed behind thetitleLabel
?setStartArrow
(ArrowStyle startArrow) Style of arrow head to draw at the beginning of the line or path.void
A string to show at thecenter point
of thisDrawItem
.setTitleAutoFit
(boolean titleAutoFit) Whether thetitleLabel
should be scaled to the maximum possible size that fits inside the bounds of this item.setTitleAutoFitMargin
(int titleAutoFitMargin) Specifies margin between label and item edges when usingtitleAutoFit
.setTitleAutoFitRotationMode
(TitleAutoFitRotationMode titleAutoFitRotationMode) Whether to rotate thetitleLabel
90 degrees clockwise while trying to maximize its size in accordance withtitleAutoFit
.setTitleLabelPadding
(int titleLabelPadding) If thetitleLabelBackground
is visible, how much padding should be left between the bounds of thetitleLabel
and the edges of thetitleLabelBackground
?setTitleRotationMode
(TitleRotationMode titleRotationMode) The mode in which thetitleLabel
(if shown) is rotated with this draw item.setTranslate
(float[] translate) Array holds two values representing translation along the x and y dimensions.setUseSimpleTransform
(boolean useSimpleTransform) setXShearFactor
(double xShearFactor) The slope of an x-shearing transformation applied to this DrawItem.setYShearFactor
(double yShearFactor) The slope of a y-shearing transformation applied to this DrawItem.void
show()
Make this drawItem visible.void
Shows all supported control knobs for this drawItem.void
Shows a set of control knobs for this drawItem.void
Shows a set of control knobs for this drawItem.boolean
Does this DrawItem supportsetEndArrow()
? For example, this is false forDrawRect
andDrawOval
, and true forDrawLine
.boolean
Does this DrawItem supportsetStartArrow()
? For example, this is false forDrawRect
andDrawOval
, and true forDrawLine
.Methods inherited from class com.smartgwt.client.widgets.BaseWidget
addDrawHandler, addDynamicProperty, addDynamicProperty, addDynamicProperty, addDynamicProperty, applyFactoryProperties, clearDynamicProperty, completeCreation, destroy, doAddHandler, doInit, doOnRender, equals, error, errorIfNotCreated, getAttribute, getAttributeAsDateArray, getAttributeAsFloatArray, getAttributeAsIntArray, getAttributeAsObject, getAttributeAsRecord, getAttributeAsStringArray, getClassName, getConfig, getDOM, getHandlerCount, getID, getInnerHTML, getJsObj, getOrCreateJsObj, getScClassName, hasAutoAssignedID, hasDynamicProperty, hashCode, initNativeObject, internalSetID, internalSetID, isConfigOnly, isCreated, isDrawn, isFactoryCreated, onBind, onDestroy, onDraw, onInit, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setConfig, setConfigOnly, setDefaultProperties, setDragTracker, setFactoryCreated, setHtmlElement, setID, setJavaScriptObject, setLogicalStructure, setLogicalStructure, setNullProperty, setPosition, setProperty, setProperty, setProperty, setProperty, setProperty, setProperty, setProperty, setScClassName, toString
Methods inherited from class com.google.gwt.user.client.ui.Widget
addAttachHandler, addBitlessDomHandler, addDomHandler, addHandler, asWidget, asWidgetOrNull, createHandlerManager, delegateEvent, doAttachChildren, doDetachChildren, fireEvent, getLayoutData, getParent, isAttached, isOrWasAttached, onAttach, onBrowserEvent, onDetach, onLoad, onUnload, removeFromParent, setLayoutData, sinkEvents, unsinkEvents
Methods inherited from class com.google.gwt.user.client.ui.UIObject
addStyleDependentName, addStyleName, ensureDebugId, ensureDebugId, ensureDebugId, getAbsoluteLeft, getAbsoluteTop, getElement, getOffsetHeight, getOffsetWidth, getStyleElement, getStyleName, getStyleName, getStylePrimaryName, getStylePrimaryName, isVisible, isVisible, onEnsureDebugId, removeStyleDependentName, removeStyleName, resolvePotentialElement, setElement, setElement, setHeight, setPixelSize, setSize, setStyleDependentName, setStyleName, setStyleName, setStyleName, setStyleName, setStylePrimaryName, setStylePrimaryName, setVisible, setVisible, setWidth, sinkBitlessEvent
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
Methods inherited from interface com.google.gwt.event.shared.HasHandlers
fireEvent
-
Constructor Details
-
DrawItem
public DrawItem() -
DrawItem
-
-
Method Details
-
getOrCreateRef
-
getPaletteDefaults
This method returns a Map of config properties suitable for use as the "defaults" attribute of aPaletteNode
. Use it when you need to work with PaletteNodes indirectly, such when setting upTileRecord
s that will be used in aTilePalette
. Seethe dev tools overview
for examples of how to assemble and acquire a suitable defaults object when you are creating a PaletteNode indirectly -
changeAutoChildDefaults
Changes the defaults for Canvas AutoChildren namedautoChildName
.- Parameters:
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, seeSGWTProperties
.- See Also:
-
changeAutoChildDefaults
Changes the defaults for FormItem AutoChildren namedautoChildName
.- Parameters:
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, seeSGWTProperties
.- See Also:
-
changeAutoChildDefaults
Changes the defaults for DrawItem AutoChildren namedautoChildName
.- Parameters:
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, seeSGWTProperties
.- See Also:
-
create
- Overrides:
create
in classBaseWidget
-
setCanDrag
Is this DrawItem draggable? If true, then the DrawItem can be drag-repositioned by the user.
If this method is called after the component has been drawn/initialized: Setter forcanDrag
.Note : This is an advanced setting
- Parameters:
canDrag
- new value forthis.canDrag
. Default value is false- Returns:
DrawItem
instance, for chaining setter calls
-
getCanDrag
Is this DrawItem draggable? If true, then the DrawItem can be drag-repositioned by the user.- Returns:
- Current canDrag value. Default value is false
-
setCanHover
Will this DrawItem fire hover events when the user hovers over it?- Parameters:
canHover
- New canHover value. Default value is null- Returns:
DrawItem
instance, for chaining setter calls- See Also:
-
getCanHover
Will this DrawItem fire hover events when the user hovers over it?- Returns:
- Current canHover value. Default value is null
- See Also:
-
getContextMenu
Context menu to show for this object, an instance of the Menu widget.Note: if
Canvas.destroy()
is called on a canvas, any specified context menu is not automatically destroyed as well. This is in contrast toMenuButton
s which automatically destroy their specifiedMenuButton.menu
by default. The behavior is intentional as context menus are commonly reused across components.- Returns:
- Current contextMenu value. Default value is null
- See Also:
-
getCornerResizeKnob
Note : This API is non-functional (always returns null) and exists only to make you aware that this MultiAutoChild exists. SeeUsing AutoChildren
for details.If this item is showing
KnobType.RESIZE
control knobs
, this attribute specifies the MultiAutoChild for theDrawKnob
that allows a user to resize the DrawItem with help of knobs located at corners of a bounding rectangle of current DrawItem. The default shape is a light teal circle.- Returns:
- null
-
setCursor
If set, specifies the cursor to display when the mouse pointer is over this DrawItem.Note : This is an advanced setting
- Parameters:
cursor
- new cursor. Default value is null- Returns:
DrawItem
instance, for chaining setter calls
-
getCursor
If set, specifies the cursor to display when the mouse pointer is over this DrawItem.- Returns:
- Current cursor value. Default value is null
-
getDestroyed
Flag indicating a drawItem has been destroyed, similar toCanvas.destroyed
.Note : This method should be called only after the widget has been rendered.
- Returns:
- Current destroyed value. Default value is null
- Throws:
IllegalStateException
- if this widget has not yet been rendered.
-
getDestroying
Flag indicating a drawItem is mid-destruction, similar toCanvas.destroying
.Note : This method should be called only after the widget has been rendered.
- Returns:
- Current destroying value. Default value is null
- Throws:
IllegalStateException
- if this widget has not yet been rendered.
-
setDragStartDistance
Number of pixels the cursor needs to move before the EventHandler starts a drag operation.Note : This is an advanced setting
- Parameters:
dragStartDistance
- New dragStartDistance value. Default value is 5- Returns:
DrawItem
instance, for chaining setter calls- See Also:
-
getDragStartDistance
public int getDragStartDistance()Number of pixels the cursor needs to move before the EventHandler starts a drag operation.- Returns:
- Current dragStartDistance value. Default value is 5
- See Also:
-
setDrawGroup
DrawGroup
this drawItem is a member of.- Parameters:
drawGroup
- New drawGroup value. Default value is null- Returns:
DrawItem
instance, for chaining setter calls- Throws:
IllegalStateException
- this property cannot be changed after the component has been created
-
getDrawGroup
DrawGroup
this drawItem is a member of.- Returns:
- Current drawGroup value. Default value is null
-
setDrawPane
DrawPane
orglobal ID
of the 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 fordrawPane
.- Parameters:
drawPane
- new value forthis.drawPane
. Default value is null- Returns:
DrawItem
instance, for chaining setter calls
-
getDrawPane
DrawPane
orglobal ID
of the DrawPane this drawItem should draw in.If this item has a
DrawGroup
, the drawGroup's drawPane is automatically used.- Returns:
- Current drawPane value. Default value is null
-
setDrawPane
DrawPane
orglobal ID
of the 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 fordrawPane
.- Parameters:
drawPane
- new value forthis.drawPane
. Default value is null- Returns:
DrawItem
instance, for chaining setter calls
-
getDrawPaneAsString
DrawPane
orglobal ID
of the DrawPane this drawItem should draw in.If this item has a
DrawGroup
, the drawGroup's drawPane is automatically used.- Returns:
- Current drawPane value. Default value is null
-
setEditProxyConstructor
Default class used to construct theEditProxy
for this component when the component isfirst placed into edit mode
.- Parameters:
editProxyConstructor
- New editProxyConstructor value. Default value is "DrawItemEditProxy"- Returns:
DrawItem
instance, for chaining setter calls- Throws:
IllegalStateException
- this property cannot be changed after the component has been created- See Also:
-
getEditProxyConstructor
Default class used to construct theEditProxy
for this component when the component isfirst placed into edit mode
.- Returns:
- Current editProxyConstructor value. Default value is "DrawItemEditProxy"
- See Also:
-
setEndArrow
Style of arrow head to draw at the end of the line or path.
If this method is called after the component has been drawn/initialized: Set the arrowhead at the end of this path.NOTE: Not all DrawItem classes support arrowheads. You can use
supportsEndArrow()
to dynamically check whether a DrawItem instance supports this method.- Parameters:
endArrow
- style of arrow to use. Default value is null- Returns:
DrawItem
instance, for chaining setter calls- See Also:
-
getEndArrow
Style of arrow head to draw at the end of the line or path.- Returns:
- Current endArrow value. Default value is null
- See Also:
-
getEndKnob
If this item is showingKnobType.ENDPOINT
control knobs
, this attribute specifies the AutoChild for theDrawKnob
for end point of current drawItem.This component is an AutoChild named "endKnob". For an overview of how to use and configure AutoChildren, see
Using AutoChildren
.- Returns:
- Current endKnob value. Default value is null
- Throws:
IllegalStateException
- if this widget has not yet been rendered.
-
setEventOpaque
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. This property is true by default for closed shapes, and false for paths, lines, etc.Note: this property must be true if you're writing to an HTML5 <canvas> element directly in your code (only applies to
DrawingType
DrawingType.BITMAP
).Note : This is an advanced setting
- Parameters:
eventOpaque
- New eventOpaque value. Default value is varies- Returns:
DrawItem
instance, for chaining setter calls- Throws:
IllegalStateException
- this property cannot be changed after the component has been created- See Also:
-
setFillColor(java.lang.String)
setFillOpacity(float)
DrawPane.getBitmap()
-
getEventOpaque
public 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. This property is true by default for closed shapes, and false for paths, lines, etc.Note: this property must be true if you're writing to an HTML5 <canvas> element directly in your code (only applies to
DrawingType
DrawingType.BITMAP
).- Returns:
- Current eventOpaque value. Default value is varies
- See Also:
-
getFillColor()
getFillOpacity()
DrawPane.getBitmap()
-
setFillColor
Fill color to use for shapes. The default of 'null' is transparent.
If this method is called after the component has been drawn/initialized: Update fillColor for this drawItem. -
getFillColor
Fill color to use for shapes. The default of 'null' is transparent.- Returns:
- Current fillColor value. Default value is null
- See Also:
-
setFillGradient
Fill gradient to use for shapes. If a string it uses the gradient identifier parameter provided inDrawPane.addGradient()
. Otherwise it expects one ofSimpleGradient
,LinearGradient
orRadialGradient
.
If this method is called after the component has been drawn/initialized: Update fillGradient for this drawItem. -
getFillGradient
Fill gradient to use for shapes. If a string it uses the gradient identifier parameter provided inDrawPane.addGradient()
. Otherwise it expects one ofSimpleGradient
,LinearGradient
orRadialGradient
.- Returns:
- Current fillGradient value. Default value is null
- See Also:
-
setFillGradient
Fill gradient to use for shapes. If a string it uses the gradient identifier parameter provided inDrawPane.addGradient()
. Otherwise it expects one ofSimpleGradient
,LinearGradient
orRadialGradient
.
If this method is called after the component has been drawn/initialized: Update fillGradient for this drawItem. -
getFillGradientAsString
Fill gradient to use for shapes. If a string it uses the gradient identifier parameter provided inDrawPane.addGradient()
. Otherwise it expects one ofSimpleGradient
,LinearGradient
orRadialGradient
.- Returns:
- Current fillGradient value. Default value is null
- See Also:
-
setFillOpacity
Opacity of the fillColor, as a number between 0 (transparent) and 1 (opaque).
If this method is called after the component has been drawn/initialized: Update fillOpacity for this drawItem.- Parameters:
fillOpacity
- new opacity, as a number between 0 (transparent) and 1 (opaque). Default value is 1.0- Returns:
DrawItem
instance, for chaining setter calls
-
getFillOpacity
public float getFillOpacity()Opacity of the fillColor, as a number between 0 (transparent) and 1 (opaque).- Returns:
- Current fillOpacity value. Default value is 1.0
-
setHoverDelay
Ifthis.canHover
is true, how long should the mouse be kept over this widget before the hover event is fired- Parameters:
hoverDelay
- New hoverDelay value. Default value is 300- Returns:
DrawItem
instance, for chaining setter calls- See Also:
-
getHoverDelay
public int getHoverDelay()Ifthis.canHover
is true, how long should the mouse be kept over this widget before the hover event is fired- Returns:
- Current hoverDelay value. Default value is 300
- See Also:
-
setKeepInParentRect
Constrains drag-resizing and drag-repositioning of this draw item to either the current visible area of thedraw 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
- Parameters:
keepInParentRect
- New keepInParentRect value. Default value is null- Returns:
DrawItem
instance, for chaining setter calls
-
getKeepInParentRect
Constrains drag-resizing and drag-repositioning of this draw item to either the current visible area of thedraw 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.
- Returns:
- Current keepInParentRect value. Default value is null
-
setKeepInParentRect
Constrains drag-resizing and drag-repositioning of this draw item to either the current visible area of thedraw 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
- Parameters:
keepInParentRect
- New keepInParentRect value. Default value is null- Returns:
DrawItem
instance, for chaining setter calls
-
setKnobs
Array of control knobs to display for this item. EachKnobType
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 useshowKnobs()
andhideKnobs()
.NOTE: Unless otherwise documented, DrawItem types only support
KnobType.RESIZE
andKnobType.MOVE
knobs.- Parameters:
knobs
- New knobs value. Default value is null- Returns:
DrawItem
instance, for chaining setter calls- Throws:
IllegalStateException
- this property cannot be changed after the component has been created
-
getKnobs
Array of control knobs to display for this item. EachKnobType
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 useshowKnobs()
andhideKnobs()
.NOTE: Unless otherwise documented, DrawItem types only support
KnobType.RESIZE
andKnobType.MOVE
knobs.- Returns:
- Current knobs value. Default value is null
-
setLineCap
Style of drawing the endpoints of a line.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.- Parameters:
lineCap
- new lineCap to use. Default value is "round"- Returns:
DrawItem
instance, for chaining setter calls
-
getLineCap
Style of drawing the endpoints of a line.Note that for dashed and dotted lines, the lineCap style affects each dash or dot.
- Returns:
- Current lineCap value. Default value is "round"
-
setLineColor
Line color
If this method is called after the component has been drawn/initialized: Update lineColor for this drawItem. -
getLineColor
Line color- Returns:
- Current lineColor value. Default value is "#808080"
- See Also:
-
setLineOpacity
Opacity for lines, as a number between 0 (transparent) and 1 (opaque).
If this method is called after the component has been drawn/initialized: Update lineOpacity for this drawItem.- Parameters:
lineOpacity
- new opacity, as a number between 0 (transparent) and 1 (opaque). Default value is 1.0- Returns:
DrawItem
instance, for chaining setter calls
-
getLineOpacity
public float getLineOpacity()Opacity for lines, as a number between 0 (transparent) and 1 (opaque).- Returns:
- Current lineOpacity value. Default value is 1.0
-
setLinePattern
Pattern for lines, eg "solid" or "dash".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, andDrawRect
s with norounding
.
If this method is called after the component has been drawn/initialized: Update linePattern for this drawItem.- Parameters:
linePattern
- new linePattern to use. Default value is "solid"- Returns:
DrawItem
instance, for chaining setter calls
-
getLinePattern
Pattern for lines, eg "solid" or "dash".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, andDrawRect
s with norounding
.- Returns:
- Current linePattern value. Default value is "solid"
-
setLineWidth
Pixel width for lines.
If this method is called after the component has been drawn/initialized: Update lineWidth for this drawItem.- Parameters:
lineWidth
- new pixel lineWidth. Default value is 3- Returns:
DrawItem
instance, for chaining setter calls
-
getLineWidth
public int getLineWidth()Pixel width for lines.- Returns:
- Current lineWidth value. Default value is 3
-
getMoveKnob
If this item is showingKnobType.MOVE
control knobs
, this attribute specifies the AutoChild for theDrawKnob
that allows a user to move the DrawItem with help of a knob located atmoveKnobPoint
. Default move knob shape is green circle.This component is an AutoChild named "moveKnob". For an overview of how to use and configure AutoChildren, see
Using AutoChildren
.- Returns:
- Current moveKnob value. Default value is null
- Throws:
IllegalStateException
- if this widget has not yet been rendered.
-
setMoveKnobOffset
If this item is showing a"move"
control knob
, this attribute allows you to specify an offset in pixels from themoveKnobPoint
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 formoveKnobOffset
.Note : This is an advanced setting
- Parameters:
moveKnobOffset
- the new move knob offset. This is a 2-element array of [left offset, top offset]. If null, thennew int[] {0, 0}
is assumed. Default value is null- Returns:
DrawItem
instance, for chaining setter calls- See Also:
-
getMoveKnobOffset
public int[] getMoveKnobOffset()If this item is showing a"move"
control knob
, this attribute allows you to specify an offset in pixels from themoveKnobPoint
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.
- Returns:
- Current moveKnobOffset value. Default value is null
- See Also:
-
setMoveKnobPoint
If this item is showing aKnobType.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
.- Parameters:
moveKnobPoint
- New moveKnobPoint value. Default value is "TL"- Returns:
DrawItem
instance, for chaining setter calls- Throws:
IllegalStateException
- this property cannot be changed after the component has been created- See Also:
-
getMoveKnobPoint
If this item is showing aKnobType.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
.- Returns:
- Current moveKnobPoint value. Default value is "TL"
- See Also:
-
setPrompt
Defaulthover HTML
that is displayed in the global hover canvas if the user hovers over this DrawItem andshowHover
is true.- Parameters:
prompt
- New prompt value. Default value is null- Returns:
DrawItem
instance, for chaining setter calls- See Also:
-
getPrompt
Defaulthover HTML
that is displayed in the global hover canvas if the user hovers over this DrawItem andshowHover
is true.- Returns:
- Current prompt value. Default value is null
- See Also:
-
setProportionalResizing
public DrawItem setProportionalResizing(ProportionalResizeMode proportionalResizing) throws IllegalStateException This property specifies the conditions for when proportional resizing is used.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
.- Parameters:
proportionalResizing
- New proportionalResizing value. Default value is "modifier"- Returns:
DrawItem
instance, for chaining setter calls- Throws:
IllegalStateException
- this property cannot be changed after the component has been created
-
getProportionalResizing
This property specifies the conditions for when proportional resizing is used.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
.- Returns:
- Current proportionalResizing value. Default value is "modifier"
-
setResizeKnobPoints
public DrawItem setResizeKnobPoints(ResizeKnobPoint... resizeKnobPoints) throws IllegalStateException If this item is showingKnobType.RESIZE
control knobs
, this attribute specifies the points with respect to the draw item where resize knobs should appear.- Parameters:
resizeKnobPoints
- New resizeKnobPoints value. Default value is ["TL","TR","BL","BR","T","R","B","L"]- Returns:
DrawItem
instance, for chaining setter calls- Throws:
IllegalStateException
- this property cannot be changed after the component has been created
-
getResizeKnobPoints
If this item is showingKnobType.RESIZE
control knobs
, this attribute specifies the points with respect to the draw item where resize knobs should appear.- Returns:
- Current resizeKnobPoints value. Default value is ["TL","TR","BL","BR","T","R","B","L"]
-
getResizeOutline
If this item is showingKnobType.RESIZE
control knobs
, this attribute specifies the AutoChild for theDrawRect
that draws a rectangle frame which connects all resize knobs of current DrawItem.This component is an AutoChild named "resizeOutline". For an overview of how to use and configure AutoChildren, see
Using AutoChildren
.- Returns:
- Current resizeOutline value. Default value is null
- Throws:
IllegalStateException
- if this widget has not yet been rendered.
-
setResizeViaLocalTransformOnly
public DrawItem setResizeViaLocalTransformOnly(boolean resizeViaLocalTransformOnly) throws IllegalStateException If this DrawItem is showingKnobType.RESIZE
control knobs
, should resizing the shape solely update the local transform (for example, the DrawItem'sscale
ortranslation
)?.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:- A
DrawOval
might decrease itsradius
when resized to a smaller size. - A
DrawPath
might change itspoints
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.- Parameters:
resizeViaLocalTransformOnly
- New resizeViaLocalTransformOnly value. Default value is false- Returns:
DrawItem
instance, for chaining setter calls- Throws:
IllegalStateException
- this property cannot be changed after the component has been created
- A
-
getResizeViaLocalTransformOnly
public boolean getResizeViaLocalTransformOnly()If this DrawItem is showingKnobType.RESIZE
control knobs
, should resizing the shape solely update the local transform (for example, the DrawItem'sscale
ortranslation
)?.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:- A
DrawOval
might decrease itsradius
when resized to a smaller size. - A
DrawPath
might change itspoints
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.- Returns:
- Current resizeViaLocalTransformOnly value. Default value is false
- A
-
getRotateKnob
If this item is showingKnobType.ROTATE
control knobs
, this attribute specifies the AutoChild for theDrawKnob
that allows a user to rotate the DrawItem with help of a knob located above. Default rotate knob shape is green circle.This component is an AutoChild named "rotateKnob". For an overview of how to use and configure AutoChildren, see
Using AutoChildren
.- Returns:
- Current rotateKnob value. Default value is null
- Throws:
IllegalStateException
- if this widget has not yet been rendered.
-
setRotation
Deprecated.Rotation in degrees about thecenter point
. The positive direction is clockwise.- Parameters:
rotation
- New rotation value. Default value is 0.0- Returns:
DrawItem
instance, for chaining setter calls- Throws:
IllegalStateException
- this property cannot be changed after the component has been created
-
getRotation
public float getRotation()Deprecated.Rotation in degrees about thecenter point
. The positive direction is clockwise.- Returns:
- Current rotation value. Default value is 0.0
-
setRotation
Rotation in degrees about thecenter point
. The positive direction is clockwise.- Parameters:
rotation
- New rotation value. Default value is 0.0- Returns:
DrawItem
instance, for chaining setter calls- Throws:
IllegalStateException
- this property cannot be changed after the component has been created
-
getRotationAsDouble
public double getRotationAsDouble()Rotation in degrees about thecenter point
. The positive direction is clockwise.- Returns:
- Current rotation value. Default value is 0.0
-
setScale
Array holds 2 values representing scaling along x and y dimensions.Note : This is an advanced setting
- Parameters:
scale
- New scale value. Default value is null- Returns:
DrawItem
instance, for chaining setter calls- Throws:
IllegalStateException
- this property cannot be changed after the component has been created
-
getScale
public float[] getScale()Array holds 2 values representing scaling along x and y dimensions.- Returns:
- Current scale value. Default value is null
-
setShadow
Shadow used for all DrawItem subtypes.
If this method is called after the component has been drawn/initialized: Update shadow for this drawItem.- Parameters:
shadow
- new shadow. Default value is null- Returns:
DrawItem
instance, for chaining setter calls
-
getShadow
Shadow used for all DrawItem subtypes.- Returns:
- Current shadow value. Default value is null
-
setShapeData
An opaque object specifying the local transformation that should be applied to thisDrawItem
, obtained through a call togetShapeData()
.Note: if this property is specified, you should avoid also specifying a
translate
,scale
,xShearFactor
,yShearFactor
, orrotation
.- Parameters:
shapeData
- New shapeData value. Default value is null- Returns:
DrawItem
instance, for chaining setter calls- Throws:
IllegalStateException
- this property cannot be changed after the component has been created
-
setShowHover
IfcanHover
is true, should we show the global hover canvas by default when the user hovers over this DrawItem?- Parameters:
showHover
- New showHover value. Default value is true- Returns:
DrawItem
instance, for chaining setter calls- See Also:
-
getShowHover
public boolean getShowHover()IfcanHover
is true, should we show the global hover canvas by default when the user hovers over this DrawItem?- Returns:
- Current showHover value. Default value is true
- See Also:
-
setShowResizeOutline
If this item is showingKnobType.RESIZE
control knobs
will the resize outline be shown or not.- Parameters:
showResizeOutline
- New showResizeOutline value. Default value is true- Returns:
DrawItem
instance, for chaining setter calls- See Also:
-
com.smartgwt.client.widgets.drawing.DrawItem#setResizeOutline
-
getShowResizeOutline
public boolean getShowResizeOutline()If this item is showingKnobType.RESIZE
control knobs
will the resize outline be shown or not.- Returns:
- Current showResizeOutline value. Default value is true
- See Also:
-
setShowTitleLabelBackground
public DrawItem setShowTitleLabelBackground(boolean showTitleLabelBackground) throws IllegalStateException If thetitleLabel
is showing, should thetitleLabelBackground
be created and placed behind thetitleLabel
?This defaults to true for
DrawSector
s and shapes that are not commonly filled (e.g.DrawLine
s).Note : This is an advanced setting
- Parameters:
showTitleLabelBackground
- New showTitleLabelBackground value. Default value is false- Returns:
DrawItem
instance, for chaining setter calls- Throws:
IllegalStateException
- this property cannot be changed after the component has been created
-
getShowTitleLabelBackground
public boolean getShowTitleLabelBackground()If thetitleLabel
is showing, should thetitleLabelBackground
be created and placed behind thetitleLabel
?This defaults to true for
DrawSector
s and shapes that are not commonly filled (e.g.DrawLine
s).- Returns:
- Current showTitleLabelBackground value. Default value is false
-
getSideResizeKnob
Note : This API is non-functional (always returns null) and exists only to make you aware that this MultiAutoChild exists. SeeUsing AutoChildren
for details.If this item is showing
KnobType.RESIZE
control knobs
, this attribute specifies the MultiAutoChild for theDrawKnob
that allows a user to resize the DrawItem with help of knobs located at centers of edges of a bounding rectangle of current DrawItem. The default shape is a light teal square.- Returns:
- null
-
setStartArrow
Style of arrow head to draw at the beginning of the line or path.
If this method is called after the component has been drawn/initialized: Set the arrowhead at the beginning of this path.NOTE: Not all DrawItem classes support arrowheads. You can use
supportsStartArrow()
to dynamically check whether a DrawItem instance supports this method.- Parameters:
startArrow
- style of arrow to use. Default value is null- Returns:
DrawItem
instance, for chaining setter calls- See Also:
-
getStartArrow
Style of arrow head to draw at the beginning of the line or path.- Returns:
- Current startArrow value. Default value is null
- See Also:
-
getStartKnob
If this item is showingKnobType.STARTPOINT
control knobs
, this attribute specifies the AutoChild for theDrawKnob
for start point of current drawItem.This component is an AutoChild named "startKnob". For an overview of how to use and configure AutoChildren, see
Using AutoChildren
.- Returns:
- Current startKnob value. Default value is null
- Throws:
IllegalStateException
- if this widget has not yet been rendered.
-
setTitle
A string to show at thecenter point
of thisDrawItem
.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 thisDrawItem
.
If this method is called after the component has been drawn/initialized: Setter for thetitle
of thisDrawItem
.Note : This is an advanced setting
- Overrides:
setTitle
in classBaseWidget
- Parameters:
title
- newtitle
. Default value is null- See Also:
-
getTitle
A string to show at thecenter point
of thisDrawItem
.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 thisDrawItem
.- Overrides:
getTitle
in classBaseWidget
- Returns:
- Current title value. Default value is null
- See Also:
-
setTitleAutoFit
Whether thetitleLabel
should be scaled to the maximum possible size that fits inside the bounds of this item. Currently onlyDrawRect
s andDrawPolygon
s with 90 degree angles are supported.Note that
titleAutoFit
isn't supported for rotated, sheared, or scaledDrawItem
s, and that therefore the value ofTitleRotationMode
, which relates to rotation of the item, is ignored when this property is set. However, we do support having the label automatically rotate to run vertically if there's more space - seetitleAutoFitRotationMode
.- Parameters:
titleAutoFit
- New titleAutoFit value. Default value is false- Returns:
DrawItem
instance, for chaining setter calls- Throws:
IllegalStateException
- this property cannot be changed after the component has been created- See Also:
-
com.smartgwt.client.widgets.drawing.DrawItem#setTitleLabel
-
getTitleAutoFit
public boolean getTitleAutoFit()Whether thetitleLabel
should be scaled to the maximum possible size that fits inside the bounds of this item. Currently onlyDrawRect
s andDrawPolygon
s with 90 degree angles are supported.Note that
titleAutoFit
isn't supported for rotated, sheared, or scaledDrawItem
s, and that therefore the value ofTitleRotationMode
, which relates to rotation of the item, is ignored when this property is set. However, we do support having the label automatically rotate to run vertically if there's more space - seetitleAutoFitRotationMode
.- Returns:
- Current titleAutoFit value. Default value is false
- See Also:
-
setTitleAutoFitMargin
Specifies margin between label and item edges when usingtitleAutoFit
.- Parameters:
titleAutoFitMargin
- New titleAutoFitMargin value. Default value is 2- Returns:
DrawItem
instance, for chaining setter calls- Throws:
IllegalStateException
- this property cannot be changed after the component has been created- See Also:
-
com.smartgwt.client.widgets.drawing.DrawItem#setTitleLabel
-
getTitleAutoFitMargin
public int getTitleAutoFitMargin()Specifies margin between label and item edges when usingtitleAutoFit
.- Returns:
- Current titleAutoFitMargin value. Default value is 2
- See Also:
-
setTitleAutoFitRotationMode
public DrawItem setTitleAutoFitRotationMode(TitleAutoFitRotationMode titleAutoFitRotationMode) throws IllegalStateException Whether to rotate thetitleLabel
90 degrees clockwise while trying to maximize its size in accordance withtitleAutoFit
. If automatic rotation is specified, the default, the label will be rotated if and only if it allows the label to become larger.- Parameters:
titleAutoFitRotationMode
- New titleAutoFitRotationMode value. Default value is "auto"- Returns:
DrawItem
instance, for chaining setter calls- Throws:
IllegalStateException
- this property cannot be changed after the component has been created- See Also:
-
com.smartgwt.client.widgets.drawing.DrawItem#setTitleLabel
setTitleAutoFit(boolean)
-
getTitleAutoFitRotationMode
Whether to rotate thetitleLabel
90 degrees clockwise while trying to maximize its size in accordance withtitleAutoFit
. If automatic rotation is specified, the default, the label will be rotated if and only if it allows the label to become larger.- Returns:
- Current titleAutoFitRotationMode value. Default value is "auto"
- See Also:
-
getTitleLabel
When a non-nulltitle
is set, this AutoChild is created automatically and positioned at thecenter
of thisDrawItem
. ThetitleLabel
moves with thisDrawItem
and, depending ontitleRotationMode
, can rotate with thisDrawItem
as well.The following
passthrough
applies:
title
forDrawLabel.contents
.Related to the
titleLabel
is thetitleLabelBackground
which allows a border to be placed around thetitleLabel
and/or a background added. By default, shapes that are commonly filled such asDrawTriangle
s, with the exception ofDrawSector
s, do not show thetitleLabelBackground
(seeshowTitleLabelBackground
).This component is an AutoChild named "titleLabel". For an overview of how to use and configure AutoChildren, see
Using AutoChildren
.- Returns:
- Current titleLabel value. Default value is null
- Throws:
IllegalStateException
- if this widget has not yet been rendered.- See Also:
-
getTitleLabelBackground
When thetitleLabel
is showing andshowTitleLabelBackground
istrue
, thisDrawRect
AutoChild is created and placed behind thetitleLabel
.This component is an AutoChild named "titleLabelBackground". For an overview of how to use and configure AutoChildren, see
Using AutoChildren
.- Returns:
- Current titleLabelBackground value. Default value is null
- Throws:
IllegalStateException
- if this widget has not yet been rendered.- See Also:
-
setTitleLabelPadding
If thetitleLabelBackground
is visible, how much padding should be left between the bounds of thetitleLabel
and the edges of thetitleLabelBackground
?Note : This is an advanced setting
- Parameters:
titleLabelPadding
- New titleLabelPadding value. Default value is 2- Returns:
DrawItem
instance, for chaining setter calls- Throws:
IllegalStateException
- this property cannot be changed after the component has been created
-
getTitleLabelPadding
public int getTitleLabelPadding()If thetitleLabelBackground
is visible, how much padding should be left between the bounds of thetitleLabel
and the edges of thetitleLabelBackground
?- Returns:
- Current titleLabelPadding value. Default value is 2
-
setTitleRotationMode
public DrawItem setTitleRotationMode(TitleRotationMode titleRotationMode) throws IllegalStateException The mode in which thetitleLabel
(if shown) is rotated with this draw item.Note : This is an advanced setting
- Parameters:
titleRotationMode
- New titleRotationMode value. Default value is "neverRotate"- Returns:
DrawItem
instance, for chaining setter calls- Throws:
IllegalStateException
- this property cannot be changed after the component has been created- See Also:
-
getTitleRotationMode
The mode in which thetitleLabel
(if shown) is rotated with this draw item.- Returns:
- Current titleRotationMode value. Default value is "neverRotate"
- See Also:
-
setTranslate
Array holds two values representing translation along the x and y dimensions.Note : This is an advanced setting
- Parameters:
translate
- New translate value. Default value is null- Returns:
DrawItem
instance, for chaining setter calls- Throws:
IllegalStateException
- this property cannot be changed after the component has been created
-
getTranslate
public float[] getTranslate()Array holds two values representing translation along the x and y dimensions.- Returns:
- Current translate value. Default value is null
-
setUseSimpleTransform
If true, when a DrawItem ismoved
orresized
, the transform is applied by manipulating the shape coordinates, if possible, rather than by introducing scaling, shearing, rotation, or translation. This is only supported currently forDrawRect
,DrawOval
,DrawDiamond
,DrawImage
, andDrawLabel
, and only if no shearing is already present. Further, it's only possible to keep the transform simple if both axes are scaled by the same amount during the resize (or end up at the same scale if the DrawItem is already scaled unevenly), unless the rotation angle is a multiple of 90 degrees.For
DrawPolygon
and other shapes not based on a box (top/left/width/height), we can't safely just modify coordinates to effect a resize as we can do forDrawRect
(and similar), so resizing will normally introduce or modify the transform, potentially introducing scaling or shearing, rather than modifying coordinates. For suchDrawItem
s, we avoid trying to manipulate the coordinates, in part, because there's a danger that the floating point error may accumulate over time and warp the shape.Note : This is an advanced setting
- Parameters:
useSimpleTransform
- New useSimpleTransform value. Default value is true- Returns:
DrawItem
instance, for chaining setter calls- See Also:
-
getUseSimpleTransform
public boolean getUseSimpleTransform()If true, when a DrawItem ismoved
orresized
, the transform is applied by manipulating the shape coordinates, if possible, rather than by introducing scaling, shearing, rotation, or translation. This is only supported currently forDrawRect
,DrawOval
,DrawDiamond
,DrawImage
, andDrawLabel
, and only if no shearing is already present. Further, it's only possible to keep the transform simple if both axes are scaled by the same amount during the resize (or end up at the same scale if the DrawItem is already scaled unevenly), unless the rotation angle is a multiple of 90 degrees.For
DrawPolygon
and other shapes not based on a box (top/left/width/height), we can't safely just modify coordinates to effect a resize as we can do forDrawRect
(and similar), so resizing will normally introduce or modify the transform, potentially introducing scaling or shearing, rather than modifying coordinates. For suchDrawItem
s, we avoid trying to manipulate the coordinates, in part, because there's a danger that the floating point error may accumulate over time and warp the shape.- Returns:
- Current useSimpleTransform value. Default value is true
- See Also:
-
setXShearFactor
The slope of an x-shearing transformation applied to this DrawItem. Each point in the shape is moved along the x-axis a distance that is proportional to the initial y-coordinate of the point.Note : This is an advanced setting
- Parameters:
xShearFactor
- New xShearFactor value. Default value is 0.0- Returns:
DrawItem
instance, for chaining setter calls- Throws:
IllegalStateException
- this property cannot be changed after the component has been created
-
getXShearFactor
public double getXShearFactor()The slope of an x-shearing transformation applied to this DrawItem. Each point in the shape is moved along the x-axis a distance that is proportional to the initial y-coordinate of the point.- Returns:
- Current xShearFactor value. Default value is 0.0
-
setYShearFactor
The slope of a y-shearing transformation applied to this DrawItem. Each point in the shape is moved along the y-axis a distance that is proportional to the initial x-coordinate of the point.Note : This is an advanced setting
- Parameters:
yShearFactor
- New yShearFactor value. Default value is 0.0- Returns:
DrawItem
instance, for chaining setter calls- Throws:
IllegalStateException
- this property cannot be changed after the component has been created
-
getYShearFactor
public double getYShearFactor()The slope of a y-shearing transformation applied to this DrawItem. Each point in the shape is moved along the y-axis a distance that is proportional to the initial x-coordinate of the point.- Returns:
- Current yShearFactor value. Default value is 0.0
-
setZIndex
Relative stacking order of this draw item with respect to other items in the sameDrawPane
orDrawGroup
.null means that the zIndex has not been resolved. Upon adding this draw item to a
DrawPane
orDrawGroup
, this item's zIndex will be resolved to the next higher auto-assigned zIndex. Note that this may still be less than another item's zIndex ifbringToFront()
was called on that item.If two items within the same
DrawPane
orDrawGroup
have the same zIndex, then they are stacked in the order in which they were added to theDrawPane
orDrawGroup
.When the
DrawPane
'sdrawingType
isDrawingType.BITMAP
, zIndex,bringToFront()
, andsendToBack()
are not supported forDrawLabel
s on iOS due to platform limitations.
If this method is called after the component has been drawn/initialized: Setter forzIndex
.- Parameters:
zIndex
- newzIndex
. If null and this draw item is already in aDrawPane
orDrawGroup
, then this item's zIndex will be set to the next higher auto-assigned zIndex.Note that when setting draw items' zIndexes via this advanced API, the application should take over management of all draw items' zIndexes, and
bringToFront()
/sendToBack()
should not be used, as those APIs assume automatic management of zIndexes. Default value is null- Returns:
DrawItem
instance, for chaining setter calls- Throws:
IllegalStateException
- this property cannot be changed after the component has been created- See Also:
-
getZIndex
Relative stacking order of this draw item with respect to other items in the sameDrawPane
orDrawGroup
.null means that the zIndex has not been resolved. Upon adding this draw item to a
DrawPane
orDrawGroup
, this item's zIndex will be resolved to the next higher auto-assigned zIndex. Note that this may still be less than another item's zIndex ifbringToFront()
was called on that item.If two items within the same
DrawPane
orDrawGroup
have the same zIndex, then they are stacked in the order in which they were added to theDrawPane
orDrawGroup
.When the
DrawPane
'sdrawingType
isDrawingType.BITMAP
, zIndex,bringToFront()
, andsendToBack()
are not supported forDrawLabel
s on iOS due to platform limitations.- Returns:
- Returns the
zIndex
of this draw item. Default value is null - See Also:
-
bringToFront
public void bringToFront()Places this draw item at the top of the stacking order so that it appears in front of other draw items in the sameDrawPane
orDrawGroup
.When the
DrawPane
'sdrawingType
isDrawingType.BITMAP
,zIndex
, bringToFront(), andsendToBack()
are not supported forDrawLabel
s on iOS due to platform limitations. -
addClickHandler
Add a click handler.Notification fired when the user clicks on this DrawItem.
Note that if this item is part of a
DrawGroup
, then the group'suseGroupRect
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.- Specified by:
addClickHandler
in interfaceHasClickHandlers
- Parameters:
handler
- the click handler- Returns:
HandlerRegistration
used to remove this handler
-
dragResizeMove
IfcanDrag
is true and thecontrol knobs
include "resize" knobs, then this notification method will be fired when the user drag-resizes the draw item.- Parameters:
position
- provides which knob of theresizeKnobPoints
was draggedx
- new x-coordinate of the knoby
- new y-coordinate of the knobdX
- horizontal distance moveddY
- vertical distance moved
-
draw
public void draw()Draws this item into its currentdrawPane
.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. TheDrawPane.refreshNow()
API will force this item to be drawn immediately.- Overrides:
draw
in classBaseWidget
-
addDrawEndHandler
Add a drawEnd handler.Called when we finish drawing for this DrawItem to the
DrawItem.drawPane
's underlying HTML5 <canvas> element. Only called if theDrawingType
isDrawingType.BITMAP
.- Specified by:
addDrawEndHandler
in interfaceHasDrawEndHandlers
- Parameters:
handler
- the drawEnd handler- Returns:
HandlerRegistration
used to remove this handler
-
addDrawStartHandler
Add a drawStart handler.Called when we start drawing for this DrawItem to the
DrawItem.drawPane
's underlying HTML5 <canvas> element. Only called if theDrawingType
isDrawingType.BITMAP
.- Specified by:
addDrawStartHandler
in interfaceHasDrawStartHandlers
- Parameters:
handler
- the drawStart handler- Returns:
HandlerRegistration
used to remove this handler
-
erase
public void erase()Erase this drawItem's visual representation and remove it from its DrawGroup (if any) and DrawPane.To re-draw the item within the DrawPane, call
draw()
again, or useDrawPane.addDrawItem()
to move to another DrawGroup. -
getCenter
Returns the center point of this draw item in local coordinates. Generally this is the center of thebounding box
, but some item types may use a different point. For example,DrawTriangle
uses the incenter of the triangle.- Returns:
- the center point in local coordinates
-
getHoverHTML
IfshowHover
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 returnsprompt
- override for custom hover HTML. Note that returningnull
or an empty string will suppress the hover canvas altogether.- Returns:
- the HTML to show in the hover.
See
HTMLString
-
getPageLeft
public int getPageLeft()Returns the page-relative left coordinate of the widget on the page, in pixels.- Returns:
- global left coordinate
- See Also:
-
getPageTop
public int getPageTop()Returns the page-relative top coordinate of the widget on the page, in pixels- Returns:
- GLOBAL top coordinate
- See Also:
-
getSvgString
public void getSvgString()Generates a string containing the SVG source of this DrawItem.NOTE: The generated SVG source assumes that the default namespace is
http://www.w3.org/2000/svg
and that namespace prefixxlink
refers to namespace namehttp://www.w3.org/1999/xlink
. -
hide
public void hide()Hide this drawItem. -
hideAllKnobs
public void hideAllKnobs()Hides all control knobs for this drawItem. Updatesknobs
to remove all knobTypes and clears any drawn knobs. -
hideKnobs
Hides a set of control knobs for this drawItem. Updatesknobs
to remove the specified knobType, and clears any drawn knobs for this knobType.- Parameters:
knobType
- knobs to hide
-
hideKnobs
Hides a set of control knobs for this drawItem. Updatesknobs
to remove the specified knobType, and clears any drawn knobs for this knobType.- Parameters:
knobType
- knobs to hide
-
hover
public boolean hover()IfcanHover
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 ifshowHover
is true.- Returns:
- false to cancel the hover event.
-
isInBounds
public 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 thebounding 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.- Parameters:
x
- X coordinate of the point in the drawing coordinate system.y
- Y coordinate of the point in the drawing coordinate system.- Returns:
-
isPointInPath
public 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.- Parameters:
x
- X coordinate of the test point.y
- Y coordinate of the test point.- Returns:
-
addMouseDownHandler
Add a mouseDown 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'suseGroupRect
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.- Specified by:
addMouseDownHandler
in interfaceHasMouseDownHandlers
- Parameters:
handler
- the mouseDown handler- Returns:
HandlerRegistration
used to remove this handler
-
addMouseMoveHandler
Add a mouseMove 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'suseGroupRect
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.- Specified by:
addMouseMoveHandler
in interfaceHasMouseMoveHandlers
- Parameters:
handler
- the mouseMove handler- Returns:
HandlerRegistration
used to remove this handler
-
addMouseOutHandler
Add a mouseOut handler.Notification fired when the mouse leaves this DrawItem.
Note that if this item is part of a
DrawGroup
, then the group'suseGroupRect
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.- Specified by:
addMouseOutHandler
in interfaceHasMouseOutHandlers
- Parameters:
handler
- the mouseOut handler- Returns:
HandlerRegistration
used to remove this handler
-
addMouseOverHandler
Add a mouseOver handler.Notification fired when the mouse enters this DrawItem.
Note that if this item is part of a
DrawGroup
, then the group'suseGroupRect
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.- Specified by:
addMouseOverHandler
in interfaceHasMouseOverHandlers
- Parameters:
handler
- the mouseOver handler- Returns:
HandlerRegistration
used to remove this handler
-
addMouseUpHandler
Add a mouseUp 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'suseGroupRect
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.- Specified by:
addMouseUpHandler
in interfaceHasMouseUpHandlers
- Parameters:
handler
- the mouseUp handler- Returns:
HandlerRegistration
used to remove this handler
-
moveBy
public void moveBy(int dX, int dY) Move the shape by the specified deltas for the left and top coordinate.- Parameters:
dX
- change to left coordinate in pixelsdY
- change to top coordinate in pixels
-
addMovedHandler
Add a moved 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.- Specified by:
addMovedHandler
in interfaceHasMovedHandlers
- Parameters:
handler
- the moved handler- Returns:
HandlerRegistration
used to remove this handler
-
moveTo
Move the DrawItem to the specified coordinates in the global coordinate system. The specified coordinates will become the top-left point of theresize bounding box
.- Parameters:
left
- new left coordinate in pixelstop
- new top coordinate in pixels
-
addDragMoveHandler
Add a dragMove handler.If
DrawItem.canDrag
is true, this notification method will be fired when the user drags the draw item.- Specified by:
addDragMoveHandler
in interfaceHasDragMoveHandlers
- Parameters:
handler
- the dragMove handler- Returns:
HandlerRegistration
used to remove this handler
-
addDragResizeMoveHandler
Add a dragResizeMove handler.If
DrawItem.canDrag
is true and thecontrol knobs
include "resize" knobs then this notification method will be fired when the user drags the resize knobs of the draw item.- Specified by:
addDragResizeMoveHandler
in interfaceHasDragResizeMoveHandlers
- Parameters:
handler
- the dragResizeMove handler- Returns:
HandlerRegistration
used to remove this handler
-
addDragResizeStartHandler
Add a dragResizeStart handler.If
DrawItem.canDrag
is true and thecontrol knobs
include "resize" knobs then this notification method will be fired when the user starts to drag the resize knobs of the draw item.- Specified by:
addDragResizeStartHandler
in interfaceHasDragResizeStartHandlers
- Parameters:
handler
- the dragResizeStart handler- Returns:
HandlerRegistration
used to remove this handler
-
addDragResizeStopHandler
Add a dragResizeStop handler.If
DrawItem.canDrag
is true and thecontrol 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.- Specified by:
addDragResizeStopHandler
in interfaceHasDragResizeStopHandlers
- Parameters:
handler
- the dragResizeStop handler- Returns:
HandlerRegistration
used to remove this handler
-
addDragStartHandler
Add a dragStart handler.If
DrawItem.canDrag
is true, this notification method will be fired when the user starts to drag the draw item.- Specified by:
addDragStartHandler
in interfaceHasDragStartHandlers
- Parameters:
handler
- the dragStart handler- Returns:
HandlerRegistration
used to remove this handler
-
addDragStopHandler
Add a dragStop handler.If
DrawItem.canDrag
is true, this notification method will be fired when the user completes a drag on the draw item.- Specified by:
addDragStopHandler
in interfaceHasDragStopHandlers
- Parameters:
handler
- the dragStop handler- Returns:
HandlerRegistration
used to remove this handler
-
resizeBy
public void resizeBy(int dX, int dY) Resize the shape by the specified deltas.- Parameters:
dX
- number of pixels to resize by horizontallydY
- number of pixels to resize by vertically
-
addResizedHandler
Add a resized handler.Method called whenever a DrawItem changes size.
- Specified by:
addResizedHandler
in interfaceHasResizedHandlers
- Parameters:
handler
- the resized handler- Returns:
HandlerRegistration
used to remove this handler
-
resizeTo
Resize to the specified size- Parameters:
width
- new widthheight
- new height
-
rotateBy
public void rotateBy(double degrees) Rotate the shape by the relative rotation in degrees- Parameters:
degrees
- number of degrees to rotate from current orientation.
-
rotateTo
public void rotateTo(double degrees) Rotate the shape by the absolute rotation in degrees- Parameters:
degrees
- number of degrees to rotate
-
scaleBy
public void scaleBy(double x, double y) Scale the shape by the x, y multipliers- Parameters:
x
- scale in the x directiony
- scale in the y direction
-
scaleTo
public void scaleTo(double x, double y) Scale the shape by the x, y multipliers- Parameters:
x
- scale in the x directiony
- scale in the y direction
-
sendToBack
public void sendToBack()Places this draw item at the bottom of the stacking order so that it appears behind other draw items in the sameDrawPane
orDrawGroup
.When the
DrawPane
'sdrawingType
isDrawingType.BITMAP
,zIndex
,bringToFront()
, and sendToBack() are not supported forDrawLabel
s on iOS due to platform limitations. -
setCenterPoint
public void setCenterPoint(int left, int top) Change the center point for this DrawItem.- Parameters:
left
- X coordinate of the center point (in the global coordinate system).top
- Y coordinate of the center point (in the global coordinate system).
-
setPropertyValue
Sets a property on this DrawItem, calling the appropriate setter method if one is found and is supported.- Parameters:
propertyName
- name of the property to setnewValue
- new value for the property
-
show
public void show()Make this drawItem visible. -
showAllKnobs
public void showAllKnobs()Shows all supported control knobs for this drawItem. Updatesknobs
to include the supported knobTypes and if necessary draws out the appropriate control knobs. -
addShowContextMenuHandler
Add a showContextMenu handler.Executed when the right mouse button is clicked. The default implementation of this method auto-creates a
Menu
from theCanvas.contextMenu
property on this component and then callsMenu.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.
- Specified by:
addShowContextMenuHandler
in interfaceHasShowContextMenuHandlers
- Parameters:
handler
- the showContextMenu handler- Returns:
HandlerRegistration
used to remove this handler
-
showKnobs
Shows a set of control knobs for this drawItem. Updatesknobs
to include the specified knobType, and if necessary draws out the appropriate control knobs.- Parameters:
knobType
- knobs to show
-
showKnobs
Shows a set of control knobs for this drawItem. Updatesknobs
to include the specified knobType, and if necessary draws out the appropriate control knobs.- Parameters:
knobType
- knobs to show
-
supportsEndArrow
public boolean supportsEndArrow()Does this DrawItem supportsetEndArrow()
? For example, this is false forDrawRect
andDrawOval
, and true forDrawLine
.- Returns:
- whether setEndArrow() is supported by this DrawItem.
-
supportsStartArrow
public boolean supportsStartArrow()Does this DrawItem supportsetStartArrow()
? For example, this is false forDrawRect
andDrawOval
, and true forDrawLine
.- Returns:
- whether setStartArrow() is supported by this DrawItem.
-
setDefaultProperties
Class level method to set the default properties of this class. If set, then all existing and subsequently created instances of this class will automatically have default properties corresponding to the properties set on the SmartGWT class instance passed to this function before its underlying SmartClient JS object was created. This is a powerful feature that eliminates the need for users to create a separate hierarchy of subclasses that only alter the default properties of this class. Can also be used for skinning / styling purposes.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.
- Parameters:
drawItemProperties
- properties that should be used as new defaults when instances of this class are created- See Also:
-
getById
Retrieve a DrawItem by its globalID
.- Parameters:
ID
- global ID of the DrawItem- Returns:
- the DrawItem, or null if not found or not a DrawItem
-
getByJSObject
Retrieve a DrawItem from itsJavaScriptObject
.- Parameters:
jsObj
- SmartClient object associated with Canvas- Returns:
- the DrawItem, or null if not found or not a DrawItem
-
getRef
-
computeAngle
public static float computeAngle(double px1, double py1, double px2, double py2) Deprecated.Computes the angle in degrees from the positive X axis to the difference vectorv2 - v1 between the two given vectors.- Parameters:
px1
- X coordinate of v1py1
- Y coordinate of v1px2
- X coordinate of v2py2
- Y coordinate of v2- Returns:
- the angle in degrees, in the range [0, 360).
-
computeAngleAsDouble
public static double computeAngleAsDouble(double px1, double py1, double px2, double py2) Computes the angle in degrees from the positive X axis to the difference vectorv2 - v1 between the two given vectors.- Parameters:
px1
- X coordinate of v1py1
- Y coordinate of v1px2
- X coordinate of v2py2
- Y coordinate of v2- Returns:
- the angle in degrees, in the range [0, 360).
-
getBoundingBoxAsDouble
Returns the startPoint endPoint- Returns:
- x1, y1, x2, y2 coordinates
-
getBoundingBox
public int[] getBoundingBox()Returns the startPoint endPoint- Returns:
- x1, y1, x2, y2 coordinates
-
getResizeBoundingBoxAsDouble
Returns the bounding box of the shape reflected by theresize outline
shown when dragging theresize knobs
. This method is similar togetBoundingBoxAsDouble
except that the coordinates returned by this method are in the global coordinate system (describedhere
).- Returns:
- The x1, y1, x2, y2 coordinates. When the width and height are both positive, point (x1, y1) is the top-left point of the bounding box and point (x2, y2) is the bottom-right point of the bounding box.
- See Also:
-
getResizeBoundingBox
public int[] getResizeBoundingBox()Returns the bounding box of the shape reflected by theresize outline
shown when dragging theresize knobs
. This method is similar togetBoundingBox
except that the coordinates returned by this method are in the global coordinate system (describedhere
).- Returns:
- The x1, y1, x2, y2 coordinates. When the width and height are both positive, point (x1, y1) is the top-left point of the bounding box and point (x2, y2) is the bottom-right point of the bounding box.
- See Also:
-
setAutoChildConstructor
Sets the SmartClient constructor for the AutoChild namedautoChildName
.- Parameters:
autoChildName
- the name of the AutoChildclassName
- the SmartClient class name to use when constructing the AutoChild.- See Also:
-
setAutoChildProperties
public void setAutoChildProperties(String autoChildName, Canvas properties) throws IllegalStateException Sets the properties for creating aCanvas
AutoChild namedautoChildName
.properties
must not have already been created (properties.isCreated()
must befalse
).NOTE: Overrides at override points are not applied to AutoChildren created from
properties
; that is, if the JavaClass
ofproperties
overrides a Smart GWT override point, the custom method implementation will not be called.- Throws:
IllegalStateException
- ifproperties
has been created.- See Also:
-
setAutoChildProperties
public void setAutoChildProperties(String autoChildName, FormItem properties) throws IllegalStateException Sets the properties for creating aFormItem
AutoChild namedautoChildName
.properties
must not have already been created (properties.isCreated()
must befalse
).NOTE: Overrides at override points are not applied to AutoChildren created from
properties
; that is, if the JavaClass
ofproperties
overrides a Smart GWT override point, the custom method implementation will not be called.- Throws:
IllegalStateException
- ifproperties
has been created.- See Also:
-
setAutoChildProperties
public void setAutoChildProperties(String autoChildName, DrawItem properties) throws IllegalStateException Sets the properties for creating aDrawItem
AutoChild namedautoChildName
.properties
must not have already been created (properties.isCreated()
must befalse
).NOTE: Overrides at override points are not applied to AutoChildren created from
properties
; that is, if the JavaClass
ofproperties
overrides a Smart GWT override point, the custom method implementation will not be called.- Throws:
IllegalStateException
- ifproperties
has been created.- See Also:
-
setAutoChildProperties
public void setAutoChildProperties(String autoChildName, EditProxy properties) throws IllegalStateException Sets the properties for creating an AutoChild namedautoChildName
.properties
must not have already been created (properties.isCreated()
must befalse
).- Throws:
IllegalStateException
- ifproperties
has been created.- See Also:
-
setAutoChildVisibility
Sets whether to create and show the AutoChild namedautoChildName
.NOTE: This API is not valid for all AutoChildren because some AutoChildren cannot be hidden without destroying the main functions of the component.
- Parameters:
autoChildName
- name of an AutoChildvisible
- whether to show the AutoChild
-
getCanvasAutoChild
Returns theCanvas
AutoChild namedautoChildName
if already created.- Parameters:
autoChildName
- name of an AutoChild to return.- Throws:
RuntimeException
- if the AutoChild is not a SmartClientCanvas
object.
-
getFormItemAutoChild
Returns theFormItem
AutoChild namedautoChildName
if already created.- Parameters:
autoChildName
- name of an AutoChild to return.- Throws:
RuntimeException
- if the AutoChild is not a SmartClientFormItem
object.
-
getDrawItemAutoChild
Returns theDrawItem
AutoChild namedautoChildName
if already created.- Parameters:
autoChildName
- name of an AutoChild to return.- Throws:
RuntimeException
- if the AutoChild is not a SmartClientDrawItem
object.
-
setProportionalResizeModifiers
public void setProportionalResizeModifiers(String... proportionalResizeModifiers) throws IllegalStateException IfproportionalResizing
is set toProportionalResizeMode.MODIFIER
orProportionalResizeMode.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
isMODIFIER
and is never used ifproportionalResizing
isMODIFIER_OFF
.- Parameters:
proportionalResizeModifiers
- Default value is ["Shift"]- Throws:
IllegalStateException
- this property cannot be changed after the underlying component has been created
-
getProportionalResizeModifiers
IfproportionalResizing
is set toProportionalResizeMode.MODIFIER
orProportionalResizeMode.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
isMODIFIER
and is never used ifproportionalResizing
isMODIFIER_OFF
.- Returns:
- String...
-
setAttribute
Expose as public the setAttribute() methods of BaseWidget- Overrides:
setAttribute
in classBaseWidget
-
setAttribute
- Overrides:
setAttribute
in classBaseWidget
-
setAttribute
- Overrides:
setAttribute
in classBaseWidget
-
setAttribute
- Overrides:
setAttribute
in classBaseWidget
-
setAttribute
- Overrides:
setAttribute
in classBaseWidget
-
setAttribute
- Overrides:
setAttribute
in classBaseWidget
-
setAttribute
- Overrides:
setAttribute
in classBaseWidget
-
setAttribute
- Overrides:
setAttribute
in classBaseWidget
-
setAttribute
-
setAttribute
- Overrides:
setAttribute
in classBaseWidget
-
setAttribute
- Overrides:
setAttribute
in classBaseWidget
-
setAttribute
- Overrides:
setAttribute
in classBaseWidget
-
setAttribute
- Overrides:
setAttribute
in classBaseWidget
-
getAttributeAsString
Expose as public the getAttributeAsXXX() methods of BaseWidget- Overrides:
getAttributeAsString
in classBaseWidget
-
getAttributeAsDate
- Overrides:
getAttributeAsDate
in classBaseWidget
-
getAttributeAsInt
- Overrides:
getAttributeAsInt
in classBaseWidget
-
getAttributeAsDouble
- Overrides:
getAttributeAsDouble
in classBaseWidget
-
getAttributeAsElement
- Overrides:
getAttributeAsElement
in classBaseWidget
-
getAttributeAsJavaScriptObject
- Overrides:
getAttributeAsJavaScriptObject
in classBaseWidget
-
getAttributeAsFloat
- Overrides:
getAttributeAsFloat
in classBaseWidget
-
getAttributeAsBoolean
- Overrides:
getAttributeAsBoolean
in classBaseWidget
-
getAttributeAsMap
- Overrides:
getAttributeAsMap
in classBaseWidget
-
getUnderlyingGWTCanvas
Returns the GWT Canvas associated with this DrawItem. Throws an InvalidDrawingTypeException if theDrawingType
isn't aDrawingType.BITMAP
. -
setLogicalStructure
Setter implementing theLogicalStructure
interface, which supports Eclipse's logical structure debugging facility. -
getLogicalStructure
Getter implementing theLogicalStructure
interface, which supports Eclipse's logical structure debugging facility.- Specified by:
getLogicalStructure
in interfaceLogicalStructure
- Overrides:
getLogicalStructure
in classBaseWidget
-
GwtFloatVsDouble