]>
git.argeo.org Git - lgpl/argeo-commons.git/blob - org.argeo.cms.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
.CmsTypes
;
10 import org
.argeo
.cms
.ui
.CmsEditable
;
11 import org
.argeo
.cms
.ui
.internal
.text
.AbstractTextViewer
;
12 import org
.argeo
.cms
.util
.CmsUtils
;
13 import org
.argeo
.cms
.viewers
.Section
;
14 import org
.eclipse
.swt
.widgets
.Composite
;
16 /** Text editor where sections and subsections can be managed by the user. */
17 public class StandardTextEditor
extends AbstractTextViewer
{
18 private static final long serialVersionUID
= 6049661610883342325L;
20 public StandardTextEditor(Composite parent
, int style
, Node textNode
,
21 CmsEditable cmsEditable
) throws RepositoryException
{
22 super(new TextSection(parent
, style
, textNode
), style
, cmsEditable
);
24 getMainSection().setLayoutData(CmsUtils
.fillWidth());
28 protected void initModel(Node textNode
) throws RepositoryException
{
30 textNode
.addNode(CMS_P
).addMixin(CmsTypes
.CMS_STYLED
);
32 textNode
.setProperty(JCR_TITLE
, textNode
.getName());
36 protected Boolean
isModelInitialized(Node textNode
)
37 throws RepositoryException
{
38 return textNode
.hasProperty(Property
.JCR_TITLE
)
39 || textNode
.hasNode(CMS_P
)
40 || (!isFlat() && textNode
.hasNode(CMS_H
));
44 public Section
getMainSection() {
45 // TODO Auto-generated method stub
46 return super.getMainSection();