com.smartgwt.client.widgets.drawing
Class DrawPane

java.lang.Object
  extended by com.google.gwt.user.client.ui.UIObject
      extended by com.google.gwt.user.client.ui.Widget
          extended by com.smartgwt.client.widgets.BaseWidget
              extended by com.smartgwt.client.widgets.Canvas
                  extended by com.smartgwt.client.widgets.drawing.DrawPane
All Implemented Interfaces:
com.google.gwt.event.logical.shared.HasAttachHandlers, com.google.gwt.event.shared.HasHandlers, com.google.gwt.user.client.EventListener, com.google.gwt.user.client.ui.HasVisibility, com.google.gwt.user.client.ui.IsWidget, LogicalStructure, 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, HasScrolledHandlers, HasShowContextMenuHandlers, HasVisibilityChangedHandlers
Direct Known Subclasses:
FacetChart, Gauge

public class DrawPane
extends Canvas

A DrawPane is a container for drawing bitmap and vector graphics using browser's built-in freeform drawing capabilities. These include the HTML5 <canvas> tag and SVG (Scalable Vector Graphics) where available, and the VML (Vector Markup Language) for legacy browsers (Internet Explorer 8 and earlier).

To draw in a DrawPane you create DrawLines, DrawOvals, DrawPaths and other DrawItem-based components, and place them in the DrawPane via drawItems or add them incrementally via DrawPane.addDrawItem.

DrawItems support a variety of common features, such as gradient fills, arrowheads, events such as click() and built-in control knobs for end user resizing and manipulation of shapes.

Common shapes such as rectangles, ovals and triangles have dedicated DrawItem subclasses. For other shapes, consider:

NOTE:To use the Drawing subsystem, include the Drawing module in your application by including <inherits name="com.smartgwt.Drawing"/> in your GWT module XML.

Note on Coordinate Systems

There are three different coordinate systems involved when a DrawItem is drawn onto a DrawPane:

The view port of the DrawPane is the rectangle in the global coordinate system from (0, 0) that is as wide as the DrawPane's inner content width and as high as the DrawPane's inner content height.

One other coordinate system in use by a DrawPane when drag-scrolling is enabled is the "viewbox coordinate system". The viewbox coordinate system is the drawing coordinate system with the translate and zoomLevel transforms applied.


Nested Class Summary
 
Nested classes/interfaces inherited from class com.google.gwt.user.client.ui.UIObject
com.google.gwt.user.client.ui.UIObject.DebugIdImpl, com.google.gwt.user.client.ui.UIObject.DebugIdImplEnabled
 
Field Summary
 
Fields inherited from class com.smartgwt.client.widgets.BaseWidget
config, configOnly, id, nativeObject, scClassName
 
Fields inherited from class com.google.gwt.user.client.ui.UIObject
DEBUG_ID_PREFIX
 
Constructor Summary
DrawPane()
           
DrawPane(com.google.gwt.core.client.JavaScriptObject jsObj)
           
 
Method Summary
 void addDrawItem(DrawItem item, boolean autoDraw)
          Add a drawItem to this drawPane (if necessary removing it from any other drawPanes)
 java.lang.String addGradient(Gradient gradient)
          Add a new gradient to the drawPane shared gradient list (gradients).
static void changeAutoChildDefaults(java.lang.String autoChildName, Canvas defaults)
          Changes the defaults for Canvas AutoChildren named autoChildName.
static void changeAutoChildDefaults(java.lang.String autoChildName, FormItem defaults)
          Changes the defaults for FormItem AutoChildren named autoChildName.
