working on group leader -> group leader connectivity

git-svn-id: svn://anubis/gvsu@56 45c1a28c-8058-47b2-ae61-ca45b979098e
This commit is contained in:
josh 2008-03-09 04:28:08 +00:00
parent d7ebcf68d9
commit dd4be30846
2 changed files with 31 additions and 1 deletions

View File

@ -35,6 +35,8 @@ public class KaZaGUI extends JFrame
private JLabel m_serverClientsLabel;
private JLabel m_serverStatusLabel;
private JButton m_serverStartButton;
private JTextField m_serverPeerAddressField;
private JButton m_serverPeerConnectButton;
public KaZaGUI()
{
@ -160,6 +162,14 @@ public class KaZaGUI extends JFrame
}
}
}
else if (e.getSource() == m_serverPeerConnectButton)
{
if (m_server != null)
{
m_server.connectToPeerGroupLeader(
m_serverPeerAddressField.getText());
}
}
}
}
@ -264,27 +274,32 @@ public class KaZaGUI extends JFrame
JPanel clientPanel = new JPanel();
clientPanel.setLayout(new BoxLayout(clientPanel, BoxLayout.Y_AXIS));
JPanel p = new JPanel();
p.setLayout(new BoxLayout(p, BoxLayout.X_AXIS));
p.add(new JLabel("User name: "));
p.add(m_userNameField);
clientPanel.add(p);
p = new JPanel();
p.setLayout(new BoxLayout(p, BoxLayout.X_AXIS));
p.add(new JLabel("Connection speed: "));
p.add(m_speedCombo);
clientPanel.add(p);
p = new JPanel();
p.setLayout(new BoxLayout(p, BoxLayout.X_AXIS));
p.add(new JLabel("Shared folder: "));
p.add(m_shareFolderField);
p.add(m_browseButton);
clientPanel.add(p);
p = new JPanel();
p.setLayout(new BoxLayout(p, BoxLayout.X_AXIS));
p.add(new JLabel("Server: "));
p.add(m_serverNameField);
clientPanel.add(p);
p = new JPanel();
p.setLayout(new BoxLayout(p, BoxLayout.X_AXIS));
p.add(new JLabel("Search query: "));
@ -292,6 +307,7 @@ public class KaZaGUI extends JFrame
p.add(m_searchButton);
clientPanel.add(p);
clientPanel.add(m_searchResultsPanel);
p = new JPanel();
p.setLayout(new BoxLayout(p, BoxLayout.X_AXIS));
p.add(m_statusLabel);
@ -334,6 +350,9 @@ public class KaZaGUI extends JFrame
m_serverStartButton = new JButton("Start MNH Server");
m_serverStartButton.addActionListener(m_handler);
m_serverClientsLabel = new JLabel("Server Not Running");
m_serverPeerAddressField = new JTextField();
m_serverPeerConnectButton = new JButton("Connect");
m_serverPeerConnectButton.addActionListener(m_handler);
JPanel serverPanel = new JPanel();
serverPanel.setLayout(new BoxLayout(serverPanel, BoxLayout.Y_AXIS));
@ -343,6 +362,14 @@ public class KaZaGUI extends JFrame
p.add(new Box.Filler(new Dimension(0, 0), new Dimension(Short.MAX_VALUE, 0),
new Dimension(Short.MAX_VALUE, Short.MAX_VALUE)));
serverPanel.add(p);
p = new JPanel();
p.setLayout(new BoxLayout(p, BoxLayout.X_AXIS));
p.add(new JLabel("Peer Group Leader to link to: "));
p.add(m_serverPeerAddressField);
p.add(m_serverPeerConnectButton);
serverPanel.add(p);
serverPanel.add(new Box.Filler(new Dimension(0, 0),
new Dimension(0, Short.MAX_VALUE),
new Dimension(Short.MAX_VALUE,
@ -355,6 +382,7 @@ public class KaZaGUI extends JFrame
new Dimension(Short.MAX_VALUE, Short.MAX_VALUE)));
p.add(m_serverStartButton);
serverPanel.add(p);
return serverPanel;
}
}

View File

@ -209,7 +209,9 @@ public class KaZaServer implements Runnable
else
{
String peerResults =
getSearchResultsFromPeerGroupLeader(s, depth-1, query);
getSearchResultsFromPeerGroupLeader(
m_peerGroupLeaders.elementAt(i),
depth-1, query);
results += peerResults;
}
}