}
public static class DeleteTabActionListener extends EventListener<UITabPaneDashboard> {
public void execute(Event<UITabPaneDashboard> event) throws Exception {
UITabPaneDashboard source = event.getSource();
PortletRequestContext context = (PortletRequestContext) event.getRequestContext();
String nodeName = context.getRequestParameter(UIComponent.OBJECTID);
UserNode nextNode = source.getFirstAvailableNode();
UserNode selectedNode = source.removePageNode(nodeName);
// If the node is removed successfully, then redirect to the node specified by tab on the left
if (selectedNode != null) {
// set maximizedUIComponent of UIPageBody is null if it is maximized portlet of removed page
UIPortal uiPortal = Util.getUIPortal();
UIPageBody uiPageBody = uiPortal.findFirstComponentOfType(UIPageBody.class);
if (uiPageBody != null && uiPageBody.getMaximizedUIComponent() != null) {
uiPageBody.setMaximizedUIComponent(null);
}
nextNode = selectedNode;
}
PortalRequestContext prContext = Util.getPortalRequestContext();
NodeURL nodeURL = prContext.createURL(NodeURL.TYPE).setNode(nextNode);
context.sendRedirect(nodeURL.toString());
}