]>
git.argeo.org Git - gpl/argeo-suite.git/blob - publishing/org.argeo.publishing.ui/src/org/argeo/docbook/ui/DocumentTextEditor.java
1 package org
.argeo
.docbook
.ui
;
4 import javax
.jcr
.Property
;
5 import javax
.jcr
.RepositoryException
;
7 import org
.argeo
.cms
.text
.TextSection
;
8 import org
.argeo
.cms
.ui
.CmsEditable
;
9 import org
.argeo
.cms
.ui
.util
.CmsUiUtils
;
10 import org
.argeo
.jcr
.Jcr
;
11 import org
.argeo
.jcr
.JcrxType
;
12 import org
.eclipse
.swt
.widgets
.Composite
;
14 /** Text editor where sections and subsections can be managed by the user. */
15 public class DocumentTextEditor
extends AbstractDbkViewer
{
16 private static final long serialVersionUID
= 6049661610883342325L;
18 public DocumentTextEditor(Composite parent
, int style
, Node textNode
, CmsEditable cmsEditable
) {
19 super(new TextSection(parent
, style
, textNode
), style
, cmsEditable
);
21 getMainSection().setLayoutData(CmsUiUtils
.fillWidth());
25 protected void initModel(Node textNode
) throws RepositoryException
{
27 textNode
.addNode(DocBookNames
.DBK_PARA
, DocBookTypes
.PARA
).addNode(Jcr
.JCR_XMLTEXT
, JcrxType
.JCRX_XMLTEXT
)
28 .setProperty(Jcr
.JCR_XMLCHARACTERS
, "");
31 // textNode.setProperty(DocBookNames.DBK_TITLE, textNode.getName());
35 protected Boolean
isModelInitialized(Node textNode
) throws RepositoryException
{
36 return textNode
.hasProperty(Property
.JCR_TITLE
) || textNode
.hasNode(DocBookNames
.DBK_PARA
)
37 || (!isFlat() && textNode
.hasNode(DocBookNames
.DBK_SECTION
));