本文整理匯總了Java中com.vaadin.data.Container.Filter方法的典型用法代碼示例。如果您正苦於以下問題:Java Container.Filter方法的具體用法?Java Container.Filter怎麽用?Java Container.Filter使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類com.vaadin.data.Container
的用法示例。
在下文中一共展示了Container.Filter方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: testDate_dd_mm_Range
import com.vaadin.data.Container; //導入方法依賴的package包/類
@Test
public void testDate_dd_mm_Range() {
DateTime today = DateTime.now();
int year = today.getYear();
Container.Filter expected = new And(
new Compare.GreaterOrEqual(DATE_PROPID, new DateTime(year, 1, 1, 0, 0, 0).toDate()),
new Compare.LessOrEqual(DATE_PROPID, new DateTime(year, 1, 31, 23, 59, 59, 999).toDate()));
Container.Filter filter = filterFactory.createFilter(Date.class, DATE_PROPID, "01-01..31-01");
log.info(filterToString(expected));
log.info(filterToString(filter));
assertEquals(expected, filter);
}
示例2: convert
import com.vaadin.data.Container; //導入方法依賴的package包/類
public Criteria convert(Container.Filter f, boolean negated) {
if (f instanceof IsNull) {
return convertIsNullFilter((IsNull) f);
} else
if (f instanceof SimpleStringFilter) {
return convertSimpleStringFilter(((SimpleStringFilter) f));
} else
if (f instanceof Compare) {
return convertCompareFilter((Compare) f);
} else
if (f instanceof Not) {
return convertNegated(((Not) f).getFilter());
} else
if (f instanceof And) {
return convertAndFilter((And) f, negated);
} else
if (f instanceof Or) {
return convertOrFilter((Or) f, negated);
} else
if (f instanceof Between) {
return convertBetweenFilter((Between) f, negated);
}
throw new UnsupportedFilterException("Unsupported Filter "+f);
}
示例3: testDate_dd_mm
import com.vaadin.data.Container; //導入方法依賴的package包/類
@Test
public void testDate_dd_mm() {
DateTime today = DateTime.now();
int year = today.getYear();
Container.Filter expected = new And(
new Compare.GreaterOrEqual(DATE_PROPID, new DateTime(year, 1, 1, 0, 0, 0).toDate()),
new Compare.LessOrEqual(DATE_PROPID, new DateTime(year, 1, 1, 23, 59, 59, 999).toDate()));
Container.Filter filter = filterFactory.createFilter(Date.class, DATE_PROPID, "01-01");
log.info(filterToString(expected));
log.info(filterToString(filter));
assertEquals(expected, filter);
}
示例4: testDate_dd
import com.vaadin.data.Container; //導入方法依賴的package包/類
@Test
public void testDate_dd() {
DateTime today = DateTime.now();
int year = today.getYear(), month = today.getMonthOfYear();
Container.Filter expected = new And(
new Compare.GreaterOrEqual(DATE_PROPID, new DateTime(year, month, 1, 0, 0, 0).toDate()),
new Compare.LessOrEqual(DATE_PROPID, new DateTime(year, month, 1, 23, 59, 59, 999).toDate()));
Container.Filter filter = filterFactory.createFilter(Date.class, DATE_PROPID, "01");
log.info(filterToString(expected));
log.info(filterToString(filter));
assertEquals(expected, filter);
}
示例5: numericRange
import com.vaadin.data.Container; //導入方法依賴的package包/類
protected Container.Filter numericRange(Object propertyId, Class<?> numberClass, String pattern) {
Matcher matcher = numericRangePattern.matcher(pattern);
if (!matcher.find()) return null;
String left = matcher.group(1);
String right = matcher.group(2);
if (fpPattern.matcher(left).matches() && fpPattern.matcher(right).matches()) {
Number i = parseNumericValue(left, numberClass);
Number j = parseNumericValue(right, numberClass);
if (i.doubleValue() > j.doubleValue()) {
throw new Validator.InvalidValueException(
String.format("The given range '%s' is invalid", pattern));
}
return new And(
new Compare.GreaterOrEqual(propertyId, i),
new Compare.LessOrEqual(propertyId, j)
);
}
return null;
}
示例6: filterForCompareDate
import com.vaadin.data.Container; //導入方法依賴的package包/類
protected Container.Filter filterForCompareDate(Object propertyId, String pattern) {
Matcher matcher = comparePattern.matcher(pattern);
if (!matcher.find())
return null;
String op = matcher.group(1);
String rest = matcher.group(2);
Date value = leftRange(rest);
switch (op) {
case ">": return new Compare.Greater(propertyId, value);
case ">=": return new Compare.GreaterOrEqual(propertyId, value);
case "<": return new Compare.Less(propertyId, value);
case "<=": return new Compare.LessOrEqual(propertyId, value);
}
return null;
}
示例7: convertAll
import com.vaadin.data.Container; //導入方法依賴的package包/類
@Override
public List<Criteria> convertAll(Collection<Container.Filter> fs) {
List<Criteria> cs = new ArrayList<Criteria>();
for (Container.Filter f: fs)
cs.add(convert(f));
return cs;
}
示例8: convertOrFilter
import com.vaadin.data.Container; //導入方法依賴的package包/類
private Criteria convertOrFilter(Or f, boolean negated) {
Collection<Container.Filter> filterList = f.getFilters();
if (filterList.isEmpty()) {
throw new IllegalStateException("filter list in Or is empty");
}
if (filterList.size() == 1) {
return convert(filterList.iterator().next());
}
List<Criteria> cs = convertAll(filterList);
if (negated) {
return new Criteria().norOperator(cs.toArray(new Criteria[0]));
} else {
return new Criteria().orOperator(cs.toArray(new Criteria[0]));
}
}
示例9: convertAndFilter
import com.vaadin.data.Container; //導入方法依賴的package包/類
private Criteria convertAndFilter(And f, boolean negated) {
if (negated)
throw new UnsupportedFilterException("Not(And) not supported in " +
"mongo");
Collection<Container.Filter> filterList = f.getFilters();
if (filterList.isEmpty()) {
throw new IllegalStateException("filter list in And is empty");
}
if (filterList.size() == 1) {
return convert(filterList.iterator().next());
}
List<Criteria> cs = convertAll(filterList);
return new Criteria().andOperator(cs.toArray(new Criteria[0]));
}
示例10: testIntGt
import com.vaadin.data.Container; //導入方法依賴的package包/類
@Test
public void testIntGt() {
Container.Filter expected = new Compare.Greater(INT_PROPID, 100);
Container.Filter filter = filterFactory.createFilter(int.class, INT_PROPID, ">100");
assertEquals(expected, filter);
Item target = new PropertysetItem();
target.addItemProperty(INT_PROPID, new ObjectProperty(110));
assertTrue(filter.passesFilter(0, target));
target.getItemProperty(INT_PROPID).setValue(90);
assertFalse(filter.passesFilter(0, target));
}
示例11: testDateMonth
import com.vaadin.data.Container; //導入方法依賴的package包/類
@Test
public void testDateMonth() {
Container.Filter expected = new And(
new Compare.GreaterOrEqual(DATE_PROPID, new DateTime(2010, 1, 1, 0, 0, 0).toDate()),
new Compare.LessOrEqual(DATE_PROPID, new DateTime(2010, 1, 31, 23, 59, 59, 999).toDate()));
Container.Filter filter = filterFactory.createFilter(Date.class, DATE_PROPID, "01-2010");
log.info(filterToString(expected));
log.info(filterToString(filter));
assertEquals(expected, filter);
}
示例12: testDoubleRange
import com.vaadin.data.Container; //導入方法依賴的package包/類
@Test
public void testDoubleRange() {
Container.Filter expected = new And(
new Compare.GreaterOrEqual(INT_PROPID, 10.1),
new Compare.LessOrEqual(INT_PROPID, 100.2));
Container.Filter filter = filterFactory.createFilter(double.class, INT_PROPID, "10.1..100.2");
log.info(filterToString(expected));
log.info(filterToString(filter));
assertEquals(expected, filter);
}
示例13: testDateYearRange
import com.vaadin.data.Container; //導入方法依賴的package包/類
@Test
public void testDateYearRange() {
Container.Filter expected = new And(
new Compare.GreaterOrEqual(DATE_PROPID, new DateTime(2010, 1, 1, 0, 0, 0).toDate()),
new Compare.LessOrEqual(DATE_PROPID, new DateTime(2015, 12, 31, 23, 59, 59, 999).toDate()));
Container.Filter filter = filterFactory.createFilter(Date.class, DATE_PROPID, "2010..2015");
assertEquals(expected, filter);
}
示例14: testIntRange
import com.vaadin.data.Container; //導入方法依賴的package包/類
@Test
public void testIntRange() {
Container.Filter expected = new And(
new Compare.GreaterOrEqual(INT_PROPID, 10),
new Compare.LessOrEqual(INT_PROPID, 100));
Container.Filter filter = filterFactory.createFilter(int.class, INT_PROPID, "10..100");
log.info(filterToString(expected));
log.info(filterToString(filter));
assertEquals(expected, filter);
}
示例15: testDateYear
import com.vaadin.data.Container; //導入方法依賴的package包/類
@Test
public void testDateYear() {
Container.Filter expected = new And(
new Compare.GreaterOrEqual(DATE_PROPID, new DateTime(2014, 1, 1, 0, 0, 0).toDate()),
new Compare.LessOrEqual(DATE_PROPID, new DateTime(2014, 12, 31, 23, 59, 59, 999).toDate()));
Container.Filter filter = filterFactory.createFilter(Date.class, DATE_PROPID, "2014");
log.info(filterToString(expected));
log.info(filterToString(filter));
assertEquals(expected, filter);
}