protected  com.google.gwt.core.client.JavaScriptObject create()
           
 java.lang.String createLinearGradient(java.lang.String id, LinearGradient linearGradient)
          Deprecated. in favor of DrawPane.addGradient
 java.lang.String createRadialGradient(java.lang.String id, RadialGradient radialGradient)
          Deprecated. in favor of DrawPane.addGradient
 java.lang.String createSimpleGradient(java.lang.String id, SimpleGradient simple)
          Deprecated. in favor of DrawPane.addGradient
 void destroyItems()
          Permanently destroy all DrawItems currently associated with this DrawPane, leaving the DrawPane itself intact
 void erase()
          Call DrawItem.erase on all DrawItems currently associated with the DrawPane.
 boolean getCanDragScroll()
          Can the user drag-scroll the DrawPane?
 java.lang.String getDataURL()
          Get a "data:" URL encoding the current contents of the DrawPane as a PNG file.
 java.lang.String getDataURL(DataURLCallback callback)
          Get a "data:" URL encoding the current contents of the DrawPane as a PNG file.
 int getDrawingHeight()
          When canDragScroll is enabled, this is the height of the area in viewbox coordinates that can be accessed through drag-scrolling.
 int getDrawingWidth()
          When canDragScroll is enabled, this is the width of the area in viewbox coordinates that can be accessed through drag-scrolling.
 DrawItem[] getDrawItems()
          Array of DrawItems to initially display in this DrawPane.
 Gradient getGradient(java.lang.String gradientID)
          Returns gradient for gradientID.
 Gradient[] getGradients()
          Array of gradients that can be referenced by DrawItems placed on this DrawPane.
 com.smartgwt.logicalstructure.core.LogicalStructureObject getLogicalStructure()
           
static DrawPane getOrCreateRef(com.google.gwt.core.client.JavaScriptObject jsObj)
           
 java.lang.String getPrintHTML(PrintProperties printProperties, PrintHTMLCallback callback)
          Retrieves printable HTML for this component and all printable subcomponents.
 float getRotation()
          Deprecated. GwtFloatVsDouble
 double getRotationAsDouble()
          Rotation in degrees for the DrawPane as a whole about the center of the DrawPane.
 java.lang.String getSvgString()
          Converts this DrawPane to the source of an <svg> element equivalent to the current drawing.
 float getZoomLevel()
          Deprecated. GwtFloatVsDouble
 double getZoomLevelAsDouble()
          Zoom for the DrawPane as a whole, where 1 is normal size.
 void removeGradient(java.lang.String gradientID)
          Removes gradient for gradientID.
 void rotate(double degrees)
          Synonym of DrawPane.setRotation.
 void setCanDragScroll(boolean canDragScroll)
          Can the user drag-scroll the DrawPane?
static void setDefaultProperties(DrawPane drawPaneProperties)
          Class level method to set the default properties of this class.
 void setDrawingHeight(int drawingHeight)
          When canDragScroll is enabled, this is the height of the area in viewbox coordinates that can be accessed through drag-scrolling.
 void setDrawingWidth(int drawingWidth)
          When canDragScroll is enabled, this is the width of the area in viewbox coordinates that can be accessed through drag-scrolling.
 void setDrawItems(DrawItem... drawItems)
          Array of DrawItems to initially display in this DrawPane.
 void setGradients(Gradient... gradients)
          Array of gradients that can be referenced by DrawItems placed on this DrawPane.
 com.smartgwt.logicalstructure.core.LogicalStructureObject setLogicalStructure(com.smartgwt.logicalstructure.widgets.drawing.DrawPaneLogicalStructure s)
           
 void setRotation(double rotation)
          Rotation in degrees for the DrawPane as a whole about the center of the DrawPane.
 void setRotation(float rotation)
          Deprecated. GwtFloatVsDouble
 void setZoomLevel(double zoomLevel)
          Zoom for the DrawPane as a whole, where 1 is normal size.
 void setZoomLevel(float zoomLevel)
          Deprecated. GwtFloatVsDouble
 void zoom(double zoomLevel)
          Synonym of DrawPane.setZoomLevel.
 void zoom(float zoomLevel)
          Deprecated. GwtFloatVsDouble
 
