当前位置: 首页>>代码示例>>Java>>正文


Java Compare类代码示例

本文整理汇总了Java中com.vaadin.data.util.filter.Compare的典型用法代码示例。如果您正苦于以下问题:Java Compare类的具体用法?Java Compare怎么用?Java Compare使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


Compare类属于com.vaadin.data.util.filter包,在下文中一共展示了Compare类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: attributeChanged

import com.vaadin.data.util.filter.Compare; //导入依赖的package包/类
@Override
public void attributeChanged(Attribute attribute) {
	if (logger.isDebugEnabled()) {
		logger.debug("attributeChanged: " + attribute);
	}
	//
	// Remove all filters.
	//
	MatchEditorWindow.matchFunctions.removeAllContainerFilters();
	if (attribute == null) {
		return;
	}
	//
	// Get the datatype for the attribute
	//
	Datatype datatype = attribute.getDatatypeBean();
	if (logger.isDebugEnabled()) {
		logger.debug("datatype: " + datatype.getId());
	}
	//
	// Filter out functions where ARG2 is the datatype. The
	// AttributeDesignator/AttributeSelector is the 2nd arg.
	//
	MatchEditorWindow.matchFunctions.addContainerFilter(new Compare.Equal(PROPERTY_ARG2_DATATYPE, datatype.getId()));
}
 
开发者ID:apache,项目名称:incubator-openaz,代码行数:26,代码来源:MatchEditorWindow.java

示例2: setupDatatype

import com.vaadin.data.util.filter.Compare; //导入依赖的package包/类
private void setupDatatype(Identifier datatype) {
	if (datatype.equals(XACML3.ID_DATATYPE_INTEGER) ||
			datatype.equals(XACML3.ID_DATATYPE_DOUBLE)) {
		((XacmlAdminUI) UI.getCurrent()).getConstraintTypes().removeAllContainerFilters();
		this.constraintTypes.setEnabled(true);
		this.constraintValues.resetDatatype(datatype);
		return;
	}
	if (datatype.equals(XACML3.ID_DATATYPE_STRING)) {
		((XacmlAdminUI) UI.getCurrent()).getConstraintTypes().addContainerFilter(new Not(new Compare.Equal("constraintType", ConstraintType.RANGE_TYPE)));
		if (this.attribute.getConstraintType() != null && 
				this.attribute.getConstraintType().getConstraintType() != null &&
				this.attribute.getConstraintType().getConstraintType().equals(ConstraintType.RANGE_TYPE)) {
			this.attribute.setConstraintType(null);
		}
		this.constraintValues.resetDatatype(datatype);
		return;
	}
	//
	// No constraint for all other datatypes
	//
	this.attribute.setConstraintType(null);
	this.constraintTypes.select(null);
	this.constraintTypes.setEnabled(false);
}
 
开发者ID:apache,项目名称:incubator-openaz,代码行数:26,代码来源:AttributeEditorWindow.java

示例3: OaExpressionsEditorComponent

import com.vaadin.data.util.filter.Compare; //导入依赖的package包/类
/**
 * The constructor should first build the main layout, set the
 * composition root and then do any custom initialization.
 *
 * The constructor will not be automatically regenerated by the
 * visual editor.
 */
public OaExpressionsEditorComponent(EntityItem<Obadvice> oa, JPAContainer<ObadviceExpression> container) {
	buildMainLayout();
	setCompositionRoot(mainLayout);
	//
	// Save
	//
	this.container = container;
	this.oa = oa;
	//
	// Filter the container
	//
	this.container.removeAllContainerFilters();
	this.container.addContainerFilter(new Compare.Equal("obadvice", this.oa.getEntity()));
	//
	// Initialize components
	//
	this.initializeTable();
	this.initializeButtons();
}
 
开发者ID:apache,项目名称:incubator-openaz,代码行数:27,代码来源:OaExpressionsEditorComponent.java

示例4: createFilter

import com.vaadin.data.util.filter.Compare; //导入依赖的package包/类
@Override
public Container.Filter createFilter(Class<?> targetType, Object targetPropertyId, Object pattern) {
    if (pattern == null) return null;

    if (String.class.isAssignableFrom(targetType) || java.lang.Enum.class.isAssignableFrom(targetType)) {
        return filterForString(targetPropertyId, pattern.toString());
    } else
    if (isNumberClass(targetType)) {
        return filterForNumber(targetPropertyId, targetType, pattern.toString());
    } else
    if (Date.class.isAssignableFrom(targetType) || DateTime.class.isAssignableFrom(targetType)) {
        Container.Filter filter = filterForCompareDate(targetPropertyId, pattern.toString());
        if (filter != null) return filter;
        return filterForDateRange(targetPropertyId, pattern.toString());
    } else {
        // fallback to equality
        return new Compare.Equal(targetPropertyId, pattern);
    }
}
 
