Package com.google.gwt.dom.client

Examples of com.google.gwt.dom.client.InputElement.cast()


    public void edit(Element cell, Record record, String value, DataType<String> type, final Callback<String> callback) {
        final InputElement input = InputElement.as(DOM.createElement("input"));
        input.setValue(value);
        input.getStyle().setWidth(100, Style.Unit.PCT);
        input.getStyle().setHeight(100, Style.Unit.PCT);
        EventUtils.addHandler(input.<Element>cast(), Event.ONKEYPRESS | Event.ONBLUR, new Handler<Event>() {
            public void handle(Event event) {
                if (event.getTypeInt() == Event.ONKEYPRESS && event.getKeyCode() != KeyCodes.KEY_ENTER) {
                    return;
                }
                String value = input.getValue();
View Full Code Here


    assertEquals("valuable", cb.getFormValue());
  }

  public void testConstructorInputElement() {
    InputElement elm = DOM.createInputCheck().cast();
    CheckBox box = new CheckBox(elm.<Element> cast());
    assertFalse(box.getValue());
    elm.setDefaultChecked(true);
    assertTrue(box.getValue());
  }
View Full Code Here

   * Tests that detaching and attaching a CheckBox widget retains the checked
   * state of the element. This is known to be tricky on IE.
   */
  public void testDetachment() {
    InputElement elm = DOM.createInputCheck().cast();
    CheckBox box = new CheckBox(elm.<Element> cast());
    RootPanel.get().add(box);
    elm.setChecked(true);
    RootPanel.get().remove(box);
    RootPanel.get().add(box);
    assertTrue(elm.isChecked());
View Full Code Here

    assertTrue(elm.isChecked());
  }

  public void testFormValue() {
    InputElement elm = Document.get().createCheckInputElement();
    Element asOldElement = elm.cast();
    cb.replaceInputElement(asOldElement);

    // assertEquals("", elm.getValue());
    cb.setFormValue("valuable");
    assertEquals("valuable", elm.getValue());
View Full Code Here

    cb.setFormValue("valuable");

    InputElement elm = Document.get().createCheckInputElement();
    assertFalse(elm.isChecked());

    Element asOldElement = elm.cast();
    cb.replaceInputElement(asOldElement);

    // The values should be preserved
    assertTrue(cb.getValue());
    assertEquals(1234, cb.getTabIndex());
View Full Code Here

    if (field instanceof CheckBox && !GXT.isIE) {
      // blur is firing before check box is changed
      // mouse down on input fires before blur so stop event to prevent blur
      Element target = fe.getEvent().getEventTarget().cast();
      InputElement input = field.el().selectNode("input").dom.cast();
      if (target == input.cast()) {
        fe.stopEvent();
      }
    }
  }
View Full Code Here

    if (field instanceof CheckBox && !GXT.isIE) {
      // blur is firing before check box is changed
      // mouse down on input fires before blur so stop event to prevent blur
      Element target = fe.getEvent().getEventTarget().cast();
      InputElement input = field.el().selectNode("input").dom.cast();
      if (target == input.cast()) {
        fe.stopEvent();
      }
    }
  }
View Full Code Here

    if (field instanceof CheckBox && !GXT.isIE) {
      // blur is firing before check box is changed
      // mouse down on input fires before blur so stop event to prevent blur
      Element target = fe.getEvent().getEventTarget().cast();
      InputElement input = field.el().selectNode("input").dom.cast();
      if (target == input.cast()) {
        fe.stopEvent();
      }
    }
  }
View Full Code Here

    oldInputElement.setId("");
    oldInputElement.setAccessKey("");

    // Quickly do the actual replace
    final Element parent = oldInputElement.getParentElement().cast();
    final int index = DOM.getChildIndex(parent, (Element) oldInputElement.cast());
    parent.removeChild(oldInputElement);
    DOM.insertChild(parent, (Element) newElement.cast(), index);
    this.invokeReplaceElement(newElement);

    // Setup the new element
View Full Code Here

    parent.removeChild(oldInputElement);
    DOM.insertChild(parent, (Element) newElement.cast(), index);
    this.invokeReplaceElement(newElement);

    // Setup the new element
    DOM.sinkEvents((Element) oldInputElement.cast(), DOM.getEventsSunk(this.getElement()));
    DOM.setEventListener((Element) oldInputElement.cast(), this);
    oldInputElement.setId(uid);
    if (accessKey != "") {
      oldInputElement.setAccessKey(accessKey);
    }
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.