twaver.network
Class NodeUI

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

public class NodeUI
extends ElementUI<Node>

节点图形元素,用于绘制网元节点


Field Summary
protected  ImageUI imageUI
          图片元素 节点主体可以是图片,也可以是图形,可以使用Node.setContentType(int)进行切换 默认使用imageUI作为主体,imageUI不只支持图片,还包括其他数据,如gif动画,以及任意android.graphics.drawable.Drawable类型,更多可参考ImageUI
protected  ShapeUI shapeUI
          图形元素 节点主体可以是图片,也可以是图形,可以使用Node.setContentType(int)进行切换 如果使用多边形或者线段作为主体,则用shapeUI作为body,此外ShapeNodeUI也使用shapeUI作为body
 
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
NodeUI(Node node, Network network)
          节点图形元素,用于绘制网元节点
 
Method Summary
protected  boolean byShape()
          是否使用shapeUI作为网元主体,如果网元是ShapeNode类型,或者contentType属性为Consts.CONTENT_TYPE_SHAPE,则返回true
protected  boolean checkBody()
          检查主体类型,以确定使用imageUI还是shapeUI作为网元主体
protected  boolean checkNodeStyle(java.lang.String propertyName, PropertyChangeEvent evt)
           
protected  void createChildren()
          创建孩子元素,比如文本标签,告警标签等等
protected  boolean doValidate()
          执行生效动作,比如孩子元素的位置布局,范围大小的确定等等
 void invalidateLinks()
           
 void invalidateLocation()
           
protected  void onBodyChange()
          主体UI元素更改时,回调此函数,比如网元内容类型从image改为shape时,主体元素会从ImageUI换成ShapeUI
protected  boolean onElementPropertyChange(java.lang.String propertyName, PropertyChangeEvent evt)
          网元属性变化时,调用此函数
protected  void resetNodeProperties()
          重设节点相关样式
protected  void resetShapeData()
          重新设置图形类型,默认取样式Styles.SHAPE_TYPE属性,只在网元主体为shapeUI是起作用
protected  void resetStyles()
          重新加载网元UI的所有样式
 
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, isLayoutByAnchorPoint, 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
 

Field Detail

shapeUI

protected ShapeUI shapeUI
图形元素 节点主体可以是图片,也可以是图形,可以使用Node.setContentType(int)进行切换 如果使用多边形或者线段作为主体,则用shapeUI作为body,此外ShapeNodeUI也使用shapeUI作为body

See Also:
Node.setContentType(int), Consts.CONTENT_TYPE_SHAPE

imageUI

protected ImageUI imageUI
图片元素 节点主体可以是图片,也可以是图形,可以使用Node.setContentType(int)进行切换 默认使用imageUI作为主体,imageUI不只支持图片,还包括其他数据,如gif动画,以及任意android.graphics.drawable.Drawable类型,更多可参考ImageUI

See Also:
ImageUI, IImage, twaver.Utils#registerImage(...), Node.setContentType(int), Consts.CONTENT_TYPE_SHAPE
Constructor Detail

NodeUI

public NodeUI(Node node,
              Network network)
节点图形元素,用于绘制网元节点

Parameters:
node - 节点
network - 拓扑图
Method Detail

checkBody

protected boolean checkBody()
检查主体类型,以确定使用imageUI还是shapeUI作为网元主体

Returns:
See Also:
Node.setContentType(int)

byShape

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

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

createChildren

protected void createChildren()
Description copied from class: ElementUI
创建孩子元素,比如文本标签,告警标签等等

Overrides:
createChildren in class ElementUI<Node>
See Also:
ElementUI.initialize()

resetStyles

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

Overrides:
resetStyles in class ElementUI<Node>

resetNodeProperties

protected void resetNodeProperties()
重设节点相关样式


onBodyChange

protected void onBodyChange()
Description copied from class: ElementUI
主体UI元素更改时,回调此函数,比如网元内容类型从image改为shape时,主体元素会从ImageUI换成ShapeUI

Overrides:
onBodyChange in class ElementUI<Node>
See Also:
Node.setContentType(int)

resetShapeData

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

See Also:
Styles.SHAPE_TYPE

doValidate

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

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

onElementPropertyChange

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

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

checkNodeStyle

protected boolean checkNodeStyle(java.lang.String propertyName,
                                 PropertyChangeEvent evt)

invalidateLinks

public void invalidateLinks()

invalidateLocation

public void invalidateLocation()
Overrides:
invalidateLocation in class twaver.core.network.BaseUI<Node>