Source Code Cross Referenced for TransactionCanvas.java in  » Database-DBMS » Ozone-1.1 » org » ozoneDB » core » monitor » 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 » Database DBMS » Ozone 1.1 » org.ozoneDB.core.monitor 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        //$Id: TransactionCanvas.java,v 1.2 2002/07/29 11:30:23 per_nyfelt Exp $
002:
003:        package org.ozoneDB.core.monitor;
004:
005:        import org.ozoneDB.DxLib.*;
006:        import org.ozoneDB.core.*;
007:
008:        import java.awt.*;
009:        import java.awt.event.*;
010:
011:        public class TransactionCanvas extends Canvas {
012:            static Color createColor = new Color(255, 150, 80);
013:            static Color readColor = new Color(176, 196, 222);
014:            static Color writeColor = new Color(123, 104, 238);
015:
016:            private Graphics dbg;
017:            private Image dbImage;
018:
019:            /** */
020:            public TransactionCanvas() {
021:                setBackground(StorageCanvas.bg1Color);
022:            }
023:
024:            /** */
025:            public void update(Graphics g) {
026:                if (dbImage == null) {
027:                    /* BUG 0: deprecated function: size() */
028:                    dbImage = createImage(size().width, size().height);
029:                    dbg = dbImage.getGraphics();
030:                }
031:                paint(dbg);
032:                g.drawImage(dbImage, 0, 0, this );
033:            }
034:
035:            /** */
036:            public void paint(Graphics g) {
037:                super .paint(g);
038:                Rectangle rect = getBounds();
039:
040:                g.setColor(StorageCanvas.bg1Color);
041:                g.fillRect(1, 1, rect.width - 2, rect.height - 2);
042:                g.draw3DRect(1, 1, rect.width - 2, rect.height - 2, true);
043:                g.setColor(StorageCanvas.headColor);
044:                g.fillRect(3, 3, rect.width - 5, 13);
045:                g.setColor(Color.white);
046:                g.drawString("Transaction View", 6, 13);
047:
048:                int viewHeight = (rect.height - 60) / 3;
049:                Rectangle osRect = new Rectangle(10, rect.height - viewHeight
050:                        * 3 - 40, rect.width - 20, viewHeight);
051:                updateCV(g, osRect);
052:                Rectangle csRect = new Rectangle(10, rect.height - viewHeight
053:                        * 2 - 25, rect.width - 20, viewHeight);
054:                updateBV(g, csRect);
055:                Rectangle psRect = new Rectangle(10, rect.height - viewHeight
056:                        - 10, rect.width - 20, viewHeight);
057:                updateTV(g, psRect);
058:            }
059:
060:            /** */
061:            public void updateTV(Graphics g, Rectangle r) {
062:                TransactionManager tam = Env.currentEnv().transactionManager;
063:
064:                g.setColor(StorageCanvas.bgColor);
065:                g.fillRect(r.x, r.y + 14, r.width, r.height - 14);
066:                g.draw3DRect(r.x, r.y + 14, r.width, r.height - 14, false);
067:
068:                /*
069:                int read = 0;
070:                int write = 0;
071:                int create = 0;
072:                int viewW = r.width / 4;
073:                DxIterator it = tam.taTable.iterator();
074:                for (int i = 0; i < 4; i++) {
075:                    if (i > 0) {
076:                        g.setColor( StorageCanvas.bgColor );
077:                        g.draw3DRect( r.x + viewW * i - 1, r.y + 14, 1, r.height - 14, true );
078:                    }
079:                    Transaction ta = (Transaction)it.next();
080:                    if (ta != null && ta.createTable != null) {
081:                        Rectangle taRect = new Rectangle( r.x + viewW * i + 1, r.y + 14 + 1, viewW, r.height - 14 - 1 );
082:                        updateTA( g, taRect, ta );
083:
084:                        create += ta.createTable.count();
085:                        read += ta.readTable.count();
086:                        write += ta.writeTable.count();
087:                    }
088:                }
089:
090:                g.setColor( StorageCanvas.fontColor );
091:                String label =
092:                        "Object access - " + new Integer( tam.taTable.count() ).toString() + " transactions  [ " + new Integer(
093:                        create ).toString() + " / " + new Integer( read ).toString() + " / " + new Integer( write ).toString()
094:                        + " ]";
095:                g.drawString( label, r.x, r.y + 12 );
096:                 */
097:            }
098:
099:            /** */
100:            public void updateTA(Graphics g, Rectangle r, Transaction ta) {
101:                /*
102:                int max = ta.createTable.count();
103:                max = Math.max( max, ta.readTable.count() );
104:                max = Math.max( max, ta.writeTable.count() );
105:
106:                int scale = 1;
107:                while (max / scale > r.height) {
108:                    scale++;
109:                }
110:
111:                int bw = r.width / 3;
112:                int bh = ta.createTable.count() / scale;
113:                g.setColor( createColor );
114:                g.fillRect( r.x, r.y + r.height - bh, bw, bh );
115:                bh = ta.readTable.count() / scale;
116:                g.setColor( readColor );
117:                g.fillRect( r.x + bw, r.y + r.height - bh, bw, bh );
118:                bh = ta.writeTable.count() / scale;
119:                g.setColor( writeColor );
120:                g.fillRect( r.x + bw * 2, r.y + r.height - bh, bw, bh );
121:                 */
122:            }
123:
124:            /** */
125:            public void updateBV(Graphics g, Rectangle r) {
126:                TransactionManager tam = Env.currentEnv().transactionManager;
127:
128:                g.setColor(StorageCanvas.bgColor);
129:                g.fillRect(r.x, r.y + 14, r.width, r.height - 14);
130:                g.draw3DRect(r.x, r.y + 14, r.width, r.height - 14, false);
131:                g.setColor(StorageCanvas.fontColor);
132:                String label = "Blocking";
133:                g.drawString(label, r.x, r.y + 12);
134:
135:                int y = r.y + 14 + 14;
136:                int x = r.x + 5;
137:                g.setColor(StorageCanvas.fontColor);
138:                /*
139:                if (tam.taTable.isEmpty()) {
140:                    g.drawString( "No transactions.", x, y );
141:                } else {
142:                    boolean somethingBlocked = false;
143:                    DxIterator it = tam.taTable.iterator();
144:                    Transaction ta;
145:                    while ((ta = (Transaction)it.next()) != null) {
146:                        if (ta.blocker != null) {
147:                            somethingBlocked = true;
148:                            Transaction blocker = Env.currentEnv().objectSpace.objectForID( ta.blocker ).writeLocker;
149:                            g.drawString( new Short( (short)ta.taID.hashCode() ).toString() + " blocked by " + new Short(
150:                                    (short)blocker.taID.hashCode() ).toString(), x, y );
151:                            y += 14;
152:                        }
153:                    }
154:                    if (!somethingBlocked) {
155:                        g.drawString( "No transaction blocked.", x, y );
156:                    }
157:                }
158:                 */
159:            }
160:
161:            /** */
162:            public void updateCV(Graphics g, Rectangle r) {
163:                TransactionManager tam = Env.currentEnv().transactionManager;
164:
165:                g.setColor(StorageCanvas.bgColor);
166:                g.fillRect(r.x, r.y + 14, r.width, r.height - 14);
167:                g.draw3DRect(r.x, r.y + 14, r.width, r.height - 14, false);
168:                g.setColor(StorageCanvas.fontColor);
169:                String label = "Clients - ";
170:                g.drawString(label, r.x, r.y + 12);
171:            }
172:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.