Exemplo n.º 1
0
 private JamSessionPanel findJamSessionPanel(String sessionName) {
   int size = jamSessionTabbedPane.getTabCount();
   for (int i = 0; i < size; i++) {
     String tabTitle = jamSessionTabbedPane.getTitleAt(i);
     if (tabTitle.equals(sessionName)) {
       JamSessionPanel jamSessionPanel = (JamSessionPanel) jamSessionTabbedPane.getComponentAt(i);
       return jamSessionPanel;
     }
   }
   return null;
 }
Exemplo n.º 2
0
  public void displayMessage(
      Date timestamp,
      String sessionName,
      ArrayList<String> participants,
      String fromUser,
      String message) {
    JamSessionPanel jamSessionPanel = findJamSessionPanel(sessionName);
    if (jamSessionPanel == null) {
      jamSessionPanel = mainJamPanel.addJamSession(sessionName, participants);
    }

    jamSessionTabbedPane.flash(jamSessionPanel);

    if (message.startsWith(RSJM)) {
      Midi midi = receiveBlocks(jamSessionPanel.getMessageBuffer(), message);
      if (midi != null) {
        MessageListElement messageListElement =
            new MusicMessageListElement(timestamp, fromUser, midi);
        jamSessionPanel.addRecentMessage(messageListElement);
      }
    } else {
      MessageListElement messageListElement = new MessageListElement(timestamp, fromUser, message);
      jamSessionPanel.addRecentMessage(messageListElement);
    }
  }