本文整理了Java中com.google.gwt.user.client.ui.ListBox.getItemCount()
方法的一些代码示例,展示了ListBox.getItemCount()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。ListBox.getItemCount()
方法的具体详情如下:
包路径:com.google.gwt.user.client.ui.ListBox
类名称:ListBox
方法名:getItemCount
[英]Gets the number of items present in the list box.
[中]获取列表框中的项数。
代码示例来源:origin: kaaproject/kaa
private void addValue(T value) {
Object key = keyProvider.getKey(value);
if (valueKeyToIndex.containsKey(key)) {
throw new IllegalArgumentException("Duplicate value: " + value);
}
valueKeyToIndex.put(key, values.size());
values.add(value);
addListBoxItem(renderer.render(value));
assert values.size() == getListBox().getItemCount();
}
代码示例来源:origin: com.google.gwt/gwt-servlet
private void checkIndex(int index) {
if (index < 0 || index >= getItemCount()) {
throw new IndexOutOfBoundsException();
}
}
代码示例来源:origin: com.google.gwt/gwt-servlet
private void addValue(T value) {
Object key = keyProvider.getKey(value);
if (valueKeyToIndex.containsKey(key)) {
throw new IllegalArgumentException("Duplicate value: " + value);
}
valueKeyToIndex.put(key, values.size());
values.add(value);
getListBox().addItem(renderer.render(value));
assert values.size() == getListBox().getItemCount();
}
代码示例来源:origin: com.google.gwt/gwt-servlet
/**
* <b>Affected Elements:</b>
* <ul>
* <li>-item# = the option at the specified index.</li>
* </ul>
*
* @see UIObject#onEnsureDebugId(String)
*/
@Override
protected void onEnsureDebugId(String baseID) {
super.onEnsureDebugId(baseID);
// Set the id of each option
int numItems = getItemCount();
for (int i = 0; i < numItems; i++) {
ensureDebugId(getSelectElement().getOptions().getItem(i), baseID, "item"
+ i);
}
}
代码示例来源:origin: GwtMaterialDesign/gwt-material
/**
* Gets the number of items present in the list box.
*
* @return the number of items
*/
public int getItemCount() {
return listBox.getItemCount();
}
代码示例来源:origin: com.vaadin.external.gwt/gwt-user
private void checkIndex(int index) {
if (index < 0 || index >= getItemCount()) {
throw new IndexOutOfBoundsException();
}
}
代码示例来源:origin: com.googlecode.gwt-test-utils/gwt-test-utils
public static boolean assertListBoxDataMatch(ListBox listBox, String[] content) {
int contentSize = content.length;
if (contentSize != listBox.getItemCount()) {
return false;
}
for (int i = 0; i < contentSize; i++) {
if (!content[i].equals(listBox.getItemText(i))) {
return false;
}
}
return true;
}
代码示例来源:origin: org.drools/drools-wb-guided-dtable-editor-client
public static int getCurrentIndexFromListWithoutDefaultSelect(final String currentValue,
final ListBox list) {
for (int index = 0; index < list.getItemCount(); index++) {
final String value = list.getValue(index);
if (value != null && value.equals(currentValue)) {
return index;
}
}
return -1;
}
代码示例来源:origin: org.eclipse.che.plugin/che-plugin-git-ext-git
@Override
public boolean addRemoteBranch(@NotNull String branch) {
for (int i = 0; i < remoteBranch.getItemCount(); ++i) {
if (branch.equals(remoteBranch.getItemText(i))) {
return false;
}
}
remoteBranch.addItem(branch);
return true;
}
代码示例来源:origin: org.eclipse.che.plugin/che-plugin-git-ext-git
/** {@inheritDoc} */
@Override
public void selectLocalBranch(String branch) {
for (int i = 0; i < localBranch.getItemCount(); i++) {
if (localBranch.getValue(i).equals(branch)) {
localBranch.setItemSelected(i, true);
break;
}
}
}
代码示例来源:origin: org.kie.guvnor/guvnor-config-resource-widget
@Override
public void removeImport( String selected ) {
for ( int i = 0; i < importsList.getItemCount(); i++ ) {
if ( importsList.getValue( i ).equals( selected ) ) {
importsList.removeItem( i );
break;
}
}
}
代码示例来源:origin: org.eclipse.che.plugin/che-plugin-git-ext-git
/** {@inheritDoc} */
@Override
public void selectLocalBranch(String branch) {
for (int i = 0; i < localBranch.getItemCount(); i++) {
if (localBranch.getValue(i).equals(branch)) {
localBranch.setItemSelected(i, true);
break;
}
}
}
代码示例来源:origin: fr.lteconsulting/hexa.binding.gwt
private void deselectItems() {
for(int i = 0; i < listBox.getItemCount(); i++) {
if (listBox.isItemSelected(i)) {
listBox.setItemSelected(i, false);
}
}
}
代码示例来源:origin: org.jboss.ballroom/widgets
@Override
public void clearValue() {
clearSelection();
if(defaultToFirst && listBox.getItemCount()>0)
selectItem(0);
}
代码示例来源:origin: com.vaadin.external.gwt/gwt-user
private void addValue(T value) {
Object key = keyProvider.getKey(value);
if (valueKeyToIndex.containsKey(key)) {
throw new IllegalArgumentException("Duplicate value: " + value);
}
valueKeyToIndex.put(key, values.size());
values.add(value);
getListBox().addItem(renderer.render(value));
assert values.size() == getListBox().getItemCount();
}
代码示例来源:origin: org.eclipse.che.plugin/che-plugin-git-ext-git
/** {@inheritDoc} */
@Override
public void selectRemoteBranch(String branch) {
for (int i = 0; i < remoteBranch.getItemCount(); i++) {
if (remoteBranch.getValue(i).equals(branch)) {
remoteBranch.setItemSelected(i, true);
delegate.onRemoteBranchChanged();
break;
}
}
}
}
代码示例来源:origin: com.haulmont.cuba/cuba-web-toolkit
public void setSuggestions(List<TransportSuggestion> suggs) {
this.suggs = suggs;
createChoiceList();
populateList();
if (choiceList.getItemCount() == 0) {
close();
}
}
代码示例来源:origin: com.sksamuel.jqm4gwt/jqm4gwt-library
public void setLabel1(String label1) {
if (select.getItemCount() > 1)
select.setItemText(0, label1);
else
select.addItem(label1, getValue1());
}
代码示例来源:origin: org.drools/drools-wb-guided-dtable-editor-client
@Override
public void setupAttributeList(final List<String> attributes) {
attributeList.clear();
attributes.forEach(attributeList::addItem);
attributeList.setVisibleItemCount(attributeList.getItemCount());
attributeList.setSelectedIndex(attributeIndex());
}
代码示例来源:origin: org.jboss.errai/errai-widgets
/**
* Completes the selection and cancels the popup.
*/
private void select() {
if (list.getItemCount() > 0)
setText(list.getItemText(list.getSelectedIndex()));
cancel();
}
内容来源于网络,如有侵权,请联系作者删除!