當前位置: 首頁>>代碼示例>>Java>>正文


Java InputElement類代碼示例

本文整理匯總了Java中com.google.gwt.dom.client.InputElement的典型用法代碼示例。如果您正苦於以下問題:Java InputElement類的具體用法?Java InputElement怎麽用?Java InputElement使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


InputElement類屬於com.google.gwt.dom.client包,在下文中一共展示了InputElement類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: AccessibleCheckBox

import com.google.gwt.dom.client.InputElement; //導入依賴的package包/類
protected AccessibleCheckBox(Element elem) {
    super(DOM.createSpan());
    inputElem = InputElement.as(elem);
    labelElem = Document.get().createLabelElement();

    getElement().appendChild(inputElem);
    getElement().appendChild(labelElem);

    String uid = DOM.createUniqueId();
    inputElem.setPropertyString("id", uid);
    labelElem.setHtmlFor(uid);

    // Accessibility: setting tab index to be 0 by default, ensuring element
    // appears in tab sequence. FocusWidget's setElement method already
    // calls setTabIndex, which is overridden below. However, at the time
    // that this call is made, inputElem has not been created. So, we have
    // to call setTabIndex again, once inputElem has been created.
    setTabIndex(0);
}
 
開發者ID:YoungDigitalPlanet,項目名稱:empiria.player,代碼行數:20,代碼來源:AccessibleCheckBox.java

示例2: BaseCheckBox

import com.google.gwt.dom.client.InputElement; //導入依賴的package包/類
protected BaseCheckBox(Element elem) {
    super(elem);

    inputElem = InputElement.as(DOM.createInputCheck());
    labelElem = Document.get().createLabelElement();

    getElement().appendChild(inputElem);
    getElement().appendChild(labelElem);

    String uid = DOM.createUniqueId();
    inputElem.setPropertyString("id", uid);
    labelElem.setHtmlFor(uid);

    directionalTextHelper = new DirectionalTextHelper(labelElem, true);

    // Accessibility: setting tab index to be 0 by default, ensuring element
    // appears in tab sequence. FocusWidget's setElement method already
    // calls setTabIndex, which is overridden below. However, at the time
    // that this call is made, inputElem has not been created. So, we have
    // to call setTabIndex again, once inputElem has been created.
    setTabIndex(0);
}
 
開發者ID:GwtMaterialDesign,項目名稱:gwt-material,代碼行數:23,代碼來源:BaseCheckBox.java

示例3: render

import com.google.gwt.dom.client.InputElement; //導入依賴的package包/類
@Override
public Element render(
    final Node node, final String domID, final Tree.Joint joint, final int depth) {
  // Initialize HTML elements.
  final Element rootContainer = super.render(node, domID, joint, depth);
  final Element nodeContainer = rootContainer.getFirstChildElement();
  final Element checkBoxElement = new CheckBox().getElement();
  final InputElement checkBoxInputElement =
      (InputElement) checkBoxElement.getElementsByTagName("input").getItem(0);

  final Path nodePath =
      node instanceof ChangedFileNode
          ? Path.valueOf(node.getName())
          : ((ChangedFolderNode) node).getPath();
  setCheckBoxState(nodePath, checkBoxInputElement);
  setCheckBoxClickHandler(nodePath, checkBoxElement, checkBoxInputElement.isChecked());

  // Paste check-box element to node container.
  nodeContainer.insertAfter(checkBoxElement, nodeContainer.getFirstChild());

  return rootContainer;
}
 
開發者ID:eclipse,項目名稱:che,代碼行數:23,代碼來源:CheckBoxRender.java

示例4: prepareToAdoptChildren

import com.google.gwt.dom.client.InputElement; //導入依賴的package包/類
@Override
public void prepareToAdoptChildren() {
	if (!this.hasChildren()) {	
		// BEFORE the item is prepared to adopt children, it's just like:
		//		<li>
		//			<input type="checkbox" class="expander" disabled>	<!-- input.expander DISABLED = no child -->
        //        	<span class="expander"></span>
        //        	<input type="checkbox" class="selection">
        //        	<!-- the widget --> <!-- if it's a text item: <label>Child Node 1</label> -->
		//			<!-- there's NO child items container -->
        //		</li>
		//
		// AFTER the item is prepared to adopt children, it's: 
		//		<li>
		//			<input type="checkbox" class="expander">			<!-- input.expander ENABLED = has child -->
        //        	<span class="expander"></span>
        //        	<input type="checkbox" class="selection">
        //        	<!-- the widget --> <!-- if it's a text item: <label>Child Node 1</label> -->
		//			<ul class='childContainer'>						 	<!-- child items container is present -->
		//				... here will come the child items 
		//			</ul>
        //		</li>
		// 
		// [1] - Create a child items container UL by cloning the BASE_INTERNAL_ELEM
		UListElement childContainerULElem = DOM.clone(BASE_CHILD_CONTAINER_ELEM,// an UL
										  			  true)						// deep cloning
										  	   .cast();
		// [2] - set the new UL as a child of the item (the LI)
		LIElement parentLI = this.getElement().cast();
		parentLI.appendChild(childContainerULElem);
		// [3] - Change the <input type="checkbox" class="expander"> status from DISABLED to ENABLED
		InputElement expanderINPUT = parentLI.getFirstChild().cast();	// from Node to Element
		expanderINPUT.setDisabled(false);
	} else {
		throw new IllegalStateException();
	}
}
 
