java - GWT CellTable Input Validation -


i implement similar cell validation showcase example, can found here

http://gwt.googleusercontent.com/samples/showcase/showcase.html#!cwcellvalidation

after looking through code , trying implement it, there seems class/variable deffinition missing template. shows in code in 2 places

public validatableinputcell(string errormessage) {   super("change");   if (template == null) {     template = gwt.create(template.class);   }   this.errormessage = simplehtmlsanitizer.sanitizehtml(errormessage); }  safestyles safecolor = safestylesutils.fromtrustedstring("color: " + color + ";"); sb.append(template.input(pendingvalue != null ? pendingvalue : value, safecolor));  if (invalid) {   sb.appendhtmlconstant(" <span style='color:red;'>");   sb.append(errormessage);   sb.appendhtmlconstant("</span>"); } 

after searching web found few examples of template variable definition should , came with

interface template extends safehtmltemplates {   @template("<input type=\"text\" value=\"{0}\" tabindex=\"-1\" size=\"{1}\"></input>")   safehtml input(string value, safehtml safestyles); } private template template; 

with above code added in there no compiler warning howver when code executed error

safestyles used in non-css attribute context. did mean use java.lang.string or safehtml instead?

any ideas of how fix problem?

the template definition looking for, misses @showcasesource annotation, hence not see in source tab of validation sample.

anyway, here original code. , template is:

interface template extends safehtmltemplates {   @template("<input type=\"text\" value=\"{0}\" style=\"{1}\" tabindex=\"-1\"/>")   safehtml input(string value, safestyles color); } 

the error see because using safestyle element (referenced {1}) value of size attribute (instead of style).


Comments