1 23 24 package de.progra.charting; 25 26 import de.progra.charting.event.ChartDataModelListener; 27 import de.progra.charting.render.AbstractChartRenderer; 28 import de.progra.charting.render.AbstractRenderer; 29 import de.progra.charting.render.RowColorModel; 30 import java.awt.Rectangle ; 31 import java.awt.Graphics2D ; 32 import de.progra.charting.model.ChartDataModel; 33 import java.util.Map ; 34 import java.util.HashMap ; 35 import java.util.Iterator ; 36 37 41 public abstract class AbstractChart extends AbstractRenderer implements Chart { 42 43 protected HashMap renderer = new HashMap (); 44 45 protected Rectangle bounds; 46 protected Legend legend; 47 protected CoordSystem coord; 48 protected Title title; 49 protected RowColorModel rcModel; 50 51 protected ChartDataModel model; 52 53 54 public AbstractChart() { 55 } 56 57 61 public void addChartRenderer(AbstractChartRenderer render, int z) { 62 renderer.put(new Integer (z), render); 63 render.setRowColorModel(rcModel); 64 } 65 66 69 public Map getChartRenderer() { 70 return renderer; 71 } 72 73 77 public AbstractChartRenderer getChartRenderer(int z) { 78 return (AbstractChartRenderer)renderer.get(new Integer (z)); 79 } 80 81 84 public CoordSystem getCoordSystem() { 85 return coord; 86 } 87 88 91 public Legend getLegend() { 92 return legend; 93 } 94 95 98 public Title getTitle() { 99 return title; 100 } 101 102 105 public RowColorModel getRowColorModel() { 106 return rcModel; 107 } 108 109 113 public void setChartRenderer(Map render) { 114 Iterator i = render.values().iterator(); 115 int z = 0; 116 while(i.hasNext()) { 117 addChartRenderer((AbstractChartRenderer)i.next(), z); 118 } 119 } 120 121 127 public void setCoordSystem(CoordSystem c) { 128 coord = c; 129 } 130 131 134 public void setLegend(Legend l) { 135 legend = l; 136 } 137 138 141 public void setTitle(Title t) { 142 title = t; 143 } 144 145 148 public void setRowColorModel(RowColorModel rcm) { 149 this.rcModel = rcm; 150 } 151 152 155 public void setChartDataModel(ChartDataModel model) { 156 this.model = model; 157 } 158 159 162 public ChartDataModel getChartDataModel() { 163 return model; 164 } 165 166 170 public void setBounds(Rectangle r) { 171 this.bounds = r; 172 } 173 174 177 public Rectangle getBounds() { 178 return bounds; 179 } 180 181 187 public void paintDefault(Graphics2D g) { 188 } 189 190 194 public void render(Graphics2D g) {} 195 } | Popular Tags |