Using server to provide sharednotes numbering.

This commit is contained in:
Jonata Teixeira Pastro 2014-08-15 21:14:13 +00:00
parent 9ee6024b8e
commit f3252728e0
4 changed files with 6 additions and 23 deletions

View File

@ -52,12 +52,14 @@ public class SharedNotesRoom {
private Map<String,String> documents = new ConcurrentHashMap<String, String>(); private Map<String,String> documents = new ConcurrentHashMap<String, String>();
private static final Object syncObject = new Object(); private static final Object syncObject = new Object();
private diff_match_patch diffPatch = new diff_match_patch(); private diff_match_patch diffPatch = new diff_match_patch();
private Integer noteCounter;
public SharedNotesRoom(String name) { public SharedNotesRoom(String name) {
this.name = name; this.name = name;
this.listeners = new ConcurrentHashMap<String, ISharedNotesRoomListener>(); this.listeners = new ConcurrentHashMap<String, ISharedNotesRoomListener>();
this.clients = new ConcurrentSkipListSet<String>(); this.clients = new ConcurrentSkipListSet<String>();
documents.put("MAIN_WINDOW",""); this.documents.put("MAIN_WINDOW","");
this.noteCounter=1;
} }
public String getName() { public String getName() {
@ -133,8 +135,8 @@ public class SharedNotesRoom {
} }
public void createAdditionalNotes() { public void createAdditionalNotes() {
String noteId = UUID.randomUUID().toString();
synchronized (syncObject) { synchronized (syncObject) {
String noteId = (noteCounter++).toString();
documents.put(noteId, ""); documents.put(noteId, "");
for (Map.Entry<String, ISharedNotesRoomListener> entry : listeners.entrySet()) { for (Map.Entry<String, ISharedNotesRoomListener> entry : listeners.entrySet()) {

View File

@ -60,14 +60,6 @@
<MethodInvoker generator="{SharedNotesManager}" method="disconnectFromSharedNotes"/> <MethodInvoker generator="{SharedNotesManager}" method="disconnectFromSharedNotes"/>
</EventHandlers> </EventHandlers>
<EventHandlers type="{ToolbarButtonWindowEvent.SHOW_WINDOW}">
<MethodInvoker generator="{SharedNotesEventMapDelegate}" method="showWindow"/>
</EventHandlers>
<EventHandlers type="{ToolbarButtonWindowEvent.HIDE_WINDOW}">
<MethodInvoker generator="{SharedNotesEventMapDelegate}" method="hideWindow"/>
</EventHandlers>
<EventHandlers type="{GetCurrentDocumentEvent.GET_CURRENT_DOCUMENT}"> <EventHandlers type="{GetCurrentDocumentEvent.GET_CURRENT_DOCUMENT}">
<MethodInvoker generator="{SharedNotesManager}" method="getCurrentDocument"/> <MethodInvoker generator="{SharedNotesManager}" method="getCurrentDocument"/>
</EventHandlers> </EventHandlers>

View File

@ -12,8 +12,6 @@ package org.bigbluebutton.modules.sharednotes.views
public class AdditionalSharedNotesWindow extends SharedNotesWindow public class AdditionalSharedNotesWindow extends SharedNotesWindow
{ {
private static var windowsAcc:int = 1;
private var _windowId:int = windowsAcc++;
public function AdditionalSharedNotesWindow(notesId:String) { public function AdditionalSharedNotesWindow(notesId:String) {
trace("AdditionalSharedNotesWindow: in-constructor additional notes " + notesId); trace("AdditionalSharedNotesWindow: in-constructor additional notes " + notesId);
@ -46,10 +44,5 @@ package org.bigbluebutton.modules.sharednotes.views
return MainCanvas.POPUP; return MainCanvas.POPUP;
} }
override protected function resourcesChanged():void {
super.resourcesChanged();
title = ResourceUtil.getInstance().getString('bbb.sharedNotes.title') + " " + _windowId;
}
} }
} }

View File

@ -96,8 +96,10 @@
if(_notesId == "MAIN_WINDOW"){ if(_notesId == "MAIN_WINDOW"){
btnNew.visible = btnNew.includeInLayout = true; btnNew.visible = btnNew.includeInLayout = true;
_dispatcher.dispatchEvent(new GetCurrentDocumentEvent()); _dispatcher.dispatchEvent(new GetCurrentDocumentEvent());
title = ResourceUtil.getInstance().getString('bbb.sharedNotes.title');
} else { } else {
btnNew.visible = btnNew.includeInLayout = false; btnNew.visible = btnNew.includeInLayout = false;
title = ResourceUtil.getInstance().getString('bbb.sharedNotes.title') + " " + _notesId;
} }
} }
@ -173,12 +175,6 @@
super.close(event); super.close(event);
} }
override protected function resourcesChanged():void {
super.resourcesChanged();
title = ResourceUtil.getInstance().getString('bbb.sharedNotes.title');
}
]]> ]]>
</mx:Script> </mx:Script>