1 9 package org.jboss.portal.server.plugins.windowstate; 10 11 import java.util.HashSet ; 12 import java.util.Iterator ; 13 import java.util.Set ; 14 15 import org.jboss.portal.common.metadata.MetaData; 16 import org.jboss.portal.server.metadata.WindowStatesMetaData; 17 import org.jboss.portal.server.plugins.PluginService; 18 19 23 public class WindowStates 24 extends PluginService 25 implements WindowStateProvider 26 { 27 28 protected WindowStatesMetaData metaData; 29 30 protected Set windowStates; 31 32 35 public boolean containsWindowState(WindowState windowState) 36 { 37 if (windowState == null) 38 { 39 throw new IllegalArgumentException ("Window state must not be null"); 40 } 41 return windowStates.contains(windowState); 42 } 43 44 47 public void addWindowState(WindowState windowState) 48 { 49 if (windowState == null) 50 { 51 throw new IllegalArgumentException ("Window state must not be null"); 52 } 53 windowStates.add(windowState); 54 } 55 56 59 public void removeWindowState(WindowState windowState) 60 { 61 if (windowState == null) 62 { 63 throw new IllegalArgumentException ("Window state must not be null"); 64 } 65 windowStates.remove(windowState); 66 } 67 68 public Set getWindowStates() 69 { 70 return windowStates; 71 } 72 73 public void start() throws Exception 74 { 75 this.windowStates = new HashSet (); 76 for (Iterator i = this.metaData.getWindowStates().iterator();i.hasNext();) 77 { 78 String windowStateAsString = (String )i.next(); 79 WindowState windowState = WindowState.create(windowStateAsString); 80 windowStates.add(windowState); 81 } 82 } 83 84 public void setMetaData(MetaData metaData) 85 { 86 this.metaData = (WindowStatesMetaData)metaData; 87 } 88 89 public MetaData getMetaData() 90 { 91 return metaData; 92 } 93 } 94 | Popular Tags |