当前位置: 首页>>代码示例>>Java>>正文


Java ListBox.isMultipleSelect方法代码示例

本文整理汇总了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();
}
 
开发者ID:Jenner4S,项目名称:unitimes,代码行数:50,代码来源:PointInTimeDataReportsPage.java

示例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();
		}
	});		
}
 
开发者ID:Jenner4S,项目名称:unitimes,代码行数:66,代码来源:SavedHQLPage.java


注:本文中的com.google.gwt.user.client.ui.ListBox.isMultipleSelect方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。