本文整理匯總了Java中com.vaadin.data.Container.Filterable方法的典型用法代碼示例。如果您正苦於以下問題:Java Container.Filterable方法的具體用法?Java Container.Filterable怎麽用?Java Container.Filterable使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類com.vaadin.data.Container
的用法示例。
在下文中一共展示了Container.Filterable方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: FilterableGrid
import com.vaadin.data.Container; //導入方法依賴的package包/類
public FilterableGrid(String caption, Container.Indexed dataSource) {
super(caption, dataSource);
if (!(dataSource instanceof Container.Filterable)) {
throw new IllegalArgumentException("Container must be Filterable");
}
setSelectionMode(Grid.SelectionMode.SINGLE);
setSizeFull();
setWidth("100%");
setHeight("100%");
makeSearchHeader(
(Container.Filterable) dataSource,
dataSource.getContainerPropertyIds(),
searchFieldRow);
}
示例2: applyFilterPattern
import com.vaadin.data.Container; //導入方法依賴的package包/類
protected SearchPattern
applyFilterPattern(Class<?> propertyType,
Object propertyId,
Object objectPattern,
Container.Filterable filterableContainer) {
// remove last applied filter from the container
SearchPattern lastPattern = getLastAppliedSearchPattern();
if (lastPattern != null) {
filterableContainer.removeContainerFilter(lastPattern.getFilter());
}
// if the objectPattern is non-empty
if (!isEmpty(objectPattern)) {
SearchPattern newPattern = getPattern(objectPattern);
filterableContainer.addContainerFilter(newPattern.getFilter());
setLastAppliedSearchPattern(newPattern);
}
return lastPattern;
}
示例3: setValue
import com.vaadin.data.Container; //導入方法依賴的package包/類
/**
* Sets the new value to field, and applies the filter on the target container (if any).
*
* If the given value is null, then it only clears the filter on the container.
*/
@Override
public void setValue(T newValue) throws ReadOnlyException {
super.setValue(newValue);
if (newValue != null) {
getBackingField().setValue(newValue);
return;
}
getBackingField().setValue(null);
SearchPattern lastPattern = getLastAppliedSearchPattern();
setLastAppliedSearchPattern(null);
if (lastPattern == null) return;
Container.Filterable c = getTargetContainer();
if (c != null) c.removeContainerFilter(lastPattern.getFilter());
}
示例4: search
import com.vaadin.data.Container; //導入方法依賴的package包/類
private void search(final String searchRequest) {
Container.Filterable container = (Container.Filterable) tree.getContainerDataSource();
if (StringUtils.isBlank(searchRequest)) {
container.removeContainerFilter(filter);
filter = null;
} else {
if (filter != null) {
container.removeContainerFilter(filter);
}
filter = new TreeSearchFilter(PROPERTY_CAPTION, searchRequest);
container.addContainerFilter(filter);
expandAll();
}
}
示例5: isFiltered
import com.vaadin.data.Container; //導入方法依賴的package包/類
public boolean isFiltered(Container container) {
if (container instanceof Container.Filterable) {
Collection<Container.Filter> filters = ((Container.Filterable) container).getContainerFilters();
return filters != null && !filters.isEmpty();
}
return false;
}
示例6: updateClearToFind
import com.vaadin.data.Container; //導入方法依賴的package包/類
private void updateClearToFind(Container container) {
disable(btnFind);
disable(btnClearToFind);
// if it is filterable
if (container instanceof Container.Filterable) {
Container.Filterable filterable = (Container.Filterable) container;
if (filterable.size() > 0 // and it contains values
|| !filterable.getContainerFilters().isEmpty()) { // when no filters have been applied
enable(btnClearToFind);
}
}
}
示例7: setContainer
import com.vaadin.data.Container; //導入方法依賴的package包/類
@Override
public void setContainer(Container.Ordered container) {
this.container = container;
this.currentItemId = null;
if (container == null || container.size() == 0) disableNavigation();
if (container instanceof Container.Filterable) enableFind();
else disableFind();
first();
}
示例8: onFind
import com.vaadin.data.Container; //導入方法依賴的package包/類
@Override
public void onFind(OnFind.Event event) {
Container.Filterable container = (Container.Filterable)event.getSource().getContainer();
container.removeAllContainerFilters();
for (SearchPattern p : searchWindow.getSearchPatterns()) {
container.addContainerFilter(p.getFilter());
}
event.getSource().first();
}
示例9: makeSearchFields
import com.vaadin.data.Container; //導入方法依賴的package包/類
protected Map<Object, Field<?>> makeSearchFields(Container.Filterable container, Collection<?> visiblePropertyIds) {
final Map<Object, Field<?>> localSearchFieldMap = new HashMap<>();
for (Object propertyId : visiblePropertyIds) {
localSearchFieldMap.put(propertyId, makeSearchField(propertyId, container));
}
return localSearchFieldMap;
}
示例10: createField
import com.vaadin.data.Container; //導入方法依賴的package包/類
@Override
public SearchPatternField<?, ?> createField(Object propertyId, Class<?> propertyType, Container.Filterable container) {
SearchPatternField f ;
if (java.lang.Enum.class.isAssignableFrom(propertyType)) {
f = new SearchPatternComboBox(propertyId, propertyType, container);
} else {
f = new SearchPatternTextField(propertyId, propertyType, container);
}
f.setCaption(DefaultFieldFactory.createCaptionByPropertyId(propertyId));
return f;
}
示例11: SearchPatternComboBox
import com.vaadin.data.Container; //導入方法依賴的package包/類
public SearchPatternComboBox(Object propertyId,
Class<?> propertyType,
Container.Filterable targetContainer) {
super(new ComboBox(), Object.class, propertyId, propertyType, targetContainer);
setFieldDefaults(getBackingField());
addDefaultBackingFieldListeners();
}
示例12: dismiss
import com.vaadin.data.Container; //導入方法依賴的package包/類
public void dismiss() {
super.dismiss();
Container c = getGrid().getContainerDataSource();
if (c instanceof Container.Filterable) {
((Container.Filterable) c).removeAllContainerFilters();
}
}
示例13: enableFind
import com.vaadin.data.Container; //導入方法依賴的package包/類
@Override
public void enableFind() {
this.findEnabled = getContainer() instanceof Container.Filterable;
getEventRouter().fireEvent(new FindEnabled.Event(this, findEnabled));
}
示例14: makeSearchHeader
import com.vaadin.data.Container; //導入方法依賴的package包/類
protected void makeSearchHeader(Container.Filterable container, Collection<?> visiblePropertyIds, HeaderRow filterRow) {
final Map<Object,Field<?>> localFilterMap = makeSearchFields(container, visiblePropertyIds);
prepareFilterHeader(visiblePropertyIds, localFilterMap, filterRow);
setSearchFieldMap(localFilterMap);
}
示例15: makeSearchField
import com.vaadin.data.Container; //導入方法依賴的package包/類
protected Field<?> makeSearchField(final Object propertyId, Container.Filterable container) {
Class<?> type = container.getType(propertyId);
return searchFieldFactory.createField(propertyId, type, container);
}