Пример #1
0
 public void addUserStatusMessage(
     User source, Message message, MessageRow.Type type, TabAction action) {
   for (Tab tab : getItems()) {
     if (tab.getEntity().equals(source)
         || (tab.getEntity() instanceof Channel
             && ((Channel) tab.getEntity()).getUsers().contains(source))) {
       tab.getContentPane().getMessagePane().addRow(new MessageRow(message, type));
       if (action != null) {
         action.process(tab);
       }
     }
   }
 }
Пример #2
0
 public void addUntargetedMessage(Connection connection, Message message, MessageRow.Type type) {
   Tab tab = getSelected();
   if (tab == null || !tab.getConnection().equals(connection)) {
     tab = null;
     for (Tab _tab : getItems()) {
       if (_tab.getConnection().equals(connection)) {
         tab = _tab;
         break;
       }
     }
     if (tab == null) {
       tab = create(connection, connection.getServer());
     }
   }
   tab.getContentPane().getMessagePane().addRow(new MessageRow(message, type));
 }
Пример #3
0
 public void addTargetedMessage(Connection connection, Message message, MessageRow.Type type) {
   Entity target = message.getTarget();
   if (target.equals(connection.getLocalUser())) {
     target = message.getSource();
   }
   Tab tab = null;
   for (Tab _tab : getItems()) {
     if (_tab.getEntity().equals(target)) {
       tab = _tab;
       break;
     }
   }
   if (tab == null) {
     if (type == MessageRow.Type.PART && message.getSource().equals(connection.getLocalUser())) {
       return;
     }
     tab = create(connection, target);
   }
   tab.getContentPane().getMessagePane().addRow(new MessageRow(message, type));
 }
Пример #4
0
 public void changed(ObservableValue<? extends Tab> ov, Tab oldTab, Tab newTab) {
   try {
     if (newTab == null) {
       appPane.setContentPane(null);
       return;
     }
     newTab.setUnread(false);
     appPane.setContentPane(newTab.getContentPane());
     final TextField inputField = appPane.getContentPane().getInputPane().getInputField();
     Platform.runLater(
         new Runnable() {
           public void run() {
             inputField.requestFocus();
             inputField.positionCaret(inputField.getText().length());
             inputField.deselect();
           }
         });
   } catch (final NullPointerException npe) {
     System.err.println("NPE Caught in method: TabPane.TabClickedListener#changed()");
   }
 }