1 3 package org.ozoneDB.core.monitor; 4 5 import org.ozoneDB.DxLib.*; 6 import org.ozoneDB.core.*; 7 8 import java.awt.*; 9 import java.awt.event.*; 10 11 12 public class TransactionCanvas extends Canvas { 13 static Color createColor = new Color( 255, 150, 80 ); 14 static Color readColor = new Color( 176, 196, 222 ); 15 static Color writeColor = new Color( 123, 104, 238 ); 16 17 private Graphics dbg; 18 private Image dbImage; 19 20 21 22 public TransactionCanvas() { 23 setBackground( StorageCanvas.bg1Color ); 24 } 25 26 27 28 public void update( Graphics g ) { 29 if (dbImage == null) { 30 31 dbImage = createImage( size().width, size().height ); 32 dbg = dbImage.getGraphics(); 33 } 34 paint( dbg ); 35 g.drawImage( dbImage, 0, 0, this ); 36 } 37 38 39 40 public void paint( Graphics g ) { 41 super.paint( g ); 42 Rectangle rect = getBounds(); 43 44 g.setColor( StorageCanvas.bg1Color ); 45 g.fillRect( 1, 1, rect.width - 2, rect.height - 2 ); 46 g.draw3DRect( 1, 1, rect.width - 2, rect.height - 2, true ); 47 g.setColor( StorageCanvas.headColor ); 48 g.fillRect( 3, 3, rect.width - 5, 13 ); 49 g.setColor( Color.white ); 50 g.drawString( "Transaction View", 6, 13 ); 51 52 int viewHeight = (rect.height - 60) / 3; 53 Rectangle osRect = new Rectangle( 10, rect.height - viewHeight * 3 - 40, rect.width - 20, viewHeight ); 54 updateCV( g, osRect ); 55 Rectangle csRect = new Rectangle( 10, rect.height - viewHeight * 2 - 25, rect.width - 20, viewHeight ); 56 updateBV( g, csRect ); 57 Rectangle psRect = new Rectangle( 10, rect.height - viewHeight - 10, rect.width - 20, viewHeight ); 58 updateTV( g, psRect ); 59 } 60 61 62 63 public void updateTV( Graphics g, Rectangle r ) { 64 TransactionManager tam = Env.currentEnv().transactionManager; 65 66 g.setColor( StorageCanvas.bgColor ); 67 g.fillRect( r.x, r.y + 14, r.width, r.height - 14 ); 68 g.draw3DRect( r.x, r.y + 14, r.width, r.height - 14, false ); 69 70 99 } 100 101 102 103 public void updateTA( Graphics g, Rectangle r, Transaction ta ) { 104 125 } 126 127 128 129 public void updateBV( Graphics g, Rectangle r ) { 130 TransactionManager tam = Env.currentEnv().transactionManager; 131 132 g.setColor( StorageCanvas.bgColor ); 133 g.fillRect( r.x, r.y + 14, r.width, r.height - 14 ); 134 g.draw3DRect( r.x, r.y + 14, r.width, r.height - 14, false ); 135 g.setColor( StorageCanvas.fontColor ); 136 String label = "Blocking"; 137 g.drawString( label, r.x, r.y + 12 ); 138 139 int y = r.y + 14 + 14; 140 int x = r.x + 5; 141 g.setColor( StorageCanvas.fontColor ); 142 163 } 164 165 166 167 public void updateCV( Graphics g, Rectangle r ) { 168 TransactionManager tam = Env.currentEnv().transactionManager; 169 170 g.setColor( StorageCanvas.bgColor ); 171 g.fillRect( r.x, r.y + 14, r.width, r.height - 14 ); 172 g.draw3DRect( r.x, r.y + 14, r.width, r.height - 14, false ); 173 g.setColor( StorageCanvas.fontColor ); 174 String label = "Clients - "; 175 g.drawString( label, r.x, r.y + 12 ); 176 } 177 } 178 | Popular Tags |