Using IRenderer and IDataRenderer interfaces

IRenderer and IDataRenderer give access to node data. In fact, if the node item renderer implements one of these interfaces, its data is set to:

So it is recommended to use at least one of these interfaces. If you want also to have access to the node itself from the renderer it is mandatory to use the IRenderer interface. This interface allows also to specify, through the isFixed property, whether the node is movable. The following file defines an item renderer that implements IRenderer.

<?xml version="1.0" encoding="utf-8"?>
<s:Label xmlns:fx="http://ns.adobe.com/mxml/2009" 
		 xmlns:s="library://ns.adobe.com/flex/spark" 
		 xmlns:mx="library://ns.adobe.com/flex/mx" 
		 width="100" height="50" 
		 implements="fr.kapit.visualizer.renderers.IRenderer"
		 backgroundColor="0xedded4"
		 verticalAlign="middle"
		 textAlign="center">
	<fx:Script>
		<![CDATA[
			import fr.kapit.visualizer.Visualizer;
			import fr.kapit.visualizer.base.IItem;
			import fr.kapit.visualizer.renderers.IRenderer;
			
			[Bindable]
			private var textValue:String;
			private var _data:Object;
			public function get data():Object
			{
				return _data;
			}
			public function set data(value:Object):void
			{
				_data = value;
				text = data.name;
			}

			private var _item:IItem;
			public function get item():IItem
			{
				return _item;
			}
			public function set item(value:IItem):void
			{
				_item = value;
			}
			
			private var _isFixed:Boolean;
			public function get isFixed():Boolean
			{
				return _isFixed;
			}
			public function set isFixed(value:Boolean):void
			{
				_isFixed=value;
			}
		]]>
	</fx:Script>
</s:Label>