throw new Exception("Unexpected response type [" + piResponse
+ "]. Expected a UpdateNavigationResponse or an ErrorResponse.");
}
}
UpdateNavigationalStateResponse navResponse = (UpdateNavigationalStateResponse) piResponse;
//
/*
* Update the portlet window state according to the action output information
*
* If the current node is displaying a usual layout page, also tells the page which portlet to render or not when
* the state is maximized
*/
WindowState state = new WindowState(getWindowStateOrDefault(navResponse));
setNextState(uiPortlet, state);
// update the portlet with the next mode to display
PortletMode mode = new PortletMode(getPortletModeOrDefault(navResponse));
setNextMode(uiPortlet, mode);
StateString navState = navResponse.getNavigationalState();
if (navState != null) {
uiPortlet.setNavigationalState(navResponse.getNavigationalState());
}
setupPublicRenderParams(uiPortlet, navResponse.getPublicNavigationalStateUpdates());
// TODO: (mwringe) add this to the UpdateNavigationStateResponse.Event class instead of here
class PortletEvent implements javax.portlet.Event {
QName qName;
Serializable value;
public PortletEvent(QName qName, Serializable value) {
this.qName = qName;
this.value = value;
}
public String getName() {
return qName.getLocalPart();
}
public QName getQName() {
return qName;
}
public Serializable getValue() {
return value;
}
}
List<UpdateNavigationalStateResponse.Event> nsEvents = navResponse.getEvents();
List<javax.portlet.Event> events = new ArrayList<javax.portlet.Event>(nsEvents.size());
if (nsEvents != null && !nsEvents.isEmpty()) {
for (UpdateNavigationalStateResponse.Event nsEvent : nsEvents) {
javax.portlet.Event portletEvent = new PortletEvent(nsEvent.getName(), nsEvent.getPayload());
events.add(portletEvent);