1 31 32 package org.opencms.widgets; 33 34 import org.opencms.file.CmsObject; 35 import org.opencms.i18n.CmsEncoder; 36 37 48 public class CmsTextareaWidget extends A_CmsWidget { 49 50 51 private static final int DEFAULT_ROWS_NUMBER = 4; 52 53 56 public CmsTextareaWidget() { 57 58 this(DEFAULT_ROWS_NUMBER); 60 } 61 62 67 public CmsTextareaWidget(int rows) { 68 69 super("" + rows); 70 } 71 72 77 public CmsTextareaWidget(String configuration) { 78 79 super(configuration); 80 } 81 82 85 public String getDialogWidget(CmsObject cms, I_CmsWidgetDialog widgetDialog, I_CmsWidgetParameter param) { 86 87 String id = param.getId(); 88 StringBuffer result = new StringBuffer (16); 89 int rows = DEFAULT_ROWS_NUMBER; 90 try { 91 rows = new Integer (getConfiguration()).intValue(); 92 } catch (Exception e) { 93 } 95 96 result.append("<td class=\"xmlTd\">"); 97 result.append("<textarea class=\"xmlInput maxwidth"); 98 if (param.hasError()) { 99 result.append(" xmlInputError"); 100 } 101 result.append("\" name=\""); 102 result.append(id); 103 result.append("\" rows=\""); 104 result.append(rows); 105 result.append("\" cols=\"60\" style=\"overflow:auto;\">"); 106 result.append(CmsEncoder.escapeXml(param.getStringValue(cms))); 107 result.append("</textarea>"); 108 result.append("</td>"); 109 110 return result.toString(); 111 } 112 113 116 public I_CmsWidget newInstance() { 117 118 return new CmsTextareaWidget(getConfiguration()); 119 } 120 121 } | Popular Tags |