teichmann@5831: package org.dive4elements.river.themes; christian@3464: teichmann@5831: import org.dive4elements.river.jfree.StableXYDifferenceRenderer; christian@3464: christian@3464: import java.awt.Color; christian@3464: import java.awt.Font; christian@3464: christian@3464: import org.apache.log4j.Logger; christian@3464: import org.jfree.chart.annotations.XYTextAnnotation; christian@3464: christian@3464: public class TextStyle { christian@3464: @SuppressWarnings("unused") christian@3464: private static Logger log = Logger.getLogger(TextStyle.class); christian@3464: christian@3464: protected Color textColor; christian@3464: protected Font font; christian@3464: protected Color bgColor; christian@3464: protected boolean showBg; christian@3464: protected boolean isVertical; christian@3464: christian@3464: public TextStyle(Color fgColor, Font font, Color bgColor, christian@3464: boolean showBg, boolean isVertical christian@3464: ) { christian@3464: this.textColor = fgColor; christian@3464: this.font = font; christian@3464: this.bgColor = bgColor; christian@3464: this.showBg = showBg; christian@3464: this.isVertical = isVertical; christian@3464: } christian@3464: christian@3464: public void apply(XYTextAnnotation ta) { christian@3464: ta.setPaint(textColor); christian@3464: ta.setFont(font); christian@3464: if (this.showBg) { christian@3464: ta.setBackgroundPaint(bgColor); christian@3464: } christian@3464: if (this.isVertical) { christian@3464: ta.setRotationAngle(270f*Math.PI/180f); christian@3464: } christian@3464: else { christian@3464: ta.setRotationAngle(0); christian@3464: } christian@3464: } christian@3464: christian@3464: public void apply(StableXYDifferenceRenderer renderer) { christian@3464: renderer.setLabelColor(textColor); christian@3464: renderer.setLabelFont(font); christian@3464: if (this.showBg) { christian@3464: renderer.setLabelBGColor(bgColor); christian@3464: } christian@3464: } christian@3464: }