001 /*
002 * Copyright (C) 2003 Adam Olsen
003 * This program is free software; you can redistribute it and/or modify
004 * it under the terms of the GNU General Public License as published by
005 * the Free Software Foundation; either version 1, or (at your option)
006 * any later version.
007 * This program is distributed in the hope that it will be useful,
008 * but WITHOUT ANY WARRANTY; without even the implied warranty of
009 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
010 * GNU General Public License for more details.
011 * You should have received a copy of the GNU General Public License
012 * along with this program; if not, write to the Free Software
013 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
014 */
015 package com.valhalla.jbother.actions;
016
017 import java.awt.*;
018 import java.awt.event.*;
019 import javax.swing.*;
020 import javax.swing.event.*;
021 import com.valhalla.jbother.*;
022 import java.util.*;
023 import com.valhalla.settings.*;
024
025 /**
026 * Description of the Class
027 *
028 *@author synic
029 *@created May 13, 2005
030 */
031 public class ShowAwayAction implements ActionListener {
032 private static ShowAwayAction instance = new ShowAwayAction();
033 private static Vector items = new Vector();
034
035
036 /**
037 * Constructor for the ShowOfflineAction object
038 */
039 private ShowAwayAction() { }
040
041
042 /**
043 * Adds a feature to the Item attribute of the ShowOfflineAction class
044 *
045 *@param button The feature to be added to the Item attribute
046 */
047 public static void addItem(AbstractButton button) {
048 items.add(button);
049 button.addActionListener(instance);
050 }
051
052
053 /**
054 * Description of the Method
055 *
056 *@param e Description of the Parameter
057 */
058 public void actionPerformed(ActionEvent e) {
059 AbstractButton button = (AbstractButton) e.getSource();
060 BuddyList.getInstance().getBuddyListTree().setShowAwayBuddies(button.isSelected());
061
062 for (int i = 0; i < items.size(); i++) {
063 AbstractButton b = (AbstractButton) items.get(i);
064 if (button != b) {
065 b.setSelected(button.isSelected());
066 }
067 }
068 }
069 }
070