Package com.google.gwt.dom.client

Examples of com.google.gwt.dom.client.InputElement


    }

    if ("click".equals(type) || enterPressed) {
      event.stopPropagation();

      final InputElement input = getInputElement(parent);
      Boolean checked = input.isChecked();

      boolean label = "LABEL".equals(target.getTagName());

      // TODO this should be changed to remove reference to known subclass
      boolean radio = this instanceof RadioCell;

      if (label || enterPressed) {
        event.preventDefault();

        if (checked & radio) {
          return;
        }

        // input will NOT have been updated for label clicks
        checked = !checked;
        input.setChecked(checked);

      } else if (radio && value) {

        // no action required if value is already true and this is a radio
        return;
      }

      if (valueUpdater != null && checked != value) {
        valueUpdater.update(checked);
      }

      if (ignoreNextBlur) {
        ignoreNextBlur = false;
        input.focus();
      }
    }
  }
View Full Code Here


  public void setEditable(XElement parent, boolean editable) {
    this.editable = editable;

    getAppearance().setEditable(parent, editable);

    InputElement inputElem = getAppearance().getInputElement(parent).cast();
    if (!isReadOnly()) {
      inputElem.setReadOnly(!editable);
    }
  }
View Full Code Here

  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();
View Full Code Here

  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();
View Full Code Here

  }

  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();
        }
      }

      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) {
          newVal = getPropertyEditor().incr(value);
          if (newVal.doubleValue() > maxValue.doubleValue() || newVal.doubleValue() < minValue.doubleValue()) {
            return;
          }
          input.setValue(getPropertyEditor().render(newVal));
        } 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);
View Full Code Here

    replaceInputElement(DOM.createInputRadio(name));

  }

  private void replaceInputElement(Element elem) {
    InputElement newInputElem = InputElement.as(elem);
    // Collect information we need to set

    boolean checked = getValue();
    boolean enabled = isEnabled();
    String formValue = getFormValue();
View Full Code Here

        }

        // Determine if we clicked on a checkbox.
        Element target = nativeEvent.getEventTarget().cast();
        if ("input".equals(target.getTagName().toLowerCase())) {
          final InputElement input = target.cast();
          if ("checkbox".equals(input.getType().toLowerCase())) {
            // Synchronize the checkbox with the current selection state.
            input.setChecked(event.getDisplay().getSelectionModel().isSelected(
                event.getValue()));
            return SelectAction.TOGGLE;
          }
        }
        return SelectAction.IGNORE;
View Full Code Here

   * @param parent the parent element
   * @param value the current value
   */
  protected void edit(Context context, Element parent, String value) {
    setValue(context, parent, value);
    InputElement input = getInputElement(parent);
    input.focus();
    input.select();
  }
View Full Code Here

   * @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;
  }
View Full Code Here

  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());
    }
  }
View Full Code Here

TOP

Related Classes of com.google.gwt.dom.client.InputElement

Copyright © 2018 www.massapicom. 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.