本文整理汇总了Java中com.google.gwt.user.cellview.client.CellList.setKeyboardSelectionPolicy方法的典型用法代码示例。如果您正苦于以下问题:Java CellList.setKeyboardSelectionPolicy方法的具体用法?Java CellList.setKeyboardSelectionPolicy怎么用?Java CellList.setKeyboardSelectionPolicy使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.google.gwt.user.cellview.client.CellList
的用法示例。
在下文中一共展示了CellList.setKeyboardSelectionPolicy方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: makeTemplateSelector
import com.google.gwt.user.cellview.client.CellList; //导入方法依赖的package包/类
/**
* Creates the scrollable list of cells each of which serves as a link to a template.
*
* @param list an ArrayList of TemplateInfo
* @return A CellList widget
*/
public CellList<TemplateInfo> makeTemplateSelector(ArrayList<TemplateInfo> list) {
TemplateCell templateCell = new TemplateCell(list.get(0), templateHostUrl);
CellList<TemplateInfo> templateCellList = new CellList<TemplateInfo>(templateCell,TemplateInfo.KEY_PROVIDER);
templateCellList.setPageSize(list.size() + 10);
templateCellList.setKeyboardSelectionPolicy(KeyboardSelectionPolicy.ENABLED);
templateCellList.setWidth("250px");
templateCellList.setHeight("400px");
templateCellList.setVisible(true);
// Add a selection model to handle user selection.
final SingleSelectionModel<TemplateInfo> selectionModel =
new SingleSelectionModel<TemplateInfo>(TemplateInfo.KEY_PROVIDER);
templateCellList.setSelectionModel(selectionModel);
selectionModel.setSelected(list.get(0), true);
final TemplateUploadWizard wizard = this;
selectionModel.addSelectionChangeHandler(new SelectionChangeEvent.Handler() {
public void onSelectionChange(SelectionChangeEvent event) {
TemplateInfo selected = selectionModel.getSelectedObject();
if (selected != null) {
selectedTemplateNAME = selected.name;
TemplateWidget.setTemplate(selected, wizard.getTemplateUrlHost());
}
}
});
// Set the total row count. This isn't strictly necessary, but it affects
// paging calculations, so its good habit to keep the row count up to date.
templateCellList.setRowCount(list.size(), true);
// Push the data into the widget.
templateCellList.setRowData(0, list);
return templateCellList;
}
示例2: createTaskTemplateList
import com.google.gwt.user.cellview.client.CellList; //导入方法依赖的package包/类
private CellList<TaskProxy> createTaskTemplateList() {
CellList<TaskProxy> list =
new CellList<TaskProxy>(new TaskTemplateCell());
list.setKeyboardSelectionPolicy(KeyboardSelectionPolicy.DISABLED);
// Create the templates.
List<TaskProxy> templates = new ArrayList<TaskProxy>();
templates.add(new TaskProxyImpl("Call mom", null));
templates.add(new TaskProxyImpl("Register to vote", "Where is my polling location again?"));
templates.add(new TaskProxyImpl("Replace air filter", "Size: 24x13x1"));
templates.add(new TaskProxyImpl("Take out the trash", null));
list.setRowData(templates);
return list;
}