com.smartgwt.client.widgets.drawing
Class DrawLabel

java.lang.Object
  extended by com.smartgwt.client.core.BaseClass
      extended by com.smartgwt.client.widgets.drawing.DrawItem
          extended by com.smartgwt.client.widgets.drawing.DrawLabel
All Implemented Interfaces:
com.google.gwt.event.shared.HasHandlers, HasClickHandlers, HasDragMoveHandlers, HasDragStartHandlers, HasDragStopHandlers, HasMouseDownHandlers, HasMouseMoveHandlers, HasMouseOutHandlers, HasMouseOverHandlers, HasMouseUpHandlers, HasMovedHandlers, HasResizedHandlers, HasShowContextMenuHandlers

public class DrawLabel
extends DrawItem

DrawItem subclass to render a single-line text label.


Field Summary
 
Fields inherited from class com.smartgwt.client.core.BaseClass
config, id, scClassName
 
Constructor Summary
DrawLabel()
           
DrawLabel(com.google.gwt.core.client.JavaScriptObject jsObj)
           
 
Method Summary
 com.google.gwt.core.client.JavaScriptObject create()
           
 java.lang.String getAlignment()
          Sets the text alignment from the x position.
 java.lang.String getContents()
          This is the content that will exist as the label.
 java.lang.String getFontFamily()
          Font family name, similar to the CSS font-family attribute.
 int getFontSize()
          Font size, similar to the CSS font-size attribute.
 java.lang.String getFontStyle()
          Font style, similar to the CSS font-style attribute, eg "normal", "italic".
 java.lang.String getFontWeight()
          Font weight, similar to the CSS font-weight attribute, eg "normal", "bold".
 int getLeft()
          Sets the amount from the left of its positioning that the element should be placed.
static DrawLabel getOrCreateRef(com.google.gwt.core.client.JavaScriptObject jsObj)
           
 float getRotation()
          Rotation in degrees.
 int getTop()
          Sets the amount from the top of its positioning that the element should be placed.
 void moveBy(int left, int top)
          Move both the start and end points of the line by a relative amount.
 void moveTo(int left, int top)
          Move the label to the absolute x, y coordinates
 void rotateTo(float degrees)
          Rotate the label by the absolute rotation in degrees
 void setAlignment(java.lang.String alignment)
          Sets the text alignment from the x position.
 void setContents(java.lang.String contents)
          This is the content that will exist as the label.
 void setFontFamily(java.lang.String fontFamily)
          Font family name, similar to the CSS font-family attribute.
 void setFontSize(int fontSize)
          Font size, similar to the CSS font-size attribute.
 void setFontStyle(java.lang.String fontStyle)
          Font style, similar to the CSS font-style attribute, eg "normal", "italic".
 void setFontWeight(java.lang.String fontWeight)
          Font weight, similar to the CSS font-weight attribute, eg "normal", "bold".
 void setJavaScriptObject(com.google.gwt.core.client.JavaScriptObject jsObj)
           
 void setLeft(int left)
          Sets the amount from the left of its positioning that the element should be placed.
 void setRotation(float rotation)
          Rotation in degrees.
 void setTop(int top)
          Sets the amount from the top of its positioning that the element should be placed.
 
Methods inherited from class com.smartgwt.client.widgets.drawing.DrawItem
addClickHandler, addDragMoveHandler, addDragStartHandler, addDragStopHandler, addMouseDownHandler, addMouseMoveHandler, addMouseOutHandler, addMouseOverHandler, addMouseUpHandler, addMovedHandler, addResizedHandler, addShowContextMenuHandler, computeAngle, convertToDrawItemArray, destroy, draw, erase, getAttributeAsIntArray, getBoundingBox, getCanDrag, getCenter, getContextMenu, getDestroyed, getDestroying, getDragStartDistance, getDrawGroup, getDrawPane, getEndArrow, getFillColor, getFillGradient, getFillOpacity, getKnobs, getLineCap, getLineColor, getLineOpacity, getLinePattern, getLineWidth, getMoveKnobOffset, getMoveKnobPoint, getPageLeft, getPageTop, getRef, getResizeKnobPoints, getScale, getShadow, getStartArrow, getSvgString, hide, hideKnobs, isInBounds, isPointInPath, resizeBy, resizeTo, rotateBy, scaleBy, scaleTo, setCanDrag, setContextMenu, setDragStartDistance, setDrawGroup, setDrawPane, setEndArrow, setFillColor, setFillGradient, setFillOpacity, setKnobs, setLineCap, setLineColor, setLineOpacity, setLinePattern, setLineWidth, setMoveKnobOffset, setMoveKnobPoint, setResizeKnobPoints, setScale, setShadow, setStartArrow, show, showKnobs
 
