1 package org
.argeo
.cms
.swt
.app
;
4 import java
.nio
.file
.Path
;
5 import java
.nio
.file
.spi
.FileSystemProvider
;
6 import java
.util
.HashSet
;
9 import org
.argeo
.api
.acr
.Content
;
10 import org
.argeo
.api
.acr
.ContentRepository
;
11 import org
.argeo
.api
.cms
.ux
.CmsUi
;
12 import org
.argeo
.api
.cms
.ux
.CmsView
;
13 import org
.argeo
.cms
.AbstractCmsApp
;
14 import org
.argeo
.cms
.swt
.CmsSwtUi
;
15 import org
.argeo
.cms
.swt
.CmsSwtUtils
;
16 import org
.argeo
.cms
.swt
.auth
.CmsLogin
;
17 import org
.argeo
.eclipse
.ui
.fs
.SimpleFsBrowser
;
18 import org
.eclipse
.swt
.SWT
;
19 import org
.eclipse
.swt
.widgets
.Composite
;
21 public class CmsUserApp
extends AbstractCmsApp
{
22 private ContentRepository contentRepository
;
24 private FileSystemProvider cmsFileSystemProvider
;
27 public Set
<String
> getUiNames() {
28 Set
<String
> uiNames
= new HashSet
<>();
35 public CmsUi
initUi(Object uiParent
) {
36 Composite parent
= (Composite
) uiParent
;
37 String uiName
= parent
.getData(UI_NAME_PROPERTY
) != null ? parent
.getData(UI_NAME_PROPERTY
).toString() : null;
38 CmsSwtUi cmsUi
= new CmsSwtUi(parent
, SWT
.NONE
);
39 if ("login".equals(uiName
)) {
40 CmsView cmsView
= CmsSwtUtils
.getCmsView(cmsUi
);
41 CmsLogin cmsLogin
= new CmsLogin(cmsView
, getCmsContext());
42 cmsLogin
.createUi(cmsUi
);
44 } else if ("data".equals(uiName
)) {
45 Content rootContent
= contentRepository
.get().get("/");
46 AcrContentTreeView view
= new AcrContentTreeView(cmsUi
, 0, rootContent
);
47 view
.setLayoutData(CmsSwtUtils
.fillAll());
49 } else if ("app".equals(uiName
)) {
50 Path rootPath
= cmsFileSystemProvider
.getPath(URI
.create("cms:///"));
51 SimpleFsBrowser view
= new SimpleFsBrowser(cmsUi
, 0);
52 view
.setInput(rootPath
);
53 view
.setLayoutData(CmsSwtUtils
.fillAll());
60 public void refreshUi(CmsUi cmsUi
, String state
) {
64 public void setState(CmsUi cmsUi
, String state
) {
65 // TODO Auto-generated method stub
69 public void setContentRepository(ContentRepository contentRepository
) {
70 this.contentRepository
= contentRepository
;
73 public void setCmsFileSystemProvider(FileSystemProvider cmsFileSystemProvider
) {
74 this.cmsFileSystemProvider
= cmsFileSystemProvider
;