本文整理汇总了Java中com.google.gwt.user.client.ui.ListBox.isMultipleSelect方法的典型用法代码示例。如果您正苦于以下问题:Java ListBox.isMultipleSelect方法的具体用法?Java ListBox.isMultipleSelect怎么用?Java ListBox.isMultipleSelect使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.google.gwt.user.client.ui.ListBox
的用法示例。
在下文中一共展示了ListBox.isMultipleSelect方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: reload
import com.google.gwt.user.client.ui.ListBox; //导入方法依赖的package包/类
public void reload(String history) {
if (history == null) return;
if (history.indexOf('&') >= 0)
history = history.substring(0, history.indexOf('&'));
if (history.isEmpty()) return;
String[] params = history.split(":");
String id = params[0];
PointInTimeDataReportsInterface.Report rpt = null;
for (int i = 0; i < iReports.size(); i++) {
PointInTimeDataReportsInterface.Report q = iReports.get(i);
if (id.equals(q.getId())) {
rpt = q;
iReportSelector.getWidget().setSelectedIndex(1 + i);
queryChanged();
break;
}
}
if (rpt == null) return;
int idx = 1;
for (int i = 0; i < iParameters.size(); i++) {
PointInTimeDataReportsInterface.Parameter parameter = iParameters.get(i);
if (rpt.parametersContain(parameter.getType())) {
String param = params[idx++];
if (param == null || param.isEmpty()) continue;
if (parameter.isTextField()) {
TextBox text = ((UniTimeWidget<TextBox>)iForm.getWidget(3 + i, 1)).getWidget();
text.setText(param);
} else {
ListBox list = ((UniTimeWidget<ListBox>)iForm.getWidget(3 + i, 1)).getWidget();
if (list.isMultipleSelect()) {
for (int j = 0; j < list.getItemCount(); j++) {
String value = list.getValue(j);
boolean contains = false;
for (String o: param.split(",")) if (o.equals(value)) { contains = true; break; }
list.setItemSelected(j, contains);
}
} else {
for (int j = 1; j < list.getItemCount(); j++) {
if (list.getValue(j).equals(param)) {
list.setSelectedIndex(j); break;
}
}
}
}
}
}
iLastSort = Integer.parseInt(params[idx++]);
execute();
}
示例2: execute
import com.google.gwt.user.client.ui.ListBox; //导入方法依赖的package包/类
private void execute() {
HQLExecuteRpcRequest request = new HQLExecuteRpcRequest();
iHeader.setEnabled("print", false);
iHeader.setEnabled("export", false);
Long id = Long.valueOf(iQuerySelector.getWidget().getValue(iQuerySelector.getWidget().getSelectedIndex()));
for (SavedHQLInterface.Query q: iQueries) {
if (id.equals(q.getId())) {
request.setQuery(q); break;
}
}
if (request.getQuery() == null) {
iHeader.setErrorMessage(MESSAGES.errorNoReportSelected());
return;
}
iLastHistory = request.getQuery().getId().toString();
for (int i = 0; i < iOptions.size(); i++) {
SavedHQLInterface.Option option = iOptions.get(i);
if (request.getQuery().getQuery().contains("%" + option.getType() + "%")) {
SavedHQLInterface.IdValue o = new SavedHQLInterface.IdValue();
o.setValue(option.getType());
ListBox list = ((UniTimeWidget<ListBox>)iForm.getWidget(3 + i, 1)).getWidget();
String value = "";
boolean allSelected = true;
if (list.isMultipleSelect()) {
for (int j = 0; j < list.getItemCount(); j++)
if (list.isItemSelected(j)) {
if (!value.isEmpty()) value += ",";
value += list.getValue(j);
} else {
allSelected = false;
}
} else if (list.getSelectedIndex() > 0) {
value = list.getValue(list.getSelectedIndex());
}
if (value.isEmpty()) {
iHeader.setErrorMessage(MESSAGES.errorItemNotSelected(option.getName()));
return;
}
request.addOption(option.getType(), value);
iLastHistory += ":" + (list.isMultipleSelect() && allSelected ? "" : value);
}
}
iTable.clearTable(); iFirstField = null;
iTableHeader.clearMessage();
iHeader.clearMessage();
LoadingWidget.getInstance().show(MESSAGES.waitExecuting(request.getQuery().getName()));
History.newItem(iLastHistory + ":" + iFirstLine + ":" + iLastSort, false);
request.setFromRow(iFirstLine);
request.setMaxRows(101);
RPC.execute(request, new AsyncCallback<Table>() {
@Override
public void onFailure(Throwable caught) {
iTableHeader.setErrorMessage(caught.getMessage());
LoadingWidget.getInstance().hide();
}
@Override
public void onSuccess(Table result) {
populate(result);
LoadingWidget.getInstance().hide();
}
});
}