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.DruPanel;
6   import org.catacomb.druid.gui.base.DruScrollingInfoPanel;
7   import org.catacomb.interlish.structure.Marketplace;
8   
9   
10  public class ScrollingInfoPanel extends Panel {
11  
12  
13      public String text;
14  
15      public String scope;
16  
17      public int width;
18      public int height;
19  
20      public String sources;
21  
22      public String action;
23      public int maxlines;
24  
25  
26  
27      public DruPanel instantiatePanel() {
28          if (height == 0) {
29              height = 20;
30          }
31          DruScrollingInfoPanel ret = null;
32          if (width > 10 && height > 10) {
33              ret = new DruScrollingInfoPanel(text, width, height);
34          } else {
35              ret = new DruScrollingInfoPanel(text);
36          }
37          return ret;
38      }
39  
40  
41      public void populatePanel(DruPanel dp, Context ctx, GUIPath gpath) {
42  
43          DruScrollingInfoPanel drup = (DruScrollingInfoPanel)dp;
44  
45  
46          drup.setEtchedBorder(ctx.getBg());
47  
48          Marketplace hub = ctx.getMarketplace(scope);
49  
50          //   E.info("sip registering on " + hub + " scope=" + scope);
51  
52          if (sources != null) {
53              String[] sa = sources.split(",");
54              for (int i = 0; i < sa.length; i++) {
55                  hub.addConsumer("Info", drup, sa[i].trim());
56              }
57          } else {
58              hub.addConsumer("Info", drup, "*");
59          }
60  
61      }
62  
63  }