]>
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. */
15 public class StandardTextEditor
extends AbstractTextViewer
{
16 private static final long serialVersionUID
= 6049661610883342325L;
18 public StandardTextEditor(Composite parent
, int style
, Node textNode
,
19 CmsEditable cmsEditable
) throws RepositoryException
{
20 super(new TextSection(parent
, style
, textNode
), style
, cmsEditable
);
22 getMainSection().setLayoutData(CmsUiUtils
.fillWidth());
26 protected void initModel(Node textNode
) throws RepositoryException
{
28 textNode
.addNode(CMS_P
).addMixin(CmsTypes
.CMS_STYLED
);
30 textNode
.setProperty(JCR_TITLE
, textNode
.getName());
34 protected Boolean
isModelInitialized(Node textNode
)
35 throws RepositoryException
{
36 return textNode
.hasProperty(Property
.JCR_TITLE
)
37 || textNode
.hasNode(CMS_P
)
38 || (!isFlat() && textNode
.hasNode(CMS_H
));
42 public Section
getMainSection() {
43 // TODO Auto-generated method stub
44 return super.getMainSection();