use of com.google.gwt.dom.client.InputElement in project che by eclipse.
the class CustomComboBox method insertItem.
/**
* Inserts an item into the list box.
*
* @param item
* the text of the item to be inserted.
* @param value
* the item's value.
*/
public void insertItem(String item, String value) {
//create new widget
final RadioButton radioButton = new RadioButton(optionsGroupName, item);
//remove the default gwt-RadioButton style
radioButton.removeStyleName("gwt-RadioButton");
//set value
final InputElement inputElement = (InputElement) radioButton.getElement().getElementsByTagName("input").getItem(0);
inputElement.removeAttribute("tabindex");
inputElement.setAttribute("value", value);
//set default state
if (defaultSelectedIndex > -1 && optionsPanel.getElement().getChildCount() == defaultSelectedIndex) {
inputElement.setChecked(true);
currentInputElement.setValue("");
}
//add to widget
optionsPanel.add(radioButton);
}
use of com.google.gwt.dom.client.InputElement in project che by eclipse.
the class CustomComboBox method getValue.
/**
* Gets the value associated with the item at a given index.
*
* @param index
* the index of the item to be retrieved
* @return the item's associated value
* @throws IndexOutOfBoundsException
* if the index is out of range
*/
public String getValue(int index) {
checkIndex(index);
final Element optionElement = (Element) optionsPanel.getElement().getChild(index);
final InputElement inputElement = (InputElement) optionElement.getElementsByTagName("input").getItem(0);
return inputElement.getValue();
}
use of com.google.gwt.dom.client.InputElement in project rstudio by rstudio.
the class Application method onLogoutRequested.
public void onLogoutRequested(LogoutRequestedEvent event) {
cleanupWorkbench();
// create an invisible form to host the sign-out process
FormElement form = DocumentEx.get().createFormElement();
form.setMethod("POST");
form.setAction(absoluteUrl("auth-sign-out", true));
form.getStyle().setDisplay(Display.NONE);
// read the CSRF token from the cookie and place it in the form
InputElement csrfToken = DocumentEx.get().createHiddenInputElement();
csrfToken.setName(CSRF_TOKEN_FIELD);
csrfToken.setValue(Cookies.getCookie(CSRF_TOKEN_FIELD));
form.appendChild(csrfToken);
// append the form to the document and submit it
DocumentEx.get().getBody().appendChild(form);
form.submit();
}
use of com.google.gwt.dom.client.InputElement in project gwt-test-utils by gwt-test-utils.
the class WidgetUtils method setCheckBoxValueSilent.
/**
* set a CheckBox value without firing any {@link ValueChangeEvent}.
*
* @param checkBox the targeted checkBox
* @param newValue the new value, which could be retrieve through {@link CheckBox#getValue()}
*/
public static void setCheckBoxValueSilent(CheckBox checkBox, boolean newValue) {
InputElement inputElem = GwtReflectionUtils.getPrivateFieldValue(checkBox, "inputElem");
inputElem.setChecked(newValue);
inputElem.setDefaultChecked(newValue);
}
use of com.google.gwt.dom.client.InputElement in project perun by CESNET.
the class TextInputCellWithTabIndex method onBrowserEvent.
@Override
public void onBrowserEvent(Context context, Element parent, String value, NativeEvent event, ValueUpdater<String> valueUpdater) {
super.onBrowserEvent(context, parent, value, event, valueUpdater);
// Ignore events that don't target the input.
InputElement input = getInputElement(parent);
Element target = event.getEventTarget().cast();
if (!input.isOrHasChild(target)) {
return;
}
String eventType = event.getType();
Object key = context.getKey();
if ("change".equals(eventType)) {
finishEditing(parent, value, key, valueUpdater);
} else if ("keyup".equals(eventType)) {
// Record keys as they are typed.
ViewData vd = getViewData(key);
if (vd == null) {
vd = new ViewData(value);
setViewData(key, vd);
}
vd.setCurrentValue(input.getValue());
}
}
Aggregations