]> git.argeo.org Git - gpl/argeo-suite.git/blob - publishing/org.argeo.publishing.ui/src/org/argeo/docbook/ui/DocumentTextEditor.java
Do not refresh UI right away.
[gpl/argeo-suite.git] / publishing / org.argeo.publishing.ui / src / org / argeo / docbook / ui / DocumentTextEditor.java
1 package org.argeo.docbook.ui;
2
3 import javax.jcr.Node;
4 import javax.jcr.RepositoryException;
5
6 import org.argeo.cms.text.TextSection;
7 import org.argeo.cms.ui.CmsEditable;
8 import org.argeo.cms.ui.util.CmsUiUtils;
9 import org.argeo.docbook.DbkUtils;
10 import org.argeo.docbook.DbkType;
11 import org.eclipse.swt.widgets.Composite;
12
13 /** Text editor where sections and subsections can be managed by the user. */
14 public class DocumentTextEditor extends AbstractDbkViewer {
15 private static final long serialVersionUID = 6049661610883342325L;
16
17 public DocumentTextEditor(Composite parent, int style, Node textNode, CmsEditable cmsEditable) {
18 super(new TextSection(parent, style, textNode), style, cmsEditable);
19 refresh();
20 getMainSection().setLayoutData(CmsUiUtils.fillWidth());
21 }
22
23 @Override
24 protected void initModel(Node textNode) throws RepositoryException {
25 if (isFlat()) {
26 DbkUtils.addParagraph(textNode, "");
27 }
28 // else
29 // textNode.setProperty(DocBookNames.DBK_TITLE, textNode.getName());
30 }
31
32 @Override
33 protected Boolean isModelInitialized(Node textNode) throws RepositoryException {
34 return textNode.hasNode(DbkType.title.get()) || textNode.hasNode(DbkType.para.get())
35 || (!isFlat() && textNode.hasNode(DbkType.section.get()));
36 }
37
38 }