- disable delete, start, edit buttons depending on the state of the poll

This commit is contained in:
Richard Alam 2013-09-23 20:49:41 +00:00
parent 8a137a61ae
commit f334a49a31

View File

@ -1,5 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<mx:HBox xmlns:mx="http://www.adobe.com/2006/mxml" width="90%">
<mx:HBox xmlns:mx="http://www.adobe.com/2006/mxml" width="90%"
creationComplete="onCreationComplete()">
<mx:Script>
<![CDATA[
import com.asfusion.mate.events.Dispatcher;
@ -13,6 +14,17 @@
private var globalDispatch:Dispatcher = new Dispatcher();
private function onCreationComplete():void{
validateNow();
}
override public function set data(value:Object):void {
super.data = value;
if (data == null) return;
validateNow();
}
private function startPoll():void {
trace(LOG + "::startPoll() " + data.id);
var event:PollEvent = new PollEvent(PollEvent.START_POLL, data.id);
@ -30,14 +42,12 @@
private function editPoll():void {
var event:PollEvent = new PollEvent(PollEvent.EDIT_POLL_REQUEST, data.id);
globalDispatch.dispatchEvent(event);
globalDispatch.dispatchEvent(event);
}
private function showPollResult():void {
var event:PollEvent = new PollEvent(PollEvent.SHOW_POLL_RESULT, data.id);
globalDispatch.dispatchEvent(event);
globalDispatch.dispatchEvent(event);
}
]]>
</mx:Script>
@ -45,17 +55,17 @@
<mx:Button id="resultBtn" label="Result"
toolTip="{ResourceUtil.getInstance().getString('bbb.fileupload.showBtn.toolTip')}"
styleName="presentationUploadShowButtonStyle"
click="showPollResult()" enabled="true"/>
click="showPollResult()" enabled="{data.stopped}"/>
<mx:Button id="startBtn" label="Start"
toolTip="{ResourceUtil.getInstance().getString('bbb.fileupload.showBtn.toolTip')}"
styleName="presentationUploadShowButtonStyle"
click="startPoll()" enabled="true"/>
click="startPoll()" enabled="{!data.started}"/>
<mx:Button id="editBtn" label="Edit"
toolTip="{ResourceUtil.getInstance().getString('bbb.fileupload.showBtn.toolTip')}"
styleName="presentationUploadShowButtonStyle"
click="editPoll()" enabled="true"/>
click="editPoll()" enabled="{!data.started}"/>
<mx:Button id="deleteBtn" label="" toolTip="{ResourceUtil.getInstance().getString('bbb.fileupload.deleteBtn.toolTip')}"
styleName="presentationUploadDeleteButtonStyle"
click="deletePoll()" enabled="true"/>
click="deletePoll()" enabled="{!data.started}"/>
</mx:HBox>