1 23 package org.objectweb.clif.scenario.util.isac.plugin.gui; 24 25 import java.util.Enumeration ; 26 import java.util.Hashtable ; 27 28 import org.apache.log4j.Category; 29 30 38 public class WidgetDescription { 39 static Category cat = Category.getInstance(WidgetDescription.class 40 .getName()); 41 42 45 public static final int TEXT_FIELD = 0; 46 49 public static final int RADIO_GROUP = 1; 50 53 public static final int CHECK_BOX = 2; 54 57 public static final int GROUP = 3; 58 61 public static final int COMBO = 4; 62 65 public static final int NFIELD = 5; 66 69 public static final int TABLE = 6 ; 70 71 private int type; 72 private String text; 73 private String label; 74 private Hashtable params; 75 76 87 public WidgetDescription(int t, String text, String label, Hashtable p) { 88 cat.debug("-> constructor"); 89 this.type = t; 90 this.text = text; 91 this.params = p; 92 this.label = label ; 93 } 94 95 98 public Hashtable getParams() { 99 cat.debug("-> getParams"); 100 return params; 101 } 102 105 public String getText() { 106 cat.debug("-> getText"); 107 return text; 108 } 109 112 public int getType() { 113 cat.debug("-> getType"); 114 return type; 115 } 116 119 public String getLabel() { 120 return label; 121 } 122 125 public String toString() { 126 String result = ""; 127 switch (this.type) { 128 case CHECK_BOX : 129 result = result+"type = checkbox\n"; 130 break; 131 case COMBO : 132 result = result+"type = combo\n"; 133 break; 134 case GROUP : 135 result = result+"type = group\n"; 136 break; 137 case RADIO_GROUP : 138 result = result+"type = radio_group\n"; 139 break; 140 case TEXT_FIELD : 141 result = result+"type = text_field\n"; 142 break; 143 case NFIELD : 144 result = result+"type = nfield\n"; 145 break; 146 default : 147 result = result+"type = unknown\n"; 148 break; 149 } 150 result = result + "text of the widget = " + this.text + "\n"; 151 if (this.params != null) { 152 Enumeration keys = this.params.keys(); 153 while (keys.hasMoreElements()) { 154 String key = (String ) keys.nextElement(); 155 result = result + "Parameters :\n"; 156 result = result + key + " : " + this.params.get(key) + "\n"; 158 } 159 } 160 161 return result; 162 } 163 } | Popular Tags |