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

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

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

ListBox.addItem介绍

[英]Adds an item to the list box. This method has the same effect as

addItem(item, item)

[中]将项目添加到列表框中。此方法与

addItem(item, item)

代码示例

代码示例来源: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

private ListBox createMonthSelect() {
 final ListBox monthListBox = new ListBox();
 for (int i = 0; i < CalendarModel.MONTHS_IN_YEAR; i++) {
  monthListBox.addItem(getModel().formatMonth(i));
 }
 monthListBox.addChangeHandler(new ChangeHandler() {
  @Override
  public void onChange(ChangeEvent event) {
   int previousMonth = getModel().getCurrentMonth().getMonth();
   int newMonth = monthListBox.getSelectedIndex();
   int delta = newMonth - previousMonth;
   addMonths(delta);
  }
 });
 return monthListBox;
}

代码示例来源:origin: com.google.gwt/gwt-servlet

private void setDate(Date date) {
 if (getDatePicker().isYearAndMonthDropdownVisible()) {
  // setup months dropdown
  int month = date.getMonth();
  monthSelect.setSelectedIndex(month);
  // setup years dropdown
  yearSelect.clear();
  int year = date.getYear();
  int startYear = year - getNoOfYearsToDisplayBefore();
  int endYear = year + getNoOfYearsToDisplayAfter();
  Date newDate = new Date();
  for (int i = startYear; i <= endYear; i++) {
   newDate.setYear(i);
   yearSelect.addItem(getModel().getYearFormatter().format(newDate));
  }
  yearSelect.setSelectedIndex(year - startYear);
 } else {
  grid.setText(0, monthColumn, getModel().formatCurrentMonthAndYear());
 }
}

代码示例来源:origin: org.drools/drools-wb-guided-dtable-editor-client

@Override
public void addItem(final String itemName,
          final String itemKey) {
  fieldList.addItem(itemName,
           itemKey);
}

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

public void setBackgroundColorLocaleMap(Map<String, String> localeMap) {
  backColors.clear();
  backColors.addItem(localeMap.get(CubaRichTextAreaState.RICH_TEXT_AREA_BACKGROUND_LABEL));
  backColors.addItem(localeMap.get(CubaRichTextAreaState.RICH_TEXT_AREA_WHITE_LABEL), "white");
  backColors.addItem(localeMap.get(CubaRichTextAreaState.RICH_TEXT_AREA_BLACK_LABEL), "black");
  backColors.addItem(localeMap.get(CubaRichTextAreaState.RICH_TEXT_AREA_RED_LABEL), "red");
  backColors.addItem(localeMap.get(CubaRichTextAreaState.RICH_TEXT_AREA_GREEN_LABEL), "green");
  backColors.addItem(localeMap.get(CubaRichTextAreaState.RICH_TEXT_AREA_YELLOW_LABEL), "yellow");
  backColors.addItem(localeMap.get(CubaRichTextAreaState.RICH_TEXT_AREA_BLUE_LABEL), "blue");
  backColors.setTabIndex(-1);
}

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

public void setForegroundColorLocaleMap(Map<String, String> localeMap) {
    foreColors.clear();

    foreColors.addItem(localeMap.get(CubaRichTextAreaState.RICH_TEXT_AREA_FOREGROUND_LABEL));
    foreColors.addItem(localeMap.get(CubaRichTextAreaState.RICH_TEXT_AREA_WHITE_LABEL), "white");
    foreColors.addItem(localeMap.get(CubaRichTextAreaState.RICH_TEXT_AREA_BLACK_LABEL), "black");
    foreColors.addItem(localeMap.get(CubaRichTextAreaState.RICH_TEXT_AREA_RED_LABEL), "red");
    foreColors.addItem(localeMap.get(CubaRichTextAreaState.RICH_TEXT_AREA_GREEN_LABEL), "green");
    foreColors.addItem(localeMap.get(CubaRichTextAreaState.RICH_TEXT_AREA_YELLOW_LABEL), "yellow");
    foreColors.addItem(localeMap.get(CubaRichTextAreaState.RICH_TEXT_AREA_BLUE_LABEL), "blue");

    foreColors.setTabIndex(-1);
  }
}

代码示例来源:origin: org.eclipse.che.plugin/che-plugin-git-ext-git

