Class Canvas
- All Implemented Interfaces:
HasAttachHandlers
,HasHandlers
,EventListener
,HasVisibility
,IsWidget
,LogicalStructure
,HasClearHandlers
,HasClickHandlers
,HasDoubleClickHandlers
,HasDragMoveHandlers
,HasDragRepositionMoveHandlers
,HasDragRepositionStartHandlers
,HasDragRepositionStopHandlers
,HasDragResizeMoveHandlers
,HasDragResizeStartHandlers
,HasDragResizeStopHandlers
,HasDragStartHandlers
,HasDragStopHandlers
,HasDropHandlers
,HasDropMoveHandlers
,HasDropOutHandlers
,HasDropOverHandlers
,HasFocusChangedHandlers
,HasHoverHandlers
,HasHoverHiddenHandlers
,HasKeyDownHandlers
,HasKeyPressHandlers
,HasMouseDownHandlers
,HasMouseMoveHandlers
,HasMouseOutHandlers
,HasMouseOverHandlers
,HasMouseStillDownHandlers
,HasMouseUpHandlers
,HasMouseWheelHandlers
,HasMovedHandlers
,HasParentMovedHandlers
,HasResizedHandlers
,HasRightMouseDownHandlers
,HasRuleContextChangedHandlers
,HasScrolledHandlers
,HasShowContextMenuHandlers
,HasVisibilityChangedHandlers
- Direct Known Subclasses:
AceEditor
,BrowserPlugin
,Calendar
,DetailViewer
,DrawKnob
,DrawPane
,DynamicForm
,EdgedCanvas
,EditPane
,GridRenderer
,HTMLFlow
,Layout
,LayoutSpacer
,PrintCanvas
,RangeSlider
,RowRangeDisplay
,Slider
,StatefulCanvas
,TabSet
,TileLayout
,WidgetCanvas
FormItems
). Canvas provides:
- basic visual lifecycle support - creation and destruction of HTML via
draw()
andclear()
, visibility viashow()
andhide()
, z-layering viabringToFront()
andsendToBack()
. - consistent cross-browser
positioning
,sizing
andsize detection
, with automatic compensation forbrowser CSS behavior differences
. - clipping, scrolling and overflow management of content via
overflow
- consistent cross-browser
key
andmouse
events, includingmapping touch events
to mouse events - built-in drag and drop
capabilities including
moving
,resizing
,drag scrolling
andsnap-to-grid
behavior. - the ability to either contain
HTML content
orcontain other Canvases
, includingan edge-based positioning
andpercent sizing system
for children. For more advanced layout capabilities, seeLayout
. - various other details like
cursors
,modal masking
,animation
,accessibility properties
, andsettings
forautomated testing
.
-
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 TypeMethodDescriptionvoid
Adds newChild as a child of this widget, set up a named object reference (i.e., this[name]) to the new widget if name argument is provided, and draw the child if this widget has been drawn already.Adds newChild as a child of this widget, set up a named object reference (i.e., this[name]) to the new widget if name argument is provided, and draw the child if this widget has been drawn already.Adds newChild as a child of this widget, set up a named object reference (i.e., this[name]) to the new widget if name argument is provided, and draw the child if this widget has been drawn already.Adds newChild as a child of this widget, set up a named object reference (i.e., this[name]) to the new widget if name argument is provided, and draw the child if this widget has been drawn already.addClearHandler
(ClearHandler handler) Add a clear handler.addClickHandler
(ClickHandler handler) Add a click handler.addDoubleClickHandler
(DoubleClickHandler handler) Add a doubleClick handler.addDragMoveHandler
(DragMoveHandler handler) Add a dragMove handler.Add a dragRepositionMove handler.Add a dragRepositionStart handler.Add a dragRepositionStop 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.addDropHandler
(DropHandler handler) Add a drop handler.addDropMoveHandler
(DropMoveHandler handler) Add a dropMove handler.addDropOutHandler
(DropOutHandler handler) Add a dropOut handler.addDropOverHandler
(DropOverHandler handler) Add a dropOver handler.Add a focusChanged handler.addHoverHandler
(HoverHandler handler) Add a hover handler.addHoverHiddenHandler
(HoverHiddenHandler handler) Add a hoverHidden handler.addKeyDownHandler
(KeyDownHandler handler) Add a keyDown handler.addKeyPressHandler
(KeyPressHandler handler) Add a keyPress 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.Add a mouseStillDown handler.addMouseUpHandler
(MouseUpHandler handler) Add a mouseUp handler.addMouseWheelHandler
(MouseWheelHandler handler) Add a mouseWheel handler.addMovedHandler
(MovedHandler handler) Add a moved handler.addParentMovedHandler
(ParentMovedHandler handler) Add a parentMoved handler.Adds newPeer as a peer of this widget (also making it a child of this widget's parent, if any), set up a named object reference (i.e., this[name]) to the new widget if name is provided, and draw the peer if this widget has been drawn already.Adds newPeer as a peer of this widget (also making it a child of this widget's parent, if any), set up a named object reference (i.e., this[name]) to the new widget if name is provided, and draw the peer if this widget has been drawn already.addResizedHandler
(ResizedHandler handler) Add a resized handler.Add a rightMouseDown handler.Add a ruleContextChanged handler.addScrolledHandler
(ScrolledHandler handler) Add a scrolled handler.Add a showContextMenu handler.void
addSnapAlignCandidate
(Canvas newCandidate) Add a candidate tosnapAlignCandidates
.void
addStyleName
(String style) Multiple styles are currently not supported.Add a visibilityChanged handler.void
adjustForContent
(boolean immediate) This method tells a component to adjust for changes in the size of its content that happen outside of Smart GWT APIs.void
animateFade
(int opacity) Animate a change in opacity from the widget's current opacity to the specified opacity.void
animateFade
(int opacity, AnimationCallback callback) Animate a change in opacity from the widget's current opacity to the specified opacity.void
animateFade
(int opacity, AnimationCallback callback, int duration) Animate a change in opacity from the widget's current opacity to the specified opacity.void
animateFade
(int opacity, AnimationCallback callback, int duration, AnimationAcceleration acceleration) Animate a change in opacity from the widget's current opacity to the specified opacity.void
animateFade
(Integer opacity) Animate a change in opacity from the widget's current opacity to the specified opacity.void
animateFade
(Integer opacity, AnimationCallback callback) void
animateFade
(Integer opacity, AnimationCallback callback, Integer duration) void
animateFade
(Integer opacity, AnimationCallback callback, Integer duration, AnimationAcceleration acceleration) Animate a change in opacity from the widget's current opacity to the specified opacity.void
Hide a canvas by shrinking it with default effect specified byanimateHideEffect
.void
animateHide
(AnimationEffect effect) Hide a canvas by shrinking it vertically to zero height over a period of time.void
animateHide
(AnimationEffect effect, AnimationCallback callback) Hide a canvas by shrinking it vertically to zero height over a period of time.void
animateHide
(AnimationEffect effect, AnimationCallback callback, int duration) Hide a canvas by shrinking it vertically to zero height over a period of time.void
animateHide
(AnimateShowEffect effect) Hide a canvas by shrinking it vertically to zero height over a period of time.void
animateHide
(AnimateShowEffect effect, AnimationCallback callback) Hide a canvas by shrinking it vertically to zero height over a period of time.void
animateHide
(AnimateShowEffect effect, AnimationCallback callback, int duration) Hide a canvas by shrinking it vertically to zero height over a period of time.void
animateMove
(Integer left, Integer top) Animate a reposition of this canvas from its current position to the specified positionvoid
animateMove
(Integer left, Integer top, AnimationCallback callback) void
animateMove
(Integer left, Integer top, AnimationCallback callback, Integer duration) void
animateMove
(Integer left, Integer top, AnimationCallback callback, Integer duration, AnimationAcceleration acceleration) Animate a reposition of this canvas from its current position to the specified positionvoid
animateRect
(Integer left, Integer top, Integer width, Integer height) Animate a reposition / resize of this canvas from its current size and position.void
animateRect
(Integer left, Integer top, Integer width, Integer height, AnimationCallback callback) void
animateRect
(Integer left, Integer top, Integer width, Integer height, AnimationCallback callback, Integer duration) void
animateRect
(Integer left, Integer top, Integer width, Integer height, AnimationCallback callback, Integer duration, AnimationAcceleration acceleration) Animate a reposition / resize of this canvas from its current size and position.void
animateResize
(Integer width, Integer height) Animate a resize of this canvas from its current size to the specified sizevoid
animateResize
(Integer width, Integer height, AnimationCallback callback) void
animateResize
(Integer width, Integer height, AnimationCallback callback, Integer duration) void
animateResize
(Integer width, Integer height, AnimationCallback callback, Integer duration, AnimationAcceleration acceleration) Animate a resize of this canvas from its current size to the specified sizevoid
animateScroll
(int scrollLeft, int scrollTop, AnimationCallback callback) Animate a scroll from the current scroll position to the specified position.void
animateScroll
(int scrollLeft, int scrollTop, AnimationCallback callback, int duration) Animate a scroll from the current scroll position to the specified position.void
animateScroll
(Integer scrollLeft, Integer scrollTop) Animate a scroll from the current scroll position to the specified position.void
animateScroll
(Integer scrollLeft, Integer scrollTop, AnimationCallback callback) void
animateScroll
(Integer scrollLeft, Integer scrollTop, AnimationCallback callback, Integer duration) void
animateScroll
(Integer scrollLeft, Integer scrollTop, AnimationCallback callback, Integer duration, AnimationAcceleration acceleration) Animate a scroll from the current scroll position to the specified position.void
Show a canvas by growing it with default effect specified byanimateShowEffect
.void
animateShow
(AnimationEffect effect) Show a canvas by growing it vertically to its fully drawn height over a period of time.void
animateShow
(AnimationEffect effect, AnimationCallback callback) Show a canvas by growing it vertically to its fully drawn height over a period of time.void
animateShow
(AnimationEffect effect, AnimationCallback callback, int duration) Show a canvas by growing it vertically to its fully drawn height over a period of time.void
animateShow
(AnimateShowEffect effect) Show a canvas by growing it vertically to its fully drawn height over a period of time.void
animateShow
(AnimateShowEffect effect, AnimationCallback callback) Show a canvas by growing it vertically to its fully drawn height over a period of time.void
animateShow
(AnimateShowEffect effect, AnimationCallback callback, int duration) Show a canvas by growing it vertically to its fully drawn height over a period of time.static <T extends Canvas>
TasSGWTComponent
(JavaScriptObject jsObj) Returns the existing SGWT widget, or creates and returns one if none exist, associated with the suppliedJavaScriptObject
.void
blur()
If this canvas has keyboard focus, blur it.void
Puts this widget at the top of the stacking order, so it appears in front of all other widgets in the same parent.static void
changeAutoChildDefaults
(String autoChildName, Canvas defaults) Changes the defaults for Canvas AutoChildren namedautoChildName
.static void
changeAutoChildDefaults
(String autoChildName, FormItem defaults) Changes the defaults for FormItem AutoChildren namedautoChildName
.void
clear()
Remove all visual representation of a Canvas, including all child or member Canvases, or managed top-level components such as the ListGrid drop location indicator.void
If an explicittabIndex
was assigned to this widget, clear it.Determines whether a clickmask is showingclickMaskUp
(String ID) Determines whether a clickmask is showingReturns true if element is a descendant of this widget (i.e., exists below this widget in the containment hierarchy); and false otherwise.Returns true if element is a descendant of this widget (i.e., exists below this widget in the containment hierarchy); and false otherwise.Return true if the last event's mouse coordinates are within the bounds of this component.Returns true if the currentmouse event target
is this component or a descendent of this component.Returns true if the keyboard focus is in this Canvas or any child of this Canvas.containsPoint
(int x, int y) Return whether or not this object contains the specified global (x,y) coordinates.containsPoint
(int x, int y, Boolean withinViewport) Return whether or not this object contains the specified global (x,y) coordinates.protected JavaScriptObject
create()
void
Notification method fired whenDataContext
is bound.void
deparent()
Remove this canvas from its parent if it has one.void
depeer()
Make this Canvas no longer a peer of its mastervoid
disable()
Disables this widget and any children and peers of this widget.void
enable()
Enables this widget and any children / peers of this widget.Returns true if the rectangle of this widget encloses the rectangle of the specified widget.void
focus()
If this canvas can accept focus, give it keyboard focus.void
Shifts focus to the next focusable element after this one, skipping any elements nested inside the tabbing group for this canvas, such as focusable children.void
focusAtEnd
(boolean start) Shifts focus to the start or end of this canvas and its descendants.void
Shifts focus to the next focusable element after this one.void
Shifts focus to the previous focusable element before this one.int
This method is similar togetPageLeft()
.int
This method is similar togetPageTop()
.If specified this governs the HTML accessKey for the widget.If multiple widgets in the same Layout haveadaptive width
,adaptiveWidthPriority
can be set to indicate which of the components should be given priority access to space.Should focus navigation for this canvas and its descendents be handled explicitly by intercepting "Tab" key events and calling theTabIndexManager.shiftFocus()
API?Should this browser always show custom scrollbars ifshowCustomScrollbars
is true?Default acceleration effect to apply to all animations on this Canvas.Default time for performing an animated fade.Default acceleration function for performing an animated hide.Default animation effect to use ifanimateHide()
is called without an explicit effect parameter.Default time for performing an animated hide.Default acceleration effect for performing an animated move.Default time for performing an animated move.Default acceleration function for performing an animated move and resize.Default time for performing an animated setRect.Default acceleration function for performing an animated resize.When to update thechild layout
for asize animation
.Default time for performing an animated resize.Default acceleration function for performing an animated scroll.Default time for performing an animated scroll.Default acceleration function for performing an animated show.Default animation effect to use ifanimateShow()
is called without an explicit effect parameter.Default time for performing an animated show.int
Default total duration of animations.Default directory for app-specific images, relative to the Page-wideappImgDir
.Returns the DOM ID for the main element for this canvas which will have ARIArole
andattributes
applied to it.ARIA role of this component.Retrieves dynamically calculated default ARIA state properties for this canvas.Deprecated.This initialization property allows developers to create a canvas using the Class.addAutoChild() method, and have it added as a child to some other component.If adataContext
is provided, should subcomponents automatically bind to the data?If set to true, the widget's parent (if any) will automatically be shown whenever the widget is shown.The background color for this widget.URL for a background image for this widget (corresponding to the CSS "background-image" attribute).Specifies how the background image should be positioned on the widget.Specifies how the background image should be tiled if this widget is larger than the image.Set the CSS border of this component, as a CSS string including border-width, border-style, and/or color (eg "2px solid blue").The CSS border-radius for this widget.int
Return the bottom coordinate of this object as rendered, relative to its enclosing context, in pixels.static Canvas
Retrieve a Canvas by its globalID
.static Canvas
getByJSObject
(JavaScriptObject jsObj) Retrieve a Canvas from itsJavaScriptObject
.getByLocalId
(String ID) Retrieve a child of this Canvas by it's local ID.Indicates that this object can receive dropped widgets (i.e.SeecanAdaptWidth
.Indicates that this component is able to render itself at multiple possible sizes, in order to fit into less space when very little space is available, or to display more information or provide more immediate access to functionality when more space is available.Indicates whether this widget can initiate custom drag-and-drop operations (other than reposition or resize).Indicates whether this widget can be moved by a user of your application by simply dragging with the mouse.Indicates whether this widget can be resized by dragging on the edges and/or corners of the widget with the mouse.boolean
If this Canvas is canAcceptDrop:true, when the user drags a droppable widget over an edge of the widget, should we scroll to show the rest of the widget's content? Returned from canvas.shouldDragScroll() if there are scrollbars.Indicates that this object can be dropped on top of other widgets.When explicitly set to false, disallows drop before this member in the Layout.Can this widget be allowed to become the target of keyboard events?Will this Canvas fire hover events when the user hovers over it, or one of its children?Whether native drag selection of contained text is allowed within this Canvas.final Canvas
getCanvasAutoChild
(String autoChildName) Returns theCanvas
AutoChild namedautoChildName
if already created.If this canvas is being displayed in aCanvasItem
, this property will be set to point at the item.Canvas[]
Array of all Canvii that are immediate children of this Canvas.Flag to disable snapping to alignment when children of this Canvas are resizedIf enabled whilechildrenSnapToGrid
is enabled, children dragged within this Canvas will also snap to positions where their edges or center lines would be aligned with the edges or centers of other components, and lines will be shown to point out the possible alignment (with appearance controlled bysnapAlignCenterLineStyle
andsnapAlignEdgeLineStyle
respectively.SeechildrenSnapAlign
.SeechildrenSnapAlign
.If true, causes this canvas's children to snap to its grid when resizing.If true, causes this canvas's children to snap to its grid when dragging.getChildTabPosition
(Canvas child) For a given child widget whereupdateTabPositionOnReparent
is true, return the expected tab position within this parent.Returns the JavaScript class name.Automatically generated mask canvas displayed whenshowComponentMask()
is called.Defaults for thecomponentMask
autoChild.Returns the DOM element for this Canvas which contains thecontents
, or forparent components
, the DOM elements for any drawn children.The contents of a canvas or label widget.Context menu to show for this object, an instance of the Menu widget.Whether the Framework should correct for erroneous scrollHeight and scrollWidth values reported by the browser when zoomed (via browser or OS-level zoom) by allowingmaxZoomOverflowError
of overflow before enabling scrolling and displaying custom scrollbars.Specifies the css cursor image to display when the mouse pointer is over this component.A mapping fromDataSource
IDs to specificRecords
from those DataSources, thatDataBoundComponents
contained within this Canvas should automatically bind to if a DataSource is provided but data is not provided (directly or indirectly, for example, indirectly via settingListGrid.autoFetchData
.A dataPath may be specified on any canvas.int
For custom components, establishes a default height for the component.int
For custom components, establishes a default width for the component.This attribute denotes the name of a property to use as agetDefiningPropertyName()
for this property when generating and resolvingAutoTest locators with search segments
.String[]
If no explicitdefiningProperty
was specified for this component, this array denotes a list of options to use as adefining property
when generating and resolvingAutoTest locators with search segments
.If this property is set totrue
, thedestroy()
method has been called on this canvas.This property is set to true when thedestroy()
method is called on a widget.boolean
If set to true, the widget will be disabled.Specifies the cursor image to display when the mouse pointer is over this widget if this widget is disabled.DisablesuseTouchScrolling
whenever a built-in drag operation has been enabled which is known to be non-functional if touch scrolling is enabled.int
Amount of time (in milliseconds) between which two clicks are considered a single clickVisual appearance to show when the object is being dragged.This indicates how the system will test for droppable targets: either by intersection with the mouse or intersection with the rectangle of the dragMoveTarget.This property controls what kind of mask is used in caseuseDragMask
is enabled.int
Sets maximum height that this Canvas can be resized to by a user.int
Maximum width that this Canvas can be resized to by a user.int
Minimum height that this Canvas can be resized to by a user.int
Minimum width that this Canvas can be resized to by a user.If this widget has dragAppearance"target"
, this value specifies the opacity to render the target while it is being dragged.IfcanDragReposition
is true, this attribute specifies the visual appearance to show during drag reposition.Cursor to switch to if the mouse is over a widget that is drag repositionable.IfcanDragResize
is true, this attribute specifies the visual appearance to show during drag resize.int
If this widget supports drag-scrolling, This property specifies how many ms the user must hover over the drag-scroll threshold before scrolling begins.int
Number of pixels the cursor needs to move before the EventHandler starts a drag operation.A different widget that should be actually dragged when dragging initiates on this widget.A different widget that should be actually dragged when dragging initiates on this widget.Sets adragType
for this widget used, to be compared todropTypes
on possible drop target widgets.Delegates a different widget that should actually be dropped on if the cursor is over this widget when the drop completes.Delegates a different widget that should actually be dropped on if the cursor is over this widget when the drop completes.String[]
When a drag and drop interaction occurs, if adragType
is configured on the source widget, it is compared to thedropTypes
configured on the target widget, and a drop is only allowed if thedragType
is listed in the target widget'sdropTypes
array.When a drag and drop interaction occurs, if adragType
is configured on the source widget, it is compared to thedropTypes
configured on the target widget, and a drop is only allowed if thedragType
is listed in the target widget'sdropTypes
array.Dynamic contents allows the contents string to be treated as a simple but powerful template.Background color for the EdgedCanvas created to decorate this component.Background color for the center section only.Base name of images for edges.int
How far into the edge of an object do we consider the "edge" for drag resize purposes?Amount the contained Canvas should be offset.Opacity of the edges.Whether to show media in the center section, that is, behind the decorated Canvas.int
Size in pixels for corners and edgesAnEditProxy
controls the behaviors of a component when it is placed intoediting mode
.Default class used to construct theEditProxy
for this component when the component isfirst placed into edit mode
.Normal usage of SmartGWT is to call draw() on SmartGWT widgets, not to use use RootPanel.add().getElement
(boolean allowPreRender) Criteria to be evaluated to determine whether this Canvas should be enabled.Whether this canvas should end the line it's in when used as a tile in aFlowLayout
.static EdgeName
Check if an event is within an "edge" of this canvas.static EdgeName
getEventEdge
(EdgeName... edgeMask) Check if an event is within an "edge" of this canvas.int
When this Canvas is included as a member in a Layout, extra blank space that should be left after this member in a Layout.boolean
IfshowCustomScrollbars
is true, should the scrollbars be drawn floating over the component handle, or should the handle shrink to accommodate them?final FormItem
getFormItemAutoChild
(String autoChildName) Returns theFormItem
AutoChild namedautoChildName
if already created.If true, events sent to the SVG inside an object tag are forwarded to the object itself by Framework handlers.Returns a fully qualifiedDataPath
for this canvas.Sets the style for the grouping frame around the canvas.If set, the background color of the grouping label.Sets the style for the grouping label.Padding to apply inside the border when this canvas is showing a groupborder and label
.The title/label for the grouping.Thecanvas.width
attribute specifies the size for a component's horizontal dimension;canvas.height
specifies the size for the vertical dimension.boolean
When this widget is hidden (seevisibility
andhide()
), should display:none be applied to theouter element
?Ifthis.showHover
is true, this property can be used to customize the alignment of content in the hover canvas.Ifthis.showHover
is true andgetHoverComponent()
is implemented, should the hoverCanvas returned from it be automatically destroyed when it is hidden?int
Maximum auto-fit width for a hover ifhoverAutoFitWidth
is enabled.Maximum auto-fit width for a hover ifhoverAutoFitWidth
is enabled.ifshowHover
is true, this property will cause the specifiedhoverWidth
to be treated as a minimum width for the hover.WhenshowHoverComponents
is true, this method is called to get the component to show as a hover for this Canvas.int
Ifthis.canHover
is true, how long should the mouse be kept over this widget before the hover event is firedFor canvasesshowing a hover
, this attribute gives users a way to pin the hover in place so they can interact with it (scroll it, click embedded links, etc).Ifthis.showHover
is true, this property can be used to customize the height of the hover canvas shown.Ifthis.showHover
is true, when the user holds the mouse over this Canvas for long enough to trigger a hover event, a hover canvas is shown by default.Ifthis.showHover
is true, should this widget's hover canvas be moved with the mouse while visible?Ifthis.showHover
is true, should the hover canvas be shown with opacity other than 100?Allows interaction with hovers when the cursor is positioned over them.Screen to create (viacreateScreen()
) in lieu of callinggetHoverComponent()
.Ifthis.showHover
is true, this property can be used to specify the css style to apply to the hover canvas.Ifthis.showHover
is true, this property can be used to customize the vertical alignment of content in the hover canvas.int
Ifthis.showHover
is true, this property can be used to customize the width of the hover canvas shown.Ifthis.showHover
is true, this property can be used to customize the whether content in the hover canvas is displayed in a single line, or wraps.int
getHSnapPosition
(int coordinate) Override this method to provide a custom snap-to grid.int
getHSnapPosition
(int coordinate, String direction) Override this method to provide a custom snap-to grid.If specified as a pointer to an HTML element present in the DOM, this canvas will be rendered inside that element ondraw()
.If specified as a pointer to an HTML element present in the DOM, this canvas will be rendered inside that element ondraw()
.IfhtmlElement
is specified, this attribute specifies the position where the canvas should be inserted relative to thehtmlElement
in the DOM.Retrieve a native image, SVG object element or the container for an SVG symbol or font-icon, by name.static String
Return the full URL for an image to be drawn in this canvas.static String
Return the full URL for an image to be drawn in this canvas.int
Returns the amount of space available for interior content (or relatively positioned child widget(s)) without introducing clipping, scrolling or overflow.
This is the space within the viewport of the widget (not including padding, and excluding margins, borders or scrollbars) rendered at its specified size.int
Returns the amount of space available for interior content (or relatively positioned child widget(s)) without introducing clipping, scrolling or overflow.
This is the space within the viewport of the widget (not including padding, and excluding margins, borders or scrollbars) rendered at its specified size.int
Returns the amount of space available for (an) absolutely positioned child widget(s) or absolutely positioned HTML content, without introducing clipping, scrolling or overflow.int
Returns the amount of space available for absolutely positioned child widget(s) or absolutely positioned HTML content, without introducing clipping, scrolling or overflow.boolean
Should a grouping frame be shown around this canvas if a non-empty string has been specified forgroupTitle
.This boolean flag will be set to true by framework logic while generating print HTML for this widget as a result to a call toshowPrintPreview()
(or justgetPrintHTML()
).Marks this Canvas as theruleScope
that will be discovered by any containedDataBoundComponent
s which do not specify an explicitruleScope
.Flag to disable snapping to alignment against this Canvas when other Canvases dragged into the same parent whenchildrenSnapAlign
is enabled on this Canvas' parent.Constrains drag-resizing and drag-repositioning of this canvas to either the rect of its parent (if set to true) or an arbitrary rect based on its parent (if set to a [Left,Top,Width,Height] rect array).When this Canvas is included as a member in a Layout, layoutAlign controls alignment on the breadth axis of the layout.When showing this widget in agroup
, should any content be shifted down so that the group-label doesn't sit in front of it?If set, overrides the globaldefaultPageSpace
.int
getLeft()
Number of pixels the left side of the widget is offset to the right from its default drawing context (either its parent's topleft corner, or the document flow, depending on the value of theposition
property).Number of pixels the left side of the widget is offset to the right from its default drawing context (either its parent's topleft corner, or the document flow, depending on the value of theposition
property).Retrieve the local ID of this canvas.boolean
Iftrue
, when retrieving alocator
for this component always return a reference directly to this component bywidget ID
, using the compact format"///canvasID"
, ignoring any parent elements and ignoring any configuredtestRoot
.Strategy to use when locating children in this canvas from an autoTest locator string.LocatorTypeStrategy
to use when finding children within this canvas.Strategy to use when locating peers of this canvas from an autoTest locator string.LocatorTypeStrategy
to use when finding peers of this canvas.Local name for referencing this canvas from an autoTest locator string.Getter implementing theLogicalStructure
interface, which supports Eclipse's logical structure debugging facility.Set the CSS Margin, in pixels, for this component.Returns this canvas's "master" (the canvas to which it was added as a peer), if any.Deprecated.In favor orgetMasterCanvas()
as of Smart GWT release 9.1IfhtmlElement
is specified, should this canvas be drawn at the same dimensions as the htmlElement?
See alsomatchElementWidth
andmatchElementHeight
For canvases with a specifiedhtmlElement
wherepersistentMatchElement
is set to true, how should the canvas match the element's height?For canvases with a specifiedhtmlElement
wherepersistentMatchElement
is set to true, how should the canvas match the element's width?int
Maximum height available to this Canvas.int
Maximum width available to this Canvas.int
WhencorrectZoomOverflow
is true and browser or OS-level zoom is active, determines how much overflow must occur before the Framework enables scrolling for this canvas.Default class used to construct menus created by this component, including context menus.int
Minimum height available to this Canvas.int
If the widget has drag resize configured on one or more of it's edges, and the edgeMarginSize is large enough that the remaining space is less thanminNonEdgeSize
, the edgeMarginSize will be reduced such that the non-edge part of the widget is at least 1/3 of the total space (with two draggable edges) or half of it (with one draggable edge).int
Minimum width available to this Canvas.double
The minimum speed in pixels per second that must be reached for momentum scrolling to kick in.int
Amount of time (in milliseconds) between repeated 'mouseStillDown' events for this canvas.int
Amount of time (in milliseconds) before mouseStillDown events start to be fired repeatedly for this canvas.getName()
Optional name for the canvas, which can later be used to reference it.In some platform/browser configurations, scrollable regions do not show visible scrollbars until the user attempts to interact with the region.int
get the next zIndex for the next item to be drawn.If true, this canvas will receive all mouse-clicks as singleclick
events rather than asdoubleClick
events.Specifies the cursor image to display when the user drags a droppable canvas over this if it is not a valid drop target for the event andshowNoDropIndicator
is true.int
int
int
Return the X-coordinate of the last event relative to the left edge of the content of this Canvas.
NOTE: To get a coordinate relative to the viewport of this Canvas, subtract this.getScrollLeft()int
Return the Y-coordinate of the last event, relative to the top edge of the content of this Canvas.
NOTE: To get a coordinate relative to the viewport of this Canvas, subtract this.getScrollTop()Renders the widget to be partly transparent.static Canvas
getOrCreateRef
(JavaScriptObject jsObj) Returns the outer DOM element of this Canvas.Controls what happens when the drawn size of the content of a Canvas is either greater or smaller than the specified size of the Canvas.Set the CSS padding of this component, in pixels.int
Return the page-relative bottom coordinate of this object, in pixels.int
Returns the page-relative left coordinate of the widget on the page, in pixels.int
Return the page-relative right coordinate of this object, 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
.Returns this Canvas's "panel container".This Canvas's immediate parent, if any.Deprecated.As of Smartclient version 9.1, deprecated in favor ofparentCanvas
andgetParentCanvas()
Canvas[]
getPeers()
Array of all Canvii that are peers of this Canvas.CSS class used to apply additional styles to this canvas whenshowPendingMarker()
is called, or whenpendingMarkerVisible
has been set.This attribute indicates whether thepending marker class
should be appended to the list of CSS classes applied to this canvas.Governs the model to be used when sizing canvases with percentage width or height, or positioning widgets with a specifiedsnapTo
.If this canvas has its size specified as a percentage, this property allows the user to explicitly designate another canvas upon which sizing will be based.If this canvas has a specifiedhtmlElement
andmatchElement
is set to true, should the canvas perform a one time resize to fit the target element on draw, or should it continue to match the target element as its size changes due to page reflows?Detail settings of thepointer
such as where it should be located along the outside of the canvas.This property in conjunction with thepointerSettings.snapTo
places the canvas in relation to the target canvas.This property in conjunction with thepointerSettings.snapTo
places the canvas in relation to the target canvas.Absolute or relative, corresponding to the "absolute" (with respect to parent) or "relative" (with respect to document flow) values for the CSS position attribute.Should this canvas print its children absolutely positioned when generatingprintable HTML
.getPrintHTML
(PrintProperties printProperties, PrintHTMLCallback callback) Retrieves printable HTML for this component and all printable subcomponents.static void
getPrintHTML
(Object[] components, PrintProperties printProperties, PrintHTMLCallback callback) Returns print-formatted HTML for the specified list of components.The CSS class to apply when printing this widget.Prompt displayed in hover canvas ifshowHover
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.IfcanDragResize
is true, this property specifies the conditions for when proportional resizing is used.boolean
Whether this canvas should receiveevents
from its scrollbars, which arepeers
.getRect()
Get all four coordinates, relative to the enclosing context, at one.Should this element be redrawn in response to a resize?When this Canvas is included as a member in a Layout, andshowResizeBar
is set totrue
so that a resizeBar is created,resizeBarTarget:"next"
can be set to indicate that the resizeBar should resize the next member of the layout rather than this one.EdgeName[]
When drag resizing is enabled viacanDragResize
, restricts resizes to only certain edges or corners.int
getRight()
Return the right coordinate of this object as rendered, relative to its enclosing context, in pixels.Get the current value of the rule context collected by theruleScope
of this component (which may be this component itself or whatever component is managing theruleScope
for this component).getRuleContext
(boolean databoundOnly) Get the current value of the rule context collected by theruleScope
of this component (which may be this component itself or whatever component is managing theruleScope
for this component).ID
of the component that gathers the context for evaluation of criteria-based rules specified by properties such asFormItem.visibleWhen
, Dynamic Properties, andDynamicCriteria
such asListGrid.initialCriteria
.int
How thick should we make the scrollbars for this canvas.int
Returns the scrollTop required to scroll vertically to the end of this widget's content.int
Returns the scrollable height of the widget's contents, including children, ignoring clipping.int
Get the number of pixels this Canvas is scrolled from its left edge.int
Returns the scrollLeft required to scroll horizontally to the end of this widget's content.int
Get the number of pixels this Canvas is scrolled from its top edge.int
Returns the scrollable width of the widget's contents, including children, ignoring clipping.Color for the css-based drop shadow shown ifuseCSSShadow
is true andshowShadow
is true.int
Depth of the shadow, or the virtual height above the page of the widget throwing the shadow.Horizontal offset for theshadow
.IfuseCSSShadow
is false, (or for browsers that do not support css3), this property supplies the base name of the series of images for the sides, corners, and center of the shadow.Offset of the shadow.Softness, or degree of blurring, of the shadow.Explicit spread for the css-based drop shadow shown ifuseCSSShadow
is true andshowShadow
is true.Vertical offset for theshadow
.Whether this canvas should be included in a printable view.boolean
Whether to use the browser's native scrollbars or Smart GWT-based scrollbars.When this widget is dragged, if its dragAppearance is"target"
, should we show a shadow behind the canvas during the drag.Whether anEdgedCanvas
should be used to show image-based edges around this component.Ifthis.canHover
is true, should we show the global hover canvas by default when the user hovers over this canvas?When set to true, shows a widget hovering at the mouse point instead of the builtin hover label.Should a pointer be shown? A pointer can be placed on the border to identify the target of the canvas contents.When this Canvas is included as a member in aLayout
, whether a resizeBar should be shown after this member in the layout, to allow it to be resized.Whether to show a drop shadow for this Canvas.Whether to show a snap grid for this Canvas.boolean
This is an advanced setting.Is it possible that a call toredraw()
on this widget will change its size?Default directory for skin images (those defined by the class), relative to the Page-wideskinDir
.Canvas[]
WhenchildrenSnapAlign
is enabled, list of candidates to check for alignment.CSS border declaration used for the line shown to indicate snapping to a center line whenchildrenSnapAlign
is set.CSS border declaration used for the line shown to indicate snapping to a edge line whenchildrenSnapAlign
is set.Describes which axes to apply snap-to-grid to.IfsnapTo
is defined to this widget, this property can be used to define which edge of this widget should be snapped to an edge of the master or parent element.Specifies line styling to use when drawing the grid of lines forSnapGridStyle
: "lines".Specifies indication style to use for snap points, either a grid of lines or an array of crosses.The horizontal snap direction.int
The horizontal grid size to use, in pixels, when snap-to-grid is enabled.IfsnapTo
is defined for this widget, this property can be used to specify an offset in px or percentage for the left coordinate of this widget.IfsnapTo
is defined for this widget, this property can be used to specify an offset in px or percentage for the top coordinate of this widget.When this canvas is dropped onto an object supporting snap-to-grid, should it snap to the grid (true, the default) or just drop wherever the mouse is (false).static Point
getSnapPosition
(Canvas target, String snapTo, Canvas snapper) Return the position forsnapper
to be placed in order to "snap to" an edge or corner oftarget
, in the same sense assnapTo
.static Point
getSnapPosition
(Canvas target, String snapTo, Canvas snapper, String snapEdge) Return the position forsnapper
to be placed in order to "snap to" an edge or corner oftarget
, in the same sense assnapTo
.Flag to disable snapping to alignment when this Canvas is resized.Causes this canvas to snap to its parent's grid when resizing.Position this widget such that it is aligned with ("snapped to") an edge of itsmaster
(if specified), or itsparent canvas
.Flag to disable snapping to alignment when this Canvas is dragged whenchildrenSnapAlign
is enabled on this Canvas' parent.Flag to disable snapping to center alignment when this Canvas is dragged whenchildrenSnapAlign
is enabled on this Canvas' parent.Flag to disable snapping to edge alignment when this Canvas is dragged whenchildrenSnapAlign
is enabled on this Canvas' parent.Causes this canvas to snap to its parent's grid when dragging.The vertical snap direction.int
The vertical grid size to use, in pixels, when snap-to-grid is enabled.Whether this canvas should always start a new line when used as a tile in aFlowLayout
.The CSS class applied to this widget as a whole.If specified this governs the tabIndex of the widget in the page's tab order.ADataContext
to be used if nodataContext
is provided (directly or indirectly via a parent).protected Canvas
getTitle()
Synonym forgetPrompt()
Synonym forgetPrompt()
int
getTop()
Number of pixels the top of the widget is offset down from its default drawing context (either its parent's top-left corner, or the document flow, depending on the value of theposition
property).Number of pixels the top of the widget is offset down from its default drawing context (either its parent's top-left corner, or the document flow, depending on the value of theposition
property).The top-most Canvas (i.e., not a child of any other Canvas), if any, in this widget's containment hierarchy.getUISummary
(String[] heirarchyExcluded, String[] thisCanvasExcluded) Returns a summary of this canvas and its child canvii and/or fields that is useful to an AI in understanding the hierarchy.boolean
Should canvases with noparent canvas
be moved to the end of the TabIndexManager tree on draw()?boolean
Should canvases with aparent canvas
be added to the TabIndexManager under the parent as described inupdateChildTabPositions()
andupdateChildTabPosition()
?In earlier versions of Internet Explorer (pre IE9), a native limitation exists whereby if HTML elements are overlapping on the page, certain elements can appear to "burn through" elements in the same position with a higher z-index.boolean
IfshowShadow
is true, should we use the cssbox-shadow
property (where supported) to achieve the shadow?boolean
This flag controls whether we register the component as a maskable item with the EventHandler.boolean
If set, forces the main SVG image or icon in the canvas to be rendered in an image tag rather than an object tag, the default.If set, native HTML5 drag and drop will be used for all drags initiated on this widget (on browsers where this is supported), and native HTML5 drop events occurring over this widget will be processed.Configures where the Opacity filter is used for IE6-8.Ontouch devices
, if thisCanvas
can be scrolled, should touch-dragging the content area result in scrolling? Set tofalse
if touch-dragging should not cause scrolling.ValuesManager
for managing values displayed in this component.ValuesManager
for managing values displayed in this component.int
Returns the height of the viewport onto the scrollable content.int
Returns the width of the viewport onto the scrollable content.Controls widget visibility when the widget is initialized.int
Return the visible height of the Canvas.Criteria to be evaluated to determine whether this Canvas should be visible.int
Return the visible width of the Canvas.int
getVSnapPosition
(int coordinate) Override this method to provide a custom snap-to grid.int
getVSnapPosition
(int coordinate, String direction) Override this method to provide a custom snap-to grid.getWidth()
Thecanvas.width
attribute specifies the size for a component's horizontal dimension;canvas.height
specifies the size for the vertical dimension.Process[]
List of screen-globalworkflows
that can be shared by event handler workflows using aStartProcessTask
.int
Get the z-Index of this canvas.int
getZIndex
(boolean resolveToNumber) Get the z-Index of this canvas.void
Handler fired on a delay when the user hovers the mouse over this hover-target.void
hide()
Sets the widget's CSS visibility attribute to "hidden".void
Hides the click mask associated with this canvas.void
hideClickMask
(String ID) Hides the click mask associated with this canvas.void
Hide thecomponent level clickMask
for this widgetvoid
hideComponentMask
(boolean suppressFocusReset) Hide thecomponent level clickMask
for this widgetvoid
The default implementation of this method hides the contextMenu currently being shown for this component (which occurs when the mouse button that toggles the context menu is released).static String
Generates the HTML for an image unique to this Canvas.static String
static String
Generates the HTML for an image unique to this Canvas.void
Notification method fired afterinitWidget()
, when canvas initialization is complete.intersects
(Canvas other) Returns true if the rectangles of this widget and the specified widget overlap.isDirty()
Returns whether a canvas is waiting to be redrawn.Is this canvas disabled? Note that the disabled state is inherited - this method will return true if this widget, or any of its ancestors are marked disabled.Returns true if this Canvas has the keyboard focus.boolean
Returns true if the widget is visible, taking all parents into account, so that a widget which is not hidden might still report itself as not visible if it is within a hidden parent.keyUp()
Executed when a key is released on a focusable widget (canFocus
: true).void
layoutChildren
(String reason) layoutChildren()
is where a Canvas should implement a sizing policy for it's Canvas children.Generates the HTML for a standard link (anchor) element.Generates the HTML for a standard link (anchor) element.void
destroy()
this canvas on a timeout.void
Marks the widget as "dirty" so that it will be added to a queue for redraw.void
markForRedraw
(String reason) Marks the widget as "dirty" so that it will be added to a queue for redraw.void
Puts this widget just above the specified widget in the stacking order, so it appears in front of the specified widget if both widgets have the same parent.void
Puts this widget just below the specified widget in the stacking order, so it appears behind the specified widget if both widgets have the same parent.moveBy
(int deltaX, int deltaY) Moves the widget deltaX pixels to the right and deltaY pixels down.boolean
moveTo
(int left, int top) Moves the widget so that its top-left corner is at the specified coordinates.protected void
onAttach()
protected void
onDetach()
protected void
onInit()
void
This method is the programmatic equivalent of the user pressing the "Page Down" key while this widget has the focus.void
This method is the programmatic equivalent of the user pressing the "Page Up" key while this widget has the focus.protected void
Fires when the interior size of the parent changes, including parent resize and scrollbar introduction or removal.void
Move this canvas to the specified point, or as close to the specified point as possible without this widget extending beyond the edge of the browser viewport on any side.void
placeNear
(int left) void
placeNear
(int left, int top) Move this canvas to the specified point, or as close to the specified point as possible without this widget extending beyond the edge of the browser viewport on any side.void
print()
Generate and show aPrintWindow
containing aPrintCanvas
showing a printable view of this component.void
print
(PrintProperties printProperties) void
print
(PrintProperties printProperties, PrintWindow printWindowProperties) void
print
(PrintProperties printProperties, PrintWindow printWindowProperties, String callback) Generate and show aPrintWindow
containing aPrintCanvas
showing a printable view of this component.static void
printComponents
(Object[] components) Generate printable HTML for the designated components and trigger the native print dialog, without ever showing the printable HTML to the user.void
provideRuleContext
(String dataPath, Object data) Provide data to thecom.smartgwt.client.widgets.Canvas#ruleScope
component, to be made available in the rule context at the specifiedpath
.void
provideRuleContext
(String dataPath, Object data, DataBoundComponent dbc) Provide data to thecom.smartgwt.client.widgets.Canvas#ruleScope
component, to be made available in the rule context at the specifiedpath
.void
redraw()
Redraws the widget immediately with its current property values.void
Redraws the widget immediately with its current property values.static void
registerFontScaledPaddingStyles
(String[] scaledStyles, String[] baselineStyles, int targetSizeChange) Registers one or more CSS classes to have their padding adjusted (independently on all edges) according to thepadding size change
applied to the page.void
removeChild
(Canvas child) Remove a child from this parent.void
removeChild
(Canvas child, String name) Remove a child from this parent.void
removePeer
(Canvas peer) Remove a peer from this Canvasvoid
removePeer
(Canvas peer, String name) Remove a peer from this Canvasvoid
removeRuleContext
(String path) Remove data in the rule context at the specifiedpath
along with any user-provided schema.void
removeSnapAlignCandidate
(Canvas candidate) Remove a candidate fromsnapAlignCandidates
.static void
resizeAutoChildAttributes
(String policy, int delta) Change the value of attributes registered viaregisterAutoChildSizingAttributes()
by some number of pixels.resizeBy
(int deltaX, int deltaY) Resizes the widget, adding deltaX to its width and deltaY to its height (moves the right and/or bottom sides of the widget).static void
resizeControls
(int delta) Change the basic size of UI components in the current skin by "delta" pixels.static void
resizeControlsTo
(int targetDelta) Resizes controls as if callingresizeControls()
, but takes a final target size instead of a delta representing the change from a current size.static void
resizeFonts
(int sizeChange) Modify the size of fonts for some or all stylesheets defined in the page.static void
resizeFonts
(int sizeChange, String styleSheets) static void
resizeFonts
(int sizeChange, String styleSheets, Boolean resizeRelatedControls) Modify the size of fonts for some or all stylesheets defined in the page.static void
resizeFontsTo
(int targetDelta) Resizes fonts as if callingresizeFonts()
, but takes a final target size instead of a delta representing the change from a current size.static void
resizeIcons
(String policy, int delta) Change the basic size of icons in the current skin by "delta" pixels.static void
resizePadding
(int fontSizeChange) Modify the amount of padding for some CSS styles defined for the page.static void
resizePadding
(int fontSizeChange, String styleSheets) Modify the amount of padding for some CSS styles defined for the page.resizeTo
(int width, int height) Resizes the widget to the specified width and height (moves the right and/ or bottom sides of the widget).Resizes the widget to the specified width and height (moves the right and/ or bottom sides of the widget).void
revealChild
(Canvas child) Reveals the child Canvas passed in by showing it if it is currently hidden (note, this is stub functionality, certain Canvas subclasses such asTabSet
have more useful implementations) NOTE: This is an override point.void
revealChild
(String childID) Reveals the child Canvas passed in by showing it if it is currently hidden (note, this is stub functionality, certain Canvas subclasses such asTabSet
have more useful implementations) NOTE: This is an override point.void
scrollBy
(int dX, int dY) Scroll this widget by some pixel increment in either (or both) direction(s).void
scrollByPercent
(int dX, int dY) Scroll this widget by some percentage of scroll size in either (or both) direction(s).void
scrollTo()
Scrolls the content of the widget so that the origin (top-left corner) of the content is left pixels to the left and top pixels above the widget's top-left corner (but still clipped by the widget's dimensions).void
void
Scrolls the content of the widget so that the origin (top-left corner) of the content is left pixels to the left and top pixels above the widget's top-left corner (but still clipped by the widget's dimensions).void
Vertically scrolls the content of the widget to the end of its contentvoid
Horizontally scrolls the content of the widget to 0void
scrollToPercent
(int left, int top) Scroll this widget to some position specified as a percentage of scroll size in either (or both) direction(s).void
Horizontally scrolls the content of the widget to the end of its contentvoid
Vertically scrolls the content of the widget to 0void
Puts this widget at the bottom of the stacking order, so it appears behind all other widgets in the same parent.setAccessKey
(String accessKey) If specified this governs the HTML accessKey for the widget.setAdaptHeightByCustomizer
(AdaptHeightByCustomizer customizer) Set customizer that definesadaptHeightBy
.setAdaptiveHeightPriority
(Integer adaptiveHeightPriority) setAdaptiveWidthPriority
(Integer adaptiveWidthPriority) If multiple widgets in the same Layout haveadaptive width
,adaptiveWidthPriority
can be set to indicate which of the components should be given priority access to space.setAdaptWidthByCustomizer
(AdaptWidthByCustomizer customizer) Set customizer that definesadaptWidthBy
.static void
setAllowExternalFilters
(boolean allExternalFilters) Changes the system-wideallowExternalFilters
setting.setAlwaysManageFocusNavigation
(Boolean alwaysManageFocusNavigation) Should focus navigation for this canvas and its descendents be handled explicitly by intercepting "Tab" key events and calling theTabIndexManager.shiftFocus()
API?setAlwaysShowScrollbars
(Boolean alwaysShowScrollbars) Should this browser always show custom scrollbars ifshowCustomScrollbars
is true?setAnimateAcceleration
(AnimationAcceleration animateAcceleration) Default acceleration effect to apply to all animations on this Canvas.setAnimateFadeTime
(Integer animateFadeTime) Default time for performing an animated fade.setAnimateHideAcceleration
(AnimationAcceleration animateHideAcceleration) Default acceleration function for performing an animated hide.setAnimateHideEffect
(AnimationEffect animateHideEffect) Default animation effect to use ifanimateHide()
is called without an explicit effect parameter.setAnimateHideTime
(Integer animateHideTime) Default time for performing an animated hide.setAnimateMoveAcceleration
(AnimationAcceleration animateMoveAcceleration) Default acceleration effect for performing an animated move.setAnimateMoveTime
(Integer animateMoveTime) Default time for performing an animated move.setAnimateRectAcceleration
(AnimationAcceleration animateRectAcceleration) Default acceleration function for performing an animated move and resize.setAnimateRectTime
(Integer animateRectTime) Default time for performing an animated setRect.setAnimateResizeAcceleration
(AnimationAcceleration animateResizeAcceleration) Default acceleration function for performing an animated resize.setAnimateResizeLayoutMode
(AnimationLayoutMode animateResizeLayoutMode) When to update thechild layout
for asize animation
.setAnimateResizeTime
(Integer animateResizeTime) Default time for performing an animated resize.setAnimateScrollAcceleration
(AnimationAcceleration animateScrollAcceleration) Default acceleration function for performing an animated scroll.setAnimateScrollTime
(Integer animateScrollTime) Default time for performing an animated scroll.setAnimateShowAcceleration
(AnimationAcceleration animateShowAcceleration) Default acceleration function for performing an animated show.setAnimateShowEffect
(AnimationEffect animateShowEffect) Default animation effect to use ifanimateShow()
is called without an explicit effect parameter.setAnimateShowTime
(Integer animateShowTime) Default time for performing an animated show.setAnimateTime
(int animateTime) Default total duration of animations.setAppImgDir
(String appImgDir) Default directory for app-specific images, relative to the Page-wideappImgDir
.setAriaRole
(String ariaRole) ARIA role of this component.setAriaState
(String stateName, Object stateValue) Set a specific ARIA state mapping for this component.setAutoChildConstructor
(String autoChildName, String className) Sets the SmartClient constructor for the AutoChild namedautoChildName
.setAutoChildProperties
(String autoChildName, EditContext properties) Sets the properties for creating an AutoChild namedautoChildName
.setAutoChildProperties
(String autoChildName, EditProxy properties) Sets the properties for creating an AutoChild namedautoChildName
.setAutoChildProperties
(String autoChildName, Canvas properties) Sets the properties for creating aCanvas
AutoChild namedautoChildName
.setAutoChildProperties
(String autoChildName, FormItem properties) Sets the properties for creating aFormItem
AutoChild namedautoChildName
.setAutoChildVisibility
(String autoChildName, boolean visible) Sets whether to create and show the AutoChild namedautoChildName
.Set the minimum value for height.setAutoMaskComponents
(Boolean autoMaskComponents) Deprecated.As of Smart GWT version 10.0, deprecated in favor ofEditProxy.autoMaskChildren
setAutoParent
(String autoParent) This initialization property allows developers to create a canvas using the Class.addAutoChild() method, and have it added as a child to some other component.setAutoPopulateData
(Boolean autoPopulateData) If adataContext
is provided, should subcomponents automatically bind to the data?static void
setAutoResizeAutoChildAttributes
(boolean autoResize) static void
setAutoResizeIcons
(boolean autoResizeIcons) setAutoShowParent
(Boolean autoShowParent) If set to true, the widget's parent (if any) will automatically be shown whenever the widget is shown.Set the minimum value for width.setBackgroundColor
(String backgroundColor) The background color for this widget.setBackgroundImage
(String backgroundImage) URL for a background image for this widget (corresponding to the CSS "background-image" attribute).setBackgroundPosition
(String backgroundPosition) Specifies how the background image should be positioned on the widget.setBackgroundRepeat
(BackgroundRepeat backgroundRepeat) Specifies how the background image should be tiled if this widget is larger than the image.Set the CSS border of this component, as a CSS string including border-width, border-style, and/or color (eg "2px solid blue").setBorderRadius
(String borderRadius) The CSS border-radius for this widget.void
setBottom
(int bottom) Resizes the widget vertically to position its bottom edge at the specified coordinate.setCanAcceptDrop
(Boolean canAcceptDrop) Indicates that this object can receive dropped widgets (i.e.setCanAdaptHeight
(Boolean canAdaptHeight) SeecanAdaptWidth
.setCanAdaptWidth
(Boolean canAdaptWidth) Indicates that this component is able to render itself at multiple possible sizes, in order to fit into less space when very little space is available, or to display more information or provide more immediate access to functionality when more space is available.setCanDrag
(Boolean canDrag) Indicates whether this widget can initiate custom drag-and-drop operations (other than reposition or resize).setCanDragReposition
(Boolean canDragReposition) Indicates whether this widget can be moved by a user of your application by simply dragging with the mouse.setCanDragResize
(Boolean canDragResize) Indicates whether this widget can be resized by dragging on the edges and/or corners of the widget with the mouse.setCanDragScroll
(boolean canDragScroll) If this Canvas is canAcceptDrop:true, when the user drags a droppable widget over an edge of the widget, should we scroll to show the rest of the widget's content? Returned from canvas.shouldDragScroll() if there are scrollbars.setCanDrop
(Boolean canDrop) Indicates that this object can be dropped on top of other widgets.setCanDropBefore
(Boolean canDropBefore) When explicitly set to false, disallows drop before this member in the Layout.setCanFocus
(Boolean canFocus) Can this widget be allowed to become the target of keyboard events?setCanHover
(Boolean canHover) Will this Canvas fire hover events when the user hovers over it, or one of its children?setCanSelectText
(Boolean canSelectText) Whether native drag selection of contained text is allowed within this Canvas.setChildren
(Canvas... children) Array of all Canvii that are immediate children of this Canvas.setChildrenResizeSnapAlign
(Boolean childrenResizeSnapAlign) Flag to disable snapping to alignment when children of this Canvas are resizedsetChildrenSnapAlign
(Boolean childrenSnapAlign) If enabled whilechildrenSnapToGrid
is enabled, children dragged within this Canvas will also snap to positions where their edges or center lines would be aligned with the edges or centers of other components, and lines will be shown to point out the possible alignment (with appearance controlled bysnapAlignCenterLineStyle
andsnapAlignEdgeLineStyle
respectively.setChildrenSnapCenterAlign
(Boolean childrenSnapCenterAlign) SeechildrenSnapAlign
.setChildrenSnapEdgeAlign
(Boolean childrenSnapEdgeAlign) SeechildrenSnapAlign
.setChildrenSnapResizeToGrid
(Boolean childrenSnapResizeToGrid) If true, causes this canvas's children to snap to its grid when resizing.setChildrenSnapToGrid
(Boolean childrenSnapToGrid) If true, causes this canvas's children to snap to its grid when dragging.setComponentMaskDefaults
(Canvas componentMaskDefaults) Defaults for thecomponentMask
autoChild.setContents
(String contents) The contents of a canvas or label widget.setContextMenu
(Menu contextMenu) Context menu to show for this object, an instance of the Menu widget.setCorrectZoomOverflow
(Boolean correctZoomOverflow) Whether the Framework should correct for erroneous scrollHeight and scrollWidth values reported by the browser when zoomed (via browser or OS-level zoom) by allowingmaxZoomOverflowError
of overflow before enabling scrolling and displaying custom scrollbars.Specifies the css cursor image to display when the mouse pointer is over this component.setDataContext
(DataContext dataContext) A mapping fromDataSource
IDs to specificRecords
from those DataSources, thatDataBoundComponents
contained within this Canvas should automatically bind to if a DataSource is provided but data is not provided (directly or indirectly, for example, indirectly via settingListGrid.autoFetchData
.setDataPath
(String dataPath) A dataPath may be specified on any canvas.setDefaultHeight
(int defaultHeight) For custom components, establishes a default height for the component.static void
setDefaultPageSpace
(int newDefaultPageSpace) Changes the globaldefaultPageSpace
.static void
setDefaultProperties
(Canvas canvasProperties) Class level method to set the default properties of this class.static Canvas
setDefaultShowCustomScrollbars
(boolean showCS) Whether to use the browser's native scrollbars or SmartClient-based scrollbars by default for all canvases.setDefaultWidth
(int defaultWidth) For custom components, establishes a default width for the component.setDefiningProperty
(String definingProperty) This attribute denotes the name of a property to use as agetDefiningPropertyName()
for this property when generating and resolvingAutoTest locators with search segments
.setDefiningPropertyNameOptions
(String... definingPropertyNameOptions) If no explicitdefiningProperty
was specified for this component, this array denotes a list of options to use as adefining property
when generating and resolvingAutoTest locators with search segments
.setDisabled
(boolean disabled) If set to true, the widget will be disabled.setDisabledCursor
(Cursor disabledCursor) Specifies the cursor image to display when the mouse pointer is over this widget if this widget is disabled.setDisableTouchScrollingForDrag
(Boolean disableTouchScrollingForDrag) DisablesuseTouchScrolling
whenever a built-in drag operation has been enabled which is known to be non-functional if touch scrolling is enabled.setDoubleClickDelay
(int doubleClickDelay) Amount of time (in milliseconds) between which two clicks are considered a single clicksetDragAppearance
(DragAppearance dragAppearance) Visual appearance to show when the object is being dragged.setDragIntersectStyle
(DragIntersectStyle dragIntersectStyle) This indicates how the system will test for droppable targets: either by intersection with the mouse or intersection with the rectangle of the dragMoveTarget.setDragMaskType
(DragMaskType dragMaskType) This property controls what kind of mask is used in caseuseDragMask
is enabled.setDragMaxHeight
(int dragMaxHeight) Sets maximum height that this Canvas can be resized to by a user.setDragMaxWidth
(int dragMaxWidth) Maximum width that this Canvas can be resized to by a user.setDragMinHeight
(int dragMinHeight) Minimum height that this Canvas can be resized to by a user.setDragMinWidth
(int dragMinWidth) Minimum width that this Canvas can be resized to by a user.setDragOpacity
(Integer dragOpacity) If this widget has dragAppearance"target"
, this value specifies the opacity to render the target while it is being dragged.setDragRepositionAppearance
(DragAppearance dragRepositionAppearance) IfcanDragReposition
is true, this attribute specifies the visual appearance to show during drag reposition.setDragRepositionCursor
(Cursor dragRepositionCursor) Cursor to switch to if the mouse is over a widget that is drag repositionable.setDragResizeAppearance
(DragAppearance dragResizeAppearance) IfcanDragResize
is true, this attribute specifies the visual appearance to show during drag resize.setDragScrollDelay
(int dragScrollDelay) If this widget supports drag-scrolling, This property specifies how many ms the user must hover over the drag-scroll threshold before scrolling begins.setDragStartDistance
(int dragStartDistance) Number of pixels the cursor needs to move before the EventHandler starts a drag operation.setDragTarget
(Canvas dragTarget) A different widget that should be actually dragged when dragging initiates on this widget.setDragTarget
(String dragTarget) A different widget that should be actually dragged when dragging initiates on this widget.setDragType
(String dragType) Sets adragType
for this widget used, to be compared todropTypes
on possible drop target widgets.setDropTarget
(Canvas dropTarget) Delegates a different widget that should actually be dropped on if the cursor is over this widget when the drop completes.setDropTarget
(String dropTarget) Delegates a different widget that should actually be dropped on if the cursor is over this widget when the drop completes.setDropTypes
(String dropTypes) When a drag and drop interaction occurs, if adragType
is configured on the source widget, it is compared to thedropTypes
configured on the target widget, and a drop is only allowed if thedragType
is listed in the target widget'sdropTypes
array.setDropTypes
(String... dropTypes) When a drag and drop interaction occurs, if adragType
is configured on the source widget, it is compared to thedropTypes
configured on the target widget, and a drop is only allowed if thedragType
is listed in the target widget'sdropTypes
array.setDynamicContents
(Boolean dynamicContents) Dynamic contents allows the contents string to be treated as a simple but powerful template.setEdgeBackgroundColor
(String edgeBackgroundColor) Background color for the EdgedCanvas created to decorate this component.setEdgeCenterBackgroundColor
(String edgeCenterBackgroundColor) Background color for the center section only.setEdgeImage
(String edgeImage) Base name of images for edges.setEdgeMarginSize
(int edgeMarginSize) How far into the edge of an object do we consider the "edge" for drag resize purposes?setEdgeOffset
(Integer edgeOffset) Amount the contained Canvas should be offset.setEdgeOpacity
(Integer edgeOpacity) Opacity of the edges.setEdgeShowCenter
(Boolean edgeShowCenter) Whether to show media in the center section, that is, behind the decorated Canvas.setEdgeSize
(int edgeSize) Size in pixels for corners and edgesvoid
setEditMode
(boolean editingOn) Enable or disable edit mode for this component.void
setEditMode
(boolean editingOn, EditContext editContext) void
setEditMode
(boolean editingOn, EditContext editContext, EditNode editNode) Enable or disable edit mode for this component.setEditProxyConstructor
(String editProxyConstructor) Default class used to construct theEditProxy
for this component when the component isfirst placed into edit mode
.protected void
setElement
(Element elem) Normal usage of SmartGWT is to call draw() on SmartGWT widgets, not to use use RootPanel.add().setEnableWhen
(AdvancedCriteria enableWhen) Criteria to be evaluated to determine whether this Canvas should be enabled.setEndLine
(Boolean endLine) Whether this canvas should end the line it's in when used as a tile in aFlowLayout
.setExtraSpace
(int extraSpace) When this Canvas is included as a member in a Layout, extra blank space that should be left after this member in a Layout.setFacetId
(String facetId) If a Canvas is dropped onto aCubeGrid
, and it has a facetId property specified then the Cube treats this as adding that facetId at the drop location.setFloatingScrollbars
(boolean floatingScrollbars) IfshowCustomScrollbars
is true, should the scrollbars be drawn floating over the component handle, or should the handle shrink to accommodate them?setForwardSVGeventsToObject
(Boolean forwardSVGeventsToObject) If true, events sent to the SVG inside an object tag are forwarded to the object itself by Framework handlers.setGroupBorderCSS
(String groupBorderCSS) Sets the style for the grouping frame around the canvas.setGroupLabelBackgroundColor
(String groupLabelBackgroundColor) If set, the background color of the grouping label.setGroupLabelStyleName
(String groupLabelStyleName) Sets the style for the grouping label.setGroupPadding
(Integer groupPadding) Padding to apply inside the border when this canvas is showing a groupborder and label
.setGroupTitle
(String groupTitle) The title/label for the grouping.setHeight
(int height) Thecanvas.width
attribute specifies the size for a component's horizontal dimension;canvas.height
specifies the size for the vertical dimension.void
Thecanvas.width
attribute specifies the size for a component's horizontal dimension;canvas.height
specifies the size for the vertical dimension.Convenience method that sets the height to 100%.setHideUsingDisplayNone
(boolean hideUsingDisplayNone) When this widget is hidden (seevisibility
andhide()
), should display:none be applied to theouter element
?setHoverAlign
(Alignment hoverAlign) Ifthis.showHover
is true, this property can be used to customize the alignment of content in the hover canvas.setHoverAutoDestroy
(Boolean hoverAutoDestroy) Ifthis.showHover
is true andgetHoverComponent()
is implemented, should the hoverCanvas returned from it be automatically destroyed when it is hidden?setHoverAutoFitMaxWidth
(int hoverAutoFitMaxWidth) Maximum auto-fit width for a hover ifhoverAutoFitWidth
is enabled.setHoverAutoFitMaxWidth
(String hoverAutoFitMaxWidth) Maximum auto-fit width for a hover ifhoverAutoFitWidth
is enabled.setHoverAutoFitWidth
(Boolean hoverAutoFitWidth) ifshowHover
is true, this property will cause the specifiedhoverWidth
to be treated as a minimum width for the hover.setHoverDelay
(int hoverDelay) Ifthis.canHover
is true, how long should the mouse be kept over this widget before the hover event is firedsetHoverFocusKey
(String hoverFocusKey) For canvasesshowing a hover
, this attribute gives users a way to pin the hover in place so they can interact with it (scroll it, click embedded links, etc).setHoverHeight
(Integer hoverHeight) Ifthis.showHover
is true, this property can be used to customize the height of the hover canvas shown.setHoverMoveWithMouse
(Boolean hoverMoveWithMouse) Ifthis.showHover
is true, should this widget's hover canvas be moved with the mouse while visible?setHoverOpacity
(Integer hoverOpacity) Ifthis.showHover
is true, should the hover canvas be shown with opacity other than 100?setHoverPersist
(HoverPersistMode hoverPersist) Allows interaction with hovers when the cursor is positioned over them.setHoverScreen
(String hoverScreen) Screen to create (viacreateScreen()
) in lieu of callinggetHoverComponent()
.setHoverStyle
(String hoverStyle) Ifthis.showHover
is true, this property can be used to specify the css style to apply to the hover canvas.setHoverVAlign
(VerticalAlignment hoverVAlign) Ifthis.showHover
is true, this property can be used to customize the vertical alignment of content in the hover canvas.setHoverWidth
(int hoverWidth) Ifthis.showHover
is true, this property can be used to customize the width of the hover canvas shown.setHoverWrap
(Boolean hoverWrap) Ifthis.showHover
is true, this property can be used to customize the whether content in the hover canvas is displayed in a single line, or wraps.setHtmlElement
(Element htmlElement) If specified as a pointer to an HTML element present in the DOM, this canvas will be rendered inside that element ondraw()
.setHtmlElement
(String htmlElement) If specified as a pointer to an HTML element present in the DOM, this canvas will be rendered inside that element ondraw()
.setHtmlPosition
(DrawPosition htmlPosition) IfhtmlElement
is specified, this attribute specifies the position where the canvas should be inserted relative to thehtmlElement
in the DOM.void
Set the URL of an image or SVG object element by name.void
Set the URL of an image or SVG object element by name.void
setInitHandler
(CanvasInitHandler initHandler) Specify a notification method to fire when this Canvas is initialized in JavaScript.setIsGroup
(boolean isGroup) Should a grouping frame be shown around this canvas if a non-empty string has been specified forgroupTitle
.setIsRuleScope
(Boolean isRuleScope) Marks this Canvas as theruleScope
that will be discovered by any containedDataBoundComponent
s which do not specify an explicitruleScope
.setIsSnapAlignCandidate
(Boolean isSnapAlignCandidate) Flag to disable snapping to alignment against this Canvas when other Canvases dragged into the same parent whenchildrenSnapAlign
is enabled on this Canvas' parent.setKeepInParentRect
(Rectangle rectangle) setKeepInParentRect
(Boolean keepInParentRect) Constrains drag-resizing and drag-repositioning of this canvas to either the rect of its parent (if set to true) or an arbitrary rect based on its parent (if set to a [Left,Top,Width,Height] rect array).setKeepInParentRect
(Integer... keepInParentRect) Constrains drag-resizing and drag-repositioning of this canvas to either the rect of its parent (if set to true) or an arbitrary rect based on its parent (if set to a [Left,Top,Width,Height] rect array).setLayoutAlign
(Alignment layoutAlign) When this Canvas is included as a member in a Layout, layoutAlign controls alignment on the breadth axis of the layout.setLayoutAlign
(VerticalAlignment layoutAlign) When this Canvas is included as a member in a Layout, layoutAlign controls alignment on the breadth axis of the layout.setLeaveGroupLabelSpace
(Boolean leaveGroupLabelSpace) When showing this widget in agroup
, should any content be shifted down so that the group-label doesn't sit in front of it?setLeavePageSpace
(Integer leavePageSpace) If set, overrides the globaldefaultPageSpace
.setLeft
(int left) Number of pixels the left side of the widget is offset to the right from its default drawing context (either its parent's topleft corner, or the document flow, depending on the value of theposition
property).Number of pixels the left side of the widget is offset to the right from its default drawing context (either its parent's topleft corner, or the document flow, depending on the value of theposition
property).setLocateByIDOnly
(boolean locateByIDOnly) Iftrue
, when retrieving alocator
for this component always return a reference directly to this component bywidget ID
, using the compact format"///canvasID"
, ignoring any parent elements and ignoring any configuredtestRoot
.setLocateChildrenBy
(LocatorStrategy locateChildrenBy) Strategy to use when locating children in this canvas from an autoTest locator string.setLocateChildrenType
(LocatorTypeStrategy locateChildrenType) LocatorTypeStrategy
to use when finding children within this canvas.setLocatePeersBy
(LocatorStrategy locatePeersBy) Strategy to use when locating peers of this canvas from an autoTest locator string.setLocatePeersType
(LocatorTypeStrategy locatePeersType) LocatorTypeStrategy
to use when finding peers of this canvas.setLocatorName
(String locatorName) Local name for referencing this canvas from an autoTest locator string.boolean
setLocatorParent
(Canvas locatorParent, String childName) This method will set mark the target canvas as the "locator parent" for this canvas, using the specified child name.boolean
setLocatorParent
(Canvas locatorParent, String childName, String attributeName) This method will set mark the target canvas as the "locator parent" for this canvas, using the specified child name.Setter implementing theLogicalStructure
interface, which supports Eclipse's logical structure debugging facility.Set the CSS Margin, in pixels, for this component.setMatchElement
(Boolean matchElement) IfhtmlElement
is specified, should this canvas be drawn at the same dimensions as the htmlElement?
See alsomatchElementWidth
andmatchElementHeight
setMatchElementHeight
(MatchElementSizeMode matchElementHeight) For canvases with a specifiedhtmlElement
wherepersistentMatchElement
is set to true, how should the canvas match the element's height?setMatchElementWidth
(MatchElementSizeMode matchElementWidth) For canvases with a specifiedhtmlElement
wherepersistentMatchElement
is set to true, how should the canvas match the element's width?setMaxHeight
(int maxHeight) Maximum height available to this Canvas.setMaxWidth
(int maxWidth) Maximum width available to this Canvas.setMaxZoomOverflowError
(int maxZoomOverflowError) WhencorrectZoomOverflow
is true and browser or OS-level zoom is active, determines how much overflow must occur before the Framework enables scrolling for this canvas.setMenuConstructor
(String menuConstructor) Default class used to construct menus created by this component, including context menus.setMinHeight
(int minHeight) Minimum height available to this Canvas.setMinNonEdgeSize
(int minNonEdgeSize) If the widget has drag resize configured on one or more of it's edges, and the edgeMarginSize is large enough that the remaining space is less thanminNonEdgeSize
, the edgeMarginSize will be reduced such that the non-edge part of the widget is at least 1/3 of the total space (with two draggable edges) or half of it (with one draggable edge).setMinWidth
(int minWidth) Minimum width available to this Canvas.setMomentumScrollMinSpeed
(double momentumScrollMinSpeed) The minimum speed in pixels per second that must be reached for momentum scrolling to kick in.setMouseStillDownDelay
(int mouseStillDownDelay) Amount of time (in milliseconds) between repeated 'mouseStillDown' events for this canvas.setMouseStillDownInitialDelay
(int mouseStillDownInitialDelay) Amount of time (in milliseconds) before mouseStillDown events start to be fired repeatedly for this canvas.Optional name for the canvas, which can later be used to reference it.setNativeAutoHideScrollbars
(Boolean nativeAutoHideScrollbars) In some platform/browser configurations, scrollable regions do not show visible scrollbars until the user attempts to interact with the region.static void
setNeverUseFilters
(boolean neverUseFilters) Changes the system-wideneverUseFilters
setting.setNoDoubleClicks
(Boolean noDoubleClicks) If true, this canvas will receive all mouse-clicks as singleclick
events rather than asdoubleClick
events.setNoDropCursor
(Cursor noDropCursor) Specifies the cursor image to display when the user drags a droppable canvas over this if it is not a valid drop target for the event andshowNoDropIndicator
is true.setOpacity
(Integer opacity) Renders the widget to be partly transparent.setOverflow
(Overflow overflow) Controls what happens when the drawn size of the content of a Canvas is either greater or smaller than the specified size of the Canvas.setPadding
(Integer padding) Set the CSS padding of this component, in pixels.void
setPageLeft
(int left) Set the page-relative left coordinate of this widget.void
setPageTop
(int top) Set the page-relative top coordinate of this widget.void
setPanelContainer
(Canvas container) Sets this Canvas's "panel container".setParentCanvas
(Canvas parentCanvas) This Canvas's immediate parent, if any.setParentElement
(Canvas parentElement) Deprecated.As of Smartclient version 9.1, deprecated in favor ofparentCanvas
andgetParentCanvas()
Array of all Canvii that are peers of this Canvas.setPendingMarkerStyle
(String pendingMarkerStyle) CSS class used to apply additional styles to this canvas whenshowPendingMarker()
is called, or whenpendingMarkerVisible
has been set.setPendingMarkerVisible
(Boolean pendingMarkerVisible) This attribute indicates whether thepending marker class
should be appended to the list of CSS classes applied to this canvas.setPercentBox
(PercentBoxModel percentBox) Governs the model to be used when sizing canvases with percentage width or height, or positioning widgets with a specifiedsnapTo
.setPercentSource
(Canvas percentSource) If this canvas has its size specified as a percentage, this property allows the user to explicitly designate another canvas upon which sizing will be based.setPersistentMatchElement
(Boolean persistentMatchElement) If this canvas has a specifiedhtmlElement
andmatchElement
is set to true, should the canvas perform a one time resize to fit the target element on draw, or should it continue to match the target element as its size changes due to page reflows?setPointerSettings
(PointerSettings pointerSettings) Detail settings of thepointer
such as where it should be located along the outside of the canvas.setPointerTarget
(String pointerTarget) This property in conjunction with thepointerSettings.snapTo
places the canvas in relation to the target canvas.setPosition
(Positioning position) Absolute or relative, corresponding to the "absolute" (with respect to parent) or "relative" (with respect to document flow) values for the CSS position attribute.setPrintChildrenAbsolutelyPositioned
(Boolean printChildrenAbsolutelyPositioned) Should this canvas print its children absolutely positioned when generatingprintable HTML
.setPrintStyleName
(String printStyleName) The CSS class to apply when printing this widget.Prompt displayed in hover canvas ifshowHover
is true.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) IfcanDragResize
is true, this property specifies the conditions for when proportional resizing is used.setReceiveScrollbarEvents
(boolean receiveScrollbarEvents) Whether this canvas should receiveevents
from its scrollbars, which arepeers
.setRect
(int left, int top, int width, int height) Set all four coordinates, relative to the enclosing context, at once.Set all four coordinates, relative to the enclosing context, at once.setRedrawOnResize
(Boolean redrawOnResize) Should this element be redrawn in response to a resize?void
setRelativeTabPosition
(Integer position) Assign a relative tab position for this canvas.setResizeBarTarget
(String resizeBarTarget) When this Canvas is included as a member in a Layout, andshowResizeBar
is set totrue
so that a resizeBar is created,resizeBarTarget:"next"
can be set to indicate that the resizeBar should resize the next member of the layout rather than this one.setResizeFrom
(EdgeName... resizeFrom) When drag resizing is enabled viacanDragResize
, restricts resizes to only certain edges or corners.setResizeFrom
(String... resizeFrom) Deprecated.use#setResizeFrom(EdgeName)
instead.void
setRight
(int right) Resizes the widget horizontally to position its right side at the specified coordinate.setRuleScope
(String ruleScope) ID
of the component that gathers the context for evaluation of criteria-based rules specified by properties such asFormItem.visibleWhen
, Dynamic Properties, andDynamicCriteria
such asListGrid.initialCriteria
.setScrollbarConstructor
(String scrollbarConstructor) The class that will be used to create custom scrollbars for this component.setScrollbarSize
(int scrollbarSize) How thick should we make the scrollbars for this canvas.setShadowColor
(String shadowColor) Color for the css-based drop shadow shown ifuseCSSShadow
is true andshowShadow
is true.setShadowDepth
(int shadowDepth) Depth of the shadow, or the virtual height above the page of the widget throwing the shadow.setShadowHOffset
(Integer shadowHOffset) Horizontal offset for theshadow
.setShadowImage
(String shadowImage) IfuseCSSShadow
is false, (or for browsers that do not support css3), this property supplies the base name of the series of images for the sides, corners, and center of the shadow.setShadowOffset
(Integer shadowOffset) Offset of the shadow.setShadowSoftness
(Integer shadowSoftness) Softness, or degree of blurring, of the shadow.setShadowSpread
(Integer shadowSpread) Explicit spread for the css-based drop shadow shown ifuseCSSShadow
is true andshowShadow
is true.setShadowVOffset
(Integer shadowVOffset) Vertical offset for theshadow
.setShouldPrint
(Boolean shouldPrint) Whether this canvas should be included in a printable view.setShowCustomScrollbars
(boolean showCustomScrollbars) Whether to use the browser's native scrollbars or Smart GWT-based scrollbars.setShowDragShadow
(Boolean showDragShadow) When this widget is dragged, if its dragAppearance is"target"
, should we show a shadow behind the canvas during the drag.setShowEdges
(Boolean showEdges) Whether anEdgedCanvas
should be used to show image-based edges around this component.setShowHover
(Boolean showHover) Ifthis.canHover
is true, should we show the global hover canvas by default when the user hovers over this canvas?setShowHoverComponents
(Boolean showHoverComponents) When set to true, shows a widget hovering at the mouse point instead of the builtin hover label.setShowPointer
(Boolean showPointer) Should a pointer be shown? A pointer can be placed on the border to identify the target of the canvas contents.setShowResizeBar
(Boolean showResizeBar) When this Canvas is included as a member in aLayout
, whether a resizeBar should be shown after this member in the layout, to allow it to be resized.setShowShadow
(Boolean showShadow) Whether to show a drop shadow for this Canvas.setShowSnapGrid
(Boolean showSnapGrid) Whether to show a snap grid for this Canvas.setShrinkElementOnHide
(boolean shrinkElementOnHide) This is an advanced setting.setSizeMayChangeOnRedraw
(Boolean sizeMayChangeOnRedraw) Is it possible that a call toredraw()
on this widget will change its size?setSkinImgDir
(String skinImgDir) Default directory for skin images (those defined by the class), relative to the Page-wideskinDir
.setSmoothFade
(Boolean smoothFade) setSnapAlignCandidates
(Canvas... snapAlignCandidates) WhenchildrenSnapAlign
is enabled, list of candidates to check for alignment.setSnapAlignCenterLineStyle
(String snapAlignCenterLineStyle) CSS border declaration used for the line shown to indicate snapping to a center line whenchildrenSnapAlign
is set.setSnapAlignEdgeLineStyle
(String snapAlignEdgeLineStyle) CSS border declaration used for the line shown to indicate snapping to a edge line whenchildrenSnapAlign
is set.setSnapAxis
(String snapAxis) Describes which axes to apply snap-to-grid to.setSnapEdge
(String snapEdge) IfsnapTo
is defined to this widget, this property can be used to define which edge of this widget should be snapped to an edge of the master or parent element.setSnapGridLineProperties
(DrawLine snapGridLineProperties) Specifies line styling to use when drawing the grid of lines forSnapGridStyle
: "lines".setSnapGridStyle
(SnapGridStyle snapGridStyle) Specifies indication style to use for snap points, either a grid of lines or an array of crosses.setSnapHDirection
(String snapHDirection) The horizontal snap direction.setSnapHGap
(int snapHGap) The horizontal grid size to use, in pixels, when snap-to-grid is enabled.setSnapOffsetLeft
(Integer snapOffsetLeft) IfsnapTo
is defined for this widget, this property can be used to specify an offset in px or percentage for the left coordinate of this widget.setSnapOffsetTop
(Integer snapOffsetTop) IfsnapTo
is defined for this widget, this property can be used to specify an offset in px or percentage for the top coordinate of this widget.setSnapOnDrop
(Boolean snapOnDrop) When this canvas is dropped onto an object supporting snap-to-grid, should it snap to the grid (true, the default) or just drop wherever the mouse is (false).setSnapResizeToAlign
(Boolean snapResizeToAlign) Flag to disable snapping to alignment when this Canvas is resized.setSnapResizeToGrid
(Boolean snapResizeToGrid) Causes this canvas to snap to its parent's grid when resizing.Position this widget such that it is aligned with ("snapped to") an edge of itsmaster
(if specified), or itsparent canvas
.setSnapToAlign
(Boolean snapToAlign) Flag to disable snapping to alignment when this Canvas is dragged whenchildrenSnapAlign
is enabled on this Canvas' parent.setSnapToCenterAlign
(Boolean snapToCenterAlign) Flag to disable snapping to center alignment when this Canvas is dragged whenchildrenSnapAlign
is enabled on this Canvas' parent.setSnapToEdgeAlign
(Boolean snapToEdgeAlign) Flag to disable snapping to edge alignment when this Canvas is dragged whenchildrenSnapAlign
is enabled on this Canvas' parent.setSnapToGrid
(Boolean snapToGrid) Causes this canvas to snap to its parent's grid when dragging.setSnapVDirection
(String snapVDirection) The vertical snap direction.setSnapVGap
(int snapVGap) The vertical grid size to use, in pixels, when snap-to-grid is enabled.setStartLine
(Boolean startLine) Whether this canvas should always start a new line when used as a tile in aFlowLayout
.void
setStyleName
(String styleName) The CSS class applied to this widget as a whole.setTabIndex
(Integer tabIndex) If specified this governs the tabIndex of the widget in the page's tab order.setTestDataContext
(DataContext testDataContext) ADataContext
to be used if nodataContext
is provided (directly or indirectly via a parent).void
Synonym forsetPrompt(String)
setTooltip
(String tooltip) Synonym forsetPrompt(String)
setTop
(int top) Number of pixels the top of the widget is offset down from its default drawing context (either its parent's top-left corner, or the document flow, depending on the value of theposition
property).Number of pixels the top of the widget is offset down from its default drawing context (either its parent's top-left corner, or the document flow, depending on the value of theposition
property).setUpdateTabPositionOnDraw
(boolean updateTabPositionOnDraw) Should canvases with noparent canvas
be moved to the end of the TabIndexManager tree on draw()?setUpdateTabPositionOnReparent
(boolean updateTabPositionOnReparent) Should canvases with aparent canvas
be added to the TabIndexManager under the parent as described inupdateChildTabPositions()
andupdateChildTabPosition()
?setUseBackMask
(Boolean useBackMask) In earlier versions of Internet Explorer (pre IE9), a native limitation exists whereby if HTML elements are overlapping on the page, certain elements can appear to "burn through" elements in the same position with a higher z-index.setUseCSSShadow
(boolean useCSSShadow) IfshowShadow
is true, should we use the cssbox-shadow
property (where supported) to achieve the shadow?setUseDragMask
(boolean useDragMask) This flag controls whether we register the component as a maskable item with the EventHandler.setUseImageForSVG
(boolean useImageForSVG) If set, forces the main SVG image or icon in the canvas to be rendered in an image tag rather than an object tag, the default.setUseNativeDrag
(Boolean useNativeDrag) If set, native HTML5 drag and drop will be used for all drags initiated on this widget (on browsers where this is supported), and native HTML5 drop events occurring over this widget will be processed.setUseOpacityFilter
(Boolean useOpacityFilter) Configures where the Opacity filter is used for IE6-8.setUseTouchScrolling
(Boolean useTouchScrolling) Ontouch devices
, if thisCanvas
can be scrolled, should touch-dragging the content area result in scrolling? Set tofalse
if touch-dragging should not cause scrolling.setValuesManager
(ValuesManager valuesManager) ValuesManager
for managing values displayed in this component.setValuesManager
(String valuesManager) ValuesManager
for managing values displayed in this component.setVisibility
(Visibility visibility) Controls widget visibility when the widget is initialized.void
setVisible
(boolean visible) setVisibleWhen
(AdvancedCriteria visibleWhen) Criteria to be evaluated to determine whether this Canvas should be visible.setWidth
(int width) Thecanvas.width
attribute specifies the size for a component's horizontal dimension;canvas.height
specifies the size for the vertical dimension.void
Thecanvas.width
attribute specifies the size for a component's horizontal dimension;canvas.height
specifies the size for the vertical dimension.Convenience method that sets the width to 100%.setWorkflows
(Process... workflows) List of screen-globalworkflows
that can be shared by event handler workflows using aStartProcessTask
.setZIndex
(int newIndex) Set the z-Index of the canvas.void
If this widget is showing scrollbars, and a user drags close to the edge of the viewport, should we scroll the viewport in the appropriate direction? Returns this.canDragScroll if there are scrollbars, else false.void
show()
Sets this widget's visibility to "inherit", so that it becomes visible if all of its parents are visible or it has no parents.showClickMask
(Function clickActionCallback, ClickMaskMode mode, Canvas[] unmaskedTargets) Show a clickMask over the entire screen that intercepts mouse clicks and fires some action.void
Temporariy block all user interaction with children of this widget, with the exception of those passed in in theunmaskedChildren
parameter.void
showComponentMask
(Canvas... unmaskedChildren) Temporariy block all user interaction with children of this widget, with the exception of those passed in in theunmaskedChildren
parameter.void
showNextTo
(Canvas otherWidget) Show this widget next to another widget on the page, positioned such that it will not extend beyond the browser viewport.void
showNextTo
(Canvas otherWidget, String side) void
showNextTo
(Canvas otherWidget, String side, boolean canOcclude) void
showNextTo
(Canvas otherWidget, String side, boolean canOcclude, boolean skipAnimation) Show this widget next to another widget on the page, positioned such that it will not extend beyond the browser viewport.void
Manually move this component into the "pending changes" visual state (based on thependingMarker style
, or the Pending suffix in stateful components).static void
showPrintPreview
(Canvas component) Show a PrintWindow containing a printable view of the component passed in containing print HTML.static void
showPrintPreview
(Object[] components) Show a Print containing a printable view of the components passed in.static void
showPrintPreview
(Object[] components, PrintProperties printProperties, String title, PrintPreviewCallback callback) Show a Print containing a printable view of the components passed in.static void
showPrintPreview
(Object[] components, PrintProperties printProperties, String title, PrintPreviewCallback callback, Window printWindowProperties, String printButtonTitle) Show a Print containing a printable view of the components passed in.void
Recursively show the canvas and all its parents so the canvas will be visible.static void
startDebuggingOverflow
(DebugOverflowSettings settings) Start to track and report excessive overflow per the supplied settings.static void
Stop tracking and reporting excessive overflow.void
updateChildTabPosition
(Canvas child) Ensure that a specific child is slotted correctly into the page's tab order.void
Update the childrens' tab positions, slotting them under this widget in theTabIndexManager
, in the order defined bygetChildTabPosition()
.void
updateEditNode
(EditContext editContext, EditNode editNode) A callback invoked for eachliveObject
byEditContext
when the EditContext is being serialized.void
If this canvas is currently showing a hover (seehandleHover()
), this method can be called to update the HTML contents of the hover.void
updateHover
(String hoverHTML) If this canvas is currently showing a hover (seehandleHover()
), this method can be called to update the HTML contents of the hover.void
Update the canvas shadow.void
This method is executed on draw.visibleAtPoint
(int x, int y, boolean withinViewport, Canvas ignoreWidgets, Canvas upToParent) Does this widget contain the specified global (x,y) coordinates, and have no other widgets also at the specified position, obscuring this one? This is commonly used for (for example) drag and drop interactions.Returns true if the widget object being dragged can be dropped on this widget, and false or null otherwise.Methods inherited from class com.smartgwt.client.widgets.BaseWidget
addDrawHandler, addDynamicProperty, addDynamicProperty, addDynamicProperty, addDynamicProperty, applyFactoryProperties, clearDynamicProperty, completeCreation, destroy, doAddHandler, doInit, doOnRender, draw, equals, error, errorIfNotCreated, getAttribute, getAttributeAsBoolean, getAttributeAsDate, getAttributeAsDateArray, getAttributeAsDouble, getAttributeAsElement, getAttributeAsFloat, getAttributeAsFloatArray, getAttributeAsInt, getAttributeAsIntArray, getAttributeAsJavaScriptObject, getAttributeAsMap, getAttributeAsObject, getAttributeAsRecord, getAttributeAsString, getAttributeAsStringArray, getConfig, getDOM, getHandlerCount, getID, getInnerHTML, getJsObj, getOrCreateJsObj, getRef, getScClassName, hasAutoAssignedID, hasDynamicProperty, hashCode, initNativeObject, internalSetID, internalSetID, isConfigOnly, isCreated, isDrawn, isFactoryCreated, onBind, onDestroy, onDraw, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setConfig, setConfigOnly, setDefaultProperties, setDragTracker, setFactoryCreated, 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, onBrowserEvent, onLoad, onUnload, removeFromParent, setLayoutData, sinkEvents, unsinkEvents
Methods inherited from class com.google.gwt.user.client.ui.UIObject
addStyleDependentName, ensureDebugId, ensureDebugId, ensureDebugId, getStyleElement, getStyleName, getStylePrimaryName, getStylePrimaryName, isVisible, onEnsureDebugId, removeStyleDependentName, removeStyleName, resolvePotentialElement, setElement, setPixelSize, setSize, setStyleDependentName, setStyleName, setStyleName, setStyleName, setStylePrimaryName, setStylePrimaryName, setVisible, 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
-
Canvas
public Canvas() -
Canvas
-
Canvas
-
-
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:
-
create
- Overrides:
create
in classBaseWidget
-
setAccessKey
If specified this governs the HTML accessKey for the widget.This should be set to a character - when a user hits the html accessKey modifier for the browser, plus this character, focus will be given to the widget in question. The accessKey modifier can vary by browser and platform.
The following list of default behavior is for reference only, developers should also consult browser documentation for additional information.
- Internet Explorer (all
platforms):
Alt
+ accessKey - Mozilla Firefox (Windows, Unix):
Alt+Shift
+ accessKey - Mozilla Firefox (Mac):
Ctrl+Opt
+ accessKey - Chrome and Safari (Windows, Unix):
Alt
+ accessKey - Chrome and Safari (Mac):
Ctrl+Opt
+ accessKey
If this method is called after the component has been drawn/initialized: Set the accessKey for this canvas.The accessKey can be set to any alphanumeric character (symbols not supported) Having set an accessKey, the canvas will be given focus when the user hits Alt+[accessKey], or in Mozilla Firefox 2.0 and above, Shift+Alt+[accessKey].
Note : This is an advanced setting
- Internet Explorer (all
platforms):
-
getAccessKey
If specified this governs the HTML accessKey for the widget.This should be set to a character - when a user hits the html accessKey modifier for the browser, plus this character, focus will be given to the widget in question. The accessKey modifier can vary by browser and platform.
The following list of default behavior is for reference only, developers should also consult browser documentation for additional information.
- Internet Explorer (all
platforms):
Alt
+ accessKey - Mozilla Firefox (Windows, Unix):
Alt+Shift
+ accessKey - Mozilla Firefox (Mac):
Ctrl+Opt
+ accessKey - Chrome and Safari (Windows, Unix):
Alt
+ accessKey - Chrome and Safari (Mac):
Ctrl+Opt
+ accessKey
- Returns:
- Current accessKey value. Default value is null
- See Also:
- Internet Explorer (all
platforms):
-
setAdaptiveHeightPriority
public Canvas setAdaptiveHeightPriority(Integer adaptiveHeightPriority) throws IllegalStateException - Parameters:
adaptiveHeightPriority
- New adaptiveHeightPriority value. Default value is null- Returns:
Canvas
instance, for chaining setter calls- Throws:
IllegalStateException
- this property cannot be changed after the component has been created
-
getAdaptiveHeightPriority
- Returns:
- Current adaptiveHeightPriority value. Default value is null
-
setAdaptiveWidthPriority
If multiple widgets in the same Layout haveadaptive width
,adaptiveWidthPriority
can be set to indicate which of the components should be given priority access to space.The widget with the highest priority setting will be offered surplus space first, and asked to give up space last. Lack of a priority setting is treated as zero. Any adaptive widgets with the same priority setting will be asked to give up or release space according to their order in
Layout.members
.- Parameters:
adaptiveWidthPriority
- New adaptiveWidthPriority value. Default value is null- Returns:
Canvas
instance, for chaining setter calls- Throws:
IllegalStateException
- this property cannot be changed after the component has been created- See Also:
-
getAdaptiveWidthPriority
If multiple widgets in the same Layout haveadaptive width
,adaptiveWidthPriority
can be set to indicate which of the components should be given priority access to space.The widget with the highest priority setting will be offered surplus space first, and asked to give up space last. Lack of a priority setting is treated as zero. Any adaptive widgets with the same priority setting will be asked to give up or release space according to their order in
Layout.members
.- Returns:
- Current adaptiveWidthPriority value. Default value is null
- See Also:
-
setAlwaysShowScrollbars
Should this browser always show custom scrollbars ifshowCustomScrollbars
is true?On
touch devices
that support native touch scrolling, ifshowCustomScrollbars
istrue
and touch scrolling has not been disabled by theuseTouchScrolling
and/ordisableTouchScrollingForDrag
settings, should custom scrollbars and native touch scrolling be enabled for this component? Iffalse
or unset, then only native touch scrolling will be enabled. Iftrue
, then both scrolling mechanisms will be enabled.NOTE: Because native touch scrolling (also called momentum scrolling) is computationally intensive, some mobile browsers implement an optimization where the state of the DOM for the element being scrolled will be frozen or partially frozen during the scroll animation. This results in a delay between when the scroll position reaches a certain point in the animation and when the positions of the custom scrollbar thumbs are updated to reflect that scroll position.
For non-touch devices, setting this property to
true
will overridenativeAutoHideScrollbars
, and ensure custom scrollbars are shown for the componentNote : This is an advanced setting
- Parameters:
alwaysShowScrollbars
- New alwaysShowScrollbars value. Default value is null- Returns:
Canvas
instance, for chaining setter calls- Throws:
IllegalStateException
- this property cannot be changed after the component has been created- See Also:
-
getAlwaysShowScrollbars
Should this browser always show custom scrollbars ifshowCustomScrollbars
is true?On
touch devices
that support native touch scrolling, ifshowCustomScrollbars
istrue
and touch scrolling has not been disabled by theuseTouchScrolling
and/ordisableTouchScrollingForDrag
settings, should custom scrollbars and native touch scrolling be enabled for this component? Iffalse
or unset, then only native touch scrolling will be enabled. Iftrue
, then both scrolling mechanisms will be enabled.NOTE: Because native touch scrolling (also called momentum scrolling) is computationally intensive, some mobile browsers implement an optimization where the state of the DOM for the element being scrolled will be frozen or partially frozen during the scroll animation. This results in a delay between when the scroll position reaches a certain point in the animation and when the positions of the custom scrollbar thumbs are updated to reflect that scroll position.
For non-touch devices, setting this property to
true
will overridenativeAutoHideScrollbars
, and ensure custom scrollbars are shown for the component- Returns:
- Current alwaysShowScrollbars value. Default value is null
- See Also:
-
setAnimateAcceleration
Default acceleration effect to apply to all animations on this Canvas. Can be overridden by setting animationAcceleration for specific animations or by passing an acceleration function directly into the appropriate method.Note : This is an advanced setting
- Parameters:
animateAcceleration
- New animateAcceleration value. Default value is "smoothEnd"- Returns:
Canvas
instance, for chaining setter calls
-
getAnimateAcceleration
Default acceleration effect to apply to all animations on this Canvas. Can be overridden by setting animationAcceleration for specific animations or by passing an acceleration function directly into the appropriate method.- Returns:
- Current animateAcceleration value. Default value is "smoothEnd"
-
setAnimateFadeTime
Default time for performing an animated fade. If unset,this.animateTime
will be used by default insteadNote : This is an advanced setting
- Parameters:
animateFadeTime
- New animateFadeTime value. Default value is null- Returns:
Canvas
instance, for chaining setter calls
-
getAnimateFadeTime
Default time for performing an animated fade. If unset,this.animateTime
will be used by default instead- Returns:
- Current animateFadeTime value. Default value is null
-
setAnimateHideAcceleration
Default acceleration function for performing an animated hide. If unset,this.animateAcceleration
will be used by default insteadNote : This is an advanced setting
- Parameters:
animateHideAcceleration
- New animateHideAcceleration value. Default value is null- Returns:
Canvas
instance, for chaining setter calls
-
getAnimateHideAcceleration
Default acceleration function for performing an animated hide. If unset,this.animateAcceleration
will be used by default instead- Returns:
- Current animateHideAcceleration value. Default value is null
-
setAnimateHideTime
Default time for performing an animated hide. If unset,this.animateTime
will be used by default insteadNote : This is an advanced setting
- Parameters:
animateHideTime
- New animateHideTime value. Default value is null- Returns:
Canvas
instance, for chaining setter calls
-
getAnimateHideTime
Default time for performing an animated hide. If unset,this.animateTime
will be used by default instead- Returns:
- Current animateHideTime value. Default value is null
-
setAnimateMoveAcceleration
Default acceleration effect for performing an animated move. If unset,this.animateAcceleration
will be used by default insteadNote : This is an advanced setting
- Parameters:
animateMoveAcceleration
- New animateMoveAcceleration value. Default value is null- Returns:
Canvas
instance, for chaining setter calls
-
getAnimateMoveAcceleration
Default acceleration effect for performing an animated move. If unset,this.animateAcceleration
will be used by default instead- Returns:
- Current animateMoveAcceleration value. Default value is null
-
setAnimateMoveTime
Default time for performing an animated move. If unset,this.animateTime
will be used by default insteadNote : This is an advanced setting
- Parameters:
animateMoveTime
- New animateMoveTime value. Default value is null- Returns:
Canvas
instance, for chaining setter calls
-
getAnimateMoveTime
Default time for performing an animated move. If unset,this.animateTime
will be used by default instead- Returns:
- Current animateMoveTime value. Default value is null
-
setAnimateRectAcceleration
Default acceleration function for performing an animated move and resize. If unset,this.animateAcceleration
will be used by default insteadNote : This is an advanced setting
- Parameters:
animateRectAcceleration
- New animateRectAcceleration value. Default value is null- Returns:
Canvas
instance, for chaining setter calls
-
getAnimateRectAcceleration
Default acceleration function for performing an animated move and resize. If unset,this.animateAcceleration
will be used by default instead- Returns:
- Current animateRectAcceleration value. Default value is null
-
setAnimateRectTime
Default time for performing an animated setRect. If unset,this.animateTime
will be used by default insteadNote : This is an advanced setting
- Parameters:
animateRectTime
- New animateRectTime value. Default value is null- Returns:
Canvas
instance, for chaining setter calls
-
getAnimateRectTime
Default time for performing an animated setRect. If unset,this.animateTime
will be used by default instead- Returns:
- Current animateRectTime value. Default value is null
-
setAnimateResizeAcceleration
Default acceleration function for performing an animated resize. If unset,this.animateAcceleration
will be used by default insteadNote : This is an advanced setting
- Parameters:
animateResizeAcceleration
- New animateResizeAcceleration value. Default value is null- Returns:
Canvas
instance, for chaining setter calls
-
getAnimateResizeAcceleration
Default acceleration function for performing an animated resize. If unset,this.animateAcceleration
will be used by default instead- Returns:
- Current animateResizeAcceleration value. Default value is null
-
setAnimateResizeLayoutMode
When to update thechild layout
for asize animation
. Updating the child layout more often may improve appearance, but risks prohibitive overhead with more complicated widget hierarchies.Note : This is an advanced setting
- Parameters:
animateResizeLayoutMode
- New animateResizeLayoutMode value. Default value is "atEnd"- Returns:
Canvas
instance, for chaining setter calls
-
getAnimateResizeLayoutMode
When to update thechild layout
for asize animation
. Updating the child layout more often may improve appearance, but risks prohibitive overhead with more complicated widget hierarchies.- Returns:
- Current animateResizeLayoutMode value. Default value is "atEnd"
-
setAnimateResizeTime
Default time for performing an animated resize. If unset,this.animateTime
will be used by default insteadNote : This is an advanced setting
- Parameters:
animateResizeTime
- New animateResizeTime value. Default value is null- Returns:
Canvas
instance, for chaining setter calls
-
getAnimateResizeTime
Default time for performing an animated resize. If unset,this.animateTime
will be used by default instead- Returns:
- Current animateResizeTime value. Default value is null
-
setAnimateScrollAcceleration
Default acceleration function for performing an animated scroll. If unset,this.animateAcceleration
will be used by default insteadNote : This is an advanced setting
- Parameters:
animateScrollAcceleration
- New animateScrollAcceleration value. Default value is null- Returns:
Canvas
instance, for chaining setter calls
-
getAnimateScrollAcceleration
Default acceleration function for performing an animated scroll. If unset,this.animateAcceleration
will be used by default instead- Returns:
- Current animateScrollAcceleration value. Default value is null
-
setAnimateScrollTime
Default time for performing an animated scroll. If unset,this.animateTime
will be used by default insteadNote : This is an advanced setting
- Parameters:
animateScrollTime
- New animateScrollTime value. Default value is null- Returns:
Canvas
instance, for chaining setter calls
-
getAnimateScrollTime
Default time for performing an animated scroll. If unset,this.animateTime
will be used by default instead- Returns:
- Current animateScrollTime value. Default value is null
-
setAnimateShowAcceleration
Default acceleration function for performing an animated show. If unset,this.animateAcceleration
will be used by default insteadNote : This is an advanced setting
- Parameters:
animateShowAcceleration
- New animateShowAcceleration value. Default value is null- Returns:
Canvas
instance, for chaining setter calls
-
getAnimateShowAcceleration
Default acceleration function for performing an animated show. If unset,this.animateAcceleration
will be used by default instead- Returns:
- Current animateShowAcceleration value. Default value is null
-
setAnimateShowTime
Default time for performing an animated show. If unset,this.animateTime
will be used by default insteadNote : This is an advanced setting
- Parameters:
animateShowTime
- New animateShowTime value. Default value is null- Returns:
Canvas
instance, for chaining setter calls
-
getAnimateShowTime
Default time for performing an animated show. If unset,this.animateTime
will be used by default instead- Returns:
- Current animateShowTime value. Default value is null
-
setAnimateTime
Default total duration of animations. Can be overridden by setting animation times for specific animations, or by passing aduration
parameter into the appropriate animate...() method.Note : This is an advanced setting
- Parameters:
animateTime
- New animateTime value. Default value is 300- Returns:
Canvas
instance, for chaining setter calls- See Also:
-
getAnimateTime
public int getAnimateTime()Default total duration of animations. Can be overridden by setting animation times for specific animations, or by passing aduration
parameter into the appropriate animate...() method.- Returns:
- Current animateTime value. Default value is 300
- See Also:
-
setAppImgDir
Default directory for app-specific images, relative to the Page-wideappImgDir
.Note : This is an advanced setting
- Parameters:
appImgDir
- New appImgDir value. Default value is ""- Returns:
Canvas
instance, for chaining setter calls- See Also:
-
getAppImgDir
Default directory for app-specific images, relative to the Page-wideappImgDir
.- Returns:
- Current appImgDir value. Default value is ""
- See Also:
-
setAriaRole
ARIA role of this component. Usually does not need to be manually set - seeAccessibility
.- Parameters:
ariaRole
- New ariaRole value. Default value is null- Returns:
Canvas
instance, for chaining setter calls- Throws:
IllegalStateException
- this property cannot be changed after the component has been created- See Also:
-
getAriaRole
ARIA role of this component. Usually does not need to be manually set - seeAccessibility
.- Returns:
- Current ariaRole value. Default value is null
- See Also:
-
setAutoMaskComponents
Deprecated.As of Smart GWT version 10.0, deprecated in favor ofEditProxy.autoMaskChildren
When nodes are added to an EditContext, should they be masked by settingEditProxy.useEditMask
true
if not explicitly set?- Parameters:
autoMaskComponents
- New autoMaskComponents value. Default value is null- Returns:
Canvas
instance, for chaining setter calls- Throws:
IllegalStateException
- this property cannot be changed after the component has been created
-
getAutoMaskComponents
Deprecated.As of Smart GWT version 10.0, deprecated in favor ofEditProxy.autoMaskChildren
When nodes are added to an EditContext, should they be masked by settingEditProxy.useEditMask
true
if not explicitly set?- Returns:
- Current autoMaskComponents value. Default value is null
-
setAutoParent
This initialization property allows developers to create a canvas using the Class.addAutoChild() method, and have it added as a child to some other component. This property may be set to thechildName
of another already-created auto-child, or"none"
to cause the component to be created without being added as a child to any other widget.
If unset, the canvas will be added as a child to the component on whichaddAutoChild(...)
was called.See
autoChildren
for an overview of the autoChild subsystem.Note : This is an advanced setting
- Parameters:
autoParent
- New autoParent value. Default value is null- Returns:
Canvas
instance, for chaining setter calls- Throws:
IllegalStateException
- this property cannot be changed after the component has been created
-
getAutoParent
This initialization property allows developers to create a canvas using the Class.addAutoChild() method, and have it added as a child to some other component. This property may be set to thechildName
of another already-created auto-child, or"none"
to cause the component to be created without being added as a child to any other widget.
If unset, the canvas will be added as a child to the component on whichaddAutoChild(...)
was called.See
autoChildren
for an overview of the autoChild subsystem.- Returns:
- Current autoParent value. Default value is null
-
setAutoPopulateData
If adataContext
is provided, should subcomponents automatically bind to the data?In general, if you provide a
primaryKey
value for a record, that specific record will be shown or edited, or have its related records loaded. If you provide other field values without the primaryKey value, those values will be treated as either criteria (for a grid) or as initial values (for a form).Components will respond to
dataContext
differently depending on whether they typically work with just a single record (such asform
or aDetailViewer
), or whether they usually work with lists of records (such asListGrid
orTileGrid
, which havecomponent.dataArity
set tomultipe
by default).Specifically, the following rules are used:
- for a singular component (eg forms,
detailViewers):
- if only the PK (primary key) value is provided, the component will fetch the singular record and display or edit it
- if the PK is provided along with other values, the component will assume it has a complete record, and display or edit it
- if only non-PK values are provided, the component will assume these are initial values
- for a multiple component (eg listGrid,
tileGrid):
- if only non-PK values are provided, the component will use these as criteria.
For example, a grid bound to an Orders DataSource with
dataContext
of Status:"In Process" would fetch records with that status - if the PK is provided, and the component's
DataSource is related to one of the DataSources in the
dataContext
, related records will be fetched, using the PK value (similarly to iffetchRelatedData()
had been called. For example, if an orderNumber value was provided, a grid bound to OrderDetail would fetch line items for that orderNumber. - if an array of multiple records is provided, that data is used as if setData() had been called on the component
- if only non-PK values are provided, the component will use these as criteria.
For example, a grid bound to an Orders DataSource with
autoPopulateData
to false on the specific component that should not be auto-populated.Specific examples, using the Order and OrderDetail sample DataSources, where OrderDetail records are associated (many-to-1) with Order records, and the PK of Order is orderNumber:
- a
form or DetailViewer bound to Order and a ListGrid bound to OrderDetail:
- if an orderNumber is provided, the form or DetailViewer would show that order, and the grid would show related OrderDetail records
- if only orderNumber is provided (no additional fields), the full Order record is automatically fetched for the form or DetailViewer
This fulfills a common use case of viewing or editing an Order and its related OrderDetail records.
- a grid bound to Order and a second grid bound to OrderDetail
- if values such as orderStatus : "On Hold" were provided, the Order grid uses those as criteria
- the OrderDetail grid does nothing
This fulfills a common use case of viewing Order records that match certain criteria. The OrderDetail grid would generally be populated only by an event handler installed on the Order grid, which would call
fetchRelatedData
. - a grid and form both bound
to Order
- if values such as orderStatus : "On Hold" were provided, the Order grid uses those as criteria, and the form uses those as initial values
This fulfills two possible use cases:
- the form is a SearchForm for searching the grid, so it should show the same criteria as are applied to the grid
- the form is for editing the selected record in
the grid, or adding new ones. It is ready to either add a new record, or for the user to select a record to
show in the form, typically via logic added to the grid (e.g.
recordClick
->form.editSelectedData()
.
By default,
autoPopulateData
is true for any component that is contained with a "screen"RPCManager.createScreen()
and false for any component that is ancom.smartgwt.client.types.AutoChild
.Note that, if there is a non-DBC in your screen that wants to access fields in the expected dataContext, the DynamicProperty can refer to properties that auto-populated DBCs will place into the ruleContext. For example, with a DynamicForm "itemEditor" bound to "supplyItem", a header above could use itemEditor.values.itemName to display the name of the item. The header will then show the expected value as soon as the DynamicForm is auto-populated.
Similarly, the
DataView.drawn()
StringMethod fires after auto-population has occurred, so any startup actions in a screen will likewise be able to utilize data from thedataContext
by just referring to it viaruleScope
.- Parameters:
autoPopulateData
- New autoPopulateData value. Default value is null- Returns:
Canvas
instance, for chaining setter calls- Throws:
IllegalStateException
- this property cannot be changed after the component has been created
- for a singular component (eg forms,
detailViewers):
-
getAutoPopulateData
If adataContext
is provided, should subcomponents automatically bind to the data?In general, if you provide a
primaryKey
value for a record, that specific record will be shown or edited, or have its related records loaded. If you provide other field values without the primaryKey value, those values will be treated as either criteria (for a grid) or as initial values (for a form).Components will respond to
dataContext
differently depending on whether they typically work with just a single record (such asform
or aDetailViewer
), or whether they usually work with lists of records (such asListGrid
orTileGrid
, which havecomponent.dataArity
set tomultipe
by default).Specifically, the following rules are used:
- for a singular component (eg forms,
detailViewers):
- if only the PK (primary key) value is provided, the component will fetch the singular record and display or edit it
- if the PK is provided along with other values, the component will assume it has a complete record, and display or edit it
- if only non-PK values are provided, the component will assume these are initial values
- for a multiple component (eg listGrid,
tileGrid):
- if only non-PK values are provided, the component will use these as criteria.
For example, a grid bound to an Orders DataSource with
dataContext
of Status:"In Process" would fetch records with that status - if the PK is provided, and the component's
DataSource is related to one of the DataSources in the
dataContext
, related records will be fetched, using the PK value (similarly to iffetchRelatedData()
had been called. For example, if an orderNumber value was provided, a grid bound to OrderDetail would fetch line items for that orderNumber. - if an array of multiple records is provided, that data is used as if setData() had been called on the component
- if only non-PK values are provided, the component will use these as criteria.
For example, a grid bound to an Orders DataSource with
autoPopulateData
to false on the specific component that should not be auto-populated.Specific examples, using the Order and OrderDetail sample DataSources, where OrderDetail records are associated (many-to-1) with Order records, and the PK of Order is orderNumber:
- a
form or DetailViewer bound to Order and a ListGrid bound to OrderDetail:
- if an orderNumber is provided, the form or DetailViewer would show that order, and the grid would show related OrderDetail records
- if only orderNumber is provided (no additional fields), the full Order record is automatically fetched for the form or DetailViewer
This fulfills a common use case of viewing or editing an Order and its related OrderDetail records.
- a grid bound to Order and a second grid bound to OrderDetail
- if values such as orderStatus : "On Hold" were provided, the Order grid uses those as criteria
- the OrderDetail grid does nothing
This fulfills a common use case of viewing Order records that match certain criteria. The OrderDetail grid would generally be populated only by an event handler installed on the Order grid, which would call
fetchRelatedData
. - a grid and form both bound
to Order
- if values such as orderStatus : "On Hold" were provided, the Order grid uses those as criteria, and the form uses those as initial values
This fulfills two possible use cases:
- the form is a SearchForm for searching the grid, so it should show the same criteria as are applied to the grid
- the form is for editing the selected record in
the grid, or adding new ones. It is ready to either add a new record, or for the user to select a record to
show in the form, typically via logic added to the grid (e.g.
recordClick
->form.editSelectedData()
.
By default,
autoPopulateData
is true for any component that is contained with a "screen"RPCManager.createScreen()
and false for any component that is ancom.smartgwt.client.types.AutoChild
.Note that, if there is a non-DBC in your screen that wants to access fields in the expected dataContext, the DynamicProperty can refer to properties that auto-populated DBCs will place into the ruleContext. For example, with a DynamicForm "itemEditor" bound to "supplyItem", a header above could use itemEditor.values.itemName to display the name of the item. The header will then show the expected value as soon as the DynamicForm is auto-populated.
Similarly, the
DataView.drawn()
StringMethod fires after auto-population has occurred, so any startup actions in a screen will likewise be able to utilize data from thedataContext
by just referring to it viaruleScope
.- Returns:
- Current autoPopulateData value. Default value is null
- for a singular component (eg forms,
detailViewers):
-
setAutoShowParent
If set to true, the widget's parent (if any) will automatically be shown whenever the widget is shown.Note : This is an advanced setting
- Parameters:
autoShowParent
- New autoShowParent value. Default value is false- Returns:
Canvas
instance, for chaining setter calls- See Also:
-
getAutoShowParent
If set to true, the widget's parent (if any) will automatically be shown whenever the widget is shown.- Returns:
- Current autoShowParent value. Default value is false
- See Also:
-
setBackgroundColor
The background color for this widget. It corresponds to the CSS background-color attribute. You can set this property to an RGB value (e.g. #22AAFF) or a named color (e.g. red) from a list of browser supported color names.
If this method is called after the component has been drawn/initialized: Sets the background color of this component tonewColor
.- Parameters:
backgroundColor
- new background color, ornull
to remove the current background color. Default value is null- Returns:
Canvas
instance, for chaining setter calls- See Also:
-
getBackgroundColor
The background color for this widget. It corresponds to the CSS background-color attribute. You can set this property to an RGB value (e.g. #22AAFF) or a named color (e.g. red) from a list of browser supported color names.- Returns:
- Current backgroundColor value. Default value is null
- See Also:
-
setBackgroundImage
URL for a background image for this widget (corresponding to the CSS "background-image" attribute).
If this method is called after the component has been drawn/initialized: Sets the background to an image file given by newImage. This URL should be given as a string relative to the image directory for the page (./images by default).- Parameters:
backgroundImage
- new URL (local to Page image directory) for background image. Default value is null- Returns:
Canvas
instance, for chaining setter calls- See Also:
-
getBackgroundImage
URL for a background image for this widget (corresponding to the CSS "background-image" attribute).- Returns:
- Current backgroundImage value. Default value is null
- See Also:
-
setBackgroundPosition
Specifies how the background image should be positioned on the widget. It corresponds to the CSS background-position attribute. If unset, no background-position attribute is specified if a background image is specified.- Parameters:
backgroundPosition
- New backgroundPosition value. Default value is null- Returns:
Canvas
instance, for chaining setter calls- Throws:
IllegalStateException
- this property cannot be changed after the component has been created- See Also:
-
getBackgroundPosition
Specifies how the background image should be positioned on the widget. It corresponds to the CSS background-position attribute. If unset, no background-position attribute is specified if a background image is specified.- Returns:
- Current backgroundPosition value. Default value is null
- See Also:
-
setBackgroundRepeat
Specifies how the background image should be tiled if this widget is larger than the image. It corresponds to the CSSbackground-repeat
attribute.The default of null means no
background-repeat
CSS will be written out. SeeBackgroundRepeat
type for details on other settings.NOTE: this setting directly sets the CSS property
background-repeat
but does not attempt to work around various known bugs with this setting, or lack of support in IE6. If you need to apply CSS-based workarounds for browser limitations with this setting, it's best to do so via settingstyleName
.- Parameters:
backgroundRepeat
- New backgroundRepeat value. Default value is null- Returns:
Canvas
instance, for chaining setter calls- See Also:
-
getBackgroundRepeat
Specifies how the background image should be tiled if this widget is larger than the image. It corresponds to the CSSbackground-repeat
attribute.The default of null means no
background-repeat
CSS will be written out. SeeBackgroundRepeat
type for details on other settings.NOTE: this setting directly sets the CSS property
background-repeat
but does not attempt to work around various known bugs with this setting, or lack of support in IE6. If you need to apply CSS-based workarounds for browser limitations with this setting, it's best to do so via settingstyleName
.- Returns:
- Current backgroundRepeat value. Default value is null
- See Also:
-
setBorder
Set the CSS border of this component, as a CSS string including border-width, border-style, and/or color (eg "2px solid blue").This property applies the same border to all four sides of this component. Different per-side borders can be set in a CSS style and applied via
styleName
.If a
grouping frame
is being shown then border is derived from thegroupBorderCSS
attribute, not from the explicit border property.
If this method is called after the component has been drawn/initialized: Set the CSS border of this component, as a CSS string including border-width, border-style, and/or color (eg "2px solid blue").This property applies the same border to all four sides of this component. Different per-side borders can be set in a CSS style and applied via
styleName
.- Parameters:
border
- new border to set to (eg: "2px solid black"). Default value is null- Returns:
Canvas
instance, for chaining setter calls- See Also:
-
getBorder
Set the CSS border of this component, as a CSS string including border-width, border-style, and/or color (eg "2px solid blue").This property applies the same border to all four sides of this component. Different per-side borders can be set in a CSS style and applied via
styleName
.If a
grouping frame
is being shown then border is derived from thegroupBorderCSS
attribute, not from the explicit border property.- Returns:
- Current border value. Default value is null
- See Also:
-
setBorderRadius
The CSS border-radius for this widget. The value can be any variant of a CSS border-radius value - that is, from 1 to 4 space-separated px values, where one value affects all corners and 4 values affects individual corners. For example "10px" applies a 10px radius to all corners, where "5px 10px 15px 20px" applies a different radius to each corner, clockwise from Top-Left: "TL TR BR BL".- Parameters:
borderRadius
- New borderRadius value. Default value is null- Returns:
Canvas
instance, for chaining setter calls- See Also:
-
getBorderRadius
The CSS border-radius for this widget. The value can be any variant of a CSS border-radius value - that is, from 1 to 4 space-separated px values, where one value affects all corners and 4 values affects individual corners. For example "10px" applies a 10px radius to all corners, where "5px 10px 15px 20px" applies a different radius to each corner, clockwise from Top-Left: "TL TR BR BL".- Returns:
- Current borderRadius value. Default value is null
- See Also:
-
setCanAcceptDrop
Indicates that this object can receive dropped widgets (i.e. other widgets can be dropped on top of it).Note : This is an advanced setting
- Parameters:
canAcceptDrop
- New canAcceptDrop value. Default value is false- Returns:
Canvas
instance, for chaining setter calls- See Also:
-
getCanAcceptDrop
Indicates that this object can receive dropped widgets (i.e. other widgets can be dropped on top of it).- Returns:
- Current canAcceptDrop value. Default value is false
- See Also:
-
setCanAdaptHeight
SeecanAdaptWidth
.- Parameters:
canAdaptHeight
- New canAdaptHeight value. Default value is null- Returns:
Canvas
instance, for chaining setter calls
-
getCanAdaptHeight
SeecanAdaptWidth
.- Returns:
- Current canAdaptHeight value. Default value is null
-
setCanAdaptWidth
Indicates that this component is able to render itself at multiple possible sizes, in order to fit into less space when very little space is available, or to display more information or provide more immediate access to functionality when more space is available.Unlike simply indicating a flexible size via width:"*", setting
canAdaptWidth
indicates that a component has 2 (or more) different ways of rendering itself with different discrete sizes, but does not have the ability to use every additional available pixel.For example, a menu embedded in a toolbar might show as only a fixed-size icon which reveals menu options when clicked, or if enough space is available, could show all of the menu options directly in the toolbar. In this example, the menu should either be allocated just enough space for an icon, or enough space for all options to appear inline; any other amount of space being allocated is just a waste.
When a component with
canAdaptWidth
is part of a Layout,AdaptWidthByCustomizer.adaptWidthBy()
will be called every time component sizes are being calculated, passing a positive or negative pixel value:- a
positive pixel value indicates a surplus - all other component's minimum sizes can be accommodated,
including any
minWidth
declared on thecanAdaptWidth
component itself - a negative pixel value indicates that the containing layout is
going to be forced to
Overflow
(introduce scrollbars, clip content, etc) unless some component or set of components gives up at least this many pixels
If a non-zero value is returned from
adaptWidthBy
, this means that the component is willing to shrink or expand by that many pixels. Returning 0 means that the component is unable to reduce size further, or for a surplus, cannot make good use of the surplus space.- A call to
AdaptWidthByCustomizer.adaptWidthBy()
may surrender as many pixels as desired (as long as the widget won't drop below its minimum allowed width), no matter whether a positive (surplus) or negative (overflow) pixel value is supplied, but - A call to
AdaptWidthByCustomizer.adaptWidthBy()
may not increase its size by more than the number of offered pixels - so if an overflow is present, it may not increase its size at all.
Note that when the initial width is specified as a stretch size (e.g. "*"), then after
AdaptWidthByCustomizer.adaptWidthBy()
is called, the Framework will stretch (but not shrink) the member like any other stretch-size Layout member, but theunadaptedWidth
argument will always reflect the unstretched width requested by the previous call toAdaptWidthByCustomizer.adaptWidthBy()
. This behavior may be disabled by specifying the initial width as a number, or leaving it unspecified.Behavior is slightly different for overflow: "visible" members - in this case the
unadaptedWidth
passed in will reflect the current visible width of the member, rather than the last width requested by the previous call toAdaptWidthByCustomizer.adaptWidthBy()
or the specified width (on the first call). However, note that the visible length will match your requested width unless the member is actually overflowed. Stretch sizing is not supported for adaptive-width members with overflow: "visible".Caution: you must either determine the current size of the canvas by maintaining your own internal state, or use the
unadaptedWidth
parameter passed toAdaptWidthByCustomizer.adaptWidthBy()
. You must not callgetWidth()
orgetVisibleWidth()
on the canvas itself insideAdaptWidthByCustomizer.adaptWidthBy()
as the size is in the processing of being determined, but you may draw children or callgetVisibleWidth()
on them, as we guarantee that the adaptive-width canvas is drawn before the first call toAdaptWidthByCustomizer.adaptWidthBy()
. An example of drawing children inAdaptWidthByCustomizer.adaptWidthBy()
to compute overall width may be seen in the Inlined Menu Mobile Sample.Note that reasonable settings for
minWidth
should be applied to all other flexible-sized members of a layout where acanAdaptWidth
component appears, because when too little space is available, acanAdaptWidth
component will absorb all available space until minimums for other components are hit (or thecanAdaptWidth
component reaches its maximum size). If more than onecanAdaptWidth
component is present,adaptiveWidthPriority
to give priority to a particular component when allocating space.All of the above behaviors are exactly the same for height, using
canAdaptHeight
andAdaptHeightByCustomizer.adaptHeightBy()
.- Parameters:
canAdaptWidth
- New canAdaptWidth value. Default value is null- Returns:
Canvas
instance, for chaining setter calls- See Also:
- a
positive pixel value indicates a surplus - all other component's minimum sizes can be accommodated,
including any
-
getCanAdaptWidth
Indicates that this component is able to render itself at multiple possible sizes, in order to fit into less space when very little space is available, or to display more information or provide more immediate access to functionality when more space is available.Unlike simply indicating a flexible size via width:"*", setting
canAdaptWidth
indicates that a component has 2 (or more) different ways of rendering itself with different discrete sizes, but does not have the ability to use every additional available pixel.For example, a menu embedded in a toolbar might show as only a fixed-size icon which reveals menu options when clicked, or if enough space is available, could show all of the menu options directly in the toolbar. In this example, the menu should either be allocated just enough space for an icon, or enough space for all options to appear inline; any other amount of space being allocated is just a waste.
When a component with
canAdaptWidth
is part of a Layout,AdaptWidthByCustomizer.adaptWidthBy()
will be called every time component sizes are being calculated, passing a positive or negative pixel value:- a
positive pixel value indicates a surplus - all other component's minimum sizes can be accommodated,
including any
minWidth
declared on thecanAdaptWidth
component itself - a negative pixel value indicates that the containing layout is
going to be forced to
Overflow
(introduce scrollbars, clip content, etc) unless some component or set of components gives up at least this many pixels
If a non-zero value is returned from
adaptWidthBy
, this means that the component is willing to shrink or expand by that many pixels. Returning 0 means that the component is unable to reduce size further, or for a surplus, cannot make good use of the surplus space.- A call to
AdaptWidthByCustomizer.adaptWidthBy()
may surrender as many pixels as desired (as long as the widget won't drop below its minimum allowed width), no matter whether a positive (surplus) or negative (overflow) pixel value is supplied, but - A call to
AdaptWidthByCustomizer.adaptWidthBy()
may not increase its size by more than the number of offered pixels - so if an overflow is present, it may not increase its size at all.
Note that when the initial width is specified as a stretch size (e.g. "*"), then after
AdaptWidthByCustomizer.adaptWidthBy()
is called, the Framework will stretch (but not shrink) the member like any other stretch-size Layout member, but theunadaptedWidth
argument will always reflect the unstretched width requested by the previous call toAdaptWidthByCustomizer.adaptWidthBy()
. This behavior may be disabled by specifying the initial width as a number, or leaving it unspecified.Behavior is slightly different for overflow: "visible" members - in this case the
unadaptedWidth
passed in will reflect the current visible width of the member, rather than the last width requested by the previous call toAdaptWidthByCustomizer.adaptWidthBy()
or the specified width (on the first call). However, note that the visible length will match your requested width unless the member is actually overflowed. Stretch sizing is not supported for adaptive-width members with overflow: "visible".Caution: you must either determine the current size of the canvas by maintaining your own internal state, or use the
unadaptedWidth
parameter passed toAdaptWidthByCustomizer.adaptWidthBy()
. You must not callgetWidth()
orgetVisibleWidth()
on the canvas itself insideAdaptWidthByCustomizer.adaptWidthBy()
as the size is in the processing of being determined, but you may draw children or callgetVisibleWidth()
on them, as we guarantee that the adaptive-width canvas is drawn before the first call toAdaptWidthByCustomizer.adaptWidthBy()
. An example of drawing children inAdaptWidthByCustomizer.adaptWidthBy()
to compute overall width may be seen in the Inlined Menu Mobile Sample.Note that reasonable settings for
minWidth
should be applied to all other flexible-sized members of a layout where acanAdaptWidth
component appears, because when too little space is available, acanAdaptWidth
component will absorb all available space until minimums for other components are hit (or thecanAdaptWidth
component reaches its maximum size). If more than onecanAdaptWidth
component is present,adaptiveWidthPriority
to give priority to a particular component when allocating space.All of the above behaviors are exactly the same for height, using
canAdaptHeight
andAdaptHeightByCustomizer.adaptHeightBy()
.- Returns:
- Current canAdaptWidth value. Default value is null
- See Also:
- a
positive pixel value indicates a surplus - all other component's minimum sizes can be accommodated,
including any
-
setCanDrag
Indicates whether this widget can initiate custom drag-and-drop operations (other than reposition or resize). NormallycanDragReposition
orcanDragResize
would be used instead of this property.Note: this property may be manipulated by higher-level dragging semantics.
If
useNativeDrag
is true and this widget has been drawn, then this widget must beredrawn
in order for a change of the value of this attribute to take effect.Note : This is an advanced setting
- Parameters:
canDrag
- New canDrag value. Default value is false- Returns:
Canvas
instance, for chaining setter calls- See Also:
-
getCanDrag
Indicates whether this widget can initiate custom drag-and-drop operations (other than reposition or resize). NormallycanDragReposition
orcanDragResize
would be used instead of this property.Note: this property may be manipulated by higher-level dragging semantics.
If
useNativeDrag
is true and this widget has been drawn, then this widget must beredrawn
in order for a change of the value of this attribute to take effect.- Returns:
- Current canDrag value. Default value is false
- See Also:
-
setCanDragReposition
Indicates whether this widget can be moved by a user of your application by simply dragging with the mouse.Note : This is an advanced setting
- Parameters:
canDragReposition
- New canDragReposition value. Default value is false- Returns:
Canvas
instance, for chaining setter calls- See Also:
-
getCanDragReposition
Indicates whether this widget can be moved by a user of your application by simply dragging with the mouse.- Returns:
- Current canDragReposition value. Default value is false
- See Also:
-
setCanDragResize
Indicates whether this widget can be resized by dragging on the edges and/or corners of the widget with the mouse.Note : This is an advanced setting
- Parameters:
canDragResize
- New canDragResize value. Default value is false- Returns:
Canvas
instance, for chaining setter calls- See Also:
-
getCanDragResize
Indicates whether this widget can be resized by dragging on the edges and/or corners of the widget with the mouse.- Returns:
- Current canDragResize value. Default value is false
- See Also:
-
setCanDragScroll
If this Canvas is canAcceptDrop:true, when the user drags a droppable widget over an edge of the widget, should we scroll to show the rest of the widget's content? Returned from canvas.shouldDragScroll() if there are scrollbars.Note : This is an advanced setting
- Parameters:
canDragScroll
- New canDragScroll value. Default value is true- Returns:
Canvas
instance, for chaining setter calls- See Also:
-
getCanDragScroll
public boolean getCanDragScroll()If this Canvas is canAcceptDrop:true, when the user drags a droppable widget over an edge of the widget, should we scroll to show the rest of the widget's content? Returned from canvas.shouldDragScroll() if there are scrollbars.- Returns:
- Current canDragScroll value. Default value is true
- See Also:
-
setCanDrop
Indicates that this object can be dropped on top of other widgets. Only valid if canDrag or canDragReposition is true.Note : This is an advanced setting
- Parameters:
canDrop
- New canDrop value. Default value is false- Returns:
Canvas
instance, for chaining setter calls- See Also:
-
getCanDrop
Indicates that this object can be dropped on top of other widgets. Only valid if canDrag or canDragReposition is true.- Returns:
- Current canDrop value. Default value is false
- See Also:
-
setCanDropBefore
When explicitly set to false, disallows drop before this member in the Layout.Note : This is an advanced setting
- Parameters:
canDropBefore
- New canDropBefore value. Default value is null- Returns:
Canvas
instance, for chaining setter calls- See Also:
-
getCanDropBefore
When explicitly set to false, disallows drop before this member in the Layout.- Returns:
- Current canDropBefore value. Default value is null
- See Also:
-
setCanFocus
Can this widget be allowed to become the target of keyboard events?If canFocus is unset (the default), only scrollable widgets with visible scrollbars are focusable, to allow for keyboard scrolling.
A widget normally receives focus by being clicked on or tabbed to.
If this method is called after the component has been drawn/initialized: Change whether a widget can accept keyboard focus.Note : This is an advanced setting
- Parameters:
canFocus
- whether the widget should now accept focus. Default value is null- Returns:
Canvas
instance, for chaining setter calls- See Also:
-
getCanFocus
Can this widget be allowed to become the target of keyboard events?If canFocus is unset (the default), only scrollable widgets with visible scrollbars are focusable, to allow for keyboard scrolling.
A widget normally receives focus by being clicked on or tabbed to.
- Returns:
- Current canFocus value. Default value is null
- See Also:
-
setCanHover
Will this Canvas fire hover events when the user hovers over it, or one of its children?- Parameters:
canHover
- New canHover value. Default value is null- Returns:
Canvas
instance, for chaining setter calls- See Also:
-
getCanHover
Will this Canvas fire hover events when the user hovers over it, or one of its children?- Returns:
- Current canHover value. Default value is null
- See Also:
-
setCanSelectText
Whether native drag selection of contained text is allowed within this Canvas.Note that setting this property to
false
will not avoid text selection which is initiated outside this Canvas from continuing into this Canvas, even if text selection began in another Canvas.Note : This is an advanced setting
- Parameters:
canSelectText
- New canSelectText value. Default value is false- Returns:
Canvas
instance, for chaining setter calls
-
getCanSelectText
Whether native drag selection of contained text is allowed within this Canvas.Note that setting this property to
false
will not avoid text selection which is initiated outside this Canvas from continuing into this Canvas, even if text selection began in another Canvas.- Returns:
- Current canSelectText value. Default value is false
-
getCanvasItem
If this canvas is being displayed in aCanvasItem
, this property will be set to point at the item. Otherwise this property will be null.Note : This method should be called only after the widget has been rendered.
- Returns:
- Current canvasItem value. Default value is null
- Throws:
IllegalStateException
- if this widget has not yet been rendered.
-
getChildren
Array of all Canvii that are immediate children of this Canvas.Use
addChild()
andremoveChild()
to add and remove children after a Canvas has been created/drawn.See
Containment
for an overview of parent/child relationships.- Returns:
- Current children value. Default value is null
- See Also:
-
setChildrenResizeSnapAlign
Flag to disable snapping to alignment when children of this Canvas are resized- Parameters:
childrenResizeSnapAlign
- New childrenResizeSnapAlign value. Default value is null- Returns:
Canvas
instance, for chaining setter calls- See Also:
-
getChildrenResizeSnapAlign
Flag to disable snapping to alignment when children of this Canvas are resized- Returns:
- Current childrenResizeSnapAlign value. Default value is null
- See Also:
-
setChildrenSnapAlign
If enabled whilechildrenSnapToGrid
is enabled, children dragged within this Canvas will also snap to positions where their edges or center lines would be aligned with the edges or centers of other components, and lines will be shown to point out the possible alignment (with appearance controlled bysnapAlignCenterLineStyle
andsnapAlignEdgeLineStyle
respectively.By default, edge- or center-snapping is enabled for all components, but the set of eligible components can be explicitly set via
snapAlignCandidates
.See also
childrenSnapCenterAlign
andchildrenSnapEdgeAlign
for enabling or disabling center alignment or edge alignment individually.- Parameters:
childrenSnapAlign
- New childrenSnapAlign value. Default value is null- Returns:
Canvas
instance, for chaining setter calls- See Also:
-
getChildrenSnapAlign
If enabled whilechildrenSnapToGrid
is enabled, children dragged within this Canvas will also snap to positions where their edges or center lines would be aligned with the edges or centers of other components, and lines will be shown to point out the possible alignment (with appearance controlled bysnapAlignCenterLineStyle
andsnapAlignEdgeLineStyle
respectively.By default, edge- or center-snapping is enabled for all components, but the set of eligible components can be explicitly set via
snapAlignCandidates
.See also
childrenSnapCenterAlign
andchildrenSnapEdgeAlign
for enabling or disabling center alignment or edge alignment individually.- Returns:
- Current childrenSnapAlign value. Default value is null
- See Also:
-
setChildrenSnapCenterAlign
SeechildrenSnapAlign
. This setting enables or disables snapping on center alignment only.- Parameters:
childrenSnapCenterAlign
- New childrenSnapCenterAlign value. Default value is null- Returns:
Canvas
instance, for chaining setter calls- See Also:
-
getChildrenSnapCenterAlign
SeechildrenSnapAlign
. This setting enables or disables snapping on center alignment only.- Returns:
- Current childrenSnapCenterAlign value. Default value is null
- See Also:
-
setChildrenSnapEdgeAlign
SeechildrenSnapAlign
. This setting enables or disables snapping on edge alignment only.- Parameters:
childrenSnapEdgeAlign
- New childrenSnapEdgeAlign value. Default value is null- Returns:
Canvas
instance, for chaining setter calls- See Also:
-
getChildrenSnapEdgeAlign
SeechildrenSnapAlign
. This setting enables or disables snapping on edge alignment only.- Returns:
- Current childrenSnapEdgeAlign value. Default value is null
- See Also:
-
setChildrenSnapResizeToGrid
If true, causes this canvas's children to snap to its grid when resizing. This behavior can be overridden on a per-child basis by setting thesnapToGrid
orsnapResizeToGrid
value on the child.- Parameters:
childrenSnapResizeToGrid
- New childrenSnapResizeToGrid value. Default value is null- Returns:
Canvas
instance, for chaining setter calls- See Also:
-
getChildrenSnapResizeToGrid
If true, causes this canvas's children to snap to its grid when resizing. This behavior can be overridden on a per-child basis by setting thesnapToGrid
orsnapResizeToGrid
value on the child.- Returns:
- Current childrenSnapResizeToGrid value. Default value is null
- See Also:
-
setChildrenSnapToGrid
If true, causes this canvas's children to snap to its grid when dragging. This behavior can be overridden on a per-child basis by setting thesnapToGrid
value on the child.- Parameters:
childrenSnapToGrid
- New childrenSnapToGrid value. Default value is null- Returns:
Canvas
instance, for chaining setter calls- See Also:
-
getChildrenSnapToGrid
If true, causes this canvas's children to snap to its grid when dragging. This behavior can be overridden on a per-child basis by setting thesnapToGrid
value on the child.- Returns:
- Current childrenSnapToGrid value. Default value is null
- See Also:
-
getComponentMask
Automatically generated mask canvas displayed whenshowComponentMask()
is called.This component is an AutoChild named "componentMask". For an overview of how to use and configure AutoChildren, see
Using AutoChildren
.- Returns:
- Current componentMask value. Default value is null
- Throws:
IllegalStateException
- if this widget has not yet been rendered.- See Also:
-
setComponentMaskDefaults
Defaults for thecomponentMask
autoChild. Default properties includebackgroundColor
being set to"black"
andopacity
being set to20
.- Parameters:
componentMaskDefaults
- New componentMaskDefaults value. Default value is {...}- Returns:
Canvas
instance, for chaining setter calls- Throws:
IllegalStateException
- this property cannot be changed after the component has been created- See Also:
-
getComponentMaskDefaults
Defaults for thecomponentMask
autoChild. Default properties includebackgroundColor
being set to"black"
andopacity
being set to20
.- Returns:
- Current componentMaskDefaults value. Default value is {...}
-
setContents
The contents of a canvas or label widget. Any HTML string is acceptable.
If this method is called after the component has been drawn/initialized: Changes the contents of a widget to newContents, an HTML string.When
dynamicContents
is set,setContents()
can also be called with no arguments to cause contents to be re-evaluated.Note : This is an advanced setting
- Parameters:
contents
- an HTML string to be set as the contents of this widget. Default value is " "- Returns:
Canvas
instance, for chaining setter calls- See Also:
-
getContents
The contents of a canvas or label widget. Any HTML string is acceptable.- Returns:
- Returns the contents of a Canvas. The contents are an HTML string. Default value is " "
- See Also:
-
getContextMenu
Context menu to show for this object, an instance of the Menu widget.Note: if
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:
-
setCorrectZoomOverflow
Whether the Framework should correct for erroneous scrollHeight and scrollWidth values reported by the browser when zoomed (via browser or OS-level zoom) by allowingmaxZoomOverflowError
of overflow before enabling scrolling and displaying custom scrollbars. Only relevant whenoverflow
is "auto".This property is defaulted to true in the
Canvas
prototype for those browsers where the situation has been observed, except for Firefox, where a better solution is applied that doesn't rely onmaxZoomOverflowError
and never clips any content. Setting this property false will disable the workaround for all browsers, including Firefox. Without a workaround, scrollbars may oscillate rapidly when the browser or OS is zoomed.Note : This is an advanced setting
- Parameters:
correctZoomOverflow
- New correctZoomOverflow value. Default value is varies- Returns:
Canvas
instance, for chaining setter calls
-
getCorrectZoomOverflow
Whether the Framework should correct for erroneous scrollHeight and scrollWidth values reported by the browser when zoomed (via browser or OS-level zoom) by allowingmaxZoomOverflowError
of overflow before enabling scrolling and displaying custom scrollbars. Only relevant whenoverflow
is "auto".This property is defaulted to true in the
Canvas
prototype for those browsers where the situation has been observed, except for Firefox, where a better solution is applied that doesn't rely onmaxZoomOverflowError
and never clips any content. Setting this property false will disable the workaround for all browsers, including Firefox. Without a workaround, scrollbars may oscillate rapidly when the browser or OS is zoomed.- Returns:
- Current correctZoomOverflow value. Default value is varies
-
setCursor
Specifies the css cursor image to display when the mouse pointer is over this component. SeeCursor
for valid values.Note that the cursor may also be controlled by the following attributes in various cases:
disabledCursor
noDropCursor
dragRepositionCursor
edgeCursorMap
If no cursor is explicitly specified for a component, the cursor will be derived from the component's
ancestors
. Ifcursor
is not explicitly set in the ancestor chain,"default"
will be used.
If this method is called after the component has been drawn/initialized: Sets the cursor for this widget to cursor. See the cursor property for possible values.Note : This is an advanced setting
- Parameters:
cursor
- new cursor. Default value is null- Returns:
Canvas
instance, for chaining setter calls- See Also:
-
getCursor
Specifies the css cursor image to display when the mouse pointer is over this component. SeeCursor
for valid values.Note that the cursor may also be controlled by the following attributes in various cases:
disabledCursor
noDropCursor
dragRepositionCursor
edgeCursorMap
If no cursor is explicitly specified for a component, the cursor will be derived from the component's
ancestors
. Ifcursor
is not explicitly set in the ancestor chain,"default"
will be used.- Returns:
- Current cursor value. Default value is null
- See Also:
-
setDataContext
A mapping fromDataSource
IDs to specificRecords
from those DataSources, thatDataBoundComponents
contained within this Canvas should automatically bind to if a DataSource is provided but data is not provided (directly or indirectly, for example, indirectly via settingListGrid.autoFetchData
.See
autoPopulateData
for details on how this is done.DataSources included in the
dataContext
are immediately provided torule context
when used if no other component has done so already. These records are found in rule context 'dataContext' section (ex.dataContext.Customer
for a Customer record indataContext
) so they do not conflict with normal DataSource records.
If this method is called after the component has been drawn/initialized: Provides a newDataContext
to the Canvas. If the DataContext is new,DataBoundComponents
contained within this Canvas will be automatically bound as described indataContext
. If the DataContext replaces an existing one, any contained components that were originally bound against the DataContext will be re-bound.- Parameters:
dataContext
- dataContext to use for automatic binding. Default value is null- Returns:
Canvas
instance, for chaining setter calls
-
getDataContext
A mapping fromDataSource
IDs to specificRecords
from those DataSources, thatDataBoundComponents
contained within this Canvas should automatically bind to if a DataSource is provided but data is not provided (directly or indirectly, for example, indirectly via settingListGrid.autoFetchData
.See
autoPopulateData
for details on how this is done.DataSources included in the
dataContext
are immediately provided torule context
when used if no other component has done so already. These records are found in rule context 'dataContext' section (ex.dataContext.Customer
for a Customer record indataContext
) so they do not conflict with normal DataSource records.- Returns:
- Current dataContext value. Default value is null
-
setDataPath
A dataPath may be specified on any canvas. This provides a straightforward way to display or edit complex nested data.NOTE: the dataPath feature is intended to help certain legacy architectures, such as systems that work in terms of exchanging large messages with several different entity types in one message, and are incapable of providing separate access to each entity type.
See theDataPath overview
for more information.For components which support displaying or editing data values, (such as
DynamicForm
orListGrid
components), the dataPath may be set to specify how the components data is accessed. In this case the dataPath essentially specifies a nested object to edit - typically a path to a field value within a dataSource record. Note that a ValuesManager will be required to handle connecting the dataBoundcomponent to the appropriate sub object. This may be explicitly specified on the component, or a parent of the component, or automatically generated if a DataSource is specified on either the component or a parent thereof.To provide a simple example - if a complex object existed with the following format:
Map values = new HashMap(); values.put("companyName", "Some company"); Map addressMap = new HashMap(); addressMap.put("street", "123 Main Street"); addressMap.put("city", "New York"); addressMap.put("state", "NY"); values.put("address", addressMap);
a developer could specify a DynamicForm instance with 'dataPath' set to "address" to edit the nested address object:ValuesManager vm = new ValuesManager(); Map values = new HashMap(); values.put("companyName", "Some company"); Map addressMap = new HashMap(); addressMap.put("street", "123 Main Street"); addressMap.put("city", "New York"); addressMap.put("state", "NY"); values.put("address", addressMap); vm.setValues(values); DynamicForm form = new DynamicForm(); form.setValuesManager(vm); form.setDataPath("address"); TextItem streetField = new TextItem("street"); TextItem cityField = new TextItem("city"); TextItem stateField = new TextItem("state"); form.setItems(streetField, cityField, stateField);
If a component is specified with adataPath
attribute but does not have an explicitly specified valuesManager, it will check its parent element chain for a specified valuesManager and automatically bind to that. This simplifies binding multiple components used to view or edit a nested data structure as the valuesManager needs only be defined once at a reasonably high level component. Here's an example of this approach:ValuesManager vm = new ValuesManager(); Map values = new HashMap(); values.put("companyName", "Some company"); Map addressMap = new HashMap(); addressMap.put("street", "123 Main Street"); addressMap.put("city", "New York"); addressMap.put("state", "NY"); values.put("address", addressMap); vm.setValues(values); Layout layout = new Layout(); layout.setValuesManager(vm); DynamicForm form = new DynamicForm(); form.setDataPath("/"); TextItem companyNameField = new TextItem("companyName"); form.setItems(companyNameField); DynamicForm form1 = new DynamicForm(); form1.setDataPath("address"); TextItem streetField = new TextItem("street"); TextItem cityField = new TextItem("city"); TextItem stateField = new TextItem("state"); form1.setItems(streetField, cityField, stateField); layout.addMember(form); layout.addMember(form1);
Note that in this case the valuesManager is specified on a Layout, which has no 'values' management behavior of its own, but contains items with a specified dataPath which do. In this example you'd see 2 forms allowing editing of the nested data structure.dataPaths from multiple nested components may also be combined. For example:
ValuesManager vm = new ValuesManager(); Map values = new HashMap(); values.put("companyName", "Some company"); Map addressMap = new HashMap(); addressMap.put("street", "123 Main Street"); addressMap.put("city", "New York"); addressMap.put("state", "NY"); values.put("address", addressMap); Map values1 = new HashMap(); values1.put("companyName", "Some Corporation"); Map addressMap1 = new HashMap(); addressMap1.put("street", "1 High Street"); addressMap1.put("city", "New York"); addressMap1.put("state", "NY"); values1.put("address", addressMap1); values.put("parentCompany", values1); vm.setValues(values); Layout layout = new Layout(); layout.setValuesManager(vm); DynamicForm form = new DynamicForm(); form.setDataPath("/"); TextItem companyNameField = new TextItem("companyName"); form.setItems(companyNameField); DynamicForm form1 = new DynamicForm(); form1.setDataPath("address"); TextItem streetField = new TextItem("street"); TextItem cityField = new TextItem("city"); TextItem stateField = new TextItem("state"); form1.setItems(streetField, cityField, stateField); Layout innerlayout = new Layout(); innerlayout.setDataPath("parentCompany"); DynamicForm form3 = new DynamicForm(); form3.setDataPath(""); StaticTextItem companyNameField1 = new StaticTextItem("companyName"); form3.setItems(companyNameField1); DetailViewer detailViewer = new DetailViewer(); detailViewer.setDataPath("address"); DetailViewerField streetDVField = new DetailViewerField("street"); DetailViewerField cityDVField = new DetailViewerField("city"); DetailViewerField stateDVField = new DetailViewerField("state"); detailViewer.setFields(streetDVField, cityDVField, stateDVField); innerlayout.addMember(form3); innerlayout.addMember(detailViewer); layout.addMember(form); layout.addMember(form1); layout.addMember(innerlayout);
In this example the detailViewer will display data from theparentCompany.address
object within the base record.Note that if a component has a specified dataSource and shows child components with a specified dataPath, there is no need to explicitly declare a valuesManager at all. If a component with a dataPath has a dataSource, or an ancestor with a dataSource specified, it will, a valuesManager will automatically be generated on the higher level component (and be available as
component.valuesManager
).Difference between "" and "/" - relative and absolute datapaths
In the above example, note how the form for entering the "main" company name is given a dataPath of "/", while the form for entering the parent company name is given a dataPath of "". The difference here is exactly the same as you would find in a filesystem path: a dataPath starting with "/" is absolute, so "/" by itself means "root". A dataPath that does not start with "/" is relative, and the empty string indicates that dataPaths for items below this one in the hierarchy should apply the dataPath so far from the hierarchy above.If that isn't clear, consider the form for entering the parent company name in the above example. The correct dataPath to the field is
/parentCompany/companyName
. We have the "parentCompany" part of that path provided by the containing Layout, so we cannot reiterate it on the form itself. However, if we omit the dataPath property altogether, the framework will not seek to apply dataPath at all. So, we specify the empty string, which tells Smart GWT to use dataPath and to retain the portion of the path derived so far from the containment hierarchy.One further clarification: relative paths are only different from absolute paths if they are relative to something other than the root. So in the above example, although we specify "/" as the dataPath of the "main" company name form, we would get exactly the same behavior by specifying it as "", because the correct dataPath for the companyName field is "/companyName" - ie, it is relative to the root.
If this method is called after the component has been drawn/initialized: Setter for thedataPath
attribute. This method may be called directly at runtime to set the dataPath on a component, and will also be re-run automatically whenever a canvas' parent changes due to a call to addChild(). This method handles automatically binding the component to the appropriate valuesManager if necessary.Note : This is an advanced setting
- Parameters:
dataPath
- new dataPath. Default value is null- Returns:
Canvas
instance, for chaining setter calls- See Also:
-
getDataPath
A dataPath may be specified on any canvas. This provides a straightforward way to display or edit complex nested data.NOTE: the dataPath feature is intended to help certain legacy architectures, such as systems that work in terms of exchanging large messages with several different entity types in one message, and are incapable of providing separate access to each entity type.
See theDataPath overview
for more information.For components which support displaying or editing data values, (such as
DynamicForm
orListGrid
components), the dataPath may be set to specify how the components data is accessed. In this case the dataPath essentially specifies a nested object to edit - typically a path to a field value within a dataSource record. Note that a ValuesManager will be required to handle connecting the dataBoundcomponent to the appropriate sub object. This may be explicitly specified on the component, or a parent of the component, or automatically generated if a DataSource is specified on either the component or a parent thereof.To provide a simple example - if a complex object existed with the following format:
Map values = new HashMap(); values.put("companyName", "Some company"); Map addressMap = new HashMap(); addressMap.put("street", "123 Main Street"); addressMap.put("city", "New York"); addressMap.put("state", "NY"); values.put("address", addressMap);
a developer could specify a DynamicForm instance with 'dataPath' set to "address" to edit the nested address object:ValuesManager vm = new ValuesManager(); Map values = new HashMap(); values.put("companyName", "Some company"); Map addressMap = new HashMap(); addressMap.put("street", "123 Main Street"); addressMap.put("city", "New York"); addressMap.put("state", "NY"); values.put("address", addressMap); vm.setValues(values); DynamicForm form = new DynamicForm(); form.setValuesManager(vm); form.setDataPath("address"); TextItem streetField = new TextItem("street"); TextItem cityField = new TextItem("city"); TextItem stateField = new TextItem("state"); form.setItems(streetField, cityField, stateField);
If a component is specified with adataPath
attribute but does not have an explicitly specified valuesManager, it will check its parent element chain for a specified valuesManager and automatically bind to that. This simplifies binding multiple components used to view or edit a nested data structure as the valuesManager needs only be defined once at a reasonably high level component. Here's an example of this approach:ValuesManager vm = new ValuesManager(); Map values = new HashMap(); values.put("companyName", "Some company"); Map addressMap = new HashMap(); addressMap.put("street", "123 Main Street"); addressMap.put("city", "New York"); addressMap.put("state", "NY"); values.put("address", addressMap); vm.setValues(values); Layout layout = new Layout(); layout.setValuesManager(vm); DynamicForm form = new DynamicForm(); form.setDataPath("/"); TextItem companyNameField = new TextItem("companyName"); form.setItems(companyNameField); DynamicForm form1 = new DynamicForm(); form1.setDataPath("address"); TextItem streetField = new TextItem("street"); TextItem cityField = new TextItem("city"); TextItem stateField = new TextItem("state"); form1.setItems(streetField, cityField, stateField); layout.addMember(form); layout.addMember(form1);
Note that in this case the valuesManager is specified on a Layout, which has no 'values' management behavior of its own, but contains items with a specified dataPath which do. In this example you'd see 2 forms allowing editing of the nested data structure.dataPaths from multiple nested components may also be combined. For example:
ValuesManager vm = new ValuesManager(); Map values = new HashMap(); values.put("companyName", "Some company"); Map addressMap = new HashMap(); addressMap.put("street", "123 Main Street"); addressMap.put("city", "New York"); addressMap.put("state", "NY"); values.put("address", addressMap); Map values1 = new HashMap(); values1.put("companyName", "Some Corporation"); Map addressMap1 = new HashMap(); addressMap1.put("street", "1 High Street"); addressMap1.put("city", "New York"); addressMap1.put("state", "NY"); values1.put("address", addressMap1); values.put("parentCompany", values1); vm.setValues(values); Layout layout = new Layout(); layout.setValuesManager(vm); DynamicForm form = new DynamicForm(); form.setDataPath("/"); TextItem companyNameField = new TextItem("companyName"); form.setItems(companyNameField); DynamicForm form1 = new DynamicForm(); form1.setDataPath("address"); TextItem streetField = new TextItem("street"); TextItem cityField = new TextItem("city"); TextItem stateField = new TextItem("state"); form1.setItems(streetField, cityField, stateField); Layout innerlayout = new Layout(); innerlayout.setDataPath("parentCompany"); DynamicForm form3 = new DynamicForm(); form3.setDataPath(""); StaticTextItem companyNameField1 = new StaticTextItem("companyName"); form3.setItems(companyNameField1); DetailViewer detailViewer = new DetailViewer(); detailViewer.setDataPath("address"); DetailViewerField streetDVField = new DetailViewerField("street"); DetailViewerField cityDVField = new DetailViewerField("city"); DetailViewerField stateDVField = new DetailViewerField("state"); detailViewer.setFields(streetDVField, cityDVField, stateDVField); innerlayout.addMember(form3); innerlayout.addMember(detailViewer); layout.addMember(form); layout.addMember(form1); layout.addMember(innerlayout);
In this example the detailViewer will display data from theparentCompany.address
object within the base record.Note that if a component has a specified dataSource and shows child components with a specified dataPath, there is no need to explicitly declare a valuesManager at all. If a component with a dataPath has a dataSource, or an ancestor with a dataSource specified, it will, a valuesManager will automatically be generated on the higher level component (and be available as
component.valuesManager
).Difference between "" and "/" - relative and absolute datapaths
In the above example, note how the form for entering the "main" company name is given a dataPath of "/", while the form for entering the parent company name is given a dataPath of "". The difference here is exactly the same as you would find in a filesystem path: a dataPath starting with "/" is absolute, so "/" by itself means "root". A dataPath that does not start with "/" is relative, and the empty string indicates that dataPaths for items below this one in the hierarchy should apply the dataPath so far from the hierarchy above.If that isn't clear, consider the form for entering the parent company name in the above example. The correct dataPath to the field is
/parentCompany/companyName
. We have the "parentCompany" part of that path provided by the containing Layout, so we cannot reiterate it on the form itself. However, if we omit the dataPath property altogether, the framework will not seek to apply dataPath at all. So, we specify the empty string, which tells Smart GWT to use dataPath and to retain the portion of the path derived so far from the containment hierarchy.One further clarification: relative paths are only different from absolute paths if they are relative to something other than the root. So in the above example, although we specify "/" as the dataPath of the "main" company name form, we would get exactly the same behavior by specifying it as "", because the correct dataPath for the companyName field is "/companyName" - ie, it is relative to the root.
- Returns:
- Current dataPath value. Default value is null
- See Also:
-
setDefaultHeight
For custom components, establishes a default height for the component.For a component that should potentially be sized automatically by a Layout, set this property rather than
height
directly, because Layouts regard a height setting as an explicit size that shouldn't be changed.Note : This is an advanced setting
- Parameters:
defaultHeight
- New defaultHeight value. Default value is 100- Returns:
Canvas
instance, for chaining setter calls- See Also:
-
getDefaultHeight
public int getDefaultHeight()For custom components, establishes a default height for the component.For a component that should potentially be sized automatically by a Layout, set this property rather than
height
directly, because Layouts regard a height setting as an explicit size that shouldn't be changed.- Returns:
- Current defaultHeight value. Default value is 100
- See Also:
-
setDefaultWidth
For custom components, establishes a default width for the component.For a component that should potentially be sized automatically by a Layout, set this property rather than
width
directly, because Layouts regard a width setting as an explicit size that shouldn't be changed.Note : This is an advanced setting
- Parameters:
defaultWidth
- New defaultWidth value. Default value is 100- Returns:
Canvas
instance, for chaining setter calls- See Also:
-
getDefaultWidth
public int getDefaultWidth()For custom components, establishes a default width for the component.For a component that should potentially be sized automatically by a Layout, set this property rather than
width
directly, because Layouts regard a width setting as an explicit size that shouldn't be changed.- Returns:
- Current defaultWidth value. Default value is 100
- See Also:
-
setDefiningProperty
This attribute denotes the name of a property to use as agetDefiningPropertyName()
for this property when generating and resolvingAutoTest locators with search segments
.Note : This is an advanced setting
- Parameters:
definingProperty
- New definingProperty value. Default value is null- Returns:
Canvas
instance, for chaining setter calls
-
getDefiningProperty
This attribute denotes the name of a property to use as agetDefiningPropertyName()
for this property when generating and resolvingAutoTest locators with search segments
.- Returns:
- Current definingProperty value. Default value is null
-
setDefiningPropertyNameOptions
If no explicitdefiningProperty
was specified for this component, this array denotes a list of options to use as adefining property
when generating and resolvingAutoTest locators with search segments
. The first attribute in this array that is non-null for this component will be used as the defining property for locator search segments.The default set of options are as follows:
[ "locatorName", "dataSource" ]
Note : This is an advanced setting
- Parameters:
definingPropertyNameOptions
- New definingPropertyNameOptions value. Default value is [...]- Returns:
Canvas
instance, for chaining setter calls
-
getDefiningPropertyNameOptions
If no explicitdefiningProperty
was specified for this component, this array denotes a list of options to use as adefining property
when generating and resolvingAutoTest locators with search segments
. The first attribute in this array that is non-null for this component will be used as the defining property for locator search segments.The default set of options are as follows:
[ "locatorName", "dataSource" ]
- Returns:
- Current definingPropertyNameOptions value. Default value is [...]
-
getDestroyed
If this property is set totrue
, thedestroy()
method has been called on this canvas. This implies the canvas is no longer valid. Its ID has been removed from global scope, and calling standard canvas APIs on it is likely to result in errors.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.- See Also:
-
getDestroying
This property is set to true when thedestroy()
method is called on a widget. If this property is true, butdestroyed
is not, this indicates the canvas is in the process of being destroyed.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.- See Also:
-
setDisabledCursor
Specifies the cursor image to display when the mouse pointer is over this widget if this widget is disabled. It corresponds to the CSS cursor attribute. See Cursor type for different cursors.Note : This is an advanced setting
- Parameters:
disabledCursor
- New disabledCursor value. Default value is Canvas.DEFAULT- Returns:
Canvas
instance, for chaining setter calls- See Also:
-
getDisabledCursor
Specifies the cursor image to display when the mouse pointer is over this widget if this widget is disabled. It corresponds to the CSS cursor attribute. See Cursor type for different cursors.- Returns:
- Current disabledCursor value. Default value is Canvas.DEFAULT
- See Also:
-
setDisableTouchScrollingForDrag
public Canvas setDisableTouchScrollingForDrag(Boolean disableTouchScrollingForDrag) throws IllegalStateException DisablesuseTouchScrolling
whenever a built-in drag operation has been enabled which is known to be non-functional if touch scrolling is enabled. Default behavior is to leave touch scrolling enabled even if it makes other enabled drag operations non-functional, since anyaccessible
application must provide an alternative way to perform drag and drop operations anyway.disableTouchScrollingForDrag
exists so that applications can change the default setting on a per-component basis (viasetDefaultProperties
), in order to make a system-wide or per-component-type decision about whether to favor touch scrolling vs retaining the ability to drag and drop via finger drags, instead of having to setuseTouchScrolling
on each individual instance.See the
Mobile Development overview
for more background information.- Parameters:
disableTouchScrollingForDrag
- New disableTouchScrollingForDrag value. Default value is null- Returns:
Canvas
instance, for chaining setter calls- Throws:
IllegalStateException
- this property cannot be changed after the component has been created- See Also:
-
getDisableTouchScrollingForDrag
DisablesuseTouchScrolling
whenever a built-in drag operation has been enabled which is known to be non-functional if touch scrolling is enabled. Default behavior is to leave touch scrolling enabled even if it makes other enabled drag operations non-functional, since anyaccessible
application must provide an alternative way to perform drag and drop operations anyway.disableTouchScrollingForDrag
exists so that applications can change the default setting on a per-component basis (viasetDefaultProperties
), in order to make a system-wide or per-component-type decision about whether to favor touch scrolling vs retaining the ability to drag and drop via finger drags, instead of having to setuseTouchScrolling
on each individual instance.See the
Mobile Development overview
for more background information.- Returns:
- Current disableTouchScrollingForDrag value. Default value is null
- See Also:
-
setDoubleClickDelay
Amount of time (in milliseconds) between which two clicks are considered a single clickNote : This is an advanced setting
- Parameters:
doubleClickDelay
- New doubleClickDelay value. Default value is 250- Returns:
Canvas
instance, for chaining setter calls
-
getDoubleClickDelay
public int getDoubleClickDelay()Amount of time (in milliseconds) between which two clicks are considered a single click- Returns:
- Current doubleClickDelay value. Default value is 250
-
setDragAppearance
Visual appearance to show when the object is being dragged. May be overridden for dragResize or dragReposition events viadragResizeAppearance
anddragRepositionAppearance
.Note : This is an advanced setting
- Parameters:
dragAppearance
- New dragAppearance value. Default value is EventHandler.OUTLINE- Returns:
Canvas
instance, for chaining setter calls- See Also:
-
getDragAppearance
Visual appearance to show when the object is being dragged. May be overridden for dragResize or dragReposition events viadragResizeAppearance
anddragRepositionAppearance
.- Returns:
- Current dragAppearance value. Default value is EventHandler.OUTLINE
- See Also:
-
setDragIntersectStyle
This indicates how the system will test for droppable targets: either by intersection with the mouse or intersection with the rectangle of the dragMoveTarget.Note : This is an advanced setting
- Parameters:
dragIntersectStyle
- New dragIntersectStyle value. Default value is "mouse"- Returns:
Canvas
instance, for chaining setter calls- See Also:
-
getDragIntersectStyle
This indicates how the system will test for droppable targets: either by intersection with the mouse or intersection with the rectangle of the dragMoveTarget.- Returns:
- Current dragIntersectStyle value. Default value is "mouse"
- See Also:
-
setDragMaskType
This property controls what kind of mask is used in caseuseDragMask
is enabled.- Parameters:
dragMaskType
- New dragMaskType value. Default value is "div"- Returns:
Canvas
instance, for chaining setter calls- See Also:
-
getDragMaskType
This property controls what kind of mask is used in caseuseDragMask
is enabled.- Returns:
- Current dragMaskType value. Default value is "div"
- See Also:
-
setDragMaxHeight
Sets maximum height that this Canvas can be resized to by a user. Actual limit will be minimum ofdragMaxHeight
andmaxHeight
.Note : This is an advanced setting
- Parameters:
dragMaxHeight
- New dragMaxHeight value. Default value is 10000- Returns:
Canvas
instance, for chaining setter calls- See Also:
-
getDragMaxHeight
public int getDragMaxHeight()Sets maximum height that this Canvas can be resized to by a user. Actual limit will be minimum ofdragMaxHeight
andmaxHeight
.- Returns:
- Current dragMaxHeight value. Default value is 10000
- See Also:
-
setDragMaxWidth
Maximum width that this Canvas can be resized to by a user. Actual limit will be minimum ofdragMaxWidth
andmaxWidth
.Note : This is an advanced setting
- Parameters:
dragMaxWidth
- New dragMaxWidth value. Default value is 10000- Returns:
Canvas
instance, for chaining setter calls- See Also:
-
getDragMaxWidth
public int getDragMaxWidth()Maximum width that this Canvas can be resized to by a user. Actual limit will be minimum ofdragMaxWidth
andmaxWidth
.- Returns:
- Current dragMaxWidth value. Default value is 10000
- See Also:
-
setDragMinHeight
Minimum height that this Canvas can be resized to by a user. SeedragMinWidth
for details of behavior.Note : This is an advanced setting
- Parameters:
dragMinHeight
- New dragMinHeight value. Default value is 10- Returns:
Canvas
instance, for chaining setter calls- See Also:
-
getDragMinHeight
public int getDragMinHeight()Minimum height that this Canvas can be resized to by a user. SeedragMinWidth
for details of behavior.- Returns:
- Current dragMinHeight value. Default value is 10
- See Also:
-
setDragMinWidth
Minimum width that this Canvas can be resized to by a user. Actual limit will be maximum ofdragMinWidth
andminWidth
.Note that a Canvas with overflow:"visible" has an implicit minimize size based on it's contents.
Note that
dragMinWidth
affects only user-initiated drag resizes. To set the minimum width of a Canvas embedded in a Layout, you can set +{minWidth}, orLayout.minMemberLength
to constrain the minimum size along the length axis of all members of theLayout
.Note : This is an advanced setting
- Parameters:
dragMinWidth
- New dragMinWidth value. Default value is 10- Returns:
Canvas
instance, for chaining setter calls- See Also:
-
getDragMinWidth
public int getDragMinWidth()Minimum width that this Canvas can be resized to by a user. Actual limit will be maximum ofdragMinWidth
andminWidth
.Note that a Canvas with overflow:"visible" has an implicit minimize size based on it's contents.
Note that
dragMinWidth
affects only user-initiated drag resizes. To set the minimum width of a Canvas embedded in a Layout, you can set +{minWidth}, orLayout.minMemberLength
to constrain the minimum size along the length axis of all members of theLayout
.- Returns:
- Current dragMinWidth value. Default value is 10
- See Also:
-
setDragOpacity
If this widget has dragAppearance"target"
, this value specifies the opacity to render the target while it is being dragged. A null value implies we do not modify the opacity.Note : This is an advanced setting
- Parameters:
dragOpacity
- New dragOpacity value. Default value is null- Returns:
Canvas
instance, for chaining setter calls- See Also:
-
getDragOpacity
If this widget has dragAppearance"target"
, this value specifies the opacity to render the target while it is being dragged. A null value implies we do not modify the opacity.- Returns:
- Current dragOpacity value. Default value is null
- See Also:
-
setDragRepositionAppearance
IfcanDragReposition
is true, this attribute specifies the visual appearance to show during drag reposition. If unsetdragAppearance
will be used.Note : This is an advanced setting
- Parameters:
dragRepositionAppearance
- New dragRepositionAppearance value. Default value is null- Returns:
Canvas
instance, for chaining setter calls- See Also:
-
getDragRepositionAppearance
IfcanDragReposition
is true, this attribute specifies the visual appearance to show during drag reposition. If unsetdragAppearance
will be used.- Returns:
- Current dragRepositionAppearance value. Default value is null
- See Also:
-
setDragRepositionCursor
Cursor to switch to if the mouse is over a widget that is drag repositionable.Note : This is an advanced setting
- Parameters:
dragRepositionCursor
- New dragRepositionCursor value. Default value is Canvas.MOVE- Returns:
Canvas
instance, for chaining setter calls- See Also:
-
getDragRepositionCursor
Cursor to switch to if the mouse is over a widget that is drag repositionable.- Returns:
- Current dragRepositionCursor value. Default value is Canvas.MOVE
- See Also:
-
setDragResizeAppearance
IfcanDragResize
is true, this attribute specifies the visual appearance to show during drag resize. If unsetdragAppearance
will be used.Note : This is an advanced setting
- Parameters:
dragResizeAppearance
- New dragResizeAppearance value. Default value is null- Returns:
Canvas
instance, for chaining setter calls- See Also:
-
getDragResizeAppearance
IfcanDragResize
is true, this attribute specifies the visual appearance to show during drag resize. If unsetdragAppearance
will be used.- Returns:
- Current dragResizeAppearance value. Default value is null
- See Also:
-
setDragScrollDelay
If this widget supports drag-scrolling, This property specifies how many ms the user must hover over the drag-scroll threshold before scrolling begins.Note : This is an advanced setting
- Parameters:
dragScrollDelay
- New dragScrollDelay value. Default value is 100- Returns:
Canvas
instance, for chaining setter calls
-
getDragScrollDelay
public int getDragScrollDelay()If this widget supports drag-scrolling, This property specifies how many ms the user must hover over the drag-scroll threshold before scrolling begins.- Returns:
- Current dragScrollDelay value. Default value is 100
-
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:
Canvas
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:
-
setDragTarget
A different widget that should be actually dragged when dragging initiates on this widget. One example of this is to have a child widget that drags its parent, as with a drag box. Because the parent automatically repositions its children, setting the drag target of the child to the parent and then dragging the child will result in both widgets being moved.Valid
dragTarget
values are:null
(default) [this widget is its own drag target]- another widget, or widget ID
"parent"
drag target is this widget'sparentCanvas
"top"
drag target is this widget'stopElement
Note that for dragging to work as intended, the
resizeFrom
setting on thedragTarget
must be null or a superset of theresizeFrom
on this canvas.Note : This is an advanced setting
- Parameters:
dragTarget
- New dragTarget value. Default value is null- Returns:
Canvas
instance, for chaining setter calls- See Also:
-
getDragTarget
A different widget that should be actually dragged when dragging initiates on this widget. One example of this is to have a child widget that drags its parent, as with a drag box. Because the parent automatically repositions its children, setting the drag target of the child to the parent and then dragging the child will result in both widgets being moved.Valid
dragTarget
values are:null
(default) [this widget is its own drag target]- another widget, or widget ID
"parent"
drag target is this widget'sparentCanvas
"top"
drag target is this widget'stopElement
Note that for dragging to work as intended, the
resizeFrom
setting on thedragTarget
must be null or a superset of theresizeFrom
on this canvas.- Returns:
- Current dragTarget value. Default value is null
- See Also:
-
setDragTarget
A different widget that should be actually dragged when dragging initiates on this widget. One example of this is to have a child widget that drags its parent, as with a drag box. Because the parent automatically repositions its children, setting the drag target of the child to the parent and then dragging the child will result in both widgets being moved.Valid
dragTarget
values are:null
(default) [this widget is its own drag target]- another widget, or widget ID
"parent"
drag target is this widget'sparentCanvas
"top"
drag target is this widget'stopElement
Note that for dragging to work as intended, the
resizeFrom
setting on thedragTarget
must be null or a superset of theresizeFrom
on this canvas.Note : This is an advanced setting
- Parameters:
dragTarget
- New dragTarget value. Default value is null- Returns:
Canvas
instance, for chaining setter calls- See Also:
-
getDragTargetAsString
A different widget that should be actually dragged when dragging initiates on this widget. One example of this is to have a child widget that drags its parent, as with a drag box. Because the parent automatically repositions its children, setting the drag target of the child to the parent and then dragging the child will result in both widgets being moved.Valid
dragTarget
values are:null
(default) [this widget is its own drag target]- another widget, or widget ID
"parent"
drag target is this widget'sparentCanvas
"top"
drag target is this widget'stopElement
Note that for dragging to work as intended, the
resizeFrom
setting on thedragTarget
must be null or a superset of theresizeFrom
on this canvas.- Returns:
- Current dragTarget value. Default value is null
- See Also:
-
setDragType
Sets adragType
for this widget used, to be compared todropTypes
on possible drop target widgets. SeedropTypes
for a full explanation.Note : This is an advanced setting
- Parameters:
dragType
- New dragType value. Default value is null- Returns:
Canvas
instance, for chaining setter calls- See Also:
-
getDragType
Sets adragType
for this widget used, to be compared todropTypes
on possible drop target widgets. SeedropTypes
for a full explanation.- Returns:
- Current dragType value. Default value is null
- See Also:
-
setDropTarget
Delegates a different widget that should actually be dropped on if the cursor is over this widget when the drop completes. If you're building your own "drop indicator" widget, it may need this property set to the main canvas (receiving the drop) to avoid itself being considered a drop target (causing the indicator to flicker).Note : This is an advanced setting
- Parameters:
dropTarget
- New dropTarget value. Default value is null- Returns:
Canvas
instance, for chaining setter calls- See Also:
-
getDropTarget
Delegates a different widget that should actually be dropped on if the cursor is over this widget when the drop completes. If you're building your own "drop indicator" widget, it may need this property set to the main canvas (receiving the drop) to avoid itself being considered a drop target (causing the indicator to flicker).- Returns:
- Current dropTarget value. Default value is null
- See Also:
-
setDropTarget
Delegates a different widget that should actually be dropped on if the cursor is over this widget when the drop completes. If you're building your own "drop indicator" widget, it may need this property set to the main canvas (receiving the drop) to avoid itself being considered a drop target (causing the indicator to flicker).Note : This is an advanced setting
- Parameters:
dropTarget
- New dropTarget value. Default value is null- Returns:
Canvas
instance, for chaining setter calls- See Also:
-
getDropTargetAsString
Delegates a different widget that should actually be dropped on if the cursor is over this widget when the drop completes. If you're building your own "drop indicator" widget, it may need this property set to the main canvas (receiving the drop) to avoid itself being considered a drop target (causing the indicator to flicker).- Returns:
- Current dropTarget value. Default value is null
- See Also:
-
setDropTypes
When a drag and drop interaction occurs, if adragType
is configured on the source widget, it is compared to thedropTypes
configured on the target widget, and a drop is only allowed if thedragType
is listed in the target widget'sdropTypes
array.The default setting means any
dragType
is eligible for dropping on this widget, including nodragType
setting.See also
willAcceptDrop()
for dynamic determination of drop eligibility.Note : This is an advanced setting
- Parameters:
dropTypes
- New dropTypes value. Default value is Canvas.ANYTHING- Returns:
Canvas
instance, for chaining setter calls- See Also:
-
getDropTypes
When a drag and drop interaction occurs, if adragType
is configured on the source widget, it is compared to thedropTypes
configured on the target widget, and a drop is only allowed if thedragType
is listed in the target widget'sdropTypes
array.The default setting means any
dragType
is eligible for dropping on this widget, including nodragType
setting.See also
willAcceptDrop()
for dynamic determination of drop eligibility.- Returns:
- Current dropTypes value. Default value is Canvas.ANYTHING
- See Also:
-
setDropTypes
When a drag and drop interaction occurs, if adragType
is configured on the source widget, it is compared to thedropTypes
configured on the target widget, and a drop is only allowed if thedragType
is listed in the target widget'sdropTypes
array.The default setting means any
dragType
is eligible for dropping on this widget, including nodragType
setting.See also
willAcceptDrop()
for dynamic determination of drop eligibility.Note : This is an advanced setting
- Parameters:
dropTypes
- New dropTypes value. Default value is Canvas.ANYTHING- Returns:
Canvas
instance, for chaining setter calls- See Also:
-
getDropTypesAsString
When a drag and drop interaction occurs, if adragType
is configured on the source widget, it is compared to thedropTypes
configured on the target widget, and a drop is only allowed if thedragType
is listed in the target widget'sdropTypes
array.The default setting means any
dragType
is eligible for dropping on this widget, including nodragType
setting.See also
willAcceptDrop()
for dynamic determination of drop eligibility.- Returns:
- Current dropTypes value. Default value is Canvas.ANYTHING
- See Also:
-
setDynamicContents
Dynamic contents allows the contents string to be treated as a simple but powerful template. When this attribute is set to true, JavaScript expressions may be embedded within the contents string, using the format:${[JavaScript to evaluate]}
.For example, to include the current date in a templated message,
canvas.contents
could be set to:
"Today's date is <b>${new Date().toUSShortDate()}</b>"
Embedded expressions will be evaluated when the canvas is drawn or redrawn, and the result of the evaluated expression will be displayed to the user. If the expression does not evaluate to a String, the
toString()
representation of the returned object will be displayed automaticallyDynamic expressions are evaluated in the scope of the canvas displaying the content, so the
this
keyword may be used within your expression to refer to the canvas. Developers may also explicitly supply values for variables to be used within the evaluation via thedynamicContentsVars
property.Notes:
- Calling markForRedraw() on the canvas will evaluate any embedded expressions.
- Multiple such expressions may be embedded within the contents string for a component.
- If
an error occurs during evaluation, a warning is logged to the
Developer Console
and the error string will be embedded in place of the expected value in the Canvas.
Note : This is an advanced setting
- Parameters:
dynamicContents
- New dynamicContents value. Default value is false- Returns:
Canvas
instance, for chaining setter calls- See Also:
-
setContents(java.lang.String)
com.smartgwt.client.widgets.Canvas#setDynamicContentsVars
-
getDynamicContents
Dynamic contents allows the contents string to be treated as a simple but powerful template. When this attribute is set to true, JavaScript expressions may be embedded within the contents string, using the format:${[JavaScript to evaluate]}
.For example, to include the current date in a templated message,
canvas.contents
could be set to:
"Today's date is <b>${new Date().toUSShortDate()}</b>"
Embedded expressions will be evaluated when the canvas is drawn or redrawn, and the result of the evaluated expression will be displayed to the user. If the expression does not evaluate to a String, the
toString()
representation of the returned object will be displayed automaticallyDynamic expressions are evaluated in the scope of the canvas displaying the content, so the
this
keyword may be used within your expression to refer to the canvas. Developers may also explicitly supply values for variables to be used within the evaluation via thedynamicContentsVars
property.Notes:
- Calling markForRedraw() on the canvas will evaluate any embedded expressions.
- Multiple such expressions may be embedded within the contents string for a component.
- If
an error occurs during evaluation, a warning is logged to the
Developer Console
and the error string will be embedded in place of the expected value in the Canvas.
- Returns:
- Current dynamicContents value. Default value is false
- See Also:
-
getContents()
com.smartgwt.client.widgets.Canvas#getDynamicContentsVars
-
setEdgeBackgroundColor
Background color for the EdgedCanvas created to decorate this component. This can be used to provide an underlying "tint" color for translucent edge media- Parameters:
edgeBackgroundColor
- New edgeBackgroundColor value. Default value is null- Returns:
Canvas
instance, for chaining setter calls- Throws:
IllegalStateException
- this property cannot be changed after the component has been created- See Also:
-
getEdgeBackgroundColor
Background color for the EdgedCanvas created to decorate this component. This can be used to provide an underlying "tint" color for translucent edge media- Returns:
- Current edgeBackgroundColor value. Default value is null
- See Also:
-
setEdgeCenterBackgroundColor
public Canvas setEdgeCenterBackgroundColor(String edgeCenterBackgroundColor) throws IllegalStateException Background color for the center section only. Can be used as a surrogate background color for the decorated Canvas, if the Canvas is set to partially overlap the edges and hence can't show a background color itself without occluding media.- Parameters:
edgeCenterBackgroundColor
- New edgeCenterBackgroundColor value. Default value is null- Returns:
Canvas
instance, for chaining setter calls- Throws:
IllegalStateException
- this property cannot be changed after the component has been created- See Also:
-
getEdgeCenterBackgroundColor
Background color for the center section only. Can be used as a surrogate background color for the decorated Canvas, if the Canvas is set to partially overlap the edges and hence can't show a background color itself without occluding media.- Returns:
- Current edgeCenterBackgroundColor value. Default value is null
- See Also:
-
setEdgeImage
Base name of images for edges. Extensions for each corner or edge piece will be added to this image URL, before the extension. For example, with the default base name of "edge.gif", the top-left corner image will be "edge_TL.gif".The full list of extensions is: "_TL", "_TR", "_BL", "_BR", "_T", "_L", "_B", "_R", "_center".
- Parameters:
edgeImage
- New edgeImage value. Default value is "[SKIN]edge.gif"- Returns:
Canvas
instance, for chaining setter calls- Throws:
IllegalStateException
- this property cannot be changed after the component has been created- See Also:
-
getEdgeImage
Base name of images for edges. Extensions for each corner or edge piece will be added to this image URL, before the extension. For example, with the default base name of "edge.gif", the top-left corner image will be "edge_TL.gif".The full list of extensions is: "_TL", "_TR", "_BL", "_BR", "_T", "_L", "_B", "_R", "_center".
- Returns:
- Current edgeImage value. Default value is "[SKIN]edge.gif"
- See Also:
-
setEdgeMarginSize
How far into the edge of an object do we consider the "edge" for drag resize purposes?Note : This is an advanced setting
- Parameters:
edgeMarginSize
- New edgeMarginSize value. Default value is 5- Returns:
Canvas
instance, for chaining setter calls- See Also:
-
getEdgeMarginSize
public int getEdgeMarginSize()How far into the edge of an object do we consider the "edge" for drag resize purposes?- Returns:
- Current edgeMarginSize value. Default value is 5
- See Also:
-
setEdgeOffset
Amount the contained Canvas should be offset. Defaults to edgeSize; set to less than edgeSize to allow the contained Canvas to overlap the edge and corner media.- Parameters:
edgeOffset
- New edgeOffset value. Default value is null- Returns:
Canvas
instance, for chaining setter calls- Throws:
IllegalStateException
- this property cannot be changed after the component has been created- See Also:
-
getEdgeOffset
Amount the contained Canvas should be offset. Defaults to edgeSize; set to less than edgeSize to allow the contained Canvas to overlap the edge and corner media.- Returns:
- Current edgeOffset value. Default value is null
- See Also:
-
setEdgeOpacity
Opacity of the edges. Defaults to matching this.opacity. ifsetOpacity()
is called on a Canvas where edgeOpacity is set, edgeOpacity will be considered a percentage of the parent's opacity (so 50% opaque parent plus edgeOpacity 50 means 25% opaque edges)
If this method is called after the component has been drawn/initialized: Set theedgeOpacity
and mark the canvas for redraw- Parameters:
edgeOpacity
- new edge-opacity level. Default value is null- Returns:
Canvas
instance, for chaining setter calls- Throws:
IllegalStateException
- this property cannot be changed after the component has been created- See Also:
-
getEdgeOpacity
Opacity of the edges. Defaults to matching this.opacity. ifsetOpacity()
is called on a Canvas where edgeOpacity is set, edgeOpacity will be considered a percentage of the parent's opacity (so 50% opaque parent plus edgeOpacity 50 means 25% opaque edges)- Returns:
- Current edgeOpacity value. Default value is null
- See Also:
-
setEdgeShowCenter
Whether to show media in the center section, that is, behind the decorated Canvas.- Parameters:
edgeShowCenter
- New edgeShowCenter value. Default value is false- Returns:
Canvas
instance, for chaining setter calls- Throws:
IllegalStateException
- this property cannot be changed after the component has been created- See Also:
-
getEdgeShowCenter
Whether to show media in the center section, that is, behind the decorated Canvas.- Returns:
- Current edgeShowCenter value. Default value is false
- See Also:
-
setEdgeSize
Size in pixels for corners and edges- Parameters:
edgeSize
- New edgeSize value. Default value is 10- Returns:
Canvas
instance, for chaining setter calls- Throws:
IllegalStateException
- this property cannot be changed after the component has been created- See Also:
-
getEdgeSize
public int getEdgeSize()Size in pixels for corners and edges- Returns:
- Current edgeSize value. Default value is 10
- See Also:
-
getEditNode
The component'sEditNode
for a component that has been created by aPalette
from aPaletteNode
.Note : This method should be called only after the widget has been rendered.
- Returns:
- Current editNode value. Default value is null
- Throws:
IllegalStateException
- if this widget has not yet been rendered.
-
getEditProxy
AnEditProxy
controls the behaviors of a component when it is placed intoediting mode
.The
editProxy
AutoChild is created when a component is first placed into edit mode viasetEditMode()
.editProxy
properties can be supplied on aPaletteNode
orEditNode
aseditProxyProperties
, but must be provided before the component is first placed into edit mode.Most editable components use a custom EditProxy. See the documentation for each class'
editProxyConstructor
to determine the class.This component is an AutoChild named "editProxy". For an overview of how to use and configure AutoChildren, see
Using AutoChildren
.- Returns:
- Current editProxy value. Default value is null
- Throws:
IllegalStateException
- if this widget has not yet been rendered.- See Also:
-
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 "CanvasEditProxy"- Returns:
Canvas
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 "CanvasEditProxy"
- See Also:
-
setEnableWhen
Criteria to be evaluated to determine whether this Canvas should be enabled. Re-evaluated whenever data in theruleScope
changes.A basic criteria uses textMatchStyle:"exact". When specified in
Component XML
this property allowsshorthand formats
for defining criteria.- Parameters:
enableWhen
- New enableWhen value. Default value is null- Returns:
Canvas
instance, for chaining setter calls- Throws:
IllegalStateException
- this property cannot be changed after the component has been created- See Also:
-
getEnableWhen
Criteria to be evaluated to determine whether this Canvas should be enabled. Re-evaluated whenever data in theruleScope
changes.A basic criteria uses textMatchStyle:"exact". When specified in
Component XML
this property allowsshorthand formats
for defining criteria.- Returns:
- Current enableWhen value. Default value is null
- See Also:
-
setEndLine
Whether this canvas should end the line it's in when used as a tile in aFlowLayout
. This property is not supported in aTileLayout
withTileLayout.layoutPolicy
: "fit" or if databound (i.e.TileGrid
).- Parameters:
endLine
- New endLine value. Default value is false- Returns:
Canvas
instance, for chaining setter calls- See Also:
-
getEndLine
Whether this canvas should end the line it's in when used as a tile in aFlowLayout
. This property is not supported in aTileLayout
withTileLayout.layoutPolicy
: "fit" or if databound (i.e.TileGrid
).- Returns:
- Current endLine value. Default value is false
- See Also:
-
setExtraSpace
When this Canvas is included as a member in a Layout, extra blank space that should be left after this member in a Layout.- Parameters:
extraSpace
- New extraSpace value. Default value is 0- Returns:
Canvas
instance, for chaining setter calls- Throws:
IllegalStateException
- this property cannot be changed after the component has been created- See Also:
-
getExtraSpace
public int getExtraSpace()When this Canvas is included as a member in a Layout, extra blank space that should be left after this member in a Layout.- Returns:
- Current extraSpace value. Default value is 0
- See Also:
-
setFloatingScrollbars
IfshowCustomScrollbars
is true, should the scrollbars be drawn floating over the component handle, or should the handle shrink to accommodate them?Floating scrollbars are typically only appropriate for scrollbars that are hidden by default and get shown as the user actively scrolls the widget handle, such as in the
nativeAutoHideScrollbars
case. If floating scrollbars are permanently visible over the component handle, they may block some of the widget's content.Note : This is an advanced setting
- Parameters:
floatingScrollbars
- New floatingScrollbars value. Default value is false- Returns:
Canvas
instance, for chaining setter calls- Throws:
IllegalStateException
- this property cannot be changed after the component has been created
-
getFloatingScrollbars
public boolean getFloatingScrollbars()IfshowCustomScrollbars
is true, should the scrollbars be drawn floating over the component handle, or should the handle shrink to accommodate them?Floating scrollbars are typically only appropriate for scrollbars that are hidden by default and get shown as the user actively scrolls the widget handle, such as in the
nativeAutoHideScrollbars
case. If floating scrollbars are permanently visible over the component handle, they may block some of the widget's content.- Returns:
- Current floatingScrollbars value. Default value is false
-
setForwardSVGeventsToObject
public Canvas setForwardSVGeventsToObject(Boolean forwardSVGeventsToObject) throws IllegalStateException If true, events sent to the SVG inside an object tag are forwarded to the object itself by Framework handlers. If false, "pointer-events:none" CSS is set on the object so that events are directly sent to the object by the browser, if supported.The advantage of forwarding events is that it allows hover CSS or any other event-driven logic on the SVG to work as expected. If "pointer-events:none" is written out, no GUI interaction will trigger events in the SVG, including hover CSS. The disadvantage is that only a few critical events are forwarded, such as "mouseDown", "mouseMove", and "mouseUp" for non-touch platforms, and "click" for touch platforms. Other events will be delivered to the SVG, but not forwarded up to the parent document/object tag.
Note : This is an advanced setting
- Parameters:
forwardSVGeventsToObject
- New forwardSVGeventsToObject value. Default value is true- Returns:
Canvas
instance, for chaining setter calls- Throws:
IllegalStateException
- this property cannot be changed after the component has been created- See Also:
-
getForwardSVGeventsToObject
If true, events sent to the SVG inside an object tag are forwarded to the object itself by Framework handlers. If false, "pointer-events:none" CSS is set on the object so that events are directly sent to the object by the browser, if supported.The advantage of forwarding events is that it allows hover CSS or any other event-driven logic on the SVG to work as expected. If "pointer-events:none" is written out, no GUI interaction will trigger events in the SVG, including hover CSS. The disadvantage is that only a few critical events are forwarded, such as "mouseDown", "mouseMove", and "mouseUp" for non-touch platforms, and "click" for touch platforms. Other events will be delivered to the SVG, but not forwarded up to the parent document/object tag.
- Returns:
- Current forwardSVGeventsToObject value. Default value is true
- See Also:
-
setGroupBorderCSS
Sets the style for the grouping frame around the canvas. Only necessary when showing agrouping frame
.- Parameters:
groupBorderCSS
- New groupBorderCSS value. Default value is "2px solid black"- Returns:
Canvas
instance, for chaining setter calls- Throws:
IllegalStateException
- this property cannot be changed after the component has been created- See Also:
-
getGroupBorderCSS
Sets the style for the grouping frame around the canvas. Only necessary when showing agrouping frame
.- Returns:
- Current groupBorderCSS value. Default value is "2px solid black"
- See Also:
-
setGroupLabelBackgroundColor
If set, the background color of the grouping label. Only applicable when showing agrouping frame
.This corresponds to the CSS background-color property on the grouping label. You can set this property to an RGB value (e.g. #22AAFF) or a named color (e.g. red) from a list of browser supported color names.
The getter for this attribute,
getGroupLabelBackgroundColor()
, returns the color that will actually be used; i.e. if groupLabelBackgroundColor is left unset or is set to null, then getGroupLabelBackgroundColor() returns the color string that will be used.
If this method is called after the component has been drawn/initialized: Setter forgroupLabelBackgroundColor
.- Parameters:
groupLabelBackgroundColor
- the new grouping label background color. Default value is null- Returns:
Canvas
instance, for chaining setter calls- See Also:
-
getGroupLabelBackgroundColor
If set, the background color of the grouping label. Only applicable when showing agrouping frame
.This corresponds to the CSS background-color property on the grouping label. You can set this property to an RGB value (e.g. #22AAFF) or a named color (e.g. red) from a list of browser supported color names.
The getter for this attribute,
getGroupLabelBackgroundColor()
, returns the color that will actually be used; i.e. if groupLabelBackgroundColor is left unset or is set to null, then getGroupLabelBackgroundColor() returns the color string that will be used.- Returns:
- Current groupLabelBackgroundColor value. Default value is null
- See Also:
-
setGroupLabelStyleName
Sets the style for the grouping label. Only necessary when showing agrouping frame
.Note that
groupLabelBackgroundColor
overrides any background-color of this style.- Parameters:
groupLabelStyleName
- New groupLabelStyleName value. Default value is "groupLabel"- Returns:
Canvas
instance, for chaining setter calls- Throws:
IllegalStateException
- this property cannot be changed after the component has been created- See Also:
-
getGroupLabelStyleName
Sets the style for the grouping label. Only necessary when showing agrouping frame
.Note that
groupLabelBackgroundColor
overrides any background-color of this style.- Returns:
- Current groupLabelStyleName value. Default value is "groupLabel"
- See Also:
-
setGroupPadding
Padding to apply inside the border when this canvas is showing a groupborder and label
.- Parameters:
groupPadding
- New groupPadding value. Default value is 10- Returns:
Canvas
instance, for chaining setter calls- Throws:
IllegalStateException
- this property cannot be changed after the component has been created- See Also:
-
getGroupPadding
Padding to apply inside the border when this canvas is showing a groupborder and label
.- Returns:
- Current groupPadding value. Default value is 10
- See Also:
-
setGroupTitle
The title/label for the grouping. Only applicable whenisGroup
is set to true. Nogrouping frame
or title/label will be shown unless this property is a non-empty string.
If this method is called after the component has been drawn/initialized: Setter forgroupTitle
.- Parameters:
groupTitle
- The new title for the grouping. Default value is null- Returns:
Canvas
instance, for chaining setter calls- See Also:
-
getGroupTitle
The title/label for the grouping. Only applicable whenisGroup
is set to true. Nogrouping frame
or title/label will be shown unless this property is a non-empty string.- Returns:
- Current groupTitle value. Default value is null
- See Also:
-
setHeight
Thecanvas.width
attribute specifies the size for a component's horizontal dimension;canvas.height
specifies the size for the vertical dimension.May be set to an integer value (a number of pixels), a percentage value like "50%", or "*".
See
PercentSizing
for details on how percentage or"*"
values are resolved actual size.If
overflow
is set to "visible", the specified size acts as a minimum, and the component may overflow to show all content and/or children.Note that developers wishing to set a default width or height for a component class should set
defaultWidth
ordefaultHeight
instead of specifying an explicit defaultwidth
orheight
. This is important for components added to aLayout
as members - it allows the Layout to determine whether the canvas has an explicitly specified size that must be respected, or whether it can participate in itssizing policies
.
If this method is called after the component has been drawn/initialized: Resizes the widget vertically to the specified height (moves the bottom side of the widget). The height parameter can be expressed as a percentage of viewport size or as the number of pixels.NOTE: if you're setting multiple coordinates, use resizeTo() or setRect() instead
- Parameters:
height
- new height. Default value is null- Returns:
Canvas
instance, for chaining setter calls- See Also:
-
getHeight
Thecanvas.width
attribute specifies the size for a component's horizontal dimension;canvas.height
specifies the size for the vertical dimension.May be set to an integer value (a number of pixels), a percentage value like "50%", or "*".
See
PercentSizing
for details on how percentage or"*"
values are resolved actual size.If
overflow
is set to "visible", the specified size acts as a minimum, and the component may overflow to show all content and/or children.Note that developers wishing to set a default width or height for a component class should set
defaultWidth
ordefaultHeight
instead of specifying an explicit defaultwidth
orheight
. This is important for components added to aLayout
as members - it allows the Layout to determine whether the canvas has an explicitly specified size that must be respected, or whether it can participate in itssizing policies
.- Returns:
- Return the height of this object, in pixels.
See
GettingCanvasSize
. Default value is null - See Also:
-
setHeight
Thecanvas.width
attribute specifies the size for a component's horizontal dimension;canvas.height
specifies the size for the vertical dimension.May be set to an integer value (a number of pixels), a percentage value like "50%", or "*".
See
PercentSizing
for details on how percentage or"*"
values are resolved actual size.If
overflow
is set to "visible", the specified size acts as a minimum, and the component may overflow to show all content and/or children.Note that developers wishing to set a default width or height for a component class should set
defaultWidth
ordefaultHeight
instead of specifying an explicit defaultwidth
orheight
. This is important for components added to aLayout
as members - it allows the Layout to determine whether the canvas has an explicitly specified size that must be respected, or whether it can participate in itssizing policies
.
If this method is called after the component has been drawn/initialized: Resizes the widget vertically to the specified height (moves the bottom side of the widget). The height parameter can be expressed as a percentage of viewport size or as the number of pixels.NOTE: if you're setting multiple coordinates, use resizeTo() or setRect() instead
-
setHideUsingDisplayNone
When this widget is hidden (seevisibility
andhide()
), should display:none be applied to theouter element
?This setting is not supported for general use, but in certain cases, it has been shown that display:none is a work-around for browser bugs involving burn-through of iframes or plugins, where the content of the iframe or plugin may still be visible despite the containing widget being hidden.
Note : This is an advanced setting
- Parameters:
hideUsingDisplayNone
- New hideUsingDisplayNone value. Default value is false- Returns:
Canvas
instance, for chaining setter calls- Throws:
IllegalStateException
- this property cannot be changed after the component has been created- See Also:
-
getHideUsingDisplayNone
public boolean getHideUsingDisplayNone()When this widget is hidden (seevisibility
andhide()
), should display:none be applied to theouter element
?This setting is not supported for general use, but in certain cases, it has been shown that display:none is a work-around for browser bugs involving burn-through of iframes or plugins, where the content of the iframe or plugin may still be visible despite the containing widget being hidden.
- Returns:
- Current hideUsingDisplayNone value. Default value is false
- See Also:
-
setHoverAlign
Ifthis.showHover
is true, this property can be used to customize the alignment of content in the hover canvas.- Parameters:
hoverAlign
- New hoverAlign value. Default value is null- Returns:
Canvas
instance, for chaining setter calls- See Also:
-
getHoverAlign
Ifthis.showHover
is true, this property can be used to customize the alignment of content in the hover canvas.- Returns:
- Current hoverAlign value. Default value is null
- See Also:
-
setHoverAutoDestroy
Ifthis.showHover
is true andgetHoverComponent()
is implemented, should the hoverCanvas returned from it be automatically destroyed when it is hidden?The default of null indicates that the component will be automatically destroyed. Set to false to prevent this.
- Parameters:
hoverAutoDestroy
- New hoverAutoDestroy value. Default value is null- Returns:
Canvas
instance, for chaining setter calls- See Also:
-
getHoverAutoDestroy
Ifthis.showHover
is true andgetHoverComponent()
is implemented, should the hoverCanvas returned from it be automatically destroyed when it is hidden?The default of null indicates that the component will be automatically destroyed. Set to false to prevent this.
- Returns:
- Current hoverAutoDestroy value. Default value is null
- See Also:
-
setHoverAutoFitMaxWidth
Maximum auto-fit width for a hover ifhoverAutoFitWidth
is enabled. May be specified as a pixel value, or a percentage of page width.- Parameters:
hoverAutoFitMaxWidth
- New hoverAutoFitMaxWidth value. Default value is 200- Returns:
Canvas
instance, for chaining setter calls
-
getHoverAutoFitMaxWidth
public int getHoverAutoFitMaxWidth()Maximum auto-fit width for a hover ifhoverAutoFitWidth
is enabled. May be specified as a pixel value, or a percentage of page width.- Returns:
- Current hoverAutoFitMaxWidth value. Default value is 200
-
setHoverAutoFitMaxWidth
Maximum auto-fit width for a hover ifhoverAutoFitWidth
is enabled. May be specified as a pixel value, or a percentage of page width.- Parameters:
hoverAutoFitMaxWidth
- New hoverAutoFitMaxWidth value. Default value is 200- Returns:
Canvas
instance, for chaining setter calls
-
getHoverAutoFitMaxWidthAsString
Maximum auto-fit width for a hover ifhoverAutoFitWidth
is enabled. May be specified as a pixel value, or a percentage of page width.- Returns:
- Current hoverAutoFitMaxWidth value. Default value is 200
-
setHoverAutoFitWidth
ifshowHover
is true, this property will cause the specifiedhoverWidth
to be treated as a minimum width for the hover. If the hover content string exceeds this, the hover will expand to accommodate it up tohoverAutoFitMaxWidth
(without the text wrapping).Using this settings differs from simply disabling wrapping via
hoverWrap:false
as the content will wrap if thehoverAutoFitMaxWidth
is exceeded.Note : This is an advanced setting
- Parameters:
hoverAutoFitWidth
- New hoverAutoFitWidth value. Default value is true- Returns:
Canvas
instance, for chaining setter calls- See Also:
-
getHoverAutoFitWidth
ifshowHover
is true, this property will cause the specifiedhoverWidth
to be treated as a minimum width for the hover. If the hover content string exceeds this, the hover will expand to accommodate it up tohoverAutoFitMaxWidth
(without the text wrapping).Using this settings differs from simply disabling wrapping via
hoverWrap:false
as the content will wrap if thehoverAutoFitMaxWidth
is exceeded.- Returns:
- Current hoverAutoFitWidth value. Default value is true
- See Also:
-
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:
Canvas
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:
-
setHoverFocusKey
For canvasesshowing a hover
, this attribute gives users a way to pin the hover in place so they can interact with it (scroll it, click embedded links, etc). Clicking outside the hover (on some other component) will still dismiss it.When enabled, the standard hover canvas will display the
focusKeyHintLabel
to prompt the user on how to give the hover focus. This behavior may be disabled by settingshowFocusKeyHint
to falseNote that setting a hoverFocusKey also sets
hoverPersist
to "clickPin". This makes hovers stay visible while the cursor is over them, and become pinned if clicked, the same as pressing the hoverFocusKey. -
getHoverFocusKey
For canvasesshowing a hover
, this attribute gives users a way to pin the hover in place so they can interact with it (scroll it, click embedded links, etc). Clicking outside the hover (on some other component) will still dismiss it.When enabled, the standard hover canvas will display the
focusKeyHintLabel
to prompt the user on how to give the hover focus. This behavior may be disabled by settingshowFocusKeyHint
to falseNote that setting a hoverFocusKey also sets
hoverPersist
to "clickPin". This makes hovers stay visible while the cursor is over them, and become pinned if clicked, the same as pressing the hoverFocusKey.- Returns:
- Current hoverFocusKey value. Default value is null
- See Also:
-
setHoverHeight
Ifthis.showHover
is true, this property can be used to customize the height of the hover canvas shown.- Parameters:
hoverHeight
- New hoverHeight value. Default value is null- Returns:
Canvas
instance, for chaining setter calls- See Also:
-
getHoverHeight
Ifthis.showHover
is true, this property can be used to customize the height of the hover canvas shown.- Returns:
- Current hoverHeight value. Default value is null
- See Also:
-
setHoverMoveWithMouse
Ifthis.showHover
is true, should this widget's hover canvas be moved with the mouse while visible?- Parameters:
hoverMoveWithMouse
- New hoverMoveWithMouse value. Default value is null- Returns:
Canvas
instance, for chaining setter calls- See Also:
-
getHoverMoveWithMouse
Ifthis.showHover
is true, should this widget's hover canvas be moved with the mouse while visible?- Returns:
- Current hoverMoveWithMouse value. Default value is null
- See Also:
-
setHoverOpacity
Ifthis.showHover
is true, should the hover canvas be shown with opacity other than 100?- Parameters:
hoverOpacity
- New hoverOpacity value. Default value is null- Returns:
Canvas
instance, for chaining setter calls- See Also:
-
getHoverOpacity
Ifthis.showHover
is true, should the hover canvas be shown with opacity other than 100?- Returns:
- Current hoverOpacity value. Default value is null
- See Also:
-
setHoverPersist
Allows interaction with hovers when the cursor is positioned over them.- Parameters:
hoverPersist
- New hoverPersist value. Default value is null- Returns:
Canvas
instance, for chaining setter calls- See Also:
-
com.smartgwt.client.widgets.Hover#persistent
-
getHoverPersist
Allows interaction with hovers when the cursor is positioned over them.- Returns:
- Current hoverPersist value. Default value is null
- See Also:
-
com.smartgwt.client.widgets.Hover#persistent
-
setHoverScreen
Screen to create (viacreateScreen()
) in lieu of callinggetHoverComponent()
.- Parameters:
hoverScreen
- New hoverScreen value. Default value is null- Returns:
Canvas
instance, for chaining setter calls- Throws:
IllegalStateException
- this property cannot be changed after the component has been created
-
getHoverScreen
Screen to create (viacreateScreen()
) in lieu of callinggetHoverComponent()
.- Returns:
- Current hoverScreen value. Default value is null
-
setHoverStyle
Ifthis.showHover
is true, this property can be used to specify the css style to apply to the hover canvas.- Parameters:
hoverStyle
- New hoverStyle value. Default value is null- Returns:
Canvas
instance, for chaining setter calls- See Also:
-
getHoverStyle
Ifthis.showHover
is true, this property can be used to specify the css style to apply to the hover canvas.- Returns:
- Current hoverStyle value. Default value is null
- See Also:
-
setHoverVAlign
Ifthis.showHover
is true, this property can be used to customize the vertical alignment of content in the hover canvas.- Parameters:
hoverVAlign
- New hoverVAlign value. Default value is null- Returns:
Canvas
instance, for chaining setter calls- See Also:
-
getHoverVAlign
Ifthis.showHover
is true, this property can be used to customize the vertical alignment of content in the hover canvas.- Returns:
- Current hoverVAlign value. Default value is null
- See Also:
-
setHoverWidth
Ifthis.showHover
is true, this property can be used to customize the width of the hover canvas shown. See alsohoverAutoFitWidth
andhoverAutoFitMaxWidth
.- Parameters:
hoverWidth
- New hoverWidth value. Default value is 1- Returns:
Canvas
instance, for chaining setter calls- See Also:
-
getHoverWidth
public int getHoverWidth()Ifthis.showHover
is true, this property can be used to customize the width of the hover canvas shown. See alsohoverAutoFitWidth
andhoverAutoFitMaxWidth
.- Returns:
- Current hoverWidth value. Default value is 1
- See Also:
-
setHoverWrap
Ifthis.showHover
is true, this property can be used to customize the whether content in the hover canvas is displayed in a single line, or wraps.Note that if developers wish to have hovers expand horizontally to fit their text without wrapping *up to some maximum*, and then wrap rather than exceeding that maximum, the
hoverAutoFitWidth
andhoverAutoFitMaxWidth
attributes may be used instead of simply setting hoverWrap to false.- Parameters:
hoverWrap
- New hoverWrap value. Default value is null- Returns:
Canvas
instance, for chaining setter calls- See Also:
-
getHoverWrap
Ifthis.showHover
is true, this property can be used to customize the whether content in the hover canvas is displayed in a single line, or wraps.Note that if developers wish to have hovers expand horizontally to fit their text without wrapping *up to some maximum*, and then wrap rather than exceeding that maximum, the
hoverAutoFitWidth
andhoverAutoFitMaxWidth
attributes may be used instead of simply setting hoverWrap to false.- Returns:
- Current hoverWrap value. Default value is null
- See Also:
-
setHtmlElement
If specified as a pointer to an HTML element present in the DOM, this canvas will be rendered inside that element ondraw()
. If provided as a String, the String will be replaced by a DOM node as returned from document.getElementById(htmlElement) on initialization.NOTES:
This feature is intended for integration with other JavaScript frameworks and legacy page architectures only; the native browser's reaction to DOM insertion is unspecified and unsupported. For consistent cross-browser layout and positioning semantics, use Canvas parents (especially Layouts) and use absolute positioning at top level.In some cases, the target element may need a specified height to be rendered correctly. In this cases, you can expect to find a message like the following in the JavaScript console: "isc_DataView_0:can't resize to height: 0; clamping to 1 [enable 'sizing' log for stack trace]"
Persistence of htmlElement: If
htmlPosition
is set to"replace"
the htmlElement will be removed from the DOM when the canvas is drawn - therefore the htmlElement attribute will be cleared at this time. Otherwise if a Canvas is clear()d and then draw()n again it will be rendered inside the same htmlElement.
If a Canvas is added as a child to Canvas parent, its htmlElement will be dropped.position
should typically be set to"relative"
if the widget is to be rendered inline within a standard page.
If this method is called after the component has been drawn/initialized: Setter for thehtmlElement
.Note : This is an advanced setting
- Overrides:
setHtmlElement
in classBaseWidget
- Parameters:
htmlElement
- New htmlElement for this canvas or Null to clear the existing htmlElement. You may also provide a string with the elements ID, which will have the effect of settinghtmlElement
to the node returned by document.getElementById(element). Note that you may need to set position:relative explicitly following a call to this function. Default value is null- Returns:
Canvas
instance, for chaining setter calls- See Also:
-
getHtmlElement
If specified as a pointer to an HTML element present in the DOM, this canvas will be rendered inside that element ondraw()
. If provided as a String, the String will be replaced by a DOM node as returned from document.getElementById(htmlElement) on initialization.NOTES:
This feature is intended for integration with other JavaScript frameworks and legacy page architectures only; the native browser's reaction to DOM insertion is unspecified and unsupported. For consistent cross-browser layout and positioning semantics, use Canvas parents (especially Layouts) and use absolute positioning at top level.In some cases, the target element may need a specified height to be rendered correctly. In this cases, you can expect to find a message like the following in the JavaScript console: "isc_DataView_0:can't resize to height: 0; clamping to 1 [enable 'sizing' log for stack trace]"
Persistence of htmlElement: If
htmlPosition
is set to"replace"
the htmlElement will be removed from the DOM when the canvas is drawn - therefore the htmlElement attribute will be cleared at this time. Otherwise if a Canvas is clear()d and then draw()n again it will be rendered inside the same htmlElement.
If a Canvas is added as a child to Canvas parent, its htmlElement will be dropped.position
should typically be set to"relative"
if the widget is to be rendered inline within a standard page.- Returns:
- Current htmlElement value. Default value is null
- See Also:
-
setHtmlElement
If specified as a pointer to an HTML element present in the DOM, this canvas will be rendered inside that element ondraw()
. If provided as a String, the String will be replaced by a DOM node as returned from document.getElementById(htmlElement) on initialization.NOTES:
This feature is intended for integration with other JavaScript frameworks and legacy page architectures only; the native browser's reaction to DOM insertion is unspecified and unsupported. For consistent cross-browser layout and positioning semantics, use Canvas parents (especially Layouts) and use absolute positioning at top level.In some cases, the target element may need a specified height to be rendered correctly. In this cases, you can expect to find a message like the following in the JavaScript console: "isc_DataView_0:can't resize to height: 0; clamping to 1 [enable 'sizing' log for stack trace]"
Persistence of htmlElement: If
htmlPosition
is set to"replace"
the htmlElement will be removed from the DOM when the canvas is drawn - therefore the htmlElement attribute will be cleared at this time. Otherwise if a Canvas is clear()d and then draw()n again it will be rendered inside the same htmlElement.
If a Canvas is added as a child to Canvas parent, its htmlElement will be dropped.position
should typically be set to"relative"
if the widget is to be rendered inline within a standard page.
If this method is called after the component has been drawn/initialized: Setter for thehtmlElement
.Note : This is an advanced setting
- Parameters:
htmlElement
- New htmlElement for this canvas or Null to clear the existing htmlElement. You may also provide a string with the elements ID, which will have the effect of settinghtmlElement
to the node returned by document.getElementById(element). Note that you may need to set position:relative explicitly following a call to this function. Default value is null- Returns:
Canvas
instance, for chaining setter calls- See Also:
-
getHtmlElementAsString
If specified as a pointer to an HTML element present in the DOM, this canvas will be rendered inside that element ondraw()
. If provided as a String, the String will be replaced by a DOM node as returned from document.getElementById(htmlElement) on initialization.NOTES:
This feature is intended for integration with other JavaScript frameworks and legacy page architectures only; the native browser's reaction to DOM insertion is unspecified and unsupported. For consistent cross-browser layout and positioning semantics, use Canvas parents (especially Layouts) and use absolute positioning at top level.In some cases, the target element may need a specified height to be rendered correctly. In this cases, you can expect to find a message like the following in the JavaScript console: "isc_DataView_0:can't resize to height: 0; clamping to 1 [enable 'sizing' log for stack trace]"
Persistence of htmlElement: If
htmlPosition
is set to"replace"
the htmlElement will be removed from the DOM when the canvas is drawn - therefore the htmlElement attribute will be cleared at this time. Otherwise if a Canvas is clear()d and then draw()n again it will be rendered inside the same htmlElement.
If a Canvas is added as a child to Canvas parent, its htmlElement will be dropped.position
should typically be set to"relative"
if the widget is to be rendered inline within a standard page.- Returns:
- Current htmlElement value. Default value is null
- See Also:
-
setHtmlPosition
IfhtmlElement
is specified, this attribute specifies the position where the canvas should be inserted relative to thehtmlElement
in the DOM.
If this method is called after the component has been drawn/initialized: Setter for thehtmlPosition
.Note : This is an advanced setting
- Parameters:
htmlPosition
- New htmlPosition for this canvas. Default value is "afterBegin"- Returns:
Canvas
instance, for chaining setter calls- See Also:
-
getHtmlPosition
IfhtmlElement
is specified, this attribute specifies the position where the canvas should be inserted relative to thehtmlElement
in the DOM.- Returns:
- Current htmlPosition value. Default value is "afterBegin"
- See Also:
-
setIsGroup
Should a grouping frame be shown around this canvas if a non-empty string has been specified forgroupTitle
.- Parameters:
isGroup
- New isGroup value. Default value is true- Returns:
Canvas
instance, for chaining setter calls- Throws:
IllegalStateException
- this property cannot be changed after the component has been created- See Also:
-
getIsGroup
public boolean getIsGroup()Should a grouping frame be shown around this canvas if a non-empty string has been specified forgroupTitle
.- Returns:
- Current isGroup value. Default value is true
- See Also:
-
getIsPrinting
This boolean flag will be set to true by framework logic while generating print HTML for this widget as a result to a call toshowPrintPreview()
(or justgetPrintHTML()
). Note that this flag is set recursively as parent widgets generate print HTML for their children.This is a read-only property and should not be modified by application code.
Note : This method should be called only after the widget has been rendered.
- Returns:
- Current isPrinting value. Default value is false
- Throws:
IllegalStateException
- if this widget has not yet been rendered.
-
setIsRuleScope
Marks this Canvas as theruleScope
that will be discovered by any containedDataBoundComponent
s which do not specify an explicitruleScope
.- Parameters:
isRuleScope
- New isRuleScope value. Default value is null- Returns:
Canvas
instance, for chaining setter calls- Throws:
IllegalStateException
- this property cannot be changed after the component has been created
-
getIsRuleScope
Marks this Canvas as theruleScope
that will be discovered by any containedDataBoundComponent
s which do not specify an explicitruleScope
.- Returns:
- Current isRuleScope value. Default value is null
-
setIsSnapAlignCandidate
Flag to disable snapping to alignment against this Canvas when other Canvases dragged into the same parent whenchildrenSnapAlign
is enabled on this Canvas' parent.- Parameters:
isSnapAlignCandidate
- New isSnapAlignCandidate value. Default value is null- Returns:
Canvas
instance, for chaining setter calls- See Also:
-
getIsSnapAlignCandidate
Flag to disable snapping to alignment against this Canvas when other Canvases dragged into the same parent whenchildrenSnapAlign
is enabled on this Canvas' parent.- Returns:
- Current isSnapAlignCandidate value. Default value is null
- See Also:
-
setKeepInParentRect
Constrains drag-resizing and drag-repositioning of this canvas to either the rect of its parent (if set to true) or an arbitrary rect based on its parent (if set to a [Left,Top,Width,Height] rect array). In the latter mode you may use negative offsets for left/top and a width/height greater than the visible or scroll width of the parent to allow positioning beyond the confines of the parent.If this canvas has no parent, constrains dragging to within the browser window.
Affects target and outline dragAppearance, not tracker.
Note: keepInParentRect affects only user drag interactions, not programmatic moves.
Example use cases:
keepInParentRect: true
- confine to parent
keepInParentRect: [0, 0, 500, 500]
- confine to top left 500x500 region within parent
keepInParentRect: [0, 0, 10000, 10000]
- in combination with overflow: "auto", confine to parent, but allow moving off the right and bottom of the parent to force scrolling (and hence enlarge the scrollWidth of the parent).Note : This is an advanced setting
- Parameters:
keepInParentRect
- New keepInParentRect value. Default value is null- Returns:
Canvas
instance, for chaining setter calls- See Also:
-
getKeepInParentRect
Constrains drag-resizing and drag-repositioning of this canvas to either the rect of its parent (if set to true) or an arbitrary rect based on its parent (if set to a [Left,Top,Width,Height] rect array). In the latter mode you may use negative offsets for left/top and a width/height greater than the visible or scroll width of the parent to allow positioning beyond the confines of the parent.If this canvas has no parent, constrains dragging to within the browser window.
Affects target and outline dragAppearance, not tracker.
Note: keepInParentRect affects only user drag interactions, not programmatic moves.
Example use cases:
keepInParentRect: true
- confine to parent
keepInParentRect: [0, 0, 500, 500]
- confine to top left 500x500 region within parent
keepInParentRect: [0, 0, 10000, 10000]
- in combination with overflow: "auto", confine to parent, but allow moving off the right and bottom of the parent to force scrolling (and hence enlarge the scrollWidth of the parent).- Returns:
- Current keepInParentRect value. Default value is null
- See Also:
-
setKeepInParentRect
Constrains drag-resizing and drag-repositioning of this canvas to either the rect of its parent (if set to true) or an arbitrary rect based on its parent (if set to a [Left,Top,Width,Height] rect array). In the latter mode you may use negative offsets for left/top and a width/height greater than the visible or scroll width of the parent to allow positioning beyond the confines of the parent.If this canvas has no parent, constrains dragging to within the browser window.
Affects target and outline dragAppearance, not tracker.
Note: keepInParentRect affects only user drag interactions, not programmatic moves.
Example use cases:
keepInParentRect: true
- confine to parent
keepInParentRect: [0, 0, 500, 500]
- confine to top left 500x500 region within parent
keepInParentRect: [0, 0, 10000, 10000]
- in combination with overflow: "auto", confine to parent, but allow moving off the right and bottom of the parent to force scrolling (and hence enlarge the scrollWidth of the parent).Note : This is an advanced setting
- Parameters:
keepInParentRect
- New keepInParentRect value. Default value is null- Returns:
Canvas
instance, for chaining setter calls- See Also:
-
setLayoutAlign
When this Canvas is included as a member in a Layout, layoutAlign controls alignment on the breadth axis of the layout. Default is "left" for a VLayout, "top" for an HLayout.- Parameters:
layoutAlign
- New layoutAlign value. Default value is null- Returns:
Canvas
instance, for chaining setter calls- See Also:
-
getLayoutAlign
When this Canvas is included as a member in a Layout, layoutAlign controls alignment on the breadth axis of the layout. Default is "left" for a VLayout, "top" for an HLayout.- Returns:
- Current layoutAlign value. Default value is null
- See Also:
-
setLayoutAlign
When this Canvas is included as a member in a Layout, layoutAlign controls alignment on the breadth axis of the layout. Default is "left" for a VLayout, "top" for an HLayout.- Parameters:
layoutAlign
- New layoutAlign value. Default value is null- Returns:
Canvas
instance, for chaining setter calls- See Also:
-
setLeaveGroupLabelSpace
When showing this widget in agroup
, should any content be shifted down so that the group-label doesn't sit in front of it?- Parameters:
leaveGroupLabelSpace
- New leaveGroupLabelSpace value. Default value is true- Returns:
Canvas
instance, for chaining setter calls- Throws:
IllegalStateException
- this property cannot be changed after the component has been created- See Also:
-
getLeaveGroupLabelSpace
When showing this widget in agroup
, should any content be shifted down so that the group-label doesn't sit in front of it?- Returns:
- Current leaveGroupLabelSpace value. Default value is true
- See Also:
-
setLeavePageSpace
If set, overrides the globaldefaultPageSpace
.
If this method is called after the component has been drawn/initialized: Setter forleavePageSpace
.Note : This is an advanced setting
- Parameters:
leavePageSpace
- new value forleavePageSpace
. Default value is null- Returns:
Canvas
instance, for chaining setter calls- See Also:
-
getLeavePageSpace
If set, overrides the globaldefaultPageSpace
.- Returns:
- Current leavePageSpace value. Default value is null
- See Also:
-
setLeft
Number of pixels the left side of the widget is offset to the right from its default drawing context (either its parent's topleft corner, or the document flow, depending on the value of theposition
property).Can also be set as a percentage, specified as a String ending in '%', eg, "50%". In this case the top coordinate is considered as a percentage of the specified width of the
parent
.
If this method is called after the component has been drawn/initialized: Set the left coordinate of this object, relative to its enclosing context, in pixels. NOTE: if you're setting multiple coordinates, use setRect(), moveTo() or resizeTo() instead- Parameters:
left
- new left coordinate. Default value is 0- Returns:
Canvas
instance, for chaining setter calls- See Also:
-
getLeft
public int getLeft()Number of pixels the left side of the widget is offset to the right from its default drawing context (either its parent's topleft corner, or the document flow, depending on the value of theposition
property).Can also be set as a percentage, specified as a String ending in '%', eg, "50%". In this case the top coordinate is considered as a percentage of the specified width of the
parent
.- Returns:
- Return the left coordinate of this object, relative to its enclosing context, in pixels. Default value is 0
- See Also:
-
setLeft
Number of pixels the left side of the widget is offset to the right from its default drawing context (either its parent's topleft corner, or the document flow, depending on the value of theposition
property).Can also be set as a percentage, specified as a String ending in '%', eg, "50%". In this case the top coordinate is considered as a percentage of the specified width of the
parent
.
If this method is called after the component has been drawn/initialized: Set the left coordinate of this object, relative to its enclosing context, in pixels. NOTE: if you're setting multiple coordinates, use setRect(), moveTo() or resizeTo() instead- Parameters:
left
- new left coordinate. Default value is 0- Returns:
Canvas
instance, for chaining setter calls- See Also:
-
setLocateByIDOnly
Iftrue
, when retrieving alocator
for this component always return a reference directly to this component bywidget ID
, using the compact format"///canvasID"
, ignoring any parent elements and ignoring any configuredtestRoot
. This format of locator will always be resolved back to the component by ID regardless of any changes in its position in the UI structure of an application.This setting is appropriate for components which are expected to always be present in an application with a stable
ID
.Note : This is an advanced setting
- Parameters:
locateByIDOnly
- New locateByIDOnly value. Default value is false- Returns:
Canvas
instance, for chaining setter calls
-
getLocateByIDOnly
public boolean getLocateByIDOnly()Iftrue
, when retrieving alocator
for this component always return a reference directly to this component bywidget ID
, using the compact format"///canvasID"
, ignoring any parent elements and ignoring any configuredtestRoot
. This format of locator will always be resolved back to the component by ID regardless of any changes in its position in the UI structure of an application.This setting is appropriate for components which are expected to always be present in an application with a stable
ID
.- Returns:
- Current locateByIDOnly value. Default value is false
-
setLocateChildrenBy
Strategy to use when locating children in this canvas from an autoTest locator string.Note : This is an advanced setting
- Parameters:
locateChildrenBy
- New locateChildrenBy value. Default value is null- Returns:
Canvas
instance, for chaining setter calls
-
getLocateChildrenBy
Strategy to use when locating children in this canvas from an autoTest locator string.- Returns:
- Current locateChildrenBy value. Default value is null
-
setLocateChildrenType
LocatorTypeStrategy
to use when finding children within this canvas.Note : This is an advanced setting
- Parameters:
locateChildrenType
- New locateChildrenType value. Default value is null- Returns:
Canvas
instance, for chaining setter calls
-
getLocateChildrenType
LocatorTypeStrategy
to use when finding children within this canvas.- Returns:
- Current locateChildrenType value. Default value is null
-
setLocatePeersBy
Strategy to use when locating peers of this canvas from an autoTest locator string.Note : This is an advanced setting
- Parameters:
locatePeersBy
- New locatePeersBy value. Default value is null- Returns:
Canvas
instance, for chaining setter calls
-
getLocatePeersBy
Strategy to use when locating peers of this canvas from an autoTest locator string.- Returns:
- Current locatePeersBy value. Default value is null
-
setLocatePeersType
LocatorTypeStrategy
to use when finding peers of this canvas.Note : This is an advanced setting
- Parameters:
locatePeersType
- New locatePeersType value. Default value is null- Returns:
Canvas
instance, for chaining setter calls
-
getLocatePeersType
LocatorTypeStrategy
to use when finding peers of this canvas.- Returns:
- Current locatePeersType value. Default value is null
-
setLocatorName
Local name for referencing this canvas from an autoTest locator string. It will be used instead ofindex
if found. This name must by unique within the parent component.By setting a static ID on certain top-level components and then using locatorName in contained components, stable locators can be created for these components without the need to pervasively assign IDs.
Note : This is an advanced setting
- Parameters:
locatorName
- New locatorName value. Default value is null- Returns:
Canvas
instance, for chaining setter calls
-
getLocatorName
Local name for referencing this canvas from an autoTest locator string. It will be used instead ofindex
if found. This name must by unique within the parent component.By setting a static ID on certain top-level components and then using locatorName in contained components, stable locators can be created for these components without the need to pervasively assign IDs.
- Returns:
- Current locatorName value. Default value is null
-
setMargin
Set the CSS Margin, in pixels, for this component. Margin provides blank space outside of the border.This property sets the same thickness of margin on every side. Differing per-side margins can be set in a CSS style and applied via
styleName
.Note that the specified size of the widget will be the size including the margin thickness on each side.
If this method is called after the component has been drawn/initialized: Set the CSS Margin, in pixels, for this component. Margin provides blank space outside of the border.This property sets the same thickness of margin on every side. Differing per-side margins can be set in a CSS style and applied via
styleName
.Note that the specified size of the widget will be the size including the margin thickness on each side.
- Parameters:
margin
- new margin in pixels. Default value is null- Returns:
Canvas
instance, for chaining setter calls- See Also:
-
getMargin
Set the CSS Margin, in pixels, for this component. Margin provides blank space outside of the border.This property sets the same thickness of margin on every side. Differing per-side margins can be set in a CSS style and applied via
styleName
.Note that the specified size of the widget will be the size including the margin thickness on each side.
- Returns:
- Current margin value. Default value is null
- See Also:
-
getMasterElement
Deprecated.In favor orgetMasterCanvas()
as of Smart GWT release 9.1This Canvas's "master" (the Canvas to which it was added as a peer), if any.Note : This method should be called only after the widget has been rendered.
- Returns:
- Current masterElement value. Default value is null
- Throws:
IllegalStateException
- if this widget has not yet been rendered.- See Also:
-
setMatchElement
IfhtmlElement
is specified, should this canvas be drawn at the same dimensions as the htmlElement?
See alsomatchElementWidth
andmatchElementHeight
By default, if
htmlPosition
is anything other than"replace"
, setting this property will cause the canvas resize with the element if the element itself subsequently resizes (for example due to page reflow).To disable this behavior for backwards compatibility or other reasons, use
persistentMatchElement
Note : This is an advanced setting
- Parameters:
matchElement
- New matchElement value. Default value is null- Returns:
Canvas
instance, for chaining setter calls
-
getMatchElement
IfhtmlElement
is specified, should this canvas be drawn at the same dimensions as the htmlElement?
See alsomatchElementWidth
andmatchElementHeight
By default, if
htmlPosition
is anything other than"replace"
, setting this property will cause the canvas resize with the element if the element itself subsequently resizes (for example due to page reflow).To disable this behavior for backwards compatibility or other reasons, use
persistentMatchElement
- Returns:
- Current matchElement value. Default value is null
-
setMatchElementHeight
public Canvas setMatchElementHeight(MatchElementSizeMode matchElementHeight) throws IllegalStateException For canvases with a specifiedhtmlElement
wherepersistentMatchElement
is set to true, how should the canvas match the element's height?Note : This is an advanced setting
- Parameters:
matchElementHeight
- New matchElementHeight value. Default value is "matchElement"- Returns:
Canvas
instance, for chaining setter calls- Throws:
IllegalStateException
- this property cannot be changed after the component has been created
-
getMatchElementHeight
For canvases with a specifiedhtmlElement
wherepersistentMatchElement
is set to true, how should the canvas match the element's height?- Returns:
- Current matchElementHeight value. Default value is "matchElement"
-
setMatchElementWidth
public Canvas setMatchElementWidth(MatchElementSizeMode matchElementWidth) throws IllegalStateException For canvases with a specifiedhtmlElement
wherepersistentMatchElement
is set to true, how should the canvas match the element's width?Note : This is an advanced setting
- Parameters:
matchElementWidth
- New matchElementWidth value. Default value is "matchElement"- Returns:
Canvas
instance, for chaining setter calls- Throws:
IllegalStateException
- this property cannot be changed after the component has been created
-
getMatchElementWidth
For canvases with a specifiedhtmlElement
wherepersistentMatchElement
is set to true, how should the canvas match the element's width?- Returns:
- Current matchElementWidth value. Default value is "matchElement"
-
setMaxHeight
Maximum height available to this Canvas. SeemaxWidth
for details of behavior.Note : This is an advanced setting
- Parameters:
maxHeight
- New maxHeight value. Default value is 10000- Returns:
Canvas
instance, for chaining setter calls- See Also:
-
getMaxHeight
public int getMaxHeight()Maximum height available to this Canvas. SeemaxWidth
for details of behavior.- Returns:
- Current maxHeight value. Default value is 10000
- See Also:
-
setMaxWidth
Maximum width available to this Canvas.The
maxWidth
andmaxHeight
settings apply to:- For a canvas being managed as a
member of a
Layout
, the maximum size the layout should apply to the canvas. - For a canvas with a width or height specified as a percent value, a maximum numeric pixel value to limit how large the canvas is sized.
- determining size for a Canvas in a
CanvasItem
(maxHeight
only) - end user
drag resizing
ListGrid recordComponents
.Note : This is an advanced setting
- Parameters:
maxWidth
- New maxWidth value. Default value is 10000- Returns:
Canvas
instance, for chaining setter calls- See Also:
- For a canvas being managed as a
member of a
-
getMaxWidth
public int getMaxWidth()Maximum width available to this Canvas.The
maxWidth
andmaxHeight
settings apply to:- For a canvas being managed as a
member of a
Layout
, the maximum size the layout should apply to the canvas. - For a canvas with a width or height specified as a percent value, a maximum numeric pixel value to limit how large the canvas is sized.
- determining size for a Canvas in a
CanvasItem
(maxHeight
only) - end user
drag resizing
ListGrid recordComponents
.- Returns:
- Current maxWidth value. Default value is 10000
- See Also:
- For a canvas being managed as a
member of a
-
setMaxZoomOverflowError
WhencorrectZoomOverflow
is true and browser or OS-level zoom is active, determines how much overflow must occur before the Framework enables scrolling for this canvas.The larger the value, the more clipping that can occur before scrolling is enabled. So, this property should never be set larger than the minimum amount needed to prevent scrollbar oscillation when zoomed - which is the maximum scrollHeight or scrollWidth error.
Note : This is an advanced setting
- Parameters:
maxZoomOverflowError
- New maxZoomOverflowError value. Default value is varies- Returns:
Canvas
instance, for chaining setter calls
-
getMaxZoomOverflowError
public int getMaxZoomOverflowError()WhencorrectZoomOverflow
is true and browser or OS-level zoom is active, determines how much overflow must occur before the Framework enables scrolling for this canvas.The larger the value, the more clipping that can occur before scrolling is enabled. So, this property should never be set larger than the minimum amount needed to prevent scrollbar oscillation when zoomed - which is the maximum scrollHeight or scrollWidth error.
- Returns:
- Current maxZoomOverflowError value. Default value is varies
-
setMenuConstructor
Default class used to construct menus created by this component, including context menus.- Parameters:
menuConstructor
- New menuConstructor value. Default value is "Menu"- Returns:
Canvas
instance, for chaining setter calls- Throws:
IllegalStateException
- this property cannot be changed after the component has been created- See Also:
-
getMenuConstructor
Default class used to construct menus created by this component, including context menus.- Returns:
- Current menuConstructor value. Default value is "Menu"
- See Also:
-
setMinHeight
Minimum height available to this Canvas. Minimum sizes do not apply to all situations. SeeminWidth
for details.
If this method is called after the component has been drawn/initialized: Resizes the widget vertically if required to satisfy the specifiedminHeight
.Note : This is an advanced setting
- Parameters:
minHeight
- new minimum height. Default value is 0- Returns:
Canvas
instance, for chaining setter calls- See Also:
-
getMinHeight
public int getMinHeight()Minimum height available to this Canvas. Minimum sizes do not apply to all situations. SeeminWidth
for details.- Returns:
- Current minHeight value. Default value is 0
- See Also:
-
setMinNonEdgeSize
If the widget has drag resize configured on one or more of it's edges, and the edgeMarginSize is large enough that the remaining space is less thanminNonEdgeSize
, the edgeMarginSize will be reduced such that the non-edge part of the widget is at least 1/3 of the total space (with two draggable edges) or half of it (with one draggable edge).Note : This is an advanced setting
- Parameters:
minNonEdgeSize
- New minNonEdgeSize value. Default value is 0- Returns:
Canvas
instance, for chaining setter calls- See Also:
-
getMinNonEdgeSize
public int getMinNonEdgeSize()If the widget has drag resize configured on one or more of it's edges, and the edgeMarginSize is large enough that the remaining space is less thanminNonEdgeSize
, the edgeMarginSize will be reduced such that the non-edge part of the widget is at least 1/3 of the total space (with two draggable edges) or half of it (with one draggable edge).- Returns:
- Current minNonEdgeSize value. Default value is 0
- See Also:
-
setMinWidth
Minimum width available to this Canvas.The
minWidth
andminHeight
settings apply to:- For a canvas being managed as a
member of a
Layout
, the minimum size the layout should apply to the canvas. - For a canvas with a width or height specified as a percent value, a minimum numeric pixel value to limit how large the canvas is sized.
- determining size for a Canvas in a
CanvasItem
(minHeight
only) - end user
drag resizing
- minimum size when using
Overflow
"visible" outside of a Layout - minimum size will be the greater of this setting or the minimum size needed to make all content visible
Minimum sizes do not apply in various other circumstances where sizes are being determined, such as
ListGrid recordComponents
.See also
Layout.minMemberLength
as a way of establishing minimum sizes along the length axis for all members of aLayout
with a single setting.
If this method is called after the component has been drawn/initialized: Resizes the widget horizontally if required to satisfy the specifiedminWidth
.Note : This is an advanced setting
- Parameters:
minWidth
- new minimum width. Default value is 0- Returns:
Canvas
instance, for chaining setter calls- See Also:
- For a canvas being managed as a
member of a
-
getMinWidth
public int getMinWidth()Minimum width available to this Canvas.The
minWidth
andminHeight
settings apply to:- For a canvas being managed as a
member of a
Layout
, the minimum size the layout should apply to the canvas. - For a canvas with a width or height specified as a percent value, a minimum numeric pixel value to limit how large the canvas is sized.
- determining size for a Canvas in a
CanvasItem
(minHeight
only) - end user
drag resizing
- minimum size when using
Overflow
"visible" outside of a Layout - minimum size will be the greater of this setting or the minimum size needed to make all content visible
Minimum sizes do not apply in various other circumstances where sizes are being determined, such as
ListGrid recordComponents
.See also
Layout.minMemberLength
as a way of establishing minimum sizes along the length axis for all members of aLayout
with a single setting.- Returns:
- Current minWidth value. Default value is 0
- See Also:
- For a canvas being managed as a
member of a
-
setMomentumScrollMinSpeed
The minimum speed in pixels per second that must be reached for momentum scrolling to kick in. This setting only applies to touch-enabled devices.Note : This is an advanced setting
- Parameters:
momentumScrollMinSpeed
- New momentumScrollMinSpeed value. Default value is 200- Returns:
Canvas
instance, for chaining setter calls
-
getMomentumScrollMinSpeed
public double getMomentumScrollMinSpeed()The minimum speed in pixels per second that must be reached for momentum scrolling to kick in. This setting only applies to touch-enabled devices.- Returns:
- Current momentumScrollMinSpeed value. Default value is 200
-
setMouseStillDownDelay
Amount of time (in milliseconds) between repeated 'mouseStillDown' events for this canvas. SeeCanvas.mouseStillDown()
for details.Note : This is an advanced setting
- Parameters:
mouseStillDownDelay
- New mouseStillDownDelay value. Default value is 100- Returns:
Canvas
instance, for chaining setter calls
-
getMouseStillDownDelay
public int getMouseStillDownDelay()Amount of time (in milliseconds) between repeated 'mouseStillDown' events for this canvas. SeeCanvas.mouseStillDown()
for details.- Returns:
- Current mouseStillDownDelay value. Default value is 100
-
setMouseStillDownInitialDelay
Amount of time (in milliseconds) before mouseStillDown events start to be fired repeatedly for this canvas. SeeCanvas.mouseStillDown()
for details.Note : This is an advanced setting
- Parameters:
mouseStillDownInitialDelay
- New mouseStillDownInitialDelay value. Default value is 400- Returns:
Canvas
instance, for chaining setter calls
-
getMouseStillDownInitialDelay
public int getMouseStillDownInitialDelay()Amount of time (in milliseconds) before mouseStillDown events start to be fired repeatedly for this canvas. SeeCanvas.mouseStillDown()
for details.- Returns:
- Current mouseStillDownInitialDelay value. Default value is 400
-
setName
Optional name for the canvas, which can later be used to reference it. Need not be globally unique, but should be unique within theparent
to get defined results forLayout.getMember()
andLayout.getMemberNumber()
.- Parameters:
name
- New name value. Default value is null- Returns:
Canvas
instance, for chaining setter calls- Throws:
IllegalStateException
- this property cannot be changed after the component has been created- See Also:
-
getName
Optional name for the canvas, which can later be used to reference it. Need not be globally unique, but should be unique within theparent
to get defined results forLayout.getMember()
andLayout.getMemberNumber()
.- Returns:
- Current name value. Default value is null
- See Also:
-
setNativeAutoHideScrollbars
public Canvas setNativeAutoHideScrollbars(Boolean nativeAutoHideScrollbars) throws IllegalStateException In some platform/browser configurations, scrollable regions do not show visible scrollbars until the user attempts to interact with the region. The interaction to show the scrollbar varies by browser/OS but may include starting a trackpad scroll or simply rolling over the scrollable element.If
nativeAutoHideScrollbars
is set to true, we detect platforms that show scrollbars dynamically on user interaction and for components withshowCustomScrollbars
we ignore the specifiedscrollbarConstructor
, and instead create system-managed native scrollbars via the special NativeScrollbar class, and setfloatingScrollbars
to true.Not applicable to
touch devices
Has no impact if
alwaysShowScrollbars
is true.If
showCustomScrollbars
is false, this setting will have no effect (we would be showing custom scrollbars in any case)
Also does not apply to
touch scrolling interfaces
(where scrollbars are always hidden unlessalwaysShowScrollbars
is true).Note : This is an advanced setting
- Parameters:
nativeAutoHideScrollbars
- New nativeAutoHideScrollbars value. Default value is false- Returns:
Canvas
instance, for chaining setter calls- Throws:
IllegalStateException
- this property cannot be changed after the component has been created- See Also:
-
getNativeAutoHideScrollbars
In some platform/browser configurations, scrollable regions do not show visible scrollbars until the user attempts to interact with the region. The interaction to show the scrollbar varies by browser/OS but may include starting a trackpad scroll or simply rolling over the scrollable element.If
nativeAutoHideScrollbars
is set to true, we detect platforms that show scrollbars dynamically on user interaction and for components withshowCustomScrollbars
we ignore the specifiedscrollbarConstructor
, and instead create system-managed native scrollbars via the special NativeScrollbar class, and setfloatingScrollbars
to true.Not applicable to
touch devices
Has no impact if
alwaysShowScrollbars
is true.If
showCustomScrollbars
is false, this setting will have no effect (we would be showing custom scrollbars in any case)
Also does not apply to
touch scrolling interfaces
(where scrollbars are always hidden unlessalwaysShowScrollbars
is true).- Returns:
- Current nativeAutoHideScrollbars value. Default value is false
- See Also:
-
setNoDoubleClicks
If true, this canvas will receive all mouse-clicks as singleclick
events rather than asdoubleClick
events.Note : This is an advanced setting
- Parameters:
noDoubleClicks
- New noDoubleClicks value. Default value is null- Returns:
Canvas
instance, for chaining setter calls
-
getNoDoubleClicks
If true, this canvas will receive all mouse-clicks as singleclick
events rather than asdoubleClick
events.- Returns:
- Current noDoubleClicks value. Default value is null
-
setNoDropCursor
Specifies the cursor image to display when the user drags a droppable canvas over this if it is not a valid drop target for the event andshowNoDropIndicator
is true.Note : This is an advanced setting
- Parameters:
noDropCursor
- New noDropCursor value. Default value is Canvas.NOT_ALLOWED- Returns:
Canvas
instance, for chaining setter calls- See Also:
-
getNoDropCursor
Specifies the cursor image to display when the user drags a droppable canvas over this if it is not a valid drop target for the event andshowNoDropIndicator
is true.- Returns:
- Current noDropCursor value. Default value is Canvas.NOT_ALLOWED
- See Also:
-
setOpacity
Renders the widget to be partly transparent. A widget's opacity property may be set to any number between 0 (transparent) to 100 (opaque). Null means don't specify opacity directly, 100 is fully opaque. Note that heavy use of opacity may have a performance impact on some older browsers.In older versions of Internet Explorer (Pre IE9 / HTML5), opacity is achieved through proprietary filters. If
filters have been disabled
within this application developers must setuseOpacityFilter
to true for specific components on which opacity support is required.Also note that opacity is incompatible with
backMasks
.
If this method is called after the component has been drawn/initialized: Sets the opacity for the widget to the newOpacity value. This newOpacity value must be within the range of 0 (transparent) to 100 (opaque). Null means don't specify opacity directly. Note that heavy use of opacity may have a performance impact on some older browsers.In older versions of Internet Explorer (Pre IE9 / HTML5), opacity is achieved through proprietary filters. If
filters have been disabled
within this application developers must setuseOpacityFilter
to true for specific components on which opacity support is required.Also note that opacity is incompatible with
backMasks
.Note : This is an advanced setting
- Parameters:
opacity
- new opacity level. Default value is null- Returns:
Canvas
instance, for chaining setter calls- See Also:
-
getOpacity
Renders the widget to be partly transparent. A widget's opacity property may be set to any number between 0 (transparent) to 100 (opaque). Null means don't specify opacity directly, 100 is fully opaque. Note that heavy use of opacity may have a performance impact on some older browsers.In older versions of Internet Explorer (Pre IE9 / HTML5), opacity is achieved through proprietary filters. If
filters have been disabled
within this application developers must setuseOpacityFilter
to true for specific components on which opacity support is required.Also note that opacity is incompatible with
backMasks
.- Returns:
- Current opacity value. Default value is null
- See Also:
-
setOverflow
Controls what happens when the drawn size of the content of a Canvas is either greater or smaller than the specified size of the Canvas. Similar to the CSS property overflow, but consistent across browsers. See Overflow type for details.
If this method is called after the component has been drawn/initialized: Update theoverflow
of a Canvas after it has been created.- Parameters:
overflow
- New overflow value. Default value is Canvas.VISIBLE- Returns:
Canvas
instance, for chaining setter calls- See Also:
-
getOverflow
Controls what happens when the drawn size of the content of a Canvas is either greater or smaller than the specified size of the Canvas. Similar to the CSS property overflow, but consistent across browsers. See Overflow type for details.- Returns:
- Current overflow value. Default value is Canvas.VISIBLE
- See Also:
-
setPadding
Set the CSS padding of this component, in pixels. Padding provides space between the border and the component's contents.This property sets the same thickness of padding on every side. Differing per-side padding can be set in a CSS style and applied via
styleName
.Note that CSS padding does not affect the placement of
children
. To provide a blank area around children, either useCSS margins
or use aLayout
as the parent instead, and use properties such asLayout.layoutMargin
to create blank space.
If this method is called after the component has been drawn/initialized: Set the CSS padding of this component, in pixels. Padding provides space between the border and the component's contents.This property sets the same thickness of padding on every side. Differing per-side padding can be set in a CSS style and applied via
styleName
.- Parameters:
padding
- new padding in pixels. Default value is null- Returns:
Canvas
instance, for chaining setter calls- See Also:
-
getPadding
Set the CSS padding of this component, in pixels. Padding provides space between the border and the component's contents.This property sets the same thickness of padding on every side. Differing per-side padding can be set in a CSS style and applied via
styleName
.Note that CSS padding does not affect the placement of
children
. To provide a blank area around children, either useCSS margins
or use aLayout
as the parent instead, and use properties such asLayout.layoutMargin
to create blank space.- Returns:
- Current padding value. Default value is null
- See Also:
-
setParentCanvas
This Canvas's immediate parent, if any.
Can be initialized, but any subsequent manipulation should be viaaddChild()
andremoveChild()
calls on the parent. The parent Canvas should be fetched usinggetParentCanvas()
.See
Containment
for an overview of parent/child relationships.- Parameters:
parentCanvas
- New parentCanvas value. Default value is null- Returns:
Canvas
instance, for chaining setter calls- Throws:
IllegalStateException
- this property cannot be changed after the component has been created- See Also:
-
getParentCanvas
This Canvas's immediate parent, if any.
Can be initialized, but any subsequent manipulation should be viaaddChild()
andremoveChild()
calls on the parent. The parent Canvas should be fetched usinggetParentCanvas()
.See
Containment
for an overview of parent/child relationships.- Returns:
- Returns the parent of this canvas, if any.
See
Containment
for an overview of parent/child relationships. Default value is null - See Also:
-
setParentElement
Deprecated.As of Smartclient version 9.1, deprecated in favor ofparentCanvas
andgetParentCanvas()
This Canvas's immediate parent, if any.
Can be initialized, but any subsequent manipulation should be viaaddChild()
andremoveChild()
calls on the parent.Note : This is an advanced setting
- Parameters:
parentElement
- New parentElement value. Default value is null- Returns:
Canvas
instance, for chaining setter calls- Throws:
IllegalStateException
- this property cannot be changed after the component has been created- See Also:
-
getParentElement
Deprecated.As of Smartclient version 9.1, deprecated in favor ofparentCanvas
andgetParentCanvas()
This Canvas's immediate parent, if any.
Can be initialized, but any subsequent manipulation should be viaaddChild()
andremoveChild()
calls on the parent.- Returns:
- Current parentElement value. Default value is null
- See Also:
-
setPeers
Array of all Canvii that are peers of this Canvas.Use
addPeer()
andremovePeer()
to add and remove peers after a Canvas has been created/drawn.See
Containment
for an overview of master/peer relationships.Note : This is an advanced setting
- Parameters:
peers
- New peers value. Default value is null- Returns:
Canvas
instance, for chaining setter calls- Throws:
IllegalStateException
- this property cannot be changed after the component has been created- See Also:
-
getPeers
Array of all Canvii that are peers of this Canvas.Use
addPeer()
andremovePeer()
to add and remove peers after a Canvas has been created/drawn.See
Containment
for an overview of master/peer relationships.- Returns:
- Current peers value. Default value is null
- See Also:
-
setPendingMarkerStyle
CSS class used to apply additional styles to this canvas whenshowPendingMarker()
is called, or whenpendingMarkerVisible
has been set.The default
pendingMarkerStyle
, pendingMarker, renders a small triangle in the top-left of the Canvas. You can modify this class or provide a custom one to achieve a different display.- Parameters:
pendingMarkerStyle
- New pendingMarkerStyle value. Default value is "pendingMarker"- Returns:
Canvas
instance, for chaining setter calls- See Also:
-
getPendingMarkerStyle
CSS class used to apply additional styles to this canvas whenshowPendingMarker()
is called, or whenpendingMarkerVisible
has been set.The default
pendingMarkerStyle
, pendingMarker, renders a small triangle in the top-left of the Canvas. You can modify this class or provide a custom one to achieve a different display.- Returns:
- Current pendingMarkerStyle value. Default value is "pendingMarker"
- See Also:
-
setPendingMarkerVisible
This attribute indicates whether thepending marker class
should be appended to the list of CSS classes applied to this canvas. By default, this extra class overlays a small shape in the corner of this canvas.- Parameters:
pendingMarkerVisible
- New pendingMarkerVisible value. Default value is null- Returns:
Canvas
instance, for chaining setter calls
-
getPendingMarkerVisible
This attribute indicates whether thepending marker class
should be appended to the list of CSS classes applied to this canvas. By default, this extra class overlays a small shape in the corner of this canvas.- Returns:
- Current pendingMarkerVisible value. Default value is null
-
setPercentBox
Governs the model to be used when sizing canvases with percentage width or height, or positioning widgets with a specifiedsnapTo
.Only affects widgets with a a specified
percentSource
, or widgets that havesnapTo
set and are peers of someother canvas
.Determines whether the coordinates used for sizing (for percentage sized widgets) and positioning (if
snapTo
is set) should be relative to the visible size or the viewport size of the percentSource ormaster canvas
widget.Note : This is an advanced setting
- Parameters:
percentBox
- New percentBox value. Default value is "visible"- Returns:
Canvas
instance, for chaining setter calls- Throws:
IllegalStateException
- this property cannot be changed after the component has been created- See Also:
-
getPercentBox
Governs the model to be used when sizing canvases with percentage width or height, or positioning widgets with a specifiedsnapTo
.Only affects widgets with a a specified
percentSource
, or widgets that havesnapTo
set and are peers of someother canvas
.Determines whether the coordinates used for sizing (for percentage sized widgets) and positioning (if
snapTo
is set) should be relative to the visible size or the viewport size of the percentSource ormaster canvas
widget.- Returns:
- Current percentBox value. Default value is "visible"
- See Also:
-
setPercentSource
If this canvas has its size specified as a percentage, this property allows the user to explicitly designate another canvas upon which sizing will be based.If unset percentage sizing is based on
- themaster canvas
if there is one andsnapTo
is set,
- otherwise on the amount of space available in this widget's parent canvas, if this is a child of some other widget
- otherwise the page size.
If this method is called after the component has been drawn/initialized: Setter method for thepercentSource
attribute.Note : This is an advanced setting
- Parameters:
percentSource
- eterNew percent source (if omitted existing percentSource will just be cleared). Default value is null- Returns:
Canvas
instance, for chaining setter calls- See Also:
-
getPercentSource
If this canvas has its size specified as a percentage, this property allows the user to explicitly designate another canvas upon which sizing will be based.If unset percentage sizing is based on
- themaster canvas
if there is one andsnapTo
is set,
- otherwise on the amount of space available in this widget's parent canvas, if this is a child of some other widget
- otherwise the page size.- Returns:
- Current percentSource value. Default value is null
- See Also:
-
setPersistentMatchElement
public Canvas setPersistentMatchElement(Boolean persistentMatchElement) throws IllegalStateException If this canvas has a specifiedhtmlElement
andmatchElement
is set to true, should the canvas perform a one time resize to fit the target element on draw, or should it continue to match the target element as its size changes due to page reflows?Note : This is an advanced setting
- Parameters:
persistentMatchElement
- New persistentMatchElement value. Default value is true- Returns:
Canvas
instance, for chaining setter calls- Throws:
IllegalStateException
- this property cannot be changed after the component has been created
-
getPersistentMatchElement
If this canvas has a specifiedhtmlElement
andmatchElement
is set to true, should the canvas perform a one time resize to fit the target element on draw, or should it continue to match the target element as its size changes due to page reflows?- Returns:
- Current persistentMatchElement value. Default value is true
-
setPointerSettings
Detail settings of thepointer
such as where it should be located along the outside of the canvas.- Parameters:
pointerSettings
- New pointerSettings value. Default value is null- Returns:
Canvas
instance, for chaining setter calls- Throws:
IllegalStateException
- this property cannot be changed after the component has been created
-
getPointerSettings
Detail settings of thepointer
such as where it should be located along the outside of the canvas.- Returns:
- Current pointerSettings value. Default value is null
-
setPointerTarget
This property in conjunction with thepointerSettings.snapTo
places the canvas in relation to the target canvas.Depending on the
pointerSettings.snapTo
and thepointerSettings.targetSnapTo
the canvas will be positioned so the pointer correctly points to the target.A
pointerTarget
can be specified ether as anAutoTestLocator
or aGlobalId
.- Parameters:
pointerTarget
- New pointerTarget value. Default value is null- Returns:
Canvas
instance, for chaining setter calls- Throws:
IllegalStateException
- this property cannot be changed after the component has been created- See Also:
-
getPointerTarget
This property in conjunction with thepointerSettings.snapTo
places the canvas in relation to the target canvas.Depending on the
pointerSettings.snapTo
and thepointerSettings.targetSnapTo
the canvas will be positioned so the pointer correctly points to the target.A
pointerTarget
can be specified ether as anAutoTestLocator
or aGlobalId
.- Returns:
- Current pointerTarget value. Default value is null
- See Also:
-
getPointerTargetAsString
This property in conjunction with thepointerSettings.snapTo
places the canvas in relation to the target canvas.Depending on the
pointerSettings.snapTo
and thepointerSettings.targetSnapTo
the canvas will be positioned so the pointer correctly points to the target.A
pointerTarget
can be specified ether as anAutoTestLocator
or aGlobalId
.- Returns:
- Current pointerTarget value. Default value is null
- See Also:
-
setPosition
Absolute or relative, corresponding to the "absolute" (with respect to parent) or "relative" (with respect to document flow) values for the CSS position attribute.Setting
position:"relative"
enables Smart GWT components to be embedded directly into the native HTML flow of a page, causing the component to be rendered within an existing DOM structure. This attribute should only be set to"relative"
on a top level component (a component with nogetParentCanvas()
).There are 2 ways to embed relatively positioned canvases in the DOM - by default the component will be written out inline when it gets
drawn()n
. For example to embed a canvas in an HTML table you could use this code:<table> <tr> <td> <script> isc.Canvas.create({autoDraw:true, backgroundColor:"red", position:"relative"}); </script> <td> </tr> </table>
Alternatively you can make use of thehtmlElement
attribute.Relative positioning is intended as a short-term integration scenario while incrementally upgrading existing applications. Note that relative positioning is not used to manage layout within Smart GWT components - instead the
Layout
class would typically be used. For best consistency and flexibility across browsers, all Smart GWT layout managers use absolute positioning.For canvases with a specified
htmlElement
, this attribute defaults to"relative"
. In all other cases the default value will be"absolute"
. Note that if you plan to callsetHtmlElement()
after init, you will need to set this value to "relative" explicitly.Note : This is an advanced setting
- Parameters:
position
- New position value. Default value is null- Returns:
Canvas
instance, for chaining setter calls- See Also:
-
getPosition
Absolute or relative, corresponding to the "absolute" (with respect to parent) or "relative" (with respect to document flow) values for the CSS position attribute.Setting
position:"relative"
enables Smart GWT components to be embedded directly into the native HTML flow of a page, causing the component to be rendered within an existing DOM structure. This attribute should only be set to"relative"
on a top level component (a component with nogetParentCanvas()
).There are 2 ways to embed relatively positioned canvases in the DOM - by default the component will be written out inline when it gets
drawn()n
. For example to embed a canvas in an HTML table you could use this code:<table> <tr> <td> <script> isc.Canvas.create({autoDraw:true, backgroundColor:"red", position:"relative"}); </script> <td> </tr> </table>
Alternatively you can make use of thehtmlElement
attribute.Relative positioning is intended as a short-term integration scenario while incrementally upgrading existing applications. Note that relative positioning is not used to manage layout within Smart GWT components - instead the
Layout
class would typically be used. For best consistency and flexibility across browsers, all Smart GWT layout managers use absolute positioning.For canvases with a specified
htmlElement
, this attribute defaults to"relative"
. In all other cases the default value will be"absolute"
. Note that if you plan to callsetHtmlElement()
after init, you will need to set this value to "relative" explicitly.- Returns:
- Current position value. Default value is null
- See Also:
-
setPrintChildrenAbsolutelyPositioned
Should this canvas print its children absolutely positioned when generatingprintable HTML
.By default explicitly specified absolute positioning and sizing is ignored when generating print HTML. This is done intentionally: there is no way for the framework to predict how explicit sizes will translate to a the printed page and if HTML for printing includes the same absolute positioning and sizing as is displayed within an application it is very common to encounter undesirable effects, such as seeing tables get broken over several pages horizontally when there is enough room to print them on a single page of paper.
In some cases, however, a developer may wish to have explicit sizing and positioning respected within the print-view. Setting this attribute to
true
will cause this to occur.Note : This is an advanced setting
-
getPrintChildrenAbsolutelyPositioned
Should this canvas print its children absolutely positioned when generatingprintable HTML
.By default explicitly specified absolute positioning and sizing is ignored when generating print HTML. This is done intentionally: there is no way for the framework to predict how explicit sizes will translate to a the printed page and if HTML for printing includes the same absolute positioning and sizing as is displayed within an application it is very common to encounter undesirable effects, such as seeing tables get broken over several pages horizontally when there is enough room to print them on a single page of paper.
In some cases, however, a developer may wish to have explicit sizing and positioning respected within the print-view. Setting this attribute to
true
will cause this to occur.- Returns:
- Current printChildrenAbsolutelyPositioned value. Default value is false
- See Also:
-
setPrintStyleName
The CSS class to apply when printing this widget. If unset, falls back to thespecified style
.- Parameters:
printStyleName
- New printStyleName value. Default value is null- Returns:
Canvas
instance, for chaining setter calls- See Also:
-
getPrintStyleName
The CSS class to apply when printing this widget. If unset, falls back to thespecified style
.- Returns:
- Get the CSS class to apply when printing this widget. Returns the
print style
, if specified, falling back to thespecified style
otherwise. Default value is null - See Also:
-
setPrompt
Prompt displayed in hover canvas ifshowHover
is true.- Parameters:
prompt
- New prompt value. Default value is null- Returns:
Canvas
instance, for chaining setter calls- See Also:
-
getPrompt
Prompt displayed in hover canvas ifshowHover
is true.- Returns:
- Current prompt value. Default value is null
- See Also:
-
setProportionalResizing
public Canvas setProportionalResizing(ProportionalResizeMode proportionalResizing) throws IllegalStateException IfcanDragResize
is true, this property specifies the conditions for when proportional resizing is used. The default isProportionalResizeMode.MODIFIER_OFF
, which means that proportional resizing is disabled.- Parameters:
proportionalResizing
- New proportionalResizing value. Default value is "none"- Returns:
Canvas
instance, for chaining setter calls- Throws:
IllegalStateException
- this property cannot be changed after the component has been created- See Also:
-
getProportionalResizing
IfcanDragResize
is true, this property specifies the conditions for when proportional resizing is used. The default isProportionalResizeMode.MODIFIER_OFF
, which means that proportional resizing is disabled.- Returns:
- Current proportionalResizing value. Default value is "none"
- See Also:
-
setReceiveScrollbarEvents
public Canvas setReceiveScrollbarEvents(boolean receiveScrollbarEvents) throws IllegalStateException Whether this canvas should receiveevents
from its scrollbars, which arepeers
. Normally, a canvas only gets bubbled events from itschildren
.Note that this property only has an impact if
showCustomScrollbars
is true.- Parameters:
receiveScrollbarEvents
- New receiveScrollbarEvents value. Default value is true- Returns:
Canvas
instance, for chaining setter calls- Throws:
IllegalStateException
- this property cannot be changed after the component has been created- See Also:
-
getReceiveScrollbarEvents
public boolean getReceiveScrollbarEvents()Whether this canvas should receiveevents
from its scrollbars, which arepeers
. Normally, a canvas only gets bubbled events from itschildren
.Note that this property only has an impact if
showCustomScrollbars
is true.- Returns:
- Current receiveScrollbarEvents value. Default value is true
- See Also:
-
setRedrawOnResize
Should this element be redrawn in response to a resize?Should be set to true for components whose
inner HTML
will not automatically reflow to fit the component's new size.Note : This is an advanced setting
- Parameters:
redrawOnResize
- New redrawOnResize value. Default value is null- Returns:
Canvas
instance, for chaining setter calls- See Also:
-
getRedrawOnResize
Should this element be redrawn in response to a resize?Should be set to true for components whose
inner HTML
will not automatically reflow to fit the component's new size.- Returns:
- Current redrawOnResize value. Default value is null
- See Also:
-
setResizeBarTarget
When this Canvas is included as a member in a Layout, andshowResizeBar
is set totrue
so that a resizeBar is created,resizeBarTarget:"next"
can be set to indicate that the resizeBar should resize the next member of the layout rather than this one. For resizeBars that support hiding their target member when clicked on,resizeBarTarget:"next"
also means that the next member will be the one hidden.This is typically used to create a 3-way split pane, where left and right-hand sections can be resized or hidden to allow a center section to expand.
NOTE: as with any Layout, to ensure all available space is used, one or more members must maintain a flexible size (eg 75%, or *). In a two pane Layout with a normal resize bar, to fill all space after a user resizes, the member on the right should have flexible size. With resizeBarTarget:"next", the member on the left should have flexible size.
- Parameters:
resizeBarTarget
- New resizeBarTarget value. Default value is null- Returns:
Canvas
instance, for chaining setter calls- Throws:
IllegalStateException
- this property cannot be changed after the component has been created- See Also:
-
getResizeBarTarget
When this Canvas is included as a member in a Layout, andshowResizeBar
is set totrue
so that a resizeBar is created,resizeBarTarget:"next"
can be set to indicate that the resizeBar should resize the next member of the layout rather than this one. For resizeBars that support hiding their target member when clicked on,resizeBarTarget:"next"
also means that the next member will be the one hidden.This is typically used to create a 3-way split pane, where left and right-hand sections can be resized or hidden to allow a center section to expand.
NOTE: as with any Layout, to ensure all available space is used, one or more members must maintain a flexible size (eg 75%, or *). In a two pane Layout with a normal resize bar, to fill all space after a user resizes, the member on the right should have flexible size. With resizeBarTarget:"next", the member on the left should have flexible size.
- Returns:
- Current resizeBarTarget value. Default value is null
- See Also:
-
setResizeFrom
When drag resizing is enabled viacanDragResize
, restricts resizes to only certain edges or corners.The default of null indicates the widget can be resized from any corner or edge (if
canDragResize
is true).To restrict resizing to only certain corners, set
resizeFrom
to an Array ofEdgeName
s.Note : This is an advanced setting
- Parameters:
resizeFrom
- New resizeFrom value. Default value is null- Returns:
Canvas
instance, for chaining setter calls- See Also:
-
getResizeFrom
When drag resizing is enabled viacanDragResize
, restricts resizes to only certain edges or corners.The default of null indicates the widget can be resized from any corner or edge (if
canDragResize
is true).To restrict resizing to only certain corners, set
resizeFrom
to an Array ofEdgeName
s.- Returns:
- Current resizeFrom value. Default value is null
- See Also:
-
setRuleScope
ID
of the component that gathers the context for evaluation of criteria-based rules specified by properties such asFormItem.visibleWhen
, Dynamic Properties, andDynamicCriteria
such asListGrid.initialCriteria
.If
ruleScope
is not specified, this component will search through itsparentCanvas
chain until it either reaches the top or reaches a parent markedisRuleScope
. This means that typically,ruleScope
does not have to be explicitly specified, since components that want to reference each other often have the same top-level parent (eg, they are part of the same screen). However, you would need to specifyruleScope
in scenarios such as a modal Window that wants to reference values in the component it was launched from.Determination of the
ruleScope
happens when the component is first drawn.The component designated as the
ruleScope
manages a nested data structure called the "rule context" which contains information from allDataBoundComponent
s that are registered with theruleScope
. By specifyingCriterion.fieldName
as aDataPath
, AdvancedCriteria defined in properties such asFormItem.visibleWhen
can access any part of the rule context.By default, the rule context contains data as follows:
- any
DataBoundComponent
that has a DataSource contributes the values of the selected record or record being edited under the ID of the DataSource. For any collision an editable display (such as a form or editable grid) wins over a static display (such as a non-editable grid with a selection.) Hidden or cleared components have lowest priority even if editable. For two editable components the first becomes the contributor. - any ListGrid or other component that manages a selection and has been assigned an explicit
ID
will contribute the values of the selected record under<componentId>.selectedRecord
, the values of the grid summary record under<componentId>.summaryRecord
, and also contributes 3 flags for checking for selection:anySelected
,multiSelected
,numSelected
. The selected record can also be identified by row number:<componentId>.selectedRowNum
which also applies to the edit row since editing implies selection by default. - any DynamicForm or other component that edits values and has been assigned an explicit
ID
contributes its current values under<componentId>.values
, and contributes a flaghasChanges
. - any DynamicForm or ListGrid that has been assigned an explicit
ID
contributes a value<componentId>.focusField
. When present the value indicates the component has focus along with the name of the field that has focus. Its absense indicates the component does not have focus at all. - any ListGrid that has been assigned an explicit
ID
contributes a flagisGrouped
under<componentId>
. - any DataSource included in a
DataContext
ortestDataContext
that is being used for this ruleScope contributes the values into thedataContext
section of the ruleContext (ex.dataContext.Customer
) so the values do not conflict with normal DataSource contributions. Note that thedataContext
is immutable so only the first contribution is actually saved.
In addition to data contributed by DataBoundComponent, the ruleScope also contains entries contributed by the Authentication class, such as the authenticated userId and roles - see
Authentication
for details. Characteristics of the current device is also included as:{ device : { isPhone : false, isTablet : false, isDesktop : true, isLandscape : true } }
For example, given a screen where:
- a ListGrid with ID "itemGrid" and DynamicForm with ID "itemForm" are both bound to the
supplyItem
sample DataSource - the ListGrid has a single selection, and the record selected in the ListGrid is being edited in the form, and has been changed
getRuleContext()
, expressed as JSON, would be:{ supplyItem : { itemID : "654321", itemName : "Sewing Machine", price : 5.50, // note: user change ..other properties.. }, itemForm.values : { itemID : "654321", itemName : "Sewing Machine", price : 5.50, // note: user change ..other properties.. }, itemForm.focusField : "itemName", itemForm.hasChanges : true, itemGrid.selectedRecord : { itemID : "654321", itemName : "Sewing Machine", price : 3.50, // note: old price ..other properties.. }, itemGrid.anySelected : true, itemGrid.multiSelected : false, itemGrid.numSelected : 1, itemGrid.isGrouped : false, device : { isPhone : false, isTablet : false, isDesktop : true, isLandscape : true }, auth : { currentUser : { userId: "lisa", firstName: "Lisa", lastName: "Admin", roles: "admin", ..other properties.. }, roles : ['admin'], isSuperUser : false } }
In addition, an application can put custom data into the ruleScope viaprovideRuleContext()
.Troubleshooting RuleScope issues
The ruleScope system consists of two major parts: managing the rule context and using the rule context. The former is handled byprovideRuleContext()
andremoveRuleContext()
. Users of rule context are the criteria-based rules noted above.A number of Log categories are provided to make diagnosing ruleScope issues easier:
- ruleContext
- whenRules
- dynamicProperties
- dynamicCriteria
Smart GWT Developer Console
. By default none of these categories are included in theLogging Preferences
category choices. To add one or more of these categories, selectMore...
then clickAdd...
. Be sure to enter the category with the correct capitalization.At the Info log priority one or two basic log messages are generated per action. The Debug priority generally includes additional information like the full criteria or a message for each evaluation even when no change is made.
Using and Interpreting log messages
To address a specific issue on rules, select the Info priority for the target category in the Developer Console then perform your application actions that are being diagnosed. You may want to re-run your application to get a clean start on the changes.whenRules and dynamicProperties
Both of these types of properties are triggered by a criteria that can reference the ruleContext and/or the component's values (for forms). The criteria is re-evaluated on each rule context change and based on the criteria being matched or not, the action is taken or property updated.Below are some example Info log messages:
16:53:39.032:TMR8[E0]:INFO:whenRules:Hide Canvas 'isc_Canvas_1' 16:53:39.034:TMR8[E1]:INFO:whenRules:Disabling Canvas 'isc_Button_3' 16:53:39.509:TMR9[E0]:INFO:whenRules:Hide Canvas 'isc_Canvas_2' 16:53:39.510:TMR9[E1]:INFO:whenRules:Hide Canvas 'isc_Button_4' 16:53:39.527:TMR4:INFO:whenRules:Show Canvas 'isc_Canvas_2' 16:53:39.527:TMR4:INFO:whenRules:Show Canvas 'isc_Button_4' 16:53:39.528:TMR4:INFO:whenRules:Disabling Canvas 'isc_Button_4' 16:53:39.529:TMR4:INFO:whenRules:Set read-only (appearance disabled) FormItem 'itemForm3.field2' 16:53:39.974:TMR6:INFO:whenRules:Set editable (appearance disabled) FormItem 'itemForm3.field2' 16:53:40.540:TMR2:INFO:whenRules:Enabling FormItemIcon 'itemForm4.field2.remove' 16:53:40.541:TMR2:INFO:whenRules:Hide FormItemIcon 'itemForm4.field4.edit'
These indicate various responses tovisibleWhen
,enableWhen
, andreadOnlyWhen
actions.By setting the priority to Debug you can see the creation of the rule for the criteria and the evaluation of the criteria before action is taken:
16:53:41.569:TMR7:DEBUG:whenRules:itemForm6:Create whenRule: itemForm6_field2_readOnly, applyWhen { "_constructor":"AdvancedCriteria", "operator":"and", "criteria":[ { "fieldName":"layout1.date1", "operator":"greaterOrEqualField", "value":"layout1.date2" } ] } to target {component: [DynamicForm ID:itemForm6], fieldName: "field2", formIconName: undef} 16:53:41.571:TMR7:DEBUG:whenRules:isc_RulesEngine_5:Applying readOnly rule 'itemForm6_field2_readOnly' for FormItem itemForm6.field2 with action result true. applyWhen criteria matched: { "__normalized":true, "_constructor":"AdvancedCriteria", "operator":"and", "criteria":[ { "__normalized":true, "fieldName":"layout1.date1", "operator":"greaterOrEqualField", "value":"layout1.date2" } ] } 16:53:41.571:TMR7:DEBUG:whenRules:Set read-only (appearance disabled) FormItem 'itemForm6.field2'
dynamicProperties are similar:16:59:13.588:XRP8:INFO:dynamicProperties:Set (populateFromDataPath) 'isc_Button_0.title' to [initial value]: Special Title 16:59:13.650:TMR2:WARN:Class:isc_Class_0:Attempt to evaluate formulaFunction itemForm.values.count * 2 + 10 failed. Error message:undefined is not an object (evaluating 'itemForm.values') 16:59:13.657:TMR9:INFO:dynamicProperties:Set (populate) 'isc_Class_0.contents' to [initial value]: 34
This example shows a failed formula indicating that the 'itemForm.values' isn't valid in the ruleContext. In this case the form values haven't been provided to ruleContext yet. When they are the next log message shows the result.dynamicCriteria
Each time a dynamic criteria is evaluated (as triggered by aruleContextChanged
event) a log entry is made:14:54:46.436:INP9:INFO:dynamicCriteria:isc_ListGrid_0:Evaluated dynamic criteria: filterCriteria
This indicates that dynamicCriteria for isc_ListGrid_0 is being evaluated/re-evaluated. By changing the priority to Debug the resolved criteria is also included:14:55:16.231:INP9:DEBUG:dynamicCriteria:isc_ListGrid_0:Evaluated dynamic criteria: filterCriteria { "fieldName":"orderNumber", "operator":"equals", "valuePath":"orderSearchForm.values.orderNumber", "value":10104, "_constructor":"AdvancedCriteria" }
Note the valuePath oforderSearchForm.values.orderNumber
is resolved to the value of10104
.ruleContext
If none of the logging above provides details needed to understand what is going on, enabling the ruleContext category can be enabled. At Info a single log message is reported for each ruleContext change.For example, below are the rule context changes that occurred to trigger the above dynamicCriteria messages above:
14:54:46.432:INP9:INFO:ruleContext:isc_SearchForm_0:provideRuleContext [ruleScope: isc_DataView_0, dbcID: isc_SearchForm_0]: Order.orderNumber = 10104 14:54:46.433:INP9:INFO:ruleContext:isc_SearchForm_0:provideRuleContext [ruleScope: isc_DataView_0, dbcID: isc_SearchForm_0]: orderSearchForm.values.orderNumber = 10104 14:54:46.434:INP9:INFO:ruleContext:isc_SearchForm_0:provideRuleContext [ruleScope: isc_DataView_0, dbcID: isc_SearchForm_0]: orderSearchForm.hasChanges = true
This indicates that isc_SearchForm_0 updated rule context with three changed values. There is no indication of when aruleContextChanged
event is raised. If that is important, change the log priority to Debug to see more details:15:16:43.291:INP9:DEBUG:ruleContext:isc_SearchForm_0:provideRuleContext [ruleScope: isc_DataView_0, dbcID: isc_SearchForm_0] START TRANSACTION 15:16:43.292:INP9:DEBUG:ruleContext:isc_SearchForm_0:provideRuleContext [ruleScope: isc_DataView_0, dbcID: isc_SearchForm_0]: Order.orderNumber = 10104 15:16:43.292:INP9:DEBUG:ruleContext:isc_SearchForm_0:provideRuleContext [ruleScope: isc_DataView_0, dbcID: isc_SearchForm_0]: orderSearchForm.values.orderNumber = 10104 15:16:43.293:INP9:DEBUG:ruleContext:isc_SearchForm_0:provideRuleContext [ruleScope: isc_DataView_0, dbcID: isc_SearchForm_0]: orderSearchForm.hasChanges = true 15:16:43.294:INP9:DEBUG:ruleContext:isc_SearchForm_0:provideRuleContext [ruleScope: isc_DataView_0, dbcID: isc_SearchForm_0] END TRANSACTION
Here the isc_SearchForm_0 provides rule context changes as part of a 'transaction'. That is, the three values are provided separately but a singleruleContextChanged
event is raised at the end of the 'transaction'. If only one change is part of a 'transaction' the start/end log messages are suppressed. For example, the isc_ListGrid_0 updates rule context as a result of the change in the dynamic criteria. The criteria is provided to rule context separately fromdataLoading
updates:15:16:43.305:INP9:DEBUG:ruleContext:isc_ListGrid_0:provideRuleContext [ruleScope: isc_DataView_0, dbcID: isc_ListGrid_0]: orderDetailGrid.criteria = {fieldName: "orderNumber", operator: "equals", valuePath: "orderSearchForm.values.orderNumber", value: 10104, _constructor: "AdvancedCriteria"} 15:16:43.317:INP9:DEBUG:ruleContext:isc_ListGrid_0:provideRuleContext [ruleScope: isc_DataView_0, dbcID: isc_ListGrid_0]: orderDetailGrid.dataLoading = true 15:16:44.228:TMR2:DEBUG:ruleContext:isc_ListGrid_0:provideRuleContext [ruleScope: isc_DataView_0, dbcID: isc_ListGrid_0]: orderDetailGrid.dataLoading = null
- Parameters:
ruleScope
- New ruleScope value. Default value is null- Returns:
Canvas
instance, for chaining setter calls- Throws:
IllegalStateException
- this property cannot be changed after the component has been created
- any
-
getRuleScope
ID
of the component that gathers the context for evaluation of criteria-based rules specified by properties such asFormItem.visibleWhen
, Dynamic Properties, andDynamicCriteria
such asListGrid.initialCriteria
.If
ruleScope
is not specified, this component will search through itsparentCanvas
chain until it either reaches the top or reaches a parent markedisRuleScope
. This means that typically,ruleScope
does not have to be explicitly specified, since components that want to reference each other often have the same top-level parent (eg, they are part of the same screen). However, you would need to specifyruleScope
in scenarios such as a modal Window that wants to reference values in the component it was launched from.Determination of the
ruleScope
happens when the component is first drawn.The component designated as the
ruleScope
manages a nested data structure called the "rule context" which contains information from allDataBoundComponent
s that are registered with theruleScope
. By specifyingCriterion.fieldName
as aDataPath
, AdvancedCriteria defined in properties such asFormItem.visibleWhen
can access any part of the rule context.By default, the rule context contains data as follows:
- any
DataBoundComponent
that has a DataSource contributes the values of the selected record or record being edited under the ID of the DataSource. For any collision an editable display (such as a form or editable grid) wins over a static display (such as a non-editable grid with a selection.) Hidden or cleared components have lowest priority even if editable. For two editable components the first becomes the contributor. - any ListGrid or other component that manages a selection and has been assigned an explicit
ID
will contribute the values of the selected record under<componentId>.selectedRecord
, the values of the grid summary record under<componentId>.summaryRecord
, and also contributes 3 flags for checking for selection:anySelected
,multiSelected
,numSelected
. The selected record can also be identified by row number:<componentId>.selectedRowNum
which also applies to the edit row since editing implies selection by default. - any DynamicForm or other component that edits values and has been assigned an explicit
ID
contributes its current values under<componentId>.values
, and contributes a flaghasChanges
. - any DynamicForm or ListGrid that has been assigned an explicit
ID
contributes a value<componentId>.focusField
. When present the value indicates the component has focus along with the name of the field that has focus. Its absense indicates the component does not have focus at all. - any ListGrid that has been assigned an explicit
ID
contributes a flagisGrouped
under<componentId>
. - any DataSource included in a
DataContext
ortestDataContext
that is being used for this ruleScope contributes the values into thedataContext
section of the ruleContext (ex.dataContext.Customer
) so the values do not conflict with normal DataSource contributions. Note that thedataContext
is immutable so only the first contribution is actually saved.
In addition to data contributed by DataBoundComponent, the ruleScope also contains entries contributed by the Authentication class, such as the authenticated userId and roles - see
Authentication
for details. Characteristics of the current device is also included as:{ device : { isPhone : false, isTablet : false, isDesktop : true, isLandscape : true } }
For example, given a screen where:
- a ListGrid with ID "itemGrid" and DynamicForm with ID "itemForm" are both bound to the
supplyItem
sample DataSource - the ListGrid has a single selection, and the record selected in the ListGrid is being edited in the form, and has been changed
getRuleContext()
, expressed as JSON, would be:{ supplyItem : { itemID : "654321", itemName : "Sewing Machine", price : 5.50, // note: user change ..other properties.. }, itemForm.values : { itemID : "654321", itemName : "Sewing Machine", price : 5.50, // note: user change ..other properties.. }, itemForm.focusField : "itemName", itemForm.hasChanges : true, itemGrid.selectedRecord : { itemID : "654321", itemName : "Sewing Machine", price : 3.50, // note: old price ..other properties.. }, itemGrid.anySelected : true, itemGrid.multiSelected : false, itemGrid.numSelected : 1, itemGrid.isGrouped : false, device : { isPhone : false, isTablet : false, isDesktop : true, isLandscape : true }, auth : { currentUser : { userId: "lisa", firstName: "Lisa", lastName: "Admin", roles: "admin", ..other properties.. }, roles : ['admin'], isSuperUser : false } }
In addition, an application can put custom data into the ruleScope viaprovideRuleContext()
.Troubleshooting RuleScope issues
The ruleScope system consists of two major parts: managing the rule context and using the rule context. The former is handled byprovideRuleContext()
andremoveRuleContext()
. Users of rule context are the criteria-based rules noted above.A number of Log categories are provided to make diagnosing ruleScope issues easier:
- ruleContext
- whenRules
- dynamicProperties
- dynamicCriteria
Smart GWT Developer Console
. By default none of these categories are included in theLogging Preferences
category choices. To add one or more of these categories, selectMore...
then clickAdd...
. Be sure to enter the category with the correct capitalization.At the Info log priority one or two basic log messages are generated per action. The Debug priority generally includes additional information like the full criteria or a message for each evaluation even when no change is made.
Using and Interpreting log messages
To address a specific issue on rules, select the Info priority for the target category in the Developer Console then perform your application actions that are being diagnosed. You may want to re-run your application to get a clean start on the changes.whenRules and dynamicProperties
Both of these types of properties are triggered by a criteria that can reference the ruleContext and/or the component's values (for forms). The criteria is re-evaluated on each rule context change and based on the criteria being matched or not, the action is taken or property updated.Below are some example Info log messages:
16:53:39.032:TMR8[E0]:INFO:whenRules:Hide Canvas 'isc_Canvas_1' 16:53:39.034:TMR8[E1]:INFO:whenRules:Disabling Canvas 'isc_Button_3' 16:53:39.509:TMR9[E0]:INFO:whenRules:Hide Canvas 'isc_Canvas_2' 16:53:39.510:TMR9[E1]:INFO:whenRules:Hide Canvas 'isc_Button_4' 16:53:39.527:TMR4:INFO:whenRules:Show Canvas 'isc_Canvas_2' 16:53:39.527:TMR4:INFO:whenRules:Show Canvas 'isc_Button_4' 16:53:39.528:TMR4:INFO:whenRules:Disabling Canvas 'isc_Button_4' 16:53:39.529:TMR4:INFO:whenRules:Set read-only (appearance disabled) FormItem 'itemForm3.field2' 16:53:39.974:TMR6:INFO:whenRules:Set editable (appearance disabled) FormItem 'itemForm3.field2' 16:53:40.540:TMR2:INFO:whenRules:Enabling FormItemIcon 'itemForm4.field2.remove' 16:53:40.541:TMR2:INFO:whenRules:Hide FormItemIcon 'itemForm4.field4.edit'
These indicate various responses tovisibleWhen
,enableWhen
, andreadOnlyWhen
actions.By setting the priority to Debug you can see the creation of the rule for the criteria and the evaluation of the criteria before action is taken:
16:53:41.569:TMR7:DEBUG:whenRules:itemForm6:Create whenRule: itemForm6_field2_readOnly, applyWhen { "_constructor":"AdvancedCriteria", "operator":"and", "criteria":[ { "fieldName":"layout1.date1", "operator":"greaterOrEqualField", "value":"layout1.date2" } ] } to target {component: [DynamicForm ID:itemForm6], fieldName: "field2", formIconName: undef} 16:53:41.571:TMR7:DEBUG:whenRules:isc_RulesEngine_5:Applying readOnly rule 'itemForm6_field2_readOnly' for FormItem itemForm6.field2 with action result true. applyWhen criteria matched: { "__normalized":true, "_constructor":"AdvancedCriteria", "operator":"and", "criteria":[ { "__normalized":true, "fieldName":"layout1.date1", "operator":"greaterOrEqualField", "value":"layout1.date2" } ] } 16:53:41.571:TMR7:DEBUG:whenRules:Set read-only (appearance disabled) FormItem 'itemForm6.field2'
dynamicProperties are similar:16:59:13.588:XRP8:INFO:dynamicProperties:Set (populateFromDataPath) 'isc_Button_0.title' to [initial value]: Special Title 16:59:13.650:TMR2:WARN:Class:isc_Class_0:Attempt to evaluate formulaFunction itemForm.values.count * 2 + 10 failed. Error message:undefined is not an object (evaluating 'itemForm.values') 16:59:13.657:TMR9:INFO:dynamicProperties:Set (populate) 'isc_Class_0.contents' to [initial value]: 34
This example shows a failed formula indicating that the 'itemForm.values' isn't valid in the ruleContext. In this case the form values haven't been provided to ruleContext yet. When they are the next log message shows the result.dynamicCriteria
Each time a dynamic criteria is evaluated (as triggered by aruleContextChanged
event) a log entry is made:14:54:46.436:INP9:INFO:dynamicCriteria:isc_ListGrid_0:Evaluated dynamic criteria: filterCriteria
This indicates that dynamicCriteria for isc_ListGrid_0 is being evaluated/re-evaluated. By changing the priority to Debug the resolved criteria is also included:14:55:16.231:INP9:DEBUG:dynamicCriteria:isc_ListGrid_0:Evaluated dynamic criteria: filterCriteria { "fieldName":"orderNumber", "operator":"equals", "valuePath":"orderSearchForm.values.orderNumber", "value":10104, "_constructor":"AdvancedCriteria" }
Note the valuePath oforderSearchForm.values.orderNumber
is resolved to the value of10104
.ruleContext
If none of the logging above provides details needed to understand what is going on, enabling the ruleContext category can be enabled. At Info a single log message is reported for each ruleContext change.For example, below are the rule context changes that occurred to trigger the above dynamicCriteria messages above:
14:54:46.432:INP9:INFO:ruleContext:isc_SearchForm_0:provideRuleContext [ruleScope: isc_DataView_0, dbcID: isc_SearchForm_0]: Order.orderNumber = 10104 14:54:46.433:INP9:INFO:ruleContext:isc_SearchForm_0:provideRuleContext [ruleScope: isc_DataView_0, dbcID: isc_SearchForm_0]: orderSearchForm.values.orderNumber = 10104 14:54:46.434:INP9:INFO:ruleContext:isc_SearchForm_0:provideRuleContext [ruleScope: isc_DataView_0, dbcID: isc_SearchForm_0]: orderSearchForm.hasChanges = true
This indicates that isc_SearchForm_0 updated rule context with three changed values. There is no indication of when aruleContextChanged
event is raised. If that is important, change the log priority to Debug to see more details:15:16:43.291:INP9:DEBUG:ruleContext:isc_SearchForm_0:provideRuleContext [ruleScope: isc_DataView_0, dbcID: isc_SearchForm_0] START TRANSACTION 15:16:43.292:INP9:DEBUG:ruleContext:isc_SearchForm_0:provideRuleContext [ruleScope: isc_DataView_0, dbcID: isc_SearchForm_0]: Order.orderNumber = 10104 15:16:43.292:INP9:DEBUG:ruleContext:isc_SearchForm_0:provideRuleContext [ruleScope: isc_DataView_0, dbcID: isc_SearchForm_0]: orderSearchForm.values.orderNumber = 10104 15:16:43.293:INP9:DEBUG:ruleContext:isc_SearchForm_0:provideRuleContext [ruleScope: isc_DataView_0, dbcID: isc_SearchForm_0]: orderSearchForm.hasChanges = true 15:16:43.294:INP9:DEBUG:ruleContext:isc_SearchForm_0:provideRuleContext [ruleScope: isc_DataView_0, dbcID: isc_SearchForm_0] END TRANSACTION
Here the isc_SearchForm_0 provides rule context changes as part of a 'transaction'. That is, the three values are provided separately but a singleruleContextChanged
event is raised at the end of the 'transaction'. If only one change is part of a 'transaction' the start/end log messages are suppressed. For example, the isc_ListGrid_0 updates rule context as a result of the change in the dynamic criteria. The criteria is provided to rule context separately fromdataLoading
updates:15:16:43.305:INP9:DEBUG:ruleContext:isc_ListGrid_0:provideRuleContext [ruleScope: isc_DataView_0, dbcID: isc_ListGrid_0]: orderDetailGrid.criteria = {fieldName: "orderNumber", operator: "equals", valuePath: "orderSearchForm.values.orderNumber", value: 10104, _constructor: "AdvancedCriteria"} 15:16:43.317:INP9:DEBUG:ruleContext:isc_ListGrid_0:provideRuleContext [ruleScope: isc_DataView_0, dbcID: isc_ListGrid_0]: orderDetailGrid.dataLoading = true 15:16:44.228:TMR2:DEBUG:ruleContext:isc_ListGrid_0:provideRuleContext [ruleScope: isc_DataView_0, dbcID: isc_ListGrid_0]: orderDetailGrid.dataLoading = null
- Returns:
- Current ruleScope value. Default value is null
- any
-
setScrollbarConstructor
The class that will be used to create custom scrollbars for this component. Set this attribute to a Scrollbar subclass with e.g. a different skinImgDir, to customize scrollbar appearance for this component only.When
spriting is enabled
and supported by the skin, the defaultscrollbarConstructor
is changed to a different scrollbar class which handles scrollbar spriting. Spriting of the scrollbars of an individual component can therefore be disabled by creating the component withscrollbarConstructor
set to the "Scrollbar" class. "Scrollbar" is a basic scrollbar class that does not employ spriting.Note : This is an advanced setting
- Parameters:
scrollbarConstructor
- New scrollbarConstructor value. Default value is "Scrollbar"- Returns:
Canvas
instance, for chaining setter calls- Throws:
IllegalStateException
- this property cannot be changed after the component has been created- See Also:
-
setScrollbarSize
How thick should we make the scrollbars for this canvas. This only applies ifshowCustomScrollbars
istrue
.NOTE: When
spriting is enabled
, changing thescrollbarSize
may cause tiling of certain images and backgrounds that make up the custom scrollbar. This can be fixed for a component by creating it withscrollbarConstructor
set to "Scrollbar"—a basic scrollbar class that does not employ spriting.Note : This is an advanced setting
- Parameters:
scrollbarSize
- New scrollbarSize value. Default value is 16- Returns:
Canvas
instance, for chaining setter calls- See Also:
-
getScrollbarSize
public int getScrollbarSize()How thick should we make the scrollbars for this canvas. This only applies ifshowCustomScrollbars
istrue
.NOTE: When
spriting is enabled
, changing thescrollbarSize
may cause tiling of certain images and backgrounds that make up the custom scrollbar. This can be fixed for a component by creating it withscrollbarConstructor
set to "Scrollbar"—a basic scrollbar class that does not employ spriting.- Returns:
- Returns the thickness of this widget's scrollbars.
For canvases showing custom scrollbars this is determined fromthis.scrollbarSize
. Default value is 16 - See Also:
-
setShadowColor
Color for the css-based drop shadow shown ifuseCSSShadow
is true andshowShadow
is true.Has no effect if we are not using css-based shadows - in that case, use
shadowImage
instead.Note : This is an advanced setting
-
getShadowColor
Color for the css-based drop shadow shown ifuseCSSShadow
is true andshowShadow
is true.Has no effect if we are not using css-based shadows - in that case, use
shadowImage
instead.- Returns:
- Current shadowColor value. Default value is "#AAAAAA"
- See Also:
-
setShadowDepth
Depth of the shadow, or the virtual height above the page of the widget throwing the shadow.This is a single parameter that can be used to control both
shadowSoftness
andshadowOffset
.- Parameters:
shadowDepth
- New shadowDepth value. Default value is 4- Returns:
Canvas
instance, for chaining setter calls- Throws:
IllegalStateException
- this property cannot be changed after the component has been created
-
getShadowDepth
public int getShadowDepth()Depth of the shadow, or the virtual height above the page of the widget throwing the shadow.This is a single parameter that can be used to control both
shadowSoftness
andshadowOffset
.- Returns:
- Current shadowDepth value. Default value is 4
-
setShadowHOffset
Horizontal offset for theshadow
. Takes precedence overshadowOffset
if set. Has no effect ifcss-shadows
are not being used for this canvas.Note : This is an advanced setting
- Parameters:
shadowHOffset
- New shadowHOffset value. Default value is null- Returns:
Canvas
instance, for chaining setter calls
-
getShadowHOffset
Horizontal offset for theshadow
. Takes precedence overshadowOffset
if set. Has no effect ifcss-shadows
are not being used for this canvas.- Returns:
- Current shadowHOffset value. Default value is null
-
setShadowImage
IfuseCSSShadow
is false, (or for browsers that do not support css3), this property supplies the base name of the series of images for the sides, corners, and center of the shadow.The actual image names fetched for the dropShadow combine the segment name and the
shadowDepth
setting. For example, given "ds.png" as the base name, a depth of 4, and the top-left segment of the shadow, we'd use "ds4_TL.png".The names for segments are the same as those given for controlling resizable edges; see
resizeFrom
. The center segment has the name "center". The center segment is the only segment that doesn't include the depth in the URL, so the final image name for the center given a baseName of "ds.png" would be just "ds_center.png".Note : This is an advanced setting
- Parameters:
shadowImage
- New shadowImage value. Default value is "[SKIN]ds.png"- Returns:
Canvas
instance, for chaining setter calls- Throws:
IllegalStateException
- this property cannot be changed after the component has been created- See Also:
-
getShadowImage
IfuseCSSShadow
is false, (or for browsers that do not support css3), this property supplies the base name of the series of images for the sides, corners, and center of the shadow.The actual image names fetched for the dropShadow combine the segment name and the
shadowDepth
setting. For example, given "ds.png" as the base name, a depth of 4, and the top-left segment of the shadow, we'd use "ds4_TL.png".The names for segments are the same as those given for controlling resizable edges; see
resizeFrom
. The center segment has the name "center". The center segment is the only segment that doesn't include the depth in the URL, so the final image name for the center given a baseName of "ds.png" would be just "ds_center.png".- Returns:
- Current shadowImage value. Default value is "[SKIN]ds.png"
- See Also:
-
setShadowOffset
Offset of the shadow. Defaults to half ofshadowDepth
if unset.Because of the blurred edges, a shadow is larger than the originating component by 2xsoftness. An
shadowOffset
of 0 means that the shadow will extend around the originating component equally in all directions.If
css shadows
are being used, separate vertical and horizontal offsets may be specified viashadowHOffset
andshadowVOffset
.Note : This is an advanced setting
- Parameters:
shadowOffset
- New shadowOffset value. Default value is null- Returns:
Canvas
instance, for chaining setter calls- See Also:
-
getShadowOffset
Offset of the shadow. Defaults to half ofshadowDepth
if unset.Because of the blurred edges, a shadow is larger than the originating component by 2xsoftness. An
shadowOffset
of 0 means that the shadow will extend around the originating component equally in all directions.If
css shadows
are being used, separate vertical and horizontal offsets may be specified viashadowHOffset
andshadowVOffset
.- Returns:
- Current shadowOffset value. Default value is null
- See Also:
-
setShadowSoftness
Softness, or degree of blurring, of the shadow.A shadow with
softness:x
is 2x pixels larger in each direction than the element throwing the shadow, and the media for each edge should be x pixels wide/tall.Defaults to
shadowDepth
if unset.Note : This is an advanced setting
- Parameters:
shadowSoftness
- New shadowSoftness value. Default value is null- Returns:
Canvas
instance, for chaining setter calls- See Also:
-
getShadowSoftness
Softness, or degree of blurring, of the shadow.A shadow with
softness:x
is 2x pixels larger in each direction than the element throwing the shadow, and the media for each edge should be x pixels wide/tall.Defaults to
shadowDepth
if unset.- Returns:
- Current shadowSoftness value. Default value is null
- See Also:
-
setShadowSpread
Explicit spread for the css-based drop shadow shown ifuseCSSShadow
is true andshowShadow
is true. This property governs how much larger than the widget the shadow will appear. A negative value (coupled with an explicit offset) will result in a smaller shadow.Has no effect if we are not using css-based shadows - in that case, use
shadowImage
instead.Note : This is an advanced setting
- Parameters:
shadowSpread
- New shadowSpread value. Default value is null- Returns:
Canvas
instance, for chaining setter calls
-
getShadowSpread
Explicit spread for the css-based drop shadow shown ifuseCSSShadow
is true andshowShadow
is true. This property governs how much larger than the widget the shadow will appear. A negative value (coupled with an explicit offset) will result in a smaller shadow.Has no effect if we are not using css-based shadows - in that case, use
shadowImage
instead.- Returns:
- Current shadowSpread value. Default value is null
-
setShadowVOffset
Vertical offset for theshadow
. Takes precedence overshadowOffset
if set. Has no effect ifcss-shadows
are not being used for this canvas.Note : This is an advanced setting
- Parameters:
shadowVOffset
- New shadowVOffset value. Default value is null- Returns:
Canvas
instance, for chaining setter calls
-
getShadowVOffset
Vertical offset for theshadow
. Takes precedence overshadowOffset
if set. Has no effect ifcss-shadows
are not being used for this canvas.- Returns:
- Current shadowVOffset value. Default value is null
-
setShouldPrint
Whether this canvas should be included in a printable view.Default is to:
- omit all peers (edges generated by showEdges:true, etc)
- omit anything considered a "control", such as a button or menu (see
PrintProperties.omitControls
) - include everything else not marked shouldPrint:false
-
getShouldPrint
Whether this canvas should be included in a printable view.Default is to:
- omit all peers (edges generated by showEdges:true, etc)
- omit anything considered a "control", such as a button or menu (see
PrintProperties.omitControls
) - include everything else not marked shouldPrint:false
- Returns:
- Current shouldPrint value. Default value is null
- See Also:
-
setShowCustomScrollbars
Whether to use the browser's native scrollbars or Smart GWT-based scrollbars.Smart GWT-based scrollbars are skinnable, giving you complete control over look and feel. Smart GWT-based scrollbars also enable some interactions not possible with native scrollbars, such as
variable height records
in grids in combination withdata paging
.Native browser scrollbars are slightly faster simply because there are less Smart GWT components that need to be created, drawn and updated. Each visible Smart GWT-based scrollbar on the screen has roughly the impact of two StretchImgButtons.
Smart GWT is always aware of the size of the scrollbar, regardless of whether native or custom scrollbars are used, and regardless of what operating system and/or operating system "theme" or "skin" is in use. This means Smart GWT will correctly report the
viewport size
, that is, the interior area of the widget excluding space taken by scrollbars, which is key for exactly filling a component with content without creating unnecessary scrolling.The
showCustomScrollbars
setting is typically overridden in load_skin.js in order to change the default for all Smart GWT components at once. This may be achieved via the staticsetDefaultShowCustomScrollbars(boolean)
method or calling setProperty() , like so:Canvas canvas = new Canvas(); canvas.setProperty("showCustomScrollbars", false);
On
touch devices
, custom scrollbars are disabled in favor of enabling native touch scrolling if available. However, custom scrollbars and native touch scrolling can be enabled for the component by settingalwaysShowScrollbars
totrue
.Note : This is an advanced setting
- Parameters:
showCustomScrollbars
- New showCustomScrollbars value. Default value is true- Returns:
Canvas
instance, for chaining setter calls- Throws:
IllegalStateException
- this property cannot be changed after the component has been created- See Also:
-
getShowCustomScrollbars
public boolean getShowCustomScrollbars()Whether to use the browser's native scrollbars or Smart GWT-based scrollbars.Smart GWT-based scrollbars are skinnable, giving you complete control over look and feel. Smart GWT-based scrollbars also enable some interactions not possible with native scrollbars, such as
variable height records
in grids in combination withdata paging
.Native browser scrollbars are slightly faster simply because there are less Smart GWT components that need to be created, drawn and updated. Each visible Smart GWT-based scrollbar on the screen has roughly the impact of two StretchImgButtons.
Smart GWT is always aware of the size of the scrollbar, regardless of whether native or custom scrollbars are used, and regardless of what operating system and/or operating system "theme" or "skin" is in use. This means Smart GWT will correctly report the
viewport size
, that is, the interior area of the widget excluding space taken by scrollbars, which is key for exactly filling a component with content without creating unnecessary scrolling.The
showCustomScrollbars
setting is typically overridden in load_skin.js in order to change the default for all Smart GWT components at once. This may be achieved via the staticsetDefaultShowCustomScrollbars(boolean)
method or calling setProperty() , like so:Canvas canvas = new Canvas(); canvas.setProperty("showCustomScrollbars", false);
On
touch devices
, custom scrollbars are disabled in favor of enabling native touch scrolling if available. However, custom scrollbars and native touch scrolling can be enabled for the component by settingalwaysShowScrollbars
totrue
.- Returns:
- Current showCustomScrollbars value. Default value is true
- See Also:
-
setShowDragShadow
When this widget is dragged, if its dragAppearance is"target"
, should we show a shadow behind the canvas during the drag.Note : This is an advanced setting
- Parameters:
showDragShadow
- New showDragShadow value. Default value is null- Returns:
Canvas
instance, for chaining setter calls- See Also:
-
getShowDragShadow
When this widget is dragged, if its dragAppearance is"target"
, should we show a shadow behind the canvas during the drag.- Returns:
- Current showDragShadow value. Default value is null
- See Also:
-
setShowEdges
Whether anEdgedCanvas
should be used to show image-based edges around this component.- Parameters:
showEdges
- New showEdges value. Default value is false- Returns:
Canvas
instance, for chaining setter calls- Throws:
IllegalStateException
- this property cannot be changed after the component has been created- See Also:
-
getShowEdges
Whether anEdgedCanvas
should be used to show image-based edges around this component.- Returns:
- Current showEdges value. Default value is false
- See Also:
-
setShowHover
Ifthis.canHover
is true, should we show the global hover canvas by default when the user hovers over this canvas?- Parameters:
showHover
- New showHover value. Default value is true- Returns:
Canvas
instance, for chaining setter calls- See Also:
-
getShowHover
Ifthis.canHover
is true, should we show the global hover canvas by default when the user hovers over this canvas?- Returns:
- Current showHover value. Default value is true
- See Also:
-
setShowHoverComponents
When set to true, shows a widget hovering at the mouse point instead of the builtin hover label. OverridegetHoverComponent
to provide the Canvas to show as the hoverComponent.Note : This is an advanced setting
- Parameters:
showHoverComponents
- New showHoverComponents value. Default value is false- Returns:
Canvas
instance, for chaining setter calls
-
getShowHoverComponents
When set to true, shows a widget hovering at the mouse point instead of the builtin hover label. OverridegetHoverComponent
to provide the Canvas to show as the hoverComponent.- Returns:
- Current showHoverComponents value. Default value is false
-
setShowPointer
Should a pointer be shown? A pointer can be placed on the border to identify the target of the canvas contents. The default position for the pointer is top-right. The position and additional properties of the pointer is specified bypointerSettings
.If a
pointerTarget
is specified,showPointer
will be enabled unless it is explicitly set tofalse
.
If this method is called after the component has been drawn/initialized: Set the showPointer property.- Parameters:
showPointer
- New showPointer value. Default value is null- Returns:
Canvas
instance, for chaining setter calls
-
getShowPointer
Should a pointer be shown? A pointer can be placed on the border to identify the target of the canvas contents. The default position for the pointer is top-right. The position and additional properties of the pointer is specified bypointerSettings
.If a
pointerTarget
is specified,showPointer
will be enabled unless it is explicitly set tofalse
.- Returns:
- Current showPointer value. Default value is null
-
setShowResizeBar
When this Canvas is included as a member in aLayout
, whether a resizeBar should be shown after this member in the layout, to allow it to be resized.Whether a resizeBar is actually shown also depends on the
defaultResizeBars
attribute of the layout, and whether this Canvas is the last layout member.By default the resize bar acts on the Canvas that it is declared on. If you want the resize bar to instead act on the next member of the Layout (e.g. to collapse down or to the right), set
resizeBarTarget
as well.
If this method is called after the component has been drawn/initialized: When this Canvas is included as a member in aLayout
, dynamically updates whether a resizeBar should be shown after this member in the layout, to allow it to be resized.Whether a resizeBar is actually shown also depends on the
defaultResizeBars
attribute of the layout, and whether this Canvas is the last layout member.- Parameters:
showResizeBar
- setting for this.showResizeBar. Default value is false- Returns:
Canvas
instance, for chaining setter calls- See Also:
-
getShowResizeBar
When this Canvas is included as a member in aLayout
, whether a resizeBar should be shown after this member in the layout, to allow it to be resized.Whether a resizeBar is actually shown also depends on the
defaultResizeBars
attribute of the layout, and whether this Canvas is the last layout member.By default the resize bar acts on the Canvas that it is declared on. If you want the resize bar to instead act on the next member of the Layout (e.g. to collapse down or to the right), set
resizeBarTarget
as well.- Returns:
- Current showResizeBar value. Default value is false
- See Also:
-
setShowShadow
Whether to show a drop shadow for this Canvas.Shadows may be rendered using
css
or via images. The appearance of shadows can be customized viashadowColor
(for css-based shadows) orshadowImage
(for image based shadows),shadowDepth
,shadowOffset
andshadowSoftness
.When
useCSSShadow
is false, developers should be aware that the drop shadow is rendered as apeer
and is drawn outside the specified width and height of the widget meaning a widget with shadows takes up a little more space than it otherwise would. A full screen canvas with showShadow set to true as this would be likely to cause browser scrollbars to appear - developers can handle this by either setting this property to false on full-screen widgets, or by setting overflow to "hidden" on the <body> element if browser-level scrolling is never intended to occur.
If this method is called after the component has been drawn/initialized: Method to updateshowShadow
.- Parameters:
showShadow
- true if the shadow should be visible false if not. Default value is false- Returns:
Canvas
instance, for chaining setter calls- See Also:
-
getShowShadow
Whether to show a drop shadow for this Canvas.Shadows may be rendered using
css
or via images. The appearance of shadows can be customized viashadowColor
(for css-based shadows) orshadowImage
(for image based shadows),shadowDepth
,shadowOffset
andshadowSoftness
.When
useCSSShadow
is false, developers should be aware that the drop shadow is rendered as apeer
and is drawn outside the specified width and height of the widget meaning a widget with shadows takes up a little more space than it otherwise would. A full screen canvas with showShadow set to true as this would be likely to cause browser scrollbars to appear - developers can handle this by either setting this property to false on full-screen widgets, or by setting overflow to "hidden" on the <body> element if browser-level scrolling is never intended to occur.- Returns:
- Current showShadow value. Default value is false
- See Also:
-
setShowSnapGrid
Whether to show a snap grid for this Canvas. Note that the grid is only shown when eitherchildrenSnapToGrid
orchildrenSnapResizeToGrid
istrue
.Grid is based on
snapHGap
andsnapVGap
properties.
If this method is called after the component has been drawn/initialized: Set the showSnapGrid property.- Parameters:
showSnapGrid
- New showSnapGrid value. Default value is null- Returns:
Canvas
instance, for chaining setter calls- See Also:
-
getShowSnapGrid
Whether to show a snap grid for this Canvas. Note that the grid is only shown when eitherchildrenSnapToGrid
orchildrenSnapResizeToGrid
istrue
.- Returns:
- Current showSnapGrid value. Default value is null
- See Also:
-
setShrinkElementOnHide
This is an advanced setting. If set totrue
, when a widget ishidden
, the widget's handle will be resized such that it takes up no space, in addition to having its cssvisibility
property set to"hidden"
.In addition to preventing the size of this widget from impacting the
scroll size
of any parent widget while hidden, this setting works around a native bug observed in Internet Explorer 10, whereby an<IFRAME>
element with visibility set to hidden can cause rendering problems, if the HTML loaded by the<IFRAME>
contains a<frameset>
. In this case the browser may refuse to draw other elements at the same coordinates with a lower z-index than the hidden frame. Setting this property totrue
works around this problem for cases where an<IFRAME>
containing a<frameset
will be rendered out, for example in anHTMLFlow
withcontentsType
set to"page"
.Note : This is an advanced setting
- Parameters:
shrinkElementOnHide
- New shrinkElementOnHide value. Default value is false- Returns:
Canvas
instance, for chaining setter calls- See Also:
-
getShrinkElementOnHide
public boolean getShrinkElementOnHide()This is an advanced setting. If set totrue
, when a widget ishidden
, the widget's handle will be resized such that it takes up no space, in addition to having its cssvisibility
property set to"hidden"
.In addition to preventing the size of this widget from impacting the
scroll size
of any parent widget while hidden, this setting works around a native bug observed in Internet Explorer 10, whereby an<IFRAME>
element with visibility set to hidden can cause rendering problems, if the HTML loaded by the<IFRAME>
contains a<frameset>
. In this case the browser may refuse to draw other elements at the same coordinates with a lower z-index than the hidden frame. Setting this property totrue
works around this problem for cases where an<IFRAME>
containing a<frameset
will be rendered out, for example in anHTMLFlow
withcontentsType
set to"page"
.- Returns:
- Current shrinkElementOnHide value. Default value is false
- See Also:
-
setSizeMayChangeOnRedraw
Is it possible that a call toredraw()
on this widget will change its size?Used by framework layout code when determining whether a component which has been
marked as dirty
needs an immediate redraw to determine its drawn size.If unset, default behavior assumes any component with overflow set to "visible" may change size on redraw, and any component with overflow set to "hidden", "scroll", or "auto" will not. This property overrides that behavior, and may be used to indicate that some component with non visible overflow can change size on redraw. An example use case would be a custom component with an override to explicitly resize the component as part of the redraw() flow.
Note : This is an advanced setting
- Parameters:
sizeMayChangeOnRedraw
- New sizeMayChangeOnRedraw value. Default value is null- Returns:
Canvas
instance, for chaining setter calls
-
getSizeMayChangeOnRedraw
Is it possible that a call toredraw()
on this widget will change its size?Used by framework layout code when determining whether a component which has been
marked as dirty
needs an immediate redraw to determine its drawn size.If unset, default behavior assumes any component with overflow set to "visible" may change size on redraw, and any component with overflow set to "hidden", "scroll", or "auto" will not. This property overrides that behavior, and may be used to indicate that some component with non visible overflow can change size on redraw. An example use case would be a custom component with an override to explicitly resize the component as part of the redraw() flow.
- Returns:
- Current sizeMayChangeOnRedraw value. Default value is null
-
setSkinImgDir
Default directory for skin images (those defined by the class), relative to the Page-wideskinDir
.Note : This is an advanced setting
- Parameters:
skinImgDir
- New skinImgDir value. Default value is "images/"- Returns:
Canvas
instance, for chaining setter calls- See Also:
-
getSkinImgDir
Default directory for skin images (those defined by the class), relative to the Page-wideskinDir
.- Returns:
- Current skinImgDir value. Default value is "images/"
- See Also:
-
setSnapAlignCandidates
WhenchildrenSnapAlign
is enabled, list of candidates to check for alignment.If a list of
snapAlignCandidates
is never provided, the default is to use all children that are not explicitly excluded viaisSnapAlignCandidate
, including automatically adding newly added children as candidates, and ignoring children that have been removed. UseaddSnapAlignCandidate()
andremoveSnapAlignCandidate()
to add and remove special candidates while retaining all children as default candidates.Possible candidates which are not drawn or are hidden are automatically ignored.
- Parameters:
snapAlignCandidates
- New snapAlignCandidates value. Default value is null- Returns:
Canvas
instance, for chaining setter calls- See Also:
-
getSnapAlignCandidates
WhenchildrenSnapAlign
is enabled, list of candidates to check for alignment.If a list of
snapAlignCandidates
is never provided, the default is to use all children that are not explicitly excluded viaisSnapAlignCandidate
, including automatically adding newly added children as candidates, and ignoring children that have been removed. UseaddSnapAlignCandidate()
andremoveSnapAlignCandidate()
to add and remove special candidates while retaining all children as default candidates.Possible candidates which are not drawn or are hidden are automatically ignored.
- Returns:
- Current snapAlignCandidates value. Default value is null
- See Also:
-
setSnapAlignCenterLineStyle
public Canvas setSnapAlignCenterLineStyle(String snapAlignCenterLineStyle) throws IllegalStateException CSS border declaration used for the line shown to indicate snapping to a center line whenchildrenSnapAlign
is set.- Parameters:
snapAlignCenterLineStyle
- New snapAlignCenterLineStyle value. Default value is "1px solid blue"- Returns:
Canvas
instance, for chaining setter calls- Throws:
IllegalStateException
- this property cannot be changed after the component has been created- See Also:
-
getSnapAlignCenterLineStyle
CSS border declaration used for the line shown to indicate snapping to a center line whenchildrenSnapAlign
is set.- Returns:
- Current snapAlignCenterLineStyle value. Default value is "1px solid blue"
- See Also:
-
setSnapAlignEdgeLineStyle
CSS border declaration used for the line shown to indicate snapping to a edge line whenchildrenSnapAlign
is set.- Parameters:
snapAlignEdgeLineStyle
- New snapAlignEdgeLineStyle value. Default value is "1px solid #555555"- Returns:
Canvas
instance, for chaining setter calls- Throws:
IllegalStateException
- this property cannot be changed after the component has been created- See Also:
-
getSnapAlignEdgeLineStyle
CSS border declaration used for the line shown to indicate snapping to a edge line whenchildrenSnapAlign
is set.- Returns:
- Current snapAlignEdgeLineStyle value. Default value is "1px solid #555555"
- See Also:
-
setSnapAxis
Describes which axes to apply snap-to-grid to. Valid values are "horizontal", "vertical" or "both".- Parameters:
snapAxis
- New snapAxis value. Default value is "both"- Returns:
Canvas
instance, for chaining setter calls- See Also:
-
getSnapAxis
Describes which axes to apply snap-to-grid to. Valid values are "horizontal", "vertical" or "both".- Returns:
- Current snapAxis value. Default value is "both"
- See Also:
-
setSnapEdge
IfsnapTo
is defined to this widget, this property can be used to define which edge of this widget should be snapped to an edge of the master or parent element.If unspecified the, default snapTo behavior is set up to align the "snapTo" edge of this widget with the snapTo edge of the master or parent.
If this method is called after the component has been drawn/initialized: Set the snapEdge property of this canvas, and handle repositioning.- Parameters:
snapEdge
- new snapEdge value. Default value is null- Returns:
Canvas
instance, for chaining setter calls- See Also:
-
getSnapEdge
IfsnapTo
is defined to this widget, this property can be used to define which edge of this widget should be snapped to an edge of the master or parent element.If unspecified the, default snapTo behavior is set up to align the "snapTo" edge of this widget with the snapTo edge of the master or parent.
- Returns:
- Return the snapEdge value of this object. Default value is null
- See Also:
-
setSnapGridLineProperties
public Canvas setSnapGridLineProperties(DrawLine snapGridLineProperties) throws IllegalStateException Specifies line styling to use when drawing the grid of lines forSnapGridStyle
: "lines".- Parameters:
snapGridLineProperties
- New snapGridLineProperties value. Default value is null- Returns:
Canvas
instance, for chaining setter calls- Throws:
IllegalStateException
- this property cannot be changed after the component has been created- See Also:
-
getSnapGridLineProperties
Specifies line styling to use when drawing the grid of lines forSnapGridStyle
: "lines".- Returns:
- Current snapGridLineProperties value. Default value is null
- See Also:
-
setSnapGridStyle
Specifies indication style to use for snap points, either a grid of lines or an array of crosses. The lines can be configured using the propertysnapGridLineProperties
.- Parameters:
snapGridStyle
- New snapGridStyle value. Default value is "crosses"- Returns:
Canvas
instance, for chaining setter calls- Throws:
IllegalStateException
- this property cannot be changed after the component has been created- See Also:
-
getSnapGridStyle
Specifies indication style to use for snap points, either a grid of lines or an array of crosses. The lines can be configured using the propertysnapGridLineProperties
.- Returns:
- Current snapGridStyle value. Default value is "crosses"
- See Also:
-
setSnapHDirection
The horizontal snap direction. Set this value to "before" to snap to the nearest gridpoint to the left; set it to "after" to snap to the nearest gridpoint to the right; and set it to "nearest" to snap to the nearest gridpoint in either direction.- Parameters:
snapHDirection
- New snapHDirection value. Default value is "after"- Returns:
Canvas
instance, for chaining setter calls- See Also:
-
getSnapHDirection
The horizontal snap direction. Set this value to "before" to snap to the nearest gridpoint to the left; set it to "after" to snap to the nearest gridpoint to the right; and set it to "nearest" to snap to the nearest gridpoint in either direction.- Returns:
- Current snapHDirection value. Default value is "after"
- See Also:
-
setSnapHGap
The horizontal grid size to use, in pixels, when snap-to-grid is enabled.- Parameters:
snapHGap
- New snapHGap value. Default value is 20- Returns:
Canvas
instance, for chaining setter calls- See Also:
-
getSnapHGap
public int getSnapHGap()The horizontal grid size to use, in pixels, when snap-to-grid is enabled.- Returns:
- Current snapHGap value. Default value is 20
- See Also:
-
setSnapOffsetLeft
IfsnapTo
is defined for this widget, this property can be used to specify an offset in px or percentage for the left coordinate of this widget.For example if
snapTo
is specified as"L"
andsnapOffsetLeft
is set to 6, this widget will be rendered 6px inside the left edge of its parent or master element. Alternatively ifsnapTo
was set to"R"
, asnapOffsetLeft
value of -6 would cause the component to be rendered 6px inside the right edge of its parent ormaster canvas
.
If this method is called after the component has been drawn/initialized: Setter forsnapOffsetLeft
.- Parameters:
snapOffsetLeft
- new snapOffsetLeft value. Default value is null- Returns:
Canvas
instance, for chaining setter calls- See Also:
-
getSnapOffsetLeft
IfsnapTo
is defined for this widget, this property can be used to specify an offset in px or percentage for the left coordinate of this widget.For example if
snapTo
is specified as"L"
andsnapOffsetLeft
is set to 6, this widget will be rendered 6px inside the left edge of its parent or master element. Alternatively ifsnapTo
was set to"R"
, asnapOffsetLeft
value of -6 would cause the component to be rendered 6px inside the right edge of its parent ormaster canvas
.- Returns:
- Current snapOffsetLeft value. Default value is null
- See Also:
-
setSnapOffsetTop
IfsnapTo
is defined for this widget, this property can be used to specify an offset in px or percentage for the top coordinate of this widget.For example if
snapTo
is specified as"T"
andsnapOffsetTop
is set to 6, this widget will be rendered 6px below the top edge of its parent or master element. Alternatively ifsnapTo
was set to"B"
, asnapOffsetTop
value of -6 would cause the component to be rendered 6px inside the bottom edge of its parent ormaster canvas
.
If this method is called after the component has been drawn/initialized: Setter forsnapOffsetTop
.- Parameters:
snapOffsetTop
- new snapOffsetTop value. Default value is null- Returns:
Canvas
instance, for chaining setter calls- See Also:
-
getSnapOffsetTop
IfsnapTo
is defined for this widget, this property can be used to specify an offset in px or percentage for the top coordinate of this widget.For example if
snapTo
is specified as"T"
andsnapOffsetTop
is set to 6, this widget will be rendered 6px below the top edge of its parent or master element. Alternatively ifsnapTo
was set to"B"
, asnapOffsetTop
value of -6 would cause the component to be rendered 6px inside the bottom edge of its parent ormaster canvas
.- Returns:
- Current snapOffsetTop value. Default value is null
- See Also:
-
setSnapOnDrop
When this canvas is dropped onto an object supporting snap-to-grid, should it snap to the grid (true, the default) or just drop wherever the mouse is (false).Note : This is an advanced setting
- Parameters:
snapOnDrop
- New snapOnDrop value. Default value is true- Returns:
Canvas
instance, for chaining setter calls- See Also:
-
setSnapToGrid(java.lang.Boolean)
com.smartgwt.client.widgets.Canvas#shouldSnapOnDrop
SnapGridDragging overview and related methods
-
getSnapOnDrop
When this canvas is dropped onto an object supporting snap-to-grid, should it snap to the grid (true, the default) or just drop wherever the mouse is (false).- Returns:
- Current snapOnDrop value. Default value is true
- See Also:
-
getSnapToGrid()
com.smartgwt.client.widgets.Canvas#shouldSnapOnDrop
SnapGridDragging overview and related methods
-
setSnapResizeToAlign
Flag to disable snapping to alignment when this Canvas is resized.To control snapping to align for the children resized within this Canvas, see
childrenResizeSnapAlign
instead.- Parameters:
snapResizeToAlign
- New snapResizeToAlign value. Default value is null- Returns:
Canvas
instance, for chaining setter calls- See Also:
-
getSnapResizeToAlign
Flag to disable snapping to alignment when this Canvas is resized.To control snapping to align for the children resized within this Canvas, see
childrenResizeSnapAlign
instead.- Returns:
- Current snapResizeToAlign value. Default value is null
- See Also:
-
setSnapResizeToGrid
Causes this canvas to snap to its parent's grid when resizing. Note that this value defaults to the Canvas'ssnapToGrid
value if undefined.- Parameters:
snapResizeToGrid
- New snapResizeToGrid value. Default value is null- Returns:
Canvas
instance, for chaining setter calls- See Also:
-
getSnapResizeToGrid
Causes this canvas to snap to its parent's grid when resizing. Note that this value defaults to the Canvas'ssnapToGrid
value if undefined.- Returns:
- Current snapResizeToGrid value. Default value is null
- See Also:
-
setSnapTo
Position this widget such that it is aligned with ("snapped to") an edge of itsmaster
(if specified), or itsparent canvas
.Note that this property also impacts the sizing of this widget. If this widgets size is specified as a percent value, and has no explicit
percentSource
, sizing will be calculated based on the size of themaster canvas
when snapTo is set.Possible values: BR, BL, TR, TL, R, L, B, T, C where B=Bottom, T=Top, L=Left, R=right and C=center
Standard snapTo behavior will attach the outer edge of the widget to the parent or master element - for example setting
snapTo
to"B"
would align the bottom edge of this component with the bottom edge of the master or parent element (and center this component horizontally over its master or parent element).snapEdge
can be specified to change this behavior allowing the developer to, for example, align the top edge of this component with the bottom edge of itsmaster canvas
.snapOffsetLeft
andsnapOffsetTop
may also be specified to offset the element from exact snapTo alignment.
If this method is called after the component has been drawn/initialized: Set the snapTo property of this canvas, and handle repositioning.- Parameters:
snapTo
- new snapTo value. Default value is null- Returns:
Canvas
instance, for chaining setter calls- See Also:
-
getSnapTo
Position this widget such that it is aligned with ("snapped to") an edge of itsmaster
(if specified), or itsparent canvas
.Note that this property also impacts the sizing of this widget. If this widgets size is specified as a percent value, and has no explicit
percentSource
, sizing will be calculated based on the size of themaster canvas
when snapTo is set.Possible values: BR, BL, TR, TL, R, L, B, T, C where B=Bottom, T=Top, L=Left, R=right and C=center
Standard snapTo behavior will attach the outer edge of the widget to the parent or master element - for example setting
snapTo
to"B"
would align the bottom edge of this component with the bottom edge of the master or parent element (and center this component horizontally over its master or parent element).snapEdge
can be specified to change this behavior allowing the developer to, for example, align the top edge of this component with the bottom edge of itsmaster canvas
.snapOffsetLeft
andsnapOffsetTop
may also be specified to offset the element from exact snapTo alignment.- Returns:
- Return the snapTo value of this object. Default value is null
- See Also:
-
setSnapToAlign
Flag to disable snapping to alignment when this Canvas is dragged whenchildrenSnapAlign
is enabled on this Canvas' parent.To control snapping to align for the children dragged within this Canvas, see
childrenSnapAlign
instead.- Parameters:
snapToAlign
- New snapToAlign value. Default value is null- Returns:
Canvas
instance, for chaining setter calls- See Also:
-
getSnapToAlign
Flag to disable snapping to alignment when this Canvas is dragged whenchildrenSnapAlign
is enabled on this Canvas' parent.To control snapping to align for the children dragged within this Canvas, see
childrenSnapAlign
instead.- Returns:
- Current snapToAlign value. Default value is null
- See Also:
-
setSnapToCenterAlign
Flag to disable snapping to center alignment when this Canvas is dragged whenchildrenSnapAlign
is enabled on this Canvas' parent.- Parameters:
snapToCenterAlign
- New snapToCenterAlign value. Default value is null- Returns:
Canvas
instance, for chaining setter calls- See Also:
-
getSnapToCenterAlign
Flag to disable snapping to center alignment when this Canvas is dragged whenchildrenSnapAlign
is enabled on this Canvas' parent.- Returns:
- Current snapToCenterAlign value. Default value is null
- See Also:
-
setSnapToEdgeAlign
Flag to disable snapping to edge alignment when this Canvas is dragged whenchildrenSnapAlign
is enabled on this Canvas' parent.- Parameters:
snapToEdgeAlign
- New snapToEdgeAlign value. Default value is null- Returns:
Canvas
instance, for chaining setter calls- See Also:
-
getSnapToEdgeAlign
Flag to disable snapping to edge alignment when this Canvas is dragged whenchildrenSnapAlign
is enabled on this Canvas' parent.- Returns:
- Current snapToEdgeAlign value. Default value is null
- See Also:
-
setSnapToGrid
Causes this canvas to snap to its parent's grid when dragging.- Parameters:
snapToGrid
- New snapToGrid value. Default value is null- Returns:
Canvas
instance, for chaining setter calls- See Also:
-
getSnapToGrid
Causes this canvas to snap to its parent's grid when dragging.- Returns:
- Current snapToGrid value. Default value is null
- See Also:
-
setSnapVDirection
The vertical snap direction. Set this value to "before" to snap to the nearest gridpoint above; set it to "after" to snap to the nearest gridpoint below; and set it to "nearest" to snap to the nearest gridpoint in either direction.- Parameters:
snapVDirection
- New snapVDirection value. Default value is "after"- Returns:
Canvas
instance, for chaining setter calls- See Also:
-
getSnapVDirection
The vertical snap direction. Set this value to "before" to snap to the nearest gridpoint above; set it to "after" to snap to the nearest gridpoint below; and set it to "nearest" to snap to the nearest gridpoint in either direction.- Returns:
- Current snapVDirection value. Default value is "after"
- See Also:
-
setSnapVGap
The vertical grid size to use, in pixels, when snap-to-grid is enabled.- Parameters:
snapVGap
- New snapVGap value. Default value is 20- Returns:
Canvas
instance, for chaining setter calls- See Also:
-
getSnapVGap
public int getSnapVGap()The vertical grid size to use, in pixels, when snap-to-grid is enabled.- Returns:
- Current snapVGap value. Default value is 20
- See Also:
-
setStartLine
Whether this canvas should always start a new line when used as a tile in aFlowLayout
. This property is not supported in aTileLayout
withTileLayout.layoutPolicy
: "fit" or if databound (i.e. for aTileGrid
).- Parameters:
startLine
- New startLine value. Default value is false- Returns:
Canvas
instance, for chaining setter calls- See Also:
-
getStartLine
Whether this canvas should always start a new line when used as a tile in aFlowLayout
. This property is not supported in aTileLayout
withTileLayout.layoutPolicy
: "fit" or if databound (i.e. for aTileGrid
).- Returns:
- Current startLine value. Default value is false
- See Also:
-
setStyleName
The CSS class applied to this widget as a whole.
If this method is called after the component has been drawn/initialized: Sets the CSS class for this widget- Overrides:
setStyleName
in classUIObject
- Parameters:
styleName
- new CSS style name. Default value is "normal"- See Also:
-
getStyleName
The CSS class applied to this widget as a whole.- Overrides:
getStyleName
in classUIObject
- Returns:
- Current styleName value. Default value is "normal"
- See Also:
-
setTabIndex
If specified this governs the tabIndex of the widget in the page's tab order. Setting this value to-1
will ensure the canvas does not show up in the page's tab order, though ifcanFocus
is true, the user may still give it keyboard focus by clicking on the widget directly.By default Smart GWT auto-assigns tab-indices, ensuring focusable widgets are reachable by tabbing in an intuitive order based on widget hierarchy and draw order. Specifying an explicit tab index means a widget will not participate in this automatic tab position allocation and is typically not recommended except for very simple cases.
For more information on automatic tab index assignment, including recommended approaches for customizing tab order assignation, see the
TabOrderOverview
. Developers may callclearExplicitTabIndex()
to clear any explicitly assigned tab index, and have the widget participate in automatic tab position allocation.canvas.tabIndex
cannot be set to greater thanTAB_INDEX_FLOOR
- as we reserve the values above this range for auto-assigned tab-indices.
If this method is called after the component has been drawn/initialized: Assign an explicittabIndex
to this widget at runtime.Developers may also call
clearExplicitTabIndex()
to clear any explicitly assigned tab index, and have the widget participate in automatic tab position allocation. For more information seetabIndex
Note : This is an advanced setting
-
getTabIndex
If specified this governs the tabIndex of the widget in the page's tab order. Setting this value to-1
will ensure the canvas does not show up in the page's tab order, though ifcanFocus
is true, the user may still give it keyboard focus by clicking on the widget directly.By default Smart GWT auto-assigns tab-indices, ensuring focusable widgets are reachable by tabbing in an intuitive order based on widget hierarchy and draw order. Specifying an explicit tab index means a widget will not participate in this automatic tab position allocation and is typically not recommended except for very simple cases.
For more information on automatic tab index assignment, including recommended approaches for customizing tab order assignation, see the
TabOrderOverview
. Developers may callclearExplicitTabIndex()
to clear any explicitly assigned tab index, and have the widget participate in automatic tab position allocation.canvas.tabIndex
cannot be set to greater thanTAB_INDEX_FLOOR
- as we reserve the values above this range for auto-assigned tab-indices.- Returns:
- Current tabIndex value. Default value is null
- See Also:
-
setTestDataContext
ADataContext
to be used if nodataContext
is provided (directly or indirectly via a parent). If a DataContext is provided it completely replaces thetestDataContext
.DataSources included in the
testDataContext
are immediately provided torule context
when used if no other component has done so already. These records are found in rule context 'dataContext' section (ex.dataContext.Customer
for a Customer record intestDataContext
) so they do not conflict with normal DataSource records.- Parameters:
testDataContext
- New testDataContext value. Default value is null- Returns:
Canvas
instance, for chaining setter calls- Throws:
IllegalStateException
- this property cannot be changed after the component has been created- See Also:
-
getTestDataContext
ADataContext
to be used if nodataContext
is provided (directly or indirectly via a parent). If a DataContext is provided it completely replaces thetestDataContext
.DataSources included in the
testDataContext
are immediately provided torule context
when used if no other component has done so already. These records are found in rule context 'dataContext' section (ex.dataContext.Customer
for a Customer record intestDataContext
) so they do not conflict with normal DataSource records.- Returns:
- Current testDataContext value. Default value is null
- See Also:
-
setTop
Number of pixels the top of the widget is offset down from its default drawing context (either its parent's top-left corner, or the document flow, depending on the value of theposition
property).Can also be set as a percentage, specified as a String ending in '%', eg, "50%". In this case the top coordinate is considered as a percentage of the specified height of the
parent
.
If this method is called after the component has been drawn/initialized: Set the top coordinate of this object, relative to its enclosing context, in pixels.NOTE: if you're setting multiple coordinates, use setRect() or moveTo() instead
- Parameters:
top
- new top coordinate. Default value is 0- Returns:
Canvas
instance, for chaining setter calls- See Also:
-
getTop
public int getTop()Number of pixels the top of the widget is offset down from its default drawing context (either its parent's top-left corner, or the document flow, depending on the value of theposition
property).Can also be set as a percentage, specified as a String ending in '%', eg, "50%". In this case the top coordinate is considered as a percentage of the specified height of the
parent
.- Returns:
- Return the top coordinate of this object, relative to its enclosing context, in pixels. Default value is 0
- See Also:
-
setTop
Number of pixels the top of the widget is offset down from its default drawing context (either its parent's top-left corner, or the document flow, depending on the value of theposition
property).Can also be set as a percentage, specified as a String ending in '%', eg, "50%". In this case the top coordinate is considered as a percentage of the specified height of the
parent
.
If this method is called after the component has been drawn/initialized: Set the top coordinate of this object, relative to its enclosing context, in pixels.NOTE: if you're setting multiple coordinates, use setRect() or moveTo() instead
- Parameters:
top
- new top coordinate. Default value is 0- Returns:
Canvas
instance, for chaining setter calls- See Also:
-
getTopElement
The top-most Canvas (i.e., not a child of any other Canvas), if any, in this widget's containment hierarchy.Note : This method should be called only after the widget has been rendered.
- Returns:
- Current topElement value. Default value is null
- Throws:
IllegalStateException
- if this widget has not yet been rendered.- See Also:
-
setUpdateTabPositionOnDraw
Should canvases with noparent canvas
be moved to the end of the TabIndexManager tree on draw()?If set to false, the tab-position will not be modified on draw.
This property is useful for cases where the tab position of a widget will be managed by some explicit tabIndex management code.
Note : This is an advanced setting
- Parameters:
updateTabPositionOnDraw
- New updateTabPositionOnDraw value. Default value is true- Returns:
Canvas
instance, for chaining setter calls
-
getUpdateTabPositionOnDraw
public boolean getUpdateTabPositionOnDraw()Should canvases with noparent canvas
be moved to the end of the TabIndexManager tree on draw()?If set to false, the tab-position will not be modified on draw.
This property is useful for cases where the tab position of a widget will be managed by some explicit tabIndex management code.
- Returns:
- Current updateTabPositionOnDraw value. Default value is true
-
setUpdateTabPositionOnReparent
Should canvases with aparent canvas
be added to the TabIndexManager under the parent as described inupdateChildTabPositions()
andupdateChildTabPosition()
?If set to false, the tab-position will not be modified on parent change.
This property is useful for cases where the tab position of a widget will be managed by something other than the parent canvas, for example for
canvasItem canvases
.
If this method is called after the component has been drawn/initialized: Setter for theupdateTabPositionOnReparent
attribute.Note : This is an advanced setting
- Parameters:
updateTabPositionOnReparent
- new value for canvas.updateTabPositionOnReparent. Default value is true- Returns:
Canvas
instance, for chaining setter calls
-
getUpdateTabPositionOnReparent
public boolean getUpdateTabPositionOnReparent()Should canvases with aparent canvas
be added to the TabIndexManager under the parent as described inupdateChildTabPositions()
andupdateChildTabPosition()
?If set to false, the tab-position will not be modified on parent change.
This property is useful for cases where the tab position of a widget will be managed by something other than the parent canvas, for example for
canvasItem canvases
.- Returns:
- Current updateTabPositionOnReparent value. Default value is true
-
setUseBackMask
In earlier versions of Internet Explorer (pre IE9), a native limitation exists whereby if HTML elements are overlapping on the page, certain elements can appear to "burn through" elements in the same position with a higher z-index. Specific cases in which this have been observed include Applets, <IFRAME> elements, and for older versions of IE, native <SELECT> items.The backMask is a workaround for this issue. If
useBackMask
is set totrue
, the component will render an empty <IFRAME> element behind the canvas, which prevents this effect in all known cases.Has no effect in other browsers.
Note : This is an advanced setting
- Parameters:
useBackMask
- New useBackMask value. Default value is false- Returns:
Canvas
instance, for chaining setter calls
-
getUseBackMask
In earlier versions of Internet Explorer (pre IE9), a native limitation exists whereby if HTML elements are overlapping on the page, certain elements can appear to "burn through" elements in the same position with a higher z-index. Specific cases in which this have been observed include Applets, <IFRAME> elements, and for older versions of IE, native <SELECT> items.The backMask is a workaround for this issue. If
useBackMask
is set totrue
, the component will render an empty <IFRAME> element behind the canvas, which prevents this effect in all known cases.Has no effect in other browsers.
- Returns:
- Current useBackMask value. Default value is false
-
setUseCSSShadow
IfshowShadow
is true, should we use the cssbox-shadow
property (where supported) to achieve the shadow?Set this property to false to switch to a media-based approach, achieved by rendering the
shadowImage
in an automatically generated peer. This approach is also used regardless of this property value in older browsers where the cssbox-shadow
property isn't supported.See also
shadowColor
,shadowDepth
,shadowOffset
,shadowSoftness
andshadowSpread
Note : This is an advanced setting
- Parameters:
useCSSShadow
- New useCSSShadow value. Default value is true- Returns:
Canvas
instance, for chaining setter calls- Throws:
IllegalStateException
- this property cannot be changed after the component has been created
-
getUseCSSShadow
public boolean getUseCSSShadow()IfshowShadow
is true, should we use the cssbox-shadow
property (where supported) to achieve the shadow?Set this property to false to switch to a media-based approach, achieved by rendering the
shadowImage
in an automatically generated peer. This approach is also used regardless of this property value in older browsers where the cssbox-shadow
property isn't supported.See also
shadowColor
,shadowDepth
,shadowOffset
,shadowSoftness
andshadowSpread
- Returns:
- Current useCSSShadow value. Default value is true
-
setUseDragMask
This flag controls whether we register the component as a maskable item with the EventHandler. If enabled, a backmask will be automatically created for the dragMoveTarget on the fly to avoid burnthrough e.g. by plugins or frames.Note that this property will be defaulted to false unless the canvas contains an IFrame, in which case it will be defaulted to true.
The
dragMaskType
property controls what kind of mask is used in case useDragMask is enabled.- Parameters:
useDragMask
- New useDragMask value. Default value is false- Returns:
Canvas
instance, for chaining setter calls- See Also:
-
getUseDragMask
public boolean getUseDragMask()This flag controls whether we register the component as a maskable item with the EventHandler. If enabled, a backmask will be automatically created for the dragMoveTarget on the fly to avoid burnthrough e.g. by plugins or frames.Note that this property will be defaulted to false unless the canvas contains an IFrame, in which case it will be defaulted to true.
The
dragMaskType
property controls what kind of mask is used in case useDragMask is enabled.- Returns:
- Current useDragMask value. Default value is false
- See Also:
-
setUseImageForSVG
If set, forces the main SVG image or icon in the canvas to be rendered in an image tag rather than an object tag, the default. Typical use cases might be configuring the image of anImg
orImgButton
, or the icon of aButton
.Rendering via object tag provides the maximum support for CSS in SVG, but may result in a flicker at the browser level when changing images - either manually such as with
setImage()
or via state change from rollover, mouseDown, etc. Using image tags to inline the images breaks CSS support but may avoid flickering.If this property is not set, then you can also control whether an SVG image is rendered in an object or image tag by setting the query param "tag" on the image URL - see
SCImgURL
for details.Note that if multiple icons are potentially present in a canvas (e.g.
removeIcons
in the cells of a grid body), then setting this property on the widget instance may have no effect. In such case, theCanvas
prototype is consulted.Note : This is an advanced setting
- Parameters:
useImageForSVG
- New useImageForSVG value. Default value is false- Returns:
Canvas
instance, for chaining setter calls- Throws:
IllegalStateException
- this property cannot be changed after the component has been created- See Also:
-
getUseImageForSVG
public boolean getUseImageForSVG()If set, forces the main SVG image or icon in the canvas to be rendered in an image tag rather than an object tag, the default. Typical use cases might be configuring the image of anImg
orImgButton
, or the icon of aButton
.Rendering via object tag provides the maximum support for CSS in SVG, but may result in a flicker at the browser level when changing images - either manually such as with
setImage()
or via state change from rollover, mouseDown, etc. Using image tags to inline the images breaks CSS support but may avoid flickering.If this property is not set, then you can also control whether an SVG image is rendered in an object or image tag by setting the query param "tag" on the image URL - see
SCImgURL
for details.Note that if multiple icons are potentially present in a canvas (e.g.
removeIcons
in the cells of a grid body), then setting this property on the widget instance may have no effect. In such case, theCanvas
prototype is consulted.- Returns:
- Current useImageForSVG value. Default value is false
- See Also:
-
setUseNativeDrag
If set, native HTML5 drag and drop will be used for all drags initiated on this widget (on browsers where this is supported), and native HTML5 drop events occurring over this widget will be processed.When using native HTML5 drags, the same series of events fires as for a normal drag (
Canvas.dragStart()
,Canvas.dropMove()
, etc.), and thedragType
/dropTypes
system works.dragAppearance
is not supported; however, basic customization of the browser's tracker image is supported in certain browsers via theEventHandler.setDragTrackerImage()
API.The primary difference with a native drag is that it can be cross-frame; that is, the user can drag out of the current browser window and drop into a different window or tab.
To provide information that will be available to a foreign frame, use
EventHandler.setNativeDragData()
. This API must be called when theCanvas.dragStart()
event fires, and will not work if called at any other time.However, due to browser bugs and/or browser-imposed limitations, the information provided to
setNativeDragData
cannot be accessed in the foreign frame until the actual drop occurs (mouse button released). This means drop eligibility cannot be determined dynamically based on the dragged data; instead, eligibility can only be determined based on thedragType
/dropTypes
system. For this reason, adragType
must be set on the source of a drag.NOTE: Although Internet Explorer 10+ supports a subset of the HTML5 drag and drop standard, native drag and drop is disabled in IE (and Microsoft Edge Legacy) because cross-window drags—the primary purpose of this API—are not possible.
- Parameters:
useNativeDrag
- New useNativeDrag value. Default value is null- Returns:
Canvas
instance, for chaining setter calls- Throws:
IllegalStateException
- this property cannot be changed after the component has been created- See Also:
-
getUseNativeDrag
If set, native HTML5 drag and drop will be used for all drags initiated on this widget (on browsers where this is supported), and native HTML5 drop events occurring over this widget will be processed.When using native HTML5 drags, the same series of events fires as for a normal drag (
Canvas.dragStart()
,Canvas.dropMove()
, etc.), and thedragType
/dropTypes
system works.dragAppearance
is not supported; however, basic customization of the browser's tracker image is supported in certain browsers via theEventHandler.setDragTrackerImage()
API.The primary difference with a native drag is that it can be cross-frame; that is, the user can drag out of the current browser window and drop into a different window or tab.
To provide information that will be available to a foreign frame, use
EventHandler.setNativeDragData()
. This API must be called when theCanvas.dragStart()
event fires, and will not work if called at any other time.However, due to browser bugs and/or browser-imposed limitations, the information provided to
setNativeDragData
cannot be accessed in the foreign frame until the actual drop occurs (mouse button released). This means drop eligibility cannot be determined dynamically based on the dragged data; instead, eligibility can only be determined based on thedragType
/dropTypes
system. For this reason, adragType
must be set on the source of a drag.NOTE: Although Internet Explorer 10+ supports a subset of the HTML5 drag and drop standard, native drag and drop is disabled in IE (and Microsoft Edge Legacy) because cross-window drags—the primary purpose of this API—are not possible.
- Returns:
- Current useNativeDrag value. Default value is null
- See Also:
-
setUseOpacityFilter
Configures where the Opacity filter is used for IE6-8.With the default of null, opacity filters are used unless
neverUseFilters
has been set. When set explicitly to true, opacity filters are used even ifneverUseFilters
is true.See
IEFilters
for background.- Parameters:
useOpacityFilter
- New useOpacityFilter value. Default value is null- Returns:
Canvas
instance, for chaining setter calls- Throws:
IllegalStateException
- this property cannot be changed after the component has been created- See Also:
-
getUseOpacityFilter
Configures where the Opacity filter is used for IE6-8.With the default of null, opacity filters are used unless
neverUseFilters
has been set. When set explicitly to true, opacity filters are used even ifneverUseFilters
is true.See
IEFilters
for background.- Returns:
- Current useOpacityFilter value. Default value is null
- See Also:
-
setUseTouchScrolling
Ontouch devices
, if thisCanvas
can be scrolled, should touch-dragging the content area result in scrolling? Set tofalse
if touch-dragging should not cause scrolling. Note that setting tofalse
enables the use ofcustom scrollbars
on touch devices.useTouchScrolling
can default tofalse
ifdisableTouchScrollingForDrag
istrue
and various built-in drag operations are enabled that normally interfere with touch scrolling (e.g.ListGrid.canDragSelect
andListGrid.canReorderRecords
).When touch scrolling is disabled, it can be difficult to interact with parts of the custom scrollbars at their default size of 16 pixels. In touch browsers, any touch 8px before the thumb of a
custom scrollbar
will be mapped to the thumb, but the other parts of the scrollbar do not have a similar tolerance applied. The width of the custom scrollbars can be increased by setting thescrollbarSize
to a larger value, but note that whenspriting is enabled
, changing thescrollbarSize
may cause tiling of certain images and backgrounds that make up the custom scrollbar. This can be fixed for a component by creating it withscrollbarConstructor
set to "Scrollbar"—a basic scrollbar class that does not employ spriting.Note : This is an advanced setting
- Parameters:
useTouchScrolling
- New useTouchScrolling value. Default value is null- Returns:
Canvas
instance, for chaining setter calls- Throws:
IllegalStateException
- this property cannot be changed after the component has been created- See Also:
-
getUseTouchScrolling
Ontouch devices
, if thisCanvas
can be scrolled, should touch-dragging the content area result in scrolling? Set tofalse
if touch-dragging should not cause scrolling. Note that setting tofalse
enables the use ofcustom scrollbars
on touch devices.useTouchScrolling
can default tofalse
ifdisableTouchScrollingForDrag
istrue
and various built-in drag operations are enabled that normally interfere with touch scrolling (e.g.ListGrid.canDragSelect
andListGrid.canReorderRecords
).When touch scrolling is disabled, it can be difficult to interact with parts of the custom scrollbars at their default size of 16 pixels. In touch browsers, any touch 8px before the thumb of a
custom scrollbar
will be mapped to the thumb, but the other parts of the scrollbar do not have a similar tolerance applied. The width of the custom scrollbars can be increased by setting thescrollbarSize
to a larger value, but note that whenspriting is enabled
, changing thescrollbarSize
may cause tiling of certain images and backgrounds that make up the custom scrollbar. This can be fixed for a component by creating it withscrollbarConstructor
set to "Scrollbar"—a basic scrollbar class that does not employ spriting.- Returns:
- Current useTouchScrolling value. Default value is null
- See Also:
-
setValuesManager
ValuesManager
for managing values displayed in this component. If specified at initialization time, this component will be added to the valuesManager viaValuesManager.addMember()
.ValuesManagers allow different fields of a single object to be displayed or edited across multiple UI components. Given a single values object, a valuesManager will handle determining the appropriate field values for its member components and displaying them / responding to edits if the components support this.
Data may be derived simply from the specified fieldNames within the member components, or for complex nested data structures can be specified by both component and field-level
DataPath
.Note that components may be automatically bound to an existing valuesManager attached to a parent component if dataPath is specified. See
dataPath
for more information. Also note that if a databound component has a specified dataSource and dataPath but no specified valuesManager object one will be automatically generated as part of the databinding process
If this method is called after the component has been drawn/initialized: Setter for thevaluesManager
attribute. This method may be called directly at runtime to set the ValuesManager for a component; it has the same effect as callingValuesManager.addMember()
, passing in this DataBoundComponent.Note : This is an advanced setting
- Parameters:
valuesManager
- new dataPath. Default value is null- Returns:
Canvas
instance, for chaining setter calls
-
getValuesManager
ValuesManager
for managing values displayed in this component. If specified at initialization time, this component will be added to the valuesManager viaValuesManager.addMember()
.ValuesManagers allow different fields of a single object to be displayed or edited across multiple UI components. Given a single values object, a valuesManager will handle determining the appropriate field values for its member components and displaying them / responding to edits if the components support this.
Data may be derived simply from the specified fieldNames within the member components, or for complex nested data structures can be specified by both component and field-level
DataPath
.Note that components may be automatically bound to an existing valuesManager attached to a parent component if dataPath is specified. See
dataPath
for more information. Also note that if a databound component has a specified dataSource and dataPath but no specified valuesManager object one will be automatically generated as part of the databinding process- Returns:
- Current valuesManager value. Default value is null
-
setValuesManager
ValuesManager
for managing values displayed in this component. If specified at initialization time, this component will be added to the valuesManager viaValuesManager.addMember()
.ValuesManagers allow different fields of a single object to be displayed or edited across multiple UI components. Given a single values object, a valuesManager will handle determining the appropriate field values for its member components and displaying them / responding to edits if the components support this.
Data may be derived simply from the specified fieldNames within the member components, or for complex nested data structures can be specified by both component and field-level
DataPath
.Note that components may be automatically bound to an existing valuesManager attached to a parent component if dataPath is specified. See
dataPath
for more information. Also note that if a databound component has a specified dataSource and dataPath but no specified valuesManager object one will be automatically generated as part of the databinding process
If this method is called after the component has been drawn/initialized: Setter for thevaluesManager
attribute. This method may be called directly at runtime to set the ValuesManager for a component; it has the same effect as callingValuesManager.addMember()
, passing in this DataBoundComponent.Note : This is an advanced setting
-
getValuesManagerAsString
ValuesManager
for managing values displayed in this component. If specified at initialization time, this component will be added to the valuesManager viaValuesManager.addMember()
.ValuesManagers allow different fields of a single object to be displayed or edited across multiple UI components. Given a single values object, a valuesManager will handle determining the appropriate field values for its member components and displaying them / responding to edits if the components support this.
Data may be derived simply from the specified fieldNames within the member components, or for complex nested data structures can be specified by both component and field-level
DataPath
.Note that components may be automatically bound to an existing valuesManager attached to a parent component if dataPath is specified. See
dataPath
for more information. Also note that if a databound component has a specified dataSource and dataPath but no specified valuesManager object one will be automatically generated as part of the databinding process- Returns:
- Current valuesManager value. Default value is null
- See Also:
-
setVisibility
Controls widget visibility when the widget is initialized. SeeVisibility
type for details.Specifying "visible" sets the CSS visiblity to "visible", forcing a child to be visible even if the parent is hidden. Not supported for use with Smart GWT layouts, scrolling or auto-sizing but may be useful when working with third-party or legacy DOM layout systems.
Note that if
hideUsingDisplayNone
is set for a hidden ancestor, settingvisibility
will have no effect at all until that ancestor becomes visible.
If this method is called after the component has been drawn/initialized: Sets this widget's visibility to "inherit", so that it becomes visible if all of its parents are visible or it has no parents.If the widget has not yet been drawn (and doesn't have a parent or master), this method calls the draw method as well.
- Parameters:
visibility
- New visibility value. Default value is Canvas.INHERIT- Returns:
Canvas
instance, for chaining setter calls- See Also:
-
getVisibility
Controls widget visibility when the widget is initialized. SeeVisibility
type for details.Specifying "visible" sets the CSS visiblity to "visible", forcing a child to be visible even if the parent is hidden. Not supported for use with Smart GWT layouts, scrolling or auto-sizing but may be useful when working with third-party or legacy DOM layout systems.
Note that if
hideUsingDisplayNone
is set for a hidden ancestor, settingvisibility
will have no effect at all until that ancestor becomes visible.- Returns:
- Returns true if the widget is visible, taking all parents into account, so that a widget which is not hidden might still
report itself as not visible if it is within a hidden parent.
NOTE: Undrawn widgets will report themselves as visible if they would be visible if drawn. Default value is Canvas.INHERIT
- See Also:
-
setVisibleWhen
Criteria to be evaluated to determine whether this Canvas should be visible. Re-evaluated whenever data in theruleScope
changes.A basic criteria uses textMatchStyle:"exact". When specified in
Component XML
this property allowsshorthand formats
for defining criteria.- Parameters:
visibleWhen
- New visibleWhen value. Default value is null- Returns:
Canvas
instance, for chaining setter calls- Throws:
IllegalStateException
- this property cannot be changed after the component has been created- See Also:
-
getVisibleWhen
Criteria to be evaluated to determine whether this Canvas should be visible. Re-evaluated whenever data in theruleScope
changes.A basic criteria uses textMatchStyle:"exact". When specified in
Component XML
this property allowsshorthand formats
for defining criteria.- Returns:
- Current visibleWhen value. Default value is null
- See Also:
-
setWidth
Thecanvas.width
attribute specifies the size for a component's horizontal dimension;canvas.height
specifies the size for the vertical dimension.May be set to an integer value (a number of pixels), a percentage value like "50%", or "*".
See
PercentSizing
for details on how percentage or"*"
values are resolved actual size.If
overflow
is set to "visible", the specified size acts as a minimum, and the component may overflow to show all content and/or children.Note that developers wishing to set a default width or height for a component class should set
defaultWidth
ordefaultHeight
instead of specifying an explicit defaultwidth
orheight
. This is important for components added to aLayout
as members - it allows the Layout to determine whether the canvas has an explicitly specified size that must be respected, or whether it can participate in itssizing policies
.
If this method is called after the component has been drawn/initialized: Resizes the widget horizontally to the specified width (moves the right side of the widget). The width parameter can be expressed as a percentage of viewport size or as the number of pixels.NOTE: if you're setting multiple coordinates, use resizeTo() or setRect() instead
- Parameters:
width
- new width. Default value is null- Returns:
Canvas
instance, for chaining setter calls- See Also:
-
getWidth
Thecanvas.width
attribute specifies the size for a component's horizontal dimension;canvas.height
specifies the size for the vertical dimension.May be set to an integer value (a number of pixels), a percentage value like "50%", or "*".
See
PercentSizing
for details on how percentage or"*"
values are resolved actual size.If
overflow
is set to "visible", the specified size acts as a minimum, and the component may overflow to show all content and/or children.Note that developers wishing to set a default width or height for a component class should set
defaultWidth
ordefaultHeight
instead of specifying an explicit defaultwidth
orheight
. This is important for components added to aLayout
as members - it allows the Layout to determine whether the canvas has an explicitly specified size that must be respected, or whether it can participate in itssizing policies
.- Returns:
- Return the width of this object, in pixels.
See
GettingCanvasSize
. Default value is null - See Also:
-
setWidth
Thecanvas.width
attribute specifies the size for a component's horizontal dimension;canvas.height
specifies the size for the vertical dimension.May be set to an integer value (a number of pixels), a percentage value like "50%", or "*".
See
PercentSizing
for details on how percentage or"*"
values are resolved actual size.If
overflow
is set to "visible", the specified size acts as a minimum, and the component may overflow to show all content and/or children.Note that developers wishing to set a default width or height for a component class should set
defaultWidth
ordefaultHeight
instead of specifying an explicit defaultwidth
orheight
. This is important for components added to aLayout
as members - it allows the Layout to determine whether the canvas has an explicitly specified size that must be respected, or whether it can participate in itssizing policies
.
If this method is called after the component has been drawn/initialized: Resizes the widget horizontally to the specified width (moves the right side of the widget). The width parameter can be expressed as a percentage of viewport size or as the number of pixels.NOTE: if you're setting multiple coordinates, use resizeTo() or setRect() instead
-
setWorkflows
List of screen-globalworkflows
that can be shared by event handler workflows using aStartProcessTask
. Each workflow must be assigned anID
for lookup.- Parameters:
workflows
- New workflows value. Default value is null- Returns:
Canvas
instance, for chaining setter calls- Throws:
IllegalStateException
- this property cannot be changed after the component has been created
-
getWorkflows
List of screen-globalworkflows
that can be shared by event handler workflows using aStartProcessTask
. Each workflow must be assigned anID
for lookup.- Returns:
- Current workflows value. Default value is null
-
addChild
Adds newChild as a child of this widget, set up a named object reference (i.e., this[name]) to the new widget if name argument is provided, and draw the child if this widget has been drawn already.If newChild has a parent it will be removed from it. If it has a master, it will be detached from it if the master is a child of a different parent. If newChild has peers, they'll be added to this widget as children as well.
- Parameters:
newChild
- new child canvas to add- Returns:
- the new child, or null if it couldn't be added
- See Also:
-
addChild
-
addChild
Adds newChild as a child of this widget, set up a named object reference (i.e., this[name]) to the new widget if name argument is provided, and draw the child if this widget has been drawn already.If newChild has a parent it will be removed from it. If it has a master, it will be detached from it if the master is a child of a different parent. If newChild has peers, they'll be added to this widget as children as well.
- Parameters:
newChild
- new child canvas to addname
- name to assign to child (eg: this[name] == child)autoDraw
- if false, child will not automatically be drawn (only for advanced use)- Returns:
- the new child, or null if it couldn't be added
- See Also:
-
addPeer
Adds newPeer as a peer of this widget (also making it a child of this widget's parent, if any), set up a named object reference (i.e., this[name]) to the new widget if name is provided, and draw the peer if this widget has been drawn already.
The widget to be added as a peer will be removed from its old master and/or parent, if any, and it will be added as a child to the parent of this canvas (if any)
- Parameters:
newPeer
- new peer widget to add- Returns:
- the new peer, or null if it couldn't be added
- See Also:
-
addPeer
-
addPeer
-
addPeer
Adds newPeer as a peer of this widget (also making it a child of this widget's parent, if any), set up a named object reference (i.e., this[name]) to the new widget if name is provided, and draw the peer if this widget has been drawn already.
The widget to be added as a peer will be removed from its old master and/or parent, if any, and it will be added as a child to the parent of this canvas (if any)
- Parameters:
newPeer
- new peer widget to addname
- name to assign to peer (eg: this[peer] == child)autoDraw
- if false, peer will not automatically be drawn (only for advanced use)preDraw
- if true, when draw is called on the master widget, the peer will be drawn before the master- Returns:
- the new peer, or null if it couldn't be added
- See Also:
-
addSnapAlignCandidate
Add a candidate tosnapAlignCandidates
. Duplicates are automatically avoided.- Parameters:
newCandidate
-
-
adjustForContent
public void adjustForContent(boolean immediate) This method tells a component to adjust for changes in the size of its content that happen outside of Smart GWT APIs. This may include:- size changes due to "replaced" HTML elements (elements that may change size after their
content loads, such as <img> tags with no sizes). To avoid the need to call
adjustForContent()
, specify sizes on replaced elements wherever possible. - modification of HTML
contained in a Canvas by direct manipulation of the DOM - see the
DOM-level Integration overview
. Note that only contents supplied to a widget viacontents
or via an override ofgetInnerHTML()
should be manipulated directly. Contents automatically generated by Smart GWT components (such as the basic structure of a Button) should never be manipulated: these structures are considered internal, differ by platform, and will change without notice.
- Parameters:
immediate
- By default the adjustment will occur on a small delay for performance reasons. Pass in this parameter to force immediate adjustment.- See Also:
- size changes due to "replaced" HTML elements (elements that may change size after their
content loads, such as <img> tags with no sizes). To avoid the need to call
-
animateFade
Animate a change in opacity from the widget's current opacity to the specified opacity.- Parameters:
opacity
- desired final opacity- See Also:
-
animateFade
- See Also:
-
animateFade
- See Also:
-
animateFade
public void animateFade(Integer opacity, AnimationCallback callback, Integer duration, AnimationAcceleration acceleration) Animate a change in opacity from the widget's current opacity to the specified opacity.- Parameters:
opacity
- desired final opacitycallback
- When the fade completes this callback will be fired. Single 'earlyFinish' parameter will be passed if the animation was cut short, for example by a call to the non-animated APIsetOpacity()
.duration
- Duration in ms of the animated fadeacceleration
- Optional animation acceleration to bias the ratios- See Also:
-
animateMove
Animate a reposition of this canvas from its current position to the specified position- Parameters:
left
- new left position (or null for unchanged)top
- new top position (or null for unchanged)- See Also:
-
animateMove
-
animateMove
-
animateMove
public void animateMove(Integer left, Integer top, AnimationCallback callback, Integer duration, AnimationAcceleration acceleration) Animate a reposition of this canvas from its current position to the specified position- Parameters:
left
- new left position (or null for unchanged)top
- new top position (or null for unchanged)callback
- When the move completes this callback will be fired. Single 'earlyFinish' parameter will be passed if the animation was cut short, for example by a call to the non-animated APIsmoveTo()
ormoveBy()
.duration
- Duration in ms of the animated moveacceleration
- Optional acceleration effect to bias the ratios- See Also:
-
animateRect
Animate a reposition / resize of this canvas from its current size and position.- Parameters:
left
- new left position (or null for unchanged)top
- new top position (or null for unchanged)width
- new width (or null for unchanged)height
- new height (or null for unchanged)- See Also:
-
animateRect
public void animateRect(Integer left, Integer top, Integer width, Integer height, AnimationCallback callback) -
animateRect
-
animateRect
public void animateRect(Integer left, Integer top, Integer width, Integer height, AnimationCallback callback, Integer duration, AnimationAcceleration acceleration) Animate a reposition / resize of this canvas from its current size and position.- Parameters:
left
- new left position (or null for unchanged)top
- new top position (or null for unchanged)width
- new width (or null for unchanged)height
- new height (or null for unchanged)callback
- When the setRect completes this callback will be fired. Single 'earlyFinish' parameter will be passed if the animation was cut short, for example by a call to the non-animated APIsetRect()
.duration
- Duration in ms of the animated setRectacceleration
- Optional acceleration effect to apply to the animation- See Also:
-
animateResize
Animate a resize of this canvas from its current size to the specified sizeNote that
animateResizeLayoutMode
allows you to control whether child layout is rerun during every step of the animation, or just at the end, since the former may incur significant overhead depending on the widget hierarchy.- Parameters:
width
- new width (or null for unchanged)height
- new height (or null for unchanged)- See Also:
-
animateResize
-
animateResize
public void animateResize(Integer width, Integer height, AnimationCallback callback, Integer duration) -
animateResize
public void animateResize(Integer width, Integer height, AnimationCallback callback, Integer duration, AnimationAcceleration acceleration) Animate a resize of this canvas from its current size to the specified sizeNote that
animateResizeLayoutMode
allows you to control whether child layout is rerun during every step of the animation, or just at the end, since the former may incur significant overhead depending on the widget hierarchy.- Parameters:
width
- new width (or null for unchanged)height
- new height (or null for unchanged)callback
- When the resize completes this callback will be fired. Single 'earlyFinish' parameter will be passed if the animation was cut short, for example by a call to the non-animated APIsresizeTo()
orresizeBy()
.duration
- Duration in ms of the animated resizeacceleration
- Optional acceleration effect to apply to the resize- See Also:
-
animateScroll
Animate a scroll from the current scroll position to the specified position.- Parameters:
scrollLeft
- desired final left scroll positionscrollTop
- desired final top scroll position
-
animateScroll
-
animateScroll
public void animateScroll(Integer scrollLeft, Integer scrollTop, AnimationCallback callback, Integer duration) -
animateScroll
public void animateScroll(Integer scrollLeft, Integer scrollTop, AnimationCallback callback, Integer duration, AnimationAcceleration acceleration) Animate a scroll from the current scroll position to the specified position.- Parameters:
scrollLeft
- desired final left scroll positionscrollTop
- desired final top scroll positioncallback
- When the scroll completes this callback will be fired. Single 'earlyFinish' parameter will be passed if the animation was cut short, for example by a call to the non-animated APIsscrollTo()
orscrollBy()
.duration
- Duration in ms of the animated scrollacceleration
- Optional acceleration to bias the animation ratios
-
blur
public void blur()If this canvas has keyboard focus, blur it. After this method, the canvas will no longer appear focused and will stop receiving keyboard events.- See Also:
-
bringToFront
public void bringToFront()Puts this widget at the top of the stacking order, so it appears in front of all other widgets in the same parent. -
clear
public void clear()Remove all visual representation of a Canvas, including all child or member Canvases, or managed top-level components such as the ListGrid drop location indicator.This is more expensive than hide(), because in order to become visible again, the Canvas must be draw()n again. Generally, application code has no reason to call clear() unless it is attempting to do advanced memory management. If you want to temporarily hide a Canvas, use hide() and show(), and if you want to permanently destroy a Canvas, use
destroy()
.You would only use clear() if you were managing a very large pool of components and you wanted to reclaim some of the memory used by components that had not been used in a while, while still being able to just draw() them to make them active and visible again.
Note: a clear() will happen as part of moving a Canvas to a different parent. See
addChild()
. -
clearExplicitTabIndex
public void clearExplicitTabIndex()If an explicittabIndex
was assigned to this widget, clear it. This will enable automatic tab index managment behaviors via theTabIndexManager
class as described in theTabOrderOverview
-
addClickHandler
Add a click handler.Executed when the left mouse is clicked (pressed and then released) on this widget. No default implementation.
- Specified by:
addClickHandler
in interfaceHasClickHandlers
- Parameters:
handler
- the click handler- Returns:
HandlerRegistration
used to remove this handler
-
clickMaskUp
Determines whether a clickmask is showing- Returns:
- whether or not a clickmask is showing
- See Also:
-
clickMaskUp
Determines whether a clickmask is showing- Parameters:
ID
- optional ID of specific clickMask to check. If not passed, checks for the click mask associated with this widget only.- Returns:
- whether or not a clickmask is showing
- See Also:
-
contains
Returns true if element is a descendant of this widget (i.e., exists below this widget in the containment hierarchy); and false otherwise.- Parameters:
canvas
- the canvas to be tested- Returns:
- true if specified element is a descendant of this canvas; false otherwise
- See Also:
-
contains
Returns true if element is a descendant of this widget (i.e., exists below this widget in the containment hierarchy); and false otherwise.- Parameters:
canvas
- the canvas to be testedtestSelf
- If passed this method will return true if the canvas parameter is a pointer to this widget.- Returns:
- true if specified element is a descendant of this canvas; false otherwise
- See Also:
-
containsEvent
Return true if the last event's mouse coordinates are within the bounds of this component.NOTE: Z-ordering is not considered for the purposes of this test. If the coordinate you're testing is occluded by other component, but the X,Y coordinates are still within the bounds that component, this method will return true.
See the related
containsEventTarget()
method for checking whether a canvas contains the target canvas for the current mouse event.- Returns:
- true if the event occurred within the bounds of this component
- See Also:
-
containsEventTarget
Returns true if the currentmouse event target
is this component or a descendent of this component.Note that, unlike
containsEvent()
, this method is not based on reported event coordinates and there are cases wherecontainsEvent()
andcontainsEventTarget()
will return different values, including when the mouse is within the bounds of a target component, but another canvas is rendered in front of it in the page's z-order.- Returns:
- true if the event occurred over this canvas or a descendant of this canvas
-
containsFocus
Returns true if the keyboard focus is in this Canvas or any child of this Canvas.- Returns:
- whether this Canvas contains the keyboard focus
- See Also:
-
containsPoint
Return whether or not this object contains the specified global (x,y) coordinates.Will return false if any parent canvas does not contain the specified point, (EG: you're hovering over an element's absolute location, but it is scrolled out of view in a parent element)
- Parameters:
x
- GLOBAL x-coordinatey
- GLOBAL y-coordinate- Returns:
- true if this object contains the specified point; false otherwise
- See Also:
-
containsPoint
Return whether or not this object contains the specified global (x,y) coordinates.Will return false if any parent canvas does not contain the specified point, (EG: you're hovering over an element's absolute location, but it is scrolled out of view in a parent element)
- Parameters:
x
- GLOBAL x-coordinatey
- GLOBAL y-coordinatewithinViewport
- point lies specifically within our viewport (drawn area excluding margins and scrollbars if present)- Returns:
- true if this object contains the specified point; false otherwise
- See Also:
-
dataContextChanged
public void dataContextChanged()Notification method fired whenDataContext
is bound. This can occur on the initial draw or by an explicit call tosetDataContext()
.This feature allows the use of the
dataContext
as a general-purpose API to the screen. For example, if you wanted your screen to support dynamically showing or hiding parts of itself based on a button that is external to the screen, you could do that by implementing this handler to show/hide that part of the screen based on the current state of thedataContext
. -
deparent
public void deparent()Remove this canvas from its parent if it has one.- See Also:
-
depeer
public void depeer()Make this Canvas no longer a peer of its master- See Also:
-
disable
public void disable()Disables this widget and any children and peers of this widget.- See Also:
-
addDoubleClickHandler
Add a doubleClick handler.Executed when the left mouse button is clicked twice in rapid succession (within
Canvas.doubleClickDelay
by default) in this object.- Specified by:
addDoubleClickHandler
in interfaceHasDoubleClickHandlers
- Parameters:
handler
- the doubleClick handler- Returns:
HandlerRegistration
used to remove this handler
-
addDragMoveHandler
Add a dragMove handler.Executed every time the mouse moves while dragging this canvas.
- Specified by:
addDragMoveHandler
in interfaceHasDragMoveHandlers
- Parameters:
handler
- the dragMove handler- Returns:
HandlerRegistration
used to remove this handler
-
addDragRepositionMoveHandler
Add a dragRepositionMove handler.Executed every time the mouse moves while drag-repositioning. If this method does not Call
DragRepositionMoveEvent.cancel()
from withinDragRepositionMoveHandler.onDragRepositionMove(com.smartgwt.client.widgets.events.DragRepositionMoveEvent)
, theCanvas.dragTarget
(or outline ifCanvas.dragAppearance
is set to "outline") will automatically be moved as appropriate whenever the mouse moves.- Specified by:
addDragRepositionMoveHandler
in interfaceHasDragRepositionMoveHandlers
- Parameters:
handler
- the dragRepositionMove handler- Returns:
HandlerRegistration
used to remove this handler
-
addDragRepositionStartHandler
Add a dragRepositionStart handler.Executed when dragging first starts. No default implementation. Create this handler to set things up for the drag reposition.
- Specified by:
addDragRepositionStartHandler
in interfaceHasDragRepositionStartHandlers
- Parameters:
handler
- the dragRepositionStart handler- Returns:
HandlerRegistration
used to remove this handler
-
addDragRepositionStopHandler
Add a dragRepositionStop handler.Executed when the mouse button is released at the end of the drag. Your widget can use this opportunity to fire custom code based upon where the mouse button was released, etc.
Returning true from this handler will cause the
Canvas.dragTarget
(or outline ifCanvas.dragAppearance
is set to "outline") to be left in its current location. Returning false from this handler will cause it to snap back to its original location.- Specified by:
addDragRepositionStopHandler
in interfaceHasDragRepositionStopHandlers
- Parameters:
handler
- the dragRepositionStop handler- Returns:
HandlerRegistration
used to remove this handler
-
addDragResizeMoveHandler
Add a dragResizeMove handler.Executed every time the mouse moves while drag-resizing. If this method does not Call
DragResizeMoveEvent.cancel()
from withinDragResizeMoveHandler.onDragResizeMove(com.smartgwt.client.widgets.events.DragResizeMoveEvent)
, theCanvas.dragTarget
(or outline ifCanvas.dragAppearance
is set to "outline") will automatically be moved as appropriate whenever the mouse moves.- Specified by:
addDragResizeMoveHandler
in interfaceHasDragResizeMoveHandlers
- Parameters:
handler
- the dragResizeMove handler- Returns:
HandlerRegistration
used to remove this handler
-
addDragResizeStartHandler
Add a dragResizeStart handler.Executed when resize dragging first starts. No default implementation. Create this handler to set things up for the drag resize.
- Specified by:
addDragResizeStartHandler
in interfaceHasDragResizeStartHandlers
- Parameters:
handler
- the dragResizeStart handler- Returns:
HandlerRegistration
used to remove this handler
-
addDragResizeStopHandler
Add a dragResizeStop handler.Executed when the mouse button is released at the end of the drag resize. Your widget can use this opportunity to fire custom code based upon where the mouse button was released, etc.
Returning true from this handler will cause the
Canvas.dragTarget
(or outline ifCanvas.dragAppearance
is set to "outline") to be left at its current size. Returning false from this handler will cause it to snap back to its original location size- Specified by:
addDragResizeStopHandler
in interfaceHasDragResizeStopHandlers
- Parameters:
handler
- the dragResizeStop handler- Returns:
HandlerRegistration
used to remove this handler
-
addDragStartHandler
Add a dragStart handler.Executed when dragging first starts. Your widget can use this opportunity to set things up for the drag, such as setting the drag tracker. Returning false from this event handler will cancel the drag action entirely.
A drag action is considered to be begin when the mouse has moved
Canvas.dragStartDistance
with the left mouse down.- Specified by:
addDragStartHandler
in interfaceHasDragStartHandlers
- Parameters:
handler
- the dragStart handler- Returns:
HandlerRegistration
used to remove this handler
-
addDragStopHandler
Add a dragStop handler.Executed when the mouse button is released at the end of the drag. Your widget can use this opportunity to fire code based on the last location of the drag or reset any visual state that was sent.
- Specified by:
addDragStopHandler
in interfaceHasDragStopHandlers
- Parameters:
handler
- the dragStop handler- Returns:
HandlerRegistration
used to remove this handler
-
addDropMoveHandler
Add a dropMove handler.Executed whenever the compatible dragged object is moved over this drop target. You can use this to show a custom visual indication of where the drop would occur within the widget, or to show the
no-drop cursor
to indicate that this is not a valid drop target, typically ifCanvas.willAcceptDrop()
returns false.For details on showing a 'no drop' cursor when the user drags over all invalid drop targets, see
showNoDropIndicator
.- Specified by:
addDropMoveHandler
in interfaceHasDropMoveHandlers
- Parameters:
handler
- the dropMove handler- Returns:
HandlerRegistration
used to remove this handler
-
addDropOutHandler
Add a dropOut handler.Executed when the dragged object is no longer over this drop target, including when the drag interaction is ending with a drop on this drop target. If you have set a visual indication in dropOver or dropMove, you should reset it to its normal state in dropOut.
- Specified by:
addDropOutHandler
in interfaceHasDropOutHandlers
- Parameters:
handler
- the dropOut handler- Returns:
HandlerRegistration
used to remove this handler
-
addDropOverHandler
Add a dropOver handler.Executed when the compatible dragged object is first moved over this drop target. Your implementation can use this to show a custom visual indication that the object can be dropped here.
- Specified by:
addDropOverHandler
in interfaceHasDropOverHandlers
- Parameters:
handler
- the dropOver handler- Returns:
HandlerRegistration
used to remove this handler
-
enable
public void enable()Enables this widget and any children / peers of this widget.- See Also:
-
encloses
Returns true if the rectangle of this widget encloses the rectangle of the specified widget.- Parameters:
other
- other canvas to test for enclosure- Returns:
- true if this canvas encloses other; false otherwise
- See Also:
-
focus
public void focus()If this canvas can accept focus, give it keyboard focus. After this method, the canvas will appear focused and will receive keyboard events.- See Also:
-
focusAfterGroup
public void focusAfterGroup()Shifts focus to the next focusable element after this one, skipping any elements nested inside the tabbing group for this canvas, such as focusable children.This method makes use of the
TabIndexManager.shiftFocusAfterGroup()
method to request focus be changed to the next registered entry. By default standard focusable Smart GWT UI elements, including Canvases, FormItems, FormItemIcons, etc are registered with the TabIndexManager in the appropriate order, and will accept focus iffocusable
, and notdisabled
ormasked
.This method differs from
focusInNextTabElement()
in that it will skip any descendants of this widget in the TabIndexManager's hierarchy of potential focus target. By default this means focus will be moved to the next target on the page which is not a descendant of this widget.FormItems support a similar method:
FormItem.focusAfterItem()
.NOTE: Focusable elements created directly in the raw HTML bootstrap or by application code will not be passed focus by this method unless they have also been explicitly registered with the TabIndexManager. See the
TabOrderOverview
for more information.- See Also:
-
focusAtEnd
public void focusAtEnd(boolean start) Shifts focus to the start or end of this canvas and its descendants.This method makes use of the
TabIndexManager.shiftFocusWithinGroup()
API to request focus be changed within the set of focusable targets registered under this canvas.If the
start
parameter is true, if the canvas itself is focusable it will be given focus, otherwise the first focusable descendant will be given focus. If thestart
parameter is false, the last focusable descendant will be given focus (or if the canvas itself is focusable but there are no focusable descendants, it will receive focus).A use case for this might be to programmatically shift focus to the first or last button in a toolbar or similar.
- Parameters:
start
- Should we focus at the start or the end of this widget and its descendants.
-
addFocusChangedHandler
Add a focusChanged handler.Notification function fired when this widget receives or loses keyboard focus.
- Specified by:
addFocusChangedHandler
in interfaceHasFocusChangedHandlers
- Parameters:
handler
- the focusChanged handler- Returns:
HandlerRegistration
used to remove this handler
-
focusInNextTabElement
public void focusInNextTabElement()Shifts focus to the next focusable element after this one. This programatically simulates the user experience of a Tab keypress, and is used automatically when a blockingclickMask
is up to ensure focus does not move to any masked elements in the UI.This method makes use of the
TabIndexManager.shiftFocus()
method to request focus be changed to the adjacent registered entry. By default standard focusable Smart GWT UI elements, including Canvases, FormItems, FormItemIcons, etc are registered with the TabIndexManager in the appropriate order, and will accept focus iffocusable
, and notdisabled
ormasked
.The TabIndexManager maintains a hierarchy of focusable targets - so if a parent canvas contains focusable children, they will typically be nested under the parent canvas in this hierarchy. If you want to shift focus to the next target outside this hierarchy (IE: skip any children and put focus into the next widget on the page outside this one), you can use use
focusAfterGroup()
.NOTE: Focusable elements created directly in the raw HTML bootstrap or by application code will not be passed focus by this method unless they have also been explicitly registered with the TabIndexManager. See the
TabOrderOverview
for more information. -
focusInPreviousTabElement
public void focusInPreviousTabElement()Shifts focus to the previous focusable element before this one. This programatically simulates the user experience of a Shift+Tab keypress.This method makes use of the
TabIndexManager.shiftFocus()
method to request focus be changed to the adjacent registered entry. By default standard focusable Smart GWT UI elements, including Canvases, FormItems, FormItemIcons, etc are registered with the TabIndexManager in the appropriate order, and will accept focus iffocusable
, and notdisabled
ormasked
.NOTE: Focusable elements created directly in the raw HTML bootstrap or by application code will not be passed focus by this method unless they have also been explicitly registered with the TabIndexManager. See the
TabOrderOverview
for more information.- See Also:
-
getAriaHandleID
Returns the DOM ID for the main element for this canvas which will have ARIArole
andattributes
applied to it. This can be useful when applyingcustom aria state attributes
which need to refer to the DOM handle of another canvas, such as aria-controls.Note that we do not recommend using this ID to identify the element in the DOM for integration with automated testing tools. The
AutoTest.getLocator()
andAutoTest.getElement()
APIs should be used instead. These locators are much finer grained - they allow developers to identify sub-elements within the widget handle that map to specific logical Smart GWT objects (for example FormItem Icons within a DynamicForm). They are also more stable - AutoTest locators are able to reliably identify components based on their position in the application hierarchy and other context, while the DOM element IDs are not guaranteed not to change across page reloads.- Returns:
- ID written into the DOM element for this component
-
getAriaStateDefaults
Retrieves dynamically calculated default ARIA state properties for this canvas. These will be combined withexplicitly specified aria state
and applied to the widget handle as described ingetAriaState()
.For
disabled canvases
, this method returns an object withdisabled
set to true. May be overridden to apply additional defaults in canvas subclasses.- Returns:
- dynamically calculated default aria state properties
-
getBottom
public int getBottom()Return the bottom coordinate of this object as rendered, relative to its enclosing context, in pixels.- Returns:
- bottom coordinate
- See Also:
-
getChildTabPosition
For a given child widget whereupdateTabPositionOnReparent
is true, return the expected tab position within this parent. Default implementation will any explicit relative tab position specified bysetRelativeTabPosition()
, and otherwise put children in the same order as defined in the children arrayOverridden in the
Layout
class to return the position in the members array.- Parameters:
child
- Child to get local tab position for- Returns:
- tab position of child within this parent
-
getContentElement
Returns the DOM element for this Canvas which contains thecontents
, or forparent components
, the DOM elements for any drawn children. This method is provided for the very rare cases where a programmer needs to examine the DOM hierarchy created by a drawn Smart GWT component.Direct manipulation of the DOM elements created by Smart GWT components is not supported. Smart GWT components should be rendered or cleared using standard methods such as
draw()
,clear()
. If direct integration with existing DOM structures is required, this should be achieved via thehtmlElement
attribute, rather than by attempting to move the component's outer element via native browser APIs.
The content of Smart GWT components' DOM elements should also not be directly manipulated using native browser APIs - standard methods such assetContents()
,addChild()
,removeChild()
,markForRedraw()
andredraw()
should be used instead.In some cases, the element returned may match the element returned by
getOuterElement()
, but this will not always be the case.If the widget is undrawn, this method will return
null
.- Returns:
- The outer DOM element for a drawn Canvas.
-
getDefiningPropertyName
This method returns the name of an attribute for theAutoTest
system to use as thedefiningProperty
when generatinglocators
.If the value for the attribute returned by this method is non null, the
AutoTest.getLocator()
method will use this property name and value in the locators it generates to search the widget hierarchy for this component.The default implementation will return
this.definingProperty
if specified, otherwise the first entry inthis.definingPropertyNameOptions
that has a non empty value for this component.- Returns:
- property name to use as a defining property when generating AutoTest locators with search segments
-
getFullDataPath
Returns a fully qualifiedDataPath
for this canvas. This is calculated by combining the canvas' specifiedDataPath
with thedataPath
of any parent canvases up to whichever canvas has a specifiedvaluesManager
specified to actually manage values from this component.- Returns:
- fully qualified dataPath for this component.
See
DataPath
-
getHoverHTML
Ifthis.showHover
is true, when the user holds the mouse over this Canvas 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 returnsthis.prompt
- override for custom hover HTML. Note that returningnull
or an empty string will suppress the hover canvas altogether.- Returns:
- the string to show in the hover.
See
HTMLString
- See Also:
-
getHSnapPosition
public int getHSnapPosition(int coordinate) Override this method to provide a custom snap-to grid. Note that you do not need to do this if your grid is regular (ie, grid points are every x pixels); regular grids should be defined usingsnapHGap
andsnapVGap
. You should only override this method if you want to provide support for a grid of irregularly-placed points- Parameters:
coordinate
- x-coordinate of the drag event relative to the inside of this widget- Returns:
- The horizontal coordinate to snap to
- See Also:
-
getHSnapPosition
Override this method to provide a custom snap-to grid. Note that you do not need to do this if your grid is regular (ie, grid points are every x pixels); regular grids should be defined usingsnapHGap
andsnapVGap
. You should only override this method if you want to provide support for a grid of irregularly-placed points- Parameters:
coordinate
- x-coordinate of the drag event relative to the inside of this widgetdirection
- "before" or "after" denoting whether the returned coordinate should match the left or right edge of the current square. If unsetsnapHDirection
will be used by default- Returns:
- The horizontal coordinate to snap to
- See Also:
-
getImage
Retrieve a native image, SVG object element or the container for an SVG symbol or font-icon, by name.The element must have been created from HTML generated by calling
imgHTML()
on this particular Canvas.- Parameters:
identifier
- name of the image or container element to get, as originally passed toimgHTML()
- Returns:
- DOM image or container element if found, else null
- See Also:
-
getInnerContentHeight
public int getInnerContentHeight()Returns the amount of space available for interior content (or relatively positioned child widget(s)) without introducing clipping, scrolling or overflow.
This is the space within the viewport of the widget (not including padding, and excluding margins, borders or scrollbars) rendered at its specified size.- Returns:
- inner height of the widget in pixels
- See Also:
-
getInnerContentWidth
public int getInnerContentWidth()Returns the amount of space available for interior content (or relatively positioned child widget(s)) without introducing clipping, scrolling or overflow.
This is the space within the viewport of the widget (not including padding, and excluding margins, borders or scrollbars) rendered at its specified size.- Returns:
- inner height of the widget in pixels
- See Also:
-
getInnerHeight
public int getInnerHeight()Returns the amount of space available for (an) absolutely positioned child widget(s) or absolutely positioned HTML content, without introducing clipping, scrolling or overflow.This is the space within the viewport of the widget (including padding, but excluding margins, borders or scrollbars) rendered at its specified size.
- Returns:
- inner height of the widget in pixels
- See Also:
-
getInnerWidth
public int getInnerWidth()Returns the amount of space available for absolutely positioned child widget(s) or absolutely positioned HTML content, without introducing clipping, scrolling or overflow.This is the space within the viewport of the widget (including padding, but excluding margins, borders or scrollbars) rendered at its specified size.
- Returns:
- inner width of the widget in pixels
- See Also:
-
getLocalId
Retrieve the local ID of this canvas. If no local ID is assigned the normal canvas ID is returned making this method a safe replacement forgetID()
.A "local ID" originates as an explicit ID assigned to a widget created in Reify. These IDs assigned by Reify become local IDs when a screen is loaded by
RPCManager.loadScreen()
orRPCManager.cacheScreens()
andRPCManager.createScreen()
. A local ID is unique only within the scope of a widget's screen, and is not globally unique as is required forID
.- Returns:
- the local ID or standard ID of the Canvas
-
getMasterCanvas
Returns this canvas's "master" (the canvas to which it was added as a peer), if any.See
Containment
for an overview of master/peer relationships.- Returns:
- the master canvas, null if none exists.
- See Also:
-
getOffsetX
public int getOffsetX()Return the X-coordinate of the last event relative to the left edge of the content of this Canvas.
NOTE: To get a coordinate relative to the viewport of this Canvas, subtract this.getScrollLeft()- Returns:
- See Also:
-
getOffsetY
public int getOffsetY()Return the Y-coordinate of the last event, relative to the top edge of the content of this Canvas.
NOTE: To get a coordinate relative to the viewport of this Canvas, subtract this.getScrollTop()- Returns:
- See Also:
-
getOuterElement
Returns the outer DOM element of this Canvas. This method is provided for the very rare cases where a programmer needs to examine the DOM hierarchy created by a drawn Smart GWT component.Direct manipulation of the DOM elements created by Smart GWT components is not supported. Smart GWT components should be rendered or cleared using standard methods such as
draw()
,clear()
. If direct integration with existing DOM structures is required, this should be achieved via thehtmlElement
attribute, rather than by attempting to move the component's outer element via native browser APIs.
The content of Smart GWT components' DOM elements should also not be directly manipulated using native browser APIs - standard methods such assetContents()
,addChild()
,removeChild()
,markForRedraw()
andredraw()
should be used instead.In some cases, the element returned may match the element returned by
getContentElement()
, but this will not always be the case.If the widget is undrawn, this method will return
null
.- Returns:
- The outer DOM element for a drawn Canvas.
-
getPageBottom
public int getPageBottom()Return the page-relative bottom coordinate of this object, in pixels.- Returns:
- GLOBAL bottom coordinate
- See Also:
-
getPageLeft
public int getPageLeft()Returns the page-relative left coordinate of the widget on the page, in pixels.- Returns:
- global left coordinate
- See Also:
-
getPageRight
public int getPageRight()Return the page-relative right coordinate of this object, in pixels.- Returns:
- GLOBAL right 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:
-
getPanelContainer
Returns this Canvas's "panel container". A panel container is a widget that manages a collection of panels, like aTabSet
orSectionStack
. If this Canvas is not a child of such a panel container, this method returns null.- Returns:
- the Canvas's panel container, or null if the Canvas is not a chlld of a panel container
-
getRight
public int getRight()Return the right coordinate of this object as rendered, relative to its enclosing context, in pixels.- Returns:
- right coordinate
- See Also:
-
getRuleContext
Get the current value of the rule context collected by theruleScope
of this component (which may be this component itself or whatever component is managing theruleScope
for this component).If the
databoundOnly
parameter is passed as true, only data from components that actually have aDataSource
is included.Use
Canvas.ruleContextChanged()
to get a notification of changes to the rule context.- Returns:
- the ruleContext object, or null if canvas is not part of a ruleScope
-
getRuleContext
Get the current value of the rule context collected by theruleScope
of this component (which may be this component itself or whatever component is managing theruleScope
for this component).If the
databoundOnly
parameter is passed as true, only data from components that actually have aDataSource
is included.Use
Canvas.ruleContextChanged()
to get a notification of changes to the rule context.- Parameters:
databoundOnly
- whether to include only data from components that have aDataSource
- Returns:
- the ruleContext object, or null if canvas is not part of a ruleScope
-
getScrollBottom
public int getScrollBottom()Returns the scrollTop required to scroll vertically to the end of this widget's content.- Returns:
- scroll bottom coordinate
- See Also:
-
getScrollHeight
public int getScrollHeight()Returns the scrollable height of the widget's contents, including children, ignoring clipping.- Returns:
- height of the element that can scroll
- See Also:
-
getScrollLeft
public int getScrollLeft()Get the number of pixels this Canvas is scrolled from its left edge.- Returns:
- scrollLeft
- See Also:
-
getScrollRight
public int getScrollRight()Returns the scrollLeft required to scroll horizontally to the end of this widget's content.- Returns:
- scroll bottom coordinate
- See Also:
-
getScrollTop
public int getScrollTop()Get the number of pixels this Canvas is scrolled from its top edge.- Returns:
- scrollTop
- See Also:
-
getScrollWidth
public int getScrollWidth()Returns the scrollable width of the widget's contents, including children, ignoring clipping.- Returns:
- the scrollable width of the widget's contents
- See Also:
-
getUISummary
Returns a summary of this canvas and its child canvii and/or fields that is useful to an AI in understanding the hierarchy.- Parameters:
heirarchyExcluded
- property names to exclude from entire hierarchythisCanvasExcluded
- property names to exclude from this canvas- Returns:
- the summary
-
getViewportHeight
public int getViewportHeight()Returns the height of the viewport onto the scrollable content.- Returns:
- height of the viewport, in pixels
- See Also:
-
getViewportWidth
public int getViewportWidth()Returns the width of the viewport onto the scrollable content.- Returns:
- width of the viewport, in pixels
- See Also:
-
getVisibleHeight
public int getVisibleHeight()Return the visible height of the Canvas.- Returns:
- visible height in pixels
- See Also:
-
getVisibleWidth
public int getVisibleWidth()Return the visible width of the Canvas.- Returns:
- visible width in pixels
- See Also:
-
getVSnapPosition
public int getVSnapPosition(int coordinate) Override this method to provide a custom snap-to grid. Note that you do not need to do this if your grid is regular (ie, grid points are every x pixels) - regular grids should be defined usingsnapHGap
andsnapVGap
. You should only override this method if you want to provide support for a grid of irregularly-placed points- Parameters:
coordinate
- y-coordinate of the drag event relative to the inside of this widget- Returns:
- The vertical coordinate to snap to
- See Also:
-
getVSnapPosition
Override this method to provide a custom snap-to grid. Note that you do not need to do this if your grid is regular (ie, grid points are every x pixels) - regular grids should be defined usingsnapHGap
andsnapVGap
. You should only override this method if you want to provide support for a grid of irregularly-placed points- Parameters:
coordinate
- y-coordinate of the drag event relative to the inside of this widgetdirection
- "before" or "after" denoting whether the returned coordinate should match the top or bottom edge of the current square. If unsetsnapHDirection
will be used by default- Returns:
- The vertical coordinate to snap to
- See Also:
-
getZIndex
public int getZIndex(boolean resolveToNumber) Get the z-Index of this canvas.- Parameters:
resolveToNumber
- If passedtrue
, for undrawn widgets, resolve "auto" to the next available zIndex.- Returns:
- See Also:
-
handleHover
public void handleHover()Handler fired on a delay when the user hovers the mouse over this hover-target. Default implementation will firethis.hover()
(if defined), and handle showing the hover canvas ifthis.showHover
is true.- See Also:
-
hide
public void hide()Sets the widget's CSS visibility attribute to "hidden". -
hideClickMask
public void hideClickMask()Hides the click mask associated with this canvas. -
hideClickMask
Hides the click mask associated with this canvas.- Parameters:
ID
- optional ID of specific clickMask to hide. If not passed, defaults to hiding the click mask associated with this widget only.- See Also:
-
hideComponentMask
public void hideComponentMask()Hide thecomponent level clickMask
for this widget -
hideComponentMask
public void hideComponentMask(boolean suppressFocusReset) Hide thecomponent level clickMask
for this widget- Parameters:
suppressFocusReset
- By default when the component-level mask is hidden it will attempt to reset focus to whatever had focus before the mask was shown. Pass this parameter to suppress this behavior.
-
hideContextMenu
public void hideContextMenu()The default implementation of this method hides the contextMenu currently being shown for this component (which occurs when the mouse button that toggles the context menu is released). Override if you want some other behavior. -
addHoverHandler
Add a hover handler.If
canHover
is true for this widget, thehover
string method will be fired when the user hovers over this canvas. If this method returns false, it will suppress the default behavior of showing a hover canvas ifthis.showHover
is true.- Specified by:
addHoverHandler
in interfaceHasHoverHandlers
- Parameters:
handler
- the hover handler- Returns:
HandlerRegistration
used to remove this handler
-
addHoverHiddenHandler
Add a hoverHidden handler.If
showHover
is true for this canvas, this notification method will be fired whenever the hover shown in response tohandleHover()
is hidden.- Specified by:
addHoverHiddenHandler
in interfaceHasHoverHiddenHandlers
- Parameters:
handler
- the hoverHidden handler- Returns:
HandlerRegistration
used to remove this handler
-
initComplete
public void initComplete()Notification method fired afterinitWidget()
, when canvas initialization is complete.This is a notification method only and has no default implementation
-
intersects
Returns true if the rectangles of this widget and the specified widget overlap.- Parameters:
other
- other canvas to test for intersection- Returns:
- true if this canvas intersects other; false otherwise
- See Also:
-
isDirty
Returns whether a canvas is waiting to be redrawn. Will return true ifmarkForRedraw()
has been called, but this canvas has not yet been redrawn.- Returns:
- true is this canvas needs to be redrawn; false otherwise
- See Also:
-
isDisabled
Is this canvas disabled? Note that the disabled state is inherited - this method will return true if this widget, or any of its ancestors are marked disabled.- Returns:
- true if the widget or any widget above it in the containment hierarchy are disabled.
- See Also:
-
isFocused
Returns true if this Canvas has the keyboard focus. Note that in Internet Explorer focus notifications can be asynchronous (seesynchronousFocusNotifications
). In this case,canvas.isFocused()
method can correctly return false when, intuitively, you would expect it to return true:someCanvas.focus(); if (someCanvas.isFocused()) { // In most browsers we would get here, but not in Internet Explorer with // EventHandler.synchronousFocusNotifications disabled. }
- Returns:
- whether this Canvas has the keyboard focus
- See Also:
-
addKeyDownHandler
Add a keyDown handler.Executed when a key is pressed on a focusable widget (
Canvas.canFocus
: true).Use
EventHandler.getKey()
to find out the String of the key that was pressed, and useEventHandler.shiftKeyDown()
and related functions to determine whether modifier keys were down.- Specified by:
addKeyDownHandler
in interfaceHasKeyDownHandlers
- Parameters:
handler
- the keyDown handler- Returns:
HandlerRegistration
used to remove this handler
-
addKeyPressHandler
Add a keyPress handler.Executed when a key is pressed and released on a focusable widget (
Canvas.canFocus
: true).Use
EventHandler.getKey()
to find out the String of the key that was pressed, and useEventHandler.shiftKeyDown()
and related functions to determine whether modifier keys were down.- Specified by:
addKeyPressHandler
in interfaceHasKeyPressHandlers
- Parameters:
handler
- the keyPress handler- Returns:
HandlerRegistration
used to remove this handler
-
keyUp
Executed when a key is released on a focusable widget (canFocus
: true).Use
EventHandler.getKey()
to find out the String of the key that was pressed, and useEventHandler.shiftKeyDown()
and related functions to determine whether modifier keys were down.- Returns:
- false to prevent this event from bubbling to this widget's parent, true or undefined to bubble.
- See Also:
-
layoutChildren
layoutChildren()
is where a Canvas should implement a sizing policy for it's Canvas children. SincelayoutChildren
calls parentResized() on its children,parentResized()
is a good place for a child to implement a layout policy that can be used within any parent.Recommended practice for a Canvas that manages Canvas children is to create those children without any initial coordinate or size settings and do all sizing when layoutChildren() is called.
layoutChildren() is always called at least once before children are drawn, and is called automatically whenever the viewport size changes (which includes both resizing and introduction/removal of scrolling). layoutChildren() can also be manually invoked in any other component-specific situation which changes the layout.
NOTE: layoutChildren() may be called before draw() if a widget is resized before draw(), so be sure to avoid errors such as assuming that any children you automatically create have already been created.
NOTE: auto-sizing: layoutChildren() is also called once during the initial draw(), before children are drawn, with a "reason" of "initial draw". During this invocation of layoutChildren() it is legal to directly draw children (call child.draw()), which is otherwise never allowed. This allows a Canvas to implement an auto-sizing layout policy by drawing some children before deciding on the sizes of remaining children, which is far more efficient than drawing all children and resizing some of them after they are drawn.
- Parameters:
reason
- reason why layoutChildren() is being called, passed when framework code invokes layoutChildren()- See Also:
-
linkHTML
Generates the HTML for a standard link (anchor) element.- Parameters:
href
- URL for the link to point to- Returns:
- HTML for the link.
See
HTMLString
-
linkHTML
- See Also:
-
linkHTML
- See Also:
-
linkHTML
- See Also:
-
linkHTML
- See Also:
-
linkHTML
public String linkHTML(String href, String text, String target, String ID, Integer tabIndex, String accessKey) Generates the HTML for a standard link (anchor) element.- Parameters:
href
- URL for the link to point totext
- HTML to display in the link element (defaults to the href). SeeHTMLString
target
- Target window for the link (defaults to opening in a new, unnamed window)ID
- optional ID for the link element to be written outtabIndex
- optional tabIndex for the linkaccessKey
- optional accessKey for the link- Returns:
- HTML for the link.
See
HTMLString
-
markForDestroy
public void markForDestroy()destroy()
this canvas on a timeout. This method should be used instead of callingcanvas.destroy()
directly unless there's a reason a the canvas needs to be destroyed synchronously. By using a timeout, this method ensures thedestroy()
will occur after the current thread of execution completes. This allows you to easily mark canvases for destruction while they're handling events, which must complete before the canvas can be destroyed.Notes:
markForDestroy()
performs some immediate cleanup and puts a component into a "pending destroy" state. As far as application code is concerned, once a component has been is in this state it should be considered invalid to invoke methods on the component.- Developers should
not
destroy()
ormarkForDestroy()
a component while it is in the middle of an asynchronous operation. For example, if you need to submit and then destroy a single-use dynamic form, the call tomarkForDestroy()
should be invoked from the callback toDynamicForm.saveData()
, rather than being invoked synchronously after the call tosaveData()
- See Also:
-
markForRedraw
public void markForRedraw()Marks the widget as "dirty" so that it will be added to a queue for redraw. Redraw of dirty components is handled by a looping timer and will after a very short delay (typically less than 100ms). In most cases it is recommended that developers usemarkForRedraw()
instead of callingredraw()
directly. Since this method queues the redraw, multiple calls to markForRedraw() within a single thread of execution will only lead to a single DOM manipulation which greatly improves application performance.- See Also:
-
markForRedraw
Marks the widget as "dirty" so that it will be added to a queue for redraw. Redraw of dirty components is handled by a looping timer and will after a very short delay (typically less than 100ms). In most cases it is recommended that developers usemarkForRedraw()
instead of callingredraw()
directly. Since this method queues the redraw, multiple calls to markForRedraw() within a single thread of execution will only lead to a single DOM manipulation which greatly improves application performance.- Parameters:
reason
- reason for performing the redraw- See Also:
-
addMouseDownHandler
Add a mouseDown handler.Executed when the left mouse button is pressed on this widget. No default implementation.
- Specified by:
addMouseDownHandler
in interfaceHasMouseDownHandlers
- Parameters:
handler
- the mouseDown handler- Returns:
HandlerRegistration
used to remove this handler
-
addMouseMoveHandler
Add a mouseMove handler.Executed when the mouse moves within this widget. No default implementation.
- Specified by:
addMouseMoveHandler
in interfaceHasMouseMoveHandlers
- Parameters:
handler
- the mouseMove handler- Returns:
HandlerRegistration
used to remove this handler
-
addMouseOutHandler
Add a mouseOut handler.Executed when the mouse leaves this widget. No default implementation.
Note that if the mouse goes over a child of this canvas, the mouseOut event will fire as it would if the user rolled entirely off the canvas. Developers may determine whether the mouse is still over a descendant of this component via
Canvas.containsEventTarget()
.- Specified by:
addMouseOutHandler
in interfaceHasMouseOutHandlers
- Parameters:
handler
- the mouseOut handler- Returns:
HandlerRegistration
used to remove this handler
-
addMouseOverHandler
Add a mouseOver handler.Executed when mouse enters this widget. No default implementation.
- Specified by:
addMouseOverHandler
in interfaceHasMouseOverHandlers
- Parameters:
handler
- the mouseOver handler- Returns:
HandlerRegistration
used to remove this handler
-
addMouseStillDownHandler
Add a mouseStillDown handler.Repeating notification method for the user holding the left mouse button down over this canvas.
The
mouseStillDown
event is fired immediately when the mouse goes down. If the user holds the mouse down, after a pause ofCanvas.mouseStillDownInitialDelay
, it will begin to fire repeatedly everyCanvas.mouseStillDownDelay
milliseconds.This provides developers with a simple way to handle the common "repeated action" use case where a user can click a UI element to perform an action once, or click and hold to perform the action repeatedly.
Examples of this include standard scrollbar button behavior and buttons to increase or decrease the value in a spinner type input element.This event is not native to JavaScript, but is provided by the ISC system.
- Specified by:
addMouseStillDownHandler
in interfaceHasMouseStillDownHandlers
- Parameters:
handler
- the mouseStillDown handler- Returns:
HandlerRegistration
used to remove this handler
-
addMouseUpHandler
Add a mouseUp handler.Executed when the left mouse is released on this widget. No default implementation.
- Specified by:
addMouseUpHandler
in interfaceHasMouseUpHandlers
- Parameters:
handler
- the mouseUp handler- Returns:
HandlerRegistration
used to remove this handler
-
addMouseWheelHandler
Add a mouseWheel handler.Executed when the mouse wheel is actuated.
- Specified by:
addMouseWheelHandler
in interfaceHasMouseWheelHandlers
- Parameters:
handler
- the mouseWheel handler- Returns:
HandlerRegistration
used to remove this handler
-
moveAbove
Puts this widget just above the specified widget in the stacking order, so it appears in front of the specified widget if both widgets have the same parent.- Parameters:
canvas
- canvas to move above- See Also:
-
moveBelow
Puts this widget just below the specified widget in the stacking order, so it appears behind the specified widget if both widgets have the same parent.- Parameters:
canvas
- canvas to move below- See Also:
-
moveBy
Moves the widget deltaX pixels to the right and deltaY pixels down. Pass negative numbers to move up and/or to the left.- Parameters:
deltaX
- amount to move horizontally (may be negative)deltaY
- amount to move vertically (may be negative)- Returns:
- whether the component actually moved
- See Also:
-
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 changed due to an ancestor being moved. The
Canvas.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
public boolean moveTo(int left, int top) Moves the widget so that its top-left corner is at the specified coordinates.This method will also accept a single parameter as an object array with left and top given as properties.
- Parameters:
left
- x-coordinate to move to in LOCAL coordinates or Object with left and top properties.top
- y-coordinate to move to in LOCAL coordinates- Returns:
- whether the component actually moved
- See Also:
-
addClearHandler
Add a clear handler.Notification method fired when the canvas is removed from the DOM via a call to
Canvas.clear()
. Canvases are cleared recursively, so if a parent is clear()'d, all of its descendants will also be cleared. This notification is fired before the canvas has been removed from the DOM, andCanvas.isDrawn()
will returntrue
if called while the notification is running.- Specified by:
addClearHandler
in interfaceHasClearHandlers
- Parameters:
handler
- the clear handler- Returns:
HandlerRegistration
used to remove this handler
-
addDropHandler
Add a drop handler.Notification method fired when the user drops another canvas onto this one. Returning
false
from this method will prevent any default drop behavior from occurring- Specified by:
addDropHandler
in interfaceHasDropHandlers
- Parameters:
handler
- the drop handler- Returns:
HandlerRegistration
used to remove this handler
-
pageScrollDown
public void pageScrollDown()This method is the programmatic equivalent of the user pressing the "Page Down" key while this widget has the focus. It scrolls the widget's content downwards by the viewport height, if the content can be scrolled that far downwards -
pageScrollUp
public void pageScrollUp()This method is the programmatic equivalent of the user pressing the "Page Up" key while this widget has the focus. It scrolls the widget's content upwards by the viewport height, if the content can be scrolled that far upwards -
addParentMovedHandler
Add a parentMoved handler.Notification method fired when an ancestor of this component's position changes.
- Specified by:
addParentMovedHandler
in interfaceHasParentMovedHandlers
- Parameters:
handler
- the parentMoved handler- Returns:
HandlerRegistration
used to remove this handler
-
placeNear
public void placeNear()Move this canvas to the specified point, or as close to the specified point as possible without this widget extending beyond the edge of the browser viewport on any side.- See Also:
-
placeNear
public void placeNear(int left) - See Also:
-
placeNear
public void placeNear(int left, int top) Move this canvas to the specified point, or as close to the specified point as possible without this widget extending beyond the edge of the browser viewport on any side.- Parameters:
left
- Left coordinate (defaults to mouse position)top
- Top coordinate (defaults to mouse position)- See Also:
-
print
public void print()Generate and show aPrintWindow
containing aPrintCanvas
showing a printable view of this component. -
print
- See Also:
-
print
- See Also:
-
print
public void print(PrintProperties printProperties, PrintWindow printWindowProperties, String callback) Generate and show aPrintWindow
containing aPrintCanvas
showing a printable view of this component.- Parameters:
printProperties
- PrintProperties object for customizing the print HTML outputprintWindowProperties
- Properties to apply to the generated print window.callback
- callback to fire when the print preview canvas has been populated with the printable HTML. This callback takes 2 parameters:printPreview
- a pointer to the generated print canvas shown in the body of the print window.printWindow
- a pointer to the generated print window and. SeeCallback
- See Also:
-
redraw
public void redraw()Redraws the widget immediately with its current property values. Generally, if you want a Canvas to redraw, call markForRedraw() - this will cause the Canvas to be redrawn when current processing ends, so that a series of modifications made to a Canvas will cause it to redraw only once. Only call redraw() directly if you need immediate responsiveness, for example you are redrawing in response to continuous mouse motion.- See Also:
-
redraw
Redraws the widget immediately with its current property values. Generally, if you want a Canvas to redraw, call markForRedraw() - this will cause the Canvas to be redrawn when current processing ends, so that a series of modifications made to a Canvas will cause it to redraw only once. Only call redraw() directly if you need immediate responsiveness, for example you are redrawing in response to continuous mouse motion.- Parameters:
reason
- reason for performing the redraw- See Also:
-
removeChild
Remove a child from this parent.- Parameters:
child
- Child canvas to remove from this parent.- See Also:
-
removeChild
Remove a child from this parent.- Parameters:
child
- Child canvas to remove from this parent.name
- If the child canvas was assigned a name when added via addChild(), it should be passed in here to ensure no reference is kept to the child- See Also:
-
removePeer
Remove a peer from this Canvas- Parameters:
peer
- Peer to be removed from this canvas- See Also:
-
removePeer
Remove a peer from this Canvas- Parameters:
peer
- Peer to be removed from this canvasname
- If this peer was assigned a name when added via addPeer(), it should be passed in here to ensure no reference is kept to the peer- See Also:
-
removeRuleContext
Remove data in the rule context at the specifiedpath
along with any user-provided schema.Normally data is removed from the ruleContext by passing
null
todata
inprovideRuleContext()
, however, this call will do the same but also removes the schema as explicitly provided to provideRuleContext.Data automatically provided to the ruleContext, as described by
ruleScope
, along with the associated schema is automatically removed when the contributing DataBoundComponent is destroyed. Therefore there is no need to clean up those ruleContext paths manually.- Parameters:
path
- path where data and schema should be removed
-
removeSnapAlignCandidate
Remove a candidate fromsnapAlignCandidates
. If the passed widget was not actually a candidate, nothing happens and no warning is logged.- Parameters:
candidate
-- See Also:
-
resizeBy
Resizes the widget, adding deltaX to its width and deltaY to its height (moves the right and/or bottom sides of the widget).- Parameters:
deltaX
- amount to resize horizontally (may be negative)deltaY
- amount to resize vertically (may be negative)- Returns:
- whether the component actually changed size
- See Also:
-
addResizedHandler
Add a resized handler.Method called whenever a Canvas changes size. Note that if this canvas is
overflow:"visible"
, and is waiting for a queued redraw (seeCanvas.isDirty()
), the value forCanvas.getVisibleWidth()
andCanvas.getVisibleHeight()
will be unreliable untilredraw()
fires.
In this case, if the delayed redraw does change the drawn size of the component, this notification will be fired a second time when it completes.- Specified by:
addResizedHandler
in interfaceHasResizedHandlers
- Parameters:
handler
- the resized handler- Returns:
HandlerRegistration
used to remove this handler
-
resizeTo
Resizes the widget to the specified width and height (moves the right and/ or bottom sides of the widget). The width and height parameters can be expressed as a percentage of viewport size or as the number of pixels. Seewidth
orheight
for more on canvas sizing.- Parameters:
width
- new width for canvas.height
- new height for canvas- Returns:
- whether the size actually changed
- See Also:
-
addRightMouseDownHandler
Add a rightMouseDown handler.Executed when the right mouse button is pressed on this widget. No default implementation.
- Specified by:
addRightMouseDownHandler
in interfaceHasRightMouseDownHandlers
- Parameters:
handler
- the rightMouseDown handler- Returns:
HandlerRegistration
used to remove this handler
-
addRuleContextChangedHandler
Add a ruleContextChanged handler.Notification that the rule context gathered by the
Canvas.ruleScope
has changed.This notification fires only on the component designated as the
Canvas.ruleScope
; components that are merely contributing data to the rule context do not fireruleContextChanged
.- Specified by:
addRuleContextChangedHandler
in interfaceHasRuleContextChangedHandlers
- Parameters:
handler
- the ruleContextChanged handler- Returns:
HandlerRegistration
used to remove this handler
-
scrollBy
public void scrollBy(int dX, int dY) Scroll this widget by some pixel increment in either (or both) direction(s).Note: If you attempt to call this API before the widget is drawn, the call will be ignored.
- Parameters:
dX
- Number of pixels to scroll horizontallydY
- Number of pixels to scroll vertically- See Also:
-
scrollByPercent
public void scrollByPercent(int dX, int dY) Scroll this widget by some percentage of scroll size in either (or both) direction(s).- Parameters:
dX
- Percentage to scroll horizontally. Will accept either a numeric percent value, or a string like "10%".dY
- Percentage to scroll horizontally. Will accept either a numeric percent value, or a string like "10%".- See Also:
-
addScrolledHandler
Add a scrolled handler.Notification that this component has just scrolled.
Fires for both CSS and
"synthetic" scrollbars
.- Specified by:
addScrolledHandler
in interfaceHasScrolledHandlers
- Parameters:
handler
- the scrolled handler- Returns:
HandlerRegistration
used to remove this handler
-
scrollTo
public void scrollTo()Scrolls the content of the widget so that the origin (top-left corner) of the content is left pixels to the left and top pixels above the widget's top-left corner (but still clipped by the widget's dimensions).This is guaranteed to be called whenever this Canvas is scrolled, whether scrolling is initiated programmatically, by custom scrollbars, or a by a native scrollbar.
Note: If you attempt to call this API before the widget is drawn, the call will be ignored.
- See Also:
-
scrollTo
- See Also:
-
scrollTo
Scrolls the content of the widget so that the origin (top-left corner) of the content is left pixels to the left and top pixels above the widget's top-left corner (but still clipped by the widget's dimensions).This is guaranteed to be called whenever this Canvas is scrolled, whether scrolling is initiated programmatically, by custom scrollbars, or a by a native scrollbar.
Note: If you attempt to call this API before the widget is drawn, the call will be ignored.
- Parameters:
left
- the left coordinatetop
- the top coordinate- See Also:
-
scrollToBottom
public void scrollToBottom()Vertically scrolls the content of the widget to the end of its content- See Also:
-
scrollToLeft
public void scrollToLeft()Horizontally scrolls the content of the widget to 0- See Also:
-
scrollToPercent
public void scrollToPercent(int left, int top) Scroll this widget to some position specified as a percentage of scroll size in either (or both) direction(s).- Parameters:
left
- Left Percentage position to scroll to Will accept either a numeric percent value, or a string like "10%".top
- Top Percentage position to scroll to Will accept either a numeric percent value, or a string like "10%".- See Also:
-
scrollToRight
public void scrollToRight()Horizontally scrolls the content of the widget to the end of its content- See Also:
-
scrollToTop
public void scrollToTop()Vertically scrolls the content of the widget to 0- See Also:
-
sendToBack
public void sendToBack()Puts this widget at the bottom of the stacking order, so it appears behind all other widgets in the same parent. -
setBottom
public void setBottom(int bottom) Resizes the widget vertically to position its bottom edge at the specified coordinate.NOTE: if you're setting multiple coordinates, use setRect(), moveTo() or resizeTo() instead
- Parameters:
bottom
- new bottom coordinate- See Also:
-
setEditMode
public void setEditMode(boolean editingOn) Enable or disable edit mode for this component. Components in editMode must be associated with anEditNode
within anEditContext
.Components with editMode enabled support certain editing interactions which vary depending on the componentType and settings on the
editProxy
.To disable edit mode just pass
editingOn
as false. The other parameters are not needed.To enable edit mode on this component all three parameters are required. The
editNode
is the edit node for this component as it exists within theeditContext
.An alternative method,
EditContext.enableEditing()
, can be used when only an editContext and editNode are available.Placing a component into
editMode
causes the component'seditProxy
to be created.- Parameters:
editingOn
- true to enable editMode; false to disable- See Also:
-
setEditMode
- See Also:
-
setEditMode
Enable or disable edit mode for this component. Components in editMode must be associated with anEditNode
within anEditContext
.Components with editMode enabled support certain editing interactions which vary depending on the componentType and settings on the
editProxy
.To disable edit mode just pass
editingOn
as false. The other parameters are not needed.To enable edit mode on this component all three parameters are required. The
editNode
is the edit node for this component as it exists within theeditContext
.An alternative method,
EditContext.enableEditing()
, can be used when only an editContext and editNode are available.Placing a component into
editMode
causes the component'seditProxy
to be created.- Parameters:
editingOn
- true to enable editMode; false to disableeditContext
- the EditContexteditNode
- the EditNode- See Also:
-
setImage
Set the URL of an image or SVG object element by name.The element must have been created from HTML generated by calling
canvas.imgHTML()
on this particular Canvas.- Parameters:
identifier
- name of the image to change, as originally passed toimgHTML
URL
- URL for the image. SeeSCImgURL
- See Also:
-
setImage
Set the URL of an image or SVG object element by name.The element must have been created from HTML generated by calling
canvas.imgHTML()
on this particular Canvas.- Parameters:
identifier
- name of the image to change, as originally passed toimgHTML
URL
- URL for the image. SeeSCImgURL
imgDir
- optional image directory, overrides the default for this Canvas- See Also:
-
setLocatorParent
This method will set mark the target canvas as the "locator parent" for this canvas, using the specified child name. After calling this method,locators
that reference this canvas will use thechildName
to navigate from the specified parent to this component, exactly how namedautoChildren
are referenced in locators.Note that, as with Smart GWT autoChildren, the locator parent does not need to be the direct parent of this component, or even a true ancestor, in the widget hierarchy. However, you should never set the locatorParent to a descendant of this widget as that would lead to infinite loops when attempting to create or resolve locators.
This method will also set
locatorParent.attributeName
, (orlocatorParent.childName
if no explicit attributeName was specified) to refer to this canvas, if this is not already the case.If the attribute is already set to refer to some other object, this method will return false without taking any further action.
- Parameters:
locatorParent
- New locator parent for this canvaschildName
- Name to refer from the locator parent to this canvas in the locator- Returns:
- returns true if the locatorParent was successfully updated
-
setLocatorParent
This method will set mark the target canvas as the "locator parent" for this canvas, using the specified child name. After calling this method,locators
that reference this canvas will use thechildName
to navigate from the specified parent to this component, exactly how namedautoChildren
are referenced in locators.Note that, as with Smart GWT autoChildren, the locator parent does not need to be the direct parent of this component, or even a true ancestor, in the widget hierarchy. However, you should never set the locatorParent to a descendant of this widget as that would lead to infinite loops when attempting to create or resolve locators.
This method will also set
locatorParent.attributeName
, (orlocatorParent.childName
if no explicit attributeName was specified) to refer to this canvas, if this is not already the case.If the attribute is already set to refer to some other object, this method will return false without taking any further action.
- Parameters:
locatorParent
- New locator parent for this canvaschildName
- Name to refer from the locator parent to this canvas in the locatorattributeName
- Optional attribute to refer from the parent to this canvas. If unset the childName will be used instead.- Returns:
- returns true if the locatorParent was successfully updated
-
setPageLeft
public void setPageLeft(int left) Set the page-relative left coordinate of this widget.- Parameters:
left
- new left coordinate in pixels- See Also:
-
setPageTop
public void setPageTop(int top) Set the page-relative top coordinate of this widget.- Parameters:
top
- new top coordinate in pixels- See Also:
-
setPanelContainer
Sets this Canvas's "panel container". A panel container is a widget that manages a collection of panels, like aTabSet
orSectionStack
. Smart GWT uses this method internally when child panels are added to panel container widgets; if you need to create a panel container widget that does not extend one of the built-in ones (these areTabSet
,SectionStack
andWindow
), your code should do the same thing.- Parameters:
container
- The container widget for this canvas
-
setRelativeTabPosition
Assign a relative tab position for this canvas. The meaning of a "relative" tab position varies depending on where the canvas is in the page.For canvases with no specified
parent canvas
, (or whereupdateTabPositionOnReparent
is false), this method will and move the canvas to the appropriate tab-position among other top level canvases. It will also disableupdateTabPositionOnDraw
so if this method is called before draw, drawing this canvas will not cause its tab position to change.For canvases embedded in a
getParentCanvas()
, this method will move the canvas to the appropriate tab position among the other children of the parent.
Implementation note: This is achieved by setting an internal property to indicate the new tab position which will be respected by the defaultgetChildTabPosition()
implementation, and callingupdateChildTabPositions()
to implement a reflow. Therefore ifgetChildTabPosition()
has been overridden, this method may have no effect.As with other APIs related to
tab index management
, tab indices are treated as a hierarchy by default. By setting the relative tab position of a canvas which is not itself focusable but has focusable descendents, these descendents' tab position will be updated.Note that after this method has been called, the tab position can be modified by subsequent code to shift another sibling in front of this one, or reparent this canvas.
- Parameters:
position
- new relative tab position
-
setRight
public void setRight(int right) Resizes the widget horizontally to position its right side at the specified coordinate.NOTE: if you're setting multiple coordinates, use setRect(), moveTo() or resizeTo() instead
- Parameters:
right
- new right coordinate- See Also:
-
shouldDragScroll
public void shouldDragScroll()If this widget is showing scrollbars, and a user drags close to the edge of the viewport, should we scroll the viewport in the appropriate direction? Returns this.canDragScroll if there are scrollbars, else false.- See Also:
-
show
public void show()Sets this widget's visibility to "inherit", so that it becomes visible if all of its parents are visible or it has no parents.If the widget has not yet been drawn (and doesn't have a parent or master), this method calls the draw method as well.
-
showComponentMask
public void showComponentMask()Temporariy block all user interaction with children of this widget, with the exception of those passed in in theunmaskedChildren
parameter. Children will remain blocked untilhideComponentMask()
is called.This method will show the
componentMask
canvas to block mouse interaction with children, and temporarily remove masked children from the page's tab-order.This behavior differs from the standard
click mask
in that the modal mask shown byshowClickMask()
will cover the entire screen and typically only allow "unmasking" of top level components.Use
hideComponentMask()
to hide the component level mask. -
showComponentMask
Temporariy block all user interaction with children of this widget, with the exception of those passed in in theunmaskedChildren
parameter. Children will remain blocked untilhideComponentMask()
is called.This method will show the
componentMask
canvas to block mouse interaction with children, and temporarily remove masked children from the page's tab-order.This behavior differs from the standard
click mask
in that the modal mask shown byshowClickMask()
will cover the entire screen and typically only allow "unmasking" of top level components.Use
hideComponentMask()
to hide the component level mask.- Parameters:
unmaskedChildren
- Children passed into this parameter will continue to be interactive while other children are blocked. They will be moved above the componentMask in the page's z-order and remain accessible via keyboard navigation. Note that this array should contain direct children of this widget only.
-
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
-
showNextTo
Show this widget next to another widget on the page, positioned such that it will not extend beyond the browser viewport.Note that this method simply sets the coordinates of the widget and displays it (using a
animateShow()
by default). It will not change theparentElement
of either component.An example use case might be showing a menu next to a menu-button.
- Parameters:
otherWidget
- Canvas to show next to
-
showNextTo
-
showNextTo
-
showNextTo
Show this widget next to another widget on the page, positioned such that it will not extend beyond the browser viewport.Note that this method simply sets the coordinates of the widget and displays it (using a
animateShow()
by default). It will not change theparentElement
of either component.An example use case might be showing a menu next to a menu-button.
- Parameters:
otherWidget
- Canvas to show next toside
- Which side of the other canvas should we put. Options are "top", "bottom", "left", "right". (Defaults to "right")canOcclude
- This argument controls whether this canvas can be positioned on top of the other widget if there isn't room to put it next to the other widget extending out of the browser viewport
If 'canOcclude' is true, simply shift this widget over the other widget, so that it ends up onscreen. If 'canOcclude' is false, avoid extending offscreen by positioning this widget on the other side of the other widget.skipAnimation
- Iffalse
do not use an animation to show the component.
-
showPendingMarker
public void showPendingMarker()Manually move this component into the "pending changes" visual state (based on thependingMarker style
, or the Pending suffix in stateful components).This is used for components that don't automatically track whether there are unsaved changes, such as tabs. Other components (such as
ListGrid
andDynamicForm
) show the"pending" visual state
automatically based on whether the end user has edited particular field values. -
showRecursively
public void showRecursively()Recursively show the canvas and all its parents so the canvas will be visible.If the widget has not yet been drawn, this method calls the draw method as well.
- See Also:
-
updateChildTabPosition
Ensure that a specific child is slotted correctly into the page's tab order. Default implementation will, ifupdateTabPositionOnReparent
is true, ensure the child canvas shows up in theTabIndexManager
tree under the entry for this widget (the parent), in the position returned bygetChildTabPosition()
.This method is called automatically in cases where a single child's tab position may need to be updated - such as if a child is added to a drawn parent.
See also
updateChildTabPositions()
- Parameters:
child
- child to have tab position updated.
-
updateChildTabPositions
public void updateChildTabPositions()Update the childrens' tab positions, slotting them under this widget in theTabIndexManager
, in the order defined bygetChildTabPosition()
. This method will skip any children whereupdateTabPositionOnReparent
is false.This method is called automatically on canvas draw(). It may be overridden by subclasses for custom tab-order behavior.
-
updateHover
public void updateHover()If this canvas is currently showing a hover (seehandleHover()
), this method can be called to update the HTML contents of the hover. Has no effect if this widget is showinghover-components instead of simple HTML
, or if the hover canvas is not showing for this widget. -
updateHover
If this canvas is currently showing a hover (seehandleHover()
), this method can be called to update the HTML contents of the hover. Has no effect if this widget is showinghover-components instead of simple HTML
, or if the hover canvas is not showing for this widget.- Parameters:
hoverHTML
- Option to specify new HTML for the hover. If not passed, the result ofthis.getHoverHTML()
will be used instead. Note that if the hover HTML is empty the hover will be hidden.
-
updateTabPositionForDraw
public void updateTabPositionForDraw()This method is executed on draw. Default implementation for top-level widgets ensures this widget is at the end of the tab-sequence.Has no effect if this canvas is embedded in a
parent
. -
addVisibilityChangedHandler
Add a visibilityChanged handler.Notification fired when this canvas becomes visible or hidden to the user. Note - this method is fired when the
Canvas.isVisible()
state of this component changes. It may be fired in response an explicit call toCanvas.show()
orCanvas.hide()
, or in response to a parent component being shown or hidden when this widgetsCanvas.visibility
is set to "inherit".Note that a call to
Canvas.show()
orCanvas.hide()
will not always fire this notification. If this widget has a hidden parent, show or hide would change this componentsCanvas.visibility
property, and may update the CSS visibility attribute of the drawn handle in the DOM, but would not actually hide or reveal the component to the user and as such the notification would not fire.Note also that this notification will only be fired for components which have been
drawn
.- Specified by:
addVisibilityChangedHandler
in interfaceHasVisibilityChangedHandlers
- Parameters:
handler
- the visibilityChanged handler- Returns:
HandlerRegistration
used to remove this handler
-
getEventEdge
Check if an event is within an "edge" of this canvas.- Returns:
- edge where the mouse is positioned, or null if not within a legal edge (including being in the center)
- See Also:
-
getEventEdge
Check if an event is within an "edge" of this canvas.- Parameters:
edgeMask
- Array of legal edges. Default is all the edges that allow resizing (seeresizeFrom
)- Returns:
- edge where the mouse is positioned, or null if not within a legal edge (including being in the center)
- See Also:
-
getSnapPosition
Return the position forsnapper
to be placed in order to "snap to" an edge or corner oftarget
, in the same sense assnapTo
.Default for
snapEdge
is the opposite edge or corner fromsnapTo
. For example,snapTo
of "T" (top) meanssnapEdge
will default to "B" (bottom), so the returned coordinates would placesnapper
centered along the top edge oftarget
. AsnapTo
of "TL" (top left) meanssnapEdge
will default to "BR" (bottom right), so the returned coordinates would place the bottom right ofsnapper
at the top left corner oftarget
.target
can be passed as either a Canvas or 4-element Array giving the top, left, width and height of the target.- Parameters:
target
- canvas to snap tosnapTo
- edge against which to snapsnapper
- canvas being snapped- Returns:
- the position for
snapper
to be placed in order to "snap to" an edge or corner oftarget
-
getSnapPosition
Return the position forsnapper
to be placed in order to "snap to" an edge or corner oftarget
, in the same sense assnapTo
.Default for
snapEdge
is the opposite edge or corner fromsnapTo
. For example,snapTo
of "T" (top) meanssnapEdge
will default to "B" (bottom), so the returned coordinates would placesnapper
centered along the top edge oftarget
. AsnapTo
of "TL" (top left) meanssnapEdge
will default to "BR" (bottom right), so the returned coordinates would place the bottom right ofsnapper
at the top left corner oftarget
.target
can be passed as either a Canvas or 4-element Array giving the top, left, width and height of the target.- Parameters:
target
- canvas to snap tosnapTo
- edge against which to snapsnapper
- canvas being snappedsnapEdge
- optional edge to snapTo. Default is the opposite edge or corner fromsnapTo
- Returns:
- the position for
snapper
to be placed in order to "snap to" an edge or corner oftarget
-
registerFontScaledPaddingStyles
public static void registerFontScaledPaddingStyles(String[] scaledStyles, String[] baselineStyles, int targetSizeChange) Registers one or more CSS classes to have their padding adjusted (independently on all edges) according to thepadding size change
applied to the page. Each class to be registered is provided along with a corresponding baseline class, and a singletargetSizeChange
is specified for all the classes. The padding in each registered class is adjusted downward towards the baseline as the padding size change approaches 0 (no resizing), and upward as it increases, so that it exactly equals the declared style's padding at a padding size change oftargetSizeChange
.Note that each call to this method replaces the registration of the previous call (if any), and will have no effect until
resizePadding()
is called.For example:
isc.Canvas.registerFontScaledPaddingStyles( [ "tabButtonTop", "tabButtonBottom"], ["iconOnlyTabButtonTop", "iconOnlyTabButtonBottom"], 3 );
In this case, the CSS style "tabButtonTop" will have its padding adjusted downward to the padding from the baseline CSS style "iconOnlyTabButtonTop" style at asizeChange
of 0, and be left unchanged at asizeChange
of 3.- Parameters:
scaledStyles
- styles whose padding should be adjustedbaselineStyles
- corresponding baseline reference stylestargetSizeChange
- sizeChange at which scaledStyles are unchanged- See Also:
-
resizeFonts(int)
resizePadding(int)
resizeControls(int)
com.smartgwt.client.widgets.Canvas#registerIconSizingAttributes
-
resizeAutoChildAttributes
Change the value of attributes registered viaregisterAutoChildSizingAttributes()
by some number of pixels. This method may be invoked automatically fromresizeControls()
orresizeFonts()
Must be called after the skin has been loaded, but before any components are created.
- Parameters:
policy
- Which set of attributes should be resized? This should correspond to the sizing policy argument applied whenregistering the icon sizing attributes
.delta
- number of pixels to increase or decrease from current size
-
resizeControls
public static void resizeControls(int delta) Change the basic size of UI components in the current skin by "delta" pixels. Must be called after the skin has been loaded, but before any components are created.In general, this method changes the height of various controls, except for certain controls that appear in alternate orientations (such as resizeBars and tabs), in which case thickness properties (resizeBarThickness, tabBarThickness) are adjusted.
The height of a text input control implies the height of most other controls:
- all other FormItems (eg selects) need to be the same height or mixed controls will look odd. This includes Buttons
- anything that potentially contains a FormItem needs to be
as tall or slightly taller: this includes grid row (inline editing),
Window headers
, TabBar and SectionHeaders
Because of this necessary uniformity, just specifying a single pixel value is enough for the framework to resize all core controls, with several caveats:
- skins that make extensive use of images (eg TreeFrog) will stretch those
images, which may result in ugly artifacts in some combinations of operating system and browser, for which no
workaround is possible. For this reason,
resizeControls()
is only officially supported inCSS3 Mode
, which includes any of the skins in ourFlat series
(Tahoe, Stratus, Obsidian and Twilight) orEnterprise series
(Enterprise/Blue and Graphite), or a custom skin based on one of those - including any skin generated by theSkin Editor
. - even in
Enterprise-series skins,
tree connector lines
vertically stretch, becoming obviously blurry and misshapen with an increase of 4-5px. To avoid this, replace the tree connector media (seeTreeGrid.connectorImage
). -
FormItemIcon
s are not resized by default, because stretched icons generally look worse than non-scaled icons that are a bit smaller than the input field - images that use
spriting
will not be stretched because the sizes for these controls are embedded in CSS. In most cases, this is desirable; for example, the downward chevron shape used for SelectItem controls doesn't stretch, and looks better that way.
- Parameters:
delta
- number of pixels to increase or decrease from current size
-
resizeControlsTo
public static void resizeControlsTo(int targetDelta) Resizes controls as if callingresizeControls()
, but takes a final target size instead of a delta representing the change from a current size. Note that all the same limitations apply.- Parameters:
targetDelta
- the final size, expressed as a differential from the default
-
resizeFonts
public static void resizeFonts(int sizeChange) Modify the size of fonts for some or all stylesheets defined in the page.This method can be used to dynamically increase or decrease font size for all of the fonts in your application, or just fonts defined in your chosen Smart GWT skin (the latter can be achieved by passing
styleSheets
as "skin_styles.css" - the default name for the CSS file used in each Smart GWT skin).resizeFonts()
must be called after the skin has been loaded, and before any components have been created. CallingresizeFonts()
at a later time is not supported (you will notice that font sizes still increase, however, this approach is not supported).Some browsers will disallow access or modification of styleSheets if they are loaded from a domain that is different from the loading page. In this case
resizeFonts()
cannot be used.This method has a small performance penalty which depends on the browser, number of stylesheets being modified, and age of your machine. With modern browsers on modern machines resizing just skin fonts, the impact is basically negligible (<5ms).
Certain controls such as icons are resized when fonts are resized (see
setAutoResizeIcons()
andsetAutoResizeAutoChildAttributes()
) so you might want to setresizeRelatedControls
tofalse
where you are just trying to make fonts in a dynamically loaded stylesheet match previously loaded fonts, but controls such as icons should not be resized upwards again.- Parameters:
sizeChange
- size to change fonts by. Can be negative to shrink fonts
-
resizeFonts
- See Also:
-
resizeFonts
Modify the size of fonts for some or all stylesheets defined in the page.This method can be used to dynamically increase or decrease font size for all of the fonts in your application, or just fonts defined in your chosen Smart GWT skin (the latter can be achieved by passing
styleSheets
as "skin_styles.css" - the default name for the CSS file used in each Smart GWT skin).resizeFonts()
must be called after the skin has been loaded, and before any components have been created. CallingresizeFonts()
at a later time is not supported (you will notice that font sizes still increase, however, this approach is not supported).Some browsers will disallow access or modification of styleSheets if they are loaded from a domain that is different from the loading page. In this case
resizeFonts()
cannot be used.This method has a small performance penalty which depends on the browser, number of stylesheets being modified, and age of your machine. With modern browsers on modern machines resizing just skin fonts, the impact is basically negligible (<5ms).
Certain controls such as icons are resized when fonts are resized (see
setAutoResizeIcons()
andsetAutoResizeAutoChildAttributes()
) so you might want to setresizeRelatedControls
tofalse
where you are just trying to make fonts in a dynamically loaded stylesheet match previously loaded fonts, but controls such as icons should not be resized upwards again.- Parameters:
sizeChange
- size to change fonts by. Can be negative to shrink fontsstyleSheets
- optional regular expression pattern for matching stylesheetsresizeRelatedControls
- resize icons and autoChild attributes? Set to false to suppress default behavior.
-
resizeFontsTo
public static void resizeFontsTo(int targetDelta) Resizes fonts as if callingresizeFonts()
, but takes a final target size instead of a delta representing the change from a current size. Note that all the same limitations apply.- Parameters:
targetDelta
- the final size, expressed as a differential from the default
-
resizeIcons
Change the basic size of icons in the current skin by "delta" pixels. This method may be invoked automatically fromresizeControls()
.Must be called after the skin has been loaded, but before any components are created.
- Parameters:
policy
- Which set of icons should be resized? This should correspond to the iconSizingPolicy argument applied whenregistering the icon sizing attributes
.delta
- number of pixels to increase or decrease from current size
-
resizePadding
public static void resizePadding(int fontSizeChange) Modify the amount of padding for some CSS styles defined for the page. Only CSS styles registered byregisterFontScaledPaddingStyles()
are modified.resizePadding()
must be called after the skin has been loaded, and before any components have been created. CallingresizePadding()
at a later time is not supported (you will notice that padding is modified, however, this approach is not supported).This method has similar browser security limitations as
resizeFonts()
.The intent is that the same font size change be passed to this method as is passed to
resizeFonts()
, so that thetargetSizeChange
in the call toregisterFontScaledPaddingStyles()
represents the right font size for the unadjusted styles being registered.- Parameters:
fontSizeChange
- size change to apply to the padding of registered styles, so that they aren't changed at all at the size change passed toregisterFontScaledPaddingStyles()
, and the padding is reduced to baseline style levels at a zero size change.- See Also:
-
resizePadding
Modify the amount of padding for some CSS styles defined for the page. Only CSS styles registered byregisterFontScaledPaddingStyles()
are modified.resizePadding()
must be called after the skin has been loaded, and before any components have been created. CallingresizePadding()
at a later time is not supported (you will notice that padding is modified, however, this approach is not supported).This method has similar browser security limitations as
resizeFonts()
.The intent is that the same font size change be passed to this method as is passed to
resizeFonts()
, so that thetargetSizeChange
in the call toregisterFontScaledPaddingStyles()
represents the right font size for the unadjusted styles being registered.- Parameters:
fontSizeChange
- size change to apply to the padding of registered styles, so that they aren't changed at all at the size change passed toregisterFontScaledPaddingStyles()
, and the padding is reduced to baseline style levels at a zero size change.styleSheets
- optional regular expression pattern for matching stylesheets- See Also:
-
setAllowExternalFilters
public static void setAllowExternalFilters(boolean allExternalFilters) Changes the system-wideallowExternalFilters
setting.- Parameters:
allExternalFilters
- new setting
-
setAutoResizeAutoChildAttributes
public static void setAutoResizeAutoChildAttributes(boolean autoResize) Should registered autoChild attributes be automatically resized withcontrols
andtext
?If true, attributes registered for resize with policy
"controls"
will be resized whenresizeControls()
runs, and icons registered with policy"fonts"
will resize whenresizeFonts()
runs.To resize autoChild attributes with other policies, developers should call
resizeAutoChildAttributes()
directly- Parameters:
autoResize
- true if attributes should be auto-resized
-
setAutoResizeIcons
public static void setAutoResizeIcons(boolean autoResizeIcons) Should icons be automatically resized withcontrols
andtext
?If true, icon attributes registered for resize with policy
"controls"
will be resized whenresizeControls()
runs, and icons registered with policy"fonts"
will resize whenresizeFonts()
runs.To resize icons with other policies, developers should call
resizeIcons()
directly- Parameters:
autoResizeIcons
- true if icons should be auto-resized
-
setDefaultPageSpace
public static void setDefaultPageSpace(int newDefaultPageSpace) Changes the globaldefaultPageSpace
.- Parameters:
newDefaultPageSpace
- the new value fordefaultPageSpace
.
-
setNeverUseFilters
public static void setNeverUseFilters(boolean neverUseFilters) Changes the system-wideneverUseFilters
setting.- Parameters:
neverUseFilters
- new setting
-
startDebuggingOverflow
Start to track and report excessive overflow per the supplied settings.- Parameters:
settings
-- See Also:
-
stopDebuggingOverflow
public static void stopDebuggingOverflow()Stop tracking and reporting excessive overflow. -
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:
canvasProperties
- properties that should be used as new defaults when instances of this class are created- See Also:
-
getTestInstance
-
getById
Retrieve a Canvas by its globalID
.- Parameters:
ID
- global ID of the Canvas- Returns:
- the Canvas, or null if not found or not a Canvas
-
getByJSObject
Retrieve a Canvas from itsJavaScriptObject
.- Parameters:
jsObj
- SmartClient object associated with Canvas- Returns:
- the Canvas, or null if not found or not a Canvas
-
setElement
Normal usage of SmartGWT is to call draw() on SmartGWT widgets, not to use use RootPanel.add(). Developers will not typically need to call getElement() or setElement() for SmartGWT canvas instances. If developers do need to access the DOM elements created by a drawn SmartGWT component, they should usegetOuterElement()
andgetContentElement()
. See the javadoc for those methods for more information. Note particularly that these elements should not be directly manipulated in the DOM - instead standard SmartGWT APIs such as draw(), clear(), setContents(), addChild(), redraw() should be used. See alsosetHtmlElement(Element)
for how to embed a SmartGWT component into an existing DOM element.getElement() and setEleent() exist solely to support adding SmartGWT widgets to a core GWT layout manager. This usage has limitations and caveats - see this list of <a href=http://forums.smartclient.com/showthread.php?t=8159#aMix>Frequently Asked Questions.
The mechanism that getElement() uses to integrate with core GWT is the same as that described for
com.smartgwt.client.widgets.Canvas#setHTMLElement(Element)
and has the same caveats- Overrides:
setElement
in classUIObject
-
getElement
Normal usage of SmartGWT is to call draw() on SmartGWT widgets, not to use use RootPanel.add(). Developers will not typically need to call getElement() or setElement() for SmartGWT canvas instances. If developers do need to access the DOM elements created by a drawn SmartGWT component, they should usegetOuterElement()
andgetContentElement()
. See the javadoc for those methods for more information. Note particularly that these elements should not be directly manipulated in the DOM - instead standard SmartGWT APIs such as draw(), clear(), setContents(), addChild(), redraw() should be used. See alsosetHtmlElement(Element)
for how to embed a SmartGWT component into an existing DOM element.getElement() and setEleent() exist solely to support adding SmartGWT widgets to a core GWT layout manager. This usage has limitations and caveats - see this list of <a href=http://forums.smartclient.com/showthread.php?t=8159#aMix>Frequently Asked Questions.
The mechanism that getElement() uses to integrate with core GWT is the same as that described for
com.smartgwt.client.widgets.Canvas#setHTMLElement(Element)
and has the same caveats- Overrides:
getElement
in classUIObject
-
getElement
- Parameters:
allowPreRender
-- Returns:
- See Also:
-
asSGWTComponent
Returns the existing SGWT widget, or creates and returns one if none exist, associated with the suppliedJavaScriptObject
. If the supplied object is not a SmartClient Canvas, a warning will be logged and null returned; otherwise the widget will be returned as the appropriate subtype of SGWT Canvas.- Parameters:
jsObj
- SmartClient Canvas whose wrapper is wanted- Returns:
- wrapping SGWT Canvas, appropriately subtyped, or null
-
getByLocalId
Retrieve a child of this Canvas by it's local ID.A "local ID" is name for a child widget which is unique only for this parent, and not globally unique as is required for
ID
. Widgets receive local IDs when loaded viacom.smartgwt.client.client.rpc.RPCManager#loadScreen()
orcom.smartgwt.client.rpc.RPCManager#cacheScreens()
andcom.smartgwt.client.rpc.RPCManager#createScreen()
.- Parameters:
ID
- global ID of the Canvas- Returns:
- the Canvas, or null if not found
-
getClassName
Returns the JavaScript class name.- Overrides:
getClassName
in classBaseWidget
- Returns:
- the JavaScript class name.
-
setInitHandler
Specify a notification method to fire when this Canvas is initialized in JavaScript. This allows developers to set up form item state dynamically when the item is created.- Parameters:
initHandler
-
-
onInit
protected void onInit()- Overrides:
onInit
in classBaseWidget
-
onDetach
protected void onDetach() -
onAttach
protected void onAttach() -
addStyleName
Multiple styles are currently not supported. This method essentially callssetStyleName(String)
- Overrides:
addStyleName
in classUIObject
- Parameters:
style
- the style name- See Also:
-
setVisible
public void setVisible(boolean visible) - Specified by:
setVisible
in interfaceHasVisibility
- Overrides:
setVisible
in classUIObject
-
setHeight
- See Also:
-
setHeight100
Convenience method that sets the height to 100%. -
getHeightAsString
-
setTitle
Synonym forsetPrompt(String)
- Overrides:
setTitle
in classBaseWidget
- Parameters:
title
- the title
-
getTitle
Synonym forgetPrompt()
- Overrides:
getTitle
in classBaseWidget
- Returns:
- the title
-
setTooltip
Synonym forsetPrompt(String)
- Parameters:
tooltip
- the tooltip- Returns:
Canvas
instance, for chaining setter calls
-
getTooltip
Synonym forgetPrompt()
- Returns:
- the tooltip
-
setWidth
- See Also:
-
setWidth100
Convenience method that sets the width to 100%. -
getWidthAsString
-
getLeftAsString
Number of pixels the left side of the widget is offset to the right from its default drawing context (either its parent's topleft corner, or the document flow, depending on the value of theposition
property).Can also be set as a percentage, specified as a String ending in '%', eg, "50%". In this case the top coordinate is considered as a percentage of the specified width of the
'parent'
.- Returns:
- Return the left coordinate of this object, relative to its enclosing context, in pixels.
-
getFacetId
If a Canvas is dropped onto aCubeGrid
, and it has afacetId
property specified then the Cube treats this as adding that facetId at the drop location.- Returns:
- the facet id
-
setFacetId
If a Canvas is dropped onto aCubeGrid
, and it has a facetId property specified then the Cube treats this as adding that facetId at the drop location.- Parameters:
facetId
- the facet id- Returns:
Canvas
instance, for chaining setter calls
-
getTopAsString
Number of pixels the top of the widget is offset down from its default drawing context (either its parent's top-left corner, or the document flow, depending on the value of theposition
property).Can also be set as a percentage, specified as a String ending in '%', eg, "50%". In this case the top coordinate is considered as a percentage of the specified height of the
'parent'
.- Returns:
- Return the top coordinate of this object, relative to its enclosing context, in pixels.
-
setAlign
-
getAbsoluteLeft
public int getAbsoluteLeft()This method is similar togetPageLeft()
.- Overrides:
getAbsoluteLeft
in classUIObject
- Returns:
-
getAbsoluteTop
public int getAbsoluteTop()This method is similar togetPageTop()
.- Overrides:
getAbsoluteTop
in classUIObject
- Returns:
-
setAnimateShowEffect
Default animation effect to use ifanimateShow()
is called without an explicit effect parameter.- Parameters:
animateShowEffect
- the animate show effect. Default is "wipe"- Returns:
Canvas
instance, for chaining setter calls
-
getAnimateShowEffect
Default animation effect to use ifanimateShow()
is called without an explicit effect parameter.- Returns:
- animation effect. Default value is "wipe"
-
getAnimateHideEffect
Default animation effect to use ifanimateHide()
is called without an explicit effect parameter.- Returns:
- animation effect. Default value is "wipe"
-
setAnimateHideEffect
Default animation effect to use ifanimateHide()
is called without an explicit effect parameter.- Parameters:
animateHideEffect
- the animate show effect. Default is "wipe"- Returns:
Canvas
instance, for chaining setter calls
-
setDisabled
If set to true, the widget will be disabled. A widget is only considered enabled if it is individually enabled and all parents above it in the containment hierarchy are enabled. This allows you to enable or disable all components of a complex nested widget by enabling or disabling the top-level parent only. set the disabled state of this objectNote : This is an advanced setting
- Parameters:
disabled
- new disabled state of this object - passtrue
to disable the widget. Default value is false- Returns:
Canvas
instance, for chaining setter calls
-
getDisabled
public boolean getDisabled()If set to true, the widget will be disabled. A widget is only considered enabled if it is individually enabled and all parents above it in the containment hierarchy are enabled. This allows you to enable or disable all components of a complex nested widget by enabling or disabling the top-level parent only.- Returns:
- Is this canvas disabled? Note that the disabled state is inherited - this method will return true if this widget, or any of its ancestors are marked disabled.
-
willAcceptDrop
Returns true if the widget object being dragged can be dropped on this widget, and false or null otherwise. The default implementation of this method simply compares thedragType
of thedragTarget
(the component being dragged from) with the list ofdropTypes
on this Canvas. If thedropTypes
list contains thedragType
value, then this method returns true. Otherwise it returns false.No matter what you return, the
onDropOver
andonDropMove
handlers will still be called, and their return value will control whether those events are bubbled to parent elements.However, what you return from
willAcceptDrop()
does determine whether theonDrop
handler will be called.- If you return true, then
onDrop()
will be called, and its return value will determine whether the event is bubbled to parent elements. - If you return false, then
onDrop()
will not be called, and the event will not be bubbled. - If you return null, then
onDrop()
will not be called, but the event will be bubbled to parent elements (giving them a chance to handle the drop).
So, you should return false to definitively deny a drop, and return null if it could make sense to allow a parent element (such as a
Layout
) to handle the drop.Note: This is an override point
- Returns:
- true if the widget object being dragged can be dropped on this widget, false if it cannot (and a drop event should not be bubbled), and null to permit a drop event to bubble to parent elements.
- If you return true, then
-
parentResized
protected void parentResized()Fires when the interior size of the parent changes, including parent resize and scrollbar introduction or removal.This method allows a child to implement a layout policy that can be used within any parent, such as a Resizer component that always snaps to the parent's bottom-right corner. The default implementation of this method applies a child's percent sizes, if any, or implements layout based on the
snapTo
property.Make sure you call super.parentResized() if you'd like the default behavior to apply.
Note: This is an override point -
getHoverComponent
WhenshowHoverComponents
is true, this method is called to get the component to show as a hover for this Canvas. There is no default implementation of this method, so you need to override it with an implementation that returns a Canvas that suits your needs.By default, components returned by
getHoverComponent()
will not be automatically destroyed when the hover is hidden. To enforce this, sethoverAutoDestroy
to true on the returned component.
Note: this is an override point- Returns:
- the component to show as a hover
-
setSmoothFade
- Throws:
IllegalStateException
-
setKeepInParentRect
-
setPrefix
-
getPrefix
-
setResizeFrom
Deprecated.use#setResizeFrom(EdgeName)
instead.Allows resizing in certain edges or corners. The default value of null indicates that the widget is resizable from any corner or edge. To restrict resizing to only certain corners, set resizeFrom to an array of any of the values listed:
T top edge
B bottom edge
L left edge
R right edge
TL top-left corner
TR top-right corner
BL bottom-left corner
BR bottom-right corner
E.g. setting this property to a value of ["R","TR","BR"] would restrict resizing to the right edge, top-right corner and bottom-right corner only- Parameters:
resizeFrom
- resizeFrom values- Returns:
Canvas
instance, for chaining setter calls
-
resizeTo
Resizes the widget to the specified width and height (moves the right and/ or bottom sides of the widget). The width and height parameters can be expressed as a percentage of viewport size or as the number of pixels.- Parameters:
width
- new width for canvasheight
- new height for canvas- Returns:
- whether the size actually changed
-
setProportionalResizeModifiers
public Canvas 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"]- Returns:
Canvas
instance, for chaining setter calls- 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...
-
isVisible
public boolean isVisible()Returns true if the widget is visible, taking all parents into account, so that a widget which is not hidden might still report itself as not visible if it is within a hidden parent.NOTE: Undrawn widgets will report themselves as visible if they would be visible if drawn.
- Specified by:
isVisible
in interfaceHasVisibility
- Overrides:
isVisible
in classUIObject
- Returns:
- true if the widget is visible, false otherwise
-
animateScroll
Animate a scroll from the current scroll position to the specified position.- Parameters:
scrollLeft
- desired final left scroll postionscrollTop
- desired final top scroll postioncallback
- When the scroll completes this callback will be fired. Single 'earlyFinish' parameter will be passed if the animation was cut short by a call to finishAnimation
-
animateScroll
Animate a scroll from the current scroll position to the specified position.- Parameters:
scrollLeft
- desired final left scroll postionscrollTop
- desired final top scroll postioncallback
- When the scroll completes this callback will be fired. Single 'earlyFinish' parameter will be passed if the animation was cut short by a call to finishAnimationduration
- Duration in ms of the animated scroll
-
animateFade
public void animateFade(int opacity) Animate a change in opacity from the widget's current opacity to the specified opacity.- Parameters:
opacity
- desired final opacity
-
animateFade
Animate a change in opacity from the widget's current opacity to the specified opacity.- Parameters:
opacity
- desired final opacitycallback
- When the fade completes this callback will be fired. Single 'earlyFinish' parameter will be passed if the animation was cut short by a call to finishAnimation
-
animateFade
Animate a change in opacity from the widget's current opacity to the specified opacity.- Parameters:
opacity
- desired final opacitycallback
- When the fade completes this callback will be fired. Single 'earlyFinish' parameter will be passed if the animation was cut short by a call to finishAnimationduration
- Duration in ms of the animated fade
-
animateFade
public void animateFade(int opacity, AnimationCallback callback, int duration, AnimationAcceleration acceleration) Animate a change in opacity from the widget's current opacity to the specified opacity.- Parameters:
opacity
- desired final opacitycallback
- When the fade completes this callback will be fired. Single 'earlyFinish' parameter will be passed if the animation was cut short by a call to finishAnimationduration
- Duration in ms of the animated fadeacceleration
- Animation acceleration to bias the ratios
-
animateHide
public void animateHide()Hide a canvas by shrinking it with default effect specified byanimateHideEffect
. This method will not fire if the widget is already drawn and visible, or has overflow other than"visible"
or"hidden"
. -
animateHide
Hide a canvas by shrinking it vertically to zero height over a period of time. This method will not fire if the widget is already drawn and visible, or has overflow other than"visible"
or"hidden"
.- Parameters:
effect
- How should the content of the window be hidden during the hide? If omitted, default behavior can be configured viaanimateHideEffect
-
animateHide
Hide a canvas by shrinking it vertically to zero height over a period of time. This method will not fire if the widget is already drawn and visible, or has overflow other than"visible"
or"hidden"
.- Parameters:
effect
- How should the content of the window be hidden during the hide? If omitted, default behavior can be configured viaanimateHideEffect
-
animateHide
Hide a canvas by shrinking it vertically to zero height over a period of time. This method will not fire if the widget is already drawn and visible, or has overflow other than"visible"
or"hidden"
.- Parameters:
effect
- How should the content of the window be hidden during the hide? If omitted, default behavior can be configured viaanimateHideEffect
callback
- When the hide completes this callback will be fired. Single 'earlyFinish' parameter will be passed if the animation was cut short by a call to finishAnimation.
-
animateHide
Hide a canvas by shrinking it vertically to zero height over a period of time. This method will not fire if the widget is already drawn and visible, or has overflow other than"visible"
or"hidden"
.- Parameters:
effect
- How should the content of the window be hidden during the hide? If omitted, default behavior can be configured viaanimateHideEffect
callback
- When the hide completes this callback will be fired. Single 'earlyFinish' parameter will be passed if the animation was cut short by a call to finishAnimation.
-
animateHide
Hide a canvas by shrinking it vertically to zero height over a period of time. This method will not fire if the widget is already drawn and visible, or has overflow other than"visible"
or"hidden"
.- Parameters:
effect
- How should the content of the window be hidden during the hide? If omitted, default behavior can be configured viaanimateHideEffect
callback
- When the hide completes this callback will be fired. Single 'earlyFinish' parameter will be passed if the animation was cut short by a call to finishAnimation.duration
- Duration in ms of the animated hide. If unset, duration will be picked up fromanimateHideTime
-
animateHide
Hide a canvas by shrinking it vertically to zero height over a period of time. This method will not fire if the widget is already drawn and visible, or has overflow other than"visible"
or"hidden"
.- Parameters:
effect
- How should the content of the window be hidden during the hide? If omitted, default behavior can be configured viaanimateHideEffect
callback
- When the hide completes this callback will be fired. Single 'earlyFinish' parameter will be passed if the animation was cut short by a call to finishAnimation.duration
- Duration in ms of the animated hide. If unset, duration will be picked up fromanimateHideTime
-
animateShow
public void animateShow()Show a canvas by growing it with default effect specified byanimateShowEffect
. This method will not fire if the widget is already drawn and visible, or has overflow other than"visible"
or"hidden"
. -
animateShow
Show a canvas by growing it vertically to its fully drawn height over a period of time. This method will not fire if the widget is already drawn and visible, or has overflow other than"visible"
or"hidden"
.- Parameters:
effect
- Animation effect to use when revealing the widget. If omitted, default behavior can be configured viaanimateShowEffect
-
animateShow
Show a canvas by growing it vertically to its fully drawn height over a period of time. This method will not fire if the widget is already drawn and visible, or has overflow other than"visible"
or"hidden"
.- Parameters:
effect
- AnimateShowEffect effect to use when revealing the widget. If omitted, default behavior can be configured viaanimateShowEffect
-
animateShow
Show a canvas by growing it vertically to its fully drawn height over a period of time. This method will not fire if the widget is already drawn and visible, or has overflow other than"visible"
or"hidden"
.- Parameters:
effect
- Animation effect to use when revealing the widget. If omitted, default behavior can be configured viaanimateShowEffect
callback
- When the show completes this callback will be fired. Single 'earlyFinish' parameter will be passed if the animation was cut short by a call to finishAnimation.
-
animateShow
Show a canvas by growing it vertically to its fully drawn height over a period of time. This method will not fire if the widget is already drawn and visible, or has overflow other than"visible"
or"hidden"
.- Parameters:
effect
- AnimateShowEffect effect to use when revealing the widget. If omitted, default behavior can be configured viaanimateShowEffect
callback
- When the show completes this callback will be fired. Single 'earlyFinish' parameter will be passed if the animation was cut short by a call to finishAnimation.
-
animateShow
Show a canvas by growing it vertically to its fully drawn height over a period of time. This method will not fire if the widget is already drawn and visible, or has overflow other than"visible"
or"hidden"
.- Parameters:
effect
- Animation effect to use when revealing the widget. If omitted, default behavior can be configured viaanimateShowEffect
callback
- When the show completes this callback will be fired. Single 'earlyFinish' parameter will be passed if the animation was cut short by a call to finishAnimation.duration
- Duration in ms of the animated show. If unset, duration will be picked up fromanimateShowTime
-
animateShow
Show a canvas by growing it vertically to its fully drawn height over a period of time. This method will not fire if the widget is already drawn and visible, or has overflow other than"visible"
or"hidden"
.- Parameters:
effect
- AnimateShowEffect effect to use when revealing the widget. If omitted, default behavior can be configured viaanimateShowEffect
callback
- When the show completes this callback will be fired. Single 'earlyFinish' parameter will be passed if the animation was cut short by a call to finishAnimation.duration
- Duration in ms of the animated show. If unset, duration will be picked up fromanimateShowTime
-
updateShadow
public void updateShadow()Update the canvas shadow. -
getZIndex
public int getZIndex()Get the z-Index of this canvas.- Returns:
- the zIndex
-
getNextZIndex
public int getNextZIndex()get the next zIndex for the next item to be drawn. see setZIndex() for notes- Returns:
- the next zIndex
-
setZIndex
Set the z-Index of the canvas.- Parameters:
newIndex
- the new zIndex to set to- Returns:
Canvas
instance, for chaining setter calls
-
getPageRect
-
setRect
Set all four coordinates, relative to the enclosing context, at once.Moves the widget so that its top-left corner is at the specified top-left coordinates, then resizes it to the specified width and height.
- Parameters:
rectangle
- new coordinates- Returns:
Canvas
instance, for chaining setter calls
-
setRect
Set all four coordinates, relative to the enclosing context, at once.Moves the widget so that its top-left corner is at the specified top-left coordinates, then resizes it to the specified width and height.
- Parameters:
left
- new left coordinatetop
- new top coordinatewidth
- new widthheight
- new height- Returns:
Canvas
instance, for chaining setter calls
-
getRect
Get all four coordinates, relative to the enclosing context, at one.- Returns:
- the Rectangle
-
getImgURL
Return the full URL for an image to be drawn in this canvas.If the passed URL begins with the special prefix "[SKIN]", it will have the widget.skinImgDir and Page.skinImgDir prepended. Otherwise the image is assumed to be application-specific, and will have the widget.appImgDir and Page.appImgDir automatically prepended.
Note that if passed an absolute path (starting with "/" or "http://" for example), no extra image directory information will be prepended to the generated URL.//
- Parameters:
URL
- URL local to skin or application image directory- Returns:
- URL to use
-
getImgURL
Return the full URL for an image to be drawn in this canvas.If the passed URL begins with the special prefix "[SKIN]", it will have the widget.skinImgDir and Page.skinImgDir prepended. Otherwise the image is assumed to be application-specific, and will have the widget.appImgDir and Page.appImgDir automatically prepended.
Note that if passed an absolute path (starting with "/" or "http://" for example), no extra image directory information will be prepended to the generated URL.//
- Parameters:
URL
- URL local to skin or application image directoryimgDir
- optional image directory to override the default for this Canvas- Returns:
- URL to use
-
imgHTML
Generates the HTML for an image unique to this Canvas.The full URL for the image will be formed according to the rules documented for
.getImgURL(java.lang.String)
The created image will have an identifier unique to this Canvas, and subsequent calls to
andgetImage(java.lang.String)
with the name passed to this function will act on the image object produced by the HTML returned from this call.setImage(java.lang.String, java.lang.String)
- Parameters:
src
- URL local to the skin or application directory.
NOTE: instead of passing several parameters, you can pass an object as the 'src' parameter with properties for all the various function parameters with, eg:
canvas.imgHTML( {src:"foo", width:10, height:10} );- Returns:
- HTML to draw the image.
-
imgHTML
public static String imgHTML(String src, int width, int height, String name, String extraStuff, String imgDir) Generates the HTML for an image unique to this Canvas.The full URL for the image will be formed according to the rules documented for
.getImgURL(java.lang.String)
The created image will have an identifier unique to this Canvas, and subsequent calls to
andgetImage(java.lang.String)
with the name passed to this function will act on the image object produced by the HTML returned from this call.setImage(java.lang.String, java.lang.String)
- Parameters:
src
- URL local to the skin or application directory.
NOTE: instead of passing several parameters, you can pass an object as the 'src' parameter with properties for all the various function parameters with, eg:
canvas.imgHTML( {src:"foo", width:10, height:10} );width
- width of the imageheight
- height of the imagename
- name for the imageextraStuff
- additional attributes to write in the tagimgDir
- image-specific image directory to override the default for this Canvas- Returns:
- HTML to draw the image.
-
imgHTML
-
showPrintPreview
Show a PrintWindow containing a printable view of the component passed in containing print HTML.- Parameters:
component
- to get printable HTML for.
-
showPrintPreview
Show a Print containing a printable view of the components passed in.- Parameters:
components
- components to get the print HTML for. May also include raw HTML strings which will be folded into the generated print output
-
showPrintPreview
public static void showPrintPreview(Object[] components, PrintProperties printProperties, String title, PrintPreviewCallback callback) Show a Print containing a printable view of the components passed in.- Parameters:
components
- components to get the print HTML for. May also include raw HTML strings which will be folded into the generated print outputprintProperties
- for customizing the print HTML output. If this parameter is passed as null, it will be ignored.title
- for the print windowcallback
- to fire when the print preview window has been created and shown
-
showPrintPreview
public static void showPrintPreview(Object[] components, PrintProperties printProperties, String title, PrintPreviewCallback callback, Window printWindowProperties, String printButtonTitle) Show a Print containing a printable view of the components passed in.- Parameters:
components
- components to get the print HTML for. May also include raw HTML strings which will be folded into the generated print outputprintProperties
- for customizing the print HTML output. If this parameter is passed as null, it will be ignored.title
- for the print windowcallback
- to fire when the print preview window has been created and shownprintWindowProperties
- the print window propertiesprintButtonTitle
- the brint button title
-
getPrintHTML
public static void getPrintHTML(Object[] components, PrintProperties printProperties, PrintHTMLCallback callback) Returns print-formatted HTML for the specified list of components.- Parameters:
components
- Components to get the print HTML for. Strings of raw HTML may also be included in this array, and will be integrated into the final HTML at the appropriate point.HTML
.printProperties
- for customizing the print HTML output. If this parameter is passed as null, it will be ignored.callback
- to fire when the HTML has been generated- See Also:
-
getPrintHTML
Retrieves printable HTML for this component and all printable subcomponents.By default any Canvas with children will simply collect the printable HTML of its children by calling getPrintHTML() on each child that is considered
printable
. If a callback is provided, then null is always returned and the callback is fired asynchronously.If overriding this method for a custom component, you should either return a String of printable HTML directly or return null and fire the provided callback using Class.fireCallback().
To return an empty print representation, return an empty string ("") rather than null.
The
printProperties
argument, if passed, must be passed to any subcomponents on whichgetPrintHTML()
is called.Default implementation will set {@link* com.smartgwt.client.widgets.Canvas#getIsPrinting isPrinting} flag to
true
to indicate printing is in* progress, and clear this flag when the printing has completed (possibly via an asynchronous callback).NOTE: Expecting a direct return value from the default implementation is deprecated usage. This is because small changes to an application (such as adding a few more data points to a chart or adding another button) or using certain browsers can make it necessary to generate the HTML asynchronously. Thus, application code should not rely on the return value and always pass a callback.
NOTE: CubeGrid does not support a WYSIWYG print view by default (also used when
exporting to pdf
). Instead we recommendexporting to excel or csv format
.- Parameters:
printProperties
- properties to configure printing behavior - may be null.callback
- optional callback. This is required to handle cases where HTML generation is asynchronous - if a method generates HTML asynchronously, it should return null, and fire the specified callback on completion of HTML generation. The first parameterHTML
should contain the generated print HTML. The callback is only called if null is returned. Furthermore, the default getPrintHTML() implementation always returns null and fires the callback when a callback is provided. SeeCallback
.- Returns:
- null if the print HTML is being generated asynchronously and/or a callback is provided; otherwise, the direct print HTML for this component (but note that returning direct print HTML is a deprecated feature).
- See Also:
-
printComponents
Generate printable HTML for the designated components and trigger the native print dialog, without ever showing the printable HTML to the user.- Parameters:
components
- components to get the print HTML for. May also include raw HTML strings which will be folded into the generated print output
-
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.- Returns:
Canvas
instance, for chaining setter calls- See Also:
-
setAutoChildProperties
public Canvas 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.- Parameters:
autoChildName
- the name of the AutoChildproperties
- AutoChild configuration- Returns:
Canvas
instance, for chaining setter calls- Throws:
IllegalStateException
- ifproperties
has been created.- See Also:
-
setAutoChildProperties
public Canvas 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.- Parameters:
autoChildName
- the name of the AutoChildproperties
- AutoChild configuration- Returns:
Canvas
instance, for chaining setter calls- Throws:
IllegalStateException
- ifproperties
has been created.- See Also:
-
setAutoChildProperties
public Canvas 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
).- Parameters:
autoChildName
- the name of the AutoChildproperties
- AutoChild configuration- Returns:
Canvas
instance, for chaining setter calls- Throws:
IllegalStateException
- ifproperties
has been created.- See Also:
-
setAutoChildProperties
public Canvas setAutoChildProperties(String autoChildName, EditContext properties) throws IllegalStateException Sets the properties for creating an AutoChild namedautoChildName
.properties
must not have already been created (properties.isCreated()
must befalse
).- Parameters:
autoChildName
- the name of the AutoChildproperties
- AutoChild configuration- Returns:
Canvas
instance, for chaining setter calls- 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- Returns:
Canvas
instance, for chaining setter calls
-
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.- See Also:
-
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.- See Also:
-
addChild
Adds newChild as a child of this widget, set up a named object reference (i.e., this[name]) to the new widget if name argument is provided, and draw the child if this widget has been drawn already.If newChild has a parent it will be removed from it. If it has a master, it will be detached from it if the master is a child of a different parent. If newChild has peers, they'll be added to this widget as children as well.
- Parameters:
newChild
- new child canvas to add
-
addChild
Adds newChild as a child of this widget, set up a named object reference (i.e., this[name]) to the new widget if name argument is provided, and draw the child if this widget has been drawn already.If newChild has a parent it will be removed from it. If it has a master, it will be detached from it if the master is a child of a different parent. If newChild has peers, they'll be added to this widget as children as well.
- Parameters:
newChild
- new child canvas to addname
- name to assign to child (eg: this[name] == child)autoDraw
- if false, child will not automatically be drawn (only for advanced use)- Returns:
- the new child, or null if it couldn't be added
- See Also:
-
setChildren
Array of all Canvii that are immediate children of this Canvas.Note : This is an advanced setting
- Parameters:
children
- children Default value is null- Returns:
Canvas
instance, for chaining setter calls
-
getOffsetHeight
public int getOffsetHeight()- Overrides:
getOffsetHeight
in classUIObject
-
getOffsetWidth
public int getOffsetWidth()- Overrides:
getOffsetWidth
in classUIObject
-
setAutoHeight
Set the minimum value for height.For use with setOverflow(Overflow.VISIBLE), where widgets render only as large as their contents and/or children, and height and width settings act as a minimum size.
- Returns:
Canvas
instance, for chaining setter calls
-
setAutoWidth
Set the minimum value for width.For use with setOverflow(Overflow.VISIBLE), where widgets render only as large as their contents and/or children, and height and width settings act as a minimum size.
- Returns:
Canvas
instance, for chaining setter calls
-
showClickMask
public String showClickMask(Function clickActionCallback, ClickMaskMode mode, Canvas[] unmaskedTargets) Show a clickMask over the entire screen that intercepts mouse clicks and fires some action. The mask created will be associated with this canvas - calling this method multiple times will not show multiple (stacked) clickMasks if the mask associated with this canvas is already up.
The clickMask useful for modal dialogs, menus and similar uses, where any click outside of some Canvas should either be suppressed (as in a modal dialog) or just cause something (like dismissing a menu).- Parameters:
clickActionCallback
- action to fire when the user clicks on the maskmode
- whether to automatically hide the clickMask on mouseDown and suppress the mouseDown event from reaching the target under the mouseunmaskedTargets
- initially unmasked targets for this clickMask. Note that if this is a"hard"
mask, unmasked children of masked parents are not supported so any non-top-level widgets passed in will have their parents unmasked. Children of masked parents can never be masked.- Returns:
- clickMask ID
-
visibleAtPoint
public Boolean visibleAtPoint(int x, int y, boolean withinViewport, Canvas ignoreWidgets, Canvas upToParent) Does this widget contain the specified global (x,y) coordinates, and have no other widgets also at the specified position, obscuring this one? This is commonly used for (for example) drag and drop interactions.- Parameters:
x
- GLOBAL x-coordinatey
- GLOBAL y-coordinatewithinViewport
- point lies within our viewport rather than just our drawn areaignoreWidgets
- If passed ignore widget(s), do not check whether those widgets occludes this oneupToParent
- If passed, only check for siblings occluding the component up as far as the specified parent widget- Returns:
- true if this object contains the specified point; false otherwise
- See Also:
-
setAriaState
Set a specific ARIA state mapping for this component. Usually this does not need to be manually set. Seecom.smartgwt.docs.Accessibility
.- Parameters:
stateName
-stateValue
-- Returns:
Canvas
instance, for chaining setter calls- Throws:
IllegalStateException
- ARIA state cannot be changed after the component has been created.
-
updateEditNode
A callback invoked for eachliveObject
byEditContext
when the EditContext is being serialized. The liveObject may make any updates needed to theEditNode
(or theEditContext
as a whole) in order to be able to later recreate the objects.
Note: This is an override point- Parameters:
editContext
- the EditContexteditNode
- the EditNode- See Also:
-
setAdaptWidthByCustomizer
Set customizer that definesadaptWidthBy
.- Parameters:
AdaptWidthByCustomizer
- customizer- Returns:
Canvas
instance, for chaining setter calls- See Also:
-
setAdaptHeightByCustomizer
Set customizer that definesadaptHeightBy
.- Parameters:
AdaptHeightByCustomizer
- customizer- Returns:
Canvas
instance, for chaining setter calls- See Also:
-
provideRuleContext
Provide data to thecom.smartgwt.client.widgets.Canvas#ruleScope
component, to be made available in the rule context at the specifiedpath
.path
must be one or more valid identifiers with either dot (.) or slash (/) used as a separator.data
can be any value, including both atomic values like a Boolean or String, or a nested data structure. Passdata
asnull
to remove data from the context at the specifiedpath
dbc
is the DataBoundComponent to be identified as the owner of the rule context contribution. This component is used to handle any conflicts between multiple components contributing to the same base path (i.e. first segment of path). For any collision an editable display (such as a form or editable grid) wins over a static display (such as a non-editable grid with a selection). Hidden components have lowest priority even if editable. For two editable components the first becomes the owner.- Parameters:
path
- path where data should be made availabledata
- data to contribute to rule context
-
provideRuleContext
Provide data to thecom.smartgwt.client.widgets.Canvas#ruleScope
component, to be made available in the rule context at the specifiedpath
.path
must be one or more valid identifiers with either dot (.) or slash (/) used as a separator.data
can be any value, including both atomic values like a Boolean or String, or a nested data structure. Passdata
asnull
to remove data from the context at the specifiedpath
dbc
is the DataBoundComponent to be identified as the owner of the rule context contribution. This component is used to handle any conflicts between multiple components contributing to the same base path (i.e. first segment of path). For any collision an editable display (such as a form or editable grid) wins over a static display (such as a non-editable grid with a selection). Hidden components have lowest priority even if editable. For two editable components the first becomes the owner.- Parameters:
path
- path where data should be made availabledata
- data to contribute to rule contextdbc
- the DataBoundComponent contributing to ruleContext
-
revealChild
Reveals the child Canvas passed in by showing it if it is currently hidden (note, this is stub functionality, certain Canvas subclasses such asTabSet
have more useful implementations) NOTE: This is an override point.- Parameters:
childID
- the global ID of the child Canvas to reveal
-
revealChild
Reveals the child Canvas passed in by showing it if it is currently hidden (note, this is stub functionality, certain Canvas subclasses such asTabSet
have more useful implementations) NOTE: This is an override point.- Parameters:
child
- the child Canvas to reveal
-
setDefaultShowCustomScrollbars
Whether to use the browser's native scrollbars or SmartClient-based scrollbars by default for all canvases.This method changes the default value of
com.smartgwt.client.widgets.Canvas#showCustomScrollbars
.- Parameters:
showCS
- whether to show custom (SmartGWT-based) scrollbars rather than css-scrollbars by default.- Returns:
Canvas
instance, for chaining setter calls
-
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
-
EditProxy.autoMaskChildren