Пример #1
0
  public static void main(String[] args) {

    // UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());

    if (args.length == 1 && args[0].equals(TEST_FLAG)) {

      String[] filesToTest =
          new String[] {
            "examples/l22_cylsoma.swc",
            "examples/l22_sphersoma.swc",
            "examples/l22.swc",
            "examples/l22_small.swc",
            "examples/dCH-cobalt.CNG_small.swc",
            "examples/dCH-cobalt.CNG.swc"
          };

      for (String f : filesToTest) {
        String[] argsNew = new String[] {f, TEST_FLAG};
        SwingUtilities.invokeLater(new main(argsNew));
      }

    } else {
      SwingUtilities.invokeLater(new main(args));
    }
  }
Пример #2
0
  /**
   * Adds the sent packet detail to the messages table.
   *
   * @param dateFormatter the SimpleDateFormat to use to format Dates
   * @param packet the sent packet to add to the table
   */
  private void addSentPacketToTable(final SimpleDateFormat dateFormatter, final Packet packet) {
    SwingUtilities.invokeLater(
        new Runnable() {
          public void run() {
            String messageType;
            String to = packet.getTo();
            String type = "";
            Icon packetTypeIcon;
            sentPackets++;
            if (packet instanceof IQ) {
              packetTypeIcon = iqPacketIcon;
              messageType = "IQ Sent (class=" + packet.getClass().getName() + ")";
              type = ((IQ) packet).getType().toString();
              sentIQPackets++;
            } else if (packet instanceof Message) {
              packetTypeIcon = messagePacketIcon;
              messageType = "Message Sent";
              type = ((Message) packet).getType().toString();
              sentMessagePackets++;
            } else if (packet instanceof Presence) {
              packetTypeIcon = presencePacketIcon;
              messageType = "Presence Sent";
              type = ((Presence) packet).getType().toString();
              sentPresencePackets++;
            } else {
              packetTypeIcon = unknownPacketTypeIcon;
              messageType = packet.getClass().getName() + " Sent";
              sentOtherPackets++;
            }

            // Check if we need to remove old rows from the table to keep memory consumption low
            if (EnhancedDebuggerWindow.MAX_TABLE_ROWS > 0
                && messagesTable.getRowCount() >= EnhancedDebuggerWindow.MAX_TABLE_ROWS) {
              messagesTable.removeRow(0);
            }

            messagesTable.addRow(
                new Object[] {
                  formatXML(packet.toXML()),
                  dateFormatter.format(new Date()),
                  packetSentIcon,
                  packetTypeIcon,
                  messageType,
                  packet.getPacketID(),
                  type,
                  to,
                  ""
                });

            // Update the statistics table
            updateStatistics();
          }
        });
  }
Пример #3
0
 public void userHasLogged(final String user) {
   final EnhancedDebugger debugger = this;
   SwingUtilities.invokeLater(
       new Runnable() {
         public void run() {
           userField.setText(user);
           EnhancedDebuggerWindow.userHasLogged(debugger, user);
           // Add the connection listener to the connection so that the debugger can be notified
           // whenever the connection is closed.
           connection.addConnectionListener(connListener);
         }
       });
 }