1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21 package org.devaki.nextobjects.workspace.models.graphics;
22
23 import java.io.Serializable;
24 import java.awt.Graphics;
25 import java.awt.Graphics2D;
26 import java.awt.Rectangle;
27 import org.devaki.nextobjects.constants.CstGraphics;
28 import org.devaki.nextobjects.workspace.models.objects.Table;
29
30 /***
31 * This class is responsible for drawing a Table in a Physical Data Model
32 * @author <a href="mailto:eflorent@devaki.org">Emmanuel Florent</a>
33 */
34 public class TableView extends ClassView implements Serializable
35 {
36 /***
37 * Construct a new 'TableView' object
38 * @param pTable the table context
39 */
40 public TableView(Table pTable)
41 {
42 super(pTable);
43
44 this.setSize(CstGraphics.DEFAULT_TABLE_SIZE);
45 oldRectangle.setSize(rectangle.getSize());
46 oldRectangle.setLocation(rectangle.getLocation());
47 }
48
49 /***
50 * Paint the table
51 * @param g the graphic context
52 */
53 public void paint(Graphics g)
54 {
55 Graphics2D g2= (Graphics2D) g;
56
57 int x= 0;
58 int y= 0;
59 /*** Start drawing... **/
60 /*** Background **/
61 g2.setColor(this.myStyle.getBackgroundColor());
62 g2.fill(new Rectangle(x, y, (int) this.getSize().getWidth() - 1, (int) this.getSize().getHeight() - 1));
63 /*** Border **/
64 g2.setPaint(this.myStyle.getBorderColor());
65 g2.drawRect(x, y, (int) this.getSize().getWidth() - 1, (int) this.getSize().getHeight() - 1);
66 /*** Text **/
67 this.printColumns(g2, x, y);
68 }
69 }