Frames | No Frames |
1: /* =========================================================== 2: * JFreeChart : a free chart library for the Java(tm) platform 3: * =========================================================== 4: * 5: * (C) Copyright 2000-2005, by Object Refinery Limited and Contributors. 6: * 7: * Project Info: http://www.jfree.org/jfreechart/index.html 8: * 9: * This library is free software; you can redistribute it and/or modify it 10: * under the terms of the GNU Lesser General Public License as published by 11: * the Free Software Foundation; either version 2.1 of the License, or 12: * (at your option) any later version. 13: * 14: * This library is distributed in the hope that it will be useful, but 15: * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY 16: * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public 17: * License for more details. 18: * 19: * You should have received a copy of the GNU Lesser General Public 20: * License along with this library; if not, write to the Free Software 21: * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, 22: * USA. 23: * 24: * [Java is a trademark or registered trademark of Sun Microsystems, Inc. 25: * in the United States and other countries.] 26: * 27: * ------------------- 28: * AxisCollection.java 29: * ------------------- 30: * (C) Copyright 2003-2005, by Object Refinery Limited. 31: * 32: * Original Author: David Gilbert (for Object Refinery Limited); 33: * Contributor(s): -; 34: * 35: * $Id: AxisCollection.java,v 1.2.2.1 2005/10/25 20:37:34 mungady Exp $ 36: * 37: * Changes 38: * ------- 39: * 03-Nov-2003 : Added standard header (DG); 40: * 41: */ 42: 43: package org.jfree.chart.axis; 44: 45: import java.util.List; 46: 47: import org.jfree.ui.RectangleEdge; 48: 49: /** 50: * A collection of axes that have been assigned to the TOP, BOTTOM, LEFT or 51: * RIGHT of a chart. This class is used internally by JFreeChart, you won't 52: * normally need to use it yourself. 53: */ 54: public class AxisCollection { 55: 56: /** The axes that need to be drawn at the top of the plot area. */ 57: private List axesAtTop; 58: 59: /** The axes that need to be drawn at the bottom of the plot area. */ 60: private List axesAtBottom; 61: 62: /** The axes that need to be drawn at the left of the plot area. */ 63: private List axesAtLeft; 64: 65: /** The axes that need to be drawn at the right of the plot area. */ 66: private List axesAtRight; 67: 68: /** 69: * Creates a new empty collection. 70: */ 71: public AxisCollection() { 72: this.axesAtTop = new java.util.ArrayList(); 73: this.axesAtBottom = new java.util.ArrayList(); 74: this.axesAtLeft = new java.util.ArrayList(); 75: this.axesAtRight = new java.util.ArrayList(); 76: } 77: 78: /** 79: * Returns a list of the axes (if any) that need to be drawn at the top of 80: * the plot area. 81: * 82: * @return A list of axes. 83: */ 84: public List getAxesAtTop() { 85: return this.axesAtTop; 86: } 87: 88: /** 89: * Returns a list of the axes (if any) that need to be drawn at the bottom 90: * of the plot area. 91: * 92: * @return A list of axes. 93: */ 94: public List getAxesAtBottom() { 95: return this.axesAtBottom; 96: } 97: 98: /** 99: * Returns a list of the axes (if any) that need to be drawn at the left 100: * of the plot area. 101: * 102: * @return A list of axes. 103: */ 104: public List getAxesAtLeft() { 105: return this.axesAtLeft; 106: } 107: 108: /** 109: * Returns a list of the axes (if any) that need to be drawn at the right 110: * of the plot area. 111: * 112: * @return A list of axes. 113: */ 114: public List getAxesAtRight() { 115: return this.axesAtRight; 116: } 117: 118: /** 119: * Adds an axis to the collection. 120: * 121: * @param axis the axis (<code>null</code> not permitted). 122: * @param edge the edge of the plot that the axis should be drawn on 123: * (<code>null</code> not permitted). 124: */ 125: public void add(Axis axis, RectangleEdge edge) { 126: if (axis == null) { 127: throw new IllegalArgumentException("Null 'axis' argument."); 128: } 129: if (edge == null) { 130: throw new IllegalArgumentException("Null 'edge' argument."); 131: } 132: if (edge == RectangleEdge.TOP) { 133: this.axesAtTop.add(axis); 134: } 135: else if (edge == RectangleEdge.BOTTOM) { 136: this.axesAtBottom.add(axis); 137: } 138: else if (edge == RectangleEdge.LEFT) { 139: this.axesAtLeft.add(axis); 140: } 141: else if (edge == RectangleEdge.RIGHT) { 142: this.axesAtRight.add(axis); 143: } 144: } 145: 146: }