com.droplets.api
Class Graph

java.lang.Object
  |
  +--com.droplets.api.Component
        |
        +--com.droplets.api.Panel
              |
              +--com.droplets.api.Graph
All Implemented Interfaces:
IGraph, IGraph.GraphProxy

public class Graph
extends Panel
implements IGraph, IGraph.GraphProxy


Inner Class Summary
static class Graph.AnnotationComponentProxy
           
static class Graph.PlotComponentProxy
           
 
Inner classes inherited from class com.droplets.api.Panel
Panel.ImageMode
 
Inner classes inherited from class com.droplets.api.IGraph
IGraph.GraphImpl, IGraph.GraphProxy
 
Fields inherited from class com.droplets.api.Panel
IMAGE_CENTER, IMAGE_FIT, IMAGE_SCALE_BOTH, IMAGE_SCALE_DOWN, IMAGE_SCALE_UP, IMAGE_TILE, IMAGE_TILE_WRT_WINDOW, SCROLLBARS_AUTO, SCROLLBARS_OFF, SCROLLBARS_ON
 
Fields inherited from class com.droplets.api.Component
ANCHOR_CENTER, ANCHOR_EAST, ANCHOR_NORTH, ANCHOR_NORTHEAST, ANCHOR_NORTHWEST, ANCHOR_SOUTH, ANCHOR_SOUTHEAST, ANCHOR_SOUTHWEST, ANCHOR_WEST, FILL_BOTH, FILL_HORIZONTAL, FILL_NONE, FILL_VERTICAL
 
Fields inherited from interface com.droplets.api.IGraph
HALIGN_LEFT, HALIGN_RIGHT, TYPE_DATE, TYPE_NUMERICAL, VALIGN_BOTTOM, VALIGN_TOP
 
Constructor Summary
Graph(LayoutPlacement lp, Window window)
          Creates a new Graph area.
 
Method Summary
 void addAnnotation(GraphAnnotation a)
          Adds an annotation to this Graph.
 void addComponent(Component c)
          This method is not used in Graphs.
 void addPlot(PlotComponent plot)
          Adds a plot to this Graph.
 boolean getBoolAttribute(java.lang.String name, boolean defaultValue)
          Convenience method to get a boolean attribute.
 int getLegendHorizontalAlignment()
          Gets the horizontal alignment of the legend.
 int getLegendHorizontalMargin()
          Gets the distance from the horizontal alignment position in pixels.
 int getLegendVerticalAlignment()
          Gets the vertical alignment of the legend.
 int getLegendVerticalMargin()
          Gets the distance from the vertical alignment position in pixels.
 boolean getLegendVisible()
          Gets the visibility of the legend
 java.lang.String getStringAttribute(java.lang.String name, java.lang.String defaultValue)
          Gets the value of an attribute.
 java.lang.String getXAxisDataType()
          Gets the type of the x-axis and x coordinate of the data points.
 java.lang.String[] getXTickLabels()
          Gets the x-tick labels
 java.lang.String getYAxisDataType()
          Gets the type of the y-axis and y coordinate of the data points.
 boolean getZoomable()
          Gets whether the graph is zoomable or not
