twaver.network
Class LabelUI

java.lang.Object
  extended by twaver.core.network.BaseUI<T>
      extended by twaver.network.UI<java.lang.String>
          extended by twaver.network.LabelUI
All Implemented Interfaces:
twaver.core.network.IUI<java.lang.String,Canvas,Paint>

public class LabelUI
extends UI<java.lang.String>

文本标签元素,用于显示文字,默认用于网元文本标签和告警冒泡的显示,也可以用于LabelAttachment的呈现 支持文字换行,旋转时能保持文字正立

See Also:
LabelAttachment

Field Summary
 
Fields inherited from class twaver.network.UI
elementUI
 
Fields inherited from class twaver.core.network.BaseUI
anchorPoint, bodyOffsetX, bodyOffsetY, bounds, data, invalidateAnchorPointFlag, invalidateLocationFlag, invalidateRenderFlag, invalidateSizeFlag, location, stateOutline, stateOutlineColor, visible
 
Constructor Summary
LabelUI(ElementUI<?> elementUI)
          文本标签元素,用于显示文字,默认用于网元文本标签和告警冒泡的显示,也可以用于LabelAttachment的呈现 支持文字换行,旋转时能保持文字正立
 
Method Summary
protected  void drawBodySelection(Canvas canvas, Paint paint)
          绘制主体选中效果
protected  void drawText(Canvas canvas, Paint paint)
          绘制文本,支持换行,旋转时能保持文字正立
 int getColor()
          文本颜色
 Typeface getFont()
          文字字体,默认字体为Defaults.FONT
 float getFontSize()
          文字字体大小,默认大小为Defaults.FONT_SIZE
 boolean isFitNodeHeight()
           
 boolean isFitNodeWidth()
           
 void measure()
           
protected  void onDrawBody(Canvas canvas, Paint paint, boolean drawSelectionOnBody, boolean drawStateOutlineOnBody)
          绘制主体
 void setColor(int color)
          文本颜色
 boolean setFitNodeHeight(boolean isFitNodeHeight)
          是否适应网元的高度,该属性为true时,将使用网元高度与文本原始高度的最大值,作为文本UI的高度
 boolean setFitNodeWidth(boolean isFitNodeWidth)
          是否适应网元的宽度,该属性为true时,将使用网元宽度与文本原始宽度中的最大值,作为文本UI的宽度
 boolean setFont(Typeface font)
          设置文字字体,默认字体为Defaults.FONT
 boolean setFontSize(float fontSize)
          设置文字字体大小,默认大小为Defaults.FONT_SIZE
 
Methods inherited from class twaver.network.UI
drawBodyStateOutline, drawBodyStateOutline, getElementUI, getPosition, intersect, intersect, invalidateSize, isSendToBottom, resetPaint, setPosition, setSendToBottom
 
Methods inherited from class twaver.core.network.BaseUI
checkBackground, checkOutline, draw, drawBackgroundAndBorder, drawBody, drawStateOutline, drawStateOutline, getAnchorPoint, getAnchorPosition, getAngle, getBackgroundColor, getBounds, getCornerRadius, getData, getLocation, getMeasuredHeight, getMeasuredWidth, getOffset, getOutlineColor, getOutlineWidth, getRenderColor, getSelectionBorder, getSelectionBorderColor, getStateOutline, getStateOutlineColor, intersectPointer, invalidateAnchorPoint, invalidateLocation, invalidatePointer, invalidateRender, isDrawBackground, isDrawOutline, isDrawStateOutline, isInvalidate, isInvalidateAnchorPoint, isInvalidateLocation, isInvalidateSize, isLayoutByAnchorPoint, isRelativeLocation, isRotatable, isSelected, isShowOnTop, isVisible, measureAnchorPosition, onDraw, onDrawBackgroundAndBorder, perLocation, resetShape, setAnchorPosition, setBackgroundColor, setBackgroundShader, setBounds, setBounds, setCornerRadius, setData, setLayoutByAnchorPoint, setLocation, setLocation, setMeasuredSize, setOffset, setOutline, setOutlineColor, setPadding, setPointerVisible, setPointerWidth, setRenderColor, setRotatable, setSelected, setSelectionBorder, setSelectionBorderColor, setShowOnTop, setStateOutline, setStateOutlineColor, setVisible, styleSelectionPaint, toAbsoluteRect, toLocalPoint, toLocalRect, validate, validateLocation, validatePointer, validateRender
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

LabelUI

public LabelUI(ElementUI<?> elementUI)
文本标签元素,用于显示文字,默认用于网元文本标签和告警冒泡的显示,也可以用于LabelAttachment的呈现 支持文字换行,旋转时能保持文字正立

Parameters:
elementUI -
See Also:
LabelAttachment
Method Detail

getColor

public int getColor()
文本颜色

Returns:
文本颜色
See Also:
setColor(int)

setColor

public void setColor(int color)
文本颜色

Parameters:
color -
See Also:
getColor()

setFitNodeHeight

public boolean setFitNodeHeight(boolean isFitNodeHeight)
是否适应网元的高度,该属性为true时,将使用网元高度与文本原始高度的最大值,作为文本UI的高度

Parameters:
isFitNodeHeight -
Returns:
是否设置成功
See Also:
setFitNodeWidth(boolean), isFitNodeHeight()

isFitNodeHeight

public boolean isFitNodeHeight()
Returns:
是否适应网元的高度
See Also:
setFitNodeHeight(boolean)

setFitNodeWidth

public boolean setFitNodeWidth(boolean isFitNodeWidth)
是否适应网元的宽度,该属性为true时,将使用网元宽度与文本原始宽度中的最大值,作为文本UI的宽度

Parameters:
isFitNodeWidth -
Returns:
是否设置成功
See Also:
isFitNodeWidth()

isFitNodeWidth

public boolean isFitNodeWidth()
Returns:
是否适应网元的宽度
See Also:
setFitNodeWidth(boolean)

getFont

public Typeface getFont()
文字字体,默认字体为Defaults.FONT

Returns:
文字字体

setFont

public boolean setFont(Typeface font)
设置文字字体,默认字体为Defaults.FONT

Parameters:
font -
Returns:
是否设置成功
See Also:
getFont()

getFontSize

public float getFontSize()
文字字体大小,默认大小为Defaults.FONT_SIZE

Returns:
字体大小
See Also:
setFontSize(float)

setFontSize

public boolean setFontSize(float fontSize)
设置文字字体大小,默认大小为Defaults.FONT_SIZE

Parameters:
fontSize -
Returns:
是否设置成功
See Also:
getFontSize()

measure

public void measure()
Specified by:
measure in class twaver.core.network.BaseUI<java.lang.String>

onDrawBody

protected void onDrawBody(Canvas canvas,
                          Paint paint,
                          boolean drawSelectionOnBody,
                          boolean drawStateOutlineOnBody)
Description copied from class: UI
绘制主体

Overrides:
onDrawBody in class UI<java.lang.String>
drawSelectionOnBody - 是否绘制选中效果
drawStateOutlineOnBody - 是否绘制边框
See Also:
UI.drawBodySelection(Canvas, Paint), UI.drawBodyStateOutline(Canvas, Paint)

drawBodySelection

protected void drawBodySelection(Canvas canvas,
                                 Paint paint)
Description copied from class: UI
绘制主体选中效果

Overrides:
drawBodySelection in class UI<java.lang.String>

drawText

protected void drawText(Canvas canvas,
                        Paint paint)
绘制文本,支持换行,旋转时能保持文字正立

Parameters:
canvas -
paint -