org.jgraph.graph
Class EdgeRenderer
- java.lang.Object
-
- java.awt.Component
-
- java.awt.Container
-
- javax.swing.JComponent
-
- org.jgraph.graph.EdgeRenderer
-
- All Implemented Interfaces:
- java.awt.image.ImageObserver, java.awt.MenuContainer, java.io.Serializable, CellViewRenderer
public class EdgeRenderer extends javax.swing.JComponent implements CellViewRenderer, java.io.Serializable
This renderer displays entries that implement the CellView interface.- See Also:
- Serialized Form
-
-
Nested Class Summary
-
Field Summary
Fields Modifier and Type Field and Description java.awt.FontextraLabelFontOverride this if you want the extra labels to appear in a special fontJstatic booleanHIT_LABEL_EXACTSwitch for exact label hit detection on rotated labels.static doubleLABELWIDTHBUFFERWhen zooming a graph the font size jumps at certain zoom levels rather than scaling smoothly.booleansimpleExtraLabelsA switch for painting the extra labels-
Fields inherited from class javax.swing.JComponent
TOOL_TIP_TEXT_KEY, UNDEFINED_CONDITION, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_FOCUSED, WHEN_IN_FOCUSED_WINDOW
-
-
Constructor Summary
Constructors Constructor and Description EdgeRenderer()Constructs a renderer that may be used to render edges.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method and Description voidfirePropertyChange(java.lang.String propertyName, boolean oldValue, boolean newValue)Overridden for performance reasons.voidfirePropertyChange(java.lang.String propertyName, byte oldValue, byte newValue)Overridden for performance reasons.voidfirePropertyChange(java.lang.String propertyName, char oldValue, char newValue)Overridden for performance reasons.voidfirePropertyChange(java.lang.String propertyName, double oldValue, double newValue)Overridden for performance reasons.voidfirePropertyChange(java.lang.String propertyName, float oldValue, float newValue)Overridden for performance reasons.voidfirePropertyChange(java.lang.String propertyName, int oldValue, int newValue)Overridden for performance reasons.voidfirePropertyChange(java.lang.String propertyName, long oldValue, long newValue)Overridden for performance reasons.voidfirePropertyChange(java.lang.String propertyName, short oldValue, short newValue)Overridden for performance reasons.java.awt.geom.Rectangle2DgetBounds(CellView value)Returns the bounds of the edge shape.java.awt.geom.Rectangle2DgetExtraLabelBounds(JGraph paintingContext, EdgeView view, int index)Returns the label bounds of the specified view in the given graph.java.awt.geom.Point2DgetExtraLabelPosition(EdgeView view, int index)Returns the label position of the specified view in the given graph.java.awt.DimensiongetExtraLabelSize(JGraph paintingContext, EdgeView view, int index)Returns the label size of the specified view in the given graph.java.awt.ColorgetGradientColor()java.awt.geom.Rectangle2DgetLabelBounds(JGraph paintingContext, EdgeView view)Returns the label bounds of the specified view in the given graph.java.awt.geom.Rectangle2DgetLabelBounds(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.Point2DgetLabelPosition(EdgeView view)Returns the label position of the specified view in the given graph.java.awt.DimensiongetLabelSize(EdgeView view, java.lang.String label)Returns the label size of the specified view in the given graph.java.awt.geom.Rectangle2DgetPaintBounds(EdgeView view)Returns the bounds of the edge shape without labeljava.awt.ComponentgetRendererComponent(JGraph graph, CellView view, boolean sel, boolean focus, boolean preview)Configure and return the renderer based on the passed in components.booleanintersects(JGraph graph, CellView value, java.awt.Rectangle rect)Returns true if the edge shape intersects the given rectangle.voidpaint(java.awt.Graphics g)Paint the renderer.voidrepaint(long tm, int x, int y, int width, int height)Overridden for performance reasons.voidrepaint(java.awt.Rectangle r)Overridden for performance reasons.voidrevalidate()Overridden for performance reasons.voidsetGradientColor(java.awt.Color gradientColor)voidvalidate()Overridden for performance reasons.-
Methods inherited from class javax.swing.JComponent
addAncestorListener, addNotify, addVetoableChangeListener, computeVisibleRect, contains, createToolTip, disable, enable, getActionForKeyStroke, getActionMap, getAlignmentX, getAlignmentY, getAncestorListeners, getAutoscrolls, getBaseline, getBaselineResizeBehavior, getBorder, getBounds, getClientProperty, 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, isPaintingTile, isRequestFocusEnabled, isValidateRoot, paintImmediately, paintImmediately, print, printAll, putClientProperty, registerKeyboardAction, registerKeyboardAction, removeAncestorListener, removeNotify, removeVetoableChangeListener, requestDefaultFocus, requestFocus, requestFocus, 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, setVerifyInputWhenFocusTarget, setVisible, unregisterKeyboardAction, update, updateUI
-
Methods inherited from class java.awt.Container
add, add, add, add, add, addContainerListener, 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, remove, remove, removeAll, removeContainerListener, setComponentZOrder, setFocusCycleRoot, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setLayout, transferFocusDownCycle
-
Methods inherited from class java.awt.Component
action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, contains, createImage, createImage, createVolatileImage, createVolatileImage, dispatchEvent, enable, 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, 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
-
-
-
-
Field Detail
-
HIT_LABEL_EXACT
public static boolean HIT_LABEL_EXACT
Switch for exact label hit detection on rotated labels. Default is false.
-
LABELWIDTHBUFFER
public static double LABELWIDTHBUFFER
When zooming a graph the font size jumps at certain zoom levels rather than scaling smoothly. Sometimes the zoom on the font is more than the component zoom and cropping occurs. This buffer allows for the maximum occurance of this
-
simpleExtraLabels
public boolean simpleExtraLabels
A switch for painting the extra labels
-
extraLabelFont
public java.awt.Font extraLabelFont
Override this if you want the extra labels to appear in a special fontJ
-
-
Constructor Detail
-
EdgeRenderer
public EdgeRenderer()
Constructs a renderer that may be used to render edges.
-
-
Method Detail
-
getRendererComponent
public 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. The value is typically set from messaging the graph withconvertValueToString.- Specified by:
getRendererComponentin interfaceCellViewRenderer- 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.
-
intersects
public boolean intersects(JGraph graph, CellView value, java.awt.Rectangle rect)
Returns true if the edge shape intersects the given rectangle.
-
getBounds
public java.awt.geom.Rectangle2D getBounds(CellView value)
Returns the bounds of the edge shape.
-
getLabelBounds
public java.awt.geom.Rectangle2D getLabelBounds(JGraph paintingContext, EdgeView view)
Returns the label bounds of the specified view in the given graph.
-
getExtraLabelBounds
public java.awt.geom.Rectangle2D getExtraLabelBounds(JGraph paintingContext, EdgeView view, int index)
Returns the label bounds of the specified view in the given graph. Note: The index is the position of the String object for the label in the extra labels array of the view.
-
getLabelBounds
public 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.
-
getLabelPosition
public java.awt.geom.Point2D getLabelPosition(EdgeView view)
Returns the label position of the specified view in the given graph.
-
getExtraLabelPosition
public java.awt.geom.Point2D getExtraLabelPosition(EdgeView view, int index)
Returns the label position of the specified view in the given graph.
-
getExtraLabelSize
public java.awt.Dimension getExtraLabelSize(JGraph paintingContext, EdgeView view, int index)
Returns the label size of the specified view in the given graph.
-
getLabelSize
public java.awt.Dimension getLabelSize(EdgeView view, java.lang.String label)
Returns the label size of the specified view in the given graph.
-
getPaintBounds
public java.awt.geom.Rectangle2D getPaintBounds(EdgeView view)
Returns the bounds of the edge shape without label
-
paint
public void paint(java.awt.Graphics g)
Paint the renderer.- Overrides:
paintin classjavax.swing.JComponent
-
getGradientColor
public java.awt.Color getGradientColor()
- Returns:
- Returns the gradientColor.
-
setGradientColor
public void setGradientColor(java.awt.Color gradientColor)
- Parameters:
gradientColor- The gradientColor to set.
-
validate
public void validate()
Overridden for performance reasons. See the Implementation Note for more information.- Overrides:
validatein classjava.awt.Container
-
revalidate
public void revalidate()
Overridden for performance reasons. See the Implementation Note for more information.- Overrides:
revalidatein classjavax.swing.JComponent
-
repaint
public void repaint(long tm, int x, int y, int width, int height)Overridden for performance reasons. See the Implementation Note for more information.- Overrides:
repaintin classjavax.swing.JComponent
-
repaint
public void repaint(java.awt.Rectangle r)
Overridden for performance reasons. See the Implementation Note for more information.- Overrides:
repaintin classjavax.swing.JComponent
-
firePropertyChange
public void firePropertyChange(java.lang.String propertyName, byte oldValue, byte newValue)Overridden for performance reasons. See the Implementation Note for more information.- Overrides:
firePropertyChangein classjava.awt.Component
-
firePropertyChange
public void firePropertyChange(java.lang.String propertyName, char oldValue, char newValue)Overridden for performance reasons. See the Implementation Note for more information.- Overrides:
firePropertyChangein classjavax.swing.JComponent
-
firePropertyChange
public void firePropertyChange(java.lang.String propertyName, short oldValue, short newValue)Overridden for performance reasons. See the Implementation Note for more information.- Overrides:
firePropertyChangein classjava.awt.Component
-
firePropertyChange
public void firePropertyChange(java.lang.String propertyName, int oldValue, int newValue)Overridden for performance reasons. See the Implementation Note for more information.- Overrides:
firePropertyChangein classjavax.swing.JComponent
-
firePropertyChange
public void firePropertyChange(java.lang.String propertyName, long oldValue, long newValue)Overridden for performance reasons. See the Implementation Note for more information.- Overrides:
firePropertyChangein classjava.awt.Component
-
firePropertyChange
public void firePropertyChange(java.lang.String propertyName, float oldValue, float newValue)Overridden for performance reasons. See the Implementation Note for more information.- Overrides:
firePropertyChangein classjava.awt.Component
-
firePropertyChange
public void firePropertyChange(java.lang.String propertyName, double oldValue, double newValue)Overridden for performance reasons. See the Implementation Note for more information.- Overrides:
firePropertyChangein classjava.awt.Component
-
firePropertyChange
public void firePropertyChange(java.lang.String propertyName, boolean oldValue, boolean newValue)Overridden for performance reasons. See the Implementation Note for more information.- Overrides:
firePropertyChangein classjavax.swing.JComponent
-
-
DataMelt 3.0 © DataMelt by jWork.ORG