]> code.citadel.org Git - citadel.git/commitdiff
Cleaned up the interface, the whoOnline window updates automatically, and
authorChilly <chilly@uncensored.citadel.org>
Fri, 27 Aug 1999 16:08:41 +0000 (16:08 +0000)
committerChilly <chilly@uncensored.citadel.org>
Fri, 27 Aug 1999 16:08:41 +0000 (16:08 +0000)
messed around with the NOOP to cut down needless chatter...

shaggy/Queue.java
shaggy/citadel.java
shaggy/message.java
shaggy/messagePanel.java
shaggy/net.java
shaggy/whoOnlineWindow.java

index fb567fd2977c25189909fb1e95953e6aa50e49ee..24bd18b238b41c536225d4d29095f24ace8596a3 100644 (file)
@@ -30,6 +30,10 @@ public class Queue {
                        tail = null;
                return o;
                }
+
+  public boolean empty() {
+    return( head == null );
+  }
        }
 
 class QElement {
index 09cb834822bf3a4a7cbfe2a5909f7e08e863b79d..6d7a4208296dcb732622ab4d28cd88fcd8de716d 100644 (file)
@@ -16,6 +16,7 @@ public class citadel {
     user               theUser;
     roomMap            rooms;
     roomFrame          rf;
+    whoOnlineWindow    wo = null;
 
     public static void main( String args[] ) {
        new citadel();
index a43f387e17b7e1fdc11e15e96387acb69f9fa69f..74dd72c3d98edc7b869de34a7c1cf009bd8c0f74 100644 (file)
@@ -4,7 +4,7 @@ public class message {
     String     blurb;
     String     message;
 
-    public message( int count, int cur_pos, citReply r ) {
+    public message( roomInfo ri, int count, int cur_pos, citReply r ) {
        Vector  msg = r.listing;
 
        String  s, from="", time="", room="", node="", rcpt="";
@@ -25,8 +25,8 @@ public class message {
            blurb = blurb + " (@"+node+")";
        if( !rcpt.equals( "" ) )
            blurb = blurb + " to " + rcpt;
-       /*      if( !room.equals(name) )        FIXME
-               blurb = blurb + " in " + room; */
+       if( !room.equals( ri.name) )
+         blurb = blurb + " in " + room;
    
        /* this relies on the fact that we've removed
           the header lines above.  probably a messy way 
index 85f012faf2d7eb542ed762d109f7910cf89e70a5..76e35c443beee13829828225751e3a56ff8ebb1d 100644 (file)
@@ -167,7 +167,7 @@ public class messagePanel extends JPanel {
                    blurb.setText( "<error>" );
                    message.setText( r.getArg(0) );
                } else {
-                   message msg = new message( msgs.size(), cur_pos, r );
+                   message msg = new message( ri, msgs.size(), cur_pos, r );
                    blurb.setText( msg.getBlurb() );
                    message.setText( msg.getText() );
                    int n = citadel.atoi( num );
index 06a72fc035681e4f4a5fdf26a632662efd259bb7..3ba6079bd10125e459b6438d07dd94a5aa29042b 100644 (file)
@@ -113,7 +113,14 @@ public class net implements Runnable {
                    } catch( Exception e ) {}
 
                    System.out.println( "Idle event" );
-                   citadel.me.networkEvent( "NOOP" );
+                   if( citadel.me.wo == null ) {
+                     if( theQueue.empty() )
+                       citadel.me.networkEvent( "NOOP" );
+                     else
+                       System.out.println( "...events pending" );
+                   }
+                   else
+                       citadel.me.wo.refresh();
                }
            } };
 
@@ -127,6 +134,7 @@ public class net implements Runnable {
        }
 
        try {
+       if( theSocket != null )
            theSocket.close();
        } catch( IOException ioe ) {
        }
index 6f1164dd89a6d33d32a3f5cdf703177daab60f4e..1eb50fc3b155b1c63a85c0ab321df05f864f5c66 100644 (file)
@@ -55,6 +55,7 @@ public class whoOnlineWindow extends JFrame {
            } } );
 
        citadel.me.registerWindow( this );
+       citadel.me.wo = this;
        refresh();
        pack();
        show();
@@ -62,6 +63,7 @@ public class whoOnlineWindow extends JFrame {
 
     public void closeWin() {
        citadel.me.removeWindow( this );
+       citadel.me.wo = null;
        dispose();
     }
 
@@ -104,3 +106,40 @@ public class whoOnlineWindow extends JFrame {
        
 
 }
+
+/*
+ class MyCellRenderer extends JLabel implements ListCellRenderer {
+     final static ImageIcon longIcon = new ImageIcon("long.gif");
+     final static ImageIcon shortIcon = new ImageIcon("short.gif");
+
+     // This is the only method defined by ListCellRenderer.  We just
+     // reconfigure the Jlabel each time we're called.
+
+     public Component getListCellRendererComponent(
+       JList list,
+       Object value,            // value to display
+       int index,               // cell index
+       boolean isSelected,      // is the cell selected
+       boolean cellHasFocus)    // the list and the cell have the focus
+     {
+         String s = value.toString();
+         setText(s);
+         setIcon((s.length() > 10) ? longIcon : shortIcon);
+           if (isSelected) {
+             setBackground(list.getSelectionBackground());
+               setForeground(list.getSelectionForeground());
+           }
+         else {
+               setBackground(list.getBackground());
+               setForeground(list.getForeground());
+           }
+           setEnabled(list.isEnabled());
+           setFont(list.getFont());
+         return this;
+     }
+ }
+
+ String[] data = {"one", "two", "free", "four"};
+ JList dataList = new JList(data);
+ dataList.setCellRenderer(new MyCellRenderer());
+*/