У меня было похожее требование, и я не мог найти готовое решение.В итоге я создал подкласс TextInputCell и сам добавил поддержку tabIndex.
Вот некоторые кусочки подкласса (надеюсь, он скомпилируется, слишком ленив, чтобы проверить).К сожалению, я не могу опубликовать весь подкласс, так как в нем есть много других вещей, не связанных с текущим вопросом.Это решение обеспечивает переход к следующей ячейке, но для поддержки ввода может потребоваться переопределить onBrowserEvent.
public class EditTextInputCell extends TextInputCell
{
int startTabIndex;
interface TabbedTemplate extends SafeHtmlTemplates
{
@Template( "<input type=\"text\" value=\"{0}\" tabindex=\"{1}\" class=\"{2}\" title=\"{3}\"></input>" )
SafeHtml input( String value, String tabindex, String styleClass, String title );
}
private static TabbedTemplate template;
public EditTextInputCell( int startTabIndex )
{
this.startTabIndex = startTabIndex;
}
@Override
public boolean isEditing( Context context, Element parent, String value )
{
return true;
}
@Override
public void render( Context context, String value, SafeHtmlBuilder sb )
{
// Get the view data.
Object key = context.getKey( );
ValidationData viewData = getViewData( key );
if ( viewData != null && value.equals( viewData.getCurrentValue( ) ) )
{
clearViewData( key );
viewData = null;
}
String strToDisp = ( viewData != null && viewData.getCurrentValue( ) != null ) ? viewData.getCurrentValue( ) : value;
String tabIndex = "" + startTabIndex + context.getIndex( ) + context.getColumn( );
boolean invalid = ( viewData == null ) ? false : viewData.isInvalid( );
String styleClass = "cellTableCell-valid";
String errorMessage = "";
if ( invalid )
{
styleClass = "cellTableCell-invalid";
errorMessage = viewData.getMessage( );
}
if ( strToDisp != null )
{
SafeHtml html = SimpleSafeHtmlRenderer.getInstance( ).render( strToDisp );
// Note: template will not treat SafeHtml specially
sb.append( getTemplate( ).input( html.asString( ), tabIndex, styleClass, errorMessage ) );
}
else
{
sb.appendHtmlConstant( "<input type=\"text\" tabindex=\"" + tabIndex + "\" class=\"" + styleClass + "\" title=\"" + errorMessage + "\"></input>" );
}
}
private TabbedTemplate getTemplate( )
{
if ( template == null )
{
template = GWT.create( TabbedTemplate.class );
}
return template;
}}