|
|||||||||||||||||||
| Source file | Conditionals | Statements | Methods | TOTAL | |||||||||||||||
| JPanelGraphRenderer.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.renderer;
|
|
| 8 |
|
|
| 9 |
import java.awt.BorderLayout;
|
|
| 10 |
import java.awt.LayoutManager;
|
|
| 11 |
import java.util.Iterator;
|
|
| 12 |
import java.util.Vector;
|
|
| 13 |
|
|
| 14 |
import javax.swing.JComponent;
|
|
| 15 |
import javax.swing.JPanel;
|
|
| 16 |
|
|
| 17 |
import org.ejtools.graph.DefaultGraphElement;
|
|
| 18 |
import org.ejtools.graph.GraphElement;
|
|
| 19 |
import org.ejtools.graph.GraphRenderer;
|
|
| 20 |
|
|
| 21 |
/**
|
|
| 22 |
* @author Laurent Etiemble
|
|
| 23 |
* @version $Revision: 1.7 $
|
|
| 24 |
* @todo Javadoc to complete
|
|
| 25 |
*/
|
|
| 26 |
public class JPanelGraphRenderer extends JPanel implements GraphRenderer |
|
| 27 |
{
|
|
| 28 |
/** Description of the Field */
|
|
| 29 |
protected GraphElement element = null; |
|
| 30 |
/** Description of the Field */
|
|
| 31 |
protected Vector renderers = new Vector(); |
|
| 32 |
|
|
| 33 |
|
|
| 34 |
/**
|
|
| 35 |
* Constructor for JPanelGraph.
|
|
| 36 |
*
|
|
| 37 |
* @param layout
|
|
| 38 |
*/
|
|
| 39 | 0 |
public JPanelGraphRenderer(LayoutManager layout)
|
| 40 |
{
|
|
| 41 | 0 |
super(layout);
|
| 42 | 0 |
this.element = new DefaultGraphElement(); |
| 43 |
} |
|
| 44 |
|
|
| 45 |
|
|
| 46 |
/** Constructor for Graph. */
|
|
| 47 | 0 |
public JPanelGraphRenderer()
|
| 48 |
{
|
|
| 49 | 0 |
this(new BorderLayout()); |
| 50 |
} |
|
| 51 |
|
|
| 52 |
|
|
| 53 |
/**
|
|
| 54 |
* Sets the renderer attribute of the Graph object
|
|
| 55 |
*
|
|
| 56 |
* @param renderer The new renderer value
|
|
| 57 |
*/
|
|
| 58 | 0 |
public void addRenderer(GraphRenderer renderer) |
| 59 |
{
|
|
| 60 | 0 |
renderer.setGraphElement(this.element);
|
| 61 | 0 |
this.renderers.add(renderer);
|
| 62 | 0 |
this.add((JComponent) renderer);
|
| 63 |
} |
|
| 64 |
|
|
| 65 |
|
|
| 66 |
/**
|
|
| 67 |
* @param element The new graphElement value
|
|
| 68 |
*/
|
|
| 69 | 0 |
public void setGraphElement(GraphElement element) |
| 70 |
{
|
|
| 71 | 0 |
this.element = element;
|
| 72 | 0 |
for (Iterator it = this.renderers.iterator(); it.hasNext(); ) |
| 73 |
{
|
|
| 74 | 0 |
((GraphRenderer) it.next()).setGraphElement(this.element);
|
| 75 |
} |
|
| 76 |
} |
|
| 77 |
|
|
| 78 |
|
|
| 79 |
/**
|
|
| 80 |
* @param multiplier The new horizontalScale value
|
|
| 81 |
*/
|
|
| 82 | 0 |
public void setHorizontalScale(double multiplier) |
| 83 |
{
|
|
| 84 | 0 |
for (Iterator it = this.renderers.iterator(); it.hasNext(); ) |
| 85 |
{
|
|
| 86 | 0 |
((GraphRenderer) it.next()).setHorizontalScale(multiplier); |
| 87 |
} |
|
| 88 |
} |
|
| 89 |
|
|
| 90 |
|
|
| 91 |
/**
|
|
| 92 |
* @param type The new horizontalScaling value
|
|
| 93 |
*/
|
|
| 94 | 0 |
public void setHorizontalScaling(int type) |
| 95 |
{
|
|
| 96 | 0 |
for (Iterator it = this.renderers.iterator(); it.hasNext(); ) |
| 97 |
{
|
|
| 98 | 0 |
((GraphRenderer) it.next()).setHorizontalScaling(type); |
| 99 |
} |
|
| 100 |
} |
|
| 101 |
|
|
| 102 |
|
|
| 103 |
/**
|
|
| 104 |
* @param multiplier The new verticalScale value
|
|
| 105 |
*/
|
|
| 106 | 0 |
public void setVerticalScale(double multiplier) |
| 107 |
{
|
|
| 108 | 0 |
for (Iterator it = this.renderers.iterator(); it.hasNext(); ) |
| 109 |
{
|
|
| 110 | 0 |
((GraphRenderer) it.next()).setVerticalScale(multiplier); |
| 111 |
} |
|
| 112 |
} |
|
| 113 |
|
|
| 114 |
|
|
| 115 |
/**
|
|
| 116 |
* @param type The new verticalScaling value
|
|
| 117 |
*/
|
|
| 118 | 0 |
public void setVerticalScaling(int type) |
| 119 |
{
|
|
| 120 | 0 |
for (Iterator it = this.renderers.iterator(); it.hasNext(); ) |
| 121 |
{
|
|
| 122 | 0 |
((GraphRenderer) it.next()).setVerticalScaling(type); |
| 123 |
} |
|
| 124 |
} |
|
| 125 |
} |
|
| 126 |
|
|
||||||||||