本文整理汇总了Java中com.vaadin.data.util.filter.Or类的典型用法代码示例。如果您正苦于以下问题:Java Or类的具体用法?Java Or怎么用?Java Or使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Or类属于com.vaadin.data.util.filter包,在下文中一共展示了Or类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: createContainer
import com.vaadin.data.util.filter.Or; //导入依赖的package包/类
@Override
protected Container createContainer() {
final ExtaDbContainer<InfoFile> dbContainer = new ExtaDbContainer<>(InfoFile.class);
final UserProfile user = lookup(UserManagementService.class).getCurrentUser();
if (user.getRole() != UserRole.ADMIN) {
final Set<String> permitBrands = newHashSet(user.getPermitBrands());
final Set<UserGroup> groups = user.getGroupList();
if (groups != null) {
for (final UserGroup group : groups) {
permitBrands.addAll(group.getPermitBrands());
}
}
if (!permitBrands.isEmpty()) {
final Container.Filter[] bFilters = new Container.Filter[permitBrands.size()];
int i = 0;
for (final String brand : permitBrands) {
bFilters[i] = new Compare.Equal(InfoFile_.permitBrands.getName(), brand);
i++;
}
dbContainer.addContainerFilter(new Or(bFilters));
}
}
return dbContainer;
}
示例2: createContainer
import com.vaadin.data.util.filter.Or; //导入依赖的package包/类
/**
* {@inheritDoc}
*/
@Override
protected Container createContainer() {
// Запрос данных
final ExtaDbContainer<Lead> container = SecuredDataContainer.create(Lead.class, ExtaDomain.SALES_LEADS);
container.addNestedContainerProperty("responsible.name");
container.addNestedContainerProperty("responsibleAssist.name");
container.addContainerFilter(new Compare.Equal("status", status));
if (isMyOnly) {
final Employee user = lookup(UserManagementService.class).getCurrentUserEmployee();
container.addContainerFilter(
new Or(
new Compare.Equal("responsible", user),
new Compare.Equal("responsibleAssist", user)));
}
container.sort(new Object[]{"createdDate"}, new boolean[]{false});
return container;
}
示例3: generateFilter
import com.vaadin.data.util.filter.Or; //导入依赖的package包/类
/**
* Generates a new Filter for the property with the given ID, using the
* Field object and its value as basis for the filtering.
*
* @param propertyId ID of the filtered property.
* @param originatingField Reference to the field that triggered this filter generating
* request.
* @return A generated Filter object, or NULL if you want to allow
* FilterTable to generate the default Filter for this property.
*/
@Override
public Container.Filter generateFilter(final Object propertyId, final Field<?> originatingField) {
if (originatingField instanceof UserProfileSelect) {
final UserProfile userProfile = (UserProfile) ((UserProfileSelect) originatingField).getConvertedValue();
if (userProfile != null) {
final Set<String> aliases = userProfile.getAliases();
final Container.Filter[] filters = new Container.Filter[aliases.size()];
int i = 0;
for (final String alias : aliases) {
filters[i++] = new Compare.Equal(propertyId, alias);
}
return filters.length > 1 ? new Or(filters) : filters[0];
}
}
return null;
}
示例4: getContainerFilter
import com.vaadin.data.util.filter.Or; //导入依赖的package包/类
@Override
protected Filter getContainerFilter(final String filterString, final boolean advancedSearchActive)
{
if (filterString.trim().length() > 0)
{
return new Or(new SimpleStringFilter(Task_.dueDate.getName(), filterString, true, false),
new SimpleStringFilter(new Path(Task_.taskType, TaskType_.name).getName(), filterString, true,
false), new SimpleStringFilter(new Path(Task_.withContact, Contact_.lastname).getName(),
filterString, true, false), new SimpleStringFilter(new Path(Task_.withContact,
Contact_.firstname).getName(), filterString, true, false), new SimpleStringFilter(new Path(
Task_.addedBy, User_.username).getName(), filterString, true, false),
new SimpleStringFilter(Task_.subject.getName(), filterString, true, false));
}
else
{
return null;
}
}
示例5: filter
import com.vaadin.data.util.filter.Or; //导入依赖的package包/类
private void filter(String filterString) {
container.removeAllContainerFilters();
if (filterString.length() > 0) {
String[] filterWords = filterString.split(" ");
Container.Filter[] filters = new Container.Filter[filterWords.length];
for (int i = 0; i < filterWords.length; ++i) {
String word = filterWords[i];
filters[i] = new Or(
new SimpleStringFilter("stringProperty", word, false, false),
new SimpleStringFilter("integerProperty", word, true, true),
new SimpleStringFilter("embeddedProperty.enumProperty", word, true, false)
);
}
container.addContainerFilter(new And(filters));
}
}
示例6: buildFilter
import com.vaadin.data.util.filter.Or; //导入依赖的package包/类
/**
* @see com.vaadin.ui.ComboBox#buildFilter(java.lang.String, com.vaadin.shared.ui.combobox.FilteringMode)
*/
@Override
protected Filter buildFilter(String filterString,
FilteringMode filteringMode) {
container.removeAllContainerFilters();
SimpleStringFilter libFilter = new SimpleStringFilter(SiScolDepartement_.libDep.getName(), filterString, true, false);
SimpleStringFilter codFilter = new SimpleStringFilter(SiScolDepartement_.codDep.getName(), filterString, true, false);
container.addContainerFilter(new Or(libFilter,codFilter));
return null;
}
示例7: setFilter
import com.vaadin.data.util.filter.Or; //导入依赖的package包/类
/**
* Filter the table based on a search string that is searched for in the
* product name, availability and category columns.
*
* @param filterString
* string to look for
*/
public void setFilter(String filterString) {
LogManager.getLogger(this.getClass()).info("FilterString : "+filterString);
getContainer().removeAllContainerFilters();
if (filterString.length() > 0) {
SimpleStringFilter nameFilter = new SimpleStringFilter(
"productName", filterString, true, false);
SimpleStringFilter availabilityFilter = new SimpleStringFilter(
"availability", filterString, true, false);
/*SimpleStringFilter categoryFilter = new SimpleStringFilter(
"category", filterString, true, false);*/
//getContainer().addContainerFilter(nameFilter);
getContainer().addContainerFilter(new Or(nameFilter, availabilityFilter/*, categoryFilter*/));
}
}
示例8: setFilter
import com.vaadin.data.util.filter.Or; //导入依赖的package包/类
/**
* Filter the grid based on a search string that is searched for in the
* product name, availability and category columns.
*
* @param filterString
* string to look for
*/
public void setFilter(String filterString) {
getContainer().removeAllContainerFilters();
if (filterString.length() > 0) {
SimpleStringFilter nameFilter = new SimpleStringFilter(
"productName", filterString, true, false);
SimpleStringFilter availabilityFilter = new SimpleStringFilter(
"availability", filterString, true, false);
SimpleStringFilter categoryFilter = new SimpleStringFilter(
"category", filterString, true, false);
getContainer().addContainerFilter(
new Or(nameFilter, availabilityFilter, categoryFilter));
}
}
示例9: setClientsFilter
import com.vaadin.data.util.filter.Or; //导入依赖的package包/类
private void setClientsFilter(final String name, final String cellPhone) {
clientsContainer.removeAllContainerFilters();
final List<Container.Filter> filters = newArrayListWithCapacity(3);
if (!Strings.isNullOrEmpty(name)) {
filters.add(new Like("name", MessageFormat.format("%{0}%", name), false));
}
if (!Strings.isNullOrEmpty(cellPhone)) {
filters.add(new Like("phone", MessageFormat.format("%{0}%", cellPhone), false));
filters.add(new Like("secondPhone", MessageFormat.format("%{0}%", cellPhone), false));
}
if (!filters.isEmpty())
clientsContainer.addContainerFilter(new Or(filters.toArray(new Container.Filter[filters.size()])));
}
示例10: createContainer
import com.vaadin.data.util.filter.Or; //导入依赖的package包/类
/**
* {@inheritDoc}
*/
@Override
protected Container createContainer() {
// Запрос данных
final ExtaDbContainer<Sale> container = SecuredDataContainer.create(Sale.class, domain);
container.addNestedContainerProperty("client.name");
container.addNestedContainerProperty("client.phone");
container.addNestedContainerProperty("clientContact.name");
container.addNestedContainerProperty("clientContact.phone");
container.addNestedContainerProperty("dealer.name");
container.addNestedContainerProperty("responsible.name");
container.addNestedContainerProperty("responsibleAssist.name");
container.addNestedContainerProperty("dealerManager.name");
container.addNestedContainerProperty("dealer.posAddress.regionWithType");
container.addNestedContainerProperty("dealer.posAddress.cityWithType");
container.addContainerFilter(new Compare.Equal("status",
domain == ExtaDomain.SALES_CANCELED ? Sale.Status.CANCELED :
domain == ExtaDomain.SALES_OPENED ? Sale.Status.NEW : Sale.Status.FINISHED));
if (isMyOnly) {
final Employee user = lookup(UserManagementService.class).getCurrentUserEmployee();
container.addContainerFilter(
new Or(
new Compare.Equal("responsible", user),
new Compare.Equal("responsibleAssist", user)));
}
container.sort(new Object[]{Sale_.lastModifiedDate.getName()}, new boolean[]{domain == ExtaDomain.SALES_OPENED});
return container;
}
示例11: or
import com.vaadin.data.util.filter.Or; //导入依赖的package包/类
public static Filter or(final Filter... filters)
{
final List<Filter> validFilters = new ArrayList<Filter>();
for (Filter filter : filters)
{
if (filter != null)
validFilters.add(filter);
}
if (validFilters.size() == 1)
return validFilters.get(0);
return new Or(validFilters.toArray(new Filter[validFilters.size()]));
}
示例12: getContainerFilter
import com.vaadin.data.util.filter.Or; //导入依赖的package包/类
@Override
protected Filter getContainerFilter(final String filterString, final boolean advancedSearchActive)
{
return new Or(new SimpleStringFilter(Raffle_.name.getName(), filterString, true, false),
new SimpleStringFilter(Raffle_.startDate.getName(), filterString, true, false));
}
示例13: getContainerFilter
import com.vaadin.data.util.filter.Or; //导入依赖的package包/类
@Override
protected Filter getContainerFilter(final String filterString, final boolean advancedSearchActive)
{
return new Or(
new SimpleStringFilter(new Path(LoginAttempt_.user, User_.username).getName(), filterString, true,
false),
new SimpleStringFilter(LoginAttempt_.dateOfAttempt.getName(), filterString, true, false),
new SimpleStringFilter(LoginAttempt_.succeeded.getName(), filterString, true, false));
}
示例14: getContainerFilter
import com.vaadin.data.util.filter.Or; //导入依赖的package包/类
@Override
protected Filter getContainerFilter(final String filterString, final boolean advancedSearchActive)
{
return new Or(new Or(new Or(new Or(
new Or(new SimpleStringFilter(CommunicationLog_.activityDate.getName(), filterString, true, false),
new SimpleStringFilter(new Path(CommunicationLog_.type, CommunicationType_.name).getName(),
filterString, true, false)),
new SimpleStringFilter(new Path(CommunicationLog_.withContact, Contact_.lastname).getName(),
filterString, true, false)),
new SimpleStringFilter(new Path(CommunicationLog_.withContact, Contact_.firstname).getName(),
filterString, true, false)),
new SimpleStringFilter(new Path(CommunicationLog_.addedBy, User_.username).getName(), filterString,
true, false)),
new SimpleStringFilter(CommunicationLog_.subject.getName(), filterString, true, false));
}
示例15: getContainerFilter
import com.vaadin.data.util.filter.Or; //导入依赖的package包/类
@Override
protected Filter getContainerFilter(final String filterString, final boolean advancedSearchActive)
{
return new Or(
new Or(new SimpleStringFilter(Event_.eventStartDateTime.getName(), filterString, true, false),
new SimpleStringFilter(Event_.eventEndDateTime.getName(), filterString, true, false)),
new SimpleStringFilter(Event_.subject.getName(), filterString, true, false));
}