view flys-artifacts/src/main/java/de/intevation/flys/jfree/StyledDomainMarker.java @ 3256:17ca0a43027a

Removed trailing whitespace flys-artifacts/trunk@4890 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author Sascha L. Teichmann <sascha.teichmann@intevation.de>
date Sat, 07 Jul 2012 09:23:33 +0000
parents 9a4707ec7800
children 9422b559b2d5
line wrap: on
line source
package de.intevation.flys.jfree;

import de.intevation.flys.utils.ThemeUtil;

import java.awt.Color;

import org.jfree.chart.plot.IntervalMarker;
import org.w3c.dom.Document;

/**
 * Marker that represents a highlighted interval.
 * @author <a href="mailto:christian.lins@intevation.de">Christian Lins</a>
 */
public class StyledDomainMarker extends IntervalMarker {

    private static final long serialVersionUID = -4369410661339512342L;

    private final Color fillColor, backgroundColor;

    public StyledDomainMarker(double start, double end, Document theme) {
        super(start, end);

        backgroundColor = ThemeUtil.parseColor(
                ThemeUtil.getBackgroundColorString(theme));
        fillColor = ThemeUtil.parseColor(
                ThemeUtil.getFillColorString(theme));
        useSecondColor(false);

        int alpha = ThemeUtil.parseInteger(ThemeUtil.getTransparencyAlpha(theme), 128);
        setAlpha(alpha / 255.0f);
    }

    /**
     * To properly differentiate several styled domain markers side by side,
     * we can use this switch to toggle between two colors.
     * @param secondColor
     */
    public void useSecondColor(boolean secondColor) {
        if(secondColor) {
            setPaint(backgroundColor);
        }
        else {
            setPaint(fillColor);
        }
    }
}

http://dive4elements.wald.intevation.org