Search in sources :

Example 6 with InputElement

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);
}
Also used : RadioButton(com.google.gwt.user.client.ui.RadioButton) InputElement(com.google.gwt.dom.client.InputElement)

Example 7 with InputElement

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();
}
Also used : InputElement(com.google.gwt.dom.client.InputElement) LabelElement(com.google.gwt.dom.client.LabelElement) Element(com.google.gwt.dom.client.Element) InputElement(com.google.gwt.dom.client.InputElement)

Example 8 with InputElement

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();
}
Also used : InputElement(com.google.gwt.dom.client.InputElement) FormElement(com.google.gwt.dom.client.FormElement)

Example 9 with InputElement

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);
}
Also used : InputElement(com.google.gwt.dom.client.InputElement)

Example 10 with InputElement

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());
    }
}
Also used : Element(com.google.gwt.dom.client.Element) InputElement(com.google.gwt.dom.client.InputElement) InputElement(com.google.gwt.dom.client.InputElement)

Aggregations

InputElement (com.google.gwt.dom.client.InputElement)17 Element (com.google.gwt.dom.client.Element)5 LabelElement (com.google.gwt.dom.client.LabelElement)4 RadioButton (com.google.gwt.user.client.ui.RadioButton)2 FormElement (com.google.gwt.dom.client.FormElement)1