public void saveTheme(FormEvent event) {
    PortletRequest req = event.getPortletRequest();
    ListBoxBean themeLB = event.getListBoxBean("themeLB");
    String theme = themeLB.getSelectedValue();

    User user = req.getUser();
    if (user != null) {
      user.setAttribute(User.THEME, theme);
      userManagerService.saveUser(user);
    }

    PortletPage page = layoutMgr.getPortletPage(req);
    page.setTheme(theme);
    layoutMgr.reloadPage(req);
  }
  public void doRender(FormEvent event) {
    PortletRequest req = event.getPortletRequest();

    req.setAttribute("lang", req.getLocale().getLanguage());

    ListBoxBean themeLB = event.getListBoxBean("themeLB");
    PortletPage page = layoutMgr.getPortletPage(req);
    String theme = page.getTheme();
    themeLB.clear();

    String themesPath = getPortletConfig().getContext().getRealPath("/themes");
    /// retrieve the current renderkit
    themesPath += "/" + page.getRenderKit();

    File f = new File(themesPath);
    if (f.isDirectory()) {
      themes = f.list();
    }

    for (int i = 0; i < themes.length; i++) {
      ListBoxItemBean lb = new ListBoxItemBean();
      lb.setValue(themes[i].trim());
      if (themes[i].trim().equalsIgnoreCase(theme)) lb.setSelected(true);
      themeLB.addBean(lb);
    }

    PortletTabbedPane pane = layoutMgr.getUserTabbedPane(req);
    List tabs;
    if (pane != null) {
      tabs = pane.getPortletTabs();
    } else {
      tabs = new ArrayList();
    }
    req.setAttribute("tabs", tabs);
    setNextState(req, VIEW_JSP);
  }