]>
git.argeo.org Git - gpl/argeo-suite.git/blob - publishing/org.argeo.publishing.ui/src/org/argeo/cms/text/StandardTextEditor.java
1 package org
.argeo
.cms
.text
;
3 import static javax
.jcr
.Property
.JCR_TITLE
;
6 import javax
.jcr
.Property
;
7 import javax
.jcr
.RepositoryException
;
9 import org
.argeo
.cms
.ui
.CmsEditable
;
10 import org
.argeo
.cms
.ui
.util
.CmsUiUtils
;
11 import org
.argeo
.cms
.ui
.viewers
.Section
;
12 import org
.eclipse
.swt
.widgets
.Composite
;
14 /** Text editor where sections and subsections can be managed by the user. */
16 public class StandardTextEditor
extends AbstractTextViewer
{
17 private static final long serialVersionUID
= 6049661610883342325L;
19 public StandardTextEditor(Composite parent
, int style
, Node textNode
,
20 CmsEditable cmsEditable
) throws RepositoryException
{
21 super(new TextSection(parent
, style
, textNode
), style
, cmsEditable
);
23 getMainSection().setLayoutData(CmsUiUtils
.fillWidth());
27 protected void initModel(Node textNode
) throws RepositoryException
{
29 textNode
.addNode(CMS_P
).addMixin(CmsTypes
.CMS_STYLED
);
31 textNode
.setProperty(JCR_TITLE
, textNode
.getName());
35 protected Boolean
isModelInitialized(Node textNode
)
36 throws RepositoryException
{
37 return textNode
.hasProperty(Property
.JCR_TITLE
)
38 || textNode
.hasNode(CMS_P
)
39 || (!isFlat() && textNode
.hasNode(CMS_H
));
43 public Section
getMainSection() {
44 // TODO Auto-generated method stub
45 return super.getMainSection();