kcl.waterloo.graphics.plots2D
Class GJComponentPlot
- java.lang.Object
-
- kcl.waterloo.observable.GJAbstractObservable
-
- kcl.waterloo.graphics.plots2D.GJAbstractPlotModelImpl
-
- kcl.waterloo.graphics.plots2D.GJAbstractPlot
-
- kcl.waterloo.graphics.plots2D.GJComponentPlot
-
- All Implemented Interfaces:
- java.beans.PropertyChangeListener, java.util.EventListener, GJEffectorInterface, GJFastPlotInterface, GJPlotInterface, GJLinkableInterface, GJObservableInterface, GJDataModelInterface<java.awt.geom.Rectangle2D,GJGraphInterface>, GJFillableInterface<java.awt.Shape,java.awt.Paint>, GJScreenDataInterface<java.awt.Shape>, GJVisualsInterface<GJMarker,java.awt.Paint,java.awt.BasicStroke,java.awt.Dimension,java.awt.Shape>
public class GJComponentPlot extends GJAbstractPlot
GJComponentPlot is an exception to the norm. Instead of plotting data, GJComponentPlot adds Swing JComponents to the graph at the locations specified in XData and YData - JLabels, JButtons, even JPanels with web pages in them if you really want to. As graph objects use a SpringLayout, the preferred size property of the added components can be used to control their size. They will be centered on the point defined in XData and YData (horizontally and vertically). Effectively, GJComponentPlot creates a scatter plot where each point is represented by a Swing component. These components are programmable just as they would be in any GUI so you can use them to allow a high level of user-interaction with the graph.This code is part of the Waterloo Scientific Graphics package from King's College London
-
-
Field Summary
-
Fields inherited from class kcl.waterloo.graphics.plots2D.GJAbstractPlotModelImpl
screenDataArray
-
-
Constructor Summary
Constructors Constructor and Description GJComponentPlot()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method and Description static GJPlotInterfacecreateInstance()javax.swing.JComponentgetComponent(int index)java.util.ArrayList<javax.swing.JComponent>getComponentArray()java.util.ArrayList<java.awt.Dimension>getPreferredSize()booleanisMultiplexible()voidpaintPlot(java.awt.Graphics2D g2)This paintPlot for does NOT do any painting.voidremoveComponents()Removes all components associated with this plot from the graphvoidsetComponentArray(java.util.ArrayList<javax.swing.JComponent> c)voidsetComponents(java.lang.Class clzz)voidsetComponents(javax.swing.JComponent c)voidsetComponentsVisible(boolean flag)voidsetPreferredSize(java.util.ArrayList<java.awt.Dimension> arr)voidsetPreferredSize(int width, int height)-
Methods inherited from class kcl.waterloo.graphics.plots2D.GJAbstractPlot
add, createFrame, findPlotBelow, findPlotBelow, getAreaFill, getAreaPaint, getDataRange, getEffect, getFillable, getFillAlpha, getFillComposite, getNode, getParentPlot, getPlots, getTopPlot, getVisualRange, intersects, intersects, isOnEDT, isSelected, isShowing, isTopPlot, isVisible, paintPlotEntry, plotRedraw, plotRedraw, plotUpdate, plotUpdate, plus, propertyChange, saveAsXML, setAntialiasing, setAreaFill, setAreaPaint, setEffect, setFillAlpha, setFillComposite, setParentPlot, setSelected, setSelectionFlag, setVisible, toString, toString
-
Methods inherited from class kcl.waterloo.graphics.plots2D.GJAbstractPlotModelImpl
getAlpha, getCompositeMode, getDataModel, getDynamicMarkerSize, getEdgeColor, getEdgeStroke, getFill, getLineColor, getLineStroke, getMarker, getMarkerArray, getMultiplexLength, getName, getParentGraph, getPlotList, getRenderHintState, getScreenDataArray, getScreenDataArrayAsCopy, getTextHintState, getVisualModel, getXData, getXDataValues, getXTransform, getYData, getYDataValues, getYTransform, isMultiplexed, setAlpha, setCompositeMode, setData, setDataModel, setDynamicMarkerSize, setEdgeColor, setEdgeColor, setEdgeColor, setEdgeColor, setEdgeColor, setEdgeStroke, setEdgeStroke, setEdgeStroke, setEdgeStroke, setEdgeStroke, setExtraData0, setExtraData1, setExtraData2, setExtraData3, setFill, setFill, setFill, setFill, setFill, setLineColor, setLineColor, setLineColor, setLineColor, setLineStroke, setLineStroke, setLineStroke, setLineStroke, setLineStroke, setMarker, setMarker, setMarkerArray, setMarkerArray, setMarkerArray, setName, setName, setParentGraph, setPlotList, setRenderHintState, setScreenDataArray, setTextHintState, setVisualModel, setXData, setXData, setXData, setXData, setXData, setYData, setYData, setYData, setYData, setYData
-
Methods inherited from class kcl.waterloo.observable.GJAbstractObservable
addLink, addPropertyChangeListener, addPropertyChangeListener, firePropertyChange, getLinks, getPCS, getPropertyChangeListeners, getPropertyChangeListeners, hasListeners, hasSelfListener, removeLink, removePropertyChangeListener, removePropertyChangeListener, setLinks
-
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface kcl.waterloo.observable.GJObservableInterface
addPropertyChangeListener, addPropertyChangeListener, firePropertyChange, getPropertyChangeListeners, getPropertyChangeListeners, hasListeners, hasSelfListener, removePropertyChangeListener, removePropertyChangeListener
-
Methods inherited from interface kcl.waterloo.observable.GJLinkableInterface
addLink, getLinks, removeLink, setLinks
-
-
-
-
Method Detail
-
createInstance
public static GJPlotInterface createInstance()
-
setComponentsVisible
public void setComponentsVisible(boolean flag)
-
getComponentArray
public java.util.ArrayList<javax.swing.JComponent> getComponentArray()
-
setComponentArray
public final void setComponentArray(java.util.ArrayList<javax.swing.JComponent> c)
-
getComponent
public final javax.swing.JComponent getComponent(int index)
-
setPreferredSize
public final void setPreferredSize(int width, int height)
-
getPreferredSize
public final java.util.ArrayList<java.awt.Dimension> getPreferredSize()
-
setPreferredSize
public final void setPreferredSize(java.util.ArrayList<java.awt.Dimension> arr)
-
setComponents
public void setComponents(javax.swing.JComponent c)
-
setComponents
public final void setComponents(java.lang.Class clzz)
-
removeComponents
public void removeComponents()
Removes all components associated with this plot from the graph
-
paintPlot
public void paintPlot(java.awt.Graphics2D g2)
This paintPlot for does NOT do any painting. Instead it calls the add method of the parent graph and places swing components at the required locations. These will become children of the graph, which is a JComponent itself and will therefore be painted as normal from the paintChildren method of the graph. The components need be added only once i.e. the first call to paintPlot. The upToDate flag is used to control this. upToDate should be set false when the data are first added to the plot. Adding the components to the graph in this way allows us to construct a plot with "orphan" JComponents so it behaves in the same way as other plot types rather than being linked to a parent JComponent. The update includes a test for components that have been added previously using the standard add(Component) method. This will usually only be the case when added as part of a de-serialization.- Specified by:
paintPlotin interfaceGJPlotInterface- Overrides:
paintPlotin classGJAbstractPlot- Parameters:
g2-
-
isMultiplexible
public boolean isMultiplexible()
- Specified by:
isMultiplexiblein interfaceGJDataModelInterface<java.awt.geom.Rectangle2D,GJGraphInterface>- Overrides:
isMultiplexiblein classGJAbstractPlot
-
-
DMelt 3.0 © DataMelt by jWork.ORG