protected  boolean isFocusTraversableDefault()
          See Component.isFocusTraversableDefault().
 com.droplets.api.GraphAnnotation.AnnotationProxy makeAnnotationProxy(GraphAnnotation a, int orientation)
          Makes the appropriate PlotProxy class for this graph type.
 com.droplets.api.PlotComponent.PlotProxy makePlotProxy(PlotComponent plot, java.lang.String type)
          Makes the appropriate PlotProxy class for this graph type.
 void notifyAddAnnotation(GraphAnnotation a)
           
 void notifyAddPlot(PlotComponent plot)
           
 void setAddedToWindow(boolean isAddedToWindow)
          Window uses this to inform the component that it is added to a window
 void setBoolAttribute(java.lang.String name, boolean value, java.lang.String skinName)
          Convenience method to set a boolean attribute.
 void setLegendHorizontalPosition(int halign, int margin)
          Sets the Horizontal position of the legend.
 void setLegendHorizontalPosition(int halign, int margin, java.lang.String skinName)
          Sets the Horizontal position of the legend.
 void setLegendVerticalPosition(int halign, int margin)
          Sets the Vertical position of the legend.
 void setLegendVerticalPosition(int halign, int margin, java.lang.String skinName)
          Sets the Vertical position of the legend.
 void setLegendVisible(boolean visible)
          Sets the visibility of the legend
 void setLegendVisible(boolean visible, java.lang.String skinName)
          Sets the visibility of the legend
 void setStringAttribute(java.lang.String name, java.lang.String value, java.lang.String skinName)
          Sets the value of an attribute.
 void setXAxisDataType(java.lang.String type)
          Sets the type of the x-axis and x coordinate of the data points.
 void setXTickLabels(java.lang.String[] ticks)
          Sets the x-tick labels
 void setXTickLabels(java.lang.String[] ticks, java.lang.String skinName)
          Sets the x-tick labels.
 void setYAxisDataType(java.lang.String type)
          Sets the type of the x-axis and x coordinate of the data points.
 void setZoomable(boolean z)
          Sets whether the graph is zoomable or not
 void setZoomable(boolean z, java.lang.String skinName)
          Sets whether the graph is zoomable or not
 
Methods inherited from class com.droplets.api.Panel
getBorders, getImageMode, getImageName, getImageRedirector, getImageUrl, getIsMoveHandle, getIsScrollPanelEnabled, getMinScrollContentHeight, getMinScrollContentWidth, getScrollbarVisibility, getSizeToImage, isContainer, setBorders, setBorders, setImageMode, setImageMode, setImageName, setImageName, setImageRedirector, setImageRedirector, setImageUrl, setImageUrl, setIsMoveHandle, setIsMoveHandle, setIsScrollPanelEnabled, setMinScrollContentHeight, setMinScrollContentWidth, setScrollbarVisibility, setSizeToImage, setSizeToImage
 
Methods inherited from class com.droplets.api.Component
action, addActionListener, addAttributeChangeListener, addValueChangeListener, attributeChanged, constructionFailed, equals, fireActionEvent, fireAttributeChangeEvent, fireValueChangeEvent, getAnchor, getAttribute, getBgColor, getBordersAttribute, getColorAttribute, getCursor, getCursorType, getDoubleAttribute, getEnabled, getFgColor, getFill, getFont, getGridHeight, getGridWidth, getGridX, getGridY, getInsets, getIntAttribute, getIPadX, getIPadY, getOpaque, getParent, getScriptingName, getSpecification, getToolTip, getValue, getVisible, getWeightX, getWeightY, getWindow, invalidate, isAddedToWindow, isFocusTraversable, isValid, removeActionListener, removeAttributeChangeListener, removeValueChangeListener, requestFocus, reset, sendCommandAttribute, setAnchor, setAnchor, setArg, setAttribute, setBgColor, setBgColor, setBordersAttribute, setColorAttribute, setCursor, setCursor, setCursorType, setDoubleAttribute, setEnabled, setEnabled, setEnterButton, setEnterButton, setEnterButton, setFgColor, setFgColor, setFill, setFill, setFocusTraversable, setFont, setFont, setGridHeight, setGridHeight, setGridWidth, setGridWidth, setGridX, setGridX, setGridY, setGridY, setInsets, setInsets, setIntAttribute, setIPadX, setIPadX, setIPadY, setIPadY, setItemListAttribute, setOpaque, setOpaque, setScriptingName, setToolTip, setValue, setValue, setVisible, setVisible, setWeightX, setWeightX, setWeightY, setWeightY, storeAttribute, valueChanged
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface com.droplets.api.IGraph.GraphProxy
isAddedToWindow
 