Methods inherited from class com.smartgwt.client.widgets.Canvas
addChild, addChild, addChild, addChild, addChild, addClickHandler, addDoubleClickHandler, addDragMoveHandler, addDragRepositionMoveHandler, addDragRepositionStartHandler, addDragRepositionStopHandler, addDragResizeMoveHandler, addDragResizeStartHandler, addDragResizeStopHandler, addDragStartHandler, addDragStopHandler, addDropHandler, addDropMoveHandler, addDropOutHandler, addDropOverHandler, addFocusChangedHandler, addHoverHandler, addHoverHiddenHandler, addKeyDownHandler, addKeyPressHandler, addMouseDownHandler, addMouseMoveHandler, addMouseOutHandler, addMouseOverHandler, addMouseStillDownHandler, addMouseUpHandler, addMouseWheelHandler, addMovedHandler, addParentMovedHandler, addPeer, addPeer, addPeer, addPeer, addResizedHandler, addRightMouseDownHandler, addScrolledHandler, addShowContextMenuHandler, addStyleName, addVisibilityChangedHandler, adjustForContent, animateFade, animateFade, animateFade, animateFade, animateFade, animateFade, animateFade, animateFade, animateHide, animateHide, animateHide, animateMove, animateMove, animateMove, animateMove, animateRect, animateRect, animateRect, animateRect, animateResize, animateResize, animateResize, animateResize, animateScroll, animateScroll, animateScroll, animateScroll, animateScroll, animateScroll, animateShow, animateShow, animateShow, animateShow, animateShow, animateShow, asSGWTComponent, blur, bringToFront, clear, clickMaskUp, clickMaskUp, contains, contains, containsEvent, containsFocus, containsPoint, containsPoint, deparent, depeer, disable, enable, focus, focusInNextTabElement, focusInPreviousTabElement, getAbsoluteLeft, getAbsoluteTop, getAccessKey, getAnimateAcceleration, getAnimateFadeTime, getAnimateHideAcceleration, getAnimateHideTime, getAnimateMoveAcceleration, getAnimateMoveTime, getAnimateRectAcceleration, getAnimateRectTime, getAnimateResizeAcceleration, getAnimateResizeTime, getAnimateScrollAcceleration, getAnimateScrollTime, getAnimateShowAcceleration, getAnimateShowEffect, getAnimateShowTime, getAnimateTime, getAppImgDir, getAriaRole, getAutoDraw, getAutoShowParent, getBackgroundColor, getBackgroundImage, getBackgroundPosition, getBackgroundRepeat, getBorder, getBottom, getById, getByJSObject, getByLocalId, getCanAcceptDrop, getCanDrag, getCanDragReposition, getCanDragResize, getCanDrop, getCanDropBefore, getCanFocus, getCanHover, getCanSelectText, getCanvasAutoChild, getCanvasItem, getChildren, getChildrenSnapResizeToGrid, getChildrenSnapToGrid, getClassName, getContentElement, getContents, getContextMenu, getCursor, getDataPath, getDefaultHeight, getDefaultWidth, getDestroyed, getDestroying, getDisabled, getDisabledCursor, getDoubleClickDelay, getDragAppearance, getDragIntersectStyle, getDragMaskType, getDragOpacity, getDragRepositionAppearance, getDragRepositionCursor, getDragResizeAppearance, getDragScrollDelay, getDragStartDistance, getDragTarget, getDragType, getDropTypes, getDropTypesAsString, getDynamicContents, getEdgeBackgroundColor, getEdgeCenterBackgroundColor, getEdgeImage, getEdgeMarginSize, getEdgeOffset, getEdgeOpacity, getEdgeShowCenter, getEdgeSize, getElement, getElement, getEventEdge, getEventEdge, getExtraSpace, getFacetId, getFormItemAutoChild, getFullDataPath, getGroupBorderCSS, getGroupLabelBackgroundColor, getGroupLabelStyleName, getGroupTitle, getHeight, getHeightAsString, getHideUsingDisplayNone, getHoverAlign, getHoverAutoDestroy, getHoverComponent, getHoverDelay, getHoverHeight, getHoverHTML, getHoverMoveWithMouse, getHoverOpacity, getHoverStyle, getHoverVAlign, getHoverWidth, getHoverWrap, getHSnapOrigin, getHSnapOrigin, getHSnapPosition, getHSnapPosition, getHtmlElement, getHtmlPosition, getImage, getImgURL, getImgURL, getInnerContentHeight, getInnerContentWidth, getInnerHeight, getInnerWidth, getIsGroup, getKeepInParentRect, getLayoutAlign, getLeft, getLeftAsString, getLocateChildrenBy, getLocateChildrenType, getLocatePeersBy, getLocatePeersType, getMargin, getMasterCanvas, getMasterElement, getMatchElement, getMaxHeight, getMaxWidth, getMenuConstructor, getMinHeight, getMinWidth, getMomentumScrollMinSpeed, getMouseStillDownDelay, getMouseStillDownInitialDelay, getNextZIndex, getNoDoubleClicks, getOffsetHeight, getOffsetWidth, getOffsetX, getOffsetY, getOpacity, getOuterElement, getOverflow, getPadding, getPageBottom, getPageLeft, getPageRect, getPageRight, getPageTop, getParentCanvas, getParentElement, getPeers, getPercentBox, getPercentSource, getPosition, getPrefix, getPrintChildrenAbsolutelyPositioned, getPrintHTML, getPrompt, getRect, getRedrawOnResize, getResizeBarTarget, getResizeFrom, getRight, getScrollbarSize, getScrollBottom, getScrollHeight, getScrollLeft, getScrollRight, getScrollTop, getScrollWidth, getShadowDepth, getShadowImage, getShadowOffset, getShadowSoftness, getShouldPrint, getShowCustomScrollbars, getShowDragShadow, getShowEdges, getShowHover, getShowHoverComponents, getShowResizeBar, getShowShadow, getShrinkElementOnHide, getSkinImgDir, getSnapAxis, getSnapEdge, getSnapHDirection, getSnapHGap, getSnapOffsetLeft, getSnapOffsetTop, getSnapOnDrop, getSnapResizeToGrid, getSnapTo, getSnapToGrid, getSnapVDirection, getSnapVGap, getStyleName, getTabIndex, getTestInstance, getTitle, getTooltip, getTop, getTopAsString, getTopElement, getUseBackMask, getUseDragMask, getUseNativeDrag, getUseOpacityFilter, getValuesManager, getViewportHeight, getViewportWidth, getVisibility, getVisibleHeight, getVisibleWidth, getVSnapOrigin, getVSnapOrigin, getVSnapPosition, getVSnapPosition, getWidth, getWidthAsString, getZIndex, getZIndex, handleHover, hide, hideClickMask, hideClickMask, hideContextMenu, imgHTML, imgHTML, imgHTML, intersects, isDirty, isDisabled, isDrawn, isVisible, keyUp, layoutChildren, linkHTML, linkHTML, linkHTML, linkHTML, linkHTML, linkHTML, markForDestroy, markForRedraw, markForRedraw, moveAbove, moveBelow, moveBy, moveTo, onAttach, onDetach, onInit, parentResized, printComponents, redraw, redraw, removeChild, removeChild, removePeer, removePeer, resizeBy, resizeTo, resizeTo, scrollBy, scrollByPercent, scrollTo, scrollTo, scrollTo, scrollToBottom, scrollToLeft, scrollToPercent, scrollToRight, scrollToTop, sendToBack, setAccessKey, setAlign, setAllowExternalFilters, setAnimateAcceleration, setAnimateFadeTime, setAnimateHideAcceleration, setAnimateHideTime, setAnimateMoveAcceleration, setAnimateMoveTime, setAnimateRectAcceleration, setAnimateRectTime, setAnimateResizeAcceleration, setAnimateResizeTime, setAnimateScrollAcceleration, setAnimateScrollTime, setAnimateShowAcceleration, setAnimateShowEffect, setAnimateShowTime, setAnimateTime, setAppImgDir, setAriaRole, setAriaState, setAutoChildConstructor, setAutoChildProperties, setAutoChildProperties, setAutoChildVisibility, setAutoDraw, setAutoHeight, setAutoShowParent, setAutoWidth, setBackgroundColor, setBackgroundImage, setBackgroundPosition, setBackgroundRepeat, setBorder, setBottom, setCanAcceptDrop, setCanDrag, setCanDragReposition, setCanDragResize, setCanDrop, setCanDropBefore, setCanFocus, setCanHover, setCanSelectText, setChildren, setChildrenSnapResizeToGrid, setChildrenSnapToGrid, setContents, setContextMenu, setCursor, setDataPath, setDefaultHeight, setDefaultProperties, setDefaultWidth, setDisabled, setDisabledCursor, setDoubleClickDelay, setDragAppearance, setDragIntersectStyle, setDragMaskType, setDragOpacity, setDragRepositionAppearance, setDragRepositionCursor, setDragResizeAppearance, setDragScrollDelay, setDragStartDistance, setDragTarget, setDragType, setDropTypes, setDropTypes, setDynamicContents, setEdgeBackgroundColor, setEdgeCenterBackgroundColor, setEdgeImage, setEdgeMarginSize, setEdgeOffset, setEdgeOpacity, setEdgeShowCenter, setEdgeSize, setElement, setExtraSpace, setFacetId, setGroupBorderCSS, setGroupLabelBackgroundColor, setGroupLabelStyleName, setGroupTitle, setHeight, setHeight, setHeight, setHeight100, setHideUsingDisplayNone, setHoverAlign, setHoverAutoDestroy, setHoverDelay, setHoverHeight, setHoverMoveWithMouse, setHoverOpacity, setHoverStyle, setHoverVAlign, setHoverWidth, setHoverWrap, setHtmlElement, setHtmlPosition, setImage, setImage, setInitHandler, setIsGroup, setKeepInParentRect, setKeepInParentRect, setKeepInParentRect, setLayoutAlign, setLayoutAlign, setLeft, setLeft, setLocateChildrenBy, setLocateChildrenType, setLocatePeersBy, setLocatePeersType, setLogicalStructure, setMargin, setMatchElement, setMaxHeight, setMaxWidth, setMenuConstructor, setMinHeight, setMinWidth, setMomentumScrollMinSpeed, setMouseStillDownDelay, setMouseStillDownInitialDelay, setNeverUseFilters, setNoDoubleClicks, setOpacity, setOverflow, setPadding, setPageLeft, setPageTop, setParentCanvas, setParentElement, setPeers, setPercentBox, setPercentSource, setPosition, setPrefix, setPrintChildrenAbsolutelyPositioned, setPrompt, setRect, setRect, setRedrawOnResize, setResizeBarTarget, setResizeFrom, setResizeFrom, setRight, setScrollbarConstructor, setScrollbarSize, setShadowDepth, setShadowImage, setShadowOffset, setShadowSoftness, setShouldPrint, setShowCustomScrollbars, setShowDragShadow, setShowEdges, setShowHover, setShowHoverComponents, setShowResizeBar, setShowShadow, setShrinkElementOnHide, setSkinImgDir, setSmoothFade, setSnapAxis, setSnapEdge, setSnapHDirection, setSnapHGap, setSnapOffsetLeft, setSnapOffsetTop, setSnapOnDrop, setSnapResizeToGrid, setSnapTo, setSnapToGrid, setSnapVDirection, setSnapVGap, setStyleName, setTabIndex, setTitle, setTooltip, setTop, setTop, setUseBackMask, setUseDragMask, setUseNativeDrag, setUseOpacityFilter, setValuesManager, setVisibility, setVisible, setWidth, setWidth, setWidth, setWidth100, setZIndex, shouldDragScroll, show, showClickMask, showNextTo, showNextTo, showNextTo, showNextTo, showPrintPreview, showPrintPreview, showPrintPreview, showPrintPreview, showRecursively, updateEditNode, updateHover, updateHover, updateShadow, visibleAtPoint, willAcceptDrop
 
Methods inherited from class com.smartgwt.client.widgets.BaseWidget
addDrawHandler, destroy, doAddHandler, doInit, doOnRender, draw, equals, error, errorIfNotCreated, getAttribute, getAttributeAsBoolean, getAttributeAsDate, getAttributeAsDateArray, getAttributeAsDouble, getAttributeAsElement, getAttributeAsFloat, getAttributeAsFloatArray, getAttributeAsInt, getAttributeAsIntArray, getAttributeAsJavaScriptObject, getAttributeAsMap, getAttributeAsRecord, getAttributeAsString, getAttributeAsStringArray, getConfig, getDOM, getHandlerCount, getID, getInnerHTML, getJsObj, getOrCreateJsObj, getRef, getScClassName, hasAutoAssignedID, hashCode, initNativeObject, internalSetID, internalSetID, isConfigOnly, isCreated, 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, setDragTracker, setID, setJavaScriptObject, 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
 
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, unsinkEvents
 
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 Detail

DrawPane

public DrawPane()

DrawPane

public DrawPane(com.google.gwt.core.client.JavaScriptObject jsObj)
Method Detail

getOrCreateRef

public static DrawPane getOrCreateRef(com.google.gwt.core.client.JavaScriptObject jsObj)

changeAutoChildDefaults

