1 16 17 package org.springframework.mock.web.portlet; 18 19 import java.util.Enumeration ; 20 import java.util.List ; 21 import java.util.Properties ; 22 import java.util.Vector ; 23 24 import javax.portlet.PortalContext; 25 import javax.portlet.PortletMode; 26 import javax.portlet.WindowState; 27 28 35 public class MockPortalContext implements PortalContext { 36 37 private final Properties properties = new Properties (); 38 39 private final Vector portletModes; 40 41 private final Vector windowStates; 42 43 44 51 public MockPortalContext() { 52 this.portletModes = new Vector (3); 53 this.portletModes.add(PortletMode.VIEW); 54 this.portletModes.add(PortletMode.EDIT); 55 this.portletModes.add(PortletMode.HELP); 56 57 this.windowStates = new Vector (3); 58 this.windowStates.add(WindowState.NORMAL); 59 this.windowStates.add(WindowState.MAXIMIZED); 60 this.windowStates.add(WindowState.MINIMIZED); 61 } 62 63 70 public MockPortalContext(List supportedPortletModes, List supportedWindowStates) { 71 this.portletModes = new Vector (supportedPortletModes); 72 this.windowStates = new Vector (supportedWindowStates); 73 } 74 75 76 public String getPortalInfo() { 77 return "MockPortal/1.0"; 78 } 79 80 public String getProperty(String name) { 81 return this.properties.getProperty(name); 82 } 83 84 public Enumeration getPropertyNames() { 85 return this.properties.propertyNames(); 86 } 87 88 public Enumeration getSupportedPortletModes() { 89 return this.portletModes.elements(); 90 } 91 92 public Enumeration getSupportedWindowStates() { 93 return this.windowStates.elements(); 94 } 95 96 } 97 | Popular Tags |