public class EdgeRenderer extends javax.swing.JComponent implements CellViewRenderer, java.io.Serializable
javax.swing.JComponent.AccessibleJComponent
Modifier and Type | Field and Description |
---|---|
protected int |
beginDeco
Painting attributes of the current edgeview
|
protected boolean |
beginFill
Boolean attributes of the current edgeview.
|
protected int |
beginSize
Painting attributes of the current edgeview
|
protected Bezier |
bezier
Cached bezier curve
|
protected java.awt.Color |
borderColor
Color attributes of the current edgeview.
|
protected boolean |
childrenSelected
Boolean attributes of the current edgeview.
|
protected float |
dashOffset
Contains the current dash offset.
|
protected java.awt.Color |
defaultBackground
Color attributes of the current edgeview.
|
protected java.awt.Color |
defaultForeground
Color attributes of the current edgeview.
|
protected int |
endDeco
Painting attributes of the current edgeview
|
protected boolean |
endFill
Boolean attributes of the current edgeview.
|
protected int |
endSize
Painting attributes of the current edgeview
|
java.awt.Font |
extraLabelFont
Override this if you want the extra labels to appear in a special fontJ
|
protected boolean |
focus
Boolean attributes of the current edgeview.
|
protected java.awt.Color |
fontColor
Color attributes of the current edgeview.
|
protected static java.awt.Graphics |
fontGraphics
Static Graphics used for Font Metrics
|
protected java.awt.Color |
gradientColor
The gradient color of the edge
|
protected java.lang.ref.WeakReference |
graph
Cache the current graph for drawing
|
protected java.awt.Color |
gridColor
The color of the graph grid
|
protected java.awt.Color |
highlightColor
The color of highlighted cells
|
static boolean |
HIT_LABEL_EXACT
Switch for exact label hit detection on rotated labels.
|
protected boolean |
isMoveBelowZero
Boolean attributes of the current edgeview.
|
protected boolean |
labelBorder
Boolean attributes of the current edgeview.
|
protected boolean |
labelsEnabled
Cached value of whether the label is to be displayed
|
protected boolean |
labelTransformEnabled
Boolean attributes of the current edgeview.
|
static double |
LABELWIDTHBUFFER
When zooming a graph the font size jumps at certain zoom levels rather than
scaling smoothly.
|
protected float[] |
lineDash
Contains the current dash pattern.
|
protected int |
lineStyle
Painting attributes of the current edgeview
|
protected float |
lineWidth
Width of the current edge view
|
protected java.awt.Color |
lockedHandleColor
The color of the second available handle
|
protected java.awt.FontMetrics |
metrics
Reference to the font metrics of the above
|
protected boolean |
opaque
Boolean attributes of the current edgeview.
|
protected boolean |
preview
Boolean attributes of the current edgeview.
|
protected boolean |
selected
Boolean attributes of the current edgeview.
|
boolean |
simpleExtraLabels
A switch for painting the extra labels
|
protected Spline2D |
spline
Cached spline curve
|
protected EdgeView |
view
Cache the current edgeview for drawing
|
listenerList, TOOL_TIP_TEXT_KEY, ui, UNDEFINED_CONDITION, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_FOCUSED, WHEN_IN_FOCUSED_WINDOW
Constructor and Description |
---|
EdgeRenderer()
Constructs a renderer that may be used to render edges.
|
Modifier and Type | Method and Description |
---|---|
protected void |
afterEdgePaint(java.awt.Graphics g)
Hook method for painting after the default painting
|
protected void |
beforeEdgePaint(java.awt.Graphics g)
Hook method for painting prior to default painting
|
protected java.awt.Shape |
createLineEnd(int size,
int style,
java.awt.geom.Point2D src,
java.awt.geom.Point2D dst)
Paint the current view's direction.
|
protected java.awt.Shape |
createShape()
Returns the shape that represents the current edge in the context of the
current graph.
|
void |
firePropertyChange(java.lang.String propertyName,
boolean oldValue,
boolean newValue)
Overridden for performance reasons.
|
void |
firePropertyChange(java.lang.String propertyName,
byte oldValue,
byte newValue)
Overridden for performance reasons.
|
void |
firePropertyChange(java.lang.String propertyName,
char oldValue,
char newValue)
Overridden for performance reasons.
|
void |
firePropertyChange(java.lang.String propertyName,
double oldValue,
double newValue)
Overridden for performance reasons.
|
void |
firePropertyChange(java.lang.String propertyName,
float oldValue,
float newValue)
Overridden for performance reasons.
|
void |
firePropertyChange(java.lang.String propertyName,
int oldValue,
int newValue)
Overridden for performance reasons.
|
void |
firePropertyChange(java.lang.String propertyName,
long oldValue,
long newValue)
Overridden for performance reasons.
|
protected void |
firePropertyChange(java.lang.String propertyName,
java.lang.Object oldValue,
java.lang.Object newValue)
Overridden for performance reasons.
|
void |
firePropertyChange(java.lang.String propertyName,
short oldValue,
short newValue)
Overridden for performance reasons.
|
java.awt.geom.Rectangle2D |
getBounds(CellView value)
Returns the bounds of the edge shape.
|
java.awt.geom.Rectangle2D |
getExtraLabelBounds(JGraph paintingContext,
EdgeView view,
int index)
Returns the label bounds of the specified view in the given graph.
|
java.awt.geom.Point2D |
getExtraLabelPosition(EdgeView view,
int index)
Returns the label position of the specified view in the given graph.
|
java.awt.Dimension |
getExtraLabelSize(JGraph paintingContext,
EdgeView view,
int index)
Returns the label size of the specified view in the given graph.
|
java.awt.Color |
getGradientColor() |
java.awt.geom.Rectangle2D |
getLabelBounds(JGraph paintingContext,
EdgeView view)
Returns the label bounds of the specified view in the given graph.
|
java.awt.geom.Rectangle2D |
getLabelBounds(java.awt.geom.Point2D p,
java.awt.Dimension d,
java.lang.String label)
Returns the label bounds of the specified view in the given graph.
|
java.awt.geom.Point2D |
getLabelPosition(EdgeView view)
Returns the label position of the specified view in the given graph.
|
protected java.awt.geom.Point2D |
getLabelPosition(java.awt.geom.Point2D pos)
Returns the label position of the specified view in the given graph.
|
java.awt.Dimension |
getLabelSize(EdgeView view,
java.lang.String label)
Returns the label size of the specified view in the given graph.
|
java.awt.geom.Rectangle2D |
getPaintBounds(EdgeView view)
Returns the bounds of the edge shape without label
|
java.awt.Component |
getRendererComponent(JGraph graph,
CellView view,
boolean sel,
boolean focus,
boolean preview)
Configure and return the renderer based on the passed in components.
|
protected void |
installAttributes(CellView view)
Installs the attributes of specified cell in this renderer instance.
|
boolean |
intersects(JGraph graph,
CellView value,
java.awt.Rectangle rect)
Returns true if the edge shape intersects the given rectangle.
|
protected boolean |
isFillable(int decoration) |
void |
paint(java.awt.Graphics g)
Paint the renderer.
|
protected void |
paintEdge(java.awt.Graphics g)
Paints the edge itself
|
protected void |
paintLabel(java.awt.Graphics g,
java.lang.String label,
java.awt.geom.Point2D p,
boolean mainLabel)
Paint the specified label for the current edgeview.
|
protected void |
paintLabels(java.awt.Graphics g)
Draws the edge labels
|
protected void |
paintSelection(java.awt.Graphics g)
Paints any selection effect applied to the edge
|
protected void |
paintSelectionBorder(java.awt.Graphics g)
Provided for subclassers to paint a selection border.
|
void |
repaint(long tm,
int x,
int y,
int width,
int height)
Overridden for performance reasons.
|
void |
repaint(java.awt.Rectangle r)
Overridden for performance reasons.
|
void |
revalidate()
Overridden for performance reasons.
|
void |
setGradientColor(java.awt.Color gradientColor) |
protected void |
translateGraphics(java.awt.Graphics g) |
void |
validate()
Overridden for performance reasons.
|
addAncestorListener, addNotify, addVetoableChangeListener, computeVisibleRect, contains, createToolTip, disable, enable, fireVetoableChange, getActionForKeyStroke, getActionMap, getAlignmentX, getAlignmentY, getAncestorListeners, getAutoscrolls, getBaseline, getBaselineResizeBehavior, getBorder, getBounds, getClientProperty, getComponentGraphics, getComponentPopupMenu, getConditionForKeyStroke, getDebugGraphicsOptions, getDefaultLocale, getFontMetrics, getGraphics, getHeight, getInheritsPopupMenu, getInputMap, getInputMap, getInputVerifier, getInsets, getInsets, getListeners, getLocation, getMaximumSize, getMinimumSize, getNextFocusableComponent, getPopupLocation, getPreferredSize, getRegisteredKeyStrokes, getRootPane, getSize, getToolTipLocation, getToolTipText, getToolTipText, getTopLevelAncestor, getTransferHandler, getUIClassID, getVerifyInputWhenFocusTarget, getVetoableChangeListeners, getVisibleRect, getWidth, getX, getY, grabFocus, hide, isDoubleBuffered, isLightweightComponent, isManagingFocus, isOpaque, isOptimizedDrawingEnabled, isPaintingForPrint, isPaintingOrigin, isPaintingTile, isRequestFocusEnabled, isValidateRoot, paintBorder, paintChildren, paintComponent, paintImmediately, paintImmediately, paramString, print, printAll, printBorder, printChildren, printComponent, processComponentKeyEvent, processKeyBinding, processKeyEvent, processMouseEvent, processMouseMotionEvent, putClientProperty, registerKeyboardAction, registerKeyboardAction, removeAncestorListener, removeNotify, removeVetoableChangeListener, requestDefaultFocus, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, resetKeyboardActions, reshape, scrollRectToVisible, setActionMap, setAlignmentX, setAlignmentY, setAutoscrolls, setBackground, setBorder, setComponentPopupMenu, setDebugGraphicsOptions, setDefaultLocale, setDoubleBuffered, setEnabled, setFocusTraversalKeys, setFont, setForeground, setInheritsPopupMenu, setInputMap, setInputVerifier, setMaximumSize, setMinimumSize, setNextFocusableComponent, setOpaque, setPreferredSize, setRequestFocusEnabled, setToolTipText, setTransferHandler, setUI, setVerifyInputWhenFocusTarget, setVisible, unregisterKeyboardAction, update, updateUI
add, add, add, add, add, addContainerListener, addImpl, addPropertyChangeListener, addPropertyChangeListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getComponentZOrder, getContainerListeners, getFocusTraversalKeys, getFocusTraversalPolicy, getLayout, getMousePosition, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusCycleRoot, isFocusTraversalPolicyProvider, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, printComponents, processContainerEvent, processEvent, remove, remove, removeAll, removeContainerListener, setComponentZOrder, setFocusCycleRoot, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setLayout, transferFocusDownCycle, validateTree
action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, coalesceEvents, contains, createImage, createImage, createVolatileImage, createVolatileImage, disableEvents, dispatchEvent, enable, enableEvents, enableInputMethods, getAccessibleContext, getBackground, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusCycleRootAncestor, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getForeground, getGraphicsConfiguration, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputContext, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocale, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPeer, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getToolkit, getTreeLock, gotFocus, handleEvent, hasFocus, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isPreferredSizeSet, isShowing, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, postEvent, prepareImage, prepareImage, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processMouseWheelEvent, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, resize, resize, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setFocusable, setFocusTraversalKeysEnabled, setIgnoreRepaint, setLocale, setLocation, setLocation, setName, setSize, setSize, show, show, size, toString, transferFocus, transferFocusBackward, transferFocusUpCycle
public static boolean HIT_LABEL_EXACT
protected static transient java.awt.Graphics fontGraphics
public static double LABELWIDTHBUFFER
public boolean simpleExtraLabels
public java.awt.Font extraLabelFont
protected transient java.awt.FontMetrics metrics
protected transient java.lang.ref.WeakReference graph
protected transient EdgeView view
protected transient int beginDeco
protected transient int endDeco
protected transient int beginSize
protected transient int endSize
protected transient int lineStyle
protected transient float lineWidth
protected transient boolean labelsEnabled
protected transient boolean labelBorder
protected transient boolean beginFill
protected transient boolean endFill
protected transient boolean focus
protected transient boolean selected
protected transient boolean preview
protected transient boolean opaque
protected transient boolean childrenSelected
protected transient boolean labelTransformEnabled
protected transient boolean isMoveBelowZero
protected transient java.awt.Color borderColor
protected transient java.awt.Color defaultForeground
protected transient java.awt.Color defaultBackground
protected transient java.awt.Color fontColor
protected transient float[] lineDash
protected transient float dashOffset
protected transient java.awt.Color gradientColor
protected transient java.awt.Color gridColor
protected transient java.awt.Color lockedHandleColor
protected transient java.awt.Color highlightColor
protected transient Bezier bezier
protected transient Spline2D spline
public EdgeRenderer()
public java.awt.Component getRendererComponent(JGraph graph, CellView view, boolean sel, boolean focus, boolean preview)
convertValueToString
.getRendererComponent
in interface CellViewRenderer
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.public boolean intersects(JGraph graph, CellView value, java.awt.Rectangle rect)
public java.awt.geom.Rectangle2D getBounds(CellView value)
public java.awt.geom.Rectangle2D getLabelBounds(JGraph paintingContext, EdgeView view)
public java.awt.geom.Rectangle2D getExtraLabelBounds(JGraph paintingContext, EdgeView view, int index)
public java.awt.geom.Rectangle2D getLabelBounds(java.awt.geom.Point2D p, java.awt.Dimension d, java.lang.String label)
public java.awt.geom.Point2D getLabelPosition(EdgeView view)
public java.awt.geom.Point2D getExtraLabelPosition(EdgeView view, int index)
protected java.awt.geom.Point2D getLabelPosition(java.awt.geom.Point2D pos)
public java.awt.Dimension getExtraLabelSize(JGraph paintingContext, EdgeView view, int index)
public java.awt.Dimension getLabelSize(EdgeView view, java.lang.String label)
protected void installAttributes(CellView view)
view
- the cell view to retrieve the attribute values from.protected boolean isFillable(int decoration)
public java.awt.geom.Rectangle2D getPaintBounds(EdgeView view)
public void paint(java.awt.Graphics g)
paint
in class javax.swing.JComponent
protected void paintLabels(java.awt.Graphics g)
g
- the graphics object being painted toprotected void paintEdge(java.awt.Graphics g)
g
- the graphics object being painted toprotected void paintSelection(java.awt.Graphics g)
g
- the graphics object being painted toprotected void beforeEdgePaint(java.awt.Graphics g)
g
- the graphics object being painted toprotected void afterEdgePaint(java.awt.Graphics g)
g
- the graphics object being painted toprotected void paintSelectionBorder(java.awt.Graphics g)
protected void translateGraphics(java.awt.Graphics g)
protected void paintLabel(java.awt.Graphics g, java.lang.String label, java.awt.geom.Point2D p, boolean mainLabel)
protected java.awt.Shape createShape()
protected java.awt.Shape createLineEnd(int size, int style, java.awt.geom.Point2D src, java.awt.geom.Point2D dst)
public java.awt.Color getGradientColor()
public void setGradientColor(java.awt.Color gradientColor)
gradientColor
- The gradientColor to set.public void validate()
validate
in class java.awt.Container
public void revalidate()
revalidate
in class javax.swing.JComponent
public void repaint(long tm, int x, int y, int width, int height)
repaint
in class javax.swing.JComponent
public void repaint(java.awt.Rectangle r)
repaint
in class javax.swing.JComponent
protected void firePropertyChange(java.lang.String propertyName, java.lang.Object oldValue, java.lang.Object newValue)
firePropertyChange
in class java.awt.Component
public void firePropertyChange(java.lang.String propertyName, byte oldValue, byte newValue)
firePropertyChange
in class java.awt.Component
public void firePropertyChange(java.lang.String propertyName, char oldValue, char newValue)
firePropertyChange
in class javax.swing.JComponent
public void firePropertyChange(java.lang.String propertyName, short oldValue, short newValue)
firePropertyChange
in class java.awt.Component
public void firePropertyChange(java.lang.String propertyName, int oldValue, int newValue)
firePropertyChange
in class javax.swing.JComponent
public void firePropertyChange(java.lang.String propertyName, long oldValue, long newValue)
firePropertyChange
in class java.awt.Component
public void firePropertyChange(java.lang.String propertyName, float oldValue, float newValue)
firePropertyChange
in class java.awt.Component
public void firePropertyChange(java.lang.String propertyName, double oldValue, double newValue)
firePropertyChange
in class java.awt.Component
public void firePropertyChange(java.lang.String propertyName, boolean oldValue, boolean newValue)
firePropertyChange
in class javax.swing.JComponent
Copyright (C) 2001-2009 JGraph Ltd. All rights reserved.