import java.util.ArrayList;
import java.util.Collections;
+import java.util.HashMap;
import java.util.List;
import java.util.Map;
-import java.util.Set;
-import java.util.TreeMap;
+
+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.synchronizedSortedMap(new TreeMap<>());
+ private Map<String, CmsTheme> themes = Collections.synchronizedMap(new HashMap<>());
private List<CmsAppListener> cmsAppListeners = new ArrayList<>();
- @Override
- public Set<String> getUiNames() {
- // TODO Auto-generated method stub
- return null;
- }
+ private Repository repository;
protected abstract String getThemeId(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);
}
- protected boolean allThemesAvailable() {
+ @Override
+ public boolean allThemesAvailable() {
boolean themeMissing = false;
uiNames: for (String uiName : getUiNames()) {
String themeId = getThemeId(uiName);
cmsAppListeners.remove(listener);
}
+ protected Repository getRepository() {
+ return repository;
+ }
+
+ public void setRepository(Repository repository) {
+ this.repository = repository;
+ }
+
}