final String portletInstanceKey = (String)copletInstanceData.getTemporaryAttribute(WSRPAdapter.ATTRIBUTE_NAME_PORTLET_INSTANCE_KEY);
final User user = (User)copletInstanceData.getTemporaryAttribute(WSRPAdapter.ATTRIBUTE_NAME_USER);
final WSRPPortlet portlet = this.environment.getPortletRegistry().getPortlet(portletKey);
try {
SimplePortletWindowSession windowSession = this.adapter.getSimplePortletWindowSession(portlet, portletInstanceKey, user);
if ( this.environment != null && windowSession != null ) {
this.adapter.setCurrentCopletInstanceData(copletInstanceData);
URLGenerator urlGenerator = this.environment.getURLGenerator();
String[] supportedWindowStates = (String[])copletInstanceData.getTemporaryAttribute(WSRPAdapter.ATTRIBUTE_NAME_PORTLET_WINDOWSTATES);
String ws = windowSession.getWindowState();
if ( ws == null ) {
ws = WindowStates._normal;
}
if ( !ws.equals(WindowStates._minimized)
&& ArrayUtils.contains(supportedWindowStates, WindowStates._minimized)) {
final Map p = new HashMap();
p.put(Constants.URL_TYPE, Constants.URL_TYPE_RENDER);
p.put(Constants.WINDOW_STATE, WindowStates._minimized);
final String link = urlGenerator.getRenderURL(p);
XMLUtils.createElement(contenthandler, "minimize-uri", link);
}
if ( !ws.equals(WindowStates._normal)
&& ArrayUtils.contains(supportedWindowStates, WindowStates._normal)) {
final Map p = new HashMap();
p.put(Constants.URL_TYPE, Constants.URL_TYPE_RENDER);
p.put(Constants.WINDOW_STATE, WindowStates._normal);
final String link = urlGenerator.getRenderURL(p);
XMLUtils.createElement(contenthandler, "maximize-uri", link);
}
if ( !ws.equals(WindowStates._maximized)
&& ArrayUtils.contains(supportedWindowStates, WindowStates._maximized)) {
final Map p = new HashMap();
p.put(Constants.URL_TYPE, Constants.URL_TYPE_RENDER);
p.put(Constants.WINDOW_STATE, WindowStates._maximized);
final String link = urlGenerator.getRenderURL(p);
XMLUtils.createElement(contenthandler, "fullscreen-uri", link);
}
String[] supportedModes = (String[])copletInstanceData.getTemporaryAttribute(WSRPAdapter.ATTRIBUTE_NAME_PORTLET_MODES);
String pm = windowSession.getMode();
if ( pm == null ) {
pm = Modes._view;
}
if ( !pm.equals(Modes._edit)
&& ArrayUtils.contains(supportedModes, Modes._edit) ) {