001 /* steelme theme manager for Java 002 * Copyright (C) 2000 - 2004 T.J. Willis 003 * 004 * This program is free software; you can redistribute it and/or 005 * modify it under the terms of the GNU General Public License 006 * as published by the Free Software Foundation; either version 2 007 * of the License, or (at your option) any later version. 008 * 009 * This program is distributed in the hope that it will be useful, 010 * but WITHOUT ANY WARRANTY; without even the implied warranty of 011 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 012 * GNU General Public License for more details. 013 * 014 * You should have received a copy of the GNU General Public License 015 * along with this program; if not, write to the Free Software 016 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111, USA. 017 * 018 * $Header: /cvsroot/steelme/steelme/src/net/sourceforge/steelme/SteelmeThemeManager.java,v 1.4 2004/05/27 23:11:09 tj_willis Exp $ 019 */ 020 package net.sourceforge.steelme; 021 022 import java.util.*; 023 024 /** 025 * Describe class <code>SteelmeThemeManager</code> here. 026 * 027 * @author <a href="mailto:tj_willis@users.sourceforge.net">T.J. Willis</a> 028 * @version 1.0 029 * @has 1..n Has - net.sourceforge.steelme.ThemeChangedListener 030 * @has 1 Has - net.sourceforge.steelme.SteelmeTheme 031 */ 032 public class SteelmeThemeManager { 033 static Vector listeners //<ThemeChangedListener> listeners 034 = new Vector(); //<ThemeChangedListener>(); 035 static SteelmeTheme theme; 036 037 038 /** 039 * Describe <code>setCurrentTheme</code> method here. 040 * 041 * @param t a <code>SteelmeTheme</code> value 042 */ 043 public static void setCurrentTheme(SteelmeTheme t) { 044 //FIXME: this class is almost useless. 045 theme = t; 046 notifyListeners(); 047 } 048 049 /** 050 * Describe <code>getCurrentTheme</code> method here. 051 * 052 * @return a <code>SteelmeTheme</code> value 053 */ 054 public static SteelmeTheme getCurrentTheme() { 055 return theme; 056 } 057 058 059 /** 060 * Describe <code>addListener</code> method here. 061 * 062 * @param l a <code>ThemeChangedListener</code> value 063 */ 064 public static void addListener(ThemeChangedListener l) { 065 listeners.add(l); 066 067 } 068 069 /** 070 * Describe <code>notifyListeners</code> method here. 071 * 072 */ 073 static protected void notifyListeners() { 074 for(int i=0;i<listeners.size();i++) { 075 ThemeChangedListener l = (ThemeChangedListener)listeners.elementAt(i); 076 l.themeChanged(theme); 077 078 } 079 } 080 081 } 082 083 084 085 086 087 088 089