public class MultiLineVertexRenderer extends VertexRenderer
javax.swing.JLabel.AccessibleJLabel
javax.swing.JComponent.AccessibleJComponent
Modifier and Type | Field and Description |
---|---|
static java.lang.String |
CLIENTPROPERTY_SHOWFOLDINGICONS
Client property for JGraph to control the display of the folding icons.
|
protected java.awt.geom.Area |
cylinderArea
Holds the area to be painted for the cylinder shape.
|
protected java.awt.Polygon |
diamond
Holds the shape to be painted for diamond cells.
|
protected JGraph |
graph
Holds a reference to fetch the correct cell value from the model in
paint.
|
protected java.awt.Color |
graphBackground
Holds the background and foreground of the graph.
|
protected java.awt.Color |
graphForeground
Holds the background and foreground of the graph.
|
static java.awt.Rectangle |
handle
Defines the root handle size and location.
|
static int |
INSET
Defines the default inset to render rich text.
|
protected boolean |
isEditing
Specifies whether the current view is a rich text value, and if the image
should be stretched.
|
protected boolean |
isGroup
Specifies whether the current view is a rich text value, and if the image
should be stretched.
|
protected boolean |
isRichText
Specifies whether the current view is a rich text value, and if the image
should be stretched.
|
protected int |
roundRectArc
Holds the round rect arc size for rounded rectangles.
|
protected int |
shape
Holds the shape of the current view.
|
static int |
SHAPE_CIRCLE
Defines the shape constants to be used as values for the
CellConstants.VERTEXSHAPE attributes. |
static int |
SHAPE_CYLINDER
Defines the shape constants to be used as values for the
CellConstants.VERTEXSHAPE attributes. |
static int |
SHAPE_DIAMOND
Defines the shape constants to be used as values for the
CellConstants.VERTEXSHAPE attributes. |
static int |
SHAPE_RECTANGLE
Defines the shape constants to be used as values for the
CellConstants.VERTEXSHAPE attributes. |
static int |
SHAPE_ROUNDED
Defines the shape constants to be used as values for the
CellConstants.VERTEXSHAPE attributes. |
static int |
SHAPE_TRIANGLE
Defines the shape constants to be used as values for the
CellConstants.VERTEXSHAPE attributes. |
protected boolean |
showFoldingIcons
Specifies whether the current view is a rich text value, and if the image
should be stretched.
|
protected boolean |
showHeavyweight
Specified if a heavyweight should be painted.
|
protected boolean |
stretchImage
Specifies whether the current view is a rich text value, and if the image
should be stretched.
|
static javax.swing.JTextPane |
textPane
Holds the text pane to be used for rich text rendering.
|
protected java.lang.Object |
userObject
Holds the user object of the current cell.
|
protected java.awt.Component |
valueComponent
References the value component of the user object if one exists.
|
protected static javax.swing.JComponent |
wrapperRenderer
Holds the wrapper renderer used for heavyweights.
|
static java.awt.Dimension |
ZERO_DIMENSION
Defines a dimension of width and height 0.
|
bordercolor, borderWidth, childrenSelected, defaultBackground, defaultForeground, gradientColor, gridColor, hasFocus, highlightColor, isDoubleBuffered, labelEnabled, lockedHandleColor, preview, selected, view
listenerList, TOOL_TIP_TEXT_KEY, ui, UNDEFINED_CONDITION, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_FOCUSED, WHEN_IN_FOCUSED_WINDOW
accessibleContext, BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
Constructor and Description |
---|
MultiLineVertexRenderer()
Constructs a new vertex renderer.
|
Modifier and Type | Method and Description |
---|---|
static int |
getArcSize(int width,
int height)
Returns an appropriate arc for the corners of the rectangle for boundary
size cases of width and height.
|
java.awt.geom.Point2D |
getCirclePerimeterPoint(VertexView view,
java.awt.geom.Point2D source,
java.awt.geom.Point2D p)
Utility method to return the perimeter point for a circle.
|
java.awt.geom.Point2D |
getDiamondPerimeterPoint(VertexView view,
java.awt.geom.Point2D source,
java.awt.geom.Point2D p)
Utility method to return the perimeter point for a diamond.
|
java.awt.geom.Point2D |
getPerimeterPoint(VertexView view,
java.awt.geom.Point2D source,
java.awt.geom.Point2D p)
Overrides the parent's implementation to return the perimeter points for
non-rectangular shapes, namely diamonds and circles.
|
java.awt.Dimension |
getPreferredSize()
Overrides the parent's implementation to return a slightly larger
preferred size for circles and rounded rectangles.
|
java.awt.Component |
getRendererComponent(JGraph graph,
CellView view,
boolean sel,
boolean focus,
boolean preview)
Overrides the parent implementation to return the value component stored
in the user object instead of this renderer if a value component exists.
|
java.awt.geom.Point2D |
getTrianglePerimeterPoint(VertexView view,
java.awt.geom.Point2D source,
java.awt.geom.Point2D p)
Utility method to return the perimeter point for a triangle.
|
boolean |
inHitRegion(java.awt.geom.Point2D pt)
Detects whether or not a point has hit the folding icon.
|
void |
installAttributes(CellView view)
Extends the parent's method to configure the renderer for displaying the
specified view.
|
protected java.awt.geom.Point2D |
intersection(java.awt.geom.Point2D lineOneStart,
java.awt.geom.Point2D lineOneEnd,
java.awt.geom.Point2D lineTwoStart,
java.awt.geom.Point2D lineTwoEnd)
Find the point of intersection of two straight lines (which follow the
equation y=mx+b) one line is an incoming edge and the other is one side
of the diamond.
|
void |
paint(java.awt.Graphics g)
Paints the renderer component for the configured view.
|
protected void |
paintBackground(java.awt.Graphics g)
Utility method to paint the background for all non-rectangular shapes.
|
protected void |
paintFoldingIcon(java.awt.Graphics g)
Utility method to paint the folding icon for groups.
|
protected void |
paintRichText(java.awt.Graphics g)
Utility method to paint the rich text content for rich text values.
|
protected void |
paintShapeBorder(java.awt.Graphics g)
Utility method to paint the border for all non-rectangular shapes.
|
protected void |
resetAttributes()
Resets attributes that would affect rendering if the
installAttributes(CellView) is not being called, which is the
case if the view is a group and it's groupOpaque attribute is set to
false. |
firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getGradientColor, paintSelectionBorder, repaint, repaint, revalidate, setGradientColor, validate
checkHorizontalKey, checkVerticalKey, getAccessibleContext, getDisabledIcon, getDisplayedMnemonic, getDisplayedMnemonicIndex, getHorizontalAlignment, getHorizontalTextPosition, getIcon, getIconTextGap, getLabelFor, getText, getUI, getUIClassID, getVerticalAlignment, getVerticalTextPosition, imageUpdate, paramString, setDisabledIcon, setDisplayedMnemonic, setDisplayedMnemonic, setDisplayedMnemonicIndex, setHorizontalAlignment, setHorizontalTextPosition, setIcon, setIconTextGap, setLabelFor, setText, setUI, setVerticalAlignment, setVerticalTextPosition, updateUI
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, getRegisteredKeyStrokes, getRootPane, getSize, getToolTipLocation, getToolTipText, getToolTipText, getTopLevelAncestor, getTransferHandler, getVerifyInputWhenFocusTarget, getVetoableChangeListeners, getVisibleRect, getWidth, getX, getY, grabFocus, hide, isDoubleBuffered, isLightweightComponent, isManagingFocus, isOpaque, isOptimizedDrawingEnabled, isPaintingForPrint, isPaintingOrigin, isPaintingTile, isRequestFocusEnabled, isValidateRoot, paintBorder, paintChildren, paintComponent, paintImmediately, paintImmediately, 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
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, 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, 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 java.lang.String CLIENTPROPERTY_SHOWFOLDINGICONS
graph.putClientProperty( JGraphpadVertexRenderer.CLIENTPROPERTY_SHOWFOLDINGICONS, new Boolean(false));
public static java.awt.Dimension ZERO_DIMENSION
public static int INSET
public static java.awt.Rectangle handle
protected JGraph graph
public static final int SHAPE_RECTANGLE
CellConstants.VERTEXSHAPE
attributes.public static final int SHAPE_CIRCLE
CellConstants.VERTEXSHAPE
attributes.public static final int SHAPE_DIAMOND
CellConstants.VERTEXSHAPE
attributes.public static final int SHAPE_ROUNDED
CellConstants.VERTEXSHAPE
attributes.public static final int SHAPE_CYLINDER
CellConstants.VERTEXSHAPE
attributes.public static final int SHAPE_TRIANGLE
CellConstants.VERTEXSHAPE
attributes.public static javax.swing.JTextPane textPane
protected static javax.swing.JComponent wrapperRenderer
protected java.lang.Object userObject
protected int shape
protected boolean isRichText
protected boolean stretchImage
protected boolean isEditing
protected boolean showFoldingIcons
protected boolean isGroup
protected java.awt.Color graphBackground
protected java.awt.Color graphForeground
protected java.awt.Component valueComponent
protected java.awt.geom.Area cylinderArea
protected java.awt.Polygon diamond
protected int roundRectArc
protected transient boolean showHeavyweight
public MultiLineVertexRenderer()
public java.awt.Component getRendererComponent(JGraph graph, CellView view, boolean sel, boolean focus, boolean preview)
getRendererComponent
in interface CellViewRenderer
getRendererComponent
in class VertexRenderer
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 void paint(java.awt.Graphics g)
paint
in class VertexRenderer
g
- The graphics to paint the cell to.protected void paintBackground(java.awt.Graphics g)
g
- The graphics to paint the background to.protected void paintRichText(java.awt.Graphics g)
g
- The graphics to paint the rich text content to.protected void paintShapeBorder(java.awt.Graphics g)
g
- The graphics to paint the border to.protected void paintFoldingIcon(java.awt.Graphics g)
g
- The graphics to paint the border to.public static int getArcSize(int width, int height)
width
- The width to compute the arc size for.height
- The height to compute the arc size for.public java.awt.geom.Point2D getPerimeterPoint(VertexView view, java.awt.geom.Point2D source, java.awt.geom.Point2D p)
getPerimeterPoint
in class VertexRenderer
view
- The view to return the perimeter point for.source
- The location of the start point of the line to be intersected
with the boundaries.p
- The location of the end point of the line to be intersected
with the boundaries.public java.awt.geom.Point2D getCirclePerimeterPoint(VertexView view, java.awt.geom.Point2D source, java.awt.geom.Point2D p)
view
- The view that defines the bounds of the circle.source
- The start point of theline to intersect with the circle.p
- The end point of the line to intersect with the circle.public java.awt.geom.Point2D getDiamondPerimeterPoint(VertexView view, java.awt.geom.Point2D source, java.awt.geom.Point2D p)
view
- The view that defines the bounds of the diamond.source
- The start point of theline to intersect with the diamond.p
- The end point of the line to intersect with the diamond.public java.awt.geom.Point2D getTrianglePerimeterPoint(VertexView view, java.awt.geom.Point2D source, java.awt.geom.Point2D p)
view
- The view that defines the bounds of the diamond.source
- The start point of theline to intersect with the diamond.p
- The end point of the line to intersect with the diamond.protected java.awt.geom.Point2D intersection(java.awt.geom.Point2D lineOneStart, java.awt.geom.Point2D lineOneEnd, java.awt.geom.Point2D lineTwoStart, java.awt.geom.Point2D lineTwoEnd)
lineOneStart
- The start point of the first line.lineOneEnd
- The end point of the first line.lineTwoStart
- The start point of the second line.lineTwoEnd
- The end point of the second line.public java.awt.Dimension getPreferredSize()
getPreferredSize
in class javax.swing.JComponent
protected void resetAttributes()
installAttributes(CellView)
is not being called, which is the
case if the view is a group and it's groupOpaque attribute is set to
false.resetAttributes
in class VertexRenderer
public void installAttributes(CellView view)
installAttributes
in class VertexRenderer
view
- The view to configure the renderer for.public boolean inHitRegion(java.awt.geom.Point2D pt)
CLIENTPROPERTY_SHOWFOLDINGICONS
is not set on the enclosing
graph.pt
- The point to checkpt
intersects with the folding
icon.Copyright (C) 2001-2009 JGraph Ltd. All rights reserved.