1 package org
.argeo
.app
.swt
.terms
;
3 import org
.argeo
.api
.acr
.Content
;
4 import org
.argeo
.api
.acr
.NamespaceUtils
;
5 import org
.argeo
.api
.acr
.spi
.ProvidedContent
;
6 import org
.argeo
.api
.cms
.ux
.CmsView
;
7 import org
.argeo
.app
.api
.EntityType
;
8 import org
.argeo
.app
.api
.TermsManager
;
9 import org
.argeo
.app
.ux
.SuiteUxEvent
;
10 import org
.argeo
.cms
.swt
.CmsSwtUtils
;
11 import org
.argeo
.cms
.swt
.acr
.SwtUiProvider
;
12 import org
.argeo
.cms
.swt
.widgets
.SwtTreeView
;
13 import org
.argeo
.cms
.ux
.acr
.ContentHierarchicalPart
;
14 import org
.eclipse
.swt
.layout
.GridLayout
;
15 import org
.eclipse
.swt
.widgets
.Composite
;
16 import org
.eclipse
.swt
.widgets
.Control
;
18 /** Entry area for managing the typologies. */
19 public class TermsEntryArea
implements SwtUiProvider
{
20 private TermsManager termsManager
;
23 public Control
createUiPart(Composite parent
, Content content
) {
24 // parent.setLayout(new GridLayout());
25 // Label lbl = new Label(parent, SWT.NONE);
26 // lbl.setText("Typologies");
28 // Set<Typology> typologies = termsManager.getTypologies();
29 // for (Typology typology : typologies) {
30 // new Label(parent, 0).setText(typology.getId());
35 CmsView cmsView
= CmsSwtUtils
.getCmsView(parent
);
37 parent
.setLayout(new GridLayout());
38 Content rootContent
= ((ProvidedContent
) content
).getSession().getRepository().get().get("/terms");
40 ContentHierarchicalPart contentPart
= new ContentHierarchicalPart() {
43 protected boolean isLeaf(Content content
) {
44 if (content
.hasContentClass(EntityType
.document
.qName()))
46 return super.isLeaf(content
);
50 contentPart
.addColumn((c
) -> NamespaceUtils
.toPrefixedName(c
.getName()));
51 // contentPart.setInput(rootContent);
53 SwtTreeView
<Content
> view
= new SwtTreeView
<>(parent
, 0, contentPart
);
54 view
.setLayoutData(CmsSwtUtils
.fillAll());
56 contentPart
.setInput(rootContent
);
57 // contentPart.onSelected((o) -> {
58 // Content c = (Content) o;
59 //// log.debug(c.getPath());
60 // cmsView.sendEvent(SuiteUxEvent.refreshPart.topic(), SuiteUxEvent.eventProperties(c));
66 public void setTermsManager(TermsManager termsManager
) {
67 this.termsManager
= termsManager
;