org.jgraph.graph

Class PortRenderer

Implemented Interfaces:
CellViewRenderer, Serializable

public class PortRenderer
extends JComponent
implements CellViewRenderer, Serializable

This renderer displays entries that implement the CellView interface and supports the following attributes:
  • GraphConstants.OFFSET GraphConstants.ABSOLUTE
  • Field Summary

    protected Color
    graphBackground
    Cache the current graph background.
    protected boolean
    hasFocus
    Cached hasFocus and selected value.
    protected boolean
    preview
    Cached hasFocus and selected value.
    protected boolean
    selected
    Cached hasFocus and selected value.
    protected PortView
    view
    Cache the current edgeview for drawing.
    protected boolean
    xorEnabled
    Cached hasFocus and selected value.

    Constructor Summary

    PortRenderer()
    Constructs a renderer that may be used to render ports.

    Method Summary

    protected void
    firePropertyChange(String propertyName, Object oldValue, Object newValue)
    Overridden for performance reasons.
    void
    firePropertyChange(String propertyName, boolean oldValue, boolean newValue)
    Overridden for performance reasons.
    void
    firePropertyChange(String propertyName, byte oldValue, byte newValue)
    Overridden for performance reasons.
    void
    firePropertyChange(String propertyName, char oldValue, char newValue)
    Overridden for performance reasons.
    void
    firePropertyChange(String propertyName, double oldValue, double newValue)
    Overridden for performance reasons.
    void
    firePropertyChange(String propertyName, float oldValue, float newValue)
    Overridden for performance reasons.
    void
    firePropertyChange(String propertyName, int oldValue, int newValue)
    Overridden for performance reasons.
    void
    firePropertyChange(String propertyName, long oldValue, long newValue)
    Overridden for performance reasons.
    void
    firePropertyChange(String propertyName, short oldValue, short newValue)
    Overridden for performance reasons.
    Component
    getRendererComponent(JGraph graph, CellView view, boolean sel, boolean focus, boolean preview)
    Configure and return the renderer based on the passed in components.
    void
    paint(Graphics g)
    Paint the renderer.
    void
    repaint(Rectangle r)
    Overridden for performance reasons.
    void
    repaint(long tm, int x, int y, int width, int height)
    Overridden for performance reasons.
    void
    revalidate()
    Overridden for performance reasons.
    void
    validate()
    Overridden for performance reasons.

    Field Details

    graphBackground

    protected Color graphBackground
    Cache the current graph background.

    hasFocus

    protected boolean hasFocus
    Cached hasFocus and selected value.

    preview

    protected boolean preview
    Cached hasFocus and selected value.

    selected

    protected boolean selected
    Cached hasFocus and selected value.

    view

    protected PortView view
    Cache the current edgeview for drawing.

    xorEnabled

    protected boolean xorEnabled
    Cached hasFocus and selected value.

    Constructor Details

    PortRenderer

    public PortRenderer()
    Constructs a renderer that may be used to render ports.

    Method Details

    firePropertyChange

    protected void firePropertyChange(String propertyName,
                                      Object oldValue,
                                      Object newValue)

    firePropertyChange

    public void firePropertyChange(String propertyName,
                                   boolean oldValue,
                                   boolean newValue)

    firePropertyChange

    public void firePropertyChange(String propertyName,
                                   byte oldValue,
                                   byte newValue)

    firePropertyChange

    public void firePropertyChange(String propertyName,
                                   char oldValue,
                                   char newValue)

    firePropertyChange

    public void firePropertyChange(String propertyName,
                                   double oldValue,
                                   double newValue)

    firePropertyChange

    public void firePropertyChange(String propertyName,
                                   float oldValue,
                                   float newValue)

    firePropertyChange

    public void firePropertyChange(String propertyName,
                                   int oldValue,
                                   int newValue)

    firePropertyChange

    public void firePropertyChange(String propertyName,
                                   long oldValue,
                                   long newValue)

    firePropertyChange

    public void firePropertyChange(String propertyName,
                                   short oldValue,
                                   short newValue)

    getRendererComponent

    public Component getRendererComponent(JGraph graph,
                                          CellView view,
                                          boolean sel,
                                          boolean focus,
                                          boolean preview)
    Configure and return the renderer based on the passed in components. The value is typically set from messaging the graph with convertValueToString.
    Specified by:
    getRendererComponent in interface CellViewRenderer
    Parameters:
    graph - the graph that that defines the rendering context.
    view - the cell view that should be rendered.
    sel - whether the object is selected.
    focus - whether the object has the focus.
    preview - whether we are drawing a preview.
    Returns:
    the component used to render the value.

    paint

    public void paint(Graphics g)
    Paint the renderer. Overrides superclass paint to add specific painting. Note: The preview flag is interpreted as "highlight" in this context. (This is used to highlight the port if the mouse is over it.)

    repaint

    public void repaint(Rectangle r)

    repaint

    public void repaint(long tm,
                        int x,
                        int y,
                        int width,
                        int height)

    revalidate

    public void revalidate()

    validate

    public void validate()

    Copyright (C) 2001-2006 Gaudenz Alder. All rights reserved.