X-Git-Url: https://git.argeo.org/?a=blobdiff_plain;f=org.argeo.publishing.ui%2Fsrc%2Forg%2Fargeo%2Fdocbook%2Fui%2FDocumentTextEditor.java;fp=org.argeo.publishing.ui%2Fsrc%2Forg%2Fargeo%2Fdocbook%2Fui%2FDocumentTextEditor.java;h=61c0120e5ec722fdcc9645b24e5d0058f060e6eb;hb=3440f51df3e4c015972c7b6a0efb3ce16188b89b;hp=0000000000000000000000000000000000000000;hpb=752a7b2614895002a3d184be166ef4162caf0d05;p=gpl%2Fargeo-suite.git diff --git a/org.argeo.publishing.ui/src/org/argeo/docbook/ui/DocumentTextEditor.java b/org.argeo.publishing.ui/src/org/argeo/docbook/ui/DocumentTextEditor.java new file mode 100644 index 0000000..61c0120 --- /dev/null +++ b/org.argeo.publishing.ui/src/org/argeo/docbook/ui/DocumentTextEditor.java @@ -0,0 +1,37 @@ +package org.argeo.docbook.ui; + +import javax.jcr.Node; +import javax.jcr.RepositoryException; + +import org.argeo.cms.ui.CmsEditable; +import org.argeo.cms.ui.util.CmsUiUtils; +import org.argeo.docbook.DbkUtils; +import org.argeo.docbook.DbkType; +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) { + super(new TextSection(parent, style, textNode), style, cmsEditable); +// refresh(); + getMainSection().setLayoutData(CmsUiUtils.fillWidth()); + } + + @Override + protected void initModel(Node textNode) throws RepositoryException { + if (isFlat()) { + DbkUtils.addParagraph(textNode, ""); + } +// else +// textNode.setProperty(DocBookNames.DBK_TITLE, textNode.getName()); + } + + @Override + protected Boolean isModelInitialized(Node textNode) throws RepositoryException { + return textNode.hasNode(DbkType.title.get()) || textNode.hasNode(DbkType.para.get()) + || (!isFlat() && textNode.hasNode(DbkType.section.get())); + } + +}