当前位置: 首页>>代码示例>>Java>>正文


Java InputElement.setChecked方法代码示例

本文整理汇总了Java中com.google.gwt.dom.client.InputElement.setChecked方法的典型用法代码示例。如果您正苦于以下问题:Java InputElement.setChecked方法的具体用法?Java InputElement.setChecked怎么用?Java InputElement.setChecked使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.google.gwt.dom.client.InputElement的用法示例。


在下文中一共展示了InputElement.setChecked方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: 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

示例2: 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

示例3: 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

示例4: 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

示例5: setItemSelected

import com.google.gwt.dom.client.InputElement; //导入方法依赖的package包/类
/**
 * Sets whether an individual list item is selected.
 *
 * @param index the index of the item to be selected or unselected
 * @param selected <code>true</code> to select the item
 */
public void setItemSelected(int index, boolean selected) {
  if (index < 0 || index >= getItemCount()) {
    return;
  }
  if (selected) {
    selectedIndex = index;
    currentInputElement.setValue(getItemText(index));
  }
  final InputElement inputElement = getListItemElement(index);
  inputElement.setChecked(selected);
}
 
开发者ID:eclipse,项目名称:che,代码行数:18,代码来源:CustomComboBox.java

示例6: 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;
  currentInputElement.setValue(getItemText(index));
  final InputElement inputElement = getListItemElement(index);
  inputElement.setChecked(true);
}
 
开发者ID:eclipse,项目名称:che,代码行数:20,代码来源:CustomComboBox.java

示例7: resetSelectedIndex

import com.google.gwt.dom.client.InputElement; //导入方法依赖的package包/类
/** Ensures that no item is selected. */
private void resetSelectedIndex() {
  if (getSelectedIndex() != -1) {
    selectedIndex = -1;
    NodeList<Element> selectionElements = optionsPanel.getElement().getElementsByTagName("input");
    for (int pos = 0; pos < selectionElements.getLength(); pos++) {
      InputElement inputElement = (InputElement) selectionElements.getItem(pos);
      inputElement.setChecked(false);
    }
  }
}
 
开发者ID:eclipse,项目名称:che,代码行数:12,代码来源:CustomComboBox.java

示例8: setItemSelected

import com.google.gwt.dom.client.InputElement; //导入方法依赖的package包/类
/**
 * Sets whether an individual list item is selected.
 *
 * @param index the index of the item to be selected or unselected
 * @param selected <code>true</code> to select the item
 */
public void setItemSelected(int index, boolean selected) {
  if (index < 0 || index >= getItemCount()) {
    return;
  }
  if (selected) {
    selectedIndex = index;
    currentItemLabel.setInnerText(getItemText(index));
  }
  final InputElement inputElement = getListItemElement(index);
  inputElement.setChecked(selected);
}
 
开发者ID:eclipse,项目名称:che,代码行数:18,代码来源:CustomListBox.java

示例9: setCheckBoxState

import com.google.gwt.dom.client.InputElement; //导入方法依赖的package包/类
private void setCheckBoxState(Path nodePath, InputElement checkBoxInputElement) {
  if (indeterminate.contains(nodePath)) {
    checkBoxInputElement.setId(checkBoxInputElement.getId() + "-indeterminate");
    setIndeterminate(checkBoxInputElement);
  } else if (!unselected.contains(nodePath)) {
    checkBoxInputElement.setChecked(true);
    checkBoxInputElement.setId(checkBoxInputElement.getId() + "-checked");
  } else {
    checkBoxInputElement.setId(checkBoxInputElement.getId() + "-unchecked");
  }
}
 
开发者ID:eclipse,项目名称:che,代码行数:12,代码来源:CheckBoxRender.java

示例10: disableInputs

import com.google.gwt.dom.client.InputElement; //导入方法依赖的package包/类
/**
 * Disables all the provided inputEls
 * @param inputEls
 */
public static void disableInputs(final Collection<InputElement> inputEls) {
	if (CollectionUtils.isNullOrEmpty(inputEls)) return;
	for (InputElement inputEl : inputEls) {
		inputEl.setChecked(false);	// ?� this is NOT the same as getValue
		inputEl.setDisabled(true);
	}
}
 
开发者ID:opendata-euskadi,项目名称:r01fb,代码行数:12,代码来源:GWTElemental.java

示例11: enableInputs

import com.google.gwt.dom.client.InputElement; //导入方法依赖的package包/类
/**
 * Enables all the provided inputEls
 * @param inputEls
 */
public static void enableInputs(final Collection<InputElement> inputEls) {
	if (CollectionUtils.isNullOrEmpty(inputEls)) return;
	for (InputElement inputEl : inputEls) {
		inputEl.setChecked(true);	// ?� this is NOT the same as getValue
		inputEl.setDisabled(false);
	}
}
 
开发者ID:opendata-euskadi,项目名称:r01fb,代码行数:12,代码来源:GWTElemental.java

示例12: onBrowserEvent

import com.google.gwt.dom.client.InputElement; //导入方法依赖的package包/类
@Override
public void onBrowserEvent(Context context, Element elem, T object, NativeEvent event) {
    if (BrowserEvents.CHANGE.equals(event.getType())) {
        InputElement input = elem.getFirstChild().cast();
        input.setChecked(!input.isChecked());
    }
}
 
开发者ID:rkfg,项目名称:gwtutil,代码行数:8,代码来源:ReadonlyCheckboxColumn.java

示例13: 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

示例14: updateCheckboxDom

import com.google.gwt.dom.client.InputElement; //导入方法依赖的package包/类
private void updateCheckboxDom(ContentElement checkbox, boolean isChecked) {
  Element implNodelet = checkbox.getImplNodelet();
  InputElement checkboxElem = (InputElement) implNodelet.getFirstChild();
  checkboxElem.setChecked(isChecked);
}
 
开发者ID:jorkey,项目名称:Wiab.pro,代码行数:6,代码来源:CheckBox.java

示例15: 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


注:本文中的com.google.gwt.dom.client.InputElement.setChecked方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。