開發者ID:opendata-euskadi,項目名稱:r01fb,代碼行數:38,代碼來源:TreeViewItem.java

示例5: checkEnabled

import com.google.gwt.dom.client.InputElement; //導入依賴的package包/類
@Override
public <T extends UIObject & HasEnabled> void checkEnabled(T button) {
    final Element label = button.getElement();
    final InputElement input = InputElement.as(label.getFirstChildElement());
    assertFalse(label.hasClassName(Styles.DISABLED));
    assertFalse(label.hasAttribute(Styles.DISABLED));
    assertFalse(input.isDisabled());
    button.setEnabled(false);
    assertTrue(label.hasClassName(Styles.DISABLED));
    assertFalse(label.hasAttribute(Styles.DISABLED));
    assertTrue(input.isDisabled());
    button.setEnabled(true);
    assertFalse(label.hasClassName(Styles.DISABLED));
    assertFalse(label.hasAttribute(Styles.DISABLED));
    assertFalse(input.isDisabled());
}
 
開發者ID:gwtbootstrap3,項目名稱:gwtbootstrap3,代碼行數:17,代碼來源:InputToggleButtonGwt.java

示例6: replaceInputElement

import com.google.gwt.dom.client.InputElement; //導入依賴的package包/類
/**
 * Replace the current input element with a new one. Preserves all state except for the name property, for nasty reasons related to radio button grouping.
 * (See implementation of {@link RadioButton#setName}.)
 *
 * @param elem the new input element
 */
protected void replaceInputElement(Element elem) {
    InputElement newInputElem = InputElement.as(elem);
    // Collect information we need to set
    int tabIndex = getTabIndex();
    boolean checked = getValue();
    boolean enabled = isEnabled();
    String formValue = getFormValue();
    String uid = inputElem.getId();
    String accessKey = inputElem.getAccessKey();
    int sunkEvents = Event.getEventsSunk(inputElem);

    // Clear out the old input element
    setEventListener(asOld(inputElem), null);

    getElement().replaceChild(newInputElem, inputElem);

    // Sink events on the new element
    Event.sinkEvents(elem, Event.getEventsSunk(inputElem));
    Event.sinkEvents(inputElem, 0);
    inputElem = newInputElem;

    // Setup the new element
    Event.sinkEvents(inputElem, sunkEvents);
    inputElem.setId(uid);
    if (!"".equals(accessKey)) {
        inputElem.setAccessKey(accessKey);
    }
    setTabIndex(tabIndex);
    setValue(checked);
    setEnabled(enabled);
    setFormValue(formValue);

    // Set the event listener
    if (isAttached()) {
        setEventListener(asOld(inputElem), this);
    }
}
 
開發者ID:YoungDigitalPlanet,項目名稱:empiria.player,代碼行數:44,代碼來源:AccessibleCheckBox.java

示例7: componentDidUpdate

import com.google.gwt.dom.client.InputElement; //導入依賴的package包/類
/**
 * Safely manipulate the DOM after updating the state when invoking
 * `props.onEdit()` in the `handleEdit` method above.
 * For more info refer to notes at https://facebook.github.io/react/docs/component-api.html#setstate
 * and https://facebook.github.io/react/docs/component-specs.html#updating-componentdidupdate
 */
public void componentDidUpdate(TodoItemProps prevProps, TodoItemProps prevState) {

    if (!prevProps.isEditing && props.isEditing) {
        InputElement inputEl = InputElement.as((InputElement)this.refs.get("editField"));
        inputEl.focus();
        inputEl.select();
    }
}
 
開發者ID:GWTReact,項目名稱:gwt-react-examples,代碼行數:15,代碼來源:TodoItem.java

示例8: createDomImpl

import com.google.gwt.dom.client.InputElement; //導入依賴的package包/類
@Override
public Element createDomImpl(Renderable element) {
  InputElement inputElem = Document.get().createCheckInputElement();
  inputElem.setClassName(CheckConstants.css.check());

  // Wrap in non-editable span- Firefox does not fire events for checkboxes
  // inside contentEditable region.
  SpanElement nonEditableSpan = Document.get().createSpanElement();
  DomHelper.setContentEditable(nonEditableSpan, false, false);
  nonEditableSpan.appendChild(inputElem);

  return nonEditableSpan;
}
 
開發者ID:jorkey,項目名稱:Wiab.pro,代碼行數:14,代碼來源:CheckBox.java

示例9: onAttributeModified

