當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。