public static final String RENAMED_TAB_LABEL_PARAMETER = "newTabLabel";
public void execute(Event<UITabPaneDashboard> event) throws Exception {
UITabPaneDashboard tabPane = event.getSource();
PortletRequestContext context = (PortletRequestContext) event.getRequestContext();
UIApplication rootUI = context.getUIApplication();
String newTabLabel = context.getRequestParameter(RENAMED_TAB_LABEL_PARAMETER);
UserNode node = tabPane.getFirstAvailableNode();
if (!tabPane.validateName(newTabLabel)) {
Object[] args = { newTabLabel };
rootUI.addMessage(new ApplicationMessage("UITabPaneDashboard.msg.wrongTabName", args));
} else {
String nodeName = context.getRequestParameter(UIComponent.OBJECTID);
UserNode renamedNode = tabPane.renamePageNode(nodeName, newTabLabel);
if (renamedNode != null) {
node = renamedNode;
}
}
PortalRequestContext prContext = Util.getPortalRequestContext();
NodeURL nodeURL = prContext.createURL(NodeURL.TYPE).setNode(node);
context.sendRedirect(nodeURL.toString());
}