1 package net.suberic.util.swing; 2 3 import net.suberic.util.*; 4 import java.util.*; 5 import javax.swing.*; 6 import javax.swing.plaf.metal.*; 7 import javax.swing.plaf.*; 8 9 10 13 public class ThemeWrapperItem implements Item, ValueChangeListener { 14 15 private String itemId; 16 private String resourceString; 17 18 private VariableBundle bundle = null; 19 20 private WeakHashMap themeListenerList = new WeakHashMap(); 21 22 private MetalTheme mWrappedTheme = null; 23 24 27 public ThemeWrapperItem(VariableBundle sourceBundle, String newResourceString, String newItemId) { 28 itemId = newItemId; 29 resourceString = newResourceString; 30 31 bundle = sourceBundle; 32 33 sourceBundle.addValueChangeListener(this, getItemProperty() + ".*"); 34 } 35 36 39 public void setWrappedTheme(MetalTheme pWrappedTheme) { 40 mWrappedTheme = pWrappedTheme; 41 } 42 43 46 public MetalTheme getWrappedTheme() { 47 return mWrappedTheme; 48 } 49 50 54 public String getItemID() { 55 return itemId; 56 } 57 58 62 public String getItemProperty() { 63 return resourceString + "." + itemId; 64 } 65 66 69 public void valueChanged(String changedValue) { 70 fireThemeChangedEvent(); 71 } 72 73 76 public void addThemeListener(ThemeListener tl) { 77 if (! themeListenerList.containsKey(tl)) 78 themeListenerList.put(tl, null); 79 } 80 81 84 public void removeThemeListener(ThemeListener tl) { 85 themeListenerList.remove(tl); 86 } 87 88 91 public void fireThemeChangedEvent() { 92 } 94 95 public String getName() { return getItemID(); } 96 97 } 98 | Popular Tags |