开发者ID:tyl,项目名称:field-binder,代码行数:20,代码来源:DefaultFilterFactory.java

示例5: numberCompare

import com.vaadin.data.util.filter.Compare; //导入依赖的package包/类
protected Container.Filter numberCompare(Object propertyId, Class<?> numberType, String pattern) {
    Matcher matcher = numberComparePattern.matcher(pattern);
    if (!matcher.find()) return null;

    String op = matcher.group(1);

    Number numberValue = parseNumericValue(matcher.group(2), numberType);

    switch (op) {
        case ">": return new Compare.Greater(propertyId, numberValue);
        case ">=": return new Compare.GreaterOrEqual(propertyId, numberValue);
        case "<": return new Compare.Less(propertyId, numberValue);
        case "<=": return new Compare.LessOrEqual(propertyId, numberValue);
    }

    return null;
}
 
开发者ID:tyl,项目名称:field-binder,代码行数:18,代码来源:DefaultFilterFactory.java

示例6: numericRange

import com.vaadin.data.util.filter.Compare; //导入依赖的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;
}
 
开发者ID:tyl,项目名称:field-binder,代码行数:25,代码来源:DefaultFilterFactory.java

示例7: filterForCompareDate

import com.vaadin.data.util.filter.Compare; //导入依赖的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;

}
 
开发者ID:tyl,项目名称:field-binder,代码行数:20,代码来源:DefaultFilterFactory.java

示例8: testDate_dd_mm

import com.vaadin.data.util.filter.Compare; //导入依赖的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);
}
 
开发者ID:tyl,项目名称:field-binder,代码行数:18,代码来源:TestDefaultFilterFactory.java

示例9: testDate_dd_mm_Range

import com.vaadin.data.util.filter.Compare; //导入依赖的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);
}
 
开发者ID:tyl,项目名称:field-binder,代码行数:18,代码来源:TestDefaultFilterFactory.java

示例10: testDate_dd

import com.vaadin.data.util.filter.Compare; //导入依赖的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);
}
 
开发者ID:tyl,项目名称:field-binder,代码行数:18,代码来源:TestDefaultFilterFactory.java

示例11: testDate_dd_Range

import com.vaadin.data.util.filter.Compare; //导入依赖的package包/类
@Test
public void testDate_dd_Range() {

    DateTime today = DateTime.now();
    int year = today.getYear(), month = today.getMonthOfYear();
    int maxDay = today.dayOfMonth().getMaximumValue();

    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, maxDay, 23, 59, 59, 999).toDate()));

    Container.Filter filter = filterFactory.createFilter(Date.class, DATE_PROPID, "01.." + maxDay);


    log.info(filterToString(expected));
    log.info(filterToString(filter));
    assertEquals(expected, filter);
}
 
开发者ID:tyl,项目名称:field-binder,代码行数:19,代码来源:TestDefaultFilterFactory.java

示例12: filterToString

import com.vaadin.data.util.filter.Compare; //导入依赖的package包/类
public String filterToString(Container.Filter filter) {
    if (filter instanceof Compare.LessOrEqual) {
        return String.format("%s <= %s", ((Compare.LessOrEqual) filter).getPropertyId(), ((Compare.LessOrEqual) filter).getValue());
    } else
    if (filter instanceof Compare.GreaterOrEqual) {
        return String.format("%s >= %s", ((Compare.GreaterOrEqual) filter).getPropertyId(), ((Compare.GreaterOrEqual) filter).getValue());
    } else
    if (filter instanceof And) {
        StringBuffer sb = new StringBuffer();
        Collection<Container.Filter> coll = ((And) filter).getFilters();
        for (Container.Filter f: coll) {
            sb.append(filterToString(f));
            sb.append(", ");
        }
        return sb.toString();
    }

    throw new UnsupportedOperationException("unsupported filter");
}
 
开发者ID:tyl,项目名称:field-binder,代码行数:20,代码来源:TestDefaultFilterFactory.java

示例13: createContainer

import com.vaadin.data.util.filter.Compare; //导入依赖的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;
}
 
开发者ID:ExtaSoft,项目名称:extacrm,代码行数:25,代码来源:InfoFilesGrid.java

示例14: createContainer

import com.vaadin.data.util.filter.Compare; //导入依赖的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;
}
 
开发者ID:ExtaSoft,项目名称:extacrm,代码行数:21,代码来源:LeadsGrid.java

示例15: generateFilter

import com.vaadin.data.util.filter.Compare; //导入依赖的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;
}
 
开发者ID:ExtaSoft,项目名称:extacrm,代码行数:27,代码来源:UserProfileFilterGenerator.java


注:本文中的com.vaadin.data.util.filter.Compare类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。