christian@3254: package de.intevation.flys.jfree; christian@3254: christian@3254: import de.intevation.flys.utils.ThemeUtil; 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@3254: /** christian@3254: * Marker that represents a highlighted interval. christian@3254: * @author Christian Lins christian@3254: */ christian@3254: public class StyledDomainMarker extends IntervalMarker { christian@3254: christian@3254: private static final long serialVersionUID = -4369410661339512342L; 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@3254: int alpha = ThemeUtil.parseInteger(ThemeUtil.getTransparencyAlpha(theme), 128); christian@3254: setAlpha(alpha / 255.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@3254: setPaint(backgroundColor); christian@3254: } christian@3254: else { christian@3254: setPaint(fillColor); christian@3254: } christian@3254: } christian@3254: } sascha@3259: // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :