本文整理汇总了Java中com.extjs.gxt.ui.client.store.Store类的典型用法代码示例。如果您正苦于以下问题:Java Store类的具体用法?Java Store怎么用?Java Store使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Store类属于com.extjs.gxt.ui.client.store包,在下文中一共展示了Store类的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getStoreSorter
import com.extjs.gxt.ui.client.store.Store; //导入依赖的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;
}
示例2: handleEvent
import com.extjs.gxt.ui.client.store.Store; //导入依赖的package包/类
@Override
public void handleEvent(StoreEvent<ContactDTO> e) {
EventType type = e.getType();
if (type == Store.BeforeAdd) {
storeBeforeAdd(e);
} else if (type == Store.Add) {
storeAdd(e);
} else if (type == Store.BeforeClear) {
storeBeforeClear();
} else if (type == Store.Clear) {
storeClear();
} if (type == Store.Remove) {
storeRemove(e);
}
}
示例3: save
import com.extjs.gxt.ui.client.store.Store; //导入依赖的package包/类
public static void save(DispatchAsync dispatcher, final Store<? extends ModelData> store, Component component) {
dispatcher.execute(createUpdateCommand(store), new CommandResultHandler<ListResult<Result>>() {
@Override
protected void onCommandSuccess(ListResult<Result> result) {
store.commitChanges();
}
}, new LoadingMask(component, I18N.CONSTANTS.saving()));
}
示例4: createUpdateCommand
import com.extjs.gxt.ui.client.store.Store; //导入依赖的package包/类
public static BatchCommand createUpdateCommand(Store<? extends ModelData> store) {
BatchCommand batch = new BatchCommand();
for (Record record : store.getModifiedRecords()) {
if(record.getModel() instanceof EntityDTO) {
EntityDTO entity = (EntityDTO) record.getModel();
batch.add(new UpdateEntity(entity, getChangedProperties(record)));
}
}
return batch;
}
示例5: CommitChangeLogAction
import com.extjs.gxt.ui.client.store.Store; //导入依赖的package包/类
public CommitChangeLogAction(Store<ChangeItem> store) {
this.store = store;
}
示例6: doSelect
import com.extjs.gxt.ui.client.store.Store; //导入依赖的package包/类
@Override
protected abstract boolean doSelect(Store<T> store, T parent, T record, String property,
String filter);
示例7: prepareAfterGetContacts
import com.extjs.gxt.ui.client.store.Store; //导入依赖的package包/类
private Runnable prepareAfterGetContacts(ContentPanel mainPanel, final ListStore<ContactDTO> store) {
Runnable afterGetContacts;
final ToolBar actionsToolBar = new ToolBar();
actionsToolBar.setAlignment(HorizontalAlignment.LEFT);
actionsToolBar.add(Forms.button(I18N.CONSTANTS.addItem(), IconImageBundle.ICONS.add(), new SelectionListener<ButtonEvent>() {
@Override
public void componentSelected(ButtonEvent ce) {
showContactSelector(store);
}
}));
final Label offlineLabel = new Label(I18N.CONSTANTS.sigmahContactsOfflineUnavailable());
actionsToolBar.add(offlineLabel);
mainPanel.setTopComponent(actionsToolBar);
// if offline mode, no contact can be used
actionsToolBar.setEnabled(!Profiler.INSTANCE.isOfflineMode());
offlineLabel.setVisible(Profiler.INSTANCE.isOfflineMode());
if (eventBus != null) {
eventBus.addHandler(OfflineEvent.getType(), new OfflineHandler() {
@Override
public void handleEvent(OfflineEvent event) {
final boolean isOffline = ApplicationState.OFFLINE == event.getState();
actionsToolBar.setEnabled(!isOffline && !isReadOnly(store));
offlineLabel.setVisible(isOffline);
}
});
}
final Listener<StoreEvent<ContactDTO>> listener = new ContactStoreEventListener(store, actionsToolBar);
afterGetContacts = new Runnable() {
@Override
public void run() {
actionsToolBar.setEnabled(!Profiler.INSTANCE.isOfflineMode() && !isReadOnly(store));
store.addListener(Store.BeforeAdd, listener);
store.addListener(Store.Add, listener);
store.addListener(Store.BeforeClear, listener);
store.addListener(Store.Clear, listener);
store.addListener(Store.Remove, listener);
handlerManager.fireEvent(new RequiredValueEvent(store.getCount() > 0, true));
}
};
return afterGetContacts;
}
示例8: FilterSelectionListener
import com.extjs.gxt.ui.client.store.Store; //导入依赖的package包/类
public FilterSelectionListener(final Store<E> store) {
this.store = store;
}
示例9: getStore
import com.extjs.gxt.ui.client.store.Store; //导入依赖的package包/类
public Store<PivotTableRow> getStore() {
return store;
}
示例10: addFilters
import com.extjs.gxt.ui.client.store.Store; //导入依赖的package包/类
/**
* Sets-up the grid filters.
*/
private void addFilters() {
// --
// The filter by model type.
// --
view.getStore().addFilter(new StoreFilter<ProjectDTO>() {
@Override
public boolean select(Store<ProjectDTO> store, ProjectDTO parent, ProjectDTO item, String property) {
boolean selected = false;
// Root item.
if (item.getParent() == null) {
// A root item is filtered if its type doesn't match the current type.
selected = item.getVisibility(auth().getOrganizationId()) == currentModelType;
}
// Child item
else {
// A child item is filtered if its parent is filtered.
selected = ((ProjectDTO) item.getParent()).getVisibility(auth().getOrganizationId()) == currentModelType;
}
return selected;
}
});
// --
// Refresh button selection listener.
// --
view.getRefreshButton().addSelectionListener(new SelectionListener<ButtonEvent>() {
@Override
public void componentSelected(ButtonEvent ce) {
// Explicit refresh.
refreshProjectGrid(command);
}
});
// --
// Filters aren't used for the moment.
// --
view.getFilterButton().setVisible(false);
}