use of org.gwtproject.dom.client.InputElement in project gwtproject by treblereel.
the class EditTextCellTest method testOnBrowserEventEdit.
/**
* Test switching into edit mode from onBrowserEvent.
*/
public void testOnBrowserEventEdit() {
NativeEvent event = Document.get().createClickEvent(0, 0, 0, 0, 0, false, false, false, false);
ViewData expectedViewData = new ViewData("editing");
Element parent = testOnBrowserEvent("helloWorld", event, "editing", null, null, expectedViewData);
// Verify the input element.
Element child = parent.getFirstChildElement();
assertTrue(InputElement.is(child));
InputElement input = child.cast();
assertEquals("editing", input.getValue());
}
use of org.gwtproject.dom.client.InputElement in project gwtproject by treblereel.
the class EditTextCell method updateViewData.
/**
* Update the view data based on the current value.
*
* @param parent the parent element
* @param viewData the {@link ViewData} object to update
* @param isEditing true if in edit mode
* @return the new value
*/
private String updateViewData(Element parent, ViewData viewData, boolean isEditing) {
InputElement input = (InputElement) parent.getFirstChild();
String value = input.getValue();
viewData.setText(value);
viewData.setEditing(isEditing);
return value;
}
use of org.gwtproject.dom.client.InputElement in project gwtproject by treblereel.
the class EditTextCell method edit.
/**
* Convert the cell to edit mode.
*
* @param context the {@link Cell.Context} of the cell
* @param parent the parent element
* @param value the current value
*/
protected void edit(Cell.Context context, Element parent, String value) {
setValue(context, parent, value);
InputElement input = getInputElement(parent);
input.focus();
input.select();
}
Aggregations