Class DrawLabel
- All Implemented Interfaces:
HasAttachHandlers
,HasHandlers
,EventListener
,HasVisibility
,IsWidget
,LogicalStructure
,HasClickHandlers
,HasDragMoveHandlers
,HasDragResizeMoveHandlers
,HasDragResizeStartHandlers
,HasDragResizeStopHandlers
,HasDragStartHandlers
,HasDragStopHandlers
,HasDrawEndHandlers
,HasDrawStartHandlers
,HasMouseDownHandlers
,HasMouseMoveHandlers
,HasMouseOutHandlers
,HasMouseOverHandlers
,HasMouseUpHandlers
,HasMovedHandlers
,HasResizedHandlers
,HasShowContextMenuHandlers
-
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 TypeMethodDescriptionstatic void
changeAutoChildDefaults
(String autoChildName, Canvas defaults) Changes the defaults for Canvas AutoChildren namedautoChildName
.static void
changeAutoChildDefaults
(String autoChildName, DrawItem defaults) Changes the defaults for DrawItem AutoChildren namedautoChildName
.static void
changeAutoChildDefaults
(String autoChildName, FormItem defaults) Changes the defaults for FormItem AutoChildren namedautoChildName
.protected JavaScriptObject
create()
Sets the text alignment from the x position.Get the center point of the label.This is the content that will exist as the label.Default class used to construct theEditProxy
for this component when the component isfirst placed into edit mode
.boolean
Font family name, similar to the CSS font-family attribute.int
Font size in pixels, similar to the CSS font-size attribute.Font style, similar to the CSS font-style attribute, eg "normal", "italic".Font weight, similar to the CSS font-weight attribute, eg "normal", "bold".KnobType[]
getKnobs()
DrawLabel only supports theKnobType.MOVE
knob type.int
getLeft()
Sets the amount from the left of its positioning that the element should be placed.double
Sets the amount from the left of its positioning that the element should be placed.The text color of the label.Getter implementing theLogicalStructure
interface, which supports Eclipse's logical structure debugging facility.static DrawLabel
getOrCreateRef
(JavaScriptObject jsObj) float
Deprecated.double
FordrawingType
"svg" only, the CSS class applied to this label.int
getTop()
Sets the amount from the top of its positioning that the element should be placed.double
Sets the amount from the top of its positioning that the element should be placed.setAlignment
(LabelAlignment alignment) Sets the text alignment from the x position.void
setAlignment
(String alignment) Deprecated.Use the method which takes a LabelAlignment.setContents
(String contents) This is the content that will exist as the label.static void
setDefaultProperties
(DrawLabel drawLabelProperties) Class level method to set the default properties of this class.setEditProxyConstructor
(String editProxyConstructor) Default class used to construct theEditProxy
for this component when the component isfirst placed into edit mode
.setEscapeContents
(boolean escapeContents) setFontFamily
(String fontFamily) Font family name, similar to the CSS font-family attribute.setFontSize
(int fontSize) Font size in pixels, similar to the CSS font-size attribute.setFontStyle
(String fontStyle) Font style, similar to the CSS font-style attribute, eg "normal", "italic".setFontWeight
(String fontWeight) Font weight, similar to the CSS font-weight attribute, eg "normal", "bold".DrawLabel only supports theKnobType.MOVE
knob type.setLeft
(int left) Sets the amount from the left of its positioning that the element should be placed.setLineColor
(String lineColor) The text color of the label.Setter implementing theLogicalStructure
interface, which supports Eclipse's logical structure debugging facility.setRotation
(double rotation) setRotation
(float rotation) Deprecated.void
setStyleName
(String styleName) FordrawingType
"svg" only, the CSS class applied to this label.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, addDragResizeMoveHandler, addDragResizeStartHandler, addDragResizeStopHandler, addDragStartHandler, addDragStopHandler, addDrawEndHandler, addDrawStartHandler, addMouseDownHandler, addMouseMoveHandler, addMouseOutHandler, addMouseOverHandler, addMouseUpHandler, addMovedHandler, addResizedHandler, addShowContextMenuHandler, bringToFront, computeAngle, computeAngleAsDouble, dragResizeMove, draw, erase, getAttributeAsBoolean, getAttributeAsDate, getAttributeAsDouble, getAttributeAsElement, getAttributeAsFloat, getAttributeAsInt, getAttributeAsJavaScriptObject, getAttributeAsMap, getAttributeAsString, getBoundingBox, getBoundingBoxAsDouble, getById, getByJSObject, getCanDrag, getCanHover, getCanvasAutoChild, getContextMenu, getCornerResizeKnob, getCursor, getDestroyed, getDestroying, getDragStartDistance, getDrawGroup, getDrawItemAutoChild, getDrawPane, getDrawPaneAsString, getEndArrow, getEndKnob, getEventOpaque, getFillColor, getFillGradient, getFillGradientAsString, getFillOpacity, getFormItemAutoChild, getHoverDelay, getHoverHTML, getKeepInParentRect, getLineCap, getLineOpacity, getLinePattern, getLineWidth, getMoveKnob, getMoveKnobOffset, getMoveKnobPoint, getPageLeft, getPageTop, getPaletteDefaults, getPrompt, getProportionalResizeModifiers, getProportionalResizing, getRef, getResizeBoundingBox, getResizeBoundingBoxAsDouble, getResizeKnobPoints, getResizeOutline, getResizeViaLocalTransformOnly, getRotateKnob, getScale, getShadow, getShowHover, getShowResizeOutline, getShowTitleLabelBackground, getSideResizeKnob, getStartArrow, getStartKnob, getSvgString, getTitle, getTitleAutoFit, getTitleAutoFitMargin, getTitleAutoFitRotationMode, getTitleLabel, getTitleLabelBackground, getTitleLabelPadding, getTitleRotationMode, getTranslate, getUnderlyingGWTCanvas, getUseSimpleTransform, getXShearFactor, getYShearFactor, getZIndex, hide, hideAllKnobs, hideKnobs, hideKnobs, hover, isInBounds, isPointInPath, moveBy, moveTo, resizeBy, resizeTo, rotateBy, rotateTo, scaleBy, scaleTo, sendToBack, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAutoChildConstructor, setAutoChildProperties, setAutoChildProperties, setAutoChildProperties, setAutoChildProperties, setAutoChildVisibility, setCanDrag, setCanHover, setCenterPoint, setContextMenu, setCursor, setDefaultProperties, setDragStartDistance, setDrawGroup, setDrawPane, setDrawPane, setEndArrow, setEventOpaque, setFillColor, setFillGradient, setFillGradient, setFillOpacity, setHoverDelay, setKeepInParentRect, setKeepInParentRect, setLineCap, setLineOpacity, setLinePattern, setLineWidth, setLogicalStructure, setMoveKnobOffset, setMoveKnobPoint, setPrompt, setPropertyValue, setProportionalResizeModifiers, setProportionalResizing, setResizeKnobPoints, setResizeViaLocalTransformOnly, setScale, setShadow, setShapeData, setShowHover, setShowResizeOutline, setShowTitleLabelBackground, setStartArrow, setTitle, setTitleAutoFit, setTitleAutoFitMargin, setTitleAutoFitRotationMode, setTitleLabelPadding, setTitleRotationMode, setTranslate, setUseSimpleTransform, setXShearFactor, setYShearFactor, setZIndex, show, showAllKnobs, showKnobs, showKnobs, supportsEndArrow, supportsStartArrow
Methods inherited from class com.smartgwt.client.widgets.BaseWidget
addDrawHandler, addDynamicProperty, addDynamicProperty, addDynamicProperty, addDynamicProperty, applyFactoryProperties, clearDynamicProperty, completeCreation, destroy, doAddHandler, doInit, doOnRender, equals, error, errorIfNotCreated, getAttribute, getAttributeAsDateArray, getAttributeAsFloatArray, getAttributeAsIntArray, getAttributeAsObject, getAttributeAsRecord, getAttributeAsStringArray, getClassName, getConfig, getDOM, getHandlerCount, getID, getInnerHTML, getJsObj, getOrCreateJsObj, getScClassName, hasAutoAssignedID, hasDynamicProperty, hashCode, initNativeObject, internalSetID, internalSetID, isConfigOnly, isCreated, isDrawn, isFactoryCreated, onBind, onDestroy, onDraw, onInit, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setConfig, setConfigOnly, setDefaultProperties, setDragTracker, setFactoryCreated, setHtmlElement, setID, setJavaScriptObject, setLogicalStructure, setLogicalStructure, setNullProperty, setPosition, setProperty, setProperty, setProperty, setProperty, setProperty, setProperty, setProperty, setScClassName, toString
Methods inherited from class com.google.gwt.user.client.ui.Widget
addAttachHandler, addBitlessDomHandler, addDomHandler, addHandler, asWidget, asWidgetOrNull, createHandlerManager, delegateEvent, doAttachChildren, doDetachChildren, fireEvent, getLayoutData, getParent, isAttached, isOrWasAttached, onAttach, onBrowserEvent, onDetach, onLoad, onUnload, removeFromParent, setLayoutData, sinkEvents, unsinkEvents
Methods inherited from class com.google.gwt.user.client.ui.UIObject
addStyleDependentName, addStyleName, ensureDebugId, ensureDebugId, ensureDebugId, getAbsoluteLeft, getAbsoluteTop, getElement, getOffsetHeight, getOffsetWidth, getStyleElement, getStyleName, getStylePrimaryName, getStylePrimaryName, isVisible, isVisible, onEnsureDebugId, removeStyleDependentName, removeStyleName, resolvePotentialElement, setElement, setElement, setHeight, setPixelSize, setSize, setStyleDependentName, setStyleName, setStyleName, setStyleName, setStylePrimaryName, setStylePrimaryName, setVisible, setVisible, setWidth, sinkBitlessEvent
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
Methods inherited from interface com.google.gwt.event.shared.HasHandlers
fireEvent
-
Constructor Details
-
DrawLabel
public DrawLabel() -
DrawLabel
-
-
Method Details
-
getOrCreateRef
-
changeAutoChildDefaults
Changes the defaults for Canvas AutoChildren namedautoChildName
.- Parameters:
autoChildName
- name of an AutoChild to customize the defaults for.defaults
- Canvas defaults to apply. These defaults override any existing properties without destroying or wiping out non-overridden properties. For usage tips on this param, seeSGWTProperties
.- See Also:
-
changeAutoChildDefaults
Changes the defaults for FormItem AutoChildren namedautoChildName
.- Parameters:
autoChildName
- name of an AutoChild to customize the defaults for.defaults
- FormItem defaults to apply. These defaults override any existing properties without destroying or wiping out non-overridden properties. For usage tips on this param, seeSGWTProperties
.- See Also:
-
changeAutoChildDefaults
Changes the defaults for DrawItem AutoChildren namedautoChildName
.- Parameters:
autoChildName
- name of an AutoChild to customize the defaults for.defaults
- DrawItem defaults to apply. These defaults override any existing properties without destroying or wiping out non-overridden properties. For usage tips on this param, seeSGWTProperties
.- See Also:
-
create
-
setAlignment
Sets the text alignment from the x position. Similar to HTML5 context.textAlign with alignment values such as "start", "center", and "end".Note that this setting is ignored for
DrawItem.titleLabel
autochildren, which are always considered to have "start" alignment to make handling ofDrawItem.titleRotationMode
simpler.- Parameters:
alignment
- New alignment value. Default value is DrawLabel.START- Returns:
DrawLabel
instance, for chaining setter calls- Throws:
IllegalStateException
- this property cannot be changed after the component has been created
-
getAlignment
Sets the text alignment from the x position. Similar to HTML5 context.textAlign with alignment values such as "start", "center", and "end".Note that this setting is ignored for
DrawItem.titleLabel
autochildren, which are always considered to have "start" alignment to make handling ofDrawItem.titleRotationMode
simpler.- Returns:
- Current alignment value. Default value is DrawLabel.START
-
setContents
This is the content that will exist as the label.
If this method is called after the component has been drawn/initialized: Sets this DrawLabel'scontents
.- Parameters:
contents
- the new contents. Default value is null- Returns:
DrawLabel
instance, for chaining setter calls- See Also:
-
getContents
This is the content that will exist as the label.- Returns:
- Current contents value. Default value is null
- See Also:
-
setEditProxyConstructor
Default class used to construct theEditProxy
for this component when the component isfirst placed into edit mode
.- Overrides:
setEditProxyConstructor
in classDrawItem
- Parameters:
editProxyConstructor
- New editProxyConstructor value. Default value is "DrawLabelEditProxy"- Returns:
DrawLabel
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
.- Overrides:
getEditProxyConstructor
in classDrawItem
- Returns:
- Current editProxyConstructor value. Default value is "DrawLabelEditProxy"
- See Also:
-
setEscapeContents
ForSVG-based
DrawPane
s, whether to escape the specifiedcontents
of this label so that any markup syntax is rendered "as is," without being interpreted as SVG. This setting should not be customized when working with otherdrawingType
s, as thecontents
are always escaped in such case.In SVG, a
DrawLabel
'scontents
are rendered inside a<text>
tag, so any SVG that's legal inside that tag can be set as thecontents
whenescapeContents
is false. See Mozilla SVG Developer Reference for more information about what exactly is supported.Note that the Framework will not be able to determine the width or height of a
DrawLabel
when this property is false, so the Framework will consider both dimensions to be zero, and centering will not work (e.g. forDrawItem.titleLabel
autochildren). For top-levelDrawLabel
s, you may be able to get the DOM to center your content by settingalignment
as "center" - the DOM will then interpret theleft
,top
coordinates of the label as its centerpoint even though our Framework doesn't know the label's actual size.For a
titleLabel
, thealignment
setting is ignored, as the Framework always positions it using "start" alignment, but SVG code such as the following demonstrates that centering is possible (via the "style" setting):<tspan text-decoration='underline' font-size='20px' style='dominant-baseline:central; text-anchor:middle;'>MyLabel </tspan>
If this method is called after the component has been drawn/initialized: Sets theescapeContents
property for this DrawLabel. -
getEscapeContents
public boolean getEscapeContents()ForSVG-based
DrawPane
s, whether to escape the specifiedcontents
of this label so that any markup syntax is rendered "as is," without being interpreted as SVG. This setting should not be customized when working with otherdrawingType
s, as thecontents
are always escaped in such case.In SVG, a
DrawLabel
'scontents
are rendered inside a<text>
tag, so any SVG that's legal inside that tag can be set as thecontents
whenescapeContents
is false. See Mozilla SVG Developer Reference for more information about what exactly is supported.Note that the Framework will not be able to determine the width or height of a
DrawLabel
when this property is false, so the Framework will consider both dimensions to be zero, and centering will not work (e.g. forDrawItem.titleLabel
autochildren). For top-levelDrawLabel
s, you may be able to get the DOM to center your content by settingalignment
as "center" - the DOM will then interpret theleft
,top
coordinates of the label as its centerpoint even though our Framework doesn't know the label's actual size.For a
titleLabel
, thealignment
setting is ignored, as the Framework always positions it using "start" alignment, but SVG code such as the following demonstrates that centering is possible (via the "style" setting):<tspan text-decoration='underline' font-size='20px' style='dominant-baseline:central; text-anchor:middle;'>MyLabel </tspan>
- Returns:
- Current escapeContents value. Default value is true
- See Also:
-
setFontFamily
Font family name, similar to the CSS font-family attribute.- Parameters:
fontFamily
- New fontFamily value. Default value is "Tahoma"- Returns:
DrawLabel
instance, for chaining setter calls- Throws:
IllegalStateException
- this property cannot be changed after the component has been created- See Also:
-
getFontFamily
Font family name, similar to the CSS font-family attribute.- Returns:
- Current fontFamily value. Default value is "Tahoma"
- See Also:
-
setFontSize
Font size in pixels, similar to the CSS font-size attribute.
If this method is called after the component has been drawn/initialized: Sets this DrawLabel'sfontSize
.- Parameters:
fontSize
- the new font size in pixels. Default value is 18- Returns:
DrawLabel
instance, for chaining setter calls- See Also:
-
getFontSize
public int getFontSize()Font size in pixels, similar to the CSS font-size attribute.- Returns:
- Current fontSize value. Default value is 18
- See Also:
-
setFontStyle
Font style, similar to the CSS font-style attribute, eg "normal", "italic".- Parameters:
fontStyle
- New fontStyle value. Default value is "normal"- Returns:
DrawLabel
instance, for chaining setter calls- Throws:
IllegalStateException
- this property cannot be changed after the component has been created- See Also:
-
getFontStyle
Font style, similar to the CSS font-style attribute, eg "normal", "italic".- Returns:
- Current fontStyle value. Default value is "normal"
- See Also:
-
setFontWeight
Font weight, similar to the CSS font-weight attribute, eg "normal", "bold".- Parameters:
fontWeight
- New fontWeight value. Default value is "bold"- Returns:
DrawLabel
instance, for chaining setter calls- Throws:
IllegalStateException
- this property cannot be changed after the component has been created- See Also:
-
getFontWeight
Font weight, similar to the CSS font-weight attribute, eg "normal", "bold".- Returns:
- Current fontWeight value. Default value is "bold"
- See Also:
-
setKnobs
DrawLabel only supports theKnobType.MOVE
knob type.- Overrides:
setKnobs
in classDrawItem
- Parameters:
knobs
- New knobs value. Default value is null- Returns:
DrawLabel
instance, for chaining setter calls- Throws:
IllegalStateException
- this property cannot be changed after the component has been created- See Also:
-
getKnobs
DrawLabel only supports theKnobType.MOVE
knob type. -
setLeft
Sets the amount from the left of its positioning that the element should be placed.- Parameters:
left
- New left value. Default value is 0- Returns:
DrawLabel
instance, for chaining setter calls- Throws:
IllegalStateException
- this property cannot be changed after the component has been created
-
getLeft
public int getLeft()Sets the amount from the left of its positioning that the element should be placed.- Returns:
- Current left value. Default value is 0
-
getLeftAsDouble
public double getLeftAsDouble()Sets the amount from the left of its positioning that the element should be placed.- Returns:
- Current left value. Default value is 0
-
setLineColor
The text color of the label.
If this method is called after the component has been drawn/initialized: Sets the text color of the label.- Overrides:
setLineColor
in classDrawItem
- Parameters:
lineColor
- new text color. Default value is "#808080"- Returns:
DrawLabel
instance, for chaining setter calls- See Also:
-
getLineColor
The text color of the label.- Overrides:
getLineColor
in classDrawItem
- Returns:
- Current lineColor value. Default value is "#808080"
- See Also:
-
setRotation
Deprecated.- Overrides:
setRotation
in classDrawItem
- Parameters:
rotation
- New rotation value. Default value is 0.0- Returns:
DrawLabel
instance, for chaining setter calls- Throws:
IllegalStateException
- this property cannot be changed after the component has been created
-
getRotation
public float getRotation()Deprecated.- Overrides:
getRotation
in classDrawItem
- Returns:
- Current rotation value. Default value is 0.0
-
setRotation
- Overrides:
setRotation
in classDrawItem
- Parameters:
rotation
- New rotation value. Default value is 0.0- Returns:
DrawLabel
instance, for chaining setter calls- Throws:
IllegalStateException
- this property cannot be changed after the component has been created
-
getRotationAsDouble
public double getRotationAsDouble()- Overrides:
getRotationAsDouble
in classDrawItem
- Returns:
- Current rotation value. Default value is 0.0
-
setStyleName
FordrawingType
"svg" only, the CSS class applied to this label. Similar toCanvas.styleName
. The font propertiesfontSize
,fontWeight
,fontStyle
, andfontFamily
, unless set to null, take priority over any CSS settings. This property can be used in combination withescapeContents
if needed. but note that in SVG, the precedence of CSS and inline styling applied to an element works differently that it does in HTML. See Mozilla SVG Developer ReferenceNote that only font sizes defined in pixels are supported through this property.
If this method is called after the component has been drawn/initialized: Sets this DrawLabel'sstyleName
.- Overrides:
setStyleName
in classUIObject
- Parameters:
styleName
- the new styleName. Default value is "normal"- See Also:
-
getStyleName
FordrawingType
"svg" only, the CSS class applied to this label. Similar toCanvas.styleName
. The font propertiesfontSize
,fontWeight
,fontStyle
, andfontFamily
, unless set to null, take priority over any CSS settings. This property can be used in combination withescapeContents
if needed. but note that in SVG, the precedence of CSS and inline styling applied to an element works differently that it does in HTML. See Mozilla SVG Developer ReferenceNote that only font sizes defined in pixels are supported through this property.
- Overrides:
getStyleName
in classUIObject
- Returns:
- Current styleName value. Default value is "normal"
- See Also:
-
setTop
Sets the amount from the top of its positioning that the element should be placed.- Parameters:
top
- New top value. Default value is 0- Returns:
DrawLabel
instance, for chaining setter calls- Throws:
IllegalStateException
- this property cannot be changed after the component has been created
-
getTop
public int getTop()Sets the amount from the top of its positioning that the element should be placed.- Returns:
- Current top value. Default value is 0
-
getTopAsDouble
public double getTopAsDouble()Sets the amount from the top of its positioning that the element should be placed.- Returns:
- Current top value. Default value is 0
-
getCenter
Get the center point of the label. -
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:
drawLabelProperties
- properties that should be used as new defaults when instances of this class are created- See Also:
-
setAlignment
Deprecated.Use the method which takes a LabelAlignment.- Parameters:
alignment
- Default value is "start"- Throws:
IllegalStateException
- Thrown upon attempt to change after component creation.
-
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 classDrawItem
-
GwtFloatVsDouble