示例#1
0
 public void selectPrevious() {
   if (selectionModel.getSelectedIndex() == 0) {
     selectionModel.selectLast();
   } else {
     selectionModel.selectPrevious();
   }
 }
示例#2
0
 public void selectNext() {
   if (selectionModel.getSelectedIndex() == tabList.getItems().size() - 1) {
     selectionModel.selectFirst();
   } else {
     selectionModel.selectNext();
   }
 }
示例#3
0
 public void close(Tab tab, boolean action) {
   if (getSelected().equals(tab)) {
     if (selectionModel.getSelectedIndex() == tabList.getItems().size()) {
       selectPrevious();
     } else {
       selectNext();
     }
   }
   {
     Iterator<Tab> it = tabList.getItems().iterator();
     while (it.hasNext()) {
       Tab _tab = it.next();
       if (_tab.equals(tab)) {
         it.remove();
         if (action) {
           if (tab.getEntity() instanceof Channel) {
             appPane.getContentPane().getConnection().part((Channel) tab.getEntity());
           } else if (tab.getEntity() instanceof Server) {
             appPane.getContentPane().getConnection().quit("");
           }
         }
         break;
       }
     }
   }
   if (tab.getEntity() instanceof Server) {
     Iterator<Tab> it = tabList.getItems().iterator();
     while (it.hasNext()) {
       Tab _tab = it.next();
       if (_tab.getConnection().equals(tab.getConnection())) {
         close(_tab);
       }
     }
   }
   Mercury.saveConnections();
 }