2011/09/21

To Add Icon at Anywhere Under TWaver Flex Network Element

iconAttachment mechanism of Java can place many icons or characters at anywhere under network element, check the following picture please.
The function of icon can be displayed on the network element by the following method under Flex:

1server1.setStyle(Styles.ICONS_NAMES, ["att5","att6", "att7","att8"]);
2server1.setStyle(Styles.ICONS_POSITION, Consts.POSITION_BOTTOMRIGHT_TOPRIGHT);
3server1.setStyle(Styles.ICONS_ORIENTATION, Consts.ORIENTATION_TOP);
4server1.setStyle(Styles.ICONS_XOFFSET, 5);
Default realization does not provide icon addition function for multiple positions.
But it will be easier to extend this function by FlexMVC design which is very flexible, please check picture as below:
Create more iconAttachment to display the icons on different places by Attachment mechanism of TWaver.
Code download
private function getIconsSize(names:Array, orientation:String, xgap:Number, ygap:Number):Size
override public function draw(graphics:Graphics):void

If you are interested, you can try to realize the attachment with different places and position
You can achieve by modifying the following two methods of CustomIconAttachment:

No comments:

Post a Comment