![JAR search and dependency download from the Maven repository](/logo.png)
com.extjs.gxt.ui.client.event.SelectionChangedEvent Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of gxt Show documentation
Show all versions of gxt Show documentation
Rich Internet Application Framework for GWT
/*
* Sencha GXT 2.3.0 - Sencha for GWT
* Copyright(c) 2007-2013, Sencha, Inc.
* [email protected]
*
* http://www.sencha.com/products/gxt/license/
*/
package com.extjs.gxt.ui.client.event;
import java.util.List;
import com.extjs.gxt.ui.client.data.ModelData;
import com.extjs.gxt.ui.client.util.Util;
/**
* BaseEvent
used to signal a SelectionProviders
* selection has changed.
*
*
TableBinder binder = new TableBinder<Stock>(tbl, store);
binder.addSelectionChangedListener(new SelectionChangedListener<Stock>() {
public void selectionChanged(SelectionChangedEvent<Stock> se) {
List<Stock> sel = se.getSelection();
}
});
*
*
* @param the model type being selected
*/
public class SelectionChangedEvent extends BaseEvent {
private SelectionProvider provider;
private List selection;
/**
* Creates a new selection event.
*
* @param provider the selection provider
* @param selection the selection
*/
public SelectionChangedEvent(SelectionProvider provider, List selection) {
super(provider);
this.provider = provider;
this.selection = selection;
}
/**
* Creates a new selection event.
*
* @param provider the selection provider
* @param selection the selection
*/
@SuppressWarnings("unchecked")
public SelectionChangedEvent(SelectionProvider provider, M selection) {
super(provider);
this.provider = provider;
this.selection = Util.createList(selection);
}
/**
* Returns the first selected item.
*
* @return the selected item
*/
public M getSelectedItem() {
if (selection.size() > 0) {
return selection.get(0);
}
return null;
}
/**
* Returns the selection.
*
* @return the selection
*/
public List getSelection() {
return selection;
}
/**
* Returns the selection provider.
*
* @return the provider
*/
public SelectionProvider getSelectionProvider() {
return provider;
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy