- move things around
This commit is contained in:
parent
26077b8499
commit
93fe4dc478
@ -38,6 +38,10 @@ package org.bigbluebutton.core.managers
|
||||
public function removeMessageListener(listener:IMessageListener):void {
|
||||
connDelegate.removeMessageListener(listener);
|
||||
}
|
||||
|
||||
public function sendMessage(service:String, onSuccess:Function, onFailure:Function, message:Object=null):void {
|
||||
connDelegate.sendMessage(service, onSuccess, onFailure, message);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
@ -118,6 +118,27 @@ package org.bigbluebutton.main.model.users
|
||||
notifyListeners(messageName, result);
|
||||
}
|
||||
|
||||
public function sendMessage(service:String, onSuccess:Function, onFailure:Function, message:Object=null):void {
|
||||
var responder:Responder = new Responder(
|
||||
function(result:Object):void { // On successful result
|
||||
onSuccess("Successfully sent [" + service + "].");
|
||||
},
|
||||
function(status:Object):void { // status - On error occurred
|
||||
var errorReason:String = "Failed to send [" + service + "]:\n";
|
||||
for (var x:Object in status) {
|
||||
errorReason += "\t" + x + " : " + status[x];
|
||||
}
|
||||
}
|
||||
);
|
||||
|
||||
if (message == null) {
|
||||
_netConnection.call(service, responder);
|
||||
} else {
|
||||
_netConnection.call(service, responder, message);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Connect to the server.
|
||||
* uri: The uri to the conference application.
|
||||
|
@ -20,8 +20,7 @@ package org.bigbluebutton.modules.whiteboard
|
||||
import flash.events.TextEvent;
|
||||
import flash.geom.Point;
|
||||
import flash.text.TextFieldAutoSize;
|
||||
import flash.ui.Keyboard;
|
||||
|
||||
import flash.ui.Keyboard;
|
||||
import mx.collections.ArrayCollection;
|
||||
import org.bigbluebutton.common.IBbbCanvas;
|
||||
import org.bigbluebutton.common.LogUtil;
|
||||
@ -30,10 +29,8 @@ package org.bigbluebutton.modules.whiteboard
|
||||
import org.bigbluebutton.modules.whiteboard.business.shapes.DrawObject;
|
||||
import org.bigbluebutton.modules.whiteboard.business.shapes.GraphicFactory;
|
||||
import org.bigbluebutton.modules.whiteboard.business.shapes.GraphicObject;
|
||||
import org.bigbluebutton.modules.whiteboard.business.shapes.ShapeFactory;
|
||||
|
||||
import org.bigbluebutton.modules.whiteboard.business.shapes.TextBox;
|
||||
|
||||
import org.bigbluebutton.modules.whiteboard.business.shapes.ShapeFactory;
|
||||
import org.bigbluebutton.modules.whiteboard.business.shapes.TextBox;
|
||||
import org.bigbluebutton.modules.whiteboard.business.shapes.TextFactory;
|
||||
import org.bigbluebutton.modules.whiteboard.business.shapes.TextObject;
|
||||
import org.bigbluebutton.modules.whiteboard.business.shapes.WhiteboardConstants;
|
||||
@ -249,8 +246,7 @@ package org.bigbluebutton.modules.whiteboard
|
||||
var graphics:Array = filterGraphicObjects(objs)
|
||||
var topMostObject:GraphicObject = getTopMostObject(graphics) as GraphicObject;
|
||||
|
||||
LogUtil.debug("There are " + graphics.length + " objects" +
|
||||
"under your mouse.");
|
||||
LogUtil.debug("There are " + graphics.length + " objects" + "under your mouse.");
|
||||
LogUtil.debug("!!!TOP MOST OBJECT: " + topMostObject.getProperties());
|
||||
}
|
||||
}
|
||||
@ -285,8 +281,7 @@ package org.bigbluebutton.modules.whiteboard
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
public function drawGraphic(event:WhiteboardUpdate):void{
|
||||
var o:GraphicObject = event.data;
|
||||
var recvdShapes:Boolean = event.recvdShapes;
|
||||
@ -326,8 +321,7 @@ package org.bigbluebutton.modules.whiteboard
|
||||
// Draws a TextObject when/if it is received from the server
|
||||
private function drawText(o:TextObject, recvdShapes:Boolean):void {
|
||||
if(recvdShapes) {
|
||||
LogUtil.debug("Got text [" + o.text + " " +
|
||||
o.status + " " + o.getGraphicID() + "]");
|
||||
LogUtil.debug("Got text [" + o.text + " " + o.status + " " + o.getGraphicID() + "]");
|
||||
LogUtil.debug(String(o.getProperties()));
|
||||
}
|
||||
switch (o.status) {
|
||||
|
@ -140,7 +140,36 @@ package org.bigbluebutton.modules.whiteboard.business
|
||||
|
||||
private function handleNewAnnotationCommand(message:Object):void {
|
||||
LogUtil.debug("Handle new annotation[" + message.type + ", " + message.id + ", " + message.status + "]");
|
||||
switch (message.type) {
|
||||
case "text":
|
||||
// annotation["type"] = "text";
|
||||
// annotation["id"] = tobj.getGraphicID();
|
||||
// annotation["status"] = tobj.status;
|
||||
// annotation["text"] = tobj.text;
|
||||
// annotation["fontColor"] = tobj.textColor;
|
||||
// annotation["backgroundColor"] = tobj.backgroundColor;
|
||||
// annotation["background"] = tobj.background;
|
||||
// annotation["x"] = tobj.x;
|
||||
// annotation["y"] = tobj.y;
|
||||
// annotation["fontSize"] = tobj.textSize;
|
||||
// addText(message.type, message.text, message.fontColor, message.backgroundColor,
|
||||
break;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
private function addText(graphicType:String, text:String, textColor:uint, bgColor:uint, bgColorVisible:Boolean,
|
||||
x:Number, y:Number, textSize:Number, id:String, status:String, recvdShapes:Boolean = false):void {
|
||||
LogUtil.debug("Rx add text **** with ID of " + id + " " + x + "," + y);
|
||||
var t:TextObject = new TextObject(text, textColor, bgColor, bgColorVisible, x, y, textSize);
|
||||
t.setGraphicID(id);
|
||||
t.status = status;
|
||||
|
||||
// var e:WhiteboardUpdate = new WhiteboardUpdate(WhiteboardUpdate.BOARD_UPDATED);
|
||||
// e.data = t;
|
||||
// e.recvdShapes = recvdShapes;
|
||||
// dispatcher.dispatchEvent(e);
|
||||
}
|
||||
|
||||
private function handleIsWhiteboardEnabledReply(message:Object):void {
|
||||
//if (result as Boolean) modifyEnabledCallback(true);
|
||||
@ -155,45 +184,9 @@ package org.bigbluebutton.modules.whiteboard.business
|
||||
}
|
||||
}
|
||||
|
||||
public function setActivePresentation(e:PresentationEvent):void{
|
||||
var nc:NetConnection = connection;
|
||||
nc.call("whiteboard.setActivePresentation",
|
||||
new Responder(
|
||||
function(result:Object):void { // On successful result
|
||||
LogUtil.debug("Whiteboard::setActivePresentation() : " + e.presentationName);
|
||||
},
|
||||
function(status:Object):void { // status - On error occurred
|
||||
LogUtil.error("Error occurred:");
|
||||
for (var x:Object in status) {
|
||||
LogUtil.error(x + " : " + status[x]);
|
||||
}
|
||||
}
|
||||
),//new Responder
|
||||
e.presentationName, e.numberOfSlides
|
||||
); //_netConnection.call
|
||||
}
|
||||
|
||||
|
||||
public function checkIsWhiteboardOn():void {
|
||||
var nc:NetConnection = connection;
|
||||
nc.call(
|
||||
"whiteboard.isWhiteboardEnabled",// Remote function name
|
||||
new Responder(
|
||||
// On successful result
|
||||
function(result:Object):void {
|
||||
LogUtil.debug("Whiteboard::checkIsWhiteboardOn() : " + result as String);
|
||||
// if (result as Boolean) modifyEnabledCallback(true);
|
||||
},
|
||||
// status - On error occurred
|
||||
function(status:Object):void {
|
||||
LogUtil.error("Error occurred:");
|
||||
for (var x:Object in status) {
|
||||
LogUtil.error(x + " : " + status[x]);
|
||||
}
|
||||
}
|
||||
)//new Responder
|
||||
|
||||
); //_netConnection.call
|
||||
}
|
||||
|
||||
|
||||
public function getPageHistory(e:PageEvent):void {
|
||||
// var nc:NetConnection = connection;
|
||||
@ -221,82 +214,8 @@ package org.bigbluebutton.modules.whiteboard.business
|
||||
// ); //_netConnection.call
|
||||
}
|
||||
|
||||
/**
|
||||
* Sends a shape to the Shared Object on the red5 server, and then triggers an update across all clients
|
||||
* @param shape The shape sent to the SharedObject
|
||||
*
|
||||
*/
|
||||
public function sendShape(e:WhiteboardDrawEvent):void {
|
||||
LogUtil.debug("Sending SHAPE");
|
||||
var nc:NetConnection = connection;
|
||||
var shape:DrawObject = e.message as DrawObject;
|
||||
|
||||
var annotation:Object = new Object();
|
||||
annotation["type"] = shape.getType();
|
||||
annotation["points"] = shape.getShapeArray();
|
||||
annotation["color"] = shape.getColor();
|
||||
annotation["thickness"] = shape.getThickness();
|
||||
annotation["id"] = shape.getGraphicID();
|
||||
annotation["status"] = shape.status;
|
||||
annotation["fill"] = shape.getFill();
|
||||
annotation["fillColor"] = shape.getFillColor();
|
||||
annotation["transparency"] = shape.getTransparency();
|
||||
|
||||
nc.call("whiteboard.sendAnnotation",
|
||||
new Responder(
|
||||
function(result:Object):void { // On successful result
|
||||
//LogUtil.debug("Whiteboard::sendShape() ");
|
||||
},
|
||||
function(status:Object):void { // status - On error occurred
|
||||
LogUtil.error("Error occurred:");
|
||||
for (var x:Object in status) {
|
||||
LogUtil.error(x + " : " + status[x]);
|
||||
}
|
||||
}
|
||||
),//new Responder
|
||||
annotation
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Sends a TextObject to the Shared Object on the red5 server, and then triggers an update across all clients
|
||||
* @param shape The shape sent to the SharedObject
|
||||
*
|
||||
*/
|
||||
public function sendText(e:WhiteboardDrawEvent):void{
|
||||
LogUtil.debug("Sending TEXT");
|
||||
var tobj:TextObject = e.message as TextObject;
|
||||
|
||||
var annotation:Object = new Object();
|
||||
annotation["type"] = "text";
|
||||
annotation["id"] = tobj.getGraphicID();
|
||||
annotation["status"] = tobj.status;
|
||||
annotation["text"] = tobj.text;
|
||||
annotation["fontColor"] = tobj.textColor;
|
||||
annotation["backgroundColor"] = tobj.backgroundColor;
|
||||
annotation["background"] = tobj.background;
|
||||
annotation["x"] = tobj.x;
|
||||
annotation["y"] = tobj.y;
|
||||
annotation["fontSize"] = tobj.textSize;
|
||||
|
||||
var nc:NetConnection = connection;
|
||||
nc.call("whiteboard.sendAnnotation",// Remote function name
|
||||
new Responder(
|
||||
// On successful result
|
||||
function(result:Object):void {
|
||||
|
||||
},
|
||||
// status - On error occurred
|
||||
function(status:Object):void {
|
||||
LogUtil.error("Error occurred:");
|
||||
for (var x:Object in status) {
|
||||
LogUtil.error(x + " : " + status[x]);
|
||||
}
|
||||
}
|
||||
),//new Responder
|
||||
annotation
|
||||
); //_netConnection.call
|
||||
}
|
||||
/**
|
||||
* Adds a shape to the ValueObject, then triggers an update event
|
||||
* @param array The array representation of a shape
|
||||
@ -317,75 +236,11 @@ package org.bigbluebutton.modules.whiteboard.business
|
||||
dispatcher.dispatchEvent(e);
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds a new TextObject to the Whiteboard overlay
|
||||
* @param Params represent the data used to recreate the TextObject
|
||||
*
|
||||
*/
|
||||
public function addText(graphicType:String, text:String, textColor:uint, bgColor:uint, bgColorVisible:Boolean,
|
||||
x:Number, y:Number, textSize:Number, id:String, status:String, recvdShapes:Boolean = false):void {
|
||||
LogUtil.debug("Rx add text **** with ID of " + id + " " + x + "," + y);
|
||||
var t:TextObject = new TextObject(text, textColor, bgColor, bgColorVisible, x, y, textSize);
|
||||
t.setGraphicID(id);
|
||||
t.status = status;
|
||||
|
||||
var e:WhiteboardUpdate = new WhiteboardUpdate(WhiteboardUpdate.BOARD_UPDATED);
|
||||
e.data = t;
|
||||
e.recvdShapes = recvdShapes;
|
||||
dispatcher.dispatchEvent(e);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Sends a call out to the red5 server to notify the clients that the board needs to be cleared
|
||||
*
|
||||
*/
|
||||
public function clearBoard():void{
|
||||
var nc:NetConnection = connection;
|
||||
nc.call("whiteboard.clear",// Remote function name
|
||||
new Responder(
|
||||
function(result:Object):void { // On successful result
|
||||
LogUtil.debug("Whiteboard::clearBoard()");
|
||||
},
|
||||
function(status:Object):void { // status - On error occurred
|
||||
LogUtil.error("Error occurred:");
|
||||
for (var x:Object in status) {
|
||||
LogUtil.error(x + " : " + status[x]);
|
||||
}
|
||||
}
|
||||
)//new Responder
|
||||
|
||||
); //_netConnection.call
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Sends a call out to the red5 server to notify the clients to undo a GraphicObject
|
||||
*
|
||||
*/
|
||||
public function undoGraphic():void{
|
||||
var nc:NetConnection = connection;
|
||||
nc.call(
|
||||
"whiteboard.undo",// Remote function name
|
||||
new Responder(
|
||||
// On successful result
|
||||
function(result:Object):void {
|
||||
LogUtil.debug("Whiteboard::undoGraphic()");
|
||||
},
|
||||
// status - On error occurred
|
||||
function(status:Object):void {
|
||||
LogUtil.error("Error occurred:");
|
||||
for (var x:Object in status) {
|
||||
LogUtil.error(x + " : " + status[x]);
|
||||
}
|
||||
}
|
||||
)//new Responder
|
||||
|
||||
); //_netConnection.call
|
||||
|
||||
//drawSO.send("undo");
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Triggers the undo shape event on all clients
|
||||
@ -395,32 +250,7 @@ package org.bigbluebutton.modules.whiteboard.business
|
||||
dispatcher.dispatchEvent(new WhiteboardUpdate(WhiteboardUpdate.GRAPHIC_UNDONE));
|
||||
}
|
||||
|
||||
/**
|
||||
* Sends a call out to the red5 server to notify the clients to toggle grid mode
|
||||
*
|
||||
*/
|
||||
public function toggleGrid():void{
|
||||
LogUtil.debug("TOGGLING GRID...");
|
||||
var nc:NetConnection = connection;
|
||||
nc.call(
|
||||
"whiteboard.toggleGrid",// Remote function name
|
||||
new Responder(
|
||||
// On successful result
|
||||
function(result:Object):void {
|
||||
LogUtil.debug("Whiteboard::toggleGrid()");
|
||||
},
|
||||
// status - On error occurred
|
||||
function(status:Object):void {
|
||||
LogUtil.error("Error occurred:");
|
||||
for (var x:Object in status) {
|
||||
LogUtil.error(x + " : " + status[x]);
|
||||
}
|
||||
}
|
||||
)//new Responder
|
||||
); //_netConnection.call
|
||||
|
||||
//drawSO.send("undo");
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Triggers the toggle grid event
|
||||
@ -431,55 +261,14 @@ package org.bigbluebutton.modules.whiteboard.business
|
||||
dispatcher.dispatchEvent(new ToggleGridEvent(ToggleGridEvent.GRID_TOGGLED));
|
||||
}
|
||||
|
||||
public function modifyEnabled(e:WhiteboardPresenterEvent):void{
|
||||
var nc:NetConnection = connection;
|
||||
nc.call(
|
||||
"whiteboard.enableWhiteboard",// Remote function name
|
||||
new Responder(
|
||||
// On successful result
|
||||
function(result:Object):void {
|
||||
LogUtil.debug("Whiteboard::modifyEnabled() : " + e.enabled);
|
||||
},
|
||||
// status - On error occurred
|
||||
function(status:Object):void {
|
||||
LogUtil.error("Error occurred:");
|
||||
for (var x:Object in status) {
|
||||
LogUtil.error(x + " : " + status[x]);
|
||||
}
|
||||
}
|
||||
),//new Responder
|
||||
e.enabled
|
||||
); //_netConnection.call
|
||||
}
|
||||
|
||||
|
||||
public function modifyEnabledCallback(enabled:Boolean):void{
|
||||
var e:WhiteboardUpdate = new WhiteboardUpdate(WhiteboardUpdate.BOARD_ENABLED);
|
||||
e.boardEnabled = enabled;
|
||||
dispatcher.dispatchEvent(e);
|
||||
}
|
||||
|
||||
private function getHistory():void{
|
||||
var nc:NetConnection = connection;
|
||||
nc.call(
|
||||
"whiteboard.requestAnnotationHistory",// Remote function name
|
||||
new Responder(
|
||||
// On successful result
|
||||
function(result:Object):void {
|
||||
LogUtil.debug("Whiteboard::getHistory() : retrieving whiteboard history");
|
||||
// receivedShapesHistory(result);
|
||||
},
|
||||
// status - On error occurred
|
||||
function(status:Object):void {
|
||||
LogUtil.error("Error occurred:");
|
||||
for (var x:Object in status) {
|
||||
LogUtil.error(x + " : " + status[x]);
|
||||
}
|
||||
}
|
||||
)//new Responder
|
||||
|
||||
); //_netConnection.call
|
||||
}
|
||||
|
||||
private function receivedGraphicsHistory(result:Object):void{
|
||||
if (result == null) return;
|
||||
|
||||
|
@ -28,7 +28,8 @@ package org.bigbluebutton.modules.whiteboard.events
|
||||
public static const SEND_SHAPE:String = "sendShape";
|
||||
public static const SEND_TEXT:String = "sendText";
|
||||
public static const CLEAR_BOARD:String = "clearBoard";
|
||||
public static const UNDO_GRAPHIC:String = "undoGraphic"
|
||||
public static const UNDO_GRAPHIC:String = "undoGraphic";
|
||||
public static const NEW_SHAPE:String = "NewShapeEvent";
|
||||
|
||||
public var message:GraphicObject;
|
||||
|
||||
|
@ -1,9 +1,11 @@
|
||||
package org.bigbluebutton.modules.whiteboard.models
|
||||
{
|
||||
import flash.events.IEventDispatcher;
|
||||
import mx.collections.ArrayCollection;
|
||||
import flash.events.IEventDispatcher;
|
||||
|
||||
import mx.collections.ArrayCollection;
|
||||
|
||||
import org.bigbluebutton.common.LogUtil;
|
||||
import org.bigbluebutton.modules.whiteboard.business.shapes.DrawObject;
|
||||
import org.bigbluebutton.modules.whiteboard.business.shapes.GraphicObject;
|
||||
import org.bigbluebutton.modules.whiteboard.events.WhiteboardDrawEvent;
|
||||
|
||||
public class WhiteboardModel
|
||||
@ -18,8 +20,9 @@ package org.bigbluebutton.modules.whiteboard.models
|
||||
_dispatcher = dispatcher;
|
||||
}
|
||||
|
||||
public function addAnnotation(annotation:DrawObject):void {
|
||||
public function addAnnotation(annotation:GraphicObject):void {
|
||||
_currentPresentation.addAnnotation(annotation);
|
||||
_dispatcher.dispatchEvent(new WhiteboardDrawEvent(WhiteboardDrawEvent.NEW_SHAPE));
|
||||
}
|
||||
|
||||
public function removeAnnotation(id:String):void {
|
||||
|
@ -0,0 +1,100 @@
|
||||
package org.bigbluebutton.modules.whiteboard.services
|
||||
{
|
||||
import org.bigbluebutton.common.LogUtil;
|
||||
import org.bigbluebutton.core.BBB;
|
||||
import org.bigbluebutton.main.model.users.IMessageListener;
|
||||
import org.bigbluebutton.modules.whiteboard.models.WhiteboardModel;
|
||||
|
||||
public class MessageReceiver implements IMessageListener
|
||||
{
|
||||
public var whiteboradModel:WhiteboardModel;
|
||||
|
||||
public function MessageReceiver()
|
||||
{
|
||||
BBB.initConnectionManager().addMessageListener(this);
|
||||
}
|
||||
|
||||
public function onMessage(messageName:String, message:Object):void {
|
||||
LogUtil.debug("WB: received message " + messageName);
|
||||
|
||||
switch (messageName) {
|
||||
case "WhiteboardRequestAnnotationHistoryReply":
|
||||
handleRequestAnnotationHistoryReply(message);
|
||||
break;
|
||||
case "WhiteboardIsWhiteboardEnabledReply":
|
||||
handleIsWhiteboardEnabledReply(message);
|
||||
break;
|
||||
case "WhiteboardEnableWhiteboardCommand":
|
||||
handleEnableWhiteboardCommand(message);
|
||||
break;
|
||||
case "WhiteboardNewAnnotationCommand":
|
||||
handleNewAnnotationCommand(message);
|
||||
break;
|
||||
case "WhiteboardClearCommand":
|
||||
handleClearCommand(message);
|
||||
break;
|
||||
case "WhiteboardUndoCommand":
|
||||
handleUndoCommand(message);
|
||||
break;
|
||||
case "WhiteboardChangePageCommand":
|
||||
handleChangePageCommand(message);
|
||||
break;
|
||||
default:
|
||||
LogUtil.warn("Cannot handle message [" + messageName + "]");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private function handleChangePageCommand(message:Object):void {
|
||||
LogUtil.debug("Handle Whiteboard Change Page Command [ " + message.pageNum + ", " + message.numAnnotations + "]");
|
||||
}
|
||||
|
||||
private function handleClearCommand(message:Object):void {
|
||||
LogUtil.debug("Handle Whiteboard Clear Command ");
|
||||
// dispatcher.dispatchEvent(new WhiteboardUpdate(WhiteboardUpdate.BOARD_CLEARED));
|
||||
}
|
||||
|
||||
private function handleUndoCommand(message:Object):void {
|
||||
LogUtil.debug("Handle Whiteboard Undo Command ");
|
||||
// dispatcher.dispatchEvent(new WhiteboardUpdate(WhiteboardUpdate.SHAPE_UNDONE));
|
||||
}
|
||||
|
||||
private function handleEnableWhiteboardCommand(message:Object):void {
|
||||
//if (result as Boolean) modifyEnabledCallback(true);
|
||||
LogUtil.debug("Handle Whiteboard Enabled Command " + message.enabled);
|
||||
}
|
||||
|
||||
private function handleNewAnnotationCommand(message:Object):void {
|
||||
LogUtil.debug("Handle new annotation[" + message.type + ", " + message.id + ", " + message.status + "]");
|
||||
switch (message.type) {
|
||||
case "text":
|
||||
// annotation["type"] = "text";
|
||||
// annotation["id"] = tobj.getGraphicID();
|
||||
// annotation["status"] = tobj.status;
|
||||
// annotation["text"] = tobj.text;
|
||||
// annotation["fontColor"] = tobj.textColor;
|
||||
// annotation["backgroundColor"] = tobj.backgroundColor;
|
||||
// annotation["background"] = tobj.background;
|
||||
// annotation["x"] = tobj.x;
|
||||
// annotation["y"] = tobj.y;
|
||||
// annotation["fontSize"] = tobj.textSize;
|
||||
// addText(message.type, message.text, message.fontColor, message.backgroundColor,
|
||||
break;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
private function handleIsWhiteboardEnabledReply(message:Object):void {
|
||||
//if (result as Boolean) modifyEnabledCallback(true);
|
||||
LogUtil.debug("Whiteboard Enabled? " + message.enabled);
|
||||
}
|
||||
|
||||
private function handleRequestAnnotationHistoryReply(message:Object):void {
|
||||
if (message.count == 0) {
|
||||
LogUtil.debug("No annotations.");
|
||||
} else {
|
||||
LogUtil.debug("Number of annotations in history = " + message.count);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,183 @@
|
||||
package org.bigbluebutton.modules.whiteboard.services
|
||||
{
|
||||
import flash.net.NetConnection;
|
||||
import flash.net.Responder;
|
||||
|
||||
import org.bigbluebutton.common.LogUtil;
|
||||
import org.bigbluebutton.core.BBB;
|
||||
import org.bigbluebutton.core.managers.ConnectionManager;
|
||||
import org.bigbluebutton.modules.present.events.PresentationEvent;
|
||||
import org.bigbluebutton.modules.whiteboard.business.shapes.DrawObject;
|
||||
import org.bigbluebutton.modules.whiteboard.business.shapes.TextObject;
|
||||
import org.bigbluebutton.modules.whiteboard.events.WhiteboardDrawEvent;
|
||||
import org.bigbluebutton.modules.whiteboard.events.WhiteboardPresenterEvent;
|
||||
|
||||
public class MessageSender
|
||||
{
|
||||
public function modifyEnabled(e:WhiteboardPresenterEvent):void {
|
||||
LogUtil.debug("Sending [whiteboard.enableWhiteboard] to server.");
|
||||
var message:Object = new Object();
|
||||
message["enabled"] = e.enabled;
|
||||
|
||||
var _nc:ConnectionManager = BBB.initConnectionManager();
|
||||
_nc.sendMessage("whiteboard.toggleGrid",
|
||||
function(result:String):void { // On successful result
|
||||
LogUtil.debug(result);
|
||||
},
|
||||
function(status:String):void { // status - On error occurred
|
||||
LogUtil.error(status);
|
||||
},
|
||||
message
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Sends a call out to the red5 server to notify the clients to toggle grid mode
|
||||
*
|
||||
*/
|
||||
public function toggleGrid():void{
|
||||
LogUtil.debug("Sending [whiteboard.toggleGrid] to server.");
|
||||
var _nc:ConnectionManager = BBB.initConnectionManager();
|
||||
_nc.sendMessage("whiteboard.toggleGrid",
|
||||
function(result:String):void { // On successful result
|
||||
LogUtil.debug(result);
|
||||
},
|
||||
function(status:String):void { // status - On error occurred
|
||||
LogUtil.error(status);
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Sends a call out to the red5 server to notify the clients to undo a GraphicObject
|
||||
*
|
||||
*/
|
||||
public function undoGraphic():void{
|
||||
LogUtil.debug("Sending [whiteboard.undo] to server.");
|
||||
var _nc:ConnectionManager = BBB.initConnectionManager();
|
||||
_nc.sendMessage("whiteboard.undo",
|
||||
function(result:String):void { // On successful result
|
||||
LogUtil.debug(result);
|
||||
},
|
||||
function(status:String):void { // status - On error occurred
|
||||
LogUtil.error(status);
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Sends a call out to the red5 server to notify the clients that the board needs to be cleared
|
||||
*
|
||||
*/
|
||||
public function clearBoard():void{
|
||||
LogUtil.debug("Sending [whiteboard.clear] to server.");
|
||||
var _nc:ConnectionManager = BBB.initConnectionManager();
|
||||
_nc.sendMessage("whiteboard.clear",
|
||||
function(result:String):void { // On successful result
|
||||
LogUtil.debug(result);
|
||||
},
|
||||
function(status:String):void { // status - On error occurred
|
||||
LogUtil.error(status);
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Sends a TextObject to the Shared Object on the red5 server, and then triggers an update across all clients
|
||||
* @param shape The shape sent to the SharedObject
|
||||
*
|
||||
*/
|
||||
public function sendText(e:WhiteboardDrawEvent):void{
|
||||
LogUtil.debug("Sending [whiteboard.sendAnnotation] (TEXT) to server.");
|
||||
var tobj:TextObject = e.message as TextObject;
|
||||
|
||||
var annotation:Object = new Object();
|
||||
annotation["type"] = "text";
|
||||
annotation["id"] = tobj.getGraphicID();
|
||||
annotation["status"] = tobj.status;
|
||||
annotation["text"] = tobj.text;
|
||||
annotation["fontColor"] = tobj.textColor;
|
||||
annotation["backgroundColor"] = tobj.backgroundColor;
|
||||
annotation["background"] = tobj.background;
|
||||
annotation["x"] = tobj.x;
|
||||
annotation["y"] = tobj.y;
|
||||
annotation["fontSize"] = tobj.textSize;
|
||||
|
||||
var _nc:ConnectionManager = BBB.initConnectionManager();
|
||||
_nc.sendMessage("whiteboard.sendAnnotation",
|
||||
function(result:String):void { // On successful result
|
||||
LogUtil.debug(result);
|
||||
},
|
||||
function(status:String):void { // status - On error occurred
|
||||
LogUtil.error(status);
|
||||
},
|
||||
annotation
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Sends a shape to the Shared Object on the red5 server, and then triggers an update across all clients
|
||||
* @param shape The shape sent to the SharedObject
|
||||
*
|
||||
*/
|
||||
public function sendShape(e:WhiteboardDrawEvent):void {
|
||||
LogUtil.debug("Sending [whiteboard.sendAnnotation] (SHAPE) to server.");
|
||||
var shape:DrawObject = e.message as DrawObject;
|
||||
|
||||
var annotation:Object = new Object();
|
||||
annotation["type"] = shape.getType();
|
||||
annotation["points"] = shape.getShapeArray();
|
||||
annotation["color"] = shape.getColor();
|
||||
annotation["thickness"] = shape.getThickness();
|
||||
annotation["id"] = shape.getGraphicID();
|
||||
annotation["status"] = shape.status;
|
||||
annotation["fill"] = shape.getFill();
|
||||
annotation["fillColor"] = shape.getFillColor();
|
||||
annotation["transparency"] = shape.getTransparency();
|
||||
|
||||
var _nc:ConnectionManager = BBB.initConnectionManager();
|
||||
_nc.sendMessage("whiteboard.sendAnnotation",
|
||||
function(result:String):void { // On successful result
|
||||
LogUtil.debug(result);
|
||||
},
|
||||
function(status:String):void { // status - On error occurred
|
||||
LogUtil.error(status);
|
||||
},
|
||||
annotation
|
||||
);
|
||||
}
|
||||
|
||||
public function checkIsWhiteboardOn():void {
|
||||
LogUtil.debug("Sending [whiteboard.isWhiteboardEnabled] to server.");
|
||||
var _nc:ConnectionManager = BBB.initConnectionManager();
|
||||
_nc.sendMessage("whiteboard.isWhiteboardEnabled",
|
||||
function(result:String):void { // On successful result
|
||||
LogUtil.debug(result);
|
||||
},
|
||||
function(status:String):void { // status - On error occurred
|
||||
LogUtil.error(status);
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
public function setActivePresentation(e:PresentationEvent):void{
|
||||
LogUtil.debug("Sending [whiteboard.isWhiteboardEnabled] to server.");
|
||||
|
||||
var message:Object = new Object();
|
||||
message["presentation"] = e.presentationName;
|
||||
message["numberOfSlides"] = e.numberOfSlides;
|
||||
|
||||
var _nc:ConnectionManager = BBB.initConnectionManager();
|
||||
_nc.sendMessage("whiteboard.setActivePresentation",
|
||||
function(result:String):void { // On successful result
|
||||
LogUtil.debug(result);
|
||||
},
|
||||
function(status:String):void { // status - On error occurred
|
||||
LogUtil.error(status);
|
||||
},
|
||||
message
|
||||
);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
@ -0,0 +1,55 @@
|
||||
package org.bigbluebutton.modules.whiteboard.services
|
||||
{
|
||||
import org.bigbluebutton.modules.present.events.PresentationEvent;
|
||||
import org.bigbluebutton.modules.whiteboard.events.WhiteboardDrawEvent;
|
||||
import org.bigbluebutton.modules.whiteboard.events.WhiteboardPresenterEvent;
|
||||
|
||||
public class WhiteboardService
|
||||
{
|
||||
public var sender:MessageSender;
|
||||
public var receiver:MessageReceiver;
|
||||
|
||||
public function WhiteboardService()
|
||||
{
|
||||
}
|
||||
|
||||
public function modifyEnabled(e:WhiteboardPresenterEvent):void {
|
||||
sender.modifyEnabled(e);
|
||||
}
|
||||
|
||||
|
||||
public function toggleGrid():void{
|
||||
sender.toggleGrid();
|
||||
}
|
||||
|
||||
|
||||
public function undoGraphic():void{
|
||||
sender.undoGraphic()
|
||||
}
|
||||
|
||||
|
||||
public function clearBoard():void{
|
||||
sender.clearBoard();
|
||||
}
|
||||
|
||||
|
||||
public function sendText(e:WhiteboardDrawEvent):void{
|
||||
sender.sendText(e);
|
||||
}
|
||||
|
||||
|
||||
public function sendShape(e:WhiteboardDrawEvent):void {
|
||||
sender.sendShape(e);
|
||||
}
|
||||
|
||||
public function checkIsWhiteboardOn():void {
|
||||
sender.checkIsWhiteboardOn();
|
||||
}
|
||||
|
||||
public function setActivePresentation(e:PresentationEvent):void{
|
||||
sender.setActivePresentation(e);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
@ -89,7 +89,7 @@
|
||||
model.doMouseDoubleClick(this.mouseX, this.mouseY);
|
||||
}
|
||||
|
||||
private function doMouseDown(event:Event):void{
|
||||
private function doMouseDown(event:Event):void {
|
||||
model.doMouseDown(this.mouseX, this.mouseY);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user