本文整理汇总了Java中com.extjs.gxt.ui.client.store.StoreSorter类的典型用法代码示例。如果您正苦于以下问题:Java StoreSorter类的具体用法?Java StoreSorter怎么用?Java StoreSorter使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
StoreSorter类属于com.extjs.gxt.ui.client.store包,在下文中一共展示了StoreSorter类的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: addNewItem
import com.extjs.gxt.ui.client.store.StoreSorter; //导入依赖的package包/类
protected void addNewItem(EditorGrid<CIModelCollection> editGrid, CIModel newModel) {
CIModelCollection model = null;
if (newInstanceCallback != null) {
model = newInstanceCallback.createInstance(gridConfig);
} else {
model = gridConfig.createNewInstance(newModel);
}
editGrid.stopEditing();
// Disable Store Filter when we add.
StoreSorter sorter = store.getStoreSorter();
store.setStoreSorter(null);
store.insert(model, 0);
store.setStoreSorter(sorter);
editGrid.startEditing(0, 1);
}
示例2: addDefaultValue
import com.extjs.gxt.ui.client.store.StoreSorter; //导入依赖的package包/类
private void addDefaultValue() {
BaseModel m = new BaseModel();
m.addChangeListener(new ChangeListener() {
public void modelChanged(ChangeEvent event) {
System.out.println("Model Changed=" + event);
if (event instanceof PropertyChangeEvent) {
updateModel((BaseModel)event.source);
}
}
});
grid.stopEditing();
// Disable Store Filter when we add.
StoreSorter sorter = store.getStoreSorter();
store.setStoreSorter(null);
store.insert(m, 0);
store.setStoreSorter(sorter);
grid.startEditing(0, 1);
/*
m.set("sourceAttribute", as.getAttribute());
m.set("sourceTemplate", ds.getTemplate());
m.set("naturalKey", false);
m.set("defaultValue", as.getValue());
*/
}
示例3: getStoreSorter
import com.extjs.gxt.ui.client.store.StoreSorter; //导入依赖的package包/类
private static StoreSorter<FileDTO> getStoreSorter() {
if(storeSorter == null) {
storeSorter = new StoreSorter<FileDTO>() {
@Override
public int compare(Store<FileDTO> store, FileDTO m1, FileDTO m2, String property) {
final FileVersionDTO last1 = m1.getLastVersion();
final FileVersionDTO last2 = m2.getLastVersion();
if (FileDTO.DATE.equals(property)) {
return last1.getAddedDate().compareTo(last2.getAddedDate());
} else if (FileDTO.AUTHOR.equals(property)) {
final String authorM1 = last1.getAuthorFirstName() != null ? last1.getAuthorFirstName() + " " + last1.getAuthorName() : last1.getAuthorName();
final String authorM2 = last2.getAuthorFirstName() != null ? last2.getAuthorFirstName() + " " + last2.getAuthorName() : last2.getAuthorName();
return authorM1.compareTo(authorM2);
} else if (FileDTO.VERSION.equals(property)) {
return Integer.valueOf(last1.getVersionNumber()).compareTo(last2.getVersionNumber());
} else if (FileDTO.NAME.equals(property)) {
final String title1 = last1.getName() + '.' + last1.getExtension();
final String title2 = last2.getName() + '.' + last2.getExtension();
return title1.compareTo(title2);
}
else {
return super.compare(store, m1, m2, property);
}
}
};
}
return storeSorter;
}