1 package org
.argeo
.suite
.ui
;
4 import javax
.jcr
.RepositoryException
;
6 import org
.argeo
.cms
.ui
.CmsTheme
;
7 import org
.argeo
.cms
.ui
.CmsUiProvider
;
8 import org
.argeo
.cms
.ui
.util
.CmsUiUtils
;
9 import org
.argeo
.cms
.ui
.widgets
.TabbedArea
;
10 import org
.eclipse
.swt
.SWT
;
11 import org
.eclipse
.swt
.custom
.SashForm
;
12 import org
.eclipse
.swt
.layout
.GridLayout
;
13 import org
.eclipse
.swt
.widgets
.Composite
;
14 import org
.eclipse
.swt
.widgets
.Control
;
16 /** An app layer based on an entry area and an editor area. */
17 public class DefaultEditionLayer
implements SuiteLayer
{
18 private CmsUiProvider entryArea
;
21 public Control
createUi(Composite parent
, Node context
) throws RepositoryException
{
22 DefaultEditionArea workArea
= new DefaultEditionArea(parent
, parent
.getStyle());
23 if (entryArea
!= null) {
24 entryArea
.createUi(workArea
.getEntryArea(), context
);
30 public void view(CmsUiProvider uiProvider
, Composite workArea
, Node context
) {
31 TabbedArea tabbedArea
= ((DefaultEditionArea
) workArea
).getTabbedArea();
32 tabbedArea
.view(uiProvider
, context
);
36 public void open(CmsUiProvider uiProvider
, Composite workArea
, Node context
) {
37 TabbedArea tabbedArea
= ((DefaultEditionArea
) workArea
).getTabbedArea();
38 tabbedArea
.open(uiProvider
, context
);
41 public void setEntryArea(CmsUiProvider entryArea
) {
42 this.entryArea
= entryArea
;
45 class DefaultEditionArea
extends SashForm
{
46 private static final long serialVersionUID
= 2219125778722702618L;
47 private CmsTheme theme
;
48 // private SashForm area;
49 private Composite entryArea
;
50 private Composite editorArea
;
51 private TabbedArea tabbedArea
;
53 DefaultEditionArea(Composite parent
, int style
) {
54 super(parent
, SWT
.HORIZONTAL
);
55 theme
= CmsTheme
.getCmsTheme(parent
);
56 // area = new SashForm(parent, SWT.HORIZONTAL);
57 // area.setLayoutData(CmsUiUtils.coversAll());
59 if (SWT
.RIGHT_TO_LEFT
== (style
& SWT
.RIGHT_TO_LEFT
)) {// arabic, hebrew, etc.
60 editorArea
= new Composite(this, SWT
.BORDER
);
61 entryArea
= new Composite(this, SWT
.BORDER
);
63 entryArea
= new Composite(this, SWT
.NONE
);
64 editorArea
= new Composite(this, SWT
.NONE
);
66 int[] weights
= new int[] { 2000, 8000 };
68 // editorArea.setLayout(CmsUiUtils.noSpaceGridLayout());
69 editorArea
.setLayout(new GridLayout());
71 tabbedArea
= new TabbedArea(editorArea
, SWT
.NONE
);
72 tabbedArea
.setBodyStyle(SuiteStyle
.mainTabBody
.toStyleClass());
73 tabbedArea
.setTabStyle(SuiteStyle
.mainTab
.toStyleClass());
74 tabbedArea
.setTabSelectedStyle(SuiteStyle
.mainTabSelected
.toStyleClass());
75 tabbedArea
.setCloseIcon(SuiteIcon
.close
.getSmallIcon(theme
));
76 tabbedArea
.setLayoutData(CmsUiUtils
.fillAll());
79 // Composite getArea() {
83 public Composite
getEntryArea() {
87 public TabbedArea
getTabbedArea() {