View Javadoc

1   package org.catacomb.druid.blocks;
2   
3   import org.catacomb.druid.build.Context;
4   import org.catacomb.druid.build.GUIPath;
5   import org.catacomb.druid.gui.base.DruInfoPanel;
6   import org.catacomb.druid.gui.base.DruPanel;
7   import org.catacomb.interlish.structure.Marketplace;
8   import org.catacomb.report.E;
9   
10  
11  public class InfoPanel extends Panel {
12  
13  
14      public String text;
15  
16      public int width;
17      public int height;
18  
19      public String sources;
20  
21  
22  
23      public DruPanel instantiatePanel() {
24          DruInfoPanel ret = null;
25  
26          if (width > 60 && height > 20) {
27              ret = new DruInfoPanel(text, width, height);
28  
29          } else {
30              if (width > 0 && height > 0) {
31                  E.warning("width, height too small to be useful " + width + " " + height);
32              }
33              ret = new DruInfoPanel(text);
34          }
35          return ret;
36      }
37  
38  
39      public void populatePanel(DruPanel dp, Context ctx, GUIPath gpath) {
40          if (height == 0) {
41              height = 20;
42          }
43          DruInfoPanel drup = (DruInfoPanel)dp;
44  
45          Marketplace hub = ctx.getMarketplace();
46  
47          if (sources != null) {
48              if (sources.equals("none") || sources.length() == 0) {
49  
50              } else {
51                  if (sources.equals("*")) {
52                      hub.addReceiver("Info", drup, "*");
53  
54                  } else {
55                      String[] sa = sources.split(",");
56                      for (int i = 0; i < sa.length; i++) {
57                          hub.addReceiver("Info", drup, sa[i].trim());
58                      }
59                  }
60              }
61          }
62  
63      }
64  
65  }