X-Git-Url: https://git.argeo.org/?p=gpl%2Fargeo-suite.git;a=blobdiff_plain;f=publishing%2Forg.argeo.publishing.ui%2Fsrc%2Forg%2Fargeo%2Fdocbook%2Fui%2FDocumentTextEditor.java;h=6bb8d438516a055790380b8bff42028827958cb3;hp=9dc7e1002dea7e68d91f6f4eb1a28532b5a05f75;hb=4bd6cf0556f597ee73c8f13df45019ccf9e418a6;hpb=147ada7da5bf6292569f17a53a77fca04c97f707 diff --git a/publishing/org.argeo.publishing.ui/src/org/argeo/docbook/ui/DocumentTextEditor.java b/publishing/org.argeo.publishing.ui/src/org/argeo/docbook/ui/DocumentTextEditor.java index 9dc7e10..6bb8d43 100644 --- a/publishing/org.argeo.publishing.ui/src/org/argeo/docbook/ui/DocumentTextEditor.java +++ b/publishing/org.argeo.publishing.ui/src/org/argeo/docbook/ui/DocumentTextEditor.java @@ -1,20 +1,23 @@ package org.argeo.docbook.ui; import javax.jcr.Node; -import javax.jcr.Property; import javax.jcr.RepositoryException; import org.argeo.cms.text.TextSection; import org.argeo.cms.ui.CmsEditable; import org.argeo.cms.ui.util.CmsUiUtils; +import org.argeo.docbook.DbkUtils; +import org.argeo.docbook.DocBookNames; +import org.argeo.docbook.DocBookType; +import org.argeo.jcr.Jcr; +import org.argeo.jcr.JcrxType; import org.eclipse.swt.widgets.Composite; /** Text editor where sections and subsections can be managed by the user. */ public class DocumentTextEditor extends AbstractDbkViewer { private static final long serialVersionUID = 6049661610883342325L; - public DocumentTextEditor(Composite parent, int style, Node textNode, CmsEditable cmsEditable) - throws RepositoryException { + public DocumentTextEditor(Composite parent, int style, Node textNode, CmsEditable cmsEditable) { super(new TextSection(parent, style, textNode), style, cmsEditable); refresh(); getMainSection().setLayoutData(CmsUiUtils.fillWidth()); @@ -23,9 +26,7 @@ public class DocumentTextEditor extends AbstractDbkViewer { @Override protected void initModel(Node textNode) throws RepositoryException { if (isFlat()) { - textNode.addNode(DocBookNames.DBK_PARA, DocBookTypes.PARA) - .addNode(DocBookNames.JCR_XMLTEXT, DocBookTypes.XMLTEXT) - .setProperty(DocBookNames.JCR_XMLCHARACTERS, "Hello World!"); + DbkUtils.addParagraph(textNode, ""); } // else // textNode.setProperty(DocBookNames.DBK_TITLE, textNode.getName()); @@ -33,8 +34,8 @@ public class DocumentTextEditor extends AbstractDbkViewer { @Override protected Boolean isModelInitialized(Node textNode) throws RepositoryException { - return textNode.hasProperty(Property.JCR_TITLE) || textNode.hasNode(DocBookNames.DBK_PARA) - || (!isFlat() && textNode.hasNode(DocBookNames.DBK_SECTION)); + return textNode.hasNode(DocBookType.title.get()) || textNode.hasNode(DocBookType.para.get()) + || (!isFlat() && textNode.hasNode(DocBookType.section.get())); } }