christian@3254: package de.intevation.flys.jfree; christian@3254: christian@3254: import java.awt.Color; christian@3254: christian@3254: import org.jfree.chart.plot.IntervalMarker; christian@3254: import org.w3c.dom.Document; christian@3254: christian@3464: import de.intevation.flys.utils.ThemeUtil; christian@3464: christian@3254: /** christian@3254: * Marker that represents a highlighted interval. christian@3889: * christian@3254: * @author Christian Lins christian@3254: */ christian@3254: public class StyledDomainMarker extends IntervalMarker { christian@3254: christian@3738: private static final long serialVersionUID = -4369417661339512342L; sascha@3256: christian@3254: private final Color fillColor, backgroundColor; sascha@3256: christian@3254: public StyledDomainMarker(double start, double end, Document theme) { christian@3254: super(start, end); sascha@3256: christian@3254: backgroundColor = ThemeUtil.parseColor( christian@3254: ThemeUtil.getBackgroundColorString(theme)); christian@3254: fillColor = ThemeUtil.parseColor( christian@3254: ThemeUtil.getFillColorString(theme)); christian@3254: useSecondColor(false); sascha@3256: christian@3889: int alpha = 100 - ThemeUtil.parseInteger( christian@3889: ThemeUtil.getTransparencyString(theme), 50); christian@3738: setAlpha(alpha / 100.0f); christian@3254: } sascha@3256: christian@3254: /** christian@3254: * To properly differentiate several styled domain markers side by side, christian@3254: * we can use this switch to toggle between two colors. christian@3254: * @param secondColor christian@3254: */ christian@3254: public void useSecondColor(boolean secondColor) { christian@3254: if(secondColor) { christian@3464: if(backgroundColor != null) christian@3464: setPaint(backgroundColor); christian@3254: } christian@3254: else { christian@3464: if(fillColor != null) christian@3464: setPaint(fillColor); christian@3254: } christian@3254: } christian@3254: } sascha@3259: // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :