com.sencha.gxt.chart.client.draw
Class DrawComponent

java.lang.Object
  extended by com.google.gwt.user.client.ui.UIObject
      extended by com.google.gwt.user.client.ui.Widget
          extended by com.sencha.gxt.widget.core.client.Component
              extended by com.sencha.gxt.chart.client.draw.DrawComponent
All Implemented Interfaces:
HasAttachHandlers, HasResizeHandlers, HasHandlers, EventListener, HasVisibility, IsWidget, SpriteHandler.HasSpriteHandlers, SpriteOutEvent.HasSpriteOutHandlers, SpriteOverEvent.HasSpriteOverHandlers, SpriteSelectionEvent.HasSpriteSelectionHandlers, BeforeHideEvent.HasBeforeHideHandlers, BeforeShowContextMenuEvent.HasBeforeShowContextMenuHandler, BeforeShowEvent.HasBeforeShowHandlers, BlurEvent.HasBlurHandlers, DisableEvent.HasDisableHandlers, EnableEvent.HasEnableHandlers, FocusEvent.HasFocusHandlers, HideEvent.HasHideHandlers, MoveEvent.HasMoveHandlers, ShowContextMenuEvent.HasShowContextMenuHandler, ShowEvent.HasShowHandlers, HasFocusSupport, HasItemId
Direct Known Subclasses:
Chart

public class DrawComponent
extends Component
implements SpriteHandler.HasSpriteHandlers, SpriteOutEvent.HasSpriteOutHandlers, SpriteOverEvent.HasSpriteOverHandlers, SpriteSelectionEvent.HasSpriteSelectionHandlers

The Draw Component is a surface in which Sprites can be rendered. The Draw Component manages and holds a Surface instance: an interface that has an SVG or VML implementation depending on the browser capabilities and where Sprites can be appended.


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.google.gwt.user.client.ui.UIObject
DEBUG_ID_PREFIX
 
Constructor Summary
DrawComponent()
          Creates a draw widget at the default size.
DrawComponent(int width, int height)
          Creates a draw widget using the given width and height.
 
Method Summary
 void addGradient(Gradient gradient)
          Adds a Gradient to the draw widget's Surface.
 void addSprite(Sprite sprite)
          Adds a Sprite to the draw widget's Surface.
 HandlerRegistration addSpriteHandler(SpriteHandler handler)
          Adds a SpriteHandler handler for SpriteSelectionEvent, SpriteOutEvent, SpriteOverEvent events.
 HandlerRegistration addSpriteOutHandler(SpriteOutEvent.SpriteOutHandler handler)
          Adds a SpriteOutEvent.SpriteOutHandler handler for SpriteOutEvent events.
 HandlerRegistration addSpriteOverHandler(SpriteOverEvent.SpriteOverHandler handler)
          Adds a SpriteOverEvent.SpriteOverHandler handler for SpriteOverEvent events.
 HandlerRegistration addSpriteSelectionHandler(SpriteSelectionEvent.SpriteSelectionHandler handler)
          Adds a SpriteSelectionEvent.SpriteSelectionHandler handler for SpriteSelectionEvent events.
 Color getBackground()
          Returns the background color of the component.
 Surface getSurface()
          Returns the Surface.
 boolean isAnimated()
          Returns whether or not the chart is animated.
 boolean isViewBox()
          Returns true if the widget is to have a view box.
 void onBrowserEvent(Event event)
           
 void onMouseDown(Event event)
          Method used when the chart is clicked.
 void onMouseMove(Event event)
          Method used when the mouse moves over the chart.
 void onMouseOut(Event event)
          Method used when the mouse leaves the chart.
 void redrawSurface()
          Calls the Surface to render.
 void redrawSurfaceForced()
          Redraws the surface immediately.
 void remove(Sprite sprite)
          Removes a Sprite from the draw widget's Surface.
 void renderSprite(Sprite sprite)
          Renders the given sprite to the surface.
 void setAnimated(boolean animated)
          Sets whether or not the chart is animated.
 void setBackground(Color background)
          Sets the background color of the chart.
 void setViewBox(boolean viewBox)
          Sets whether the Surface has a view box.
 void sinkBrowserEvents()
          Sinks the mouse browser events on the component if not already sunk.
 
Methods inherited from class com.sencha.gxt.widget.core.client.Component
addBeforeHideHandler, addBeforeShowContextMenuHandler, addBeforeShowHandler, addBlurHandler, addDisableHandler, addEnableHandler, addFocusHandler, addHideHandler, addMoveHandler, addResizeHandler, addShowContextMenuHandler, addShowHandler, addStyleOnOver, clearSizeCache, disable, disableEvents, enable, enableEvents, fireEvent, focus, getData, getElement, getFocusSupport, getHideMode, getId, getItemId, getOffsetHeight, getOffsetWidth, getShadow, getStateId, getToolTip, hide, hideToolTip, isAllowTextSelection, isAutoHeight, isAutoWidth, isDeferHeight, isEnabled, isRendered, isStateful, isVisible, isVisible, mask, mask, removeHandler, removeToolTip, setAllowTextSelection, setBorders, setBounds, setBounds, setContextMenu, setData, setDeferHeight, setEnabled, setHeight, setHeight, setHideMode, setId, setItemId, setPagePosition, setPixelSize, setPosition, setShadow, setSize, setStateful, setStateId, setTabIndex, setToolTip, setToolTipConfig, setVisible, setWidth, setWidth, show, sync, syncSize, unmask
 
Methods inherited from class com.google.gwt.user.client.ui.Widget
addAttachHandler, addBitlessDomHandler, addDomHandler, addHandler, asWidget, asWidgetOrNull, getLayoutData, getParent, isAttached, removeFromParent, setLayoutData, sinkEvents
 
Methods inherited from class com.google.gwt.user.client.ui.UIObject
addStyleDependentName, addStyleName, ensureDebugId, ensureDebugId, getAbsoluteLeft, getAbsoluteTop, getOffsetHeight, getOffsetWidth, getStyleName, getStylePrimaryName, getTitle, isVisible, removeStyleDependentName, removeStyleName, setStyleDependentName, setStyleName, setStyleName, setStylePrimaryName, setTitle, setVisible, sinkBitlessEvent, toString, unsinkEvents
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

DrawComponent

public DrawComponent()
Creates a draw widget at the default size.


DrawComponent

public DrawComponent(int width,
                     int height)
Creates a draw widget using the given width and height.

Parameters:
width - the width of the draw widget
height - the height of the draw widget
Method Detail

addGradient

public void addGradient(Gradient gradient)
Adds a Gradient to the draw widget's Surface.

Parameters:
gradient - the gradient to be added

addSprite

public void addSprite(Sprite sprite)
Adds a Sprite to the draw widget's Surface.

Parameters:
sprite - the sprite to be added

addSpriteHandler

public HandlerRegistration addSpriteHandler(SpriteHandler handler)
Description copied from interface: SpriteHandler.HasSpriteHandlers
Adds a SpriteHandler handler for SpriteSelectionEvent, SpriteOutEvent, SpriteOverEvent events.

Specified by:
addSpriteHandler in interface SpriteHandler.HasSpriteHandlers
Parameters:
handler - the handler
Returns:
the registration for the event

addSpriteOutHandler

public HandlerRegistration addSpriteOutHandler(SpriteOutEvent.SpriteOutHandler handler)
Description copied from interface: SpriteOutEvent.HasSpriteOutHandlers
Adds a SpriteOutEvent.SpriteOutHandler handler for SpriteOutEvent events.

Specified by:
addSpriteOutHandler in interface SpriteOutEvent.HasSpriteOutHandlers
Parameters:
handler - the handler
Returns:
the registration for the event

addSpriteOverHandler

public HandlerRegistration addSpriteOverHandler(SpriteOverEvent.SpriteOverHandler handler)
Description copied from interface: SpriteOverEvent.HasSpriteOverHandlers
Adds a SpriteOverEvent.SpriteOverHandler handler for SpriteOverEvent events.

Specified by:
addSpriteOverHandler in interface SpriteOverEvent.HasSpriteOverHandlers
Parameters:
handler - the handler
Returns:
the registration for the event

addSpriteSelectionHandler

public HandlerRegistration addSpriteSelectionHandler(SpriteSelectionEvent.SpriteSelectionHandler handler)
Description copied from interface: SpriteSelectionEvent.HasSpriteSelectionHandlers
Adds a SpriteSelectionEvent.SpriteSelectionHandler handler for SpriteSelectionEvent events.

Specified by:
addSpriteSelectionHandler in interface SpriteSelectionEvent.HasSpriteSelectionHandlers
Parameters:
handler - the handler
Returns:
the registration for the event

getBackground

public Color getBackground()
Returns the background color of the component.

Returns:
the background color of the component

getSurface

public Surface getSurface()
Returns the Surface.

Returns:
the surface

isAnimated

public boolean isAnimated()
Returns whether or not the chart is animated.

Returns:
true if animated

isViewBox

public boolean isViewBox()
Returns true if the widget is to have a view box.

Returns:
true if the widget is to have a view box

onBrowserEvent

public void onBrowserEvent(Event event)
Specified by:
onBrowserEvent in interface EventListener
Overrides:
onBrowserEvent in class Component

onMouseDown

public void onMouseDown(Event event)
Method used when the chart is clicked.

Parameters:
event - the mouse event

onMouseMove

public void onMouseMove(Event event)
Method used when the mouse moves over the chart.

Parameters:
event - the mouse event

onMouseOut

public void onMouseOut(Event event)
Method used when the mouse leaves the chart.

Parameters:
event - the mouse event

redrawSurface

public void redrawSurface()
Calls the Surface to render.


redrawSurfaceForced

public void redrawSurfaceForced()
Redraws the surface immediately.


remove

public void remove(Sprite sprite)
Removes a Sprite from the draw widget's Surface.

Parameters:
sprite - the sprite to be removed

renderSprite

public void renderSprite(Sprite sprite)
Renders the given sprite to the surface.

Parameters:
sprite - the sprite to be rendered

setAnimated

public void setAnimated(boolean animated)
Sets whether or not the chart is animated.

Parameters:
animated - true if animated

setBackground

public void setBackground(Color background)
Sets the background color of the chart.

Parameters:
background - the background color of the chart

setViewBox

public void setViewBox(boolean viewBox)
Sets whether the Surface has a view box. The view box is determined by the bounding box of all the Sprites in the surface.

Parameters:
viewBox - true for the surface to have a view box

sinkBrowserEvents

public void sinkBrowserEvents()
Sinks the mouse browser events on the component if not already sunk.



Copyright © 2011. All Rights Reserved.