Author: tan_pham_dinh
Date: 2009-11-05 04:50:48 -0500 (Thu, 05 Nov 2009)
New Revision: 506
Modified:
portal/trunk/portlet/exoadmin/src/main/java/org/exoplatform/applicationregistry/webui/component/UIGadgetManagement.java
Log:
GTNPORTAL-141: Problem when delete gadgets model in ApplicationRegistry
Modified:
portal/trunk/portlet/exoadmin/src/main/java/org/exoplatform/applicationregistry/webui/component/UIGadgetManagement.java
===================================================================
---
portal/trunk/portlet/exoadmin/src/main/java/org/exoplatform/applicationregistry/webui/component/UIGadgetManagement.java 2009-11-05
09:45:37 UTC (rev 505)
+++
portal/trunk/portlet/exoadmin/src/main/java/org/exoplatform/applicationregistry/webui/component/UIGadgetManagement.java 2009-11-05
09:50:48 UTC (rev 506)
@@ -23,6 +23,9 @@
import org.exoplatform.application.gadget.GadgetRegistryService;
import org.exoplatform.application.gadget.Source;
import org.exoplatform.application.gadget.SourceStorage;
+import org.exoplatform.application.registry.Application;
+import org.exoplatform.application.registry.ApplicationCategory;
+import org.exoplatform.application.registry.ApplicationRegistryService;
import org.exoplatform.applicationregistry.webui.Util;
import org.exoplatform.web.WebAppController;
import org.exoplatform.web.application.ApplicationMessage;
@@ -185,9 +188,31 @@
sourceStorage.removeSource(dirPath + "/" + name +
".xml");
}
uiManagement.reload();
+
+ // update to ApplicationOrganizer
+ removeFromApplicationRegistry(name);
+ UIApplicationOrganizer uiOrganizer =
+
uiManagement.getParent().findFirstComponentOfType(UIApplicationOrganizer.class);
+ ApplicationCategory selectedCate = uiOrganizer.getSelectedCategory();
+ uiOrganizer.reload();
+ uiOrganizer.setSelectedCategory(selectedCate);
+
ctx.addUIComponentToUpdateByAjax(uiManagement);
}
+ private void removeFromApplicationRegistry(String name) throws Exception
+ {
+ ApplicationRegistryService appRegService =
+
org.exoplatform.portal.webui.util.Util.getUIPortalApplication().getApplicationComponent(
+ ApplicationRegistryService.class);
+ List<ApplicationCategory> cates =
appRegService.getApplicationCategories();
+ for (ApplicationCategory cate : cates)
+ {
+ Application app = appRegService.getApplication(cate.getName(), name);
+ if (app != null)
+ appRegService.remove(app);
+ }
+ }
}
public static class AddLocalGadgetActionListener extends
EventListener<UIGadgetManagement>
Show replies by date