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


Java InputElement.isChecked方法代碼示例

本文整理匯總了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)));
		}
	}
}
 
開發者ID:jchaganti,項目名稱:gharonda,代碼行數:12,代碼來源:MyFavoritesView.java

示例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)));
		}
	}

}
 
開發者ID:jchaganti,項目名稱:gharonda,代碼行數:13,代碼來源:ResultWithoutMapView.java

示例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 );
        }
    }
}
 
開發者ID:kiegroup,項目名稱:kie-wb-common,代碼行數:38,代碼來源:CheckboxCell.java

示例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);
}
 
開發者ID:Teiid-Designer,項目名稱:teiid-webui,代碼行數:7,代碼來源:TableNamesTable.java

示例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);
            }
        }
    }
}
 
開發者ID:opendatakit,項目名稱:aggregate,代碼行數:59,代碼來源:UIEnabledValidatingCheckboxCell.java

示例6: getData

import com.google.gwt.dom.client.InputElement; //導入方法依賴的package包/類
@Override
public Boolean getData(final InputElement input, String attribute) {
    return input.isChecked();
}
 
開發者ID:liraz,項目名稱:gwt-backbone,代碼行數:5,代碼來源:InputElementBooleanAdapter.java

示例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);
        }
    }
}
 
開發者ID:kiegroup,項目名稱:appformer,代碼行數:47,代碼來源:CheckboxCellImpl.java

示例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);
		}
	}
}
 
開發者ID:marat-gainullin,項目名稱:platypus-js,代碼行數:44,代碼來源:CheckBoxCell.java

示例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);
        }
    }
}
 
開發者ID:inepex,項目名稱:ineform,代碼行數:45,代碼來源:DisableAbleCheckboxCell.java


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