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.DruScrollPanel; 7 import org.catacomb.interlish.structure.AddableTo; 8 import org.catacomb.report.E; 9 10 11 12 13 public class ScrollPanel extends Panel implements AddableTo { 14 15 public Panel panel; 16 17 public String bars; 18 19 public String horizontal; 20 public String vertical; 21 22 23 24 public void add(Object obj) { 25 if (panel == null) { 26 panel = (Panel)obj; 27 } else { 28 E.warning("overriding panel in ScrollPanel " + this); 29 } 30 } 31 32 33 34 public DruPanel instantiatePanel() { 35 return new DruScrollPanel(); 36 } 37 38 39 public void populatePanel(DruPanel dp, Context ctx, GUIPath gpath) { 40 41 DruScrollPanel dsp = (DruScrollPanel)dp; 42 43 if (bars != null) { 44 E.error("bars no longer accepted"); 45 } 46 47 if (vertical == null) { 48 dsp.setVerticalScrollbarAsNeeded(); 49 50 } else { 51 if (vertical.equals("never")) { 52 dsp.setVerticalScrollbarNever(); 53 54 } else if (vertical.equals("as_needed")) { 55 dsp.setVerticalScrollbarAsNeeded(); 56 57 } else if (vertical.equals("always")) { 58 dsp.setVerticalScrollbarAlways(); 59 60 } else { 61 E.error("dont recognize " + vertical); 62 } 63 } 64 65 if (horizontal == null) { 66 dsp.setHorizontalScrollbarNever(); 67 68 } else { 69 if (horizontal.equals("never")) { 70 dsp.setHorizontalScrollbarNever(); 71 72 } else if (horizontal.equals("as_needed")) { 73 dsp.setHorizontalScrollbarAsNeeded(); 74 75 } else if (horizontal.equals("always")) { 76 dsp.setHorizontalScrollbarAlways(); 77 78 } else { 79 E.error("dont recognize " + vertical); 80 } 81 } 82 83 84 if (panel != null) { 85 DruPanel subp = (DruPanel)(panel.realize(ctx, gpath)); 86 dsp.addPanel(subp); 87 } 88 89 } 90 91 }