Constructor Detail

Graph

public Graph(LayoutPlacement lp,
             Window window)
Creates a new Graph area.
Parameters:
p - specifies how this component should be laid out in the enclosing panel (see LayoutPlacement)
window - the window in which this component will be placed
Method Detail

addPlot

public void addPlot(PlotComponent plot)
Adds a plot to this Graph.
Specified by:
addPlot in interface IGraph

addAnnotation

public void addAnnotation(GraphAnnotation a)
Adds an annotation to this Graph.
Specified by:
addAnnotation in interface IGraph

notifyAddPlot

public void notifyAddPlot(PlotComponent plot)
Specified by:
notifyAddPlot in interface IGraph.GraphProxy

notifyAddAnnotation

public void notifyAddAnnotation(GraphAnnotation a)
Specified by:
notifyAddAnnotation in interface IGraph.GraphProxy

addComponent

public void addComponent(Component c)
This method is not used in Graphs. Use addPlot instead.
Overrides:
addComponent in class Panel
Parameters:
c - the component to add to this Panel

setAddedToWindow

public void setAddedToWindow(boolean isAddedToWindow)
Window uses this to inform the component that it is added to a window
Specified by:
setAddedToWindow in interface IGraph
Parameters:
isAddedToWindow - true if the component is in a window

getXAxisDataType

public java.lang.String getXAxisDataType()
Gets the type of the x-axis and x coordinate of the data points. The return will be either be a TYPE_* field from this class (e.g. TYPE_NUMERICAL)
Specified by:
getXAxisDataType in interface IGraph
Returns:
the type of the x-axis, chosen from the TYPE_* fields in this class

setXAxisDataType

public void setXAxisDataType(java.lang.String type)
Sets the type of the x-axis and x coordinate of the data points. Objects you pass to addDataPoint can have any numerical type (Integer, Double, etc.) The type parameter must be either be a TYPE_* field from this class (e.g. TYPE_NUMERICAL) This method cannot be called after plots or annotations are added to the Graph
Specified by:
setXAxisDataType in interface IGraph
Parameters:
type - the type of the x-axis, chosen from the TYPE_* fields in this class

getYAxisDataType

public java.lang.String getYAxisDataType()
Gets the type of the y-axis and y coordinate of the data points. The return will be either be a TYPE_* field from this class (e.g. TYPE_NUMERICAL)
Specified by:
getYAxisDataType in interface IGraph
Returns:
the type of the y-axis, chosen from the TYPE_* fields in this class

setYAxisDataType

public void setYAxisDataType(java.lang.String type)
Sets the type of the x-axis and x coordinate of the data points. Objects you pass to addDataPoint can have any numerical type (Integer, Double, etc.) The type parameter must be either be a TYPE_* field from this class (e.g. TYPE_NUMERICAL) This method cannot be called after plots or annotations are added to the Graph
Specified by:
setYAxisDataType in interface IGraph
Parameters:
type - the type of the x-axis, chosen from the TYPE_* fields in this class

getLegendVisible

public boolean getLegendVisible()
Gets the visibility of the legend
Specified by:
getLegendVisible in interface IGraph
Returns:
true if the legend should be visible

setLegendVisible

public void setLegendVisible(boolean visible,
                             java.lang.String skinName)
Sets the visibility of the legend
Specified by:
setLegendVisible in interface IGraph
Parameters:
visible - true if the legend should be visible
skinName - the skinName of this setting

setLegendVisible

public void setLegendVisible(boolean visible)
Sets the visibility of the legend
Specified by:
setLegendVisible in interface IGraph
Parameters:
visible - true if the legend should be visible

getLegendHorizontalAlignment

public int getLegendHorizontalAlignment()
Gets the horizontal alignment of the legend. One of HALIGN_LEFT and HALIGN_RIGHT.
Specified by:
getLegendHorizontalAlignment in interface IGraph
Returns:
the horizontal alignment of the legend

