View Javadoc

1   
2   package org.catacomb.druid.blocks;
3   
4   import org.catacomb.druid.build.Context;
5   import org.catacomb.druid.build.Druid;
6   import org.catacomb.druid.build.GUIPath;
7   import org.catacomb.druid.gui.base.DruDataDisplay;
8   import org.catacomb.druid.gui.base.DruPanel;
9   import org.catacomb.interlish.structure.ModeController;
10  import org.catacomb.report.E;
11  
12  
13  
14  public class DataDisplay extends Panel {
15  
16      public int width;
17      public int height;
18  
19      public String controls;
20  
21      public DataDisplay() {
22  
23      }
24  
25  
26  
27  
28      public DruPanel instantiatePanel() {
29          if (width <= 0) {
30              width = 200;
31          }
32          if (height <= 0) {
33              height = 200;
34          }
35          if (prefWidth <= 0) {
36              prefWidth = width;
37          }
38          if (prefHeight <= 0) {
39              prefHeight = height;
40          }
41  
42          return new DruDataDisplay(width, height);
43      }
44  
45  
46  
47      public void populatePanel(DruPanel dpp, Context ctx, GUIPath gpath) {
48  
49          DruDataDisplay drap= (DruDataDisplay)dpp;
50  
51          String ctrlpan = null;
52          if (controls == null || controls.equals("true")) {
53              ctrlpan = "org.catacomb.druid.chunk.MouseModes";
54  
55          } else if (controls.equals("false") || controls.equals("none")) {
56              ctrlpan = "org.catacomb.druid.chunk.CompactMouseModes";
57  
58          } else if (controls.equals("tiny")) {
59              ctrlpan = "org.catacomb.druid.chunk.CompactMouseModes";
60  
61          } else {
62              E.warning("unrecognized ctrl style " + controls);
63          }
64  
65  
66          if (ctrlpan != null) {
67              Druid druid = new Druid(ctrlpan, ctx);
68              druid.whizzBang();
69              DruPanel dp = druid.getMainPanel();
70              drap.addNorth(dp);
71              drap.setModeController((ModeController)druid.getController());
72          }
73      }
74  
75  }