git-svn-id: http://bigbluebutton.googlecode.com/svn/trunk@2040 af16638f-c34d-0410-8cfa-b39d5352b314
This commit is contained in:
parent
6b20be0fbe
commit
744a5f7418
@ -38,7 +38,6 @@
|
||||
import org.bigbluebutton.modules.chat.events.StartChatModuleEvent;
|
||||
import com.asfusion.mate.events.Dispatcher;
|
||||
import org.bigbluebutton.modules.chat.events.ChatEvent;
|
||||
import org.bigbluebutton.modules.chat.ChatFacade;
|
||||
import org.bigbluebutton.common.messaging.Router;
|
||||
|
||||
private var _router:Router;
|
||||
|
@ -28,7 +28,6 @@
|
||||
<![CDATA[
|
||||
import mx.controls.Alert;
|
||||
import org.bigbluebutton.modules.deskShare.DeskShareFacade;
|
||||
import org.bigbluebutton.modules.chat.ChatFacade;
|
||||
import org.bigbluebutton.common.messaging.Router;
|
||||
|
||||
private var _router:Router;
|
||||
|
@ -109,5 +109,4 @@
|
||||
</mx:Script>
|
||||
|
||||
<maps:NotesEventMap id="eventMap" />
|
||||
<!--<views:Notes id="notesWindow" width="400" height="400" label="Shared Notes" />-->
|
||||
</mx:Module>
|
||||
|
@ -31,7 +31,7 @@ package org.bigbluebutton.common.mate
|
||||
innerHandlersDispatcher = soService;
|
||||
|
||||
if (this.resultHandlers && resultHandlers.length > 0) {
|
||||
this.createInnerHandlers(scope, SharedObjectEvent.SHARED_OBJECT_UPDATE_SUCCESS, resultHandlers);
|
||||
this.createInnerHandlers(scope, SOName, resultHandlers);
|
||||
}
|
||||
|
||||
if (this.faultHandlers && faultHandlers.length > 0) {
|
||||
|
@ -22,10 +22,12 @@ package org.bigbluebutton.common.mate
|
||||
public var sharedObject:String;
|
||||
|
||||
private var listOfConnectedObjects:ArrayCollection;
|
||||
private var dispatcher:Dispatcher;
|
||||
|
||||
public function SharedObjectService(url:String, connection:NetConnection = null)
|
||||
{
|
||||
listOfConnectedObjects = new ArrayCollection();
|
||||
dispatcher = new Dispatcher();
|
||||
|
||||
if (connection != null) this.nc = connection;
|
||||
else nc = new NetConnection();
|
||||
@ -53,25 +55,31 @@ package org.bigbluebutton.common.mate
|
||||
private function onNetStatus(event:NetStatusEvent):void{
|
||||
switch(event.info.code){
|
||||
case "NetConnection.Connect.Failed":
|
||||
sendConnectionFailedEvent(event);
|
||||
sendUpdateFailedEvent(event.info.toString());
|
||||
break;
|
||||
case "NetConnection.Connect.Success":
|
||||
break;
|
||||
case "NetConnection.Connect.Rejected":
|
||||
sendUpdateFailedEvent(event.info.toString());
|
||||
break;
|
||||
case "NetConnection.Connect.Closed":
|
||||
sendUpdateFailedEvent(event.info.toString());
|
||||
break;
|
||||
case "NetConnection.Connect.InvalidApp":
|
||||
sendUpdateFailedEvent(event.info.toString());
|
||||
break;
|
||||
case "NetConnection.Connect.AppShutdown":
|
||||
sendUpdateFailedEvent(event.info.toString());
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
private function onSecurityError(event:NetStatusEvent):void{
|
||||
sendUpdateFailedEvent(event.info.toString());
|
||||
}
|
||||
|
||||
public function connectToSharedObject(sharedObject:String):void{
|
||||
if (!nc.connected) sendUpdateFailedEvent("NetConnection.Closed");
|
||||
if (isConnected(sharedObject)) return;
|
||||
listOfConnectedObjects.addItem(sharedObject);
|
||||
|
||||
@ -85,29 +93,28 @@ package org.bigbluebutton.common.mate
|
||||
}
|
||||
|
||||
public function updateSharedObject(message:Object):void{
|
||||
//Alert.show(message as String);
|
||||
so.send("sharedObjectCallback", message);
|
||||
}
|
||||
|
||||
public function sharedObjectCallback(message:Object):void{
|
||||
var event:SharedObjectEvent = new SharedObjectEvent(SharedObjectEvent.SHARED_OBJECT_UPDATE_SUCCESS);
|
||||
var event:SharedObjectEvent = new SharedObjectEvent(sharedObject);
|
||||
event.message = message;
|
||||
var dispatcher:Dispatcher = new Dispatcher();
|
||||
dispatcher.dispatchEvent(event);
|
||||
//dispatchEvent(event);
|
||||
}
|
||||
|
||||
private function onSharedObjectSync(event:SyncEvent):void{
|
||||
|
||||
}
|
||||
|
||||
private function sendConnectionFailedEvent(event:NetStatusEvent):void{
|
||||
|
||||
}
|
||||
|
||||
private function isConnected(sharedObject:String):Boolean{
|
||||
return listOfConnectedObjects.contains(sharedObject);
|
||||
}
|
||||
|
||||
private function sendUpdateFailedEvent(message:String):void{
|
||||
var e:SharedObjectEvent = new SharedObjectEvent(SharedObjectEvent.SHARED_OBJECT_UPDATE_FAILED);
|
||||
e.message = message;
|
||||
dispatcher.dispatchEvent(e);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
@ -1,16 +0,0 @@
|
||||
package org.bigbluebutton.modules.notes.events
|
||||
{
|
||||
import flash.events.Event;
|
||||
|
||||
public class MessageEvent extends Event
|
||||
{
|
||||
public static const NEW:String = "newMessageEvent";
|
||||
public var message:String;
|
||||
|
||||
public function MessageEvent(type:String, bubbles:Boolean = true, cancelable:Boolean = false)
|
||||
{
|
||||
super(type, bubbles, cancelable);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
@ -0,0 +1,21 @@
|
||||
package org.bigbluebutton.modules.notes.events
|
||||
{
|
||||
import flash.events.Event;
|
||||
|
||||
/**
|
||||
* NotesUpdateEvent contains an update sent to the shared object to update the notes
|
||||
* @author Snap
|
||||
*
|
||||
*/
|
||||
public class NotesUpdateEvent extends Event
|
||||
{
|
||||
public static const NEW:String = "newMessageEvent";
|
||||
public var message:String;
|
||||
|
||||
public function NotesUpdateEvent(type:String, bubbles:Boolean = true, cancelable:Boolean = false)
|
||||
{
|
||||
super(type, bubbles, cancelable);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
@ -1,4 +1,5 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!-- The NotesEventMap is the main EventMap file of the SharedNotes application -->
|
||||
<EventMap xmlns:mx="http://www.adobe.com/2006/mxml" xmlns="http://mate.asfusion.com/" xmlns:mate="org.bigbluebutton.common.mate.*">
|
||||
<mx:Script>
|
||||
<![CDATA[
|
||||
@ -6,26 +7,32 @@
|
||||
import org.bigbluebutton.common.mate.SharedObjectEvent;
|
||||
import mx.controls.Alert;
|
||||
import org.bigbluebutton.modules.notes.views.Notes;
|
||||
import org.bigbluebutton.modules.notes.events.MessageEvent;
|
||||
import org.bigbluebutton.modules.notes.events.NotesUpdateEvent;
|
||||
|
||||
public static const NOTES_UPDATE_EVENT:String = "NotesUpdateEvent";
|
||||
|
||||
public var notes:Notes;
|
||||
[Bindable]
|
||||
private var soService:SharedObjectService;
|
||||
|
||||
private function displayNewMessage(message:String):void{
|
||||
notes.txtArea.text = message;
|
||||
}
|
||||
|
||||
//Start the SharedObjectService the application will be communicating with
|
||||
public function startSOService(url:String, connection:NetConnection = null):void{
|
||||
soService = new SharedObjectService(url, connection);
|
||||
}
|
||||
|
||||
private function sharedObjectUpdateFailed(fault:Object):void{
|
||||
//If you want to do something when a call fails, put it here
|
||||
}
|
||||
]]>
|
||||
</mx:Script>
|
||||
<Debugger level="{Debugger.ALL}" />
|
||||
|
||||
<EventHandlers id="sender" type="{MessageEvent.NEW}" debug="true">
|
||||
<mate:SharedObjectInvoker id="soInvoker" SOName="notesSharedObject" debug="true" soService="{soService}">
|
||||
<!-- The EventHandler that handles all dispathes of the MessageEvent.NEW event-->
|
||||
<EventHandlers id="sender" type="{NotesUpdateEvent.NEW}" debug="true">
|
||||
<mate:SharedObjectInvoker id="soInvoker" SOName="{NOTES_UPDATE_EVENT}" debug="true" soService="{soService}">
|
||||
<Properties message="{event.message}" />
|
||||
<mate:faultHandlers>
|
||||
<InlineInvoker method="sharedObjectUpdateFailed" arguments="{fault}" />
|
||||
</mate:faultHandlers>
|
||||
</mate:SharedObjectInvoker>
|
||||
</EventHandlers>
|
||||
</EventMap>
|
||||
|
@ -1,25 +1,45 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!--
|
||||
Notes.mxml is the main view of the SharedNotes application
|
||||
-->
|
||||
<MDIWindow xmlns="flexlib.mdi.containers.*" xmlns:mx="http://www.adobe.com/2006/mxml"
|
||||
width="400" height="300" xmlns:mate="http://mate.asfusion.com/"
|
||||
implements="org.bigbluebutton.common.IBbbModuleWindow">
|
||||
implements="org.bigbluebutton.common.IBbbModuleWindow" creationComplete="startTimer()">
|
||||
|
||||
<mx:Script>
|
||||
<![CDATA[
|
||||
import org.bigbluebutton.modules.notes.maps.NotesEventMap;
|
||||
import com.asfusion.mate.utils.debug.Debugger;
|
||||
import org.bigbluebutton.common.mate.SharedObjectEvent;
|
||||
import mx.controls.Alert;
|
||||
import org.bigbluebutton.modules.notes.events.MessageEvent;
|
||||
import org.bigbluebutton.modules.notes.events.NotesUpdateEvent;
|
||||
|
||||
private var _xPosition:int;
|
||||
private var _yPosition:int;
|
||||
|
||||
public function sendNewMessage(message:String):void{
|
||||
var messageEvent:MessageEvent = new MessageEvent(MessageEvent.NEW);
|
||||
messageEvent.message = txtArea.text;
|
||||
txtArea.text = "";
|
||||
dispatchEvent(messageEvent);
|
||||
private var timer:Timer;
|
||||
private var dirty:Boolean = false;
|
||||
|
||||
private function startTimer():void{
|
||||
timer = new Timer(5000);
|
||||
timer.addEventListener(TimerEvent.TIMER, timerHandler);
|
||||
timer.start();
|
||||
}
|
||||
|
||||
private function timerHandler(e:TimerEvent):void{
|
||||
if (!dirty) return;
|
||||
var messageEvent:NotesUpdateEvent = new NotesUpdateEvent(NotesUpdateEvent.NEW);
|
||||
messageEvent.message = txtArea.text;
|
||||
dispatchEvent(messageEvent);
|
||||
dirty = false;
|
||||
}
|
||||
|
||||
//Sends out an update to all the other clients
|
||||
public function sendNewMessage(message:String):void{
|
||||
dirty = true;
|
||||
}
|
||||
|
||||
//Displays the updated message
|
||||
private function displayNewMessage(event:SharedObjectEvent):void{
|
||||
txtArea.text = event.message.toString();
|
||||
}
|
||||
@ -43,8 +63,11 @@
|
||||
]]>
|
||||
</mx:Script>
|
||||
|
||||
<mate:Debugger level="{Debugger.ALL}" />
|
||||
|
||||
<!-- The text area where the notes get displayed -->
|
||||
<mx:TextArea id="txtArea" width="100%" height="100%" keyUp="sendNewMessage(txtArea.text)" />
|
||||
|
||||
<mate:Debugger level="{Debugger.ALL}" />
|
||||
<mate:Listener type="{SharedObjectEvent.SHARED_OBJECT_UPDATE_SUCCESS}" method="displayNewMessage" />
|
||||
<!-- This listener calls the displayNewMessage method every time a NOTES_UPDATE_EVENT gets dispatched -->
|
||||
<mate:Listener type="{NotesEventMap.NOTES_UPDATE_EVENT}" method="displayNewMessage" />
|
||||
</MDIWindow>
|
||||
|
@ -1,14 +0,0 @@
|
||||
package org.bigbluebutton.modules.notes.vos
|
||||
{
|
||||
[Bindable]
|
||||
public class Message
|
||||
{
|
||||
public var text:String;
|
||||
|
||||
public function Message(text:String)
|
||||
{
|
||||
this.text = text;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user