|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objecttwaver.model.Data
twaver.model.Element
twaver.model.Node
public class Node
节点类型,可以设置图片,添加跟随者
默认对应的UI类是 NodeUI
Field Summary | |
---|---|
protected Position |
anchorPosition
挂载点位置 |
protected Size |
calculateSize
网元计算大小,网元计算大小不一定等于 size ,默认网元大小为空,网元计算大小则为网元图片的宽高
此外网元计算大小也不一定等于网元的显示大小,网元的显示大小由一系列样式决定 |
protected int |
contentType
内容类型,默认为图片,表示网元呈现主体,可设置为图片或者图形类型 Consts.CONTENT_TYPE_IMAGE , Consts.CONTENT_TYPE_SHAPE |
protected Node |
host
宿主节点,一个节点跟随另一个节点拖动而移动,被跟随的节点称为宿主节点 |
protected java.lang.Object |
image
图片属性 |
protected boolean |
invalidateAnchorPointFlag
挂载点变化标志 |
protected boolean |
invalidateImageFlag
图片无效标志 |
protected boolean |
invalidateSizeFlag
网元大小无效标志 |
protected Point |
location
节点坐标 |
protected Size |
size
网元大小,网元大小不一定等于网元计算大小 calculateSize ,默认网元大小为空,网元计算大小则为网元图片的宽高 |
Fields inherited from class twaver.model.Element |
---|
alarmState, attachments, layerId, name, uiClass |
Fields inherited from class twaver.model.Data |
---|
parent |
Constructor Summary | |
---|---|
Node()
构造函数 |
Method Summary | |
---|---|
boolean |
addFollower(Node follower)
添加跟随者,网元被拖动时,跟随者也会被拖动,以下两行代码作用相同: |
Rect |
calculateBounds()
计算网元范围,网元计算范围与实际显示范围不一定相同,网元实际显示范围与呈现样式有关 calculateSize |
void |
checkLinkAgent()
重新检查所有连线的代理节点 |
void |
clearFollowers()
清除跟随者 |
HashList<Link> |
getAgentLinks()
所有的代理连线 |
Point |
getAnchorPoint()
获取挂载点坐标 |
Position |
getAnchorPosition()
挂载点位置 |
Size |
getCalculateSize()
网元计算大小, calculateSize |
int |
getContentType()
获取内容类型,默认为图片,表示网元呈现主体,可设置为图片或者图形类型 Consts.CONTENT_TYPE_IMAGE , Consts.CONTENT_TYPE_SHAPE |
int |
getFollowerCount()
获取跟随者数量 |
int |
getFollowerIndex(Node child)
获取跟随者的索引号 |
HashList<Node> |
getFollowers()
获取所有的跟随者,结果可能为null |
HashList<Node> |
getFollowers(boolean create)
获取所有的跟随者 |
HashList<Link> |
getFromAgentLinks()
获取起始端所有的代理连线 |
HashList<Link> |
getFromLinks()
获取所有起始端连线 |
Node |
getHost()
获取宿主节点 |
java.lang.Object |
getImage()
获取网元图片 |
HashList<Link> |
getLinks()
获取该节点上所有的连线 |
Point |
getLocation()
节点坐标 |
HashList<Link> |
getLoopedLinks()
获取节点左右的自环 |
Size |
getSize()
获取网元大小,@see size |
Size |
getSize(boolean calculate)
获取网元大小,如果calculate参数为true,返回网元计算大小 calculateSize ,否则返回网元大小size |
HashList<Link> |
getToAgentLinks()
获取结束端所有代理连线 |
HashList<Link> |
getToLinks()
获取所有结束端连线 |
float |
getX()
节点x坐标 |
float |
getY()
节点y坐标 |
boolean |
hasAgentLinks()
是否有代理连线相连 |
boolean |
hasFollowers()
是否拥有跟随者 |
boolean |
invalidateVisibility()
无效网元的可见状态 |
void |
onParentChanged(Data oldParent,
Data newParent)
|
boolean |
removeFollower(Node follower)
删除跟随者 |
boolean |
setAnchorPosition(Position anchorPosition)
设置挂载点位置 |
boolean |
setContentType(int contentType)
设置内容类型,默认为图片,表示网元呈现主体,可设置为图片或者图形类型 Consts.CONTENT_TYPE_IMAGE , Consts.CONTENT_TYPE_SHAPE
contentType
getContentType() |
void |
setFollowerIndex(Node child,
int index)
设置跟随者索引位置 |
boolean |
setHost(Node host)
设置宿主节点,与 addFollower(Node) 可以实现相同的功能,以下两行代码作用相同: |
boolean |
setImage(java.lang.Object image)
设置网元图片,支持多种类型,栅格图片,gif动画, Drawable 实现类,IImage 实现类
通常图片先进行全局注册Utils.registerImage(String, IImage) ,然后通过注册名称使用,比如: |
boolean |
setLocation(double x,
double y)
设置节点坐标 |
boolean |
setLocation(Point location)
设置节点坐标 |
boolean |
setSize(double width,
double height)
设置网元大小,@see setSize(Size) |
boolean |
setSize(Size size)
设置网元大小 |
Node[] |
toFollowers()
获取跟随者数组 |
protected void |
validateSize()
计算网元大小, calculateSize |
Methods inherited from class twaver.model.Element |
---|
addAttachment, clearAttachments, firePropertyChangeEvent, getAlarmState, getAlarmState, getAttachment, getAttachments, getLayerId, getName, getStyle, getStyles, getStyles, getUIClass, hasAlarm, hasAttachment, hasStyle, isVisible, isVisible, removeAttachment, removeStyle, setAlarmState, setLayerId, setName, setStyle, setUIClass, updateAttachment, updateAttachment |
Methods inherited from class twaver.model.Data |
---|
addChild, addChild, beforeEvent, clearChildren, get, getChildAt, getChildIndex, getChildren, getChildrenCount, getId, getParent, getProperties, getProperties, hasChildren, hashCode, isDescendantOf, onChildAdd, onChildRemove, onChildrenClear, onEvent, remove, removeChild, set, setChildIndex, setListener, setParent, setParent, setProperty, toChildren, toString |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
protected java.lang.Object image
protected transient boolean invalidateImageFlag
protected transient boolean invalidateSizeFlag
protected transient boolean invalidateAnchorPointFlag
protected Size size
calculateSize
,默认网元大小为空,网元计算大小则为网元图片的宽高
calculateSize
protected transient Size calculateSize
size
,默认网元大小为空,网元计算大小则为网元图片的宽高
此外网元计算大小也不一定等于网元的显示大小,网元的显示大小由一系列样式决定
size
protected Position anchorPosition
protected int contentType
Consts.CONTENT_TYPE_IMAGE
, Consts.CONTENT_TYPE_SHAPE
setContentType(int)
protected Node host
protected Point location
Constructor Detail |
---|
public Node()
Method Detail |
---|
public java.lang.Object getImage()
public boolean setImage(java.lang.Object image)
Drawable
实现类,IImage
实现类
通常图片先进行全局注册Utils.registerImage(String, IImage)
,然后通过注册名称使用,比如:
Utils.registerImage("node", "/twaver/resource/images/node.png"); node.setImage("node");
image
- 图片,可以是已注册的图片名称,或IImage
, Bitmap
, Drawable
, URL
以及资源id等等
IImage
,
Utils.registerImage(String, IImage)
public boolean setContentType(int contentType)
Consts.CONTENT_TYPE_IMAGE
, Consts.CONTENT_TYPE_SHAPE
contentType
getContentType()
contentType
-
public int getContentType()
Consts.CONTENT_TYPE_IMAGE
, Consts.CONTENT_TYPE_SHAPE
setContentType(int)
public boolean addFollower(Node follower)
host.addFollower(follower); follower.setHost(host);
follower
- 跟随者
setHost(Node)
,
removeFollower(Node)
public boolean removeFollower(Node follower)
follower
- 跟随者
addFollower(Node)
public HashList<Node> getFollowers()
getFollowers(boolean)
public HashList<Node> getFollowers(boolean create)
create
- 如果followers
为null,且create参数为true,则创建一个空的集合
public boolean hasFollowers()
public Node[] toFollowers()
public void clearFollowers()
public int getFollowerIndex(Node child)
child
- 跟随节点
public void setFollowerIndex(Node child, int index)
child
- index
- public int getFollowerCount()
public HashList<Link> getFromLinks()
public HashList<Link> getToLinks()
public HashList<Link> getLinks()
public HashList<Link> getLoopedLinks()
public HashList<Link> getFromAgentLinks()
public HashList<Link> getToAgentLinks()
public boolean hasAgentLinks()
public HashList<Link> getAgentLinks()
public void onParentChanged(Data oldParent, Data newParent)
onParentChanged
in interface IChildList
onParentChanged
in class Data
public void checkLinkAgent()
public Node getHost()
public boolean setHost(Node host)
addFollower(Node)
可以实现相同的功能,以下两行代码作用相同:
host.addFollower(follower); follower.setHost(host);
host
- 宿主节点
public float getX()
public float getY()
public Point getLocation()
public boolean setLocation(Point location)
location
- 节点坐标
public boolean setLocation(double x, double y)
x
- x坐标y
- y坐标
public Position getAnchorPosition()
public boolean setAnchorPosition(Position anchorPosition)
anchorPosition
- 挂载点位置
public Point getAnchorPoint()
public boolean setSize(Size size)
size
- 网元大小,对于图片支持等比缩放,比如下面的代码,表示设置网元宽度40像素,高度按图片比例缩放
node.setSize(40, -1);
public boolean setSize(double width, double height)
setSize(Size)
width
- 宽度height
- 高度
public Size getSize()
size
public Size getSize(boolean calculate)
calculateSize
,否则返回网元大小size
calculate
- 是否返回网元计算大小
public Size getCalculateSize()
calculateSize
protected void validateSize()
calculateSize
public Rect calculateBounds()
calculateSize
public boolean invalidateVisibility()
Element
invalidateVisibility
in class Element
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |