本文整理汇总了Java中com.google.gwt.dom.client.InputElement.as方法的典型用法代码示例。如果您正苦于以下问题:Java InputElement.as方法的具体用法?Java InputElement.as怎么用?Java InputElement.as使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.google.gwt.dom.client.InputElement
的用法示例。
在下文中一共展示了InputElement.as方法的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);
}
示例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);
}
示例3: 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());
}
示例4: 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);
}
}
示例5: 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();
}
}
示例6: 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");
}
}
}
示例7: NullableCheckBox
import com.google.gwt.dom.client.InputElement; //导入方法依赖的package包/类
public NullableCheckBox(Element elem) {
super(elem);
inputElem = InputElement.as(elem);
inputElem.setPropertyBoolean("indeterminate", true);
inputElem.getStyle().setVerticalAlign(VerticalAlign.MIDDLE);
anchor.getStyle().setDisplay(Style.Display.INLINE_BLOCK);
anchor.getStyle().setPosition(Style.Position.RELATIVE);
anchor.getStyle().setHeight(100, Style.Unit.PCT);
anchor.getStyle().setVerticalAlign(Style.VerticalAlign.MIDDLE);
getElement().appendChild(anchor);
}
示例8: TDSelecter
import com.google.gwt.dom.client.InputElement; //导入方法依赖的package包/类
TDSelecter() {
super(TableCellElement.TAG_TD);
if (TableSelecter.this.singleSelection) {
this.inputElem = InputElement.as(DOM.createInputRadio(TableSelecter.this.groupId));
} else {
this.inputElem = InputElement.as(DOM.createInputCheck());
}
this.getElement().appendChild(this.inputElem);
}
示例9: checkName
import com.google.gwt.dom.client.InputElement; //导入方法依赖的package包/类
@Override
public <T extends UIObject & HasName> void checkName(T button) {
final String name = "name";
final Element label = button.getElement();
final InputElement input = InputElement.as(label.getFirstChildElement());
button.setName(name);
assertEquals(name, button.getName());
assertEquals(name, input.getName());
}
示例10: checkFormValue
import com.google.gwt.dom.client.InputElement; //导入方法依赖的package包/类
@Override
public <T extends UIObject & HasFormValue> void checkFormValue(T button) {
final String formValue = "formValue";
final Element label = button.getElement();
final InputElement input = InputElement.as(label.getFirstChildElement());
button.setFormValue(formValue);
assertEquals(formValue, button.getFormValue());
assertEquals(formValue, input.getValue());
}
示例11: checkValue
import com.google.gwt.dom.client.InputElement; //导入方法依赖的package包/类
@Override
public <T extends UIObject & HasValue<Boolean>> void checkValue(T button) {
final Element label = button.getElement();
final InputElement input = InputElement.as(label.getFirstChildElement());
button.setValue(true);
assertTrue(button.getValue());
assertTrue(input.isChecked());
button.setValue(false);
assertFalse(button.getValue());
assertFalse(input.isChecked());
}
示例12: doChange
import com.google.gwt.dom.client.InputElement; //导入方法依赖的package包/类
private void doChange(FormEvent event) {
InputElement e = InputElement.as(event.target);
String val = e.getValue();
setState(State.make(val));
}
示例13: getReviewed
import com.google.gwt.dom.client.InputElement; //导入方法依赖的package包/类
private InputElement getReviewed(FileInfo info) {
CellFormatter fmt = table.getCellFormatter();
Element e = fmt.getElement(1 + info._row(), 1);
return InputElement.as(e.getFirstChildElement());
}
示例14: NullableTextBox
import com.google.gwt.dom.client.InputElement; //导入方法依赖的package包/类
public NullableTextBox(Element elem) {
super(elem);
inputElem = InputElement.as(elem);
}
示例15: getImplAsInputElement
import com.google.gwt.dom.client.InputElement; //导入方法依赖的package包/类
/**
* Returns the implNodelet as an InputElement or null.
*/
public static InputElement getImplAsInputElement(ContentElement element) {
return InputElement.as(element.getImplNodelet());
}