]> git.argeo.org Git - lgpl/argeo-commons.git/blob - org.argeo.cms.ui/src/org/argeo/cms/text/TextSection.java
Improve DocBook
[lgpl/argeo-commons.git] / org.argeo.cms.ui / src / org / argeo / cms / text / TextSection.java
1 package org.argeo.cms.text;
2
3 import javax.jcr.Node;
4 import javax.jcr.RepositoryException;
5
6 import org.argeo.cms.CmsNames;
7 import org.argeo.cms.util.CmsUtils;
8 import org.argeo.cms.viewers.Section;
9 import org.eclipse.swt.widgets.Composite;
10
11 public class TextSection extends Section implements CmsNames {
12 private static final long serialVersionUID = -8625209546243220689L;
13 private String defaultTextStyle = TextStyles.TEXT_DEFAULT;
14 private String titleStyle;
15
16 public TextSection(Composite parent, int style, Node node)
17 throws RepositoryException {
18 this(parent, findSection(parent), style, node);
19 }
20
21 public TextSection(TextSection section, int style, Node node)
22 throws RepositoryException {
23 this(section, section.getParentSection(), style, node);
24 }
25
26 private TextSection(Composite parent, Section parentSection, int style,
27 Node node) throws RepositoryException {
28 super(parent, parentSection, style, node);
29 CmsUtils.style(this, TextStyles.TEXT_SECTION);
30 }
31
32 public String getDefaultTextStyle() {
33 return defaultTextStyle;
34 }
35
36 public String getTitleStyle() {
37 if (titleStyle != null)
38 return titleStyle;
39 // TODO make base H styles configurable
40 Integer relativeDepth = getRelativeDepth();
41 return relativeDepth == 0 ? TextStyles.TEXT_TITLE : TextStyles.TEXT_H
42 + relativeDepth;
43 }
44
45 public void setDefaultTextStyle(String defaultTextStyle) {
46 this.defaultTextStyle = defaultTextStyle;
47 }
48
49 public void setTitleStyle(String titleStyle) {
50 this.titleStyle = titleStyle;
51 }
52 }