1 19 package jcckit.graphic; 20 21 import jcckit.util.ConfigParameters; 22 23 import java.awt.Color ; 24 25 31 public class BasicGraphicAttributes extends ShapeAttributes 32 implements TextAttributes { 33 34 public static final String TEXT_COLOR_KEY = "textColor", 35 FONT_NAME_KEY = "fontName", 36 FONT_STYLE_KEY = "fontStyle", 37 FONT_SIZE_KEY = "fontSize", 38 HORIZONTAL_ANCHOR_KEY = "horizontalAnchor", 39 VERTICAL_ANCHOR_KEY = "verticalAnchor", 40 ORIENTATION_ANGLE_KEY = "orientationAngle"; 41 42 private final Color _textColor; 43 private final String _fontName; 44 private final FontStyle _fontStyle; 45 private final double _fontSize; 46 private final double _orientationAngle; 47 private final Anchor _horizontalAnchor; 48 private final Anchor _verticalAnchor; 49 50 94 public BasicGraphicAttributes(ConfigParameters config) { 95 super(config); 96 _textColor = config.getColor(TEXT_COLOR_KEY, null); 97 _fontName = config.get(FONT_NAME_KEY, null); 98 _fontStyle = FontStyle.getFontStyle(config, FONT_STYLE_KEY, 99 FontStyle.NORMAL); 100 _fontSize = config.getDouble(FONT_SIZE_KEY, 0); 101 _orientationAngle = config.getDouble(ORIENTATION_ANGLE_KEY, 0); 102 103 _horizontalAnchor = Anchor.getHorizontalAnchor(config, 104 HORIZONTAL_ANCHOR_KEY, Anchor.LEFT_BOTTOM); 105 _verticalAnchor = Anchor.getVerticalAnchor(config, 106 VERTICAL_ANCHOR_KEY, Anchor.CENTER); 107 } 108 109 125 public BasicGraphicAttributes(Color fillColor, Color lineColor, 126 double lineThickness, 127 double[] linePattern, Color textColor, 128 String fontName, FontStyle fontStyle, 129 double fontSize, double orientationAngle, 130 Anchor horizontalAnchor, 131 Anchor verticalAnchor) { 132 super(fillColor, lineColor, lineThickness, linePattern); 133 _textColor = textColor; 134 _fontName = fontName; 135 _fontStyle = fontStyle; 136 _fontSize = fontSize; 137 _orientationAngle = orientationAngle; 138 _horizontalAnchor = horizontalAnchor; 139 _verticalAnchor = verticalAnchor; 140 } 141 142 146 public Color getTextColor() { 147 return _textColor; 148 } 149 150 154 public String getFontName() { 155 return _fontName; 156 } 157 158 162 public FontStyle getFontStyle() { 163 return _fontStyle; 164 } 165 166 169 public double getFontSize() { 170 return _fontSize; 171 } 172 173 178 public double getOrientationAngle() { 179 return _orientationAngle; 180 } 181 182 188 public Anchor getHorizontalAnchor() { 189 return _horizontalAnchor; 190 } 191 192 198 public Anchor getVerticalAnchor() { 199 return _verticalAnchor; 200 } 201 } 202 203 | Popular Tags |