public static void changeAutoChildDefaults(java.lang.String autoChildName,
                                           Canvas defaults)
Changes the defaults for Canvas AutoChildren named autoChildName.

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.
See Also:
AutoChildUsage

changeAutoChildDefaults

public static void changeAutoChildDefaults(java.lang.String autoChildName,
                                           FormItem defaults)
Changes the defaults for FormItem AutoChildren named autoChildName.

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.
See Also:
AutoChildUsage

create

protected com.google.gwt.core.client.JavaScriptObject create()
Overrides:
create in class Canvas

setCanDragScroll

public void setCanDragScroll(boolean canDragScroll)
                      throws java.lang.IllegalStateException
Can the user drag-scroll the DrawPane?

Overrides:
setCanDragScroll in class Canvas
Parameters:
canDragScroll - Default value is false
Throws:
java.lang.IllegalStateException - this property cannot be changed after the component has been created
See Also:
setDrawingWidth(int), setDrawingHeight(int)

getCanDragScroll

public boolean getCanDragScroll()
Can the user drag-scroll the DrawPane?

Overrides:
getCanDragScroll in class Canvas
Returns:
boolean
See Also:
getDrawingWidth(), getDrawingHeight()

setDrawingHeight

public void setDrawingHeight(int drawingHeight)
                      throws java.lang.IllegalStateException
When canDragScroll is enabled, this is the height of the area in viewbox coordinates that can be accessed through drag-scrolling.

Parameters:
drawingHeight - Default value is 1000
Throws:
java.lang.IllegalStateException - this property cannot be changed after the component has been created

getDrawingHeight

public int getDrawingHeight()
When canDragScroll is enabled, this is the height of the area in viewbox coordinates that can be accessed through drag-scrolling.

Returns:
int

setDrawingWidth

public void setDrawingWidth(int drawingWidth)
                     throws java.lang.IllegalStateException
When canDragScroll is enabled, this is the width of the area in viewbox coordinates that can be accessed through drag-scrolling.

Parameters:
drawingWidth - Default value is 1000
Throws:
java.lang.IllegalStateException - this property cannot be changed after the component has been created

getDrawingWidth

public int getDrawingWidth()
When canDragScroll is enabled, this is the width of the area in viewbox coordinates that can be accessed through drag-scrolling.

Returns:
int

setDrawItems

public void setDrawItems(DrawItem... drawItems)
                  throws java.lang.IllegalStateException
Array of DrawItems to initially display in this DrawPane.

Parameters:
drawItems - Default value is null
Throws:
java.lang.IllegalStateException - this property cannot be changed after the component has been created

getDrawItems

public DrawItem[] getDrawItems()
Array of DrawItems to initially display in this DrawPane.

Returns:
DrawItem...

setGradients

public void setGradients(Gradient... gradients)
                  throws java.lang.IllegalStateException
Array of gradients that can be referenced by DrawItems placed on this DrawPane. Each gradient must have an ID assigned to be used for reference.

Parameters:
gradients - Default value is null
Throws:
java.lang.IllegalStateException - this property cannot be changed after the component has been created

getGradients

public Gradient[] getGradients()
Array of gradients that can be referenced by DrawItems placed on this DrawPane. Each gradient must have an ID assigned to be used for reference.

Returns:
Gradient...

setRotation

public void setRotation(float rotation)
Deprecated. GwtFloatVsDouble

Rotation in degrees for the DrawPane as a whole about the center of the DrawPane. The positive direction corresponds to clockwise rotation (for example, 45 is rotation clockwise by 45 degrees and -10 is rotation counterclockwise by 10 degrees).

If this method is called after the component has been drawn/initialized: Sets the rotation of the DrawPane.

Parameters:
rotation - the new rotation in degrees. The positive direction corresponds to clockwise rotation.. Default value is 0

getRotation

public float getRotation()
Deprecated. GwtFloatVsDouble

Rotation in degrees for the DrawPane as a whole about the center of the DrawPane. The positive direction corresponds to clockwise rotation (for example, 45 is rotation clockwise by 45 degrees and -10 is rotation counterclockwise by 10 degrees).

Returns:
float

setRotation

public void setRotation(double rotation)
Rotation in degrees for the DrawPane as a whole about the center of the DrawPane. The positive direction corresponds to clockwise rotation (for example, 45 is rotation clockwise by 45 degrees and -10 is rotation counterclockwise by 10 degrees).

If this method is called after the component has been drawn/initialized: Sets the rotation of the DrawPane.

Parameters:
rotation - the new rotation in degrees. The positive direction corresponds to clockwise rotation.. Default value is 0

getRotationAsDouble

public double getRotationAsDouble()
Rotation in degrees for the DrawPane as a whole about the center of the DrawPane. The positive direction corresponds to clockwise rotation (for example, 45 is rotation clockwise by 45 degrees and -10 is rotation counterclockwise by 10 degrees).

Returns:
double

setZoomLevel

public void setZoomLevel(float zoomLevel)
Deprecated. GwtFloatVsDouble

Zoom for the DrawPane as a whole, where 1 is normal size.

If this method is called after the component has been drawn/initialized: Sets the zoom on this DrawPane to the specified magnification, maintaining the current viewport position.

Parameters:
zoomLevel - Desired zoom level as a float where 1.0 is equivalent to 100% magnification. Must be greater than 0.. Default value is 1

getZoomLevel

public float getZoomLevel()
Deprecated. GwtFloatVsDouble

Zoom for the DrawPane as a whole, where 1 is normal size.

Returns:
float

setZoomLevel

public void setZoomLevel(double zoomLevel)
Zoom for the DrawPane as a whole, where 1 is normal size.

If this method is called after the component has been drawn/initialized: Sets the zoom on this DrawPane to the specified magnification, maintaining the current viewport position.

Parameters:
zoomLevel - Desired zoom level as a float where 1.0 is equivalent to 100% magnification. Must be greater than 0.. Default value is 1

getZoomLevelAsDouble

public double getZoomLevelAsDouble()
Zoom for the DrawPane as a whole, where 1 is normal size.

Returns:
double

addDrawItem

public void addDrawItem(DrawItem item,
                        boolean autoDraw)
Add a drawItem to this drawPane (if necessary removing it from any other drawPanes)

Parameters:
item - drawItem to add
autoDraw - If explicitly set to false, and this drawPane is drawn, don't draw the newly added item

addGradient

public java.lang.String addGradient(Gradient gradient)
Add a new gradient to the drawPane shared gradient list (gradients). If the gradient does not have an ID a new one will be assigned.

Parameters:
gradient - gradient to add
Returns:
the ID of the gradient (either provided or auto-assigned)

createLinearGradient

public java.lang.String createLinearGradient(java.lang.String id,
                                             LinearGradient linearGradient)
Deprecated. in favor of DrawPane.addGradient

Creates a linear gradient which can be used by any DrawItem of this DrawPane. Any DrawItem's fillGradient can reference the gradient by the given ID.

Parameters:
id - the ID of the linear gradient
linearGradient - the linear gradient
Returns:
id

createRadialGradient

public java.lang.String createRadialGradient(java.lang.String id,
                                             RadialGradient radialGradient)
Deprecated. in favor of DrawPane.addGradient

Creates a radial gradient which can be used by any DrawItem of this DrawPane. Any DrawItem's fillGradient can reference the gradient by the given ID.

Parameters:
id - the ID of the radial gradient
radialGradient - the radial gradient
Returns:
id

createSimpleGradient

public java.lang.String createSimpleGradient(java.lang.String id,
                                             SimpleGradient simple)
Deprecated. in favor of DrawPane.addGradient

Creates a simple linear gradient which can be used by any DrawItem of this DrawPane. Any DrawItem's fillGradient can reference the gradient by the given ID.

Parameters:
id - the ID of the simple linear gradient
simple - the simple linear gradient
Returns:
id

destroyItems

public void destroyItems()
Permanently destroy all DrawItems currently associated with this DrawPane, leaving the DrawPane itself intact


erase

public void erase()
Call DrawItem.erase on all DrawItems currently associated with the DrawPane.

The DrawItems will continue to exist, and you can call draw() on them to make them appear again, or destroy to get rid of them permanetly. Use DrawPane.destroyItems to permanently get rid of all DrawItems.


getDataURL

public java.lang.String getDataURL()
Get a "data:" URL encoding the current contents of the DrawPane as a PNG file.

The returned "data:" URLs can be used anywhere a URL to an image is valid, for example, src.

This method will directly return the data URL on modern browsers when using <canvas>-style rendering (the default).

On legacy browers (any version of IE in "quirks" mode, all versions of IE prior to 9.0), data URL generation requires a server trip and requires the Smart GWT Server to be installed with the same set of required .jars as are required for PDF export of charts in legacy IE. The method will return null and a callback must be passed, which fires when the data URL has been retrieved from the server.

If the callback is passed but no server trip is required, the callback is fired immediately.

For obtaining PNG or other image data for use in server-side processing (such as attaching to automated emails or saving to a database), see also the server-side APIs in com.isomorphic.contentexport.ImageExport.

Returns:
the data URL (on modern browsers)
See Also:
Chart Image Export Example

getDataURL

public java.lang.String getDataURL(DataURLCallback callback)
Get a "data:" URL encoding the current contents of the DrawPane as a PNG file.

The returned "data:" URLs can be used anywhere a URL to an image is valid, for example, src.

This method will directly return the data URL on modern browsers when using <canvas>-style rendering (the default).

On legacy browers (any version of IE in "quirks" mode, all versions of IE prior to 9.0), data URL generation requires a server trip and requires the Smart GWT Server to be installed with the same set of required .jars as are required for PDF export of charts in legacy IE. The method will return null and a callback must be passed, which fires when the data URL has been retrieved from the server.

If the callback is passed but no server trip is required, the callback is fired immediately.

For obtaining PNG or other image data for use in server-side processing (such as attaching to automated emails or saving to a database), see also the server-side APIs in com.isomorphic.contentexport.ImageExport.

Parameters:
callback - callback to fire when data url is available
Returns:
the data URL (on modern browsers)
See Also:
Chart Image Export Example

getGradient

public Gradient getGradient(java.lang.String gradientID)
Returns gradient for gradientID.

Parameters:
gradientID - ID of gradient to retrieve
Returns:
the gradient or null if not found

getSvgString

public java.lang.String getSvgString()
Converts this DrawPane to the source of an <svg> element equivalent to the current drawing.

In Pro edition and above, the returned string can be used with RPCManager.exportImage to download an image, or with server-side APIs in com.isomorphic.contentexport.ImageExport to obtain various kinds of images for further server-side processing.

Returns:
the source of an <svg> element.
See Also:
Chart Image Export Example

removeGradient

public void removeGradient(java.lang.String gradientID)
Removes gradient for gradientID.

Parameters:
gradientID - ID of gradient to remove

rotate

public void rotate(double degrees)
Synonym of DrawPane.setRotation.

Parameters:
degrees - the new rotation in degrees. The positive direction corresponds to clockwise rotation.

zoom

public void zoom(float zoomLevel)
Deprecated. GwtFloatVsDouble

Synonym of DrawPane.setZoomLevel.

Parameters:
zoomLevel - Desired zoom level as a float where 1.0 is equivalent to 100% magnification. Must be greater than 0.

zoom

public void zoom(double zoomLevel)
Synonym of DrawPane.setZoomLevel.

Parameters:
zoomLevel - Desired zoom level as a float where 1.0 is equivalent to 100% magnification. Must be greater than 0.

setDefaultProperties

public static void setDefaultProperties(DrawPane drawPaneProperties)
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:
drawPaneProperties - properties that should be used as new defaults when instances of this class are created

getPrintHTML

public java.lang.String getPrintHTML(PrintProperties printProperties,
                                     PrintHTMLCallback callback)
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 overriding this method for a custom component, you should either return a String of printable HTML string directly or return null, and fire the callback (if provided).

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 which getPrintHTML() is called.

Notes on printing

To print a DrawPane for export on IE8 and earlier, it is PrintProperties with printForExport:true:

 final PrintProperties pp = new PrintProperties();
 pp.setPrintForExport(true);
 final String exportHTML = drawPane.getPrintHTML(pp, null);
 

Note: this is an override point.

Overrides:
getPrintHTML in class Canvas
Parameters:
printProperties - properties to configure printing behavior - may be null.
callback - optional callback to fire. Generated HTML should be passed to the PrintHTMLCallback.setHTML(String) method of the callback.
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:
Printing overview and related methods

setLogicalStructure

public com.smartgwt.logicalstructure.core.LogicalStructureObject setLogicalStructure(com.smartgwt.logicalstructure.widgets.drawing.DrawPaneLogicalStructure s)

getLogicalStructure

public com.smartgwt.logicalstructure.core.LogicalStructureObject getLogicalStructure()
Specified by:
getLogicalStructure in interface LogicalStructure
Overrides:
getLogicalStructure in class Canvas