Ejemplo n.º 1
0
  public void itemStateChanged(ItemEvent E) {
    // The 'log chat' checkbox
    if (E.getSource() == logChat) {
      server.logChats = logChat.getState();

      // Loop through all of the chat rooms, and set the logging
      // state to be the same as the value of the checkbox
      for (int count = 0; count < server.chatRooms.size(); count++) {
        babylonChatRoom tmp = (babylonChatRoom) server.chatRooms.elementAt(count);
        try {
          tmp.setLogging(server.logChats);
        } catch (IOException e) {
          server.serverOutput(
              server.strings.get(thisClass, "togglelogerror") + " " + tmp.name + "\n");
        }
      }
    }

    // The user list
    if (E.getSource() == userList) {
      // If anything is selected, enable the 'disconnect user'
      // button, otherwise disable it
      synchronized (userList) {
        disconnect.setEnabled(userList.getSelectedItem() != null);
      }
    }
  }
Ejemplo n.º 2
0
 public void actionPerformed(ActionEvent E) {
   if (E.getSource() == yes) {
     dispose();
     server.shutdown();
     return;
   } else if (E.getSource() == cancel) {
     dispose();
     return;
   }
 }
Ejemplo n.º 3
0
 public void keyReleased(KeyEvent E) {
   if (E.getKeyCode() == E.VK_ENTER) {
     if (E.getSource() == yes) {
       dispose();
       server.shutdown();
       return;
     } else if (E.getSource() == cancel) {
       dispose();
       return;
     }
   }
 }
Ejemplo n.º 4
0
 public void windowClosing(WindowEvent E) {
   if (server.currentConnections > 0) new babylonServerShutdownDialog(this, server);
   else server.shutdown();
 }
Ejemplo n.º 5
0
  public void actionPerformed(ActionEvent E) {
    if (E.getSource() == userAdmin) {
      babylonUserToolDialog userTool = new babylonUserToolDialog(this);
      return;
    }

    if (E.getSource() == console) {
      babylonInfoDialog tmp =
          new babylonInfoDialog(
              this,
              server.strings.get(thisClass, "loading"),
              false,
              server.strings.get(thisClass, "startingclient"),
              server.strings.get("ok"));

      consoleWindow =
          new babylonWindow(
              new babylonPanel(
                  "Administrator",
                  "",
                  "localhost",
                  Integer.toString(server.port),
                  true,
                  server.myURL));
      tmp.dispose();

      consoleWindow.contentPanel.adminConsole = true;
      consoleWindow.contentPanel.lockSettings = true;
      consoleWindow.contentPanel.requirePassword = false;

      // Show the window
      consoleWindow.show();

      // Connect
      consoleWindow.contentPanel.connect();

      return;
    }

    if (E.getSource() == disconnect) {
      String disconnectUser;

      synchronized (userList) {
        disconnectUser = userList.getSelectedItem();
      }

      if (disconnectUser != null) {
        // Loop through all of the current connections to find
        // the object that corresponds to this name

        for (int count = 0; count < server.currentConnections; count++) {
          babylonClientSocket tempuser = (babylonClientSocket) server.connections.elementAt(count);

          if (tempuser.user.name.equals(disconnectUser)) {
            server.disconnect(tempuser, true);
            break;
          }
        }
      }
      return;
    }

    if (E.getSource() == disconnectAll) {
      server.disconnectAll(true);
      return;
    }

    if (E.getSource() == shutdown) {
      if (server.currentConnections > 0) new babylonServerShutdownDialog(this, server);
      else server.shutdown();
      return;
    }
  }