You can subscribe to this list here.
| 2002 |
Jan
|
Feb
|
Mar
(28) |
Apr
(30) |
May
|
Jun
(29) |
Jul
(4) |
Aug
(2) |
Sep
(13) |
Oct
|
Nov
(15) |
Dec
|
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 2003 |
Jan
(38) |
Feb
(64) |
Mar
(16) |
Apr
(13) |
May
(25) |
Jun
(64) |
Jul
(29) |
Aug
|
Sep
(10) |
Oct
(12) |
Nov
(10) |
Dec
(10) |
| 2004 |
Jan
|
Feb
(2) |
Mar
|
Apr
(57) |
May
(4) |
Jun
(8) |
Jul
(17) |
Aug
|
Sep
(26) |
Oct
(22) |
Nov
(6) |
Dec
|
| 2005 |
Jan
|
Feb
(7) |
Mar
(17) |
Apr
(7) |
May
|
Jun
|
Jul
(87) |
Aug
(20) |
Sep
(31) |
Oct
(34) |
Nov
(25) |
Dec
(9) |
| 2006 |
Jan
(9) |
Feb
(21) |
Mar
(46) |
Apr
(11) |
May
|
Jun
|
Jul
(59) |
Aug
(9) |
Sep
(22) |
Oct
(71) |
Nov
(12) |
Dec
(3) |
| 2007 |
Jan
(10) |
Feb
(11) |
Mar
(41) |
Apr
(24) |
May
(30) |
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
|
From: Kenroy G. <kg...@us...> - 2007-05-13 08:50:48
|
Update of /cvsroot/groupscheme/groupscheme/src/grewpedit/src/plugins/jes In directory sc8-pr-cvs2.sourceforge.net:/tmp/cvs-serv3493/src/plugins/jes Modified Files: JESGroup.java JESGroupEditor.java Log Message: fixed buffer switcher bug but the display is not repainting on newly opened buffers Index: JESGroup.java =================================================================== RCS file: /cvsroot/groupscheme/groupscheme/src/grewpedit/src/plugins/jes/JESGroup.java,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 --- JESGroup.java 27 Apr 2007 08:05:35 -0000 1.1 +++ JESGroup.java 13 May 2007 08:50:07 -0000 1.2 @@ -6,7 +6,7 @@ public class JESGroup extends JFrame { public JESGroup(JTextPane editor, String host, int port) { - super("JES / GrewpEdit"); + super("Group Session"); GroupSession gs = new GroupSession(new JESGroupEditor(editor, host, port)); getContentPane().add(gs); pack(); Index: JESGroupEditor.java =================================================================== RCS file: /cvsroot/groupscheme/groupscheme/src/grewpedit/src/plugins/jes/JESGroupEditor.java,v retrieving revision 1.5 retrieving revision 1.6 diff -u -d -r1.5 -r1.6 --- JESGroupEditor.java 7 May 2007 14:50:51 -0000 1.5 +++ JESGroupEditor.java 13 May 2007 08:50:17 -0000 1.6 @@ -49,7 +49,11 @@ editor.setText(o.toString()); } - public JComponent getEditor() { return editor; } + public StyledDocument getModel() { return editor.getStyledDocument(); } + public JComponent getView() { return editor; } + public void setView(Object view) { + throw new RuntimeException("Not allowed to change view!"); + } public JComponent getChatPane() { return chat; } |
|
From: Kenroy G. <kg...@us...> - 2007-05-13 08:50:46
|
Update of /cvsroot/groupscheme/groupscheme/src/grewpedit/src/plugins/jedit In directory sc8-pr-cvs2.sourceforge.net:/tmp/cvs-serv3493/src/plugins/jedit Modified Files: GroupSessionPlugin.java JEditGDocument.java JEditGroupEditor.java dockables.xml Added Files: GroupSessionManager.java Removed Files: JEditGroupSession.java Log Message: fixed buffer switcher bug but the display is not repainting on newly opened buffers --- NEW FILE: GroupSessionManager.java --- // from GrewpEdit: import plugins.GroupSession; // from Java: import java.awt.*; import java.awt.event.*; import java.io.*; import java.util.Vector; // from Swing: import javax.swing.*; import javax.swing.event.*; // from jEdit: import org.gjt.sp.jedit.*; import org.gjt.sp.jedit.gui.*; import org.gjt.sp.jedit.io.*; import org.gjt.sp.jedit.textarea.JEditTextArea; import org.gjt.sp.jedit.msg.*; // import org.gjt.sp.jedit.msg.PropertiesChanged; // import org.gjt.sp.jedit.msg.ViewUpdate; import org.gjt.sp.util.Log; public class GroupSessionManager extends JPanel implements EBComponent, DefaultFocusComponent, ActionListener { private Vector<GroupSession<JEditGroupEditor<Buffer, JEditTextArea>>> sessions; private JComboBox sessionCB; private JPanel sessionPanel; private boolean floating; private Buffer buffer; // the current bufffer; // occam.cs-i.brandeise.edu/wiki user:occam pw:razor! // carnap.cs-i.brandeise.edu/jwiki user:carnap pw:razor! // Constructor // Thursday: 10am abstract for paper ... group 2007 public GroupSessionManager() { super(new BorderLayout()); sessions = new Vector<GroupSession<JEditGroupEditor<Buffer, JEditTextArea>>>(); add(sessionCB = new JComboBox(sessions), BorderLayout.NORTH); add(new JScrollPane(sessionPanel = new JPanel(new BorderLayout())), BorderLayout.CENTER); sessionCB.addActionListener(this); addKeyListener(new KeyHandler()); } private String host() { return "localhost"; } private int port() { return 14000; } public void init() { System.err.println("INIT bufflen = "+jEdit.getBuffers().length); sessions.clear(); Buffer[] buffers = jEdit.getBuffers(); for (int i=0; i<buffers.length; i++) { addSession(null, buffers[i]); } refresh(); } private void refresh() { sessionCB.validate(); sessionCB.repaint(); sessionPanel.validate(); sessionPanel.repaint(); } private synchronized void close(GroupSession gs) { if (gs != null) { gs.disconnect(); sessions.remove(gs); } } private synchronized GroupSession<JEditGroupEditor<Buffer, JEditTextArea>> getSession(Buffer buff) { for (GroupSession<JEditGroupEditor<Buffer, JEditTextArea>> e : sessions) { if (buff.equals(e.getGroupEditor().getModel())) return e; } return null; } private synchronized GroupSession<JEditGroupEditor<Buffer,JEditTextArea>> addSession(JEditTextArea ta, Buffer buff) { System.err.print("ADD_SESSION - "+buff); if (buff.isClosed()) { System.err.print(" addCLOSED - "+buff); return null; } GroupSession<JEditGroupEditor<Buffer,JEditTextArea>> gs = getSession(buff); if (gs == null) { JEditGroupEditor<Buffer, JEditTextArea> ge = new JEditGroupEditor<Buffer, JEditTextArea> (ta, buff, host(), port()); gs = new GroupSession<JEditGroupEditor<Buffer, JEditTextArea>>(ge); System.err.print(" NEW "+buff); sessions.add(gs); } else gs.getGroupEditor().setView(ta); gs.setName(buff.getPath().toString()); System.err.println(); return gs; } // this assumes gs is in the sessions vector private synchronized void setVisible(GroupSession gs) { System.err.print("SET_VISIBLE - "); //if (!gs.equals(sessionCB.getSelectedItem())) { if (gs != null && (sessionPanel.getComponentCount() == 0 || !gs.equals(sessionPanel.getComponent(0)))) { System.err.print(" "+gs); sessionPanel.removeAll(); sessionPanel.add(gs, BorderLayout.CENTER); if (SwingUtilities.getWindowAncestor(this) != null) SwingUtilities.getWindowAncestor(this).pack(); sessionCB.setSelectedItem(gs); refresh(); } System.err.println(); } public static JEditTextArea getTextArea(Buffer buffer) { return null; } public void viewUpdate(View view, String position) { System.err.println("VIEW_UPDATE "+view); if (position != "") this.floating = position.equals(DockableWindowManager.FLOATING); EditPane[] panes = view.getEditPanes(); for (int i=0; i<panes.length; i++) if (!panes[i].getBuffer().isClosed()) addSession(panes[i].getTextArea(), panes[i].getBuffer()); setVisible(getSession(view.getBuffer())); } public synchronized void shutdown() { for (GroupSession e : sessions) e.disconnect(); sessions.clear(); } // // EBComponent implementation // public void handleMessage(EBMessage message) { // shutdown session when plugin closing (eg unloading and reloading the plugin) to prevent running a server with out access to it // shutdown session when the file/buffer it is managing closes and hide that sessions panel // add new session panels for new files/buffers opened // figure out how to prevent new instance of the plugin if (message instanceof EditPaneUpdate) { editPaneUpdate((EditPaneUpdate)message); } else if (message instanceof BufferUpdate) { bufferUpdate((BufferUpdate)message); } } private void editPaneUpdate(EditPaneUpdate msg) { if (msg.getWhat().equals(EditPaneUpdate.BUFFER_CHANGED)) { System.err.println("BUFFER_CHANGED -- "+msg.getEditPane().getBuffer()); GroupSession gs = getSession(msg.getEditPane().getBuffer()); if (gs != null) { System.err.println(" CHANGED -- "+msg.getEditPane().getBuffer()); setVisible(addSession(msg.getEditPane().getTextArea(), msg.getEditPane().getBuffer())); } } if (msg.getWhat().equals(EditPaneUpdate.BUFFER_CHANGING)) { System.err.println("BUFFER_CHANGING -- "+msg.getEditPane().getBuffer()); GroupSession gs = getSession(msg.getEditPane().getBuffer()); if (gs != null) { addSession(null, msg.getEditPane().getBuffer()); System.err.println(" CHANGING -- "+msg.getEditPane().getBuffer()); } } refresh(); } private void bufferUpdate(BufferUpdate message) { if (message.getWhat().equals(BufferUpdate.CLOSED)) { System.err.println("BUFFER_CLOSED -- "+message.getBuffer()); close(getSession(message.getBuffer())); // View view = message.getView(); // // if size is 0 then we just closed the last buffer. But b/c it's the // // last buffer the view will still contain it and updating will add // // a new session for the closed buffer session // if (//sessions.size() > 0 && // view != null) // viewUpdate(view, ""); refresh(); } else if (message.getWhat().equals(BufferUpdate.LOADED)) { System.err.println("BUFFER_LOADED -- "+message.getBuffer()); addSession(null, message.getBuffer()); // View view = message.getView(); // if (view != null)// && message.getBuffer().equals(view.getBuffer())) // viewUpdate(view, ""); // else // setVisible(addSession(null, message.getBuffer())); refresh(); refresh(); } else if (message.getWhat().equals(BufferUpdate.SAVED)) { GroupSession gs = getSession(message.getBuffer()); if (gs != null) gs.setName(message.getBuffer().getPath().toString()); else throw new RuntimeException("No corresponding session for buffer!"); } refresh(); } // These JComponent methods provide the appropriate points // to subscribe and unsubscribe this object to the EditBus public void addNotify() { System.err.println("addNotified"); super.addNotify(); EditBus.addToBus(this); } public void removeNotify() { System.err.println("removeNotified"); super.removeNotify(); EditBus.removeFromBus(this); } // // GroupSessionActions implementation // //NONE FOR NOW // // helper methods // // NONE FOR NOW // // DefaultFocusComponent implementation // public void focusOnDefaultComponent() { sessionCB.requestFocus(); } // // ActionListener implementation // public void actionPerformed(ActionEvent e) { if (e.getSource() == sessionCB) { setVisible((GroupSession)sessionCB.getSelectedItem()); } } // // Listener objects // // <Esc> closes a floating window private class KeyHandler extends KeyAdapter { public void keyPressed(KeyEvent evt) { if(floating && evt.getKeyCode() == KeyEvent.VK_ESCAPE) { evt.consume(); // DockableWindowManager wm = // GroupSessionManager.this.view.getDockableWindowManager(); // wm.removeDockableWindow(GroupSessionPlugin.NAME); } } } } Index: GroupSessionPlugin.java =================================================================== RCS file: /cvsroot/groupscheme/groupscheme/src/grewpedit/src/plugins/jedit/GroupSessionPlugin.java,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 --- GroupSessionPlugin.java 7 May 2007 14:50:51 -0000 1.1 +++ GroupSessionPlugin.java 13 May 2007 08:50:05 -0000 1.2 @@ -1,51 +1,54 @@ import org.gjt.sp.jedit.EBPlugin; import org.gjt.sp.jedit.View; import org.gjt.sp.jedit.Buffer; +import org.gjt.sp.jedit.EditPlugin; import java.util.Vector; -import javax.swing.JScrollPane; +import javax.swing.JPanel; -public class GroupSessionPlugin extends EBPlugin { // EditPlugin +public class GroupSessionPlugin extends EditPlugin { // EditPlugin public static final String NAME = "groupsession"; //public static final String MENU = "quicknotepad.menu"; //public static final String PROPERTY_PREFIX = "plugin.QuickNotepadPlugin."; public static final String OPTION_PREFIX = "options.groupsession."; - - public static final Vector<JEditGroupSession> sessions = new Vector<JEditGroupSession>(); + public static final GroupSessionManager manager = new GroupSessionManager(); public void start() { System.err.println("GROUPSESIONPLUGIN - START() - "+this); + manager.init(); } public void stop() { System.err.println("GROUPSESIONPLUGIN - STOP() - "+this); -// for (GroupSession ge : sessions) -// ge.disconnect(); - } - - + manager.shutdown(); + } - public static JScrollPane/*JEditGroupSession*/ getGroupSession(View view, String position) { - JEditGroupSession gs = getSession(view); - if (gs == null) { - JEditGroupEditor ge = - new JEditGroupEditor(view.getEditPane().getTextArea(), - "localhost", 14000); - gs = new JEditGroupSession(ge, view, position); - sessions.add(gs); - } - return new JScrollPane(gs); + public static JPanel getManager(View view, String position) { + manager.viewUpdate(view, position); + return manager; } - private static JEditGroupSession getSession(View view) { - Buffer buf = view.getBuffer(); - for (JEditGroupSession e : sessions) { - if (buf.equals(e.getBuffer())) - return e; - } - return null; - } +// public static JScrollPane/*JEditGroupSession*/ getGroupSession(View view, String position) { +// JEditGroupSession gs = getSession(view); +// if (gs == null) { +// JEditGroupEditor ge = +// new JEditGroupEditor(view.getEditPane().getTextArea(), +// "localhost", 14000); +// gs = new JEditGroupSession(ge, view, position); +// sessions.add(gs); +// } +// return new JScrollPane(gs); +// } + +// private static JEditGroupSession getSession(View view) { +// Buffer buf = view.getBuffer(); +// for (JEditGroupSession e : sessions) { +// if (buf.equals(e.getBuffer())) +// return e; +// } +// return null; +// } /* public static GroupJEditor getGroupSession(View view, String position) { Index: JEditGDocument.java =================================================================== RCS file: /cvsroot/groupscheme/groupscheme/src/grewpedit/src/plugins/jedit/JEditGDocument.java,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 --- JEditGDocument.java 7 May 2007 14:50:51 -0000 1.1 +++ JEditGDocument.java 13 May 2007 08:50:05 -0000 1.2 @@ -2,7 +2,8 @@ import util.Util; import org.gjt.sp.jedit.textarea.JEditTextArea; -import org.gjt.sp.jedit.buffer.JEditBuffer; +//import org.gjt.sp.jedit.buffer.JEditBuffer; +import org.gjt.sp.jedit.Buffer; import org.gjt.sp.jedit.buffer.BufferListener; import javax.swing.SwingUtilities; @@ -14,23 +15,20 @@ * local/remote client edit facilitator. **/ public class JEditGDocument<C extends GDocumentClient, - //E extends TextEdit<String>> E extends TextEdit<? extends GroupCursor.Cursor>> implements GDocument<C, E> { C client; - private JEditTextArea tarea; - private JEditBuffer buff; + private Buffer buff; private BufferListener listener; private HighlightCursor<Integer, Color> gcursor; private boolean saved, forwarding; - public JEditGDocument(C client, JEditTextArea tarea, BufferListener listener){ + public JEditGDocument(C client, Buffer buff, BufferListener listener){ this.client = client; - this.tarea = tarea; this.listener = listener; this.gcursor = null; - buff = tarea.getBuffer(); + this.buff = buff; buff.addBufferListener(listener); saved = true; client.setDocument(this); @@ -51,7 +49,7 @@ public void connectionClosed() { buff.removeBufferListener(listener); - tarea.setBackground(new Color(175, 175, 175)); + //tarea.setBackground(new Color(175, 175, 175)); // if (gcursor != null) // gcursor.clear(); // Util.warning("Lost Group Connection! ", tarea); @@ -64,7 +62,6 @@ synchronized(buff) { if (!SwingUtilities.isEventDispatchThread()) System.err.println("NOT IN THE EVENT QUEUE!!!"); buff.removeBufferListener(listener); - //buff.insertString(e.offset, e.text, null); buff.insert(e.offset, e.text); cursorUpdate(e.details); buff.addBufferListener(listener); Index: JEditGroupEditor.java =================================================================== RCS file: /cvsroot/groupscheme/groupscheme/src/grewpedit/src/plugins/jedit/JEditGroupEditor.java,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -r1.2 -r1.3 --- JEditGroupEditor.java 7 May 2007 14:50:51 -0000 1.2 +++ JEditGroupEditor.java 13 May 2007 08:50:06 -0000 1.3 @@ -10,6 +10,7 @@ // From jEdit import org.gjt.sp.jedit.textarea.JEditTextArea; +import org.gjt.sp.jedit.Buffer; // From Java import javax.swing.*; @@ -17,12 +18,14 @@ import java.awt.Color; import java.io.File; -public class JEditGroupEditor implements GroupEditor { +public class JEditGroupEditor<M extends Buffer, V extends JEditTextArea> + implements GroupEditor<M, V> { + M buffer; + V tarea; GroupList members; ChatPanel chat; JFileChooser fc = new JFileChooser(); - JEditTextArea editor; String host, localhost; int port; @@ -36,24 +39,38 @@ String[] miscActs = new String[] { "Refresh Cursors", "Save Chat", "Save NodeView", "Save SubNodeView" }; - public JEditGroupEditor(JEditTextArea editor, String host, int port) { - this.editor = editor; + public JEditGroupEditor(M buffer, String host, int port) { + this(null, buffer, host, port); + } + + public JEditGroupEditor(V ta, M buffer, + String host, int port) { + this.tarea = tarea; + this.buffer = buffer; this.host = host; this.port = port; this.localhost = net.NetUtil.getMyLocalIP().getHostAddress(); } public Object clearState() { - String state = editor.getText(); - editor.setText(""); + String state = buffer.getText(0, buffer.getLength()); + buffer.remove(0, buffer.getLength()); return state; } public void setState(Object o) { - editor.setText(o.toString()); + buffer.insert(0, o.toString()); } - public JComponent getEditor() { return editor; } + public M getModel() { return buffer; } + + public V getView() { + if (tarea != null && tarea.getBuffer().equals(buffer)) + return tarea; + return (V)GroupSessionManager.getTextArea(buffer); + } + + public void setView(V view) { tarea = view; } public JComponent getChatPane() { return chat; } @@ -94,12 +111,12 @@ client = new MSETGDocumentClient<JEditGDocument, TextEdit>(gc); gdoc = new JEditGDocument<MSETGDocumentClient,TextEdit<GroupCursor.Cursor>> - (client, editor, new JEBufferListener(client)); + (client, getModel(), new JEBufferListener(client)); client.connect(); Color cid = Util.randomColor(); // gcursor = new HighlightCursor<Integer, Color> -// (new Integer(gc.getID()), cid, 5, editor); +// (new Integer(gc.getID()), cid, 5, getView()); // gdoc.setCursor(gcursor); // gcursor.enableCaretListener(gc); Index: dockables.xml =================================================================== RCS file: /cvsroot/groupscheme/groupscheme/src/grewpedit/src/plugins/jedit/dockables.xml,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 --- dockables.xml 7 May 2007 00:05:23 -0000 1.1 +++ dockables.xml 13 May 2007 08:50:07 -0000 1.2 @@ -4,6 +4,6 @@ <DOCKABLES> <DOCKABLE NAME="groupsession"> - GroupSessionPlugin.getGroupSession(view, position); + GroupSessionPlugin.getManager(view, position); </DOCKABLE> </DOCKABLES> \ No newline at end of file --- JEditGroupSession.java DELETED --- |
|
From: Kenroy G. <kg...@us...> - 2007-05-13 08:50:39
|
Update of /cvsroot/groupscheme/groupscheme/src/grewpedit/src/plugins In directory sc8-pr-cvs2.sourceforge.net:/tmp/cvs-serv3493/src/plugins Modified Files: GroupEditor.java GroupSession.java Log Message: fixed buffer switcher bug but the display is not repainting on newly opened buffers Index: GroupEditor.java =================================================================== RCS file: /cvsroot/groupscheme/groupscheme/src/grewpedit/src/plugins/GroupEditor.java,v retrieving revision 1.3 retrieving revision 1.4 diff -u -d -r1.3 -r1.4 --- GroupEditor.java 7 May 2007 00:05:23 -0000 1.3 +++ GroupEditor.java 13 May 2007 08:50:04 -0000 1.4 @@ -3,12 +3,14 @@ import xdocument.GDocumentClient; import javax.swing.*; -public interface GroupEditor { +public interface GroupEditor<M, V> { public Object clearState(); public void setState(Object o); - public JComponent getEditor(); + public M getModel(); + public V getView(); + public void setView(V view); public JComponent getChatPane(); public JComponent getMembersPane(); Index: GroupSession.java =================================================================== RCS file: /cvsroot/groupscheme/groupscheme/src/grewpedit/src/plugins/GroupSession.java,v retrieving revision 1.5 retrieving revision 1.6 diff -u -d -r1.5 -r1.6 --- GroupSession.java 7 May 2007 00:05:23 -0000 1.5 +++ GroupSession.java 13 May 2007 08:50:04 -0000 1.6 @@ -11,10 +11,10 @@ import java.awt.*; import java.util.Vector; -public class GroupSession extends JPanel +public class GroupSession<E extends GroupEditor> extends JPanel implements ActionListener, ConnectionListener { - GroupEditor ge = null; + E ge = null; JComponent members = null; JComponent chat = null; @@ -24,7 +24,6 @@ // LOGIN COMPONENTS JPanel loginPanel = new JPanel(); - JLabel titleLab = new JLabel("Group Session"); JLabel userLab = new JLabel("User"); JLabel groupLab = new JLabel("Group"); JTextField userTF = new JTextField(13); @@ -33,8 +32,6 @@ // OPTIONS COMPONENTS JPanel optionsPanel = new JPanel(); - JButton optionsB = new JButton("Hide Options"); - JButton editorB = new JButton("Go to Editor"); // SERVER COMPONENTS JPanel serverPanel = new JPanel(); @@ -51,8 +48,9 @@ // DISPLAY COMPONENTS JPanel displayPanel = new JPanel(); - JCheckBox loginCB = new JCheckBox("Login", true); - JCheckBox chatCB = new JCheckBox("Chatroom", false); + JCheckBox loginCB = new JCheckBox("Login", true); + JCheckBox optionsCB = new JCheckBox("Options", true); + JCheckBox chatCB = new JCheckBox("Chatroom", false); JCheckBox memberCB = new JCheckBox("Member List", false); // EDITING COMPONENTS @@ -73,15 +71,16 @@ JButton miscApplyB = new JButton("Apply"); private boolean init = true; + private String name = null; - public GroupSession(GroupEditor ge) { + public GroupSession(E ge) { this.ge = ge; setLayout(new BorderLayout()); - titleLab.setFont(titleLab.getFont().deriveFont(26f)); - titleLab.setHorizontalAlignment(JLabel.CENTER); - add(titleLab, BorderLayout.NORTH); +// titleLab.setFont(titleLab.getFont().deriveFont(26f)); +// titleLab.setHorizontalAlignment(JLabel.CENTER); +// add(titleLab, BorderLayout.NORTH); add(getMainPanel(), BorderLayout.CENTER); defaultServTF.setText(ge.getDefaultHost()); @@ -89,8 +88,19 @@ } - public void setTitle(String title) { - titleLab.setText(title); + public void setName(String name) { + this.name = name; +// titleLab.setText(name); + } + + public String toString() { + if (name == null) + return super.toString(); + return (editCount!=null&&editCount.alive?"**":"")+name; + } + + public E getGroupEditor() { + return ge; } @@ -98,26 +108,17 @@ if (init) { mainPanel.setLayout(new BorderLayout()); mainPanel.add(getLoginPanel(), BorderLayout.NORTH); - - JPanel panel = new JPanel(new GridBagLayout()); - panel.add(optionsB); - panel.add(editorB); - mainPanel.add(panel, BorderLayout.SOUTH); - + mainPanel.add(getDisplayPanel(), BorderLayout.SOUTH); mainPanel.add(getOptionsPanel(), BorderLayout.EAST); chatPanel.setBorder(BorderFactory.createTitledBorder (chatPanel.getBorder(), "Chatroom")); - //memberPanel.add(new JButton("Change Color")); - panel = new JPanel(new BorderLayout()); + JPanel panel = new JPanel(new BorderLayout()); panel.add(memberPanel, BorderLayout.NORTH); panel.setBorder(BorderFactory.createTitledBorder (panel.getBorder(), "MEMBERS")); memberPanel = panel; - - optionsB.addActionListener(this); - editorB.addActionListener(this); init = false; } return mainPanel; @@ -157,7 +158,6 @@ optionsPanel.add(getServerPanel(), c); c.gridy = GridBagConstraints.RELATIVE; optionsPanel.add(getEditingPanel(), c); - optionsPanel.add(getDisplayPanel(), c); optionsPanel.add(getMiscPanel(), c); optionsPanel.setBorder(BorderFactory.createTitledBorder (optionsPanel.getBorder(), "Options")); @@ -221,19 +221,25 @@ public JPanel getDisplayPanel() { if (init) { displayPanel.setLayout(new GridBagLayout()); - GridBagConstraints c = new GridBagConstraints(); - c.gridx = 0; c.gridy = 0; +// GridBagConstraints c = new GridBagConstraints(); +// c.gridx = 0; c.gridy = 0; displayPanel.add(loginCB); - c.gridx = GridBagConstraints.RELATIVE; +// c.gridx = GridBagConstraints.RELATIVE; + displayPanel.add(optionsCB); displayPanel.add(chatCB); displayPanel.add(memberCB); loginCB.addActionListener(this); + optionsCB.addActionListener(this); chatCB.addActionListener(this); memberCB.addActionListener(this); displayPanel.setBorder(BorderFactory.createTitledBorder (displayPanel.getBorder(), "Display")); + // this keeps the titled border hugged around the panel + JPanel panel = new JPanel(); + panel.add(displayPanel); + displayPanel = panel; } return displayPanel; } @@ -314,7 +320,8 @@ public void disconnect() { ge.disconnect(); - editCount.alive = false; + if (editCount != null) + editCount.alive = false; setConnected(false); } @@ -339,11 +346,10 @@ try { // clear and save the state state = ge.clearState(); - //Document doc = ge.getEditor().getDocument(); + //Document doc = ge.getView().getDocument(); //doc.remove(0, doc.getLength()); ge.connect(userTF.getText(), groupTF.getText(), host, port, localServRB.isSelected()); - ge.getEditor().setBackground(Color.white); editCount = new EditAwareness(); editCount.start(); if (localServRB.isSelected()) @@ -379,7 +385,6 @@ memberCB.doClick(); // show the new setConnected(true); - //editorB.doClick(); } @@ -391,7 +396,6 @@ public void connectionClosed(ConnectionEvent ce) { disconnect(); - ge.getEditor().setBackground(new Color(175, 175, 175)); } @@ -432,23 +436,21 @@ else disconnect(); } - else if (source == optionsB) { - if (optionsB.getText().startsWith("Hide")) { - optionsB.setText("Show Options"); - mainPanel.remove(optionsPanel); + else if (source == loginCB) { + if (loginCB.isSelected()) { + mainPanel.add(loginPanel, BorderLayout.NORTH); } else { - optionsB.setText("Hide Options"); - mainPanel.add(optionsPanel, BorderLayout.EAST); + mainPanel.remove(loginPanel); } refresh(); } - else if (source == loginCB) { - if (loginCB.isSelected()) { - mainPanel.add(loginPanel, BorderLayout.NORTH); + else if (source == optionsCB) { + if (optionsCB.isSelected()) { + mainPanel.add(optionsPanel, BorderLayout.EAST); } else { - mainPanel.remove(loginPanel); + mainPanel.remove(optionsPanel); } refresh(); } @@ -474,18 +476,19 @@ ge.applyAction(miscCombo.getSelectedItem()); refresh(); } - else if (source == editorB) { - //KeyboardFocusManager.clearGlobalFocusOwner() - SwingUtilities.getWindowAncestor(GroupSession.this).toBack(); - Window w = SwingUtilities.getWindowAncestor(ge.getEditor()); - if (w != null) { - w.setVisible(true); - w.toFront(); - } - - if (!ge.getEditor().requestFocusInWindow()) - util.Util.debugln("Editor "+ge.getEditor()+" can't grab focus!"); - } +// else if (source == editorB) { +// //KeyboardFocusManager.clearGlobalFocusOwner() +// SwingUtilities.getWindowAncestor(GroupSession.this).toBack(); +// Window w = SwingUtilities.getWindowAncestor +// (((JComponent)ge.getView())); +// if (w != null) { +// w.setVisible(true); +// w.toFront(); +// } +// if (ge.getView() != null) +// if (!((JComponent)ge.getView()).requestFocusInWindow()) +// util.Util.debugln("Editor "+((JComponent)ge.getView())+" can't grab focus!"); +// } else if (source == inQueueCB) { ge.getClient().setApplyingIncoming(inQueueCB.isSelected()); } |
|
From: Kenroy G. <kg...@us...> - 2007-05-13 08:50:23
|
Update of /cvsroot/groupscheme/groupscheme/src/grewpedit/src/xdocument In directory sc8-pr-cvs2.sourceforge.net:/tmp/cvs-serv3493/src/xdocument Modified Files: JavaGDocument.java Log Message: fixed buffer switcher bug but the display is not repainting on newly opened buffers Index: JavaGDocument.java =================================================================== RCS file: /cvsroot/groupscheme/groupscheme/src/grewpedit/src/xdocument/JavaGDocument.java,v retrieving revision 1.10 retrieving revision 1.11 diff -u -d -r1.10 -r1.11 --- JavaGDocument.java 7 May 2007 14:50:51 -0000 1.10 +++ JavaGDocument.java 13 May 2007 08:50:18 -0000 1.11 @@ -48,7 +48,7 @@ public void connectionClosed() { jdoc.removeDocumentListener(listener); - tpane.setBackground(new Color(175, 175, 175)); +// tpane.setBackground(new Color(175, 175, 175)); // if (gcursor != null) // gcursor.clear(); // Util.warning("Lost Group Connection! ", tpane); |
|
From: Kenroy G. <kg...@us...> - 2007-05-07 14:50:58
|
Update of /cvsroot/groupscheme/groupscheme/src/grewpedit/src/plugins/jes In directory sc8-pr-cvs2.sourceforge.net:/tmp/cvs-serv2984/plugins/jes Modified Files: JESGroupEditor.java Added Files: README Log Message: finished the basic plugin for jEdit without cursor awareness --- NEW FILE: README --- GrepwEdit Collaboration Plugin for JES Archive Contents: - README - GrewpEditV2.jar - JESUI.py - jes.bat Installation (Windows, Linux and others): 1. Extract the zip file 2. Open your JES program folder 3. Place GrewpEditV2.jar in the 'jars' folder 4. Replace the JESUI.py file in the 'Source' folder with the one you extracted 5. (only for Windows) replace jes.bat with the one you extracted 6. Start JES as usual (eg. JES.sh or JES.exe|jes.bat). Click on "File>Group Session" to join or start group editing session. Index: JESGroupEditor.java =================================================================== RCS file: /cvsroot/groupscheme/groupscheme/src/grewpedit/src/plugins/jes/JESGroupEditor.java,v retrieving revision 1.4 retrieving revision 1.5 diff -u -d -r1.4 -r1.5 --- JESGroupEditor.java 7 May 2007 00:05:23 -0000 1.4 +++ JESGroupEditor.java 7 May 2007 14:50:51 -0000 1.5 @@ -10,7 +10,6 @@ import javax.swing.*; import javax.swing.text.*; -import javax.swing.event.DocumentEvent; import java.awt.Color; import java.io.File; @@ -26,8 +25,8 @@ GroupClient gc = null; GroupServer gs = null; - MSETDocClient<JavaGDocument, DocumentEvent> client; - JavaGDocument<MSETDocClient, TextEdit<GroupCursor.Cursor>> gdoc; + MSETGDocumentClient<JavaGDocument, TextEdit> client; + JavaGDocument<MSETGDocumentClient, TextEdit<GroupCursor.Cursor>> gdoc; HighlightCursor<Integer, Color> gcursor = null; String[] miscActs = new String[] @@ -89,9 +88,9 @@ gc = new GroupClient(user, group, host, port, "", ""); - client = new MSETDocClient<JavaGDocument, DocumentEvent>(gc); - gdoc = new JavaGDocument<MSETDocClient, TextEdit<GroupCursor.Cursor>> - (client,editor); + client = new MSETGDocumentClient<JavaGDocument, TextEdit>(gc); + gdoc = new JavaGDocument<MSETGDocumentClient, TextEdit<GroupCursor.Cursor>> + (client, editor, new JDocListener(client)); client.connect(); Color cid = Util.randomColor(); |
Update of /cvsroot/groupscheme/groupscheme/src/grewpedit/src/plugins/jedit In directory sc8-pr-cvs2.sourceforge.net:/tmp/cvs-serv2984/plugins/jedit Modified Files: JEditGroupEditor.java build.xml Added Files: GroupSessionPlugin.java JEBufferListener.java JEditGDocument.java Log Message: finished the basic plugin for jEdit without cursor awareness --- NEW FILE: GroupSessionPlugin.java --- import org.gjt.sp.jedit.EBPlugin; import org.gjt.sp.jedit.View; import org.gjt.sp.jedit.Buffer; import java.util.Vector; import javax.swing.JScrollPane; public class GroupSessionPlugin extends EBPlugin { // EditPlugin public static final String NAME = "groupsession"; //public static final String MENU = "quicknotepad.menu"; //public static final String PROPERTY_PREFIX = "plugin.QuickNotepadPlugin."; public static final String OPTION_PREFIX = "options.groupsession."; public static final Vector<JEditGroupSession> sessions = new Vector<JEditGroupSession>(); public void start() { System.err.println("GROUPSESIONPLUGIN - START() - "+this); } public void stop() { System.err.println("GROUPSESIONPLUGIN - STOP() - "+this); // for (GroupSession ge : sessions) // ge.disconnect(); } public static JScrollPane/*JEditGroupSession*/ getGroupSession(View view, String position) { JEditGroupSession gs = getSession(view); if (gs == null) { JEditGroupEditor ge = new JEditGroupEditor(view.getEditPane().getTextArea(), "localhost", 14000); gs = new JEditGroupSession(ge, view, position); sessions.add(gs); } return new JScrollPane(gs); } private static JEditGroupSession getSession(View view) { Buffer buf = view.getBuffer(); for (JEditGroupSession e : sessions) { if (buf.equals(e.getBuffer())) return e; } return null; } /* public static GroupJEditor getGroupSession(View view, String position) { GroupJEditor ge = getSession(view); if (ge == null) { ge = new GroupJEditor(view, position); sessions.add(ge); } return ge; } private static GroupJEditor getSession(View view) { Buffer buf = view.getBuffer(); for (GroupJEditor e : sessions) { if (buf.equals(e.getBuffer())) return e; } return null; } */ } --- NEW FILE: JEBufferListener.java --- import xdocument.*; import org.gjt.sp.jedit.buffer.BufferAdapter; import org.gjt.sp.jedit.buffer.JEditBuffer; /** * Designed to communicate with other clients to maintain a * shared {@link GDocument} state for a group of client's. **/ public class JEBufferListener<C extends GDocumentClient> extends BufferAdapter { C client; public JEBufferListener(C client) { this.client = client; } /** * Called when text is inserted into the buffer. **/ public void contentInserted(JEditBuffer buffer, int startLine, int offset, int numLines, int length) { try { String str = buffer.getText(offset, length); TextEdit edit = new TextEdit(offset, str, length, null); client.insertUpdate(edit); } catch (Exception ex) { util.Util.error("Could not get the String to insert.", ex, null); return; } } /** * Called when text is removed from the buffer. **/ public void contentRemoved(JEditBuffer buffer, int startLine, int offset, int numLines, int length) { client.removeUpdate(new TextEdit(offset, length, null)); } /** * Called to notify the text area that the buffer has been reloaded. ** public void bufferLoaded(JEditBuffer buffer) { } /** * Called to notify the text area that folds need to be collapsed if the "collapseFolds" property is set. ** public void foldHandlerChanged(JEditBuffer buffer) { } /** * Called when line fold levels change. ** public void foldLevelChanged(JEditBuffer buffer, int startLine, int endLine) { } /** * Called when text is about to be removed from the buffer, but is still present. ** public void preContentRemoved(JEditBuffer buffer, int startLine, int offset, int numLines, int length) { } /** * Called after an undo or compound edit has finished. ** public void transactionComplete(JEditBuffer buffer) { } */ } --- NEW FILE: JEditGDocument.java --- import xdocument.*; import util.Util; import org.gjt.sp.jedit.textarea.JEditTextArea; import org.gjt.sp.jedit.buffer.JEditBuffer; import org.gjt.sp.jedit.buffer.BufferListener; import javax.swing.SwingUtilities; import javax.swing.text.*; import java.awt.Color; /** * The class that represents a group document and servers as a bi-directional * local/remote client edit facilitator. **/ public class JEditGDocument<C extends GDocumentClient, //E extends TextEdit<String>> E extends TextEdit<? extends GroupCursor.Cursor>> implements GDocument<C, E> { C client; private JEditTextArea tarea; private JEditBuffer buff; private BufferListener listener; private HighlightCursor<Integer, Color> gcursor; private boolean saved, forwarding; public JEditGDocument(C client, JEditTextArea tarea, BufferListener listener){ this.client = client; this.tarea = tarea; this.listener = listener; this.gcursor = null; buff = tarea.getBuffer(); buff.addBufferListener(listener); saved = true; client.setDocument(this); } public boolean isSaved() { return saved; } public void setSaved(boolean b) { saved = b; } public void setCursor(HighlightCursor<Integer, Color> c) { gcursor = c; } ////////////// GDocument Interface Methods /////////////////// public C getClient() { return client; } public void setForwardingUpdates(boolean toClient) { forwarding = toClient; } public boolean isForwardingUpdates() { return forwarding; } public void connectionClosed() { buff.removeBufferListener(listener); tarea.setBackground(new Color(175, 175, 175)); // if (gcursor != null) // gcursor.clear(); // Util.warning("Lost Group Connection! ", tarea); } public int getLength() { return buff.getLength(); } public void insertUpdate(E e) throws Exception { synchronized(buff) { if (!SwingUtilities.isEventDispatchThread()) System.err.println("NOT IN THE EVENT QUEUE!!!"); buff.removeBufferListener(listener); //buff.insertString(e.offset, e.text, null); buff.insert(e.offset, e.text); cursorUpdate(e.details); buff.addBufferListener(listener); } } public void removeUpdate(E e) throws Exception { synchronized(buff) { if (!SwingUtilities.isEventDispatchThread()) System.err.println("NOT IN THE EVENT QUEUE!!!"); buff.removeBufferListener(listener); buff.remove(e.offset, e.length); cursorUpdate(e.details); buff.addBufferListener(listener); } } public void changedUpdate(E e) throws Exception { synchronized(buff) { if (!SwingUtilities.isEventDispatchThread()) System.err.println("NOT IN THE EVENT QUEUE!!!"); buff.removeBufferListener(listener); //buff.setCharacterAttributes(e.offset, e.length, null, false); cursorUpdate(e.details); buff.addBufferListener(listener); } } public void cursorUpdate(GroupCursor.Cursor cursor) throws Exception { //System.err.println("cursor "+cursor); if (gcursor != null && cursor != null) gcursor.cursorUpdate((GroupCursor.Cursor<Integer,Color>)cursor); } public GroupCursor.Cursor getMyCursor(int pos) { if (gcursor != null) { gcursor.moveMyCursor(pos); return gcursor.getMyCursor(); } return null; } } Index: JEditGroupEditor.java =================================================================== RCS file: /cvsroot/groupscheme/groupscheme/src/grewpedit/src/plugins/jedit/JEditGroupEditor.java,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 --- JEditGroupEditor.java 7 May 2007 00:05:23 -0000 1.1 +++ JEditGroupEditor.java 7 May 2007 14:50:51 -0000 1.2 @@ -1,15 +1,19 @@ +// From GrewpEdit import plugins.*; -import xdocument.GroupCursor; import xdocument.*; import xdocument.mset.*; -import widget.*; +import widget.ChatPanel; +import widget.GroupList; import net.*; import event.*; import util.*; +// From jEdit +import org.gjt.sp.jedit.textarea.JEditTextArea; + +// From Java import javax.swing.*; import javax.swing.text.*; -import javax.swing.event.DocumentEvent; import java.awt.Color; import java.io.File; @@ -18,21 +22,21 @@ GroupList members; ChatPanel chat; JFileChooser fc = new JFileChooser(); - JComponent editor; + JEditTextArea editor; String host, localhost; int port; GroupClient gc = null; GroupServer gs = null; - MSETDocClient<JavaGDocument, DocumentEvent> client; - JavaGDocument<MSETDocClient, TextEdit<GroupCursor.Cursor>> gdoc; + MSETGDocumentClient<JEditGDocument, TextEdit> client; + JEditGDocument<MSETGDocumentClient, TextEdit<GroupCursor.Cursor>> gdoc; HighlightCursor<Integer, Color> gcursor = null; String[] miscActs = new String[] { "Refresh Cursors", "Save Chat", "Save NodeView", "Save SubNodeView" }; - public JEditGroupEditor(JComponent editor, String host, int port) { + public JEditGroupEditor(JEditTextArea editor, String host, int port) { this.editor = editor; this.host = host; this.port = port; @@ -40,13 +44,13 @@ } public Object clearState() { -// String state = editor.getText(); -// editor.setText(""); - return null;//state; + String state = editor.getText(); + editor.setText(""); + return state; } public void setState(Object o) { - //editor.setText(o.toString()); + editor.setText(o.toString()); } public JComponent getEditor() { return editor; } @@ -88,11 +92,11 @@ gc = new GroupClient(user, group, host, port, "", ""); - client = null;//new MSETDocClient<JavaGDocument, DocumentEvent>(gc); - gdoc = null;/*new JavaGDocument<MSETDocClient, TextEdit<GroupCursor.Cursor>> - (client,editor);*/ + client = new MSETGDocumentClient<JEditGDocument, TextEdit>(gc); + gdoc = new JEditGDocument<MSETGDocumentClient,TextEdit<GroupCursor.Cursor>> + (client, editor, new JEBufferListener(client)); - gc.connect();//client.connect(); + client.connect(); Color cid = Util.randomColor(); // gcursor = new HighlightCursor<Integer, Color> // (new Integer(gc.getID()), cid, 5, editor); @@ -134,27 +138,12 @@ else if (act.equals("Save NodeView") && client != null) { File f = FileIO.saveAs(fc, fc.getSelectedFile(), chat); if (f != null) - ;//Graphviz.save(Graphviz.TREE_VIEW, f, client.getMSET()); + Graphviz.save(Graphviz.TREE_VIEW, f, client.getMSET()); } else if (act.equals("Save SubNodeView") && client != null) { File f = FileIO.saveAs(fc, fc.getSelectedFile(), chat); if (f != null) - ;//Graphviz.save(Graphviz.SUBNODE_VIEW, f, client.getMSET()); + Graphviz.save(Graphviz.SUBNODE_VIEW, f, client.getMSET()); } } - - - public static void main(String[] args) { - JFrame f = new JFrame("test"); - JTextPane tp = new JTextPane(); - f.getContentPane().add(tp); - f.setSize(350, 350); - f.setVisible(true); - JFrame f2 = new JFrame("JEdit / GrewpEdit"); - GroupSession con = - new GroupSession(new JEditGroupEditor(tp, "localhost", 14000)); - f2.add(con); - f2.pack(); - f2.setVisible(true); - } } Index: build.xml =================================================================== RCS file: /cvsroot/groupscheme/groupscheme/src/grewpedit/src/plugins/jedit/build.xml,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 --- build.xml 7 May 2007 00:05:23 -0000 1.1 +++ build.xml 7 May 2007 14:50:51 -0000 1.2 @@ -4,8 +4,7 @@ <property file="build.properties"/> - <!-- property name="jedit.install.dir" value="../.."/ --> - <property name="jedit.install.dir" value="/usr/share/jedit/"/> + <property name="jedit.install.dir" value="/usr/share/jEdit/"/> <property name="grewpedit.class.path" value="../../../class/"/> <property name="jar.name" value="GroupSession.jar"/> |
|
From: Kenroy G. <kg...@us...> - 2007-05-07 14:50:58
|
Update of /cvsroot/groupscheme/groupscheme/src/grewpedit/src/grouplet/xdoc In directory sc8-pr-cvs2.sourceforge.net:/tmp/cvs-serv2984/grouplet/xdoc Modified Files: XDocGrouplet.java Log Message: finished the basic plugin for jEdit without cursor awareness Index: XDocGrouplet.java =================================================================== RCS file: /cvsroot/groupscheme/groupscheme/src/grewpedit/src/grouplet/xdoc/XDocGrouplet.java,v retrieving revision 1.8 retrieving revision 1.9 diff -u -d -r1.8 -r1.9 --- XDocGrouplet.java 1 May 2007 09:05:58 -0000 1.8 +++ XDocGrouplet.java 7 May 2007 14:50:51 -0000 1.9 @@ -40,8 +40,6 @@ import javax.swing.WindowConstants; import javax.swing.JTextPane; import javax.swing.event.*; -import javax.swing.event.DocumentListener; -import javax.swing.event.DocumentEvent; import javax.swing.event.ListSelectionListener; import javax.swing.event.ListSelectionEvent; import java.awt.Color; @@ -62,8 +60,8 @@ private static final int C_LENGTH = 5; JTextPane tpane; - MSETDocClient<JavaGDocument, DocumentEvent> client; - JavaGDocument<MSETDocClient, TextEdit<GroupCursor.Cursor>> gdoc; + MSETGDocumentClient<JavaGDocument, TextEdit> client; + JavaGDocument<MSETGDocumentClient, TextEdit<GroupCursor.Cursor>> gdoc; HighlightCursor<Integer, Color> gcursor; HighlightedDocument jdoc; @@ -229,7 +227,7 @@ File f = FileIO.saveAs(fc, vizfile, tpane); if (f != null) Graphviz.save(type, vizfile=f, - ((MSETDocClient)client).getMSET()); + ((MSETGDocumentClient)client).getMSET()); } @@ -373,9 +371,9 @@ this.info = info; this.info.setOwner(owner); - client = new MSETDocClient<JavaGDocument, DocumentEvent>(gc); - gdoc = new JavaGDocument<MSETDocClient, TextEdit<GroupCursor.Cursor>> - (client, tpane); + client = new MSETGDocumentClient<JavaGDocument, TextEdit>(gc); + gdoc = new JavaGDocument<MSETGDocumentClient, TextEdit<GroupCursor.Cursor>> + (client, tpane, new JDocListener(client)); // reset java document before connecting tpane.getDocument().remove(0, tpane.getDocument().getLength()); |
|
From: Kenroy G. <kg...@us...> - 2007-05-07 14:50:58
|
Update of /cvsroot/groupscheme/groupscheme/src/grewpedit/src/xdocument In directory sc8-pr-cvs2.sourceforge.net:/tmp/cvs-serv2984/xdocument Modified Files: DocTesting.java GDocumentClient.java JavaGDocument.java Added Files: JDocListener.java Log Message: finished the basic plugin for jEdit without cursor awareness --- NEW FILE: JDocListener.java --- package xdocument; import javax.swing.event.DocumentEvent; import javax.swing.event.DocumentListener; /** * Designed to communicate with other clients to maintain a * shared {@link GDocument} state for a group of client's. **/ public class JDocListener<C extends GDocumentClient> implements DocumentListener { C client; public JDocListener(C client) { this.client = client; } public void insertUpdate(DocumentEvent e) { try { String str = e.getDocument().getText(e.getOffset(), e.getLength()); TextEdit edit = new TextEdit(e.getOffset(), str, e.getLength(), null); client.insertUpdate(edit); } catch (Exception ex) { util.Util.error("Could not get the String to insert.", ex, null); return; } } public void removeUpdate(DocumentEvent e) { client.removeUpdate(new TextEdit(e.getOffset(), e.getLength(), null)); } public void changedUpdate(DocumentEvent e) { client.changedUpdate(new TextEdit(e.getOffset(), e.getLength(), null)); } } Index: DocTesting.java =================================================================== RCS file: /cvsroot/groupscheme/groupscheme/src/grewpedit/src/xdocument/DocTesting.java,v retrieving revision 1.4 retrieving revision 1.5 diff -u -d -r1.4 -r1.5 --- DocTesting.java 30 Apr 2007 07:55:12 -0000 1.4 +++ DocTesting.java 7 May 2007 14:50:51 -0000 1.5 @@ -48,7 +48,7 @@ JCheckBoxMenuItem delMI, inQMI, outQMI; JMenuItem dotMI, dotSNMI, saveViewMI, saveTreeMI, saveAllMI; JFileChooser fc; - MSETDocClient<JavaGDocument, DocumentEvent> client; + MSETGDocumentClient<JavaGDocument, TextEdit> client; MSET mset; public DocTesting(GroupClient gc, String type, long delay, @@ -68,11 +68,11 @@ tpane.setDocument(jdoc); } - client = new MSETDocClient<JavaGDocument, DocumentEvent>(gc); + client = new MSETGDocumentClient<JavaGDocument, TextEdit>(gc); // constructor sets client's doc to this new jdoc - JavaGDocument<MSETDocClient, TextEdit<GroupCursor.Cursor>> gdoc = - new JavaGDocument<MSETDocClient, TextEdit<GroupCursor.Cursor>> - (client, tpane); + JavaGDocument<MSETGDocumentClient, TextEdit<GroupCursor.Cursor>> gdoc = + new JavaGDocument<MSETGDocumentClient, TextEdit<GroupCursor.Cursor>> + (client, tpane, new JDocListener(client)); client.setDocument(gdoc); client.connect(); // set cursor after connecting because you need a valid ID Index: GDocumentClient.java =================================================================== RCS file: /cvsroot/groupscheme/groupscheme/src/grewpedit/src/xdocument/GDocumentClient.java,v retrieving revision 1.6 retrieving revision 1.7 diff -u -d -r1.6 -r1.7 --- GDocumentClient.java 30 Apr 2007 07:55:12 -0000 1.6 +++ GDocumentClient.java 7 May 2007 14:50:51 -0000 1.7 @@ -3,7 +3,7 @@ import event.*; public interface GDocumentClient<D extends GDocument, E> - extends MessageListener, ConnectionListener, EditBuffering{ + extends MessageListener, ConnectionListener, EditBuffering { public void connect() throws Exception; @@ -51,4 +51,5 @@ * @param e Document event information. **/ public void changedUpdate(E e); + } Index: JavaGDocument.java =================================================================== RCS file: /cvsroot/groupscheme/groupscheme/src/grewpedit/src/xdocument/JavaGDocument.java,v retrieving revision 1.9 retrieving revision 1.10 diff -u -d -r1.9 -r1.10 --- JavaGDocument.java 5 May 2007 07:11:21 -0000 1.9 +++ JavaGDocument.java 7 May 2007 14:50:51 -0000 1.10 @@ -21,13 +21,15 @@ private StyledDocument jdoc; private HighlightCursor<Integer, Color> gcursor; private boolean saved, forwarding; + private DocumentListener listener; - public JavaGDocument(C client, JTextPane tpane) { + public JavaGDocument(C client, JTextPane tpane, DocumentListener listener) { this.client = client; this.tpane = tpane; + this.listener = listener; this.gcursor = null; jdoc = tpane.getStyledDocument(); - jdoc.addDocumentListener((DocumentListener)client); + jdoc.addDocumentListener(listener); saved = true; client.setDocument(this); } @@ -45,7 +47,7 @@ public boolean isForwardingUpdates() { return forwarding; } public void connectionClosed() { - jdoc.removeDocumentListener((DocumentListener)client); + jdoc.removeDocumentListener(listener); tpane.setBackground(new Color(175, 175, 175)); // if (gcursor != null) // gcursor.clear(); @@ -58,10 +60,10 @@ public void insertUpdate(E e) throws Exception { synchronized(jdoc) { if (!SwingUtilities.isEventDispatchThread()) System.out.println("NOT IN THE EVENT QUEUE!!!"); - jdoc.removeDocumentListener((DocumentListener)client); + jdoc.removeDocumentListener(listener); jdoc.insertString(e.offset, e.text, null); cursorUpdate(e.details); - jdoc.addDocumentListener((DocumentListener)client); + jdoc.addDocumentListener(listener); } } @@ -69,10 +71,10 @@ public void removeUpdate(E e) throws Exception { synchronized(jdoc) { if (!SwingUtilities.isEventDispatchThread()) System.out.println("NOT IN THE EVENT QUEUE!!!"); - jdoc.removeDocumentListener((DocumentListener)client); + jdoc.removeDocumentListener(listener); jdoc.remove(e.offset, e.length); cursorUpdate(e.details); - jdoc.addDocumentListener((DocumentListener)client); + jdoc.addDocumentListener(listener); } } @@ -80,10 +82,10 @@ public void changedUpdate(E e) throws Exception { synchronized(jdoc) { if (!SwingUtilities.isEventDispatchThread()) System.out.println("NOT IN THE EVENT QUEUE!!!"); - jdoc.removeDocumentListener((DocumentListener)client); + jdoc.removeDocumentListener(listener); //jdoc.setCharacterAttributes(e.offset, e.length, null, false); cursorUpdate(e.details); - jdoc.addDocumentListener((DocumentListener)client); + jdoc.addDocumentListener(listener); } } |
|
From: Kenroy G. <kg...@us...> - 2007-05-07 14:50:58
|
Update of /cvsroot/groupscheme/groupscheme/src/grewpedit/src/xdocument/mset In directory sc8-pr-cvs2.sourceforge.net:/tmp/cvs-serv2984/xdocument/mset Modified Files: MSET.java MSETMessage.java Added Files: MSETGDocumentClient.java Removed Files: MSETDocClient.java Log Message: finished the basic plugin for jEdit without cursor awareness --- NEW FILE: MSETGDocumentClient.java --- /* CONCERNS: 0: remove gc listeners? 1: What if i am queing edits, should i be sending a state offer? Probably not but what if don't send while queuing and everyone is queuing? Won't the client wait for an offer forever? Shouldn't we start a thread that waits like 15 - 30 seconds and then asks the group again. What if someone accepts my state offer and I die while sending the state? Wont they wait for the state for ever? Shouldn't we start a thread that times out after like 15 - 30 seconds and then requests the state from the group again. 2: Shouldn't we just force them to rejoin by disconnecting them */ package xdocument.mset; import xdocument.*; import net.GroupServer; import net.GroupClient; import util.Util; import util.Queue; import event.*; import javax.swing.SwingUtilities; import javax.swing.event.DocumentEvent; import javax.swing.event.DocumentListener; import java.util.Collections; import java.util.Set; import java.util.LinkedHashSet; import java.util.Vector; /** * Designed to communicate with other clients to maintain a * shared {@link GDocument} state for a group of client's. **/ public class MSETGDocumentClient<D extends GDocument, E extends TextEdit> implements GDocumentClient<D, E> { private static final MessageKey EDIT_MK = new MessageKey("$EDIT$"); private static final MessageKey STATE_MK = new MessageKey("$STATE$"); private static final Object AWAITING_STATE = new Object(); private static final Object ACCEPTING_STATE = new Object(); private static final Object CERTIFIED_STATE = new Object(); GroupClient gc = null; MSET mset = null; D doc = null; private EditQueue<InboundEdit> inboundQ=new EditQueue<InboundEdit>(1000L); private EditQueue<OutboundEdit> outboundQ=new EditQueue<OutboundEdit>(1000L); // private Set<MSETMessage> editHistory = // Collections.synchronizedSet(new LinkedHashSet<MSETMessage>()); // private Set<MSETMessage> initEdits = // Collections.synchronizedSet(new LinkedHashSet<MSETMessage>()); private Vector<MSETMessage> editHistory = new Vector<MSETMessage>(); private Vector<MSETMessage> initEdits = new Vector<MSETMessage>(); private Object stateStatus = AWAITING_STATE; public MSETGDocumentClient(GroupClient gc) { this.gc = gc; gc.addMessageListener(GroupServer.JOINING_KEY, this); gc.addMessageListener(EDIT_MK, this); gc.addMessageListener(STATE_MK, this); gc.addConnectionListener(this); } public MSET getMSET() { return mset; } private void init() { mset = new MSET(gc.getID()); editHistory.clear(); inboundQ.clear(); outboundQ.clear(); } public void connectionClosed(ConnectionEvent ce) { doc.connectionClosed(); } /* Synchronized because initialization must complete before accepting messages. For this reason messageReceived is also synchronized b/c otherwise a client could receive state request offers before the client knows whether or not to accept. Also checking initialized b/c mset doc clients are only allowed to connect once! */ public synchronized void connect() throws Exception { gc.connect(); // you must wait for the state if you are NOT the first client if (gc.getInitInfo().groupSize == 0) stateStatus = CERTIFIED_STATE; // initializing mset here b/c gc's ID is not issued until after connecting init(); if (stateStatus == CERTIFIED_STATE) { Util.debugln(gc.getID()+" - CERTIFIED_STATE as FIRST CLIENT"); inboundQ.start(); outboundQ.start(); } } public void disconnect() { outboundQ.setDequeuing(false); gc.disconnect(); } /** * Returns true if client has a connection with the group's server and * either has received the current state of the document or is the only * person in the group. * * @return false if client does not have a connection with the group's * server or does not have the current state of the document. * Returns true otherwise. **/ public synchronized void messageReceived(MessageEvent e) { if (e.getKey().equals(EDIT_MK)) { // Collect remote edits until your state is certified if (stateStatus == CERTIFIED_STATE) { inboundQ.add(new InboundEdit((MSETMessage)e.getData())); } else if (initEdits.add((MSETMessage)e.getData())) { System.out.println("Saving initialization edit: "+e.getData()); } } else if (e.getKey().equals(GroupServer.JOINING_KEY)) { if (isConnected()) { // CERTIFIED_STATE concern 1 gc.send(e.getFrom(), STATE_MK, "OFFERING_MY_STATE"); Util.debugln(gc.getID()+" OFFERING STATE TO "+e.getFrom()); } } else if (e.getKey().equals(STATE_MK)) { Object msg = e.getData(); if (msg.equals("I_NEED_THE_STATE")) { if (isConnected()) { // CERTIFIED_STATE concern 1 gc.send(e.getFrom(), STATE_MK, "OFFERING_MY_STATE"); } } else if (stateStatus == AWAITING_STATE) { if (msg.equals("OFFERING_MY_STATE")) { Util.debugln(gc.getID()+" ACCEPTS STATE FROM "+e.getFrom()); gc.send(e.getFrom(), STATE_MK, "ACCEPTING_YOUR_STATE"); stateStatus = ACCEPTING_STATE; } } else if (stateStatus == ACCEPTING_STATE) { if (msg instanceof MSETMessage) { // THE STATE Util.debugln(gc.getID()+" RECEIVES STATE FROM "+e.getFrom()); try { remoteState((MSETMessage)msg); } catch (Exception ex) { Util.error("History Error! Requesting it again!", ex, null); stateStatus = AWAITING_STATE; init(); Util.debugln(gc.getID()+" REQUESTING STATE FROM OTHERS"); gc.sendOthers(STATE_MK, "I_NEED_THE_STATE"); return; } // start collecting edits normally stateStatus = CERTIFIED_STATE; Util.debugln(gc.getID()+" - CERTIFIED_STATE as LATE CLIENT"); inboundQ.start(); outboundQ.start(); } } else if (isConnected()) { // CERTIFIED_STATE concern 1 if (msg.equals("ACCEPTING_YOUR_STATE")) { MSETMessage[] hist = new MSETMessage[editHistory.size()]; MSETMessage state = new MSETMessage(editHistory.toArray(hist)); gc.send(e.getFrom(), STATE_MK, state); } } } else Util.debugln("Ignoring unknown MSETGDocumentClient message: "+e); } public void setDocument(D d) { this.doc = d; } public D getDocument() { return doc; } public int getAppliedEdits() { return editHistory.size(); } public int getIncomingEdits() { return inboundQ.size(); } public int getOutgoingEdits() { return outboundQ.size(); } public boolean isApplyingIncoming() { return inboundQ.isDequeuing(); } public boolean isSendingOutgoing() { return outboundQ.isDequeuing(); } public void setApplyingIncoming(boolean on) { inboundQ.setDequeuing(on); } public void setSendingOutgoing(boolean on) { outboundQ.setDequeuing(on); } public boolean isConnected() { return (gc.isConnected() && stateStatus==CERTIFIED_STATE && inboundQ.isAlive() && outboundQ.isAlive()); } /* * Because you are not allowed to mutate a Java Document until all listeners * have been notified, the best you can do is queue group cursor updates with * invokeLater. However, you must be careful because there is no guarantee the * that another listener will not queue a document modifying event before our * cursor update, rendering the offset in our listener notification invalid. * We can circumvent this problem by converting the offset to a MSET.CURSOR * during the listener's notification and later converting it back to an * offset when our java dequeues and invoke's our update. * * This approach comes with some undesireables. There will be a lag between * a user's the edit and cursor update because it is queued for later. Also, * converting back and forth from an offset to a cursor is very costly b/c * you have to traverse the entire tree during the calculation. */ private void javaQCursorUpdate(final GroupCursor.Cursor c) { if (c != null) { final MSET.SubNode.Cursor cursor = mset.getCursor(c.pos); Util.invokeLater(new Runnable() { public void run() { try { c.pos = mset.getOffset(cursor); doc.cursorUpdate(c); } catch (Exception ex) { Util.error("insert", ex, null); } } } ); } } public void insertUpdate(E e) { //public void insertUpdate(String str, int os, int len) { /*test*/Util.debugln("\n\nLOCAL INSERT"); MSET.InsertRef ref = mset.insert(e.offset, e.text); /*test*/Util.debugln(ref); if (ref != null) { // just verifying it was inserted /*test*/Util.debugln("VIEW_DOC.insertString(offset="+e.offset+", '"+e.text+"')"); GroupCursor.Cursor cur = doc.getMyCursor(e.offset+e.length); outboundQ.add(new OutboundEdit(new MSETMessage(e.text, cur, ref))); /*test*/Util.debugln("OutboundEdit Queued "+getOutgoingEdits()); javaQCursorUpdate(cur); } } /* If delete view is visible then we must disable editing b/c (as of now) there is no way to capture a user's delete of a visible-but-deleted character. We might be able to do something like this for delete view: -apply the delete to the mset -get the element associated with the delete -insert it back into the document but keep cursor before the insert */ public void removeUpdate(E e) { //public void removeUpdate(int os, int len) { /*test*/Util.debugln("\n\nLOCAL REMOVE"); MSET.DeleteRef[] refs = mset.delete(e.offset, e.length); /*test*/Util.debugln("DeleteRef"+Util.arrayToString(refs)); if (refs != null) { // verifying it was deleted if (!mset.isDeleteViewVisible()) { /*test*/Util.debugln("VIEW_DOC.remove(offset="+e.offset+", length="+e.length+")"); } GroupCursor.Cursor cur = doc.getMyCursor(e.offset); outboundQ.add(new OutboundEdit(new MSETMessage(refs, cur))); /*test*/Util.debugln("OutboundEdit Queued "+getOutgoingEdits()); javaQCursorUpdate(cur); } } public void changedUpdate(E e) { //public void changedUpdate(int os, int len) { // /*test*/Util.debugln("\n\nLOCAL CHANGE"); // GroupCursor.Cursor cur = doc.getMyCursor(e.offset, e.length); // MSET.StyleRef ref = null; // outboundQ.add(new OutboundEdit(new MSETMessage(cur, false, ref))); // /*test*/Util.debugln("OutboundEdit Queued "+getOutQueueSize()); // javaQCursorUpdate(doc.getMyCursor(e.offset, e.length)); } /** * Process remote insertion and apply it to the view. * * @param msg The information needed to apply the insertion. **/ public synchronized void remoteInsert(MSETMessage msg) throws Exception { /*test*/Util.debugln("\n\nREMOTE INSERT"); MSET.InsertRef ref = (MSET.InsertRef)msg.getEditRef(); mset.insert(ref, msg.getText()); int os = ref.toOffset(mset); //doc.insertUpdate(new TextEdit<AttributeSet>(os, msg.getText())); doc.insertUpdate(new TextEdit(os, msg.getText(), msg.getAttributeSet())); /*test*/Util.debugln("VIEW_DOC.insertString(offset="+os+ ", '"+msg.getText()+"')"); } /** * Process remote deletion and apply it to the view. * * @param msg The information needed to apply the deletion. **/ public synchronized void remoteRemove(MSETMessage msg) throws Exception { /*test*/Util.debugln("\n\nREMOTE DELETE"); MSET.DeleteRef[] initRefs = (MSET.DeleteRef[])msg.getEditRef(); /*test*/Util.debugln("DeleteRef[].length="+initRefs.length); MSET.LocalDeleteRef[] refs = mset.delete(initRefs); int offset, length; for (int i=0; i<refs.length; i++) { /*test*/Util.debugln("refs["+i+"]="+refs[i]); offset = refs[i].toStartOffset(mset); length = refs[i].getEndIndex() - refs[i].getStartIndex(); // Applying the DeleteRefs to the MSET here b/c every delete in // the MSET may alter the location in the Document refs[i].apply(mset); // this should just be delete; no remoteRemove needed //msg.getAttributeSet() //doc.removeUpdate(new TextEdit<AttributeSet>(offset, length)); // do the Document deletion doc.removeUpdate(new TextEdit(offset, length, msg.getAttributeSet())); // do the Document deletion /*test*/Util.debugln("VIEW_DOC.remove(offset="+offset+", length="+ length+")"); } } /** * Process remote update and apply it to the view. * * @param msg The information needed to apply the update. **/ public void remoteChanged(MSETMessage msg) throws Exception { /*test*/Util.debugln("\n\nREMOTE CHANGE"); // doc.changedUpdate(new TextEdit(offset, length, msg.getAttributeSet())); // do the Document deletion // /*test*/Util.debugln("VIEW_DOC.changed(offset="+offset+", length="+ // length+")"); } /** * Process remote state change and apply it to the view. * * @param msg The information needed to apply the state change. **/ public synchronized void remoteState(MSETMessage msg) throws Exception { /*test*/Util.debugln("\n\nAPPLYING STATE"); MSETMessage[] edits = (MSETMessage[])msg.getEditRef(); /*test*/Util.debug("In Setting State: edits = "+edits.length); /*test*/Util.debugln(", initEdits = "+initEdits.size()); // verify that the document is empty if (doc.getLength() > 0) { Util.warning("You may not join a group if your document is not\nempty."+ " Please clear your document and try connecting again.", null); disconnect(); return; } // try { doc.clear(); } // catch(Exception e) { // Util.error("Problem clearing the document's view.", e, null); // } // enqueue all the state-edits /*test*/Util.debugln("inQ b4 adding edits: "+inboundQ.size()); for (int i=0; i<edits.length; i++) { inboundQ.add(new InboundEdit(edits[i])); /*test*/Util.debugln("inEdit: "+edits[i]); } /*test*/Util.debugln("inQ after adding edits: "+inboundQ.size()); // enqueue the edits received while waiting on the state /*test*/Util.debugln("inQ b4 adding initEdits: "+inboundQ.size()); edits = initEdits.toArray(new MSETMessage[initEdits.size()]); for (int i=0; i<edits.length; i++) { inboundQ.add(new InboundEdit(edits[i])); /*test*/Util.debugln("inEdit: "+edits[i]); } /*test*/Util.debugln("inQ after adding initEdits: "+inboundQ.size()); initEdits.clear(); } /** * Represents a remote edit that has been placed on the inboundQ and will * dequeue onto the AWT Event Queue before being applied to the MSET and * reflecting in the corresponding JTextComponent. **/ class InboundEdit implements Runnable { MSETMessage edit; public InboundEdit(MSETMessage edit) { this.edit = edit; } public void run() { try { // if (edit.getType() == MSETMessage.STATE) // edit.apply(MSETGDocumentClient.this) // else Util.debugln("Inbound code "+edit.hashCode()); if (!editHistory.contains(edit)) { //if (editHistory.add(edit)) { editHistory.add(edit); edit.apply(MSETGDocumentClient.this); Util.debugln("history size = "+editHistory.size()+" - "+edit); } else Util.debugln("Ignoring duplicate remote edit: "+edit, true); } catch (Exception e) { Util.error("Failed to apply remote edit. You should exit and\n"+ "rejoin the group because you're missing parts of\n"+ "the group Document.\n"+edit, e, null); // disconnect(); // concern 2 } } public String toString() { return edit.toString(); } } /** * Represents a local edit that has already been succesfully applied to the * MSET before being placed on the outboundQ. When dequeued the edit is * added to the history and broadcasted to the other clients. **/ class OutboundEdit implements Runnable { MSETMessage edit; public OutboundEdit(MSETMessage edit) { this.edit = edit; } public void run() { gc.sendOthers(EDIT_MK, edit); Util.debugln("Outbound code "+edit.hashCode()); if (!editHistory.add(edit)) // add after local edit has been sent Util.debugln("WARNING!! Ignoring local duplicate edit: "+edit, true); else Util.debugln("new edit history size = "+editHistory.size()); } public String toString() { return edit.toString(); } } } Index: MSET.java =================================================================== RCS file: /cvsroot/groupscheme/groupscheme/src/grewpedit/src/xdocument/mset/MSET.java,v retrieving revision 1.3 retrieving revision 1.4 diff -u -d -r1.3 -r1.4 --- MSET.java 30 Mar 2007 01:39:32 -0000 1.3 +++ MSET.java 7 May 2007 14:50:52 -0000 1.4 @@ -259,7 +259,8 @@ * Therefore it must be replaced by references to each piece of the * Node to maintain the intention of original deletion. * 4) Overwrite delete's (the edit message argument) remote array of - * references with an array of updated references for {@link MSETDocClient} + * references with an array of updated references for + * {@link JavaMSETGDocClient} * to apply to both the GUI and this MSET. * </code></pre> **/ Index: MSETMessage.java =================================================================== RCS file: /cvsroot/groupscheme/groupscheme/src/grewpedit/src/xdocument/mset/MSETMessage.java,v retrieving revision 1.4 retrieving revision 1.5 diff -u -d -r1.4 -r1.5 --- MSETMessage.java 30 Mar 2007 01:39:32 -0000 1.4 +++ MSETMessage.java 7 May 2007 14:50:52 -0000 1.5 @@ -53,7 +53,7 @@ public void setType(int t) { type = t; } - public void apply(MSETDocClient client) throws Exception { + public void apply(MSETGDocumentClient client) throws Exception { switch (getType()) { case INSERT: client.remoteInsert(this); break; case REMOVE: client.remoteRemove(this); break; --- MSETDocClient.java DELETED --- |
|
From: Kenroy G. <kg...@us...> - 2007-05-07 00:05:25
|
Update of /cvsroot/groupscheme/groupscheme/src/grewpedit/src/plugins/jedit In directory sc8-pr-cvs2.sourceforge.net:/tmp/cvs-serv21384/src/plugins/jedit Added Files: GroupSession.props GroupSessionOptionPane.java JEditGroupEditor.java JEditGroupSession.java actions.xml build.xml dockables.xml Log Message: created a chat and members plugin for jedit and will extend it soon --- NEW FILE: GroupSession.props --- ########################### # GENERAL PLUGIN INFORMATION ########################### # jEdit only needs to load the plugin the first time the user accesses it # the presence of this property also tells jEdit the plugin is using the new API plugin.GroupSessionPlugin.activate=defer # These two properties are required for all plugins plugin.GroupSessionPlugin.name=GroupSession plugin.GroupSessionPlugin.author=Kenroy Granville # version number == jEdit version number plugin.GroupSessionPlugin.version=0.1 # The external jar files needed for our plugin plugin.GroupSessionPlugin.jars=GrewpEditV2.jar # only needed if your plugin bundles external files like libraries which MUST reside in the local filesystem. Contains a whitespace-separated list of file names. Without this property, the plugin manager will leave behind the external files when removing the plugin. #plugin.GroupSessionPlugin.files= # online help plugin.GroupSessionPlugin.docs=index.html # we only have one dependency, jEdit 4.2final, since we use the new plugin API plugin.GroupSessionPlugin.depend.0=jedit 04.02.99.00 ########################### # DOCKABLE WINDOW INFORMATION ########################### # dockable window name (the title) groupsession.title=Group Session ########################### # ACTION LABELS ########################### # action labels for actions supplied by dockables.xml groupsession.label=Group Session # action labels for actions supplied by actions.xml #groupsession.show-options.label=Show Options #groupsession.disconnect.label=Disconnect ########################### # APPLICATION MENU ITEMS ########################### # plugin menu plugin.GroupSessionPlugin.menu-item=groupsession # \ # - \ # groupsession.show-options \ # groupsession.disconnect ########################### # WINDOW TOOLBAR BUTTONS ########################### #groupsession.choose-file.icon=Open.png #groupsession.save-file.icon=Save.png #groupsession.send-file.icon=CopyToBuffer.png ########################### # OPTION PANE INFORMATION ########################### # plugin option pane plugin.GroupSessionPlugin.option-pane=groupsession # Option pane activation BeanShell snippet options.groupsession.code=new GroupSessionOptionPane(); # Option pane labels options.groupsession.label=Group Session options.groupsession.user.label=Username: options.groupsession.user=kgg options.groupsession.group.label=Groupname: options.groupsession.group=mygroup options.groupsession.host.label=Default Host: options.groupsession.host=localhost options.groupsession.port.label=Default Port: options.groupsession.port=14000 # Setting not defined but supplied for completeness options.groupsession.filepath= --- NEW FILE: GroupSessionOptionPane.java --- import java.io.File; import java.io.IOException; import java.awt.Font; import java.awt.BorderLayout; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import javax.swing.JButton; import javax.swing.JCheckBox; import javax.swing.JPanel; import javax.swing.JTextField; import javax.swing.JFileChooser; import org.gjt.sp.jedit.jEdit; import org.gjt.sp.jedit.GUIUtilities; import org.gjt.sp.jedit.AbstractOptionPane; import org.gjt.sp.jedit.gui.FontSelector; public class GroupSessionOptionPane extends AbstractOptionPane implements ActionListener { private JTextField userTF, groupTF, hostTF, portTF; public GroupSessionOptionPane() { super(GroupSessionPlugin.NAME); } public void _init() { userTF = new JTextField(10); groupTF = new JTextField(10); hostTF = new JTextField(10); portTF = new JTextField(10); String[] props = new String[] { "user", "group", "host", "port" }; JTextField[] tfs = new JTextField[] { userTF, groupTF, hostTF, portTF }; for (int i=0; i<props.length; i++) { tfs[i].setText(jEdit.getProperty(GroupSessionPlugin.OPTION_PREFIX + props[i])); addComponent(jEdit.getProperty(GroupSessionPlugin.OPTION_PREFIX + props[i]+".label"), tfs[i]); } } public void _save() { /* jEdit.setProperty(GroupSessionPlugin.OPTION_PREFIX + "filepath", pathName.getText()); Font _font = font.getFont(); jEdit.setProperty(GroupSessionPlugin.OPTION_PREFIX + "font", _font.getFamily()); jEdit.setProperty(GroupSessionPlugin.OPTION_PREFIX + "fontsize", String.valueOf(_font.getSize())); jEdit.setProperty(GroupSessionPlugin.OPTION_PREFIX + "fontstyle", String.valueOf(_font.getStyle())); jEdit.setProperty(GroupSessionPlugin.OPTION_PREFIX + "show-filepath", String.valueOf(showPath.isSelected())); */ } // end AbstractOptionPane implementation // begin ActionListener implementation public void actionPerformed(ActionEvent evt) { System.out.println("Test - "+hostTF.getText()+" evt "+evt); } } --- NEW FILE: JEditGroupEditor.java --- import plugins.*; import xdocument.GroupCursor; import xdocument.*; import xdocument.mset.*; import widget.*; import net.*; import event.*; import util.*; import javax.swing.*; import javax.swing.text.*; import javax.swing.event.DocumentEvent; import java.awt.Color; import java.io.File; public class JEditGroupEditor implements GroupEditor { GroupList members; ChatPanel chat; JFileChooser fc = new JFileChooser(); JComponent editor; String host, localhost; int port; GroupClient gc = null; GroupServer gs = null; MSETDocClient<JavaGDocument, DocumentEvent> client; JavaGDocument<MSETDocClient, TextEdit<GroupCursor.Cursor>> gdoc; HighlightCursor<Integer, Color> gcursor = null; String[] miscActs = new String[] { "Refresh Cursors", "Save Chat", "Save NodeView", "Save SubNodeView" }; public JEditGroupEditor(JComponent editor, String host, int port) { this.editor = editor; this.host = host; this.port = port; this.localhost = net.NetUtil.getMyLocalIP().getHostAddress(); } public Object clearState() { // String state = editor.getText(); // editor.setText(""); return null;//state; } public void setState(Object o) { //editor.setText(o.toString()); } public JComponent getEditor() { return editor; } public JComponent getChatPane() { return chat; } public JComponent getMembersPane() { return members.getPane(); } public GDocumentClient getClient() { return client; } public String getLocalHost() { return localhost; } public String getDefaultHost() { return host; } public int getDefaultPort() { return port; } public boolean isConnected() { return client.isConnected(); } public void connect(String user, String group, //String pw, String host, int port, boolean isServer) throws Exception { if (!NetUtil.isLegalName(user)) throw new IllegalStateException("Illegal username '"+user+ "'! Please try something different."); if (!NetUtil.isLegalName(group)) throw new IllegalStateException("Illegal groupname '"+group+ "'! Please try something different."); if (isServer) { gs = new GroupServer(port, ""); gs.start(); } else if (NetUtil.isRendezvousMember(user, group, host, port, "")) throw new IllegalStateException("Username '"+user+"' is taken! "+ "Please try something different."); gc = new GroupClient(user, group, host, port, "", ""); client = null;//new MSETDocClient<JavaGDocument, DocumentEvent>(gc); gdoc = null;/*new JavaGDocument<MSETDocClient, TextEdit<GroupCursor.Cursor>> (client,editor);*/ gc.connect();//client.connect(); Color cid = Util.randomColor(); // gcursor = new HighlightCursor<Integer, Color> // (new Integer(gc.getID()), cid, 5, editor); // gdoc.setCursor(gcursor); // gcursor.enableCaretListener(gc); chat = new ChatPanel(gc, new MessageKey("ct"+gc.getGroup()), cid); members = new GroupList(gc, new MessageKey("gl"+gc.getGroup()), cid); members.setAsColorPane(null, "Change"); members.addListener(chat); // members.addListener(gcursor); } public void disconnect() { if (gc != null) gc.disconnect(); if (gs != null) gs.stop(); } public void addConnectionListener(ConnectionListener cl) { gc.addConnectionListener(cl); } public boolean removeConnectionListener(ConnectionListener cl) { return gc.removeConnectionListener(cl); } public Object[] getActions() { return miscActs; } public void applyAction(Object act) { if (act.equals("Refresh Cursors") && gcursor != null) { ;//gcursor.refreshCursors(); } else if (act.equals("Save Chat") && chat != null) FileIO.saveAs(fc, fc.getSelectedFile(), chat.getRoomArea()); else if (act.equals("Save NodeView") && client != null) { File f = FileIO.saveAs(fc, fc.getSelectedFile(), chat); if (f != null) ;//Graphviz.save(Graphviz.TREE_VIEW, f, client.getMSET()); } else if (act.equals("Save SubNodeView") && client != null) { File f = FileIO.saveAs(fc, fc.getSelectedFile(), chat); if (f != null) ;//Graphviz.save(Graphviz.SUBNODE_VIEW, f, client.getMSET()); } } public static void main(String[] args) { JFrame f = new JFrame("test"); JTextPane tp = new JTextPane(); f.getContentPane().add(tp); f.setSize(350, 350); f.setVisible(true); JFrame f2 = new JFrame("JEdit / GrewpEdit"); GroupSession con = new GroupSession(new JEditGroupEditor(tp, "localhost", 14000)); f2.add(con); f2.pack(); f2.setVisible(true); } } --- NEW FILE: JEditGroupSession.java --- // from GrewpEdit: import plugins.GroupSession; // from Java: import java.awt.*; import java.awt.event.*; import java.io.*; import java.util.Vector; // from Swing: import javax.swing.*; import javax.swing.event.*; // from jEdit: import org.gjt.sp.jedit.*; import org.gjt.sp.jedit.gui.*; import org.gjt.sp.jedit.io.*; import org.gjt.sp.jedit.msg.PropertiesChanged; import org.gjt.sp.jedit.msg.ViewUpdate; import org.gjt.sp.util.Log; public class JEditGroupSession extends GroupSession implements EBComponent, /*GroupSessionActions,*/ DefaultFocusComponent { private View view; private Buffer buff; private boolean floating; // // Constructor // public JEditGroupSession(JEditGroupEditor ge, View view, String position) { super(ge); this.view = view; this.buff = view.getBuffer(); this.floating = position.equals(DockableWindowManager.FLOATING); // if(floating) // this.setPreferredSize(new Dimension(500, 650)); addKeyListener(new KeyHandler()); setTitle(""+GroupSessionPlugin.sessions.size()+" - "+buff.getPath().toString()); } public Buffer getBuffer() { return buff; } public void focusOnDefaultComponent() { ;//textArea.requestFocus(); } // // Attribute methods // // NONE FOR NOW // // EBComponent implementation // public void handleMessage(EBMessage message) { if (message instanceof PropertiesChanged) { propertiesChanged(); } } private void propertiesChanged() { System.err.println("properties changed"); } // These JComponent methods provide the appropriate points // to subscribe and unsubscribe this object to the EditBus public void addNotify() { System.err.println("addNotified"); super.addNotify(); EditBus.addToBus(this); } public void removeNotify() { System.err.println("removeNotified"); super.removeNotify(); EditBus.removeFromBus(this); } // // GroupSessionActions implementation // //NONE FOR NOW // // helper methods // // NONE FOR NOW // // Listener objects // // <Esc> closes a floating window private class KeyHandler extends KeyAdapter { public void keyPressed(KeyEvent evt) { if(JEditGroupSession.this.floating && evt.getKeyCode() == KeyEvent.VK_ESCAPE) { evt.consume(); DockableWindowManager wm = JEditGroupSession.this.view.getDockableWindowManager(); wm.removeDockableWindow(GroupSessionPlugin.NAME); } } } } --- NEW FILE: actions.xml --- <!DOCTYPE ACTIONS SYSTEM "actions.dtd"> <ACTIONS> <!-- <ACTION NAME="groupsession.show-options"> --> <!-- <CODE> --> <!-- wm.addDockableWindow(GroupSessionPlugin.NAME); --> <!-- System.out.println("SHOW-OPTIONS"); --> <!-- <\!-- wm.getDockableWindow(GroupSessionPlugin.NAME).chooseFile(); -\-> --> <!-- </CODE> --> <!-- </ACTION> --> <!-- <ACTION NAME="groupsession.disconnect"> --> <!-- <CODE> --> <!-- <\!-- wm.getDockable(GroupSessionPlugin.NAME); -\-> --> <!-- <\!-- wm.addDockableWindow(GroupSessionPlugin.NAME); -\-> --> <!-- System.out.println("DISCONNECT"); --> <!-- </CODE> --> <!-- </ACTION> --> </ACTIONS> --- NEW FILE: build.xml --- <?xml version="1.0"?> <project name="GroupSession" default="dist" basedir="."> <property file="build.properties"/> <!-- property name="jedit.install.dir" value="../.."/ --> <property name="jedit.install.dir" value="/usr/share/jedit/"/> <property name="grewpedit.class.path" value="../../../class/"/> <property name="jar.name" value="GroupSession.jar"/> <property name="install.dir" value=".."/> <path id="project.class.path"> <pathelement location="${jedit.install.dir}/jedit.jar"/> <pathelement location="${grewpedit.class.path}"/> <pathelement location="."/> </path> <target name="init"> <delete file="docbook-wrapper.xsl" /> <echo file="docbook-wrapper.xsl" message="<xsl:stylesheet"/> <echo file="docbook-wrapper.xsl" append="true" message=" xmlns:xsl='http://www.w3.org/1999/XSL/Transform'"/> <echo file="docbook-wrapper.xsl" append="true" message=" xsl:version='1.0'>"/> <echo file="docbook-wrapper.xsl" append="true" message="<xsl:import href='${docbook.xsl}/html/chunk.xsl'/>"/> <echo file="docbook-wrapper.xsl" append="true" message="</xsl:stylesheet>"/> </target> <target name="compile"> <javac srcdir="." deprecation="on" includeJavaRuntime="yes" > <classpath refid="project.class.path"/> </javac> </target> <target name="dist" depends="compile"> <mkdir dir="${install.dir}"/> <jar jarfile="${install.dir}/${jar.name}"> <fileset dir="."> <include name="**/*.class"/> <include name="**/*.props"/> <include name="**/*.html"/> <include name="**/*.gif"/> <include name="actions.xml"/> <include name="dockables.xml"/> </fileset> </jar> </target> <!-- Generate docs with xsltproc tool from www.xmlsoft.org --> <target name="docs-xsltproc" depends="init"> <exec executable="xsltproc"> <arg value="--catalogs"/> <arg value="users-guide.xsl"/> <arg value="users-guide.xml"/> </exec> </target> </project> --- NEW FILE: dockables.xml --- <?xml version="1.0"?> <!DOCTYPE DOCKABLES SYSTEM "dockables.dtd"> <DOCKABLES> <DOCKABLE NAME="groupsession"> GroupSessionPlugin.getGroupSession(view, position); </DOCKABLE> </DOCKABLES> |
|
From: Kenroy G. <kg...@us...> - 2007-05-07 00:05:24
|
Update of /cvsroot/groupscheme/groupscheme/src/grewpedit/src/plugins/jes In directory sc8-pr-cvs2.sourceforge.net:/tmp/cvs-serv21384/src/plugins/jes Modified Files: JESGroupEditor.java Log Message: created a chat and members plugin for jedit and will extend it soon Index: JESGroupEditor.java =================================================================== RCS file: /cvsroot/groupscheme/groupscheme/src/grewpedit/src/plugins/jes/JESGroupEditor.java,v retrieving revision 1.3 retrieving revision 1.4 diff -u -d -r1.3 -r1.4 --- JESGroupEditor.java 5 May 2007 07:11:20 -0000 1.3 +++ JESGroupEditor.java 7 May 2007 00:05:23 -0000 1.4 @@ -40,8 +40,17 @@ this.localhost = net.NetUtil.getMyLocalIP().getHostAddress(); } + public Object clearState() { + String state = editor.getText(); + editor.setText(""); + return state; + } - public JTextPane getEditor() { return editor; } + public void setState(Object o) { + editor.setText(o.toString()); + } + + public JComponent getEditor() { return editor; } public JComponent getChatPane() { return chat; } |
|
From: Kenroy G. <kg...@us...> - 2007-05-07 00:05:23
|
Update of /cvsroot/groupscheme/groupscheme/src/grewpedit/src/plugins In directory sc8-pr-cvs2.sourceforge.net:/tmp/cvs-serv21384/src/plugins Modified Files: GroupEditor.java GroupSession.java Log Message: created a chat and members plugin for jedit and will extend it soon Index: GroupEditor.java =================================================================== RCS file: /cvsroot/groupscheme/groupscheme/src/grewpedit/src/plugins/GroupEditor.java,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -r1.2 -r1.3 --- GroupEditor.java 30 Apr 2007 07:55:11 -0000 1.2 +++ GroupEditor.java 7 May 2007 00:05:23 -0000 1.3 @@ -5,7 +5,10 @@ public interface GroupEditor { - public JTextPane getEditor(); + public Object clearState(); + public void setState(Object o); + + public JComponent getEditor(); public JComponent getChatPane(); public JComponent getMembersPane(); Index: GroupSession.java =================================================================== RCS file: /cvsroot/groupscheme/groupscheme/src/grewpedit/src/plugins/GroupSession.java,v retrieving revision 1.4 retrieving revision 1.5 diff -u -d -r1.4 -r1.5 --- GroupSession.java 5 May 2007 07:11:20 -0000 1.4 +++ GroupSession.java 7 May 2007 00:05:23 -0000 1.5 @@ -89,6 +89,10 @@ } + public void setTitle(String title) { + titleLab.setText(title); + } + public JPanel getMainPanel() { if (init) { @@ -318,7 +322,7 @@ public void connect() { String host = ""; int port = 0; - + Object state = null; if (defaultServRB.isSelected()) { host = ge.getDefaultHost(); port = ge.getDefaultPort(); @@ -333,14 +337,17 @@ } try { - // reset java document - Document doc = ge.getEditor().getDocument(); - doc.remove(0, doc.getLength()); + // clear and save the state + state = ge.clearState(); + //Document doc = ge.getEditor().getDocument(); + //doc.remove(0, doc.getLength()); ge.connect(userTF.getText(), groupTF.getText(), host, port, localServRB.isSelected()); ge.getEditor().setBackground(Color.white); editCount = new EditAwareness(); editCount.start(); + if (localServRB.isSelected()) + ge.setState(state); // reset the state after connecting } catch (IllegalStateException isx) { util.Util.warning(isx.getMessage(), this); @@ -372,7 +379,7 @@ memberCB.doClick(); // show the new setConnected(true); - editorB.doClick(); + //editorB.doClick(); } |
|
From: Kenroy G. <kg...@us...> - 2007-05-07 00:03:17
|
Update of /cvsroot/groupscheme/groupscheme/src/grewpedit/src/plugins/jedit In directory sc8-pr-cvs2.sourceforge.net:/tmp/cvs-serv20604/jedit Log Message: Directory /cvsroot/groupscheme/groupscheme/src/grewpedit/src/plugins/jedit added to the repository |
|
From: Kenroy G. <kg...@us...> - 2007-05-05 07:11:22
|
Update of /cvsroot/groupscheme/groupscheme/src/grewpedit/src/xdocument In directory sc8-pr-cvs2.sourceforge.net:/tmp/cvs-serv28675/src/xdocument Modified Files: JavaGDocument.java Log Message: some updates for JES plugin Index: JavaGDocument.java =================================================================== RCS file: /cvsroot/groupscheme/groupscheme/src/grewpedit/src/xdocument/JavaGDocument.java,v retrieving revision 1.8 retrieving revision 1.9 diff -u -d -r1.8 -r1.9 --- JavaGDocument.java 2 May 2007 07:07:57 -0000 1.8 +++ JavaGDocument.java 5 May 2007 07:11:21 -0000 1.9 @@ -46,7 +46,7 @@ public void connectionClosed() { jdoc.removeDocumentListener((DocumentListener)client); - tpane.setBackground(Color.gray); + tpane.setBackground(new Color(175, 175, 175)); // if (gcursor != null) // gcursor.clear(); // Util.warning("Lost Group Connection! ", tpane); |
|
From: Kenroy G. <kg...@us...> - 2007-05-05 07:11:22
|
Update of /cvsroot/groupscheme/groupscheme/src/grewpedit/src/plugins/jes In directory sc8-pr-cvs2.sourceforge.net:/tmp/cvs-serv28675/src/plugins/jes Modified Files: JESGroupEditor.java Added Files: JESUI.py.3.0.5 jes.bat Removed Files: JESUI.py Log Message: some updates for JES plugin --- NEW FILE: JESUI.py.3.0.5 --- #JES- Jython Environment for Students #Copyright (C) 2002 Jason Ergle, Claire Bailey, David Raines, Joshua Sklare #See JESCopyright.txt for full licensing information # 5/16/03: Added coloring to the load button to indicate concurrency with the # editor document -AdamW import JESHomeworkTurninThread import JESCommandWindow import JESConstants import JESDebugWindow import JESEditor import JESProgram import JESHomeworkSubmission import JESDBVariableWatcher import Html_Browser import JESGutter from JESBugReporter import JESBugReporter import media [...1952 lines suppressed...] swing.JOptionPane.showMessageDialog(self, "There are no movies to examine.", "No movies", swing.JOptionPane.ERROR_MESSAGE) ## little utility bits added for making skin changing easier. # this tells us about all the available Swing look 'n' feels def listskins(): return [ str(skin.getName()) for skin in UIManager.getInstalledLookAndFeels()] def currentskin(): return str(UIManager.getLookAndFeel().getName()) class skinActionListener(awt.event.ActionListener): def __init__(self, ui): self.ui = ui def actionPerformed(self, e): self.ui.changeSkin(e) --- NEW FILE: jes.bat --- set java="win-jre\bin\java.exe" set classpath=".\jars\jython.jar;.\jars\jmf.jar;.\jars\jl1.0.jar;.\jars\junit.jar;.\jars\GrewpEditV2.jar;.\Sources" %java% -Dpython.home="jython-2.1" -Xmx512m -classpath %classpath% JESstartup Index: JESGroupEditor.java =================================================================== RCS file: /cvsroot/groupscheme/groupscheme/src/grewpedit/src/plugins/jes/JESGroupEditor.java,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -r1.2 -r1.3 --- JESGroupEditor.java 30 Apr 2007 07:55:12 -0000 1.2 +++ JESGroupEditor.java 5 May 2007 07:11:20 -0000 1.3 @@ -61,10 +61,23 @@ public void connect(String user, String group, //String pw, String host, int port, boolean isServer) throws Exception { + + if (!NetUtil.isLegalName(user)) + throw new IllegalStateException("Illegal username '"+user+ + "'! Please try something different."); + + if (!NetUtil.isLegalName(group)) + throw new IllegalStateException("Illegal groupname '"+group+ + "'! Please try something different."); + if (isServer) { gs = new GroupServer(port, ""); gs.start(); } + else if (NetUtil.isRendezvousMember(user, group, host, port, "")) + throw new IllegalStateException("Username '"+user+"' is taken! "+ + "Please try something different."); + gc = new GroupClient(user, group, host, port, "", ""); client = new MSETDocClient<JavaGDocument, DocumentEvent>(gc); --- JESUI.py DELETED --- |
|
From: Kenroy G. <kg...@us...> - 2007-05-05 07:11:21
|
Update of /cvsroot/groupscheme/groupscheme/src/grewpedit/src/net In directory sc8-pr-cvs2.sourceforge.net:/tmp/cvs-serv28675/src/net Modified Files: NetUtil.java Log Message: some updates for JES plugin Index: NetUtil.java =================================================================== RCS file: /cvsroot/groupscheme/groupscheme/src/grewpedit/src/net/NetUtil.java,v retrieving revision 1.4 retrieving revision 1.5 diff -u -d -r1.4 -r1.5 --- NetUtil.java 12 Oct 2006 09:46:38 -0000 1.4 +++ NetUtil.java 5 May 2007 07:11:20 -0000 1.5 @@ -312,6 +312,20 @@ GroupServer.IS_GROUP_HOSTED, group); } + public static Boolean isRendezvous(String user, String group, + String host, int port, String serverPW) { + return (Boolean) NetUtil.immediateRequest + (host, port, serverPW, GroupServer.IS_GROUP_HOSTED, group); + } + + + public static Boolean isRendezvousMember(String user, String group, + String host, int port, String sPW) { + return (Boolean) NetUtil.immediateRequest + (host, port, sPW, GroupServer.IS_CLIENT_NAME_USED, + new String[] {group, user}); + } + /** * Returns whether or not mem is a member of info's group, * assuming the group exists. @@ -321,7 +335,7 @@ (info.getHost(), info.getPort(), info.getServerPassword(), GroupServer.IS_CLIENT_NAME_USED, new String[] {info.getGroupname(), mem}); - } + } /** * Returns whether or not the info's user is a member of the info's group, * assuming the group exists. @@ -369,4 +383,4 @@ System.out.print("\n\n>>"); } } -} \ No newline at end of file +} |
|
From: Kenroy G. <kg...@us...> - 2007-05-05 07:11:21
|
Update of /cvsroot/groupscheme/groupscheme/src/grewpedit/src/plugins In directory sc8-pr-cvs2.sourceforge.net:/tmp/cvs-serv28675/src/plugins Modified Files: GroupSession.java Log Message: some updates for JES plugin Index: GroupSession.java =================================================================== RCS file: /cvsroot/groupscheme/groupscheme/src/grewpedit/src/plugins/GroupSession.java,v retrieving revision 1.3 retrieving revision 1.4 diff -u -d -r1.3 -r1.4 --- GroupSession.java 2 May 2007 07:07:56 -0000 1.3 +++ GroupSession.java 5 May 2007 07:11:20 -0000 1.4 @@ -338,13 +338,17 @@ doc.remove(0, doc.getLength()); ge.connect(userTF.getText(), groupTF.getText(), host, port, localServRB.isSelected()); + ge.getEditor().setBackground(Color.white); editCount = new EditAwareness(); editCount.start(); } + catch (IllegalStateException isx) { + util.Util.warning(isx.getMessage(), this); + return; + } catch (Exception ex) { System.err.println("Failed to initialize GroupConnection!"); - util.Util.error("Failed to initialize GroupConnection!", ex, - ge.getEditor()); + util.Util.error("Failed to initialize GroupConnection!", ex, this); return; } @@ -380,7 +384,7 @@ public void connectionClosed(ConnectionEvent ce) { disconnect(); - ge.getEditor().setBackground(Color.gray); + ge.getEditor().setBackground(new Color(175, 175, 175)); } |
|
From: Kenroy G. <kg...@us...> - 2007-05-02 07:08:00
|
Update of /cvsroot/groupscheme/groupscheme/src/grewpedit/src/plugins/jes In directory sc8-pr-cvs2.sourceforge.net:/tmp/cvs-serv9212/plugins/jes Modified Files: JESUI.py Added Files: JESUI.py.3.0.4 Log Message: updates jes plugin for JES 3.0.5 beta version --- NEW FILE: JESUI.py.3.0.4 --- #JES- Jython Environment for Students #Copyright (C) 2002 Jason Ergle, Claire Bailey, David Raines, Joshua Sklare #See JESCopyright.txt for full licensing information # 5/16/03: Added coloring to the load button to indicate concurrency with the # editor document -AdamW import JESHomeworkTurninThread import JESCommandWindow import JESConstants import JESDebugWindow import JESEditor import JESProgram import JESHomeworkSubmission import JESDBVariableWatcher import Html_Browser import JESGutter from JESBugReporter import JESBugReporter import media [...1951 lines suppressed...] swing.JOptionPane.showMessageDialog(self, "There are no movies to examine.", "No movies", swing.JOptionPane.ERROR_MESSAGE) ## little utility bits added for making skin changing easier. # this tells us about all the available Swing look 'n' feels def listskins(): return [ str(skin.getName()) for skin in UIManager.getInstalledLookAndFeels()] def currentskin(): return str(UIManager.getLookAndFeel().getName()) class skinActionListener(awt.event.ActionListener): def __init__(self, ui): self.ui = ui def actionPerformed(self, e): self.ui.changeSkin(e) Index: JESUI.py =================================================================== RCS file: /cvsroot/groupscheme/groupscheme/src/grewpedit/src/plugins/jes/JESUI.py,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 --- JESUI.py 27 Apr 2007 08:34:32 -0000 1.1 +++ JESUI.py 2 May 2007 07:07:56 -0000 1.2 @@ -171,14 +171,16 @@ JES_API_SECTIONS = [ \ ('Colors', ['distance', 'makeColor', 'makeDarker', 'makeLighter', 'pickAColor']), -('Files', ['pickAFile', 'pickAFolder', 'setMediaPath', 'setMediaFolder']), +('Files', ['pickAFile', 'pickAFolder', 'setMediaPath', 'setMediaFolder', + 'getMediaPath', 'getMediaFolder', 'getShortPath']), ('Input/Output', ['requestNumber', 'requestInteger', 'requestIntegerInRange', 'requestString', \ - 'showWarning', 'showInformation', 'showError']), + 'showWarning', 'showInformation', 'showError', 'printNow']), ('Turtles', ['turn', 'turnLeft', 'turnRight', 'forward', 'backward', 'moveTo', 'turnToFace', \ 'makeTurtle', 'penUp', 'penDown', 'makeWorld', - 'getTurtleList', 'drop']), + 'getTurtleList', 'drop', 'getXPos', 'getYPos']), ('Movies', ['playMovie', 'makeMovie', 'makeMovieFromInitialFile', \ - 'writeFramesToDirectory', 'addFrameToMovie']), + 'writeFramesToDirectory', 'addFrameToMovie', + 'openFrameSequencerTool']), ('Pixels', ['getColor', 'setColor', 'getRed', 'getGreen', 'getBlue', \ 'setRed', 'setGreen', 'setBlue', 'getX', 'getY']), ('Pictures', ['addLine', 'addRect', 'addRectFilled', 'addText', 'getHeight', 'getWidth', \ @@ -188,9 +190,8 @@ ('Sound', ['blockingPlay', 'getLength', 'getSample', 'getSampleObjectAt', 'getSamples', 'getSampleValueAt', \ 'getSamplingRate', 'getSound', 'makeSound', 'playNote', 'play', 'playAtRate', 'playAtRateDur', \ 'playInRange', 'blockingPlayInRange', 'playAtRateInRange', 'blockingPlayAtRateInRange', \ - 'setSample', 'setSampleValueAt', 'writeSoundTo', 'openSoundTool', 'makeEmptySound'])] - - + 'setSample', 'setSampleValueAt', 'writeSoundTo', + 'openSoundTool', 'makeEmptySound'])] if System.getProperty('os.name').find('Mac') <> -1: # if we are on a Mac CONTROL_KEY = Event.META_MASK @@ -270,7 +271,8 @@ MAX_COMMAND_WINDOW_SIZE = 250 VISUAL_CONTROL_MARGIN_SIZE = 5 SPLITTER_SIZE = 10 -HSPLITTER_LOCATION = 400 +WATCHER_HSPLITTER_LOCATION = 400 +HELP_HSPLITTER_LOCATION = 600 VSPLITTER_LOCATION = 320 BUTTON_PANE_HEIGHT = 15 STATUS_BAR_HEIGHT = 30 @@ -287,7 +289,6 @@ FocusOwner = None - def getMethodList(klass): ret = [] for (name, val) in klass.__dict__.items(): @@ -403,7 +404,7 @@ self.htmlBrowser = Html_Browser.Html_Browser(JESConstants.HELP_START_PAGE) self.htmlBrowser.setMinimumSize(minSize) helpDivider.setDividerSize(SPLITTER_SIZE) - helpDivider.setDividerLocation(HSPLITTER_LOCATION) + helpDivider.setDividerLocation(HELP_HSPLITTER_LOCATION) helpDivider.setResizeWeight(1.0) helpDivider.setLeftComponent(splitterPane) helpDivider.setRightComponent(self.htmlBrowser) @@ -415,7 +416,7 @@ # see jesprogram.py, this is initialized later # watcherDivider.rightComponent = self.program.interpreter.debugger.watcher watcherDivider.setDividerSize(SPLITTER_SIZE) - watcherDivider.setDividerLocation(HSPLITTER_LOCATION) + watcherDivider.setDividerLocation(WATCHER_HSPLITTER_LOCATION) watcherDivider.setResizeWeight(1.0) watcherDivider.setLeftComponent(splitterPane) @@ -906,6 +907,8 @@ self.contentPane.add(self.statusbar) self.splitterPane.resetToPreferredSizes() self.helpDivider.resetToPreferredSizes() + self.helpDivider.setDividerLocation(HELP_HSPLITTER_LOCATION) + # do not call this one explicitly!! elif setting == COMMAND_WINDOW_3DEBUG: self.watcherDivider.setLeftComponent(self.splitterPane) @@ -914,9 +917,7 @@ self.contentPane.add(self.statusbar) self.splitterPane.resetToPreferredSizes() self.watcherDivider.resetToPreferredSizes() - self.watcherDivider.setDividerLocation(HSPLITTER_LOCATION) - - + self.watcherDivider.setDividerLocation(WATCHER_HSPLITTER_LOCATION) else: #setting == COMMAND_WINDOW_2: self.disableDebugger() |
|
From: Kenroy G. <kg...@us...> - 2007-05-02 07:07:59
|
Update of /cvsroot/groupscheme/groupscheme/src/grewpedit/src/xdocument In directory sc8-pr-cvs2.sourceforge.net:/tmp/cvs-serv9212/xdocument Modified Files: JavaGDocument.java Log Message: updates jes plugin for JES 3.0.5 beta version Index: JavaGDocument.java =================================================================== RCS file: /cvsroot/groupscheme/groupscheme/src/grewpedit/src/xdocument/JavaGDocument.java,v retrieving revision 1.7 retrieving revision 1.8 diff -u -d -r1.7 -r1.8 --- JavaGDocument.java 30 Apr 2007 07:55:12 -0000 1.7 +++ JavaGDocument.java 2 May 2007 07:07:57 -0000 1.8 @@ -46,9 +46,10 @@ public void connectionClosed() { jdoc.removeDocumentListener((DocumentListener)client); - if (gcursor != null) - gcursor.clear(); - Util.warning("Lost Group Connection! ", tpane); + tpane.setBackground(Color.gray); +// if (gcursor != null) +// gcursor.clear(); +// Util.warning("Lost Group Connection! ", tpane); } public int getLength() { return jdoc.getLength(); } |
|
From: Kenroy G. <kg...@us...> - 2007-05-02 07:07:59
|
Update of /cvsroot/groupscheme/groupscheme/src/grewpedit/src/plugins In directory sc8-pr-cvs2.sourceforge.net:/tmp/cvs-serv9212/plugins Modified Files: GroupSession.java Log Message: updates jes plugin for JES 3.0.5 beta version Index: GroupSession.java =================================================================== RCS file: /cvsroot/groupscheme/groupscheme/src/grewpedit/src/plugins/GroupSession.java,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -r1.2 -r1.3 --- GroupSession.java 30 Apr 2007 07:55:11 -0000 1.2 +++ GroupSession.java 2 May 2007 07:07:56 -0000 1.3 @@ -378,7 +378,10 @@ } - public void connectionClosed(ConnectionEvent ce) { disconnect(); } + public void connectionClosed(ConnectionEvent ce) { + disconnect(); + ge.getEditor().setBackground(Color.gray); + } class EditAwareness extends Thread { |
|
From: Kenroy G. <kg...@us...> - 2007-05-02 07:07:58
|
Update of /cvsroot/groupscheme/groupscheme/src/grewpedit/src In directory sc8-pr-cvs2.sourceforge.net:/tmp/cvs-serv9212 Removed Files: syntax.jar Log Message: updates jes plugin for JES 3.0.5 beta version --- syntax.jar DELETED --- |
|
From: Kenroy G. <kg...@us...> - 2007-05-02 07:07:28
|
Update of /cvsroot/groupscheme/groupscheme/src/grewpedit/src/app In directory sc8-pr-cvs2.sourceforge.net:/tmp/cvs-serv9191 Modified Files: GrewpEdit.java GrewpEditGUI.java Log Message: updates jes plugin for JES 3.0.5 beta version Index: GrewpEdit.java =================================================================== RCS file: /cvsroot/groupscheme/groupscheme/src/grewpedit/src/app/GrewpEdit.java,v retrieving revision 1.21 retrieving revision 1.22 diff -u -d -r1.21 -r1.22 --- GrewpEdit.java 30 Apr 2007 07:55:11 -0000 1.21 +++ GrewpEdit.java 2 May 2007 07:07:26 -0000 1.22 @@ -214,7 +214,7 @@ } public void offerServer(int port, String pw) throws Exception { - boolean change = server.getPort()!=port && server.getPassword()!=pw; + boolean change = server.getPort()!=port || !server.getPassword().equals(pw); if (server.isRunning() && change) server.stop(); Index: GrewpEditGUI.java =================================================================== RCS file: /cvsroot/groupscheme/groupscheme/src/grewpedit/src/app/GrewpEditGUI.java,v retrieving revision 1.15 retrieving revision 1.16 diff -u -d -r1.15 -r1.16 --- GrewpEditGUI.java 27 Apr 2007 09:17:15 -0000 1.15 +++ GrewpEditGUI.java 2 May 2007 07:07:27 -0000 1.16 @@ -613,7 +613,7 @@ JTextField dportTF, dhostTF, dpwTF, myhostTF, hostTF, portTF, pwTF; JComboBox serverCB; JButton stopB; - private String h, pw; private int p=-1; + private String h, pw; private int p=14000; final int DEFAULT=0, SPECIFY=1, LOCAL=2; final String[] CHOICES = |
|
From: Kenroy G. <kg...@us...> - 2007-05-01 09:06:03
|
Update of /cvsroot/groupscheme/groupscheme/src/grewpedit/src/grouplet/xdoc In directory sc8-pr-cvs2.sourceforge.net:/tmp/cvs-serv21831/src/grouplet/xdoc Modified Files: XDocGrouplet.java Log Message: adding syntax files Index: XDocGrouplet.java =================================================================== RCS file: /cvsroot/groupscheme/groupscheme/src/grewpedit/src/grouplet/xdoc/XDocGrouplet.java,v retrieving revision 1.7 retrieving revision 1.8 diff -u -d -r1.7 -r1.8 --- XDocGrouplet.java 30 Apr 2007 07:55:11 -0000 1.7 +++ XDocGrouplet.java 1 May 2007 09:05:58 -0000 1.8 @@ -19,6 +19,8 @@ import util.MenuFactory; import util.FileIO; +import javax.swing.*; +import javax.swing.text.*; import javax.swing.JPanel; import javax.swing.JLabel; import javax.swing.JMenuBar; @@ -37,11 +39,13 @@ import javax.swing.MenuElement; import javax.swing.WindowConstants; import javax.swing.JTextPane; +import javax.swing.event.*; import javax.swing.event.DocumentListener; import javax.swing.event.DocumentEvent; import javax.swing.event.ListSelectionListener; import javax.swing.event.ListSelectionEvent; import java.awt.Color; +import java.awt.Font; import java.awt.BorderLayout; import java.awt.Component; import java.awt.event.ActionListener; @@ -54,8 +58,7 @@ public class XDocGrouplet extends AbstractGrouplet { static final String ID = "XDoc v1.0"; - static final String DESCRIPTION = - "Shared Document that is represented by a Monotonically Shared Edit Tree."; + static final String DESCRIPTION = "Simple Editor"; private static final int C_LENGTH = 5; JTextPane tpane; @@ -67,7 +70,7 @@ ChatPanel chat, chatPanel; GroupList glist; Color cid; - GroupListPanel glistPanel; + DocMenuBar mbar; GroupClient gc; GroupletInfo info; JPanel panel; @@ -147,7 +150,7 @@ JCheckBoxMenuItem inMI = new JCheckBoxMenuItem("Hold Incoming Edits"); JCheckBoxMenuItem outMI = new JCheckBoxMenuItem("Hold Outgoing Edits"); - JLabel status = new JLabel(" --Edits 77, inQ 33, outQ 9 --L 12, C 4"); + StatusLabel status = new StatusLabel(); Vector events = new Vector(); public DocMenuBar() { @@ -207,7 +210,9 @@ optionsM.add(outMI); add(optionsM); - add(status); + JPanel pan = new JPanel(); + pan.add(status); + add(pan); // add action listening JMenuItem[] mi = new JMenuItem[] @@ -400,7 +405,7 @@ if (panel == null) { panel = new JPanel(new BorderLayout()); - DocMenuBar mbar = updateMenuBar(new DocMenuBar()); + mbar = updateMenuBar(new DocMenuBar()); panel.add(mbar, BorderLayout.NORTH); vsplit = new JSplitPane(JSplitPane.VERTICAL_SPLIT, @@ -413,11 +418,64 @@ panel.add(hsplit, BorderLayout.CENTER); } + new Thread(mbar.status).start(); + tpane.setEnabled(true); } + class StatusLabel extends JLabel implements CaretListener, Runnable { + Document doc; Element el; + int edits, inq, outq, line=1, col, percent=100, offset, lineCnt; + public StatusLabel() { + //new JLabel("--Edits 77, inQ 33, outQ 9 --Line 12, Column 4 --(100%)"); + super("", JLabel.RIGHT); + setFont(Font.decode("Courier-PLAIN-12")); + doc = tpane.getDocument(); + tpane.addCaretListener(this); + } + + public void setStatus() { + try { + offset = tpane.getCaretPosition(); + el = doc.getDefaultRootElement(); + lineCnt = el.getElementCount(); + //lineCnt = TA.getLineCount(); + line = el.getElementIndex(offset); + //line = TA.getLineOfOffset(offset); + el = el.getElement(line); + col = offset - el.getStartOffset(); + //col = offset-TA.getLineStartOffset(line)+1; + percent = (int)(100 * (++line / (double)lineCnt)); + + edits = client.getAppliedEdits(); + inq = client.getIncomingEdits(); + outq = client.getOutgoingEdits(); + + setText("--Edits "+edits+", inQ "+inq+", outQ "+outq+ + " --Line "+line+", Column "+col+" --("+percent+"%)"); + } + catch (Exception ex) { + ex.printStackTrace(); + } + } + + public void caretUpdate(CaretEvent e) { + setStatus(); + } + + public void run() { + while (client.isConnected()) { + setStatus(); + try { + Thread.sleep(1500L); + } + catch (Exception e) { e.printStackTrace(); } + } + } + } + public void stop() { if (tpane != null) gc.disconnect(); |
|
From: Kenroy G. <kg...@us...> - 2007-05-01 09:06:02
|
Update of /cvsroot/groupscheme/groupscheme/src/grewpedit/src/util In directory sc8-pr-cvs2.sourceforge.net:/tmp/cvs-serv21831/src/util Modified Files: MenuFactory.java Log Message: adding syntax files Index: MenuFactory.java =================================================================== RCS file: /cvsroot/groupscheme/groupscheme/src/grewpedit/src/util/MenuFactory.java,v retrieving revision 1.5 retrieving revision 1.6 diff -u -d -r1.5 -r1.6 --- MenuFactory.java 30 Apr 2007 07:55:12 -0000 1.5 +++ MenuFactory.java 1 May 2007 09:05:59 -0000 1.6 @@ -258,21 +258,34 @@ public static JMenu createFontStyleMenu(String title, final JTextComponent tc) { - String[] style = {"PLAIN", "BOLD", "ITALIC", "BOLDITALIC"}; + final String[] style = {"PLAIN", "BOLD", "ITALIC", "BOLDITALIC"}; final JMenu styleM = new JMenu(title); JMenuItem[] styleMI = new JMenuItem[style.length]; ActionListener listener = new ActionListener() { String styleVal; + Boolean on = new Boolean(true), off = new Boolean(false); public void actionPerformed(ActionEvent e) { JMenuItem src = (JMenuItem)e.getSource(); if (styleM.isMenuComponent(src)) { styleVal = src.getText(); if (tc instanceof JTextPane) { SimpleAttributeSet attr = new SimpleAttributeSet(); - //if (styleVal.equals(style[2])) - //attr.addAttribute(StyleConstants.Italic, new Boolean(true)); + if (styleVal.equals(style[0])) { + attr.addAttribute(StyleConstants.Italic, off); + attr.addAttribute(StyleConstants.Bold, off); + } + else if (styleVal.equals(style[1])) { + attr.addAttribute(StyleConstants.Bold, on); + } + else if (styleVal.equals(style[2])) { + attr.addAttribute(StyleConstants.Italic, on); + } + else if (styleVal.equals(style[3])) { + attr.addAttribute(StyleConstants.Italic, on); + attr.addAttribute(StyleConstants.Bold, on); + } ((JTextPane)tc).setCharacterAttributes(attr, false); } else |
|
From: Kenroy G. <kg...@us...> - 2007-05-01 09:06:02
|
Update of /cvsroot/groupscheme/groupscheme/src/grewpedit/src/grouplet/groupsite In directory sc8-pr-cvs2.sourceforge.net:/tmp/cvs-serv21831/src/grouplet/groupsite Modified Files: GroupSitePanel.java Log Message: adding syntax files Index: GroupSitePanel.java =================================================================== RCS file: /cvsroot/groupscheme/groupscheme/src/grewpedit/src/grouplet/groupsite/GroupSitePanel.java,v retrieving revision 1.11 retrieving revision 1.12 diff -u -d -r1.11 -r1.12 --- GroupSitePanel.java 27 Apr 2007 09:17:15 -0000 1.11 +++ GroupSitePanel.java 1 May 2007 09:05:58 -0000 1.12 @@ -410,9 +410,9 @@ fileM.setMnemonic(KeyEvent.VK_F); fileM.add(newM); // concern 1 - Grouplet [] g = { new grouplet.doc.MSETStyledDocGrouplet(), + Grouplet [] g = { new grouplet.xdoc.XDocGrouplet(),/* + new grouplet.doc.MSETStyledDocGrouplet(), new grouplet.doc.CodeDocGrouplet(), - new grouplet.xdoc.XDocGrouplet(),/*, new grouplet.doc.MSETDocGrouplet(), new grouplet.doc.CentralDocGrouplet(), new grouplet.doc.ReplicaDocGrouplet()*/ }; |