|
|||||||||||||||||||
| Source file | Conditionals | Statements | Methods | TOTAL | |||||||||||||||
| Axis.java | 0% | 0% | 0% | 0% |
|
||||||||||||||
| 1 |
/*
|
|
| 2 |
* EJTools, the Enterprise Java Tools
|
|
| 3 |
*
|
|
| 4 |
* Distributable under LGPL license.
|
|
| 5 |
* See terms of license at www.gnu.org.
|
|
| 6 |
*/
|
|
| 7 |
package org.ejtools.graph;
|
|
| 8 |
|
|
| 9 |
import java.awt.Dimension;
|
|
| 10 |
import java.awt.Font;
|
|
| 11 |
import java.text.DateFormat;
|
|
| 12 |
import java.text.DecimalFormat;
|
|
| 13 |
import java.text.Format;
|
|
| 14 |
import java.text.NumberFormat;
|
|
| 15 |
import java.util.Date;
|
|
| 16 |
|
|
| 17 |
import org.ejtools.graph.renderer.AbstractGraphRenderer;
|
|
| 18 |
|
|
| 19 |
/**
|
|
| 20 |
* @author Laurent Etiemble
|
|
| 21 |
* @version $Revision: 1.8 $
|
|
| 22 |
* @todo Javadoc to complete
|
|
| 23 |
*/
|
|
| 24 |
public abstract class Axis extends AbstractGraphRenderer |
|
| 25 |
{
|
|
| 26 |
/** Description of the Field */
|
|
| 27 |
protected Dimension dimension = null; |
|
| 28 |
/** Description of the Field */
|
|
| 29 |
protected Format format = new DecimalFormat("0"); |
|
| 30 |
/** Description of the Field */
|
|
| 31 |
protected int orientation; |
|
| 32 |
/** Description of the Field */
|
|
| 33 |
protected int position; |
|
| 34 |
/** Description of the Field */
|
|
| 35 |
protected Range range = new Range(0.0d, 1.0d); |
|
| 36 |
/** Description of the Field */
|
|
| 37 |
protected static Font FONT = new Font("Courrier", Font.PLAIN, 10); |
|
| 38 |
/** Description of the Field */
|
|
| 39 |
public final static int BOTTOM = 4; |
|
| 40 |
/** Description of the Field */
|
|
| 41 |
public final static int HORIZONTAL = 0; |
|
| 42 |
/** Description of the Field */
|
|
| 43 |
public final static int LEFT = 2; |
|
| 44 |
/** Description of the Field */
|
|
| 45 |
public final static int RIGHT = 3; |
|
| 46 |
/** Description of the Field */
|
|
| 47 |
public final static int TOP = 5; |
|
| 48 |
/** Description of the Field */
|
|
| 49 |
public final static int VERTICAL = 1; |
|
| 50 |
|
|
| 51 |
|
|
| 52 |
/** Constructor for Axis. */
|
|
| 53 | 0 |
public Axis() { }
|
| 54 |
|
|
| 55 |
|
|
| 56 |
/**
|
|
| 57 |
* Returns the format.
|
|
| 58 |
*
|
|
| 59 |
* @return Format
|
|
| 60 |
*/
|
|
| 61 | 0 |
public Format getFormat()
|
| 62 |
{
|
|
| 63 | 0 |
return format;
|
| 64 |
} |
|
| 65 |
|
|
| 66 |
|
|
| 67 |
/**
|
|
| 68 |
* Gets the formated attribute of the Axis object
|
|
| 69 |
*
|
|
| 70 |
* @param value Description of the Parameter
|
|
| 71 |
* @return The formated value
|
|
| 72 |
*/
|
|
| 73 | 0 |
public String getFormated(double value) |
| 74 |
{
|
|
| 75 | 0 |
if (this.format instanceof NumberFormat) |
| 76 |
{
|
|
| 77 | 0 |
return ((NumberFormat) this.format).format(value); |
| 78 |
} |
|
| 79 | 0 |
if (this.format instanceof DateFormat) |
| 80 |
{
|
|
| 81 | 0 |
return ((DateFormat) this.format).format(new Date((long) value)); |
| 82 |
} |
|
| 83 | 0 |
return null; |
| 84 |
} |
|
| 85 |
|
|
| 86 |
|
|
| 87 |
/**
|
|
| 88 |
* @return The minimumSize value
|
|
| 89 |
*/
|
|
| 90 | 0 |
public Dimension getMinimumSize()
|
| 91 |
{
|
|
| 92 | 0 |
if (this.dimension == null) |
| 93 |
{
|
|
| 94 | 0 |
this.dimension = new Dimension(FONT.getSize() * 2, FONT.getSize() * 2); |
| 95 |
} |
|
| 96 | 0 |
return dimension;
|
| 97 |
} |
|
| 98 |
|
|
| 99 |
|
|
| 100 |
/**
|
|
| 101 |
* Returns the orientation.
|
|
| 102 |
*
|
|
| 103 |
* @return int
|
|
| 104 |
*/
|
|
| 105 | 0 |
public int getOrientation() |
| 106 |
{
|
|
| 107 | 0 |
return orientation;
|
| 108 |
} |
|
| 109 |
|
|
| 110 |
|
|
| 111 |
/**
|
|
| 112 |
* Returns the position.
|
|
| 113 |
*
|
|
| 114 |
* @return int
|
|
| 115 |
*/
|
|
| 116 | 0 |
public int getPosition() |
| 117 |
{
|
|
| 118 | 0 |
return position;
|
| 119 |
} |
|
| 120 |
|
|
| 121 |
|
|
| 122 |
/**
|
|
| 123 |
* @return The preferredSize value
|
|
| 124 |
*/
|
|
| 125 | 0 |
public Dimension getPreferredSize()
|
| 126 |
{
|
|
| 127 | 0 |
return this.getMinimumSize(); |
| 128 |
} |
|
| 129 |
|
|
| 130 |
|
|
| 131 |
/**
|
|
| 132 |
* Returns the range.
|
|
| 133 |
*
|
|
| 134 |
* @return Range
|
|
| 135 |
*/
|
|
| 136 | 0 |
public Range getRange()
|
| 137 |
{
|
|
| 138 | 0 |
return range;
|
| 139 |
} |
|
| 140 |
|
|
| 141 |
|
|
| 142 |
/**
|
|
| 143 |
* Sets the format.
|
|
| 144 |
*
|
|
| 145 |
* @param format The format to set
|
|
| 146 |
*/
|
|
| 147 | 0 |
public void setFormat(Format format) |
| 148 |
{
|
|
| 149 | 0 |
this.format = format;
|
| 150 |
} |
|
| 151 |
|
|
| 152 |
|
|
| 153 |
/**
|
|
| 154 |
* Sets the position.
|
|
| 155 |
*
|
|
| 156 |
* @param position The position to set
|
|
| 157 |
*/
|
|
| 158 | 0 |
public void setPosition(int position) |
| 159 |
{
|
|
| 160 | 0 |
this.position = position;
|
| 161 |
} |
|
| 162 |
|
|
| 163 |
|
|
| 164 |
/**
|
|
| 165 |
* Sets the range.
|
|
| 166 |
*
|
|
| 167 |
* @param range The new range value
|
|
| 168 |
*/
|
|
| 169 | 0 |
public void setRange(Range range) |
| 170 |
{
|
|
| 171 | 0 |
this.range = range;
|
| 172 |
} |
|
| 173 |
} |
|
| 174 |
|
|
||||||||||