Major refactoring of Argeo CMS UI
[lgpl/argeo-commons.git] / org.argeo.cms.ui / src / org / argeo / cms / ui / AbstractCmsApp.java
diff --git a/org.argeo.cms.ui/src/org/argeo/cms/ui/AbstractCmsApp.java b/org.argeo.cms.ui/src/org/argeo/cms/ui/AbstractCmsApp.java
deleted file mode 100644 (file)
index 77cd983..0000000
+++ /dev/null
@@ -1,79 +0,0 @@
-package org.argeo.cms.ui;
-
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
-import javax.jcr.Repository;
-
-import org.eclipse.rap.rwt.RWT;
-
-/** Base class for {@link CmsApp}s. */
-public abstract class AbstractCmsApp implements CmsApp {
-       private Map<String, CmsTheme> themes = Collections.synchronizedMap(new HashMap<>());
-
-       private List<CmsAppListener> cmsAppListeners = new ArrayList<>();
-
-       private Repository repository;
-
-       protected abstract String getThemeId(String uiName);
-
-       @Override
-       public CmsTheme getTheme(String uiName) {
-               String themeId = getThemeId(uiName);
-               if (themeId == null)
-                       return null;
-               if (!themes.containsKey(themeId))
-                       throw new IllegalArgumentException("Theme " + themeId + " not found.");
-               return themes.get(themeId);
-       }
-
-       @Override
-       public boolean allThemesAvailable() {
-               boolean themeMissing = false;
-               uiNames: for (String uiName : getUiNames()) {
-                       String themeId = getThemeId(uiName);
-                       if (RWT.DEFAULT_THEME_ID.equals(themeId))
-                               continue uiNames;
-                       if (!themes.containsKey(themeId)) {
-                               themeMissing = true;
-                               break uiNames;
-                       }
-               }
-               return !themeMissing;
-       }
-
-       public void addTheme(CmsTheme theme, Map<String, String> properties) {
-               themes.put(theme.getThemeId(), theme);
-               if (allThemesAvailable())
-                       for (CmsAppListener listener : cmsAppListeners)
-                               listener.themingUpdated();
-       }
-
-       public void removeTheme(CmsTheme theme, Map<String, String> properties) {
-               themes.remove(theme.getThemeId());
-       }
-
-       @Override
-       public void addCmsAppListener(CmsAppListener listener) {
-               cmsAppListeners.add(listener);
-               if (allThemesAvailable())
-                       listener.themingUpdated();
-       }
-
-       @Override
-       public void removeCmsAppListener(CmsAppListener listener) {
-               cmsAppListeners.remove(listener);
-       }
-
-       protected Repository getRepository() {
-               return repository;
-       }
-
-       public void setRepository(Repository repository) {
-               this.repository = repository;
-       }
-
-}