/** * Instantiates a new MultiValueListBox. */ public MultiValueListBox(Renderer<T> renderer, ProvidesKey<T> keyProvider) { this.keyProvider = keyProvider; this.renderer = renderer; ListBox listBox = new ListBox(); listBox.setMultipleSelect(true); initWidget(listBox); getListBox().addChangeHandler(new ChangeHandler() { public void onChange(ChangeEvent event) { List<T> newValue = new ArrayList<>(); for (int i = 0; i < values.size(); i++) { if (getListBox().isItemSelected(i)) { newValue.add(values.get(i)); } } setValue(newValue, true); } }); }
private ListBox createYearSelect() { final ListBox yearListBox = new ListBox(); yearListBox.addChangeHandler(new ChangeHandler() { @Override public void onChange(ChangeEvent event) { int deltaYears = yearListBox.getSelectedIndex() - getNoOfYearsToDisplayBefore(); addMonths(deltaYears * CalendarModel.MONTHS_IN_YEAR); } }); return yearListBox; }
public ValueListBox(Renderer<? super T> renderer, ProvidesKey<T> keyProvider) { this.keyProvider = keyProvider; this.renderer = renderer; initWidget(new ListBox()); getListBox().addChangeHandler(new ChangeHandler() { public void onChange(ChangeEvent event) { int selectedIndex = getListBox().getSelectedIndex(); if (selectedIndex < 0) { return; // Not sure why this happens during addValue } T newValue = values.get(selectedIndex); setValue(newValue, true); } }); }
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; }
/** * Creates a ListBox widget that wraps an existing <select> element. * * This element must already be attached to the document. If the element is * removed from the document, you must call * {@link RootPanel#detachNow(Widget)}. * * @param element the element to be wrapped * @return list box */ public static ListBox wrap(Element element) { // Assert that the element is attached. assert Document.get().getBody().isOrHasChild(element); ListBox listBox = new ListBox(element); // Mark it attached and remember it for cleanup. listBox.onAttach(); RootPanel.detachOnWindowClose(listBox); return listBox; }
@Override public ListBox getWidget() { return new ListBox(); } }
/** * Construct a new {@link ListCellEditor} using the specified images. * * @param images the images to use for the accept/cancel buttons */ public ListCellEditor(InlineCellEditorImages images) { this(new ListBox(), images); }
/** * Construct a new {@link ListCellEditor}. */ public ListCellEditor() { this(new ListBox(), GWT.<InlineCellEditorImages> create(InlineCellEditorImages.class)); }
ListBox listBox = new ListBox(); //add some entries to the listbox int itemCount = listbox.getItemCount(); for (int i = itemCount - 1; i >= 0; i--) { if ("YOURTEXT".equals(listbox.getItemText(i))) { statusListBox.removeItem(i); } }
String[] strings = new String[] { "ab", "ac", "a", "abc" }; java.util.Arrays.sort(strings); ListBox l = new ListBox(); for (String s : strings) { l.addItem(s); }
private ListBox createYearSelect() { final ListBox yearListBox = new ListBox(); yearListBox.addChangeHandler(new ChangeHandler() { @Override public void onChange(ChangeEvent event) { int deltaYears = yearListBox.getSelectedIndex() - getNoOfYearsToDisplayBefore(); addMonths(deltaYears * CalendarModel.MONTHS_IN_YEAR); } }); return yearListBox; }
private ListBox createYearSelect() { final ListBox yearListBox = new ListBox(); yearListBox.addChangeHandler(new ChangeHandler() { @Override public void onChange(ChangeEvent event) { int deltaYears = yearListBox.getSelectedIndex() - getNoOfYearsToDisplayBefore(); addMonths(deltaYears * CalendarModel.MONTHS_IN_YEAR); } }); return yearListBox; }
/** * Getter for property 'seconds'. * * @return Value for property 'seconds'. */ public ListBox getSeconds() { if (seconds == null) { seconds = new ListBox(); seconds.setStyleName("time-list"); } return seconds; }
ListBox listBox = new ListBox(); //Add item to listBox. SelectElement selectElement = SelectElement.as(listBox.getElement()); NodeList<OptionElement> options = selectElement.getOptions(); for (int i = 0; i < options.getLength(); i++) { options.getItem(i).getStyle().setColor("#FF0000"); }
protected ListBox createAvailableRulesBox(String[] list) { final ListBox availableRulesBox = new ListBox(); availableRulesBox.addItem(TestScenarioConstants.INSTANCE.pleaseChoose1()); for (int i = 0; i < list.length; i++) { availableRulesBox.addItem(list[i]); } return availableRulesBox; }
protected void init() { listBox = new ListBox(false); this.initWidget(listBox); setupDefaultStyle(); listBox.addChangeHandler(new ChangeHandler(){ public void onChange(ChangeEvent event) { fireChangeEvent(true); } }); }
ListBox list = new ListBox(); list.addItem("John Smith", 1); list.addItem("Jane Doe", 2); int index = list.getSelectedIndex(); /// assuming selected index is zero for example list.getValue(index); // ----> returns "John Smith" list.getItemText(index); // ------> returns "1"
private void createChoiceList() { choiceList = new ListBox(); choiceList.setStyleName("list"); choiceList.addKeyDownHandler(this); choiceList.addDoubleClickHandler(this); choiceList.addChangeHandler(this); choiceList.setStylePrimaryName("aceeditor-suggestpopup-list"); setWidget(choiceList); }
public void onClick(ClickEvent event) { ListBox rules = new ListBox(true); for (String ruleName : executionTrace.getRulesFired()) { rules.addItem(ruleName); } add(new SmallLabel(" :" + TestScenarioConstants.INSTANCE.RulesFired())); add(rules); show.setVisible(false); } });
public NewGlobalPopup() { super(TestScenarioAltedImages.INSTANCE.RuleAsset(), TestScenarioConstants.INSTANCE.NewGlobal()); factTypes = new ListBox(); addButton = new AddButton(); warning = getMissingGlobalsWarning(); fillFactTypes(); addRow(warning); addAttribute(TestScenarioConstants.INSTANCE.GlobalColon(), getHorizontalPanel()); }