getLegendHorizontalMargin

public int getLegendHorizontalMargin()
Gets the distance from the horizontal alignment position in pixels.
Specified by:
getLegendHorizontalMargin in interface IGraph
Returns:
the distance from the alignment position in pixels.

setLegendHorizontalPosition

public void setLegendHorizontalPosition(int halign,
                                        int margin,
                                        java.lang.String skinName)
Sets the Horizontal position of the legend. The alignment gives the base position and the margin is the offset from that position.
Specified by:
setLegendHorizontalPosition in interface IGraph
Parameters:
halign - either HALIGN_LEFT or HALIGN_RIGHT
margin - the distance from the base position given by halign.
skinName - the skinName of this setting

setLegendHorizontalPosition

public void setLegendHorizontalPosition(int halign,
                                        int margin)
Sets the Horizontal position of the legend. The alignment gives the base position and the margin is the offset from that position.
Specified by:
setLegendHorizontalPosition in interface IGraph
Parameters:
halign - either HALIGN_LEFT or HALIGN_RIGHT
margin - the distance from the base position given by halign.

getLegendVerticalAlignment

public int getLegendVerticalAlignment()
Gets the vertical alignment of the legend. One of VALIGN_TOP and VALIGN_BOTTOM.
Specified by:
getLegendVerticalAlignment in interface IGraph
Returns:
the vertical alignment of the legend

getLegendVerticalMargin

public int getLegendVerticalMargin()
Gets the distance from the vertical alignment position in pixels.
Specified by:
getLegendVerticalMargin in interface IGraph
Returns:
the distance from the alignment position in pixels.

setLegendVerticalPosition

public void setLegendVerticalPosition(int halign,
                                      int margin,
                                      java.lang.String skinName)
Sets the Vertical position of the legend. The alignment gives the base position and the margin is the offset from that position. Use a negative number to be left of the position and positive to be right of the position.
Specified by:
setLegendVerticalPosition in interface IGraph
Parameters:
halign - either HALIGN_LEFT or HALIGN_RIGHT
margin - the distance from the base position given by halign. Use negative numbers to be left of that position and positive to be right
skinName - the skinName of this setting

setLegendVerticalPosition

public void setLegendVerticalPosition(int halign,
                                      int margin)
Sets the Vertical position of the legend. The alignment gives the base position and the margin is the offset from that position. Use a negative number to be left of the position and positive to be right of the position.
Specified by:
setLegendVerticalPosition in interface IGraph
Parameters:
halign - either HALIGN_LEFT or HALIGN_RIGHT
margin - the distance from the base position given by halign. Use negative numbers to be left of that position and positive to be right

getXTickLabels

public java.lang.String[] getXTickLabels()
Gets the x-tick labels
Specified by:
getXTickLabels in interface IGraph
Returns:
the labels used on the x-axis of the graph

setXTickLabels

public void setXTickLabels(java.lang.String[] ticks,
                           java.lang.String skinName)
Sets the x-tick labels. Normally the x-axis labels are determined automatically from the data. If you need named buckets instead, use this function to create them and then use the index of the label as the x value of the data points you add to the plot. You may add fractional x-values and they will be plotted between buckets.
Specified by:
setXTickLabels in interface IGraph
Parameters:
ticks - labels to use on the x-axis
skinName - the skinName of this setting

setXTickLabels

public void setXTickLabels(java.lang.String[] ticks)
Sets the x-tick labels
Specified by:
setXTickLabels in interface IGraph
Parameters:
ticks - labels to use on the x-axis
See Also:
setXTickLabels(String[], String)

getZoomable

public boolean getZoomable()
Gets whether the graph is zoomable or not
Specified by:
getZoomable in interface IGraph
Returns:
true if the graph is zoomable, false otherwise

setZoomable

public void setZoomable(boolean z,
                        java.lang.String skinName)
