1 2 package org.catacomb.druid.blocks; 3 4 import org.catacomb.druid.build.Context; 5 import org.catacomb.druid.build.GUIPath; 6 import org.catacomb.druid.build.Realizer; 7 import org.catacomb.druid.gui.edit.DruCheckboxMenuItem; 8 9 10 public class CheckboxMenuItem implements Realizer { 11 12 public String id; 13 public String label; 14 15 public String info; 16 17 public String action; 18 19 public String depends; 20 public String flavor; 21 22 public CheckboxMenuItem() { 23 } 24 25 26 public CheckboxMenuItem(String s) { 27 label = s; 28 } 29 30 31 public Object realize(Context ctx, GUIPath gpathin) { 32 GUIPath gpath = gpathin; 33 gpath = gpath.extend(id); 34 35 if (action == null) { 36 action = label; 37 } 38 DruCheckboxMenuItem drum = new DruCheckboxMenuItem(label, action); 39 40 if (info != null) { 41 drum.setInfoReceiver(ctx.getInfoAggregator()); 42 drum.setInfo(info); 43 } 44 45 ctx.addComponent(drum, gpath); 46 47 if (depends != null) { 48 if (flavor == null) { 49 flavor = "selection"; 50 } 51 ctx.getMarketplace().addViewer("TreeSelection", drum, flavor); 52 drum.setEnableOnSelection(depends); 53 } 54 55 56 return drum; 57 } 58 59 60 }