public void actionPerformed(ActionEvent e) { Object o = _listChannels.getSelectedValue(); if (o instanceof Channel) { Channel channel = (Channel) o; Iterator iter = channel.getItems().iterator(); while (iter.hasNext()) { Item item = (Item) iter.next(); item.setRead(false); } _listChannels.repaint(); _listItems.repaint(); } }
public void update(Object o) { setEnabled(true); Channel channel = (Channel) _listChannels.getSelectedValue(); if (channel == null) { setEnabled(false); } int numItems = channel.getItems().size(); int numUnread = channel.getUnreadItemCount(); if (numItems == numUnread) { setEnabled(false); } }