/** {@inheritDoc} */
@Override
public void setLocalBranches(@NotNull List<String> branches) {
 this.localBranch.clear();
 for (String branch : branches) {
  this.localBranch.addItem(branch);
 }
}

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

public void ruleSelected(String r) {
    filterList.add(r);
    box.addItem(r);
    pop.hide();
  }
});

代码示例来源:origin: io.github.nibiruos.ui/org.nibiru.ui.gwt

@Override
  protected void setValue(Iterable<V> value) {
    this.value = value;
    control.clear();
    comboItems.clear();
    for (V item : value) {
      control.addItem(item.toString());
      comboItems.add(item);
    }
  }
};

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

String[] strings = new String[] { "ab", "ac", "a", "abc" };
java.util.Arrays.sort(strings);

ListBox l = new ListBox();

for (String s : strings) {
  l.addItem(s);
}

代码示例来源:origin: org.jboss.ballroom/widgets

public void setValueMap(String[] values) {
  listBox.clear();
  //listBox.clearSelection();
  if(addEmptyItem && (values.length==0 || !values[0].isEmpty()))
    listBox.addItem("");
  for(String s : values)
  {
    listBox.addItem(s);
  }
  if(defaultToFirst)
    selectItem(0);
}

代码示例来源:origin: org.jboss.ballroom/widgets

public void setValueMap(Collection<String> values) {
  listBox.clear();
  //listBox.clearSelection();
  if(addEmptyItem && (values.isEmpty() || !values.iterator().next().isEmpty()))
    listBox.addItem("");
  for(String s : values)
  {
    listBox.addItem(s);
  }
  if(defaultToFirst)
    selectItem(0);
}

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

/**
 * Adds an item to the listbox. Adds a mapping to the group order to keep the indices correct.
 */
public void addItem(final String item, final String value) {
  super.addItem(item, value);
  if ( item.equals( CREATE_NEW_VALUE ) ) {
    createNewIndex = getItemCount() - 1;
  }
}

代码示例来源:origin: org.eclipse.che.plugin/che-plugin-git-ext-git

@Override
public void setRemoteBranchesList(List<Branch> branches) {
 remoteBranches.clear();
 branches.forEach(branch -> remoteBranches.addItem(branch.getDisplayName()));
}

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

public HourMinuteControl()
{
  initWidget( uiBinder.createAndBindUi( this ) );
  NumberFormat fmt = NumberFormat.getFormat( "00" );
  for( int h = 0; h < 25; h++ )
    hour.addItem( fmt.format( h ), String.valueOf( h ) );
  for( int m = 0; m < 60; m += 15 )
    minute.addItem( fmt.format( m ), String.valueOf( m ) );
}

代码示例来源:origin: org.eclipse.che.core/che-core-ide-app

@Override
public void setMachines(List<? extends MachineImpl> machines) {
 machinesList.clear();
 machinesById.clear();
 machines.forEach(
   machine -> {
    machinesById.put(machine.getName(), machine);
    machinesList.addItem(machine.getName());
   });
 machinesList.setVisibleItemCount(machines.size());
 machinesList.setSelectedIndex(0);
}

代码示例来源:origin: org.drools/drools-wb-guided-dtable-editor-client

@Override
public void setupEmptyPatternList() {
  patternList.clear();
  patternList.setEnabled(false);
  patternList.addItem(translate(GuidedDecisionTableErraiConstants.PatternToDeletePageView_None));
}

代码示例来源:origin: com.sksamuel.jqm4gwt/jqm4gwt-standalone

public void setLabel1(String label1) {
  if (select.getItemCount() > 1)
    select.setItemText(0, label1);
  else
    select.addItem(label1, getValue1());
}

代码示例来源:origin: org.kie.workbench.widgets/kie-wb-common-ui

@Override
public void setItems( final List<Pair<String, String>> items ) {
  listItems.clear();
  for ( Pair<String, String> item : items ) {
    listItems.addItem( item.getK1(),
              item.getK2() );
  }
}

代码示例来源:origin: org.kie.guvnor/guvnor-commons-ui

private void fillDates() {
  setVisible( false );
  dates.clear();
  // Check month 
  int days = daysInMonth( months.getSelectedIndex() + 1 );
  for ( int i = 1; i <= days; i++ ) {
    dates.addItem( Integer.toString( i ) );
  }
  setVisible( true );
}

相关文章