1 7 8 package org.jboss.portal.core.theme.strategy.impl; 9 10 import org.jboss.portal.server.Component; 11 import org.jboss.portal.server.Window; 12 import org.jboss.portal.server.WindowContext; 13 import org.jboss.portal.server.plugins.windowstate.WindowState; 14 import org.jboss.portal.server.theme.strategy.PortletContext; 15 import org.jboss.portal.server.user.UserContext; 16 17 import java.util.Collections ; 18 import java.util.Set ; 19 20 28 public class PortletContextImpl implements PortletContext 29 { 30 private final Component component; 31 private final WindowContext windowContext; 32 private final Window window; 33 34 36 42 public PortletContextImpl(Window window, UserContext userContext) 43 { 44 this.window = window; 45 this.component = window.getInstance().getComponent(); 46 windowContext = (WindowContext)userContext.getContext(window); 47 } 48 49 52 public String getPortletName() 53 { 54 return component.getName(); 55 } 56 57 60 public WindowState getWindowState() 61 { 62 return windowContext.getWindowState(); 63 } 64 65 69 public boolean isSupportedWindowState(WindowState windowState) 70 { 71 return window.isSupportedWindowState(windowState); 72 } 73 74 77 public Set getSupportedWindowStates() 78 { 79 return Collections.unmodifiableSet(window.getSupportedWindowStates()); 80 } 81 82 86 public String getRegionName() 87 { 88 throw new UnsupportedOperationException ("not implemented yet"); 89 } 90 91 95 public void setRegionName(String regionName) 96 { 97 throw new UnsupportedOperationException ("not implemented yet"); 98 } 99 100 104 public int getOrder() 105 { 106 throw new UnsupportedOperationException ("not implemented yet"); 107 } 108 109 113 public void setOrder(int order) 114 { 115 throw new UnsupportedOperationException ("not implemented yet"); 116 } 117 118 121 public boolean equals(Object o) 122 { 123 if (this == o) 124 { 125 return true; 126 } 127 if (!(o instanceof PortletContextImpl)) 128 { 129 return false; 130 } 131 132 final PortletContextImpl portletContext = (PortletContextImpl)o; 133 134 if (!window.getID().equals(portletContext.window.getID())) 135 { 136 return false; 137 } 138 139 return true; 140 } 141 142 145 public int hashCode() 146 { 147 return window.getID().hashCode(); 148 } 149 150 153 public String toString() 154 { 155 return window.getName(); 156 } 157 } 158 | Popular Tags |