本文整理汇总了Java中com.google.gwt.view.client.SingleSelectionModel.addSelectionChangeHandler方法的典型用法代码示例。如果您正苦于以下问题:Java SingleSelectionModel.addSelectionChangeHandler方法的具体用法?Java SingleSelectionModel.addSelectionChangeHandler怎么用?Java SingleSelectionModel.addSelectionChangeHandler使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.google.gwt.view.client.SingleSelectionModel
的用法示例。
在下文中一共展示了SingleSelectionModel.addSelectionChangeHandler方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: ListView
import com.google.gwt.view.client.SingleSelectionModel; //导入方法依赖的package包/类
public ListView(final ListPresenter<LISTITEM> presenter, Cell<LISTITEM> itemDisplayCell) {
this.presenter = presenter;
this.cellList = new CellList<LISTITEM>(itemDisplayCell);
cellList.setKeyboardSelectionPolicy(KeyboardSelectionPolicy.ENABLED);
// Add a selection model to handle user selection.
final SingleSelectionModel<LISTITEM> selectionModel = new SingleSelectionModel<LISTITEM>();
cellList.setSelectionModel(selectionModel);
selectionModel.addSelectionChangeHandler(new SelectionChangeEvent.Handler() {
public void onSelectionChange(SelectionChangeEvent event) {
LISTITEM selected = selectionModel.getSelectedObject();
if (selected != null) {
presenter.onSelectionChanged(event, selectionModel);
}
}
});
this.pagerTop = new SimplePager();
this.pagerTop.setDisplay(this.cellList);
this.pagerBottom = new SimplePager();
this.pagerBottom.setDisplay(this.cellList);
initWidget((Widget)uiBinder.createAndBindUi(this));
}
示例2: initialize
import com.google.gwt.view.client.SingleSelectionModel; //导入方法依赖的package包/类
private void initialize() {
Resources resources = GWT.create(Resources.class);
EventCell eventCell = new EventCell(resources.tux());
cellList = new CellList<EventProxy>(eventCell);
cellList.setPageSize(10);
cellList.setKeyboardPagingPolicy(KeyboardPagingPolicy.INCREASE_RANGE);
cellList.setKeyboardSelectionPolicy(KeyboardSelectionPolicy.BOUND_TO_SELECTION);
final SingleSelectionModel<EventProxy> selectionModel = new SingleSelectionModel<EventProxy>();
cellList.setSelectionModel(selectionModel);
selectionModel.addSelectionChangeHandler(new SelectionChangeEvent.Handler() {
@Override
public void onSelectionChange(SelectionChangeEvent event) {
presenter.goEventDetailView(selectionModel.getSelectedObject().getId());
}
});
eventPagerPanel.setDisplay(cellList);
}
示例3: initialiseAvailablePatterns
import com.google.gwt.view.client.SingleSelectionModel; //导入方法依赖的package包/类
private void initialiseAvailablePatterns() {
availablePatternsContainer.add(availablePatternsWidget);
availablePatternsWidget.setKeyboardSelectionPolicy(KeyboardSelectionPolicy.ENABLED);
availablePatternsWidget.setMinimumWidth(170);
final Label lstEmpty = new Label(GuidedDecisionTableConstants.INSTANCE.DecisionTableWizardNoAvailablePatterns());
lstEmpty.setStyleName(WizardCellListResources.INSTANCE.cellListStyle().cellListEmptyItem());
availablePatternsWidget.setEmptyListWidget(lstEmpty);
final SingleSelectionModel<Pattern52> selectionModel = new SingleSelectionModel<Pattern52>();
availablePatternsWidget.setSelectionModel(selectionModel);
selectionModel.addSelectionChangeHandler(new SelectionChangeEvent.Handler() {
@Override
public void onSelectionChange(final SelectionChangeEvent event) {
availablePatternsSelection = selectionModel.getSelectedObject();
presenter.selectPattern(availablePatternsSelection);
}
});
}
示例4: initialiseAvailablePatterns
import com.google.gwt.view.client.SingleSelectionModel; //导入方法依赖的package包/类
private void initialiseAvailablePatterns() {
availablePatternsContainer.add( availablePatternsWidget );
availablePatternsWidget.setKeyboardSelectionPolicy( KeyboardSelectionPolicy.ENABLED );
availablePatternsWidget.setMinimumWidth( 170 );
final Label lstEmpty = GWT.create(Label.class);
lstEmpty.setText( GuidedDecisionTableConstants.INSTANCE.DecisionTableWizardNoAvailablePatterns() );
lstEmpty.setStyleName( WizardCellListResources.INSTANCE.cellListStyle().cellListEmptyItem() );
availablePatternsWidget.setEmptyListWidget( lstEmpty );
final SingleSelectionModel<Pattern52> selectionModel = new SingleSelectionModel<Pattern52>();
availablePatternsWidget.setSelectionModel( selectionModel );
selectionModel.addSelectionChangeHandler( new SelectionChangeEvent.Handler() {
@Override
public void onSelectionChange( final SelectionChangeEvent event ) {
availablePatternsSelection = selectionModel.getSelectedObject();
presenter.selectPattern( availablePatternsSelection );
}
} );
}
示例5: makeTemplateSelector
import com.google.gwt.view.client.SingleSelectionModel; //导入方法依赖的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;
}
示例6: ExtensionManagerViewImpl
import com.google.gwt.view.client.SingleSelectionModel; //导入方法依赖的package包/类
@Inject
public ExtensionManagerViewImpl(
ToolbarPresenter toolbarPresenter, ActionManager actionManager, Resources resources) {
dataGrid = new DataGrid<>(100, resources);
rootElement = ourUiBinder.createAndBindUi(this);
DefaultActionGroup actionGroup =
new DefaultActionGroup("extensionManager", false, actionManager);
actionManager.registerAction("extensionManagerGroup", actionGroup);
toolbarPresenter.bindMainGroup(actionGroup);
UIObject.ensureDebugId(descriptionArea, "window-preferences-extensions-descriptionArea");
Column<ExtensionDescription, String> titleColumn =
new Column<ExtensionDescription, String>(new TextCell()) {
@Override
public String getValue(ExtensionDescription object) {
return object.getTitle();
}
};
titleColumn.setCellStyleNames(style.titleColumn());
dataGrid.addColumn(titleColumn);
SingleSelectionModel<ExtensionDescription> selectionModel =
new SingleSelectionModel<ExtensionDescription>();
dataGrid.setSelectionModel(selectionModel);
selectionModel.addSelectionChangeHandler(
new SelectionChangeEvent.Handler() {
@Override
public void onSelectionChange(SelectionChangeEvent event) {}
});
}
示例7: setTreeOfDestinations
import com.google.gwt.view.client.SingleSelectionModel; //导入方法依赖的package包/类
/** {@inheritDoc} */
@Override
public void setTreeOfDestinations(RefactorInfo refactorInfo, List<JavaProject> projects) {
final SingleSelectionModel<Object> selectionModel = new SingleSelectionModel<>();
selectionModel.addSelectionChangeHandler(
new SelectionChangeEvent.Handler() {
@Override
public void onSelectionChange(SelectionChangeEvent event) {
Object object = selectionModel.getSelectedObject();
if (object instanceof JavaProject) {
JavaProject project = (JavaProject) object;
delegate.setMoveDestinationPath(project.getPath(), project.getPath());
}
if (object instanceof PackageFragmentRoot) {
PackageFragmentRoot fragmentRoot = (PackageFragmentRoot) object;
delegate.setMoveDestinationPath(
fragmentRoot.getPath(), fragmentRoot.getProjectPath());
}
if (object instanceof PackageFragment) {
PackageFragment fragment = (PackageFragment) object;
delegate.setMoveDestinationPath(fragment.getPath(), fragment.getProjectPath());
}
}
});
CellTree tree =
new CellTree(
new ProjectsAndPackagesModel(projects, refactorInfo, selectionModel, resources),
null,
cellTreeResources);
tree.setAnimationEnabled(true);
treePanel.clear();
treePanel.add(tree);
}
示例8: SampleListView
import com.google.gwt.view.client.SingleSelectionModel; //导入方法依赖的package包/类
public SampleListView(List<ShowcaseSampleDefinition> data, final SampleOverviewPage overviewPage) {
initWidget(UIBINDER.createAndBindUi(this));
ProvidesKey<ShowcaseSampleDefinition> sampleKeyProvider = new ProvidesKey<ShowcaseSampleDefinition>() {
public Object getKey(ShowcaseSampleDefinition item) {
return item.getTitle();
}
};
// We fill the grid through a list of SamplePanelFactory objects:
dataProvider = new ListDataProvider<ShowcaseSampleDefinition>(sampleKeyProvider);
dataProvider.addDataDisplay(grid);
// Selection: show sample on click
final SingleSelectionModel<ShowcaseSampleDefinition> selectionModel;
selectionModel = new SingleSelectionModel<ShowcaseSampleDefinition>(sampleKeyProvider);
grid.setSelectionModel(selectionModel);
selectionModel.addSelectionChangeHandler(new SelectionChangeEvent.Handler() {
public void onSelectionChange(SelectionChangeEvent event) {
ExampleBase.showSample(selectionModel.getSelectedObject());
}
});
// Add a sort handler:
sortHandler = new ListHandler<ShowcaseSampleDefinition>(dataProvider.getList());
grid.addColumnSortHandler(sortHandler);
// Initialize the grid columns:
initColumns();
// Apply the entire data-set:
setData(data);
}
示例9: getSelectionModel
import com.google.gwt.view.client.SingleSelectionModel; //导入方法依赖的package包/类
private SingleSelectionModel<Issue> getSelectionModel() {
final SingleSelectionModel<Issue> selectionModel = new SingleSelectionModel<Issue>();
selectionModel.addSelectionChangeHandler(
new SelectionChangeEvent.Handler() {
public void onSelectionChange( SelectionChangeEvent event ) {
presenter.onSelect( selectionModel.getSelectedObject() );
}
} );
return selectionModel;
}
示例10: MainLayout
import com.google.gwt.view.client.SingleSelectionModel; //导入方法依赖的package包/类
public MainLayout() {
initWidget(uiBinder.createAndBindUi(this));
dataProvider = new ListDataProvider<ModuleInfo>();
dataProvider.addDataDisplay(cellList);
final SingleSelectionModel<ModuleInfo> selectionModel = new SingleSelectionModel<ModuleInfo>();
cellList.setSelectionModel(selectionModel);
selectionModel.addSelectionChangeHandler(new SelectionChangeEvent.Handler() {
@Override
public void onSelectionChange(SelectionChangeEvent event) {
final ModuleInfo moduleInfo = selectionModel.getSelectedObject();
LOG.info("MainLayout.cellList.selectionModel#onSelectionChange: moduleInfo=" + toStringJSO(moduleInfo));
if (moduleInfo != null) {
centerPanel.setCaptionText(moduleInfo.getCaption());
HTML panel = null;
String id = "content" + moduleInfo.getName();
for (int i = 0, l = slidePanel.getWidgetCount(); i < l; ++i) {
Widget w = slidePanel.getWidget(i);
if (id.equals(w.getElement().getId())) {
panel = (HTML) w;
break;
}
}
if (panel == null) {
LOG.warning("MainLayout.cellList.selectionModel#onSelectionChange: cannot find element with ID " + id);
return;
}
final Widget showWidget = panel;
moduleContentFeatureConsumer.call(moduleInfo.getName(), panel.getElement(), new AsyncCallback<Void>() {
@Override
public void onSuccess(Void result) {
LOG.info("MainLayout.moduleContentFeatureConsumer#onSuccess: moduleBean.name=" + moduleInfo.getName());
slidePanel.showWidget(showWidget);
}
@Override
public void onFailure(Throwable caught) {
LOG.severe("MainLayout.moduleContentFeatureConsumer#onFailure: " + caught.getMessage());
slidePanel.showWidget(showWidget);
}
});
}
}
});
LOG.info("MainLayout: instantiated");
}
示例11: setDataObject
import com.google.gwt.view.client.SingleSelectionModel; //导入方法依赖的package包/类
private void setDataObject(DataObjectTO dataObject) {
this.dataObject = dataObject;
objectName.setText(dataObject.getName() + "::" + dataObject.getPackageName());
//We create a new selection model due to a bug found in GWT when we change e.g. from one data object with 9 rows
// to one with 3 rows and the table was sorted.
//Several tests has been done and the final workaround (not too bad) we found is to
// 1) sort the table again
// 2) create a new selection model
// 3) populate the table with new items
// 3) select the first row
SingleSelectionModel selectionModel2 = new SingleSelectionModel<ObjectPropertyTO>();
dataObjectPropertiesTable.setSelectionModel(selectionModel2);
selectionModel2.addSelectionChangeHandler(new SelectionChangeEvent.Handler() {
@Override
public void onSelectionChange(SelectionChangeEvent event) {
ObjectPropertyTO selectedPropertyTO = ((SingleSelectionModel<ObjectPropertyTO>)dataObjectPropertiesTable.getSelectionModel()).getSelectedObject();
notifyFieldSelected(selectedPropertyTO);
}
});
ArrayList<ObjectPropertyTO> sortBuffer = new ArrayList<ObjectPropertyTO>();
sortBuffer.addAll(dataObject.getProperties());
Collections.sort(sortBuffer, new ObjectPropertyComparator("name"));
dataObjectProperties = dataObject.getProperties();
dataObjectPropertiesProvider.getList().clear();
dataObjectPropertiesProvider.getList().addAll(sortBuffer);
dataObjectPropertiesProvider.flush();
dataObjectPropertiesProvider.refresh();
dataObjectPropertiesTable.getColumnSortList().push(new ColumnSortList.ColumnSortInfo(dataObjectPropertiesTable.getColumn(1), true));
if (dataObjectProperties.size() > 0) {
dataObjectPropertiesTable.setKeyboardSelectedRow(0);
selectionModel2.setSelected(sortBuffer.get(0), true);
}
//set the first row selected again. Sounds crazy, but's part of the workaround, don't remove this line.
if (dataObjectProperties.size() > 0) {
dataObjectPropertiesTable.setKeyboardSelectedRow(0);
}
if (dataObjectProperties.size() == 0) {
//there are no properties.
//fire an empty property seleccion event in order to notify the
notifyFieldSelected(null);
}
}
示例12: setDataModel
import com.google.gwt.view.client.SingleSelectionModel; //导入方法依赖的package包/类
public void setDataModel(DataModelTO dataModel) {
this.dataModel = dataModel;
this.dataObjects = dataModel.getDataObjects();
modelName.setText(dataModel.getName());
// We create a new selection model due to a bug found in GWT when we change e.g. from one data object with 9 rows
// to one with 3 rows and the table was sorted.
// Several tests has been done and the final workaround (not too bad) we found is to
// 1) sort the table again
// 2) create a new selection model
// 3) populate the table with new items
// 3) select the first row
SingleSelectionModel selectionModel2 = new SingleSelectionModel<DataObjectTO>();
dataObjectsTable.setSelectionModel(selectionModel2);
selectionModel2.addSelectionChangeHandler(new SelectionChangeEvent.Handler() {
@Override
public void onSelectionChange(SelectionChangeEvent event) {
if (!skipNextOnChange) {
DataObjectTO selectedObjectTO = ((SingleSelectionModel<DataObjectTO>)dataObjectsTable.getSelectionModel()).getSelectedObject();
notifyObjectSelected(selectedObjectTO);
}
skipNextOnChange = false;
}
});
ArrayList<DataObjectTO> sortBuffer = new ArrayList<DataObjectTO>();
sortBuffer.addAll(dataObjects);
Collections.sort(sortBuffer, new DataObjectComparator());
dataObjectsProvider.getList().clear();
dataObjectsProvider.getList().addAll(sortBuffer);
dataObjectsProvider.flush();
dataObjectsProvider.refresh();
dataObjectsTable.getColumnSortList().push(new ColumnSortList.ColumnSortInfo(dataObjectsTable.getColumn(1), true));
if (dataObjects.size() > 0) {
dataObjectsTable.setKeyboardSelectedRow(0);
selectionModel2.setSelected(sortBuffer.get(0), true);
}
// Set the first row selected again. Sounds crazy, but it's part of the workaround, don't remove this line.
if (dataObjects.size() > 0) {
dataObjectsTable.setKeyboardSelectedRow(0);
}
}