Wrapper panel for a diagram/JGraph-pair that implements automatic sizing,
backgrounds, printing and undo support. When wrapped in a scrollpane this
panel adds rulers to the enclosing scrollpane. Furthermore, it automatically
sets the minimum size and scale of the graph based on its settings.
Inner Class :public class Viewport extends JViewport
getParentDiagramPane(Component component) Returns the parent diagram pane of the specified component, or the
component itself if it is a editor diagram pane.
setRulersVisible(boolean isRulersVisible) Sets if the rulers are to be displayed.
protected void
updateMinimumSize() Updates the minimum size of the graph according to the current state of
the background page: if the page is not visible then the minimum size is
set to null, otherwise the minimum size is set to the
smallest area of pages containing the graph.
protected void
updateScale() Updates the scale based on the autoscale policy.
Field Detail
AUTOSCALE_POLICY_NONE
final public static int AUTOSCALE_POLICY_NONE(Code)
Defines the no autoscaling policy.
AUTOSCALE_POLICY_PAGE
final public static int AUTOSCALE_POLICY_PAGE(Code)
Defines the page autoscaling policy.
AUTOSCALE_POLICY_PAGEWIDTH
final public static int AUTOSCALE_POLICY_PAGEWIDTH(Code)
Defines the pagewidth autoscaling policy.
AUTOSCALE_POLICY_WINDOW
final public static int AUTOSCALE_POLICY_WINDOW(Code)
public static String PROPERTY_METRICPROPERTY_PAGEVISIBLEPROPERTY_BACKGROUNDIMAGEPROPERTY_RULERSVISIBLEPROPERTY_PAGEFORMATPROPERTY_AUTOSCALEPOLICYPROPERTY_PAGESCALE(Code)
Bound property names for the respective properties.
Holds the autoscale reset listener to be used with the graph. This
listener is used to reset the autoscale policy to none if the scale of
the graph is changed manually, ie. not by means of automatic
scaling.
Returns a
BufferedImage for the graph using inset as an empty
border around the cells of the graph. If bg is null then a transparent
background is applied to the image, else the background is filled with
the bg color. Therefore, one should only use a null background if the
fileformat support transparency, eg. GIF and PNG. For JPG, you can use
Color.WHITE for example. This implementation also takes
into account potential background images.
Returns an image of the graph.
Returns the parent diagram pane of the specified component, or the
component itself if it is a editor diagram pane.
Returns the parent editor diagram pane of component.
Prints the specified page on the specified graphics using
pageForm for the page format.
Parameters: g - The graphics to paint the graph on. Parameters: printFormat - The page format to use for printing. Parameters: page - The page to print Returns Printable.PAGE_EXISTS orPrintable.NO_SUCH_PAGE.
setAutoScalePolicy
public void setAutoScalePolicy(int autoScalePolicy)(Code)
Specifies if the rulers should use metric units. Fires a property change
event for
JGraphEditorDiagramPane.PROPERTY_METRIC .
Parameters: isMetric - The isMetric to set.
public void setPageVisible(boolean isPageVisible)(Code)
Sets if the background page should be visible.Fires a property change
event for
JGraphEditorDiagramPane.PROPERTY_PAGEVISIBLE .
Parameters: isPageVisible - The isPageVisible to set.
setRulersVisible
public void setRulersVisible(boolean isRulersVisible)(Code)
Updates the minimum size of the graph according to the current state of
the background page: if the page is not visible then the minimum size is
set to null, otherwise the minimum size is set to the
smallest area of pages containing the graph.