Java Doc for JGraphpadVertexRenderer.java in  » Graphic-Library » jgraphpad » com » jgraph » pad » graph » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Java Source Code / Java Documentation
1. 6.0 JDK Core
2. 6.0 JDK Modules
3. 6.0 JDK Modules com.sun
4. 6.0 JDK Modules com.sun.java
5. 6.0 JDK Modules sun
6. 6.0 JDK Platform
7. Ajax
8. Apache Harmony Java SE
9. Aspect oriented
10. Authentication Authorization
11. Blogger System
12. Build
13. Byte Code
14. Cache
15. Chart
16. Chat
17. Code Analyzer
18. Collaboration
19. Content Management System
20. Database Client
21. Database DBMS
22. Database JDBC Connection Pool
23. Database ORM
24. Development
25. EJB Server geronimo
26. EJB Server GlassFish
27. EJB Server JBoss 4.2.1
28. EJB Server resin 3.1.5
29. ERP CRM Financial
30. ESB
31. Forum
32. GIS
33. Graphic Library
34. Groupware
35. HTML Parser
36. IDE
37. IDE Eclipse
38. IDE Netbeans
39. Installer
40. Internationalization Localization
41. Inversion of Control
42. Issue Tracking
43. J2EE
44. JBoss
45. JMS
46. JMX
47. Library
48. Mail Clients
49. Net
50. Parser
51. PDF
52. Portal
53. Profiler
54. Project Management
55. Report
56. RSS RDF
57. Rule Engine
58. Science
59. Scripting
60. Search Engine
61. Security
62. Sevlet Container
63. Source Control
64. Swing Library
65. Template Engine
66. Test Coverage
67. Testing
68. UML
69. Web Crawler
70. Web Framework
71. Web Mail
72. Web Server
73. Web Services
74. Web Services apache cxf 2.0.1
75. Web Services AXIS2
76. Wiki Engine
77. Workflow Engines
78. XML
79. XML UI
Java
Java Tutorial
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java Source Code / Java Documentation » Graphic Library » jgraphpad » com.jgraph.pad.graph 
Source Cross Reference  Class Diagram Java Document (Java Doc) 


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.


Field Summary
public static  StringCLIENTPROPERTY_SHOWFOLDINGICONS
     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.
public static  intINSET
     Defines the default inset to render rich text.
final public static  intSHAPE_RECTANGLESHAPE_CIRCLESHAPE_DIAMONDSHAPE_ROUNDEDSHAPE_CYLINDERSHAPE_TRIANGLE
     Defines the shape constants to be used as values for the JGraphpadGraphConstants.VERTEXSHAPE attributes.
public static  DimensionZERO_DIMENSION
     Defines a dimension of width and height 0.
protected  AreacylinderArea
     Holds the area to be painted for the cylinder shape.
protected  Polygondiamond
     Holds the shape to be painted for diamond cells.
protected  JGraphgraph
     Holds a reference to fetch the correct cell value from the model in paint.
protected  ColorgraphBackgroundgraphForeground
     Holds the background and foreground of the graph.
public static  Rectanglehandle
     Defines the root handle size and location.
protected  booleanisRichTextstretchImageisEditingshowFoldingIconsisGroup
     Specifies whether the current view is a rich text value, and if the image should be stretched.
protected  introundRectArc
     Holds the round rect arc size for rounded rectangles.
protected  intshape
     Holds the shape of the current view.
protected transient  booleanshowHeavyweight
     Specified if a heavyweight should be painted.
public static  JTextPanetextPane
     Holds the text pane to be used for rich text rendering.
protected  ObjectuserObject
     Holds the user object of the current cell.
protected  ComponentvalueComponent
     References the value component of the user object if one exists.
protected static  JComponentwrapperRenderer
     Holds the wrapper renderer used for heavyweights.

Constructor Summary
public  JGraphpadVertexRenderer()
     Constructs a new vertex renderer.

Method Summary
protected  ShapecropToShape(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  intgetArcSize(int width, int height)
     Returns an appropriate arc for the corners of the rectangle for boundary size cases of width and height.
public  Point2DgetCirclePerimeterPoint(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  Point2DgetDiamondPerimeterPoint(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  Point2DgetPerimeterPoint(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  DimensiongetPreferredSize()
     Overrides the parent's implementation to return a slightly larger preferred size for circles and rounded rectangles.
public  ComponentgetRendererComponent(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  Point2DgetTrianglePerimeterPoint(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  booleaninHitRegion(Point2D pt)
     Detects whether or not a point has hit the folding icon.
public  voidinstallAttributes(CellView view)
     Extends the parent's method to configure the renderer for displaying the specified view.
protected  Point2Dintersection(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  voidpaint(Graphics g)
     Paints the renderer component for the configured view.
protected  voidpaintBackground(Graphics g)
     Utility method to paint the background for all non-rectangular shapes.
protected  voidpaintFoldingIcon(Graphics g)
     Utility method to paint the folding icon for groups.
protected  voidpaintRichText(Graphics g)
     Utility method to paint the rich text content for rich text values.
protected  voidpaintShapeBorder(Graphics g)
     Utility method to paint the border for all non-rectangular shapes.
protected  voidresetAttributes()
     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.

Field Detail
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.




Constructor Detail
JGraphpadVertexRenderer
public JGraphpadVertexRenderer()(Code)
Constructs a new vertex renderer.




Method Detail
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.



inHitRegion
public boolean inHitRegion(Point2D pt)(Code)
Detects whether or not a point has hit the folding icon. This implementation never returns true if the JGraphpadVertexRenderer.CLIENTPROPERTY_SHOWFOLDINGICONS is not set on the enclosing graph.
Parameters:
  pt - The point to check Returns true if pt intersects with the foldingicon.



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.



resetAttributes
protected void resetAttributes()(Code)
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.



www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.