コード例 #1
0
  @Override
  public int getSize() {
    if (channels == null) {
      return 1;
    }

    return channels.size() + 1;
  }
コード例 #2
0
  @Override
  public Object getElementAt(int index) {
    if (index == 0) {
      return Channel.MASTER;
    }

    if (channels == null) {
      return null;
    }
    return channels.get(index - 1).getName();
  }
コード例 #3
0
  @Override
  public void setSelectedItem(Object anItem) {

    if (Channel.MASTER.equals(anItem)) {
      selectedItem = Channel.MASTER;
    } else {
      int index = channels.indexByName(anItem);

      if (index < 0) {
        selectedItem = Channel.MASTER;
      } else {
        selectedItem = (String) anItem;
      }
    }

    ListDataEvent lde = new ListDataEvent(this, ListDataEvent.CONTENTS_CHANGED, -1, -1);

    fireListEvent(lde);
  }
コード例 #4
0
 public void intervalRemoved(ObservableListEvent<Channel> e) {
   if (channels.indexByName(selectedItem) < 0) {
     setSelectedItem(Channel.MASTER);
   }
 }