Mercurial > dive4elements > river
diff flys-artifacts/src/main/java/de/intevation/flys/exports/ChartSection.java @ 1986:3632150dbe0b
Implemented a ChartSettings with relevant Sections and Attributes for charts (NOTE: Work still in progress).
flys-artifacts/trunk@3418 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author | Ingo Weinzierl <ingo.weinzierl@intevation.de> |
---|---|
date | Wed, 14 Dec 2011 14:17:31 +0000 |
parents | |
children | 2ae0627f956e |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/flys-artifacts/src/main/java/de/intevation/flys/exports/ChartSection.java Wed Dec 14 14:17:31 2011 +0000 @@ -0,0 +1,65 @@ +package de.intevation.flys.exports; + +import de.intevation.artifactdatabase.state.Attribute; +import de.intevation.artifactdatabase.state.DefaultSection; + + +/** + * @author <a href="mailto:ingo.weinzierl@intevation.de">Ingo Weinzierl</a> + */ +public class ChartSection extends DefaultSection { + + public static final String TITLE_ATTR = "title"; + public static final String SUBTITLE_ATTR = "subtitle"; + public static final String DISPLAYGRID_ATTR = "display-grid"; + + + public ChartSection() { + super("chart"); + } + + + public void setTitle(String title) { + if (title == null || title.length() == 0) { + return; + } + + Attribute attr = getAttribute(TITLE_ATTR); + if (attr == null) { + attr = new StringAttribute(TITLE_ATTR, title, true); + addAttribute(TITLE_ATTR, attr); + } + else { + attr.setValue(title); + } + } + + + public void setSubtitle(String subtitle) { + if (subtitle == null || subtitle.length() == 0) { + return; + } + + Attribute attr = getAttribute(SUBTITLE_ATTR); + if (attr == null) { + attr = new StringAttribute(SUBTITLE_ATTR, subtitle, true); + addAttribute(SUBTITLE_ATTR, attr); + } + else { + attr.setValue(subtitle); + } + } + + + public void setDisplayGird(boolean displayGrid) { + Attribute attr = getAttribute(DISPLAYGRID_ATTR); + if (attr == null) { + attr = new BooleanAttribute(DISPLAYGRID_ATTR, displayGrid, true); + addAttribute(DISPLAYGRID_ATTR, attr); + } + else { + attr.setValue(displayGrid); + } + } +} +// vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :