Shared Editor plugin bug

Hi everyone,

First off, Ryan and Larry, the Whiteboard and Shared Editor plugins are pretty sweet.

I’m running on Windows XP, Java 1.6, Spark 2.5.8, and Shared Editor 1.0.1.

One problem I seem to encounter is that if a Shared Editor is started and then closed as usual, if one person then quits/closes/logs out of Spark and comes back later, and a Shared Editor session is started between the 2 users again, one user (the one that stayed online the whole time) still sees the content from the previous session whereas the user who logged out and logged back in gets a fresh new window - thus the editor sessions are out of sync.

I’m not sure what is “supposed” to happen but probably:

a) if a Shared Editor session is started, a content window clear should happen first

or

b) if a Shared Editor session is started, the previous state content that one sees should be sent over the person who just came back in

There’s probably other things that can be done like session state communication between both users to synchronize content better or something…

My java dev skills aren’t great but I’m going to look at making a) happen as that seems easy enough to do

I’ll let you know what changes I made, but just letting the you know so that you can see if anyone can reproduce the problem (or if it’s just my environment) and may be decide on what the best choice of handling it is.

Thanks!

Cheers,

Sean

Hi Sean,

It’s good to hear you’ve gotten some use out of a couple of our sparkplugs. The shared editor plugin was originally developed just as a demonstration tool so we never made it super robust, but we’ve been happy to learn that people are using the editor to do real work. We’ve actually added some features such as the ability to save and open existing files and support some basic rich text features such bolding, italicizing and underlining of text. Unfortunately (or fortunately, depending on how you look at it) we haven’t been able to test those features as thoroughly as we’d like so we haven’t released a new version of that sparkplug.

If you make some headway into resolving some of the issues you’ve come across please let me know.

Thanks,
Ryan

Hi Ryan,

Took me a while but I made a couple of changes… I’m new to this level of java programming and I know that what I did was definately not clean and probably the worst way to do it, but at least it works. Here’s my changes (sorry, my diff patch didn’t seem to come out right):

EditorPlugin.java:

private class EditorPacketListener implements PacketListener {

  public void processPacket(Packet packet) {

     String from = StringUtils.parseBareAddress(packet.getFrom());

    

     Editor editor = null;

     if (editorMap.containsKey(from)) {

        editor = editorMap.get(from);

     } else {

        editor = new Editor(from);

        editorMap.put(from, editor);

     }

    

     editor.processPacket(packet);

    

     if (!editor.isVisible()) {

// new: does a textpane refresh to resend data to other user

    editor.refresh();

    editor.setVisible(true);

     }

  }

}

Editor.java:

// new: does a cut and paste to refresh screen
public void refresh() {
EditorTextPane textPane = getSelectedTextPane();
textPane.selectAll();
textPane.cut();
textPane.paste();
return;
}

So definately very crude. I’d suggest if someone wants to do a better version that they look at using the editor.java’s processPacket(Packet packet) fuction that processes Update packets with no changes in the style elements. I couldn’t figure out how to generate a Packet or Element that contained a command to Update from EditorPlugin.java.There is probably better ways too.

On a side note, I think the WhiteBoard does a similar thing as well, where if a user rejoins after logging off/disconnecting and loggin back in again, the 2 users aren’t synced, but the Shared Editor is what we use most.

Thanks Ryan for your great work on these plugins.

Cheers,

Sean