Example usage for com.google.gwt.dom.client InputElement setValue

List of usage examples for com.google.gwt.dom.client InputElement setValue

Introduction

In this page you can find the example usage for com.google.gwt.dom.client InputElement setValue.

Prototype

public void setValue(String value) 

Source Link

Document

When the type attribute of the element has the value "text", "file" or "password", this represents the current contents of the corresponding form control, in an interactive user agent.

Usage

From source file:com.alkacon.geranium.client.util.DomUtil.java

License:Open Source License

/**
 * Creates a hidden input field with the given name and value.<p>
 * /*w w w.  j av a  2  s.c o m*/
 * @param name the field name
 * @param value the field value
 * @return the input element
 */
private static InputElement createHiddenInput(String name, String value) {

    InputElement input = Document.get().createHiddenInputElement();
    input.setName(name);
    input.setValue(value);
    return input;
}

From source file:com.cgxlib.xq.client.plugins.widgets.TextBoxBaseWidgetFactory.java

License:Apache License

protected void copyAttributes(Element src, Element dest) {
    InputElement source = src.cast();//  www.java2  s. c om
    InputElement destination = dest.cast();

    destination.setAccessKey(source.getAccessKey());
    destination.setDefaultValue(source.getDefaultValue());
    destination.setDisabled(source.isDisabled());
    if (source.getMaxLength() > 0)
        destination.setMaxLength(source.getMaxLength());
    destination.setReadOnly(source.isReadOnly());
    destination.setSize(source.getSize());
    destination.setName(source.getName());
    destination.setValue(source.getValue());
}

From source file:com.google.appengine.demos.gwtdlx.client.GwtDlx.java

License:Apache License

private ClickHandler buildClearHandler() {
    ClickHandler out = new ClickHandler() {
        public void onClick(ClickEvent event) {
            noSolution.setVisible(false);
            for (int r = 0; r < 9; r++) {
                for (int c = 0; c < 9; c++) {
                    InputElement elt = getBox(r, c);
                    elt.setValue("");
                }/*from  w  w w  . ja v a2s.co  m*/
            }
        }
    };
    return out;
}

From source file:com.google.appengine.demos.gwtdlx.client.GwtDlx.java

License:Apache License

private AsyncCallback<int[][]> buildCallback() {
    AsyncCallback<int[][]> out = new AsyncCallback<int[][]>() {
        public void onFailure(Throwable caught) {
        }//w  w  w . ja  v  a 2  s  . co  m

        public void onSuccess(int[][] result) {
            ajax.setVisible(false);
            if (result == null) {
                noSolution.setVisible(true);
                return;
            }

            noSolution.setVisible(false);
            for (int r = 0; r < result.length; r++) {
                for (int c = 0; c < result[r].length; c++) {
                    InputElement elt = getBox(r, c);
                    elt.setValue(result[r][c] + "");
                }
            }
            ajax.setVisible(false);
        }
    };
    return out;
}

From source file:com.sencha.gxt.cell.core.client.form.SpinnerFieldCell.java

License:sencha.com license

protected void doSpin(Cell.Context context, XElement parent, N value, ValueUpdater<N> updater, boolean up) {
    if (!isReadOnly()) {
        // use the current value in the input element
        InputElement input = getInputElement(parent);
        String v = input.getValue();

        if (!"".equals(v)) {
            try {
                value = getPropertyEditor().parse(v);
            } catch (Exception e) {
                e.printStackTrace();//  w w  w  .  j  a v a2s .  c  o  m
            }
        }

        boolean cancelled = false;
        if (context instanceof HandlerManagerContext) {
            HandlerManager manager = ((HandlerManagerContext) context).getHandlerManager();
            CellBeforeSelectionEvent<N> event = CellBeforeSelectionEvent.fire(manager, context, value);
            if (event != null && event.isCanceled()) {
                cancelled = true;
            }
        } else {
            CellBeforeSelectionEvent<N> event = CellBeforeSelectionEvent.fire(this, context, value);
            if (!fireCancellableEvent(event)) {
                cancelled = true;
            }
        }

        if (!cancelled) {
            N newVal = null;
            if (up) {
                // if the user clicks up with no value and a min value > 0 we "jump" to the min value
                // otherwise, default behavior calling increment
                if (value == null && minValue.doubleValue() > 0) {
                    try {
                        newVal = getPropertyEditor().parse("" + minValue);
                    } catch (ParseException e) {
                    }
                } else {
                    newVal = getPropertyEditor().incr(value);
                }

                if (newVal.doubleValue() > maxValue.doubleValue()
                        || newVal.doubleValue() < minValue.doubleValue()) {
                    return;
                }
                input.setValue(getPropertyEditor().render(newVal));
            } else {
                // if the user clicks down no no value a min value < 0 we "jump" to the min value
                // otherwise, default behavior calling descrement
                if (value == null && maxValue.doubleValue() < 0) {
                    try {
                        newVal = getPropertyEditor().parse("" + maxValue);
                    } catch (ParseException e) {
                    }
                } else {
                    newVal = getPropertyEditor().decr(value);
                }

                if (newVal.doubleValue() > maxValue.doubleValue()
                        || newVal.doubleValue() < minValue.doubleValue()) {
                    return;
                }
                input.setValue(getPropertyEditor().render(newVal));
            }

            if (context instanceof HandlerManagerContext) {
                HandlerManager manager = ((HandlerManagerContext) context).getHandlerManager();
                CellSelectionEvent.fire(manager, context, newVal);
            } else {
                CellSelectionEvent.fire(this, lastContext, newVal);
            }
        }
    }
}

From source file:gwtquery.plugins.enhance.client.gwt.CheckBoxWidgetFactory.java

License:Apache License

protected void copyAttributes(InputElement source, InputElement destination) {

    destination.setAccessKey(source.getAccessKey());
    destination.setDisabled(source.isDisabled());
    destination.setSize(source.getSize());
    destination.setName(source.getName());
    destination.setValue(source.getValue());
}

From source file:gwtquery.plugins.enhance.client.gwt.RadioButtonWidgetFactory.java

License:Apache License

protected void copyAttributes(InputElement source, InputElement destination) {

    destination.setAccessKey(source.getAccessKey());
    destination.setDisabled(source.isDisabled());
    destination.setSize(source.getSize());
    destination.setValue(source.getValue());
}

From source file:gwtquery.plugins.enhance.client.gwt.TextBoxBaseWidgetFactory.java

License:Apache License

protected void copyAttributes(Element src, Element dest) {
    InputElement source = src.cast();// w w w . j ava 2  s. co  m
    InputElement destination = dest.cast();

    destination.setAccessKey(source.getAccessKey());
    destination.setDefaultValue(source.getDefaultValue());
    destination.setDisabled(source.isDisabled());
    if (source.getMaxLength() > 0)
        destination.setMaxLength(source.getMaxLength());
    destination.setReadOnly(source.isReadOnly());
    destination.setSize(source.getSize());
    destination.setName(source.getName());
    destination.setValue(source.getValue());

}

From source file:org.cloudcoder.app.client.view.BulkRegistrationPanel.java

License:Open Source License

@Override
public void clear() {
    InputElement inputElt = fileUpload.getElement().cast();
    inputElt.setValue("");
}

From source file:org.eclipse.che.ide.ui.listbox.CustomComboBox.java

License:Open Source License

/**
 * Sets the value associated with the item at a given index.
 *
 * @param index//from   w ww .  j  av a2 s  .  c om
 *         the index of the item to be set
 * @param value
 *         the item's new value
 * @throws IndexOutOfBoundsException
 *         if the index is out of range
 */
public void setValue(int index, String value) {
    checkIndex(index);
    final InputElement inputElement = getListItemElement(index);
    inputElement.setValue(value);
}