public void execute(final Event<UIPortletForm> event) throws Exception {
      UIPortletForm uiPortletForm = event.getSource();
      UIPortlet uiPortlet = uiPortletForm.getUIPortlet();
      UIFormInputIconSelector uiIconSelector =
          uiPortletForm.getChild(UIFormInputIconSelector.class);
      uiPortletForm.invokeSetBindingBean(uiPortlet);
      if (uiIconSelector.getSelectedIcon().equals("Default")) {
        uiPortlet.setIcon("PortletIcon");
      } else {
        uiPortlet.setIcon(uiIconSelector.getSelectedIcon());
      }
      UIFormInputThemeSelector uiThemeSelector =
          uiPortletForm.getChild(UIFormInputThemeSelector.class);
      uiPortlet.putSuitedTheme(
          null, uiThemeSelector.getChild(UIItemThemeSelector.class).getSelectedTheme());
      uiPortletForm.savePreferences();
      UIMaskWorkspace uiMaskWorkspace = uiPortletForm.getParent();
      PortalRequestContext pcontext = (PortalRequestContext) event.getRequestContext();
      uiMaskWorkspace.createEvent("Close", Phase.DECODE, pcontext).broadcast();
      if (uiPortletForm.hasEditMode()) {
        uiPortlet.setCurrentPortletMode(PortletMode.VIEW);
      }

      String width = uiPortletForm.getUIStringInput("width").getValue();
      if (width == null || width.length() == 0) {
        uiPortlet.setWidth(null);
      } else {
        if (!width.endsWith("px")) {
          width.concat("px");
        }
        uiPortlet.setWidth(width);
      }

      String height = uiPortletForm.getUIStringInput("height").getValue();
      if (height == null || height.length() == 0) {
        uiPortlet.setHeight(null);
      } else {
        if (!height.endsWith("px")) {
          height.concat("px");
        }
        uiPortlet.setHeight(height);
      }

      pcontext
          .getJavascriptManager()
          .addJavascript("eXo.portal.PortalComposer.toggleSaveButton();");
      UIPortalApplication uiPortalApp = uiPortlet.getAncestorOfType(UIPortalApplication.class);
      UIWorkingWorkspace uiWorkingWS =
          uiPortalApp.getChildById(UIPortalApplication.UI_WORKING_WS_ID);
      pcontext.addUIComponentToUpdateByAjax(uiWorkingWS);
      pcontext.ignoreAJAXUpdateOnPortlets(true);
    }
 public void execute(final Event<UIPortletForm> event) throws Exception {
   UIPortletForm uiPortletForm = event.getSource();
   UIPortlet uiPortlet = uiPortletForm.getUIPortlet();
   if (uiPortletForm.hasEditMode()) {
     uiPortlet.setCurrentPortletMode(PortletMode.VIEW);
   }
   UIPortalApplication uiPortalApp = Util.getUIPortalApplication();
   PortalRequestContext pcontext = (PortalRequestContext) event.getRequestContext();
   // add by Pham Dinh Tan
   UIMaskWorkspace uiMaskWorkspace = uiPortalApp.getChildById(UIPortalApplication.UI_MASK_WS_ID);
   uiMaskWorkspace.broadcast(event, Phase.DECODE);
   pcontext.ignoreAJAXUpdateOnPortlets(true);
 }