Sets whether the graph is zoomable or not
Specified by:
setZoomable in interface IGraph
Parameters:
z - true if the graph is zoomable, false otherwise
skinName - the skinName of this setting

setZoomable

public void setZoomable(boolean z)
Sets whether the graph is zoomable or not
Specified by:
setZoomable in interface IGraph
Parameters:
z - true if the graph is zoomable, false otherwise

isFocusTraversableDefault

protected boolean isFocusTraversableDefault()
See Component.isFocusTraversableDefault().
Overrides:
isFocusTraversableDefault in class Component
Following copied from class: com.droplets.api.Component
See Also:
Component.setFocusTraversable(boolean)

setStringAttribute

public void setStringAttribute(java.lang.String name,
                               java.lang.String value,
                               java.lang.String skinName)
Description copied from class: Component
Sets the value of an attribute. Assumes that the name is a valid attribute name for this type of component. To shield clients from having to manipulate the internal attribute names, this method is protected. Component subclasses provide public methods that encapsulate these names and are implemented in terms of this method.
Specified by:
setStringAttribute in interface IGraph.GraphProxy
Overrides:
setStringAttribute in class Component
Following copied from class: com.droplets.api.Component
Parameters:
name - name of the attribute
value - the desired value
skin - the skin name to use for this attribute
Returns:
true if the attribute's value changes as a result of this call, false if it already had the given value

getStringAttribute

public java.lang.String getStringAttribute(java.lang.String name,
                                           java.lang.String defaultValue)
Description copied from class: Component
Gets the value of an attribute. Assumes that the name is a valid attribute name for this type of component. To shield clients of components from having to manipulate the internal attribute names, this method is protected. Component subclasses provide public methods that encapsulate these names and are implemented in terms of this method.
Specified by:
getStringAttribute in interface IGraph.GraphProxy
Overrides:
getStringAttribute in class Component
Following copied from class: com.droplets.api.Component
Parameters:
name - name of the attribute
defaultValue - the value to return if this attribute has not been set. Note that if you pass in null, it will be interpreted as the empty string - this method will never return null.
Returns:
the value of the attribute, or whatever is passed in as the defaultValue argument if the attribute has no value.

setBoolAttribute

public void setBoolAttribute(java.lang.String name,
                             boolean value,
                             java.lang.String skinName)
Description copied from class: Component
Convenience method to set a boolean attribute.
Specified by:
setBoolAttribute in interface IGraph.GraphProxy
Overrides:
setBoolAttribute in class Component
Following copied from class: com.droplets.api.Component
Parameters:
name - name of the attribute
value - the desired value
skin - the skin name to use for this attribute

getBoolAttribute

public boolean getBoolAttribute(java.lang.String name,
                                boolean defaultValue)
Description copied from class: Component
Convenience method to get a boolean attribute.
Specified by:
getBoolAttribute in interface IGraph.GraphProxy
Overrides:
getBoolAttribute in class Component
Following copied from class: com.droplets.api.Component
Parameters:
name - name of the attribute
defaultValue - value to return if the attribute is not set
Returns:
the value

makePlotProxy

public com.droplets.api.PlotComponent.PlotProxy makePlotProxy(PlotComponent plot,
                                                              java.lang.String type)
Makes the appropriate PlotProxy class for this graph type.
Specified by:
makePlotProxy in interface IGraph
Parameters:
plot - the plot for which to make a proxy
type - the type of the plot

makeAnnotationProxy

public com.droplets.api.GraphAnnotation.AnnotationProxy makeAnnotationProxy(GraphAnnotation a,
                                                                            int orientation)
Description copied from interface: IGraph
Makes the appropriate PlotProxy class for this graph type.
Specified by:
makeAnnotationProxy in interface IGraph
Following copied from interface: com.droplets.api.IGraph
Parameters:
plot - the plot for which to make a proxy
type - the type of the plot


Copyright © Droplets, 2001. All Rights Reserved.