]>
git.argeo.org Git - lgpl/argeo-commons.git/blob - org.argeo.cms.ui/src/org/argeo/cms/ui/AbstractCmsApp.java
1 package org
.argeo
.cms
.ui
;
3 import java
.util
.ArrayList
;
4 import java
.util
.Collections
;
5 import java
.util
.HashMap
;
10 import javax
.jcr
.Repository
;
12 import org
.eclipse
.rap
.rwt
.RWT
;
14 /** Base class for {@link CmsApp}s. */
15 public abstract class AbstractCmsApp
implements CmsApp
{
16 private Map
<String
, CmsTheme
> themes
= Collections
.synchronizedMap(new HashMap
<>());
18 private List
<CmsAppListener
> cmsAppListeners
= new ArrayList
<>();
20 private Repository repository
;
23 public Set
<String
> getUiNames() {
24 // TODO Auto-generated method stub
28 protected abstract String
getThemeId(String uiName
);
31 public CmsTheme
getTheme(String uiName
) {
32 String themeId
= getThemeId(uiName
);
35 return themes
.get(themeId
);
38 protected boolean allThemesAvailable() {
39 boolean themeMissing
= false;
40 uiNames
: for (String uiName
: getUiNames()) {
41 String themeId
= getThemeId(uiName
);
42 if (RWT
.DEFAULT_THEME_ID
.equals(themeId
))
44 if (!themes
.containsKey(themeId
)) {
52 public void addTheme(CmsTheme theme
, Map
<String
, String
> properties
) {
53 themes
.put(theme
.getThemeId(), theme
);
54 if (allThemesAvailable())
55 for (CmsAppListener listener
: cmsAppListeners
)
56 listener
.themingUpdated();
59 public void removeTheme(CmsTheme theme
, Map
<String
, String
> properties
) {
60 themes
.remove(theme
.getThemeId());
64 public void addCmsAppListener(CmsAppListener listener
) {
65 cmsAppListeners
.add(listener
);
66 if (allThemesAvailable())
67 listener
.themingUpdated();
71 public void removeCmsAppListener(CmsAppListener listener
) {
72 cmsAppListeners
.remove(listener
);
75 protected Repository
getRepository() {
79 public void setRepository(Repository repository
) {
80 this.repository
= repository
;