Skip to content
Permalink
18ac502a6f
Switch branches/tags
Go to file
 
 
Cannot retrieve contributors at this time
93 lines (79 sloc) 3.09 KB
<?xml version="1.0"?>
<s:ItemRenderer xmlns:fx="http://ns.adobe.com/mxml/2009"
xmlns:s="library://ns.adobe.com/flex/spark"
xmlns:controls="robotlegs.examples.kanban.view.controls.*"
width="100%"
height="100%"
autoDrawBackground="false">
<fx:Script><![CDATA[
import mx.core.IUIComponent;
import mx.events.DragEvent;
import mx.managers.DragManager;
import robotlegs.examples.kanban.controller.events.DeleteTaskEvent;
import robotlegs.examples.kanban.controller.events.UpdateTaskWithStatusEvent;
import robotlegs.examples.kanban.model.vo.Status;
import robotlegs.examples.kanban.model.vo.Task;
protected function dragEnterHandler(e:DragEvent):void
{
e.preventDefault();
if (data.isOverLimit) return;
DragManager.acceptDragDrop(e.currentTarget as IUIComponent);
DragManager.showFeedback(DragManager.MOVE);
drawFocus(false)
}
protected function dragExitHandler(e:DragEvent):void
{
}
protected function dragDropHandler(event:DragEvent):void
{
var task:Task = (event.dragInitiator as TaskList).selectedItem as Task;
//we want to STOP the default behavior and manipulate
//where the task is added to a collection instead
//of letting Flex do its thing.
event.preventDefault();
event.stopImmediatePropagation();
drawFocus(false);
if (task && status)
dispatchEvent(new UpdateTaskWithStatusEvent(task, status));
}
protected function get status():Status
{
return data as Status;
}
private function deleteTaskHandler(event:Event):void
{
dispatchEvent(new DeleteTaskEvent(taskList.selectedItem as Task));
}
]]></fx:Script>
<s:layout>
<s:VerticalLayout/>
</s:layout>
<s:Label text="{data}"
styleName="sketchBlock"
fontSize="18"
color="#000000"/>
<controls:TaskList
id="taskList"
dragEnabled="true"
dropEnabled="true"
dataProvider="{data.tasks}"
dragDrop="dragDropHandler(event)"
dragEnter="dragEnterHandler(event)"
dragExit="dragExitHandler(event)"
width="100%"
height="100%"
borderVisible="false"
focusSkin="{null}"
skinClass="robotlegs.examples.kanban.view.skins.TaskLaneSkin"
itemRenderer="robotlegs.examples.kanban.view.renderers.TaskItemRenderer"
deleteTask="deleteTaskHandler(event)">
<controls:layout>
<s:VerticalLayout paddingLeft="7"
paddingRight="7"
paddingTop="7"
paddingBottom="7"
gap="7"
useVirtualLayout="true"/>
</controls:layout>
</controls:TaskList>
</s:ItemRenderer>