twaver.network
Class ShapeNodeUI

java.lang.Object
  extended by twaver.core.network.BaseUI<T>
      extended by twaver.network.ElementUI<Node>
          extended by twaver.network.NodeUI
              extended by twaver.network.ShapeNodeUI
All Implemented Interfaces:
twaver.core.network.IUI<Node,Canvas,Paint>, Identifiable, IPathUI

public class ShapeNodeUI
extends NodeUI
implements IPathUI

用于呈现ShapeNode网元类型,可以填充呈现多边形,或者不填充呈现线条样式

See Also:
IPathUI

Field Summary
 
Fields inherited from class twaver.network.NodeUI
imageUI, shapeUI
 
Fields inherited from class twaver.network.ElementUI
alarm, body, isLayouting, label, network
 
Fields inherited from class twaver.core.network.BaseUI
anchorPoint, bodyOffsetX, bodyOffsetY, bounds, data, invalidateAnchorPointFlag, invalidateLocationFlag, invalidateRenderFlag, invalidateSizeFlag, location, stateOutline, stateOutlineColor, visible
 
Constructor Summary
ShapeNodeUI(ShapeNode data, Network network)
           
 
Method Summary
protected  boolean byShape()
          是否使用shapeUI作为网元主体,如果网元是ShapeNode类型,或者contentType属性为Consts.CONTENT_TYPE_SHAPE,则返回true
protected  boolean doValidate()
          执行生效动作,比如孩子元素的位置布局,范围大小的确定等等
 float getLength()
          路径长度
 float getLineWidth()
          路径线条宽度
 java.util.List<PathSegment> getPathSegments()
          获取路径
 void invalidatePoints()
          无效多边形路径数据
 boolean isInvalidatePoints()
          路径是否无效
 boolean isLayoutByAnchorPoint()
           
 boolean isLayoutByPath()
          是否沿线布局
protected  boolean onElementPropertyChange(java.lang.String propertyName, PropertyChangeEvent evt)
          网元属性变化时,调用此函数
protected  void resetShapeData()
          重新设置图形类型,默认取样式Styles.SHAPE_TYPE属性,只在网元主体为shapeUI是起作用
protected  void resetStyles()
          重新加载网元UI的所有样式
 boolean setLayoutByPath(boolean layoutByPath)
          设置孩子是否沿路径布局,设置true时,网元上挂载的元素将沿线分布
protected  void validatePoints()
          生成多边形路径数据
 
Methods inherited from class twaver.network.NodeUI
checkBody, checkNodeStyle, createChildren, invalidateLinks, invalidateLocation, onBodyChange, resetNodeProperties
 
Methods inherited from class twaver.network.ElementUI
addChild, checkAttachments, createAttachmentUI, drawChildren, drawSendToBottomChildren, drawShowOnTop, getBody, getBodyBounds, getBooleanStyle, getChildren, getColorStyle, getFloatStyle, getId, getInsetsStyle, getIntStyle, getNetwork, getShaderStyle, getStringStyle, getStyle, getUIBounds, hasChildOnTop, hitTest, initialize, intersect, invalidateStyle, invalidateStyles, invalidateUI, isInitialized, isVisible, layout, measure, onDraw, onDrawBody, onElementPropertyChange, removeChild, setBody, setChildIndex, setLayoutByAnchorPoint, setRenderColor, setSelected, setSelectionBorder, setSelectionBorderColor, validate
 
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, intersect, intersectPointer, invalidateAnchorPoint, invalidatePointer, invalidateRender, invalidateSize, isDrawBackground, isDrawOutline, isDrawStateOutline, isInvalidate, isInvalidateAnchorPoint, isInvalidateLocation, isInvalidateSize, isRelativeLocation, isRotatable, isSelected, isShowOnTop, measureAnchorPosition, onDrawBackgroundAndBorder, perLocation, resetPaint, resetShape, setAnchorPosition, setBackgroundColor, setBackgroundShader, setBounds, setBounds, setCornerRadius, setData, setLocation, setLocation, setMeasuredSize, setOffset, setOutline, setOutlineColor, setPadding, setPointerVisible, setPointerWidth, setRotatable, setShowOnTop, setStateOutline, setStateOutlineColor, setVisible, styleSelectionPaint, toAbsoluteRect, toLocalPoint, toLocalRect, validateLocation, validatePointer, validateRender
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ShapeNodeUI

public ShapeNodeUI(ShapeNode data,
                   Network network)
Method Detail

byShape

protected boolean byShape()
Description copied from class: NodeUI
是否使用shapeUI作为网元主体,如果网元是ShapeNode类型,或者contentType属性为Consts.CONTENT_TYPE_SHAPE,则返回true

Overrides:
byShape in class NodeUI
Returns:
如果网元是ShapeNode类型,或者contentType属性为Consts.CONTENT_TYPE_SHAPE,则返回true
See Also:
Node.setContentType(int)

resetStyles

protected void resetStyles()
Description copied from class: ElementUI
重新加载网元UI的所有样式

Overrides:
resetStyles in class NodeUI

resetShapeData

protected void resetShapeData()
Description copied from class: NodeUI
重新设置图形类型,默认取样式Styles.SHAPE_TYPE属性,只在网元主体为shapeUI是起作用

Overrides:
resetShapeData in class NodeUI
See Also:
Styles.SHAPE_TYPE

isLayoutByAnchorPoint

public boolean isLayoutByAnchorPoint()
Overrides:
isLayoutByAnchorPoint in class twaver.core.network.BaseUI<Node>

validatePoints

protected void validatePoints()
生成多边形路径数据

See Also:
invalidatePoints()

onElementPropertyChange

protected boolean onElementPropertyChange(java.lang.String propertyName,
                                          PropertyChangeEvent evt)
Description copied from class: ElementUI
网元属性变化时,调用此函数

Overrides:
onElementPropertyChange in class NodeUI
Parameters:
propertyName - 属性名
evt - 属性变化事件
Returns:
是否需要重绘
See Also:
ElementUI.onElementPropertyChange(PropertyChangeEvent)

doValidate

protected boolean doValidate()
Description copied from class: ElementUI
执行生效动作,比如孩子元素的位置布局,范围大小的确定等等

Overrides:
doValidate in class NodeUI
Returns:
是否需要生效
See Also:
ElementUI.layout(), ElementUI.measure()

invalidatePoints

public void invalidatePoints()
无效多边形路径数据

See Also:
validatePoints()

isInvalidatePoints

public boolean isInvalidatePoints()
路径是否无效

Returns:
路径是否无效

getPathSegments

public java.util.List<PathSegment> getPathSegments()
Description copied from interface: IPathUI
获取路径

Specified by:
getPathSegments in interface IPathUI
Returns:
获取路径集合

isLayoutByPath

public boolean isLayoutByPath()
Description copied from interface: IPathUI
是否沿线布局

Specified by:
isLayoutByPath in interface IPathUI
Returns:
是否沿线布局

setLayoutByPath

public boolean setLayoutByPath(boolean layoutByPath)
设置孩子是否沿路径布局,设置true时,网元上挂载的元素将沿线分布

Parameters:
layoutByPath - 孩子是否沿路径布局
Returns:
是否设置成功

getLength

public float getLength()
Description copied from interface: IPathUI
路径长度

Specified by:
getLength in interface IPathUI
Returns:
路径长度

getLineWidth

public float getLineWidth()
Description copied from interface: IPathUI
路径线条宽度

Specified by:
getLineWidth in interface IPathUI
Returns:
路径线条宽度