| com.jgraph.pad.graph.JGraphpadVertexRenderer
JGraphpadVertexRenderer | public class JGraphpadVertexRenderer extends VertexRenderer (Code) | | Universal renderer for vertices and groups. This implementation supports
drawing rectangles, circles, diamonds and rounded rectangles and optionally
paints a gradient background, stretched background image and folding icon.
|
Method Summary | |
protected Shape | cropToShape(Graphics g) Limits all further painting to the clipping region of the actual
shape so that images and text are cropped at the shape bounds.
The clipping region is intersected with the "dirty" region.
Parameters: g - The graphics to crop. | public 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. | public Point2D | getCirclePerimeterPoint(VertexView view, Point2D source, Point2D p) Utility method to return the perimeter point for a circle.
Parameters: view - The view that defines the bounds of the circle. Parameters: source - The start point of theline to intersect with the circle. Parameters: p - The end point of the line to intersect with the circle. | public Point2D | getDiamondPerimeterPoint(VertexView view, Point2D source, Point2D p) Utility method to return the perimeter point for a diamond.
Parameters: view - The view that defines the bounds of the diamond. Parameters: source - The start point of theline to intersect with the diamond. Parameters: p - The end point of the line to intersect with the diamond. | public Point2D | getPerimeterPoint(VertexView view, Point2D source, Point2D p) Overrides the parent's implementation to return the perimeter points for
non-rectangular shapes, namely diamonds and circles. | public Dimension | getPreferredSize() Overrides the parent's implementation to return a slightly larger
preferred size for circles and rounded rectangles. | public 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. | public Point2D | getTrianglePerimeterPoint(VertexView view, Point2D source, Point2D p) Utility method to return the perimeter point for a triangle.
Parameters: view - The view that defines the bounds of the diamond. Parameters: source - The start point of theline to intersect with the diamond. Parameters: p - The end point of the line to intersect with the diamond. | public boolean | inHitRegion(Point2D pt) Detects whether or not a point has hit the folding icon. | public void | installAttributes(CellView view) Extends the parent's method to configure the renderer for displaying the
specified view. | protected Point2D | intersection(Point2D lineOneStart, Point2D lineOneEnd, Point2D lineTwoStart, 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.
Parameters: lineOneStart - The start point of the first line. Parameters: lineOneEnd - The end point of the first line. Parameters: lineTwoStart - The start point of the second line. Parameters: lineTwoEnd - The end point of the second line. | public void | paint(Graphics g) Paints the renderer component for the configured view. | protected void | paintBackground(Graphics g) Utility method to paint the background for all non-rectangular shapes. | protected void | paintFoldingIcon(Graphics g) Utility method to paint the folding icon for groups. | protected void | paintRichText(Graphics g) Utility method to paint the rich text content for rich text values. | protected void | paintShapeBorder(Graphics g) Utility method to paint the border for all non-rectangular shapes. | protected void | resetAttributes() Resets attributes that would affect rendering if the
JGraphpadVertexRenderer.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. |
CLIENTPROPERTY_SHOWFOLDINGICONS | public static String CLIENTPROPERTY_SHOWFOLDINGICONS(Code) | | Client property for JGraph to control the display of the folding icons.
Default is true, eg if the property is missing the icons are painted. To
switch this feature off, use the following code:
graph.putClientProperty(
JGraphpadVertexRenderer.CLIENTPROPERTY_SHOWFOLDINGICONS, new
Boolean(false));
|
INSET | public static int INSET(Code) | | Defines the default inset to render rich text.
|
SHAPE_RECTANGLESHAPE_CIRCLESHAPE_DIAMONDSHAPE_ROUNDEDSHAPE_CYLINDERSHAPE_TRIANGLE | final public static int SHAPE_RECTANGLESHAPE_CIRCLESHAPE_DIAMONDSHAPE_ROUNDEDSHAPE_CYLINDERSHAPE_TRIANGLE(Code) | | Defines the shape constants to be used as values for the
JGraphpadGraphConstants.VERTEXSHAPE attributes.
|
ZERO_DIMENSION | public static Dimension ZERO_DIMENSION(Code) | | Defines a dimension of width and height 0.
|
cylinderArea | protected Area cylinderArea(Code) | | Holds the area to be painted for the cylinder shape.
|
diamond | protected Polygon diamond(Code) | | Holds the shape to be painted for diamond cells.
|
graph | protected JGraph graph(Code) | | Holds a reference to fetch the correct cell value from the model in
paint. This should go into getComponentRenderer.
|
graphBackgroundgraphForeground | protected Color graphBackgroundgraphForeground(Code) | | Holds the background and foreground of the graph.
|
handle | public static Rectangle handle(Code) | | Defines the root handle size and location.
|
isRichTextstretchImageisEditingshowFoldingIconsisGroup | protected boolean isRichTextstretchImageisEditingshowFoldingIconsisGroup(Code) | | Specifies whether the current view is a rich text value, and if the image
should be stretched.
|
roundRectArc | protected int roundRectArc(Code) | | Holds the round rect arc size for rounded rectangles.
|
shape | protected int shape(Code) | | Holds the shape of the current view.
|
showHeavyweight | protected transient boolean showHeavyweight(Code) | | Specified if a heavyweight should be painted. Default is true.
|
textPane | public static JTextPane textPane(Code) | | Holds the text pane to be used for rich text rendering.
|
userObject | protected Object userObject(Code) | | Holds the user object of the current cell.
|
valueComponent | protected Component valueComponent(Code) | | References the value component of the user object if one exists.
|
wrapperRenderer | protected static JComponent wrapperRenderer(Code) | | Holds the wrapper renderer used for heavyweights.
|
JGraphpadVertexRenderer | public JGraphpadVertexRenderer()(Code) | | Constructs a new vertex renderer.
|
cropToShape | protected Shape cropToShape(Graphics g)(Code) | | Limits all further painting to the clipping region of the actual
shape so that images and text are cropped at the shape bounds.
The clipping region is intersected with the "dirty" region.
Parameters: g - The graphics to crop. The shape before cropping |
getArcSize | public static int getArcSize(int width, int height)(Code) | | Returns an appropriate arc for the corners of the rectangle for boundary
size cases of width and height. The arc width of a rectangle is 1/5th of
the larger of the two of the dimensions passed in, but at most 1/2 of the
smaller of the two. 1/5 because it looks nice and 1/2 so the arc can
complete in the given dimension
Parameters: width - The width to compute the arc size for. Parameters: height - The height to compute the arc size for. Returns the arc size. |
getCirclePerimeterPoint | public Point2D getCirclePerimeterPoint(VertexView view, Point2D source, Point2D p)(Code) | | Utility method to return the perimeter point for a circle.
Parameters: view - The view that defines the bounds of the circle. Parameters: source - The start point of theline to intersect with the circle. Parameters: p - The end point of the line to intersect with the circle. The interaction of the circle and the line between source and p. |
getDiamondPerimeterPoint | public Point2D getDiamondPerimeterPoint(VertexView view, Point2D source, Point2D p)(Code) | | Utility method to return the perimeter point for a diamond.
Parameters: view - The view that defines the bounds of the diamond. Parameters: source - The start point of theline to intersect with the diamond. Parameters: p - The end point of the line to intersect with the diamond. The interaction of the diamond and the line between source and p. |
getPerimeterPoint | public Point2D getPerimeterPoint(VertexView view, Point2D source, Point2D p)(Code) | | Overrides the parent's implementation to return the perimeter points for
non-rectangular shapes, namely diamonds and circles. The source point is
typically ignored and the center point is used instead.
Parameters: view - The view to return the perimeter point for. Parameters: source - The location of the start point of the line to be intersectedwith the boundaries. Parameters: p - The location of the end point of the line to be intersectedwith the boundaries. |
getPreferredSize | public Dimension getPreferredSize()(Code) | | Overrides the parent's implementation to return a slightly larger
preferred size for circles and rounded rectangles.
Returns the preferreds size for the current view. |
getRendererComponent | public Component getRendererComponent(JGraph graph, CellView view, boolean sel, boolean focus, boolean preview)(Code) | | Overrides the parent implementation to return the value component stored
in the user object instead of this renderer if a value component exists.
This applies some of the values installed to this renderer to the value
component (border, opaque) if the latter is a JComponent.
Returns a configured renderer for the specified view. |
getTrianglePerimeterPoint | public Point2D getTrianglePerimeterPoint(VertexView view, Point2D source, Point2D p)(Code) | | Utility method to return the perimeter point for a triangle.
Parameters: view - The view that defines the bounds of the diamond. Parameters: source - The start point of theline to intersect with the diamond. Parameters: p - The end point of the line to intersect with the diamond. The interaction of the diamond and the line between source and p. |
installAttributes | public void installAttributes(CellView view)(Code) | | Extends the parent's method to configure the renderer for displaying the
specified view.
Parameters: view - The view to configure the renderer for. |
intersection | protected Point2D intersection(Point2D lineOneStart, Point2D lineOneEnd, Point2D lineTwoStart, Point2D lineTwoEnd)(Code) | | 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.
Parameters: lineOneStart - The start point of the first line. Parameters: lineOneEnd - The end point of the first line. Parameters: lineTwoStart - The start point of the second line. Parameters: lineTwoEnd - The end point of the second line. Returns the intersection point between the first and the secondline. |
paint | public void paint(Graphics g)(Code) | | Paints the renderer component for the configured view. This
implementation consists of three parts: painting the background, gradient
and stretched image, painting the content by doing a supercall and
calling the rich text renderer if required, and finally paint the border,
selection border and the folding handle.
Parameters: g - The graphics to paint the cell to. |
paintBackground | protected void paintBackground(Graphics g)(Code) | | Utility method to paint the background for all non-rectangular shapes.
Parameters: g - The graphics to paint the background to. |
paintFoldingIcon | protected void paintFoldingIcon(Graphics g)(Code) | | Utility method to paint the folding icon for groups.
Parameters: g - The graphics to paint the border to. |
paintRichText | protected void paintRichText(Graphics g)(Code) | | Utility method to paint the rich text content for rich text values. This
implementation simulates rich text vertical alignment by translating the
graphics before painting the textPane.
Parameters: g - The graphics to paint the rich text content to. |
paintShapeBorder | protected void paintShapeBorder(Graphics g)(Code) | | Utility method to paint the border for all non-rectangular shapes.
Parameters: g - The graphics to paint the border to. |
|
|