1 29 30 package nextapp.echo2.app; 31 32 35 public class Label extends Component { 36 37 public static final String PROPERTY_ICON = "icon"; 38 public static final String PROPERTY_ICON_TEXT_MARGIN = "iconTextMargin"; 39 public static final String PROPERTY_LINE_WRAP = "lineWrap"; 40 public static final String PROPERTY_TEXT = "text"; 41 public static final String PROPERTY_TEXT_ALIGNMENT = "textAlignment"; 42 public static final String PROPERTY_TEXT_POSITION = "textPosition"; 43 public static final String PROPERTY_TOOL_TIP_TEXT = "toolTipText"; 44 45 48 public Label() { 49 this(null, null); 50 } 51 52 57 public Label(String text) { 58 this(text, null); 59 } 60 61 66 public Label(ImageReference icon) { 67 this(null, icon); 68 } 69 70 76 public Label(String text, ImageReference icon) { 77 super(); 78 79 setIcon(icon); 80 setText(text); 81 } 82 83 88 public ImageReference getIcon() { 89 return (ImageReference) getProperty(PROPERTY_ICON); 90 } 91 92 99 public Extent getIconTextMargin() { 100 return (Extent) getProperty(PROPERTY_ICON_TEXT_MARGIN); 101 } 102 103 108 public String getText() { 109 return (String ) getProperty(PROPERTY_TEXT); 110 } 111 112 117 public Alignment getTextAlignment() { 118 return (Alignment) getProperty(PROPERTY_TEXT_ALIGNMENT); 119 } 120 121 126 public Alignment getTextPosition() { 127 return (Alignment) getProperty(PROPERTY_TEXT_POSITION); 128 } 129 130 136 public String getToolTipText() { 137 return (String ) getProperty(PROPERTY_TOOL_TIP_TEXT); 138 } 139 140 146 public boolean isLineWrap() { 147 Boolean value = (Boolean ) getProperty(PROPERTY_LINE_WRAP); 148 return value == null ? true : value.booleanValue(); 149 } 150 151 156 public boolean isValidChild(Component component) { 157 return false; 158 } 159 160 165 public void setIcon(ImageReference newValue) { 166 setProperty(PROPERTY_ICON, newValue); 167 } 168 169 176 public void setIconTextMargin(Extent newValue) { 177 setProperty(PROPERTY_ICON_TEXT_MARGIN, newValue); 178 } 179 180 186 public void setLineWrap(boolean newValue) { 187 setProperty(PROPERTY_LINE_WRAP, new Boolean (newValue)); 188 } 189 190 195 public void setText(String newValue) { 196 setProperty(PROPERTY_TEXT, newValue); 197 } 198 199 206 public void setTextAlignment(Alignment newValue) { 207 setProperty(PROPERTY_TEXT_ALIGNMENT, newValue); 208 } 209 210 217 public void setTextPosition(Alignment newValue) { 218 setProperty(PROPERTY_TEXT_POSITION, newValue); 219 } 220 221 227 public void setToolTipText(String newValue) { 228 setProperty(PROPERTY_TOOL_TIP_TEXT, newValue); 229 } 230 } 231 | Popular Tags |