import com.google.gwt.dom.client.InputElement; //導入依賴的package包/類
@Override
public void onAttributeModified(ContentElement element, String name, String oldValue,
    String newValue) {
  if (GROUP.equalsIgnoreCase(name)) {
    InputElement inputElement = InputElement.as(element.getImplNodelet());
    inputElement.setName(element.getEditorUniqueString() + newValue);
  } else if (ContentElement.NAME.equalsIgnoreCase(name)) {
    EditorStaticDeps.logger.trace().log("myname: " + element.getName());
    element.getImplNodelet().setId(element.getEditorUniqueString() + newValue);
  }

  String groupName = element.getAttribute(GROUP);
  String elementName = element.getName();
  if (groupName != null && elementName != null) {
    EditorStaticDeps.logger.trace().log("myname: " + element.getName());
    ContentElement group = getGroup(element);
    if (group != null) {
      EditorStaticDeps.logger.trace().log(
          "selected: " + group.getAttribute(CheckConstants.VALUE));
      if (elementName != null && elementName.equals(group.getAttribute(CheckConstants.VALUE))) {
        setImplChecked(element, true);
      }
    } else {
      EditorStaticDeps.logger.trace().log("Cannot find associated group");
    }
  }
}
 
開發者ID:jorkey,項目名稱:Wiab.pro,代碼行數:28,代碼來源:RadioButton.java

示例10: setAccessKey

import com.google.gwt.dom.client.InputElement; //導入依賴的package包/類
@Override
public void setAccessKey(final char key) {
    final Element element = uiObject.getElement();
    final String accessKey = Character.toString(key);

    if (AnchorElement.is(element)) {
        AnchorElement.as(element).setAccessKey(accessKey);
    } else if (ButtonElement.is(element)) {
        ButtonElement.as(element).setAccessKey(accessKey);
    } else if (InputElement.is(element)) {
        InputElement.as(element).setAccessKey(accessKey);
    }
}
 
開發者ID:GwtMaterialDesign,項目名稱:gwt-material,代碼行數:14,代碼來源:FocusableMixin.java

示例11: insertItem

import com.google.gwt.dom.client.InputElement; //導入依賴的package包/類
/**
 * 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);
}
 
開發者ID:eclipse,項目名稱:che,代碼行數:26,代碼來源:CustomComboBox.java

示例12: insertItem

import com.google.gwt.dom.client.InputElement; //導入依賴的package包/類
/**
 * 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);
    currentItemLabel.setInnerText(item);
  }
  // add to widget
  optionsPanel.add(radioButton);
}
 
開發者ID:eclipse,項目名稱:che,代碼行數:26,代碼來源:CustomListBox.java

示例13: setSelectedIndex

import com.google.gwt.dom.client.InputElement; //導入依賴的package包/類
/**
 * Sets the currently selected index.
 *
 * @param index the index of the item to be selected
 */
public void setSelectedIndex(int index) {
  if (index < 0) {
    return;
  }

  // set default index if not added options yet
  if (index >= getItemCount()) {
    defaultSelectedIndex = index;
    return;
  }

  selectedIndex = index;
  currentItemLabel.setInnerText(getItemText(index));
  InputElement inputElement = getListItemElement(index);
  inputElement.setChecked(true);
}
 
開發者ID:eclipse,項目名稱:che,代碼行數:22,代碼來源:CustomListBox.java

示例14: select

import com.google.gwt.dom.client.InputElement; //導入依賴的package包/類
/**
 * Selects an item with given text.
 *
 * @param text text of an item to be selected
 */
public void select(String text) {
  // uncheck previous value
  if (selectedIndex >= 0) {
    InputElement inputElement = getListItemElement(selectedIndex);
    inputElement.setChecked(false);
  }

  // find and select a new one
  if (text != null) {
    for (int i = 0; i < getItemCount(); i++) {
      if (text.equals(getItemText(i))) {
        setSelectedIndex(i);
        return;
      }
    }
  }

  // clear the selection
  selectedIndex = -1;
  currentItemLabel.setInnerText("");
}
 
開發者ID:eclipse,項目名稱:che,代碼行數:27,代碼來源:CustomListBox.java

示例15: isEventAssociatedWithItemExpander

import com.google.gwt.dom.client.InputElement; //導入依賴的package包/類
public static boolean isEventAssociatedWithItemExpander(final Element eventTarget) {
	boolean outIsExpander = false;
	if (InputElement.is(eventTarget)) { 
		InputElement inputEl = eventTarget.cast();
		if (inputEl.getType().equalsIgnoreCase("checkbox") 
		 && inputEl.getClassName().equalsIgnoreCase(EXPANDER_CLASS_NAME)) {
			outIsExpander = true;
		}
	}
	return outIsExpander;
}
 
開發者ID:opendata-euskadi,項目名稱:r01fb,代碼行數:12,代碼來源:TreeViewUtils.java


注:本文中的com.google.gwt.dom.client.InputElement類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。