本文整理汇总了Java中com.google.gwt.dom.client.InputElement.isChecked方法的典型用法代码示例。如果您正苦于以下问题:Java InputElement.isChecked方法的具体用法?Java InputElement.isChecked怎么用?Java InputElement.isChecked使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.google.gwt.dom.client.InputElement
的用法示例。
在下文中一共展示了InputElement.isChecked方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: addToSelections
import com.google.gwt.dom.client.InputElement; //导入方法依赖的package包/类
public void addToSelections(String id) {
Element elem = DOM.getElementById("cb_" + id);
if (elem instanceof InputElement) {
InputElement in = (InputElement) elem;
if (in.isChecked() && !selections.contains(Integer.parseInt(id))) {
selections.add(Integer.parseInt(id));
} else if (selections.contains(Integer.parseInt(id))) {
selections.remove(new Integer(Integer.parseInt(id)));
}
}
}
示例2: addToCompareListingList
import com.google.gwt.dom.client.InputElement; //导入方法依赖的package包/类
public void addToCompareListingList(String id) {
Element elem = DOM.getElementById("cb_" + id);
if (elem instanceof InputElement) {
InputElement in = (InputElement) elem;
if (in.isChecked() && !compareListing.contains(Integer.parseInt(id))) {
compareListing.add(Integer.parseInt(id));
} else if (compareListing.contains(Integer.parseInt(id))) {
compareListing.remove(new Integer(Integer.parseInt(id)));
}
}
}
示例3: onBrowserEvent
import com.google.gwt.dom.client.InputElement; //导入方法依赖的package包/类
@Override
public void onBrowserEvent( final Context context,
final Element parent,
final Boolean value,
final NativeEvent event,
final ValueUpdater<Boolean> valueUpdater ) {
String type = event.getType();
boolean enterPressed = BrowserEvents.KEYDOWN.equals( type )
&& event.getKeyCode() == KeyCodes.KEY_ENTER;
if ( BrowserEvents.CHANGE.equals( type ) || enterPressed ) {
InputElement input = parent.getFirstChild().cast();
Boolean isChecked = input.isChecked();
// Toggle the value if the enter key was pressed and the cell handles
// selection or doesn't depend on selection. If the cell depends on
// selection but doesn't handle selection, then ignore the enter key and
// let the SelectionEventManager determine which keys will trigger a
// change.
if ( enterPressed && ( handlesSelection() || !dependsOnSelection() ) ) {
isChecked = !isChecked;
input.setChecked( isChecked );
}
// Save the new value. However, if the cell depends on the selection, then
// do not save the value because we can get into an inconsistent state.
if ( value != isChecked && !dependsOnSelection() ) {
setViewData( context.getKey(), isChecked );
} else {
clearViewData( context.getKey() );
}
if ( valueUpdater != null ) {
valueUpdater.update( isChecked );
}
}
}
示例4: onBrowserEvent
import com.google.gwt.dom.client.InputElement; //导入方法依赖的package包/类
@Override
public void onBrowserEvent(Context context, Element elem, NativeEvent event) {
InputElement input = elem.getFirstChild().cast();
checkedState = input.isChecked();
headerUpdated(checkedState);
}
示例5: onBrowserEvent
import com.google.gwt.dom.client.InputElement; //导入方法依赖的package包/类
@SuppressWarnings("unchecked")
@Override
public void onBrowserEvent(Context context, Element parent, Boolean value,
NativeEvent event, ValueUpdater<Boolean> valueUpdater) {
String type = event.getType();
boolean enterPressed = "keydown".equals(type)
&& event.getKeyCode() == KeyCodes.KEY_ENTER;
if ("change".equals(type) || enterPressed) {
InputElement input = parent.getFirstChild().cast();
Boolean isChecked = input.isChecked();
Object key = context.getKey();
if ( isEnabledPredicate != null && !isEnabledPredicate.isEnabled((T) key)) {
// disabled checkbox -- no changes!
return;
}
/*
* Toggle the value if the enter key was pressed; this brings
* the key-press event path in line with a mouse-click event path.
*/
if (enterPressed) {
isChecked = !isChecked;
input.setChecked(isChecked);
}
/*
* See if this is a valid action for this checkbox.
*/
boolean changed = true;
if ( validationPredicate != null && !validationPredicate.isValid(isChecked, (T) key)) {
isChecked = !isChecked;
changed = false;
}
/*
* Save the new value.
*/
if (value != isChecked) {
setViewData(context.getKey(), isChecked);
} else {
clearViewData(context.getKey());
}
// redraw our parent with the value we ended up with...
SafeHtmlBuilder sb = new SafeHtmlBuilder();
render(context, isChecked, sb);
parent.setInnerHTML(sb.toSafeHtml().asString());
// apparently the element never gains focus...
if ( changed ) {
// do value-change action...
if (valueUpdater != null) {
valueUpdater.update(isChecked);
}
}
}
}
示例6: getData
import com.google.gwt.dom.client.InputElement; //导入方法依赖的package包/类
@Override
public Boolean getData(final InputElement input, String attribute) {
return input.isChecked();
}
示例7: onBrowserEvent
import com.google.gwt.dom.client.InputElement; //导入方法依赖的package包/类
@Override
public void onBrowserEvent(Context context,
Element parent,
Boolean value,
NativeEvent event,
ValueUpdater<Boolean> valueUpdater) {
//If read-only ignore editing events
if (isReadOnly) {
return;
}
String type = event.getType();
boolean enterPressed = "keydown".equals(type) && event.getKeyCode() == KeyCodes.KEY_ENTER;
if ("click".equals(type) || enterPressed) {
InputElement input = parent.getFirstChild().cast();
Boolean isChecked = input.isChecked();
/*
* Toggle the value if the enter key was pressed and the cell
* handles selection or doesn't depend on selection. If the cell
* depends on selection but doesn't handle selection, then ignore
* the enter key and let the SelectionEventManager determine which
* keys will trigger a change.
*/
if (enterPressed) {
isChecked = !isChecked;
input.setChecked(isChecked);
}
/*
* Save the new value. However, if the cell depends on the
* selection, then do not save the value because we can get into an
* inconsistent state.
*/
if (value != isChecked) {
setViewData(context.getKey(),
isChecked);
}
if (valueUpdater != null) {
valueUpdater.update(isChecked);
}
}
}
示例8: onBrowserEvent
import com.google.gwt.dom.client.InputElement; //导入方法依赖的package包/类
@Override
public void onBrowserEvent(Context context, Element parent, Object value, NativeEvent event, ValueUpdater<Object> valueUpdater) {
String type = event.getType();
boolean enterPressed = (BrowserEvents.KEYDOWN.equals(type) && event.getKeyCode() == KeyCodes.KEY_ENTER);
/*
* Crazy browsers fire click and change events in different order.
* FireFox issues a click event first and then change event.
* Than we have an issue with selection re-rendering and 'change' event never fired,
* because of mark-up replacement while grid rendering.
*/
if (BrowserEvents.CLICK.equals(type) || BrowserEvents.CHANGE.equals(type) || enterPressed) {
InputElement input = parent.<XElement>cast().firstChildByTagName("input").cast();
Boolean isChecked = input.isChecked();
/*
* Toggle the value if the enter key was pressed and the cell
* handles selection or doesn't depend on selection. If the cell
* depends on selection but doesn't handle selection, then ignore
* the enter key and let the SelectionEventManager determine which
* keys will trigger a change.
*/
if (enterPressed && (handlesSelection() || !dependsOnSelection())) {
isChecked = !isChecked;
input.setChecked(isChecked);
}
/*
* Save the new value. However, if the cell depends on the
* selection, then do not save the value because we can get into an
* inconsistent state.
*/
if (value != isChecked && !dependsOnSelection()) {
setViewData(context.getKey(), isChecked);
} else {
clearViewData(context.getKey());
}
if (valueUpdater != null) {
valueUpdater.update(isChecked);
}
}
}
示例9: onBrowserEvent
import com.google.gwt.dom.client.InputElement; //导入方法依赖的package包/类
@Override
public void onBrowserEvent(
Context context,
Element parent,
CheckedAndDisabled value,
NativeEvent event,
ValueUpdater<CheckedAndDisabled> valueUpdater) {
String type = event.getType();
boolean enterPressed = BrowserEvents.KEYDOWN.equals(type)
&& event.getKeyCode() == KeyCodes.KEY_ENTER;
if (BrowserEvents.CHANGE.equals(type) || enterPressed) {
InputElement input = parent.getFirstChild().cast();
Boolean isChecked = input.isChecked();
/*
* Toggle the value if the enter key was pressed and the cell
* handles selection or doesn't depend on selection. If the cell
* depends on selection but doesn't handle selection, then ignore
* the enter key and let the SelectionEventManager determine which
* keys will trigger a change.
*/
if (enterPressed && (handlesSelection() || !dependsOnSelection())) {
isChecked = !isChecked;
input.setChecked(isChecked);
}
/*
* Save the new value. However, if the cell depends on the
* selection, then do not save the value because we can get into an
* inconsistent state.
*/
if (value.getChecked() != isChecked && !dependsOnSelection()) {
value.setChecked(isChecked);
setViewData(context.getKey(), value);
} else {
clearViewData(context.getKey());
}
if (valueUpdater != null) {
valueUpdater.update(value);
}
}
}