Mercurial > dive4elements > river
diff flys-artifacts/src/main/java/de/intevation/flys/exports/LegendSection.java @ 2058:f97cf2e350c9
Some refactoring done: all Sections subclass TypeSection now to be able to use the convinience methods for string, integer, double and boolean attributes.
flys-artifacts/trunk@3550 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author | Ingo Weinzierl <ingo.weinzierl@intevation.de> |
---|---|
date | Tue, 27 Dec 2011 11:37:23 +0000 |
parents | 2ae0627f956e |
children | ca8997aa683e |
line wrap: on
line diff
--- a/flys-artifacts/src/main/java/de/intevation/flys/exports/LegendSection.java Tue Dec 27 11:19:44 2011 +0000 +++ b/flys-artifacts/src/main/java/de/intevation/flys/exports/LegendSection.java Tue Dec 27 11:37:23 2011 +0000 @@ -7,7 +7,7 @@ /** * @author <a href="mailto:ingo.weinzierl@intevation.de">Ingo Weinzierl</a> */ -public class LegendSection extends DefaultSection { +public class LegendSection extends TypeSection { public static final String VISIBILITY_ATTR = "visibility"; public static final String FONTSIZE_ATTR = "font-size"; @@ -23,38 +23,22 @@ return; } - Attribute attr = getAttribute(FONTSIZE_ATTR); - if (attr == null) { - attr = new IntegerAttribute(FONTSIZE_ATTR, fontSize, true); - addAttribute(FONTSIZE_ATTR, attr); - } - else { - attr.setValue(fontSize); - } + setIntegerValue(FONTSIZE_ATTR, fontSize); } public Integer getFontSize() { - IntegerAttribute ia = (IntegerAttribute) getAttribute(FONTSIZE_ATTR); - return ia != null ? (Integer) ia.getValue() : null; + return getIntegerValue(FONTSIZE_ATTR); } public void setVisibility(boolean visibility) { - Attribute attr = getAttribute(VISIBILITY_ATTR); - if (attr == null) { - attr = new BooleanAttribute(VISIBILITY_ATTR, visibility, true); - addAttribute(VISIBILITY_ATTR, attr); - } - else { - attr.setValue(visibility); - } + setBooleanValue(VISIBILITY_ATTR, visibility); } public Boolean getVisibility() { - BooleanAttribute ba = (BooleanAttribute) getAttribute(VISIBILITY_ATTR); - return ba != null ? (Boolean ) ba.getValue() : null; + return getBooleanValue(VISIBILITY_ATTR); } } // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :