View Javadoc

1   
2   package org.catacomb.druid.blocks;
3   
4   import org.catacomb.datalish.SColor;
5   import org.catacomb.druid.build.Context;
6   import org.catacomb.druid.build.GUIPath;
7   import org.catacomb.druid.gui.base.DruDrawingCanvas;
8   import org.catacomb.druid.gui.base.DruPanel;
9   
10  
11  public class DrawingCanvas extends Panel {
12  
13  
14      public int width;
15      public int height;
16  
17      public boolean axes;
18  
19      public boolean threeD;
20  
21      public SColor gridColor;
22      public SColor axisColor;
23  
24      public DruPanel instantiatePanel() {
25  
26          if (width <= 0) {
27              width = 200;
28          }
29          if (height <= 0) {
30              height = 100;
31          }
32  
33          DruDrawingCanvas ddc = new DruDrawingCanvas(width, height);
34          if (axes) {
35              ddc.setOnGridAxes();
36          }
37          if (threeD) {
38              ddc.setThreeD();
39          }
40  
41          return ddc;
42      }
43  
44  
45      public void populatePanel(DruPanel drup, Context ctx, GUIPath gpath) {
46          DruDrawingCanvas ddc = (DruDrawingCanvas)drup;
47          if (backgroundColor != null) {
48              ddc.setBackgroundColor(backgroundColor.getColor());
49          }
50          if (gridColor != null) {
51              ddc.setGridColor(gridColor.getColor());
52          }
53  
54          if (axisColor != null) {
55              ddc.setAxisColor(axisColor.getColor());
56          }
57      }
58  
59  }