本文整理匯總了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);
}
}
}