[Ejtools-cvs] libraries/graph/src/main/org/ejtools/graph Axis.java,1.7,1.8 CompositeTrack.java,1.7,1
Brought to you by:
letiemble
Update of /cvsroot/ejtools/libraries/graph/src/main/org/ejtools/graph In directory sc8-pr-cvs1:/tmp/cvs-serv18699/graph/src/main/org/ejtools/graph Modified Files: Axis.java CompositeTrack.java DefaultGraphElement.java GraphElement.java GraphRenderer.java LabelElement.java Range.java Test.java Log Message: Add more javadocs. Adjust text export. Index: Axis.java =================================================================== RCS file: /cvsroot/ejtools/libraries/graph/src/main/org/ejtools/graph/Axis.java,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** Axis.java 15 Sep 2003 22:11:22 -0000 1.7 --- Axis.java 13 Dec 2003 21:26:46 -0000 1.8 *************** *** 1,173 **** ! /* ! * EJTools, the Enterprise Java Tools ! * ! * Distributable under LGPL license. ! * See terms of license at www.gnu.org. ! */ ! package org.ejtools.graph; ! ! import java.awt.Dimension; ! import java.awt.Font; ! import java.text.DateFormat; ! import java.text.DecimalFormat; ! import java.text.Format; ! import java.text.NumberFormat; ! import java.util.Date; ! ! import org.ejtools.graph.renderer.AbstractGraphRenderer; ! ! /** ! * @author Laurent Etiemble ! * @version $Revision$ ! * @todo Javadoc to complete ! */ ! public abstract class Axis extends AbstractGraphRenderer ! { ! /** Description of the Field */ ! protected Dimension dimension = null; ! /** Description of the Field */ ! protected Format format = new DecimalFormat("0"); ! /** Description of the Field */ ! protected int orientation; ! /** Description of the Field */ ! protected int position; ! /** Description of the Field */ ! protected Range range = new Range(0.0d, 1.0d); ! /** Description of the Field */ ! protected static Font FONT = new Font("Courrier", Font.PLAIN, 10); ! /** Description of the Field */ ! public final static int BOTTOM = 4; ! /** Description of the Field */ ! public final static int HORIZONTAL = 0; ! /** Description of the Field */ ! public final static int LEFT = 2; ! /** Description of the Field */ ! public final static int RIGHT = 3; ! /** Description of the Field */ ! public final static int TOP = 5; ! /** Description of the Field */ ! public final static int VERTICAL = 1; ! ! ! /** Constructor for Axis. */ ! public Axis() { } ! ! ! /** ! * Returns the format. ! * ! * @return Format ! */ ! public Format getFormat() ! { ! return format; ! } ! ! ! /** ! * Gets the formated attribute of the Axis object ! * ! * @param value Description of the Parameter ! * @return The formated value ! */ ! public String getFormated(double value) ! { ! if (this.format instanceof NumberFormat) ! { ! return ((NumberFormat) this.format).format(value); ! } ! if (this.format instanceof DateFormat) ! { ! return ((DateFormat) this.format).format(new Date((long) value)); ! } ! return null; ! } ! ! ! /** ! * @return The minimumSize value ! */ ! public Dimension getMinimumSize() ! { ! if (this.dimension == null) ! { ! this.dimension = new Dimension(FONT.getSize() * 2, FONT.getSize() * 2); ! } ! return dimension; ! } ! ! ! /** ! * Returns the orientation. ! * ! * @return int ! */ ! public int getOrientation() ! { ! return orientation; ! } ! ! ! /** ! * Returns the position. ! * ! * @return int ! */ ! public int getPosition() ! { ! return position; ! } ! ! ! /** ! * @return The preferredSize value ! */ ! public Dimension getPreferredSize() ! { ! return this.getMinimumSize(); ! } ! ! ! /** ! * Returns the range. ! * ! * @return Range ! */ ! public Range getRange() ! { ! return range; ! } ! ! ! /** ! * Sets the format. ! * ! * @param format The format to set ! */ ! public void setFormat(Format format) ! { ! this.format = format; ! } ! ! ! /** ! * Sets the position. ! * ! * @param position The position to set ! */ ! public void setPosition(int position) ! { ! this.position = position; ! } ! ! ! /** ! * Sets the range. ! * ! * @param range The new range value ! */ ! public void setRange(Range range) ! { ! this.range = range; ! } ! } --- 1,173 ---- ! /* ! * EJTools, the Enterprise Java Tools ! * ! * Distributable under LGPL license. ! * See terms of license at www.gnu.org. ! */ ! package org.ejtools.graph; ! ! import java.awt.Dimension; ! import java.awt.Font; ! import java.text.DateFormat; ! import java.text.DecimalFormat; ! import java.text.Format; ! import java.text.NumberFormat; ! import java.util.Date; ! ! import org.ejtools.graph.renderer.AbstractGraphRenderer; ! ! /** ! * @author Laurent Etiemble ! * @version $Revision$ ! * @todo Javadoc to complete ! */ ! public abstract class Axis extends AbstractGraphRenderer ! { ! /** Description of the Field */ ! protected Dimension dimension = null; ! /** Description of the Field */ ! protected Format format = new DecimalFormat("0"); ! /** Description of the Field */ ! protected int orientation; ! /** Description of the Field */ ! protected int position; ! /** Description of the Field */ ! protected Range range = new Range(0.0d, 1.0d); ! /** Description of the Field */ ! protected static Font FONT = new Font("Courrier", Font.PLAIN, 10); ! /** Description of the Field */ ! public final static int BOTTOM = 4; ! /** Description of the Field */ ! public final static int HORIZONTAL = 0; ! /** Description of the Field */ ! public final static int LEFT = 2; ! /** Description of the Field */ ! public final static int RIGHT = 3; ! /** Description of the Field */ ! public final static int TOP = 5; ! /** Description of the Field */ ! public final static int VERTICAL = 1; ! ! ! /** Constructor for Axis. */ ! public Axis() { } ! ! ! /** ! * Returns the format. ! * ! * @return Format ! */ ! public Format getFormat() ! { ! return format; ! } ! ! ! /** ! * Gets the formated attribute of the Axis object ! * ! * @param value Description of the Parameter ! * @return The formated value ! */ ! public String getFormated(double value) ! { ! if (this.format instanceof NumberFormat) ! { ! return ((NumberFormat) this.format).format(value); ! } ! if (this.format instanceof DateFormat) ! { ! return ((DateFormat) this.format).format(new Date((long) value)); ! } ! return null; ! } ! ! ! /** ! * @return The minimumSize value ! */ ! public Dimension getMinimumSize() ! { ! if (this.dimension == null) ! { ! this.dimension = new Dimension(FONT.getSize() * 2, FONT.getSize() * 2); ! } ! return dimension; ! } ! ! ! /** ! * Returns the orientation. ! * ! * @return int ! */ ! public int getOrientation() ! { ! return orientation; ! } ! ! ! /** ! * Returns the position. ! * ! * @return int ! */ ! public int getPosition() ! { ! return position; ! } ! ! ! /** ! * @return The preferredSize value ! */ ! public Dimension getPreferredSize() ! { ! return this.getMinimumSize(); ! } ! ! ! /** ! * Returns the range. ! * ! * @return Range ! */ ! public Range getRange() ! { ! return range; ! } ! ! ! /** ! * Sets the format. ! * ! * @param format The format to set ! */ ! public void setFormat(Format format) ! { ! this.format = format; ! } ! ! ! /** ! * Sets the position. ! * ! * @param position The position to set ! */ ! public void setPosition(int position) ! { ! this.position = position; ! } ! ! ! /** ! * Sets the range. ! * ! * @param range The new range value ! */ ! public void setRange(Range range) ! { ! this.range = range; ! } ! } Index: CompositeTrack.java =================================================================== RCS file: /cvsroot/ejtools/libraries/graph/src/main/org/ejtools/graph/CompositeTrack.java,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** CompositeTrack.java 15 Sep 2003 22:11:22 -0000 1.7 --- CompositeTrack.java 13 Dec 2003 21:26:46 -0000 1.8 *************** *** 1,155 **** ! /* ! * EJTools, the Enterprise Java Tools ! * ! * Distributable under LGPL license. ! * See terms of license at www.gnu.org. ! */ ! package org.ejtools.graph; ! ! import java.awt.Color; ! import java.awt.Graphics; ! import java.awt.GridLayout; ! import java.util.Collection; ! import java.util.Iterator; ! import java.util.Vector; ! ! import javax.swing.JComponent; ! import javax.swing.JPanel; ! ! /** ! * Description of the Class ! * ! * @author Laurent Etiemble ! * @version $Revision$ ! * @todo Javadoc to complete ! */ ! public class CompositeTrack implements GraphElement, LabelElement ! { ! /** Description of the Field */ ! protected JPanel component; ! /** Description of the Field */ ! protected GridLayout layout; ! /** Description of the Field */ ! protected Collection tracks = new Vector(); ! ! ! /** Constructor for the Track object */ ! public CompositeTrack() ! { ! this.layout = new GridLayout(1, 1, 1, 1); ! this.component = new JPanel(this.layout); ! } ! ! ! /** ! * Adds a feature to the Track attribute of the CompositeTrack object ! * ! * @param t The feature to be added to the Track attribute ! */ ! public void addTrack(Track t) ! { ! this.tracks.add(t); ! this.layout.setRows(this.tracks.size()); ! this.component.add(t.getComponent()); ! } ! ! ! /** Description of the Method */ ! public void clear() ! { ! synchronized (this.tracks) ! { ! for (Iterator it = this.tracks.iterator(); it.hasNext(); ) ! { ! ((Track) it.next()).clear(); ! } ! } ! } ! ! ! /** ! * @param graphics Description of the Parameter ! * @param scaleX Description of the Parameter ! * @param offsetX Description of the Parameter ! * @param scaleY Description of the Parameter ! * @param offsetY Description of the Parameter ! */ ! public void draw(Graphics graphics, double scaleX, double offsetX, double scaleY, double offsetY) ! { ! synchronized (this.tracks) ! { ! for (Iterator it = this.tracks.iterator(); it.hasNext(); ) ! { ! ((GraphElement) it.next()).draw(graphics, scaleX, offsetX, scaleY, offsetY); ! } ! } ! } ! ! ! /** ! * @return The color value ! */ ! public Color getColor() ! { ! return Color.black; ! } ! ! ! /** ! * @return The component value ! */ ! public JComponent getComponent() ! { ! return this.component; ! } ! ! ! /** ! * @return The xRange value ! */ ! public Range getXRange() ! { ! synchronized (this.tracks) ! { ! Range result = new Range(Double.MAX_VALUE, Double.MIN_VALUE); ! for (Iterator it = this.tracks.iterator(); it.hasNext(); ) ! { ! result = result.compose(((GraphElement) it.next()).getXRange()); ! } ! return result; ! } ! } ! ! ! /** ! * @return The yRange value ! */ ! public Range getYRange() ! { ! synchronized (this.tracks) ! { ! Range result = new Range(Double.MAX_VALUE, Double.MIN_VALUE); ! for (Iterator it = this.tracks.iterator(); it.hasNext(); ) ! { ! result = result.compose(((GraphElement) it.next()).getYRange()); ! } ! return result; ! } ! } ! ! ! /** ! * Description of the Method ! * ! * @param t Description of the Parameter ! */ ! public void removeTrack(Track t) ! { ! if (this.tracks.contains(t)) ! { ! this.component.remove(t.getComponent()); ! this.tracks.remove(t); ! this.layout.setRows(this.tracks.size()); ! } ! } ! } --- 1,155 ---- ! /* ! * EJTools, the Enterprise Java Tools ! * ! * Distributable under LGPL license. ! * See terms of license at www.gnu.org. ! */ ! package org.ejtools.graph; ! ! import java.awt.Color; ! import java.awt.Graphics; ! import java.awt.GridLayout; ! import java.util.Collection; ! import java.util.Iterator; ! import java.util.Vector; ! ! import javax.swing.JComponent; ! import javax.swing.JPanel; ! ! /** ! * Description of the Class ! * ! * @author Laurent Etiemble ! * @version $Revision$ ! * @todo Javadoc to complete ! */ ! public class CompositeTrack implements GraphElement, LabelElement ! { ! /** Description of the Field */ ! protected JPanel component; ! /** Description of the Field */ ! protected GridLayout layout; ! /** Description of the Field */ ! protected Collection tracks = new Vector(); ! ! ! /** Constructor for the Track object */ ! public CompositeTrack() ! { ! this.layout = new GridLayout(1, 1, 1, 1); ! this.component = new JPanel(this.layout); ! } ! ! ! /** ! * Adds a feature to the Track attribute of the CompositeTrack object ! * ! * @param t The feature to be added to the Track attribute ! */ ! public void addTrack(Track t) ! { ! this.tracks.add(t); ! this.layout.setRows(this.tracks.size()); ! this.component.add(t.getComponent()); ! } ! ! ! /** Description of the Method */ ! public void clear() ! { ! synchronized (this.tracks) ! { ! for (Iterator it = this.tracks.iterator(); it.hasNext(); ) ! { ! ((Track) it.next()).clear(); ! } ! } ! } ! ! ! /** ! * @param graphics Description of the Parameter ! * @param scaleX Description of the Parameter ! * @param offsetX Description of the Parameter ! * @param scaleY Description of the Parameter ! * @param offsetY Description of the Parameter ! */ ! public void draw(Graphics graphics, double scaleX, double offsetX, double scaleY, double offsetY) ! { ! synchronized (this.tracks) ! { ! for (Iterator it = this.tracks.iterator(); it.hasNext(); ) ! { ! ((GraphElement) it.next()).draw(graphics, scaleX, offsetX, scaleY, offsetY); ! } ! } ! } ! ! ! /** ! * @return The color value ! */ ! public Color getColor() ! { ! return Color.black; ! } ! ! ! /** ! * @return The component value ! */ ! public JComponent getComponent() ! { ! return this.component; ! } ! ! ! /** ! * @return The xRange value ! */ ! public Range getXRange() ! { ! synchronized (this.tracks) ! { ! Range result = new Range(Double.MAX_VALUE, Double.MIN_VALUE); ! for (Iterator it = this.tracks.iterator(); it.hasNext(); ) ! { ! result = result.compose(((GraphElement) it.next()).getXRange()); ! } ! return result; ! } ! } ! ! ! /** ! * @return The yRange value ! */ ! public Range getYRange() ! { ! synchronized (this.tracks) ! { ! Range result = new Range(Double.MAX_VALUE, Double.MIN_VALUE); ! for (Iterator it = this.tracks.iterator(); it.hasNext(); ) ! { ! result = result.compose(((GraphElement) it.next()).getYRange()); ! } ! return result; ! } ! } ! ! ! /** ! * Description of the Method ! * ! * @param t Description of the Parameter ! */ ! public void removeTrack(Track t) ! { ! if (this.tracks.contains(t)) ! { ! this.component.remove(t.getComponent()); ! this.tracks.remove(t); ! this.layout.setRows(this.tracks.size()); ! } ! } ! } Index: DefaultGraphElement.java =================================================================== RCS file: /cvsroot/ejtools/libraries/graph/src/main/org/ejtools/graph/DefaultGraphElement.java,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** DefaultGraphElement.java 15 Sep 2003 22:11:22 -0000 1.7 --- DefaultGraphElement.java 13 Dec 2003 21:26:46 -0000 1.8 *************** *** 1,64 **** ! /* ! * EJTools, the Enterprise Java Tools ! * ! * Distributable under LGPL license. ! * See terms of license at www.gnu.org. ! */ ! package org.ejtools.graph; ! ! import java.awt.Color; ! import java.awt.Graphics; ! ! /** ! * @author Laurent Etiemble ! * @version $Revision$ ! * @todo Javadoc to complete ! */ ! public class DefaultGraphElement implements GraphElement ! { ! /** Description of the Field */ ! protected Range xr = new Range(0.0d, 1.0d); ! /** Description of the Field */ ! protected Range yr = new Range(0.0d, 1.0d); ! ! ! /** Constructor for DefaultElement. */ ! public DefaultGraphElement() { } ! ! ! /** ! * @param graphics Description of the Parameter ! * @param scaleX Description of the Parameter ! * @param offsetX Description of the Parameter ! * @param scaleY Description of the Parameter ! * @param offsetY Description of the Parameter ! */ ! public void draw(Graphics graphics, double scaleX, double offsetX, double scaleY, double offsetY) { } ! ! ! /** ! * @return The color value ! */ ! public Color getColor() ! { ! return Color.black; ! } ! ! ! /** ! * @return The xRange value ! */ ! public Range getXRange() ! { ! return this.xr; ! } ! ! ! /** ! * @return The yRange value ! */ ! public Range getYRange() ! { ! return this.yr; ! } ! } --- 1,64 ---- ! /* ! * EJTools, the Enterprise Java Tools ! * ! * Distributable under LGPL license. ! * See terms of license at www.gnu.org. ! */ ! package org.ejtools.graph; ! ! import java.awt.Color; ! import java.awt.Graphics; ! ! /** ! * @author Laurent Etiemble ! * @version $Revision$ ! * @todo Javadoc to complete ! */ ! public class DefaultGraphElement implements GraphElement ! { ! /** Description of the Field */ ! protected Range xr = new Range(0.0d, 1.0d); ! /** Description of the Field */ ! protected Range yr = new Range(0.0d, 1.0d); ! ! ! /** Constructor for DefaultElement. */ ! public DefaultGraphElement() { } ! ! ! /** ! * @param graphics Description of the Parameter ! * @param scaleX Description of the Parameter ! * @param offsetX Description of the Parameter ! * @param scaleY Description of the Parameter ! * @param offsetY Description of the Parameter ! */ ! public void draw(Graphics graphics, double scaleX, double offsetX, double scaleY, double offsetY) { } ! ! ! /** ! * @return The color value ! */ ! public Color getColor() ! { ! return Color.black; ! } ! ! ! /** ! * @return The xRange value ! */ ! public Range getXRange() ! { ! return this.xr; ! } ! ! ! /** ! * @return The yRange value ! */ ! public Range getYRange() ! { ! return this.yr; ! } ! } Index: GraphElement.java =================================================================== RCS file: /cvsroot/ejtools/libraries/graph/src/main/org/ejtools/graph/GraphElement.java,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** GraphElement.java 15 Sep 2003 22:11:22 -0000 1.6 --- GraphElement.java 13 Dec 2003 21:26:46 -0000 1.7 *************** *** 1,53 **** ! /* ! * EJTools, the Enterprise Java Tools ! * ! * Distributable under LGPL license. ! * See terms of license at www.gnu.org. ! */ ! package org.ejtools.graph; ! ! import java.awt.Color; ! import java.awt.Graphics; ! ! /** ! * @author Laurent Etiemble ! * @version $Revision$ ! * @todo Javadoc to complete ! */ ! public interface GraphElement ! { ! /** ! * Gets the xRange attribute of the GraphModel object ! * ! * @return The xRange value ! */ ! public Range getXRange(); ! ! ! /** ! * Gets the color attribute of the Element object ! * ! * @return The color value ! */ ! public Color getColor(); ! ! ! /** ! * Description of the Method ! * ! * @param graphics Description of the Parameter ! * @param scaleX Description of the Parameter ! * @param offsetX Description of the Parameter ! * @param scaleY Description of the Parameter ! * @param offsetY Description of the Parameter ! */ ! public void draw(Graphics graphics, double scaleX, double offsetX, double scaleY, double offsetY); ! ! ! /** ! * Gets the yRange attribute of the GraphModel object ! * ! * @return The yRange value ! */ ! public Range getYRange(); ! } --- 1,53 ---- ! /* ! * EJTools, the Enterprise Java Tools ! * ! * Distributable under LGPL license. ! * See terms of license at www.gnu.org. ! */ ! package org.ejtools.graph; ! ! import java.awt.Color; ! import java.awt.Graphics; ! ! /** ! * @author Laurent Etiemble ! * @version $Revision$ ! * @todo Javadoc to complete ! */ ! public interface GraphElement ! { ! /** ! * Gets the xRange attribute of the GraphModel object ! * ! * @return The xRange value ! */ ! public Range getXRange(); ! ! ! /** ! * Gets the color attribute of the Element object ! * ! * @return The color value ! */ ! public Color getColor(); ! ! ! /** ! * Description of the Method ! * ! * @param graphics Description of the Parameter ! * @param scaleX Description of the Parameter ! * @param offsetX Description of the Parameter ! * @param scaleY Description of the Parameter ! * @param offsetY Description of the Parameter ! */ ! public void draw(Graphics graphics, double scaleX, double offsetX, double scaleY, double offsetY); ! ! ! /** ! * Gets the yRange attribute of the GraphModel object ! * ! * @return The yRange value ! */ ! public Range getYRange(); ! } Index: GraphRenderer.java =================================================================== RCS file: /cvsroot/ejtools/libraries/graph/src/main/org/ejtools/graph/GraphRenderer.java,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** GraphRenderer.java 15 Sep 2003 22:11:22 -0000 1.6 --- GraphRenderer.java 13 Dec 2003 21:26:46 -0000 1.7 *************** *** 1,69 **** ! /* ! * EJTools, the Enterprise Java Tools ! * ! * Distributable under LGPL license. ! * See terms of license at www.gnu.org. ! */ ! package org.ejtools.graph; ! ! ! /** ! * Description of the Interface ! * ! * @author Laurent Etiemble ! * @version $Revision$ ! * @todo Javadoc to complete ! */ ! public interface GraphRenderer ! { ! /** Description of the Field */ ! public final static int ALIGN_LEFT = 0; ! /** Description of the Field */ ! public final static int ALIGN_RIGHT = 1; ! /** Description of the Field */ ! public final static int JUSTIFIED = 3; ! /** Description of the Field */ ! public final static int SMOOTH = 10; ! /** Description of the Field */ ! public final static int BOUNDED = 11; ! ! ! /** ! * Sets the graphElement attribute of the GraphRenderer object ! * ! * @param element The new graphElement value ! */ ! public void setGraphElement(GraphElement element); ! ! ! /** ! * Sets the display attribute of the GraphRenderer object ! * ! * @param type The new display value ! */ ! public void setHorizontalScaling(int type); ! ! ! /** ! * Sets the horizontalScale attribute of the GraphRenderer object ! * ! * @param multiplier The new horizontalScale value ! */ ! public void setHorizontalScale(double multiplier); ! ! ! /** ! * Sets the verticalScale attribute of the GraphRenderer object ! * ! * @param multiplier The new verticalScale value ! */ ! public void setVerticalScale(double multiplier); ! ! ! /** ! * Sets the verticalDisplay attribute of the GraphRenderer object ! * ! * @param type The new verticalDisplay value ! */ ! public void setVerticalScaling(int type); ! } --- 1,69 ---- ! /* ! * EJTools, the Enterprise Java Tools ! * ! * Distributable under LGPL license. ! * See terms of license at www.gnu.org. ! */ ! package org.ejtools.graph; ! ! ! /** ! * Description of the Interface ! * ! * @author Laurent Etiemble ! * @version $Revision$ ! * @todo Javadoc to complete ! */ ! public interface GraphRenderer ! { ! /** Description of the Field */ ! public final static int ALIGN_LEFT = 0; ! /** Description of the Field */ ! public final static int ALIGN_RIGHT = 1; ! /** Description of the Field */ ! public final static int JUSTIFIED = 3; ! /** Description of the Field */ ! public final static int SMOOTH = 10; ! /** Description of the Field */ ! public final static int BOUNDED = 11; ! ! ! /** ! * Sets the graphElement attribute of the GraphRenderer object ! * ! * @param element The new graphElement value ! */ ! public void setGraphElement(GraphElement element); ! ! ! /** ! * Sets the display attribute of the GraphRenderer object ! * ! * @param type The new display value ! */ ! public void setHorizontalScaling(int type); ! ! ! /** ! * Sets the horizontalScale attribute of the GraphRenderer object ! * ! * @param multiplier The new horizontalScale value ! */ ! public void setHorizontalScale(double multiplier); ! ! ! /** ! * Sets the verticalScale attribute of the GraphRenderer object ! * ! * @param multiplier The new verticalScale value ! */ ! public void setVerticalScale(double multiplier); ! ! ! /** ! * Sets the verticalDisplay attribute of the GraphRenderer object ! * ! * @param type The new verticalDisplay value ! */ ! public void setVerticalScaling(int type); ! } Index: LabelElement.java =================================================================== RCS file: /cvsroot/ejtools/libraries/graph/src/main/org/ejtools/graph/LabelElement.java,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** LabelElement.java 15 Sep 2003 22:11:22 -0000 1.6 --- LabelElement.java 13 Dec 2003 21:26:46 -0000 1.7 *************** *** 1,24 **** ! /* ! * EJTools, the Enterprise Java Tools ! * ! * Distributable under LGPL license. ! * See terms of license at www.gnu.org. ! */ ! package org.ejtools.graph; ! ! import javax.swing.JComponent; ! ! /** ! * @author Laurent Etiemble ! * @version $Revision$ ! * @todo Javadoc to complete ! */ ! public interface LabelElement ! { ! /** ! * Gets the component attribute of the LabelElement object ! * ! * @return The component value ! */ ! public JComponent getComponent(); ! } --- 1,24 ---- ! /* ! * EJTools, the Enterprise Java Tools ! * ! * Distributable under LGPL license. ! * See terms of license at www.gnu.org. ! */ ! package org.ejtools.graph; ! ! import javax.swing.JComponent; ! ! /** ! * @author Laurent Etiemble ! * @version $Revision$ ! * @todo Javadoc to complete ! */ ! public interface LabelElement ! { ! /** ! * Gets the component attribute of the LabelElement object ! * ! * @return The component value ! */ ! public JComponent getComponent(); ! } Index: Range.java =================================================================== RCS file: /cvsroot/ejtools/libraries/graph/src/main/org/ejtools/graph/Range.java,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** Range.java 15 Sep 2003 22:11:22 -0000 1.6 --- Range.java 13 Dec 2003 21:26:46 -0000 1.7 *************** *** 1,122 **** ! /* ! * EJTools, the Enterprise Java Tools ! * ! * Distributable under LGPL license. ! * See terms of license at www.gnu.org. ! */ ! package org.ejtools.graph; ! ! ! /** ! * Description of the Class ! * ! * @author Laurent Etiemble ! * @version $Revision$ ! * @todo Javadoc to complete ! */ ! public class Range ! { ! /** Description of the Field */ ! protected double max = 0.0f; ! /** Description of the Field */ ! protected double min = 0.0f; ! /** Description of the Field */ ! public final static int X_AXIS = 0; ! /** Description of the Field */ ! public final static int Y_AXIS = 1; ! ! ! /** ! *Constructor for the Range object ! * ! * @param min Description of the Parameter ! * @param max Description of the Parameter ! */ ! public Range(double min, double max) ! { ! this.min = (double) min; ! this.max = (double) max; ! } ! ! ! /** ! * Description of the Method ! * ! * @param range Description of the Parameter ! * @return Description of the Return Value ! */ ! public Range compose(Range range) ! { ! double nmin = Math.min(this.min, range.min); ! double nmax = Math.max(this.max, range.max); ! ! return new Range(nmin, nmax); ! } ! ! ! /** ! * Gets the max attribute of the Range object ! * ! * @return The max value ! */ ! public double getMax() ! { ! return this.max; ! } ! ! ! /** ! * Gets the min attribute of the Range object ! * ! * @return The min value ! */ ! public double getMin() ! { ! return this.min; ! } ! ! ! /** ! * Description of the Method ! * ! * @param value Description of the Parameter ! */ ! public synchronized void put(double value) ! { ! this.min = Math.min(this.min, value); ! this.max = Math.max(this.max, value); ! } ! ! ! /** ! * Sets the max. ! * ! * @param max The max to set ! */ ! public void setMax(double max) ! { ! this.max = max; ! } ! ! ! /** ! * Sets the min. ! * ! * @param min The min to set ! */ ! public void setMin(double min) ! { ! this.min = min; ! } ! ! ! /** ! * Description of the Method ! * ! * @return Description of the Return Value ! */ ! public String toString() ! { ! return "[" + getMin() + " to " + getMax() + "]"; ! } ! } --- 1,122 ---- ! /* ! * EJTools, the Enterprise Java Tools ! * ! * Distributable under LGPL license. ! * See terms of license at www.gnu.org. ! */ ! package org.ejtools.graph; ! ! ! /** ! * Description of the Class ! * ! * @author Laurent Etiemble ! * @version $Revision$ ! * @todo Javadoc to complete ! */ ! public class Range ! { ! /** Description of the Field */ ! protected double max = 0.0f; ! /** Description of the Field */ ! protected double min = 0.0f; ! /** Description of the Field */ ! public final static int X_AXIS = 0; ! /** Description of the Field */ ! public final static int Y_AXIS = 1; ! ! ! /** ! *Constructor for the Range object ! * ! * @param min Description of the Parameter ! * @param max Description of the Parameter ! */ ! public Range(double min, double max) ! { ! this.min = (double) min; ! this.max = (double) max; ! } ! ! ! /** ! * Description of the Method ! * ! * @param range Description of the Parameter ! * @return Description of the Return Value ! */ ! public Range compose(Range range) ! { ! double nmin = Math.min(this.min, range.min); ! double nmax = Math.max(this.max, range.max); ! ! return new Range(nmin, nmax); ! } ! ! ! /** ! * Gets the max attribute of the Range object ! * ! * @return The max value ! */ ! public double getMax() ! { ! return this.max; ! } ! ! ! /** ! * Gets the min attribute of the Range object ! * ! * @return The min value ! */ ! public double getMin() ! { ! return this.min; ! } ! ! ! /** ! * Description of the Method ! * ! * @param value Description of the Parameter ! */ ! public synchronized void put(double value) ! { ! this.min = Math.min(this.min, value); ! this.max = Math.max(this.max, value); ! } ! ! ! /** ! * Sets the max. ! * ! * @param max The max to set ! */ ! public void setMax(double max) ! { ! this.max = max; ! } ! ! ! /** ! * Sets the min. ! * ! * @param min The min to set ! */ ! public void setMin(double min) ! { ! this.min = min; ! } ! ! ! /** ! * Description of the Method ! * ! * @return Description of the Return Value ! */ ! public String toString() ! { ! return "[" + getMin() + " to " + getMax() + "]"; ! } ! } Index: Test.java =================================================================== RCS file: /cvsroot/ejtools/libraries/graph/src/main/org/ejtools/graph/Test.java,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** Test.java 15 Sep 2003 22:11:22 -0000 1.6 --- Test.java 13 Dec 2003 21:26:46 -0000 1.7 *************** *** 1,128 **** ! /* ! * EJTools, the Enterprise Java Tools ! * ! * Distributable under LGPL license. ! * See terms of license at www.gnu.org. ! */ ! package org.ejtools.graph; ! ! import java.awt.BorderLayout; ! import java.awt.Color; ! ! import javax.swing.JFrame; ! ! import org.ejtools.graph.renderer.TriAxisLayoutRenderer; ! ! /** ! * Description of the Class ! * ! * @author Laurent Etiemble ! * @version $Revision$ ! * @todo Javadoc to complete ! */ ! public class Test ! { ! /** Constructor for Test. */ ! public Test() ! { ! super(); ! } ! ! ! /** ! * The main program for the Test class ! * ! * @param args The command line arguments ! * @exception Exception Description of the Exception ! */ ! public static void main(String[] args) ! throws Exception ! { ! Track t1 = new Track("Toto"); ! t1.setColor(Color.blue); ! Track t2 = new Track("Tata"); ! t2.setColor(Color.red); ! ! CompositeTrack ct = new CompositeTrack(); ! ct.addTrack(t1); ! ct.addTrack(t2); ! ! TriAxisLayoutRenderer cg = new TriAxisLayoutRenderer(); ! cg.setGraphElement(ct); ! ! // BorderGraph cg = new BorderGraph(); ! // cg.setGraphElement(t1); ! ! // Renderer rd = new DefaultRenderer(); ! // Renderer rd = new GridRenderer(new SimpleDateFormat("HH:mm:ss.SSS"), new DecimalFormat("0")); ! // cg.addRenderer(rd, BorderLayout.CENTER); ! // Axis axis = new HorizontalAxis(new SimpleDateFormat("HH:mm:ss.SSS"), Axis.BOTTOM); ! // cg.addRenderer(axis, BorderLayout.SOUTH); ! // axis = new VerticalAxis(new DecimalFormat("0"), Axis.LEFT); ! // cg.addRenderer(axis, BorderLayout.WEST); ! // axis = new VerticalAxis(new DecimalFormat("0"), Axis.RIGHT); ! // cg.addRenderer(axis, BorderLayout.EAST); ! ! /* ! * GridBagGraph cg = new GridBagGraph(); ! * cg.setGraphElement(ct); ! * GridBagConstraints constraints = new GridBagConstraints(); ! * / Renderer rd = new DefaultRenderer(); ! * Renderer rd = new GridRenderer(new SimpleDateFormat("HH:mm:ss.SSS"), new DecimalFormat("0")); ! * constraints.gridx = 1; ! * constraints.gridy = 0; ! * constraints.fill = GridBagConstraints.BOTH; ! * constraints.weightx = 1.0; ! * constraints.weighty = 1.0; ! * cg.addRenderer(rd, constraints); ! * Axis axis = new HorizontalAxis(new SimpleDateFormat("HH:mm:ss.SSS"), Axis.BOTTOM); ! * constraints.gridx = 1; ! * constraints.gridy = 1; ! * constraints.fill = GridBagConstraints.HORIZONTAL; ! * constraints.weightx = 0.0; ! * constraints.weighty = 0.0; ! * cg.addRenderer(axis, constraints); ! * axis = new VerticalAxis(new DecimalFormat("0"), Axis.LEFT); ! * constraints.gridx = 0; ! * constraints.gridy = 0; ! * constraints.fill = GridBagConstraints.VERTICAL; ! * constraints.weightx = 0.0; ! * constraints.weighty = 0.0; ! * cg.addRenderer(axis, constraints); ! * axis = new VerticalAxis(new DecimalFormat("0"), Axis.RIGHT); ! * constraints.gridx = 2; ! * constraints.gridy = 0; ! * constraints.fill = GridBagConstraints.VERTICAL; ! * constraints.weightx = 0.0; ! * constraints.weighty = 0.0; ! * cg.addRenderer(axis, constraints); ! */ ! cg.setVisible(true); ! ! JFrame frame = new JFrame("Test"); ! frame.getContentPane().setLayout(new BorderLayout()); ! frame.getContentPane().add(cg, BorderLayout.CENTER); ! frame.setSize(600, 400); ! ! frame.show(); ! ! double i = 0; ! double scale = 1.0d; ! while (i < 50) ! { ! System.out.println(i); ! t1.addValue(Math.cos(i * 10 * Math.PI / 180) * 20); ! t2.addValue(Math.sin(i * 10 * Math.PI / 180) * 20); ! Thread.sleep(200); ! cg.repaint(); ! i++; ! if ((i % 20) == 0) ! { ! scale = scale / 1.5; ! cg.setHorizontalScale(scale); ! } ! } ! ! System.exit(0); ! } ! } --- 1,128 ---- ! /* ! * EJTools, the Enterprise Java Tools ! * ! * Distributable under LGPL license. ! * See terms of license at www.gnu.org. ! */ ! package org.ejtools.graph; ! ! import java.awt.BorderLayout; ! import java.awt.Color; ! ! import javax.swing.JFrame; ! ! import org.ejtools.graph.renderer.TriAxisLayoutRenderer; ! ! /** ! * Description of the Class ! * ! * @author Laurent Etiemble ! * @version $Revision$ ! * @todo Javadoc to complete ! */ ! public class Test ! { ! /** Constructor for Test. */ ! public Test() ! { ! super(); ! } ! ! ! /** ! * The main program for the Test class ! * ! * @param args The command line arguments ! * @exception Exception Description of the Exception ! */ ! public static void main(String[] args) ! throws Exception ! { ! Track t1 = new Track("Toto"); ! t1.setColor(Color.blue); ! Track t2 = new Track("Tata"); ! t2.setColor(Color.red); ! ! CompositeTrack ct = new CompositeTrack(); ! ct.addTrack(t1); ! ct.addTrack(t2); ! ! TriAxisLayoutRenderer cg = new TriAxisLayoutRenderer(); ! cg.setGraphElement(ct); ! ! // BorderGraph cg = new BorderGraph(); ! // cg.setGraphElement(t1); ! ! // Renderer rd = new DefaultRenderer(); ! // Renderer rd = new GridRenderer(new SimpleDateFormat("HH:mm:ss.SSS"), new DecimalFormat("0")); ! // cg.addRenderer(rd, BorderLayout.CENTER); ! // Axis axis = new HorizontalAxis(new SimpleDateFormat("HH:mm:ss.SSS"), Axis.BOTTOM); ! // cg.addRenderer(axis, BorderLayout.SOUTH); ! // axis = new VerticalAxis(new DecimalFormat("0"), Axis.LEFT); ! // cg.addRenderer(axis, BorderLayout.WEST); ! // axis = new VerticalAxis(new DecimalFormat("0"), Axis.RIGHT); ! // cg.addRenderer(axis, BorderLayout.EAST); ! ! /* ! * GridBagGraph cg = new GridBagGraph(); ! * cg.setGraphElement(ct); ! * GridBagConstraints constraints = new GridBagConstraints(); ! * / Renderer rd = new DefaultRenderer(); ! * Renderer rd = new GridRenderer(new SimpleDateFormat("HH:mm:ss.SSS"), new DecimalFormat("0")); ! * constraints.gridx = 1; ! * constraints.gridy = 0; ! * constraints.fill = GridBagConstraints.BOTH; ! * constraints.weightx = 1.0; ! * constraints.weighty = 1.0; ! * cg.addRenderer(rd, constraints); ! * Axis axis = new HorizontalAxis(new SimpleDateFormat("HH:mm:ss.SSS"), Axis.BOTTOM); ! * constraints.gridx = 1; ! * constraints.gridy = 1; ! * constraints.fill = GridBagConstraints.HORIZONTAL; ! * constraints.weightx = 0.0; ! * constraints.weighty = 0.0; ! * cg.addRenderer(axis, constraints); ! * axis = new VerticalAxis(new DecimalFormat("0"), Axis.LEFT); ! * constraints.gridx = 0; ! * constraints.gridy = 0; ! * constraints.fill = GridBagConstraints.VERTICAL; ! * constraints.weightx = 0.0; ! * constraints.weighty = 0.0; ! * cg.addRenderer(axis, constraints); ! * axis = new VerticalAxis(new DecimalFormat("0"), Axis.RIGHT); ! * constraints.gridx = 2; ! * constraints.gridy = 0; ! * constraints.fill = GridBagConstraints.VERTICAL; ! * constraints.weightx = 0.0; ! * constraints.weighty = 0.0; ! * cg.addRenderer(axis, constraints); ! */ ! cg.setVisible(true); ! ! JFrame frame = new JFrame("Test"); ! frame.getContentPane().setLayout(new BorderLayout()); ! frame.getContentPane().add(cg, BorderLayout.CENTER); ! frame.setSize(600, 400); ! ! frame.show(); ! ! double i = 0; ! double scale = 1.0d; ! while (i < 50) ! { ! System.out.println(i); ! t1.addValue(Math.cos(i * 10 * Math.PI / 180) * 20); ! t2.addValue(Math.sin(i * 10 * Math.PI / 180) * 20); ! Thread.sleep(200); ! cg.repaint(); ! i++; ! if ((i % 20) == 0) ! { ! scale = scale / 1.5; ! cg.setHorizontalScale(scale); ! } ! } ! ! System.exit(0); ! } ! } |