diff --git a/bigbluebutton-apps/src/main/java/org/bigbluebutton/conference/service/whiteboard/Page.java b/bigbluebutton-apps/src/main/java/org/bigbluebutton/conference/service/whiteboard/Page.java index 1d3cf2b917..56d175fee7 100755 --- a/bigbluebutton-apps/src/main/java/org/bigbluebutton/conference/service/whiteboard/Page.java +++ b/bigbluebutton-apps/src/main/java/org/bigbluebutton/conference/service/whiteboard/Page.java @@ -25,37 +25,23 @@ import java.util.ArrayList; import java.util.List; import java.util.Map; -import org.red5.compatibility.flex.messaging.io.ArrayCollection; public class Page { - private ArrayCollection shapes; - private ArrayList> annotations; - + private ArrayList> annotations; private int pageIndex; public Page(int pageIndex){ annotations = new ArrayList>(); - this.shapes = new ArrayCollection(); + this.setPageIndex(pageIndex); } - -// public void addShape(Shape shape){ -// shapes.add(shape); -// } - + public void addAnnotation(Map annotation) { annotations.add(annotation); } - public List> getShapes() { -/* - List shapesCollection = new ArrayList(); - for (int i = 0; i> getAnnotations() { List> a = new ArrayList>(); for (Map v : annotations) { a.add(v); @@ -64,24 +50,29 @@ public class Page { return a; } - public void clear(){ - shapes.clear(); - + public void deleteAnnotation(String id) { + int foundIndex = -1; + for (int i=0; i < annotations.size(); i++) { + Map annotation = annotations.get(i); + if (annotation.get("id").equals(id)) { + foundIndex = i; + break; + } + } + if (foundIndex >= 0) annotations.remove(foundIndex); + } + + public void clear() { annotations.clear(); } - public void undo(){ -// if(shapes.size() > 0) -// shapes.remove(shapes.size()-1); - + public void undo() { if (annotations.isEmpty()) { annotations.remove(annotations.size() - 1); } } - public int getNumShapesOnPage(){ - //return this.shapes.size(); - + public int getNumShapesOnPage() { return annotations.size(); } diff --git a/bigbluebutton-apps/src/main/java/org/bigbluebutton/conference/service/whiteboard/WhiteboardRoom.java b/bigbluebutton-apps/src/main/java/org/bigbluebutton/conference/service/whiteboard/WhiteboardRoom.java index 131011bdba..da0383d464 100755 --- a/bigbluebutton-apps/src/main/java/org/bigbluebutton/conference/service/whiteboard/WhiteboardRoom.java +++ b/bigbluebutton-apps/src/main/java/org/bigbluebutton/conference/service/whiteboard/WhiteboardRoom.java @@ -50,7 +50,7 @@ public class WhiteboardRoom { * @param name * @param numPages */ - public void addPresentation(String name, int numPages){ + public void addPresentation(String name, int numPages) { activePresentation = new Presentation(name, numPages); presentations.add(activePresentation); } @@ -80,19 +80,14 @@ public class WhiteboardRoom { } return exists; } - -// public void addShape(Shape shape){ -// activePresentation.getActivePage().addShape(shape); -// notifyAddShape(activePresentation, shape); -// } - + public void addAnnotation(Map annotation){ activePresentation.getActivePage().addAnnotation(annotation); notifyAddShape(activePresentation, annotation); } public List> getAnnotations(){ - return activePresentation.getActivePage().getShapes(); + return activePresentation.getActivePage().getAnnotations(); } public void clear(){