com.google.gwt.user.client.ui.ListBox.removeItem()方法的使用及代码示例

x33g5p2x  于2022-01-23 转载在 其他  
字(5.8k)|赞(0)|评价(0)|浏览(114)

本文整理了Java中com.google.gwt.user.client.ui.ListBox.removeItem()方法的一些代码示例,展示了ListBox.removeItem()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。ListBox.removeItem()方法的具体详情如下:
包路径:com.google.gwt.user.client.ui.ListBox
类名称:ListBox
方法名:removeItem

ListBox.removeItem介绍

[英]Removes the item at the specified index.
[中]删除指定索引处的项。

代码示例

代码示例来源:origin: sk.seges.acris/acris-widgets-beantable

/**
 * Removes the item at the specified index.
 * 
 * @param index the index of the item to be removed
 * @throws IndexOutOfBoundsException if the index is out of range
 */
public void removeItem(int index) throws IndexOutOfBoundsException {
 listBox.removeItem(index);
 itemValues.remove(index);
}

代码示例来源:origin: ltearno/hexa.tools

public void removeItem( T item )
{
  if( item == null )
    return;
  int index = getItemIndex( item );
  if( index >= 0 )
    list.removeItem( index );
  int hashCode = item.hashCode();
  items.remove( hashCode );
}

代码示例来源:origin: fr.lteconsulting/hexa.core

public void removeItem( T item )
{
  if( item == null )
    return;
  int index = getItemIndex( item );
  if( index >= 0 )
    list.removeItem( index );
  int hashCode = item.hashCode();
  items.remove( hashCode );
}

代码示例来源:origin: GwtMaterialDesign/gwt-material

protected void removeItemInternal(int index, boolean reload) {
  values.remove(index);
  listBox.removeItem(index);
  if (reload) {
    reload();
  }
}

代码示例来源:origin: com.github.gwtmaterialdesign/gwt-material

protected void removeItemInternal(int index, boolean reload) {
  values.remove(index);
  listBox.removeItem(index);
  if (reload) {
    reload();
  }
}

代码示例来源: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: GwtMaterialDesign/gwt-material

protected void removeEmptyPlaceHolder() {
  // indeed the first item/value is emptyPlaceHolder
  listBox.removeItem(0);
  values.remove(0);
  OptionElement currentPlaceholder = getOptionElement(0);
  if (currentPlaceholder != null) {
    currentPlaceholder.setDisabled(false);
  }
}

代码示例来源: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: com.github.gwtmaterialdesign/gwt-material

protected void removeEmptyPlaceHolder() {
  // indeed the first item/value is emptyPlaceHolder
  listBox.removeItem(0);
  values.remove(0);
  OptionElement currentPlaceholder = getOptionElement(0);
  if (currentPlaceholder != null) {
    currentPlaceholder.setDisabled(false);
  }
}

代码示例来源:origin: stackoverflow.com

@UiHandler("Up")
void UpClick(ClickEvent e) {
  ListBox item;
  int i=item.getSelectedIndex();
  if(i>0){
    // add duplicated item in the list
    item.insertItem(item.getItemText(i),i-1);

    // delete the old occurence of this item
    item.removeItem(i+1);
  }
}

@UiHandler("Down")
void DownClick(ClickEvent e) {
  int i=item.getSelectedIndex();
  if((i!=-1) && (i<item.getItemCount()-1)) {
    item.insertItem(item.getItemText(i),i+2);

    item.removeItem(i);
  }
}

代码示例来源:origin: org.kie.guvnor/guvnor-test-scenario-editor-client

public void onClick(ClickEvent event) {
    if (box.getSelectedIndex() == -1) {
      Window.alert(TestScenarioConstants.INSTANCE.PleaseChooseARuleToRemove());
    } else {
      String r = box.getItemText(box.getSelectedIndex());
      sc.getRules().remove(r);
      box.removeItem(box.getSelectedIndex());
    }
  }
});

代码示例来源:origin: com.haulmont.cuba/cuba-web-toolkit

protected static Set<String> moveSelectedItems(ListBox source, ListBox target) {
  final boolean[] sel = getSelectionBitmap(source);
  final Set<String> movedItems = new HashSet<>();
  for (int i = 0; i < sel.length; i++) {
    if (sel[i]) {
      final int optionIndex = i
          - (sel.length - source.getItemCount());
      movedItems.add(source.getValue(optionIndex));
      // Move selection to another column
      final String text = source.getItemText(optionIndex);
      final String value = source.getValue(optionIndex);
      target.addItem(text, value);
      target.setItemSelected(target.getItemCount() - 1, true);
      source.removeItem(optionIndex);
    }
  }
  target.setFocus(true);
  return movedItems;
}

代码示例来源:origin: org.eagle-i/eagle-i-search-gwt

public void update() {
    SearchRequest request = context.getCurrentRequest();
    if (!context.isInstitution()) {
      List<EIURI> institutionUriList = request.getProviderInstitutionList();
      if ( institutionUriList != null && institutionUriList.size() > 0) {
        // Selected institutions should be the third item in the list (only add if smaller)
        if (institutionListBox.getItemCount() < 3) {
          institutionListBox.addItem("Selected Collections");
        }
        institutionListBox.setSelectedIndex(institutionListBox.getItemCount() - 1);
      }
      else {
        // Selected Institutions item should be last (if present)
        if (institutionListBox.getValue(institutionListBox.getItemCount() - 1).equals("Selected Collections")) {
          institutionListBox.removeItem(institutionListBox.getItemCount() - 1);
          // All Institutions item should be first
          institutionListBox.setSelectedIndex(0);
        }
      }
    }
  }
}

代码示例来源:origin: org.eagle-i/eagle-i-datatools-sweet-gwt

@Override
  public void onClick(final ClickEvent arg0) {
    if ( providerFilter.getItemCount() == 1 ) { // Populate the list only
      // if it is not already
      // populated
      providerFilter.removeItem( providerFilter.getItemCount() - 1 );
      providerFilter.addItem( "List is loading...." );
      final AuthSearchRequest request = new AuthSearchRequest();
      request.setType( ResourceProvider.BASE_RESOURCE_CONTAINER_URI );
      // FIXME enable
      request.setPaginated( false );
      ClientSweetProxy.getInstance().listResources( request, SortByProperties.LABEL, true, false, false, false,
          new RootAsyncCallback<List<EIInstanceMinimal>>() {
            @Override
            public void onSuccess(final List<EIInstanceMinimal> eiInstanceList) {
              providerFilter.removeItem( providerFilter.getItemCount() - 1 );
              providerFilter.addItem( genericOption );
              for (final EIInstanceMinimal instance : eiInstanceList) {
                providerFilter.addItem( instance.getInstanceLabel(), instance.getInstanceURI().toString() );
                if ( instance.getEntity().equals( filterProviderEntity ) ) {
                  providerFilter.setSelectedIndex( providerFilter.getItemCount() - 1 );
                }
              }
            }
          } );
    }
  }
} );

相关文章