-
Notifications
You must be signed in to change notification settings - Fork 5.9k
/
WhiteboardApp.scala
executable file
·77 lines (63 loc) · 3.4 KB
/
WhiteboardApp.scala
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
package org.bigbluebutton.core.apps
import org.bigbluebutton.core.api._
import org.bigbluebutton.common.messages.WhiteboardKeyUtil
import org.bigbluebutton.core.OutMessageGateway
import org.bigbluebutton.core.LiveMeeting
case class Whiteboard(id: String, shapeCount: Int, shapesMap: scala.collection.immutable.Map[String, scala.collection.immutable.List[AnnotationVO]])
trait WhiteboardApp {
this: LiveMeeting =>
val outGW: OutMessageGateway
def handleSendWhiteboardAnnotationRequest(msg: SendWhiteboardAnnotationRequest) {
val shape = msg.annotation
val status = shape.status
val shapeType = shape.shapeType
val wbId = shape.wbId
val userId = msg.requesterID
//initWhiteboard(wbId)
// println("Received whiteboard shape. status=[" + status + "], shapeType=[" + shapeType + "]")
if (WhiteboardKeyUtil.TEXT_CREATED_STATUS == status || WhiteboardKeyUtil.DRAW_START_STATUS == status) {
// println("Received textcreated status")
wbModel.addAnnotation(wbId, userId, shape)
} else if (WhiteboardKeyUtil.DRAW_UPDATE_STATUS == status) {
wbModel.updateAnnotation(wbId, userId, shape)
} else if (WhiteboardKeyUtil.DRAW_END_STATUS == status) {
wbModel.updateAnnotation(wbId, userId, shape)
} else if (WhiteboardKeyUtil.TEXT_TYPE == shapeType) {
// println("Received [" + shapeType +"] modify text status")
wbModel.modifyText(wbId, userId, shape)
} else {
// println("Received UNKNOWN whiteboard shape!!!!. status=[" + status + "], shapeType=[" + shapeType + "]")
}
if (wbModel.hasWhiteboard(wbId)) {
// println("WhiteboardApp::handleSendWhiteboardAnnotationRequest - num shapes [" + wb.shapes.length + "]")
outGW.send(new SendWhiteboardAnnotationEvent(mProps.meetingID, mProps.recorded, msg.requesterID, wbId, msg.annotation))
}
}
def handleGetWhiteboardShapesRequest(msg: GetWhiteboardShapesRequest) {
//println("WB: Received page history [" + msg.whiteboardId + "]")
val history = wbModel.getHistory(msg.whiteboardId);
if (history.length > 0) {
outGW.send(new GetWhiteboardShapesReply(mProps.meetingID, mProps.recorded, msg.requesterID, msg.whiteboardId, history, msg.replyTo))
}
}
def handleClearWhiteboardRequest(msg: ClearWhiteboardRequest) {
//println("WB: Received clear whiteboard")
wbModel.clearWhiteboard(msg.whiteboardId, msg.requesterID) foreach { fullClear =>
outGW.send(new ClearWhiteboardEvent(mProps.meetingID, mProps.recorded, msg.requesterID, msg.whiteboardId, fullClear))
}
}
def handleUndoWhiteboardRequest(msg: UndoWhiteboardRequest) {
// println("WB: Received undo whiteboard")
wbModel.undoWhiteboard(msg.whiteboardId, msg.requesterID) foreach { last =>
outGW.send(new UndoWhiteboardEvent(mProps.meetingID, mProps.recorded, msg.requesterID, msg.whiteboardId, last.id))
}
}
def handleModifyWhiteboardAccessRequest(msg: ModifyWhiteboardAccessRequest) {
wbModel.modifyWhiteboardAccess(msg.multiUser)
outGW.send(new ModifiedWhiteboardAccessEvent(mProps.meetingID, mProps.recorded, msg.requesterID, msg.multiUser))
}
def handleGetWhiteboardAccessRequest(msg: GetWhiteboardAccessRequest) {
val multiUser = wbModel.getWhiteboardAccess()
outGW.send(new GetWhiteboardAccessReply(mProps.meetingID, mProps.recorded, msg.requesterID, multiUser))
}
}