]> git.argeo.org Git - gpl/argeo-suite.git/blob - publishing/org.argeo.publishing.ui/src/org/argeo/cms/text/StandardTextEditor.java
Rename base Eclipse project.
[gpl/argeo-suite.git] / publishing / org.argeo.publishing.ui / src / org / argeo / cms / text / StandardTextEditor.java
1 package org.argeo.cms.text;
2
3 import static javax.jcr.Property.JCR_TITLE;
4
5 import javax.jcr.Node;
6 import javax.jcr.Property;
7 import javax.jcr.RepositoryException;
8
9 import org.argeo.cms.ui.CmsEditable;
10 import org.argeo.cms.ui.util.CmsUiUtils;
11 import org.argeo.cms.ui.viewers.Section;
12 import org.eclipse.swt.widgets.Composite;
13
14 /** Text editor where sections and subsections can be managed by the user. */
15 @Deprecated
16 public class StandardTextEditor extends AbstractTextViewer {
17 private static final long serialVersionUID = 6049661610883342325L;
18
19 public StandardTextEditor(Composite parent, int style, Node textNode,
20 CmsEditable cmsEditable) throws RepositoryException {
21 super(new TextSection(parent, style, textNode), style, cmsEditable);
22 refresh();
23 getMainSection().setLayoutData(CmsUiUtils.fillWidth());
24 }
25
26 @Override
27 protected void initModel(Node textNode) throws RepositoryException {
28 if (isFlat())
29 textNode.addNode(CMS_P).addMixin(CmsTypes.CMS_STYLED);
30 else
31 textNode.setProperty(JCR_TITLE, textNode.getName());
32 }
33
34 @Override
35 protected Boolean isModelInitialized(Node textNode)
36 throws RepositoryException {
37 return textNode.hasProperty(Property.JCR_TITLE)
38 || textNode.hasNode(CMS_P)
39 || (!isFlat() && textNode.hasNode(CMS_H));
40 }
41
42 @Override
43 public Section getMainSection() {
44 // TODO Auto-generated method stub
45 return super.getMainSection();
46 }
47 }