X-Git-Url: https://git.argeo.org/?p=gpl%2Fargeo-suite.git;a=blobdiff_plain;f=publishing%2Forg.argeo.publishing.ui%2Fsrc%2Forg%2Fargeo%2Fcms%2Ftext%2FTextSection.java;fp=publishing%2Forg.argeo.publishing.ui%2Fsrc%2Forg%2Fargeo%2Fcms%2Ftext%2FTextSection.java;h=b7b07797f922e0d66e38b7b1baa942eee08830b7;hp=0000000000000000000000000000000000000000;hb=147ada7da5bf6292569f17a53a77fca04c97f707;hpb=5431f941fd6161e89f495a330c2ecddaf4f6bfb1 diff --git a/publishing/org.argeo.publishing.ui/src/org/argeo/cms/text/TextSection.java b/publishing/org.argeo.publishing.ui/src/org/argeo/cms/text/TextSection.java new file mode 100644 index 0000000..b7b0779 --- /dev/null +++ b/publishing/org.argeo.publishing.ui/src/org/argeo/cms/text/TextSection.java @@ -0,0 +1,52 @@ +package org.argeo.cms.text; + +import javax.jcr.Node; +import javax.jcr.RepositoryException; + +import org.argeo.cms.ui.util.CmsUiUtils; +import org.argeo.cms.ui.viewers.Section; +import org.argeo.cms.ui.widgets.TextStyles; +import org.eclipse.swt.widgets.Composite; + +public class TextSection extends Section implements CmsNames { + private static final long serialVersionUID = -8625209546243220689L; + private String defaultTextStyle = TextStyles.TEXT_DEFAULT; + private String titleStyle; + + public TextSection(Composite parent, int style, Node node) + throws RepositoryException { + this(parent, findSection(parent), style, node); + } + + public TextSection(TextSection section, int style, Node node) + throws RepositoryException { + this(section, section.getParentSection(), style, node); + } + + private TextSection(Composite parent, Section parentSection, int style, + Node node) throws RepositoryException { + super(parent, parentSection, style, node); + CmsUiUtils.style(this, TextStyles.TEXT_SECTION); + } + + public String getDefaultTextStyle() { + return defaultTextStyle; + } + + public String getTitleStyle() { + if (titleStyle != null) + return titleStyle; + // TODO make base H styles configurable + Integer relativeDepth = getRelativeDepth(); + return relativeDepth == 0 ? TextStyles.TEXT_TITLE : TextStyles.TEXT_H + + relativeDepth; + } + + public void setDefaultTextStyle(String defaultTextStyle) { + this.defaultTextStyle = defaultTextStyle; + } + + public void setTitleStyle(String titleStyle) { + this.titleStyle = titleStyle; + } +}