]>
git.argeo.org Git - gpl/argeo-suite.git/blob - publishing/org.argeo.publishing.ui/src/org/argeo/cms/text/TextSection.java
1 package org
.argeo
.cms
.text
;
5 import org
.argeo
.cms
.ui
.util
.CmsUiUtils
;
6 import org
.argeo
.cms
.ui
.viewers
.EditablePart
;
7 import org
.argeo
.cms
.ui
.viewers
.Section
;
8 import org
.argeo
.cms
.ui
.widgets
.TextStyles
;
9 import org
.eclipse
.swt
.SWT
;
10 import org
.eclipse
.swt
.widgets
.Composite
;
11 import org
.eclipse
.swt
.widgets
.Control
;
13 /** An editable section. */
14 public class TextSection
extends Section
{
15 private static final long serialVersionUID
= -8625209546243220689L;
16 private String defaultTextStyle
= TextStyles
.TEXT_DEFAULT
;
17 private String titleStyle
;
19 private final boolean flat
;
21 private boolean titleReadOnly
= false;
23 public TextSection(Composite parent
, int style
, Node node
) {
24 this(parent
, findSection(parent
), style
, node
);
27 public TextSection(TextSection section
, int style
, Node node
) {
28 this(section
, section
.getParentSection(), style
, node
);
31 private TextSection(Composite parent
, Section parentSection
, int style
, Node node
) {
32 super(parent
, parentSection
, style
, node
);
33 flat
= SWT
.FLAT
== (style
& SWT
.FLAT
);
34 // CmsUiUtils.style(this, TextStyles.TEXT_SECTION);
37 public String
getDefaultTextStyle() {
38 return defaultTextStyle
;
41 public boolean isFlat() {
45 public String
getTitleStyle() {
46 if (titleStyle
!= null)
48 // TODO make base H styles configurable
49 Integer relativeDepth
= getRelativeDepth();
50 return relativeDepth
== 0 ? TextStyles
.TEXT_TITLE
: TextStyles
.TEXT_H
+ relativeDepth
;
53 public void setDefaultTextStyle(String defaultTextStyle
) {
54 this.defaultTextStyle
= defaultTextStyle
;
57 public void setTitleStyle(String titleStyle
) {
58 this.titleStyle
= titleStyle
;
61 public boolean isTitleReadOnly() {
65 public void setTitleReadOnly(boolean titleReadOnly
) {
66 this.titleReadOnly
= titleReadOnly
;