public class SpiralTextInputCell extends TextInputCell {
// Default value
private int startIndex = 1000;
public SpiralTextInputCell() {
}
/* When we have more than one DataGrid on a page, their tab indexes will collide.
* To prevent this, we should use a different start index for each grid after the first one.
*/
public SpiralTextInputCell(int startIndex) {
this.startIndex = startIndex;
}
@Override
public void render(Context context, String value, SafeHtmlBuilder sb) {
ViewData viewData = getViewData(context.getKey());
if (viewData != null && viewData.getCurrentValue().equals(value)) {
clearViewData(context.getKey());
viewData = null;
}
String s = (viewData != null) ? viewData.getCurrentValue() : value;
if (s == null) s = "";
int tabIndex = startIndex + context.getIndex();
sb.appendHtmlConstant("<input type=\"text\" value=\"" + s + "\" tabindex=\"" + tabIndex + "\"></input>");
}
}
You received this message because you are subscribed to the Google Groups "Google Web Toolkit" group.
To view this discussion on the web visit https://groups.google.com/d/msg/google-web-toolkit/-/neeNxlfNcv4J.
To post to this group, send email to google-web-toolkit@googlegroups.com.
To unsubscribe from this group, send email to google-web-toolkit+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/google-web-toolkit?hl=en.
No comments:
Post a Comment