Methods inherited from class com.smartgwt.client.core.BaseClass
doAddHandler, error, error, errorIfNotCreated, fireEvent, getAttribute, getAttributeAsBoolean, getAttributeAsDate, getAttributeAsDouble, getAttributeAsElement, getAttributeAsFloat, getAttributeAsInt, getAttributeAsJavaScriptObject, getAttributeAsMap, getAttributeAsString, getAttributeAsStringArray, getConfig, getHandlerCount, getID, getJsObj, getOrCreateJsObj, getScClassName, isCreated, onInit, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setID, setProperty, setProperty, setProperty, setProperty, setScClassName
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface com.google.gwt.event.shared.HasHandlers
fireEvent
 

Constructor Detail

DrawLabel

public DrawLabel()

DrawLabel

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

getOrCreateRef

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

setJavaScriptObject

public void setJavaScriptObject(com.google.gwt.core.client.JavaScriptObject jsObj)
Overrides:
setJavaScriptObject in class DrawItem

create

public com.google.gwt.core.client.JavaScriptObject create()
Overrides:
create in class DrawItem

setAlignment

public void setAlignment(java.lang.String alignment)
                  throws java.lang.IllegalStateException
Sets the text alignment from the x position. Similar to html5 context.textAlign, eg "start", "center", "end"

Parameters:
alignment - . See String. Default value is "start"
Throws:
java.lang.IllegalStateException - this property cannot be changed after the underlying component has been created

getAlignment

public java.lang.String getAlignment()
Sets the text alignment from the x position. Similar to html5 context.textAlign, eg "start", "center", "end"

Returns:
. See String

setContents

public void setContents(java.lang.String contents)
                 throws java.lang.IllegalStateException
This is the content that will exist as the label.

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

getContents

public java.lang.String getContents()
This is the content that will exist as the label.

Returns:
. See String

setFontFamily

public void setFontFamily(java.lang.String fontFamily)
                   throws java.lang.IllegalStateException
Font family name, similar to the CSS font-family attribute.

Parameters:
fontFamily - . See String. Default value is "Tahoma"
Throws:
java.lang.IllegalStateException - this property cannot be changed after the underlying component has been created

getFontFamily

public java.lang.String getFontFamily()
Font family name, similar to the CSS font-family attribute.

Returns:
. See String

setFontSize

public void setFontSize(int fontSize)
                 throws java.lang.IllegalStateException
Font size, similar to the CSS font-size attribute.

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

getFontSize

public int getFontSize()
Font size, similar to the CSS font-size attribute.

Returns:
int

setFontStyle

public void setFontStyle(java.lang.String fontStyle)
                  throws java.lang.IllegalStateException
Font style, similar to the CSS font-style attribute, eg "normal", "italic".

Parameters:
fontStyle - . See String. Default value is "normal"
Throws:
java.lang.IllegalStateException - this property cannot be changed after the underlying component has been created

getFontStyle

public java.lang.String getFontStyle()
Font style, similar to the CSS font-style attribute, eg "normal", "italic".

Returns:
. See String

setFontWeight

public void setFontWeight(java.lang.String fontWeight)
                   throws java.lang.IllegalStateException
Font weight, similar to the CSS font-weight attribute, eg "normal", "bold".

Parameters:
fontWeight - . See String. Default value is "bold"
Throws:
java.lang.IllegalStateException - this property cannot be changed after the underlying component has been created

getFontWeight

public java.lang.String getFontWeight()
Font weight, similar to the CSS font-weight attribute, eg "normal", "bold".

Returns:
. See String

setLeft

public void setLeft(int left)
             throws java.lang.IllegalStateException
Sets the amount from the left of its positioning that the element should be placed.

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

getLeft

public int getLeft()
Sets the amount from the left of its positioning that the element should be placed.

Returns:
int

setRotation

public void setRotation(float rotation)
                 throws java.lang.IllegalStateException
Rotation in degrees.

NOTE: For best results, only use rotation values 0, 90, 180, and 270 with DrawLabels.

Overrides:
setRotation in class DrawItem
Parameters:
rotation - rotation Default value is 0.0
Throws:
java.lang.IllegalStateException - this property cannot be changed after the underlying component has been created

getRotation

public float getRotation()
Rotation in degrees.

NOTE: For best results, only use rotation values 0, 90, 180, and 270 with DrawLabels.

Overrides:
getRotation in class DrawItem
Returns:
float

setTop

public void setTop(int top)
            throws java.lang.IllegalStateException
Sets the amount from the top of its positioning that the element should be placed.

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

getTop

public int getTop()
Sets the amount from the top of its positioning that the element should be placed.

Returns:
int

moveBy

public void moveBy(int left,
                   int top)
Move both the start and end points of the line by a relative amount.

Overrides:
moveBy in class DrawItem
Parameters:
left - change to left coordinate in pixels
top - change to top coordinate in pixels

moveTo

public void moveTo(int left,
                   int top)
Move the label to the absolute x, y coordinates

Parameters:
left - new startLeft coordinate in pixels
top - new startTop coordinate in pixels

rotateTo

public void rotateTo(float degrees)
Rotate the label by the absolute rotation in degrees

Overrides:
rotateTo in class DrawItem
Parameters:
degrees - number of degrees to rotate