本文整理了Java中com.google.gwt.user.client.ui.ListBox.<init>()
方法的一些代码示例,展示了ListBox.<init>()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。ListBox.<init>()
方法的具体详情如下:
包路径:com.google.gwt.user.client.ui.ListBox
类名称:ListBox
方法名:<init>
[英]Creates an empty list box in single selection mode.
[中]在单一选择模式下创建空列表框。
代码示例来源:origin: kaaproject/kaa
/**
* 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);
}
});
}
代码示例来源:origin: com.google.gwt/gwt-servlet
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;
}
代码示例来源:origin: com.google.gwt/gwt-servlet
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);
}
});
}
代码示例来源: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
/**
* 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;
}
代码示例来源:origin: org.kie.guvnor/guvnor-test-scenario-editor-client
@Override
public ListBox getWidget() {
return new ListBox();
}
}
代码示例来源:origin: sk.seges.acris/acris-widgets-beantable
/**
* 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);
}
代码示例来源:origin: sk.seges.acris/acris-widgets-beantable
/**
* Construct a new {@link ListCellEditor}.
*/
public ListCellEditor() {
this(new ListBox(),
GWT.<InlineCellEditorImages> create(InlineCellEditorImages.class));
}
代码示例来源:origin: stackoverflow.com
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);
}
}
代码示例来源: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: net.wetheinter/gwt-user
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;
}
代码示例来源:origin: com.vaadin.external.gwt/gwt-user
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;
}
代码示例来源:origin: net.sf.advanced-gwt/advanced-gwt
/**
* Getter for property 'seconds'.
*
* @return Value for property 'seconds'.
*/
public ListBox getSeconds() {
if (seconds == null) {
seconds = new ListBox();
seconds.setStyleName("time-list");
}
return seconds;
}
代码示例来源:origin: stackoverflow.com
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");
}
代码示例来源:origin: org.kie.guvnor/guvnor-test-scenario-editor-client
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;
}
代码示例来源:origin: org.kuali.student.core/ks-common-ui
protected void init() {
listBox = new ListBox(false);
this.initWidget(listBox);
setupDefaultStyle();
listBox.addChangeHandler(new ChangeHandler(){
public void onChange(ChangeEvent event) {
fireChangeEvent(true);
}
});
}
代码示例来源:origin: stackoverflow.com
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"
代码示例来源:origin: org.vaadin.addons/aceeditor
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);
}
代码示例来源:origin: org.kie.guvnor/guvnor-test-scenario-editor-client
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);
}
});
代码示例来源:origin: org.kie.guvnor/guvnor-test-scenario-editor-client
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());
}
内容来源于网络,如有侵权,请联系作者删除!