• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java Compare类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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


示例16: setBogusParentFilter

import com.vaadin.data.util.filter.Compare; //导入依赖的package包/类
/**
 * Load the page with a bogus parent filter to prevent possible large
 * queries from being executed before a parent row is selected
 */
private void setBogusParentFilter()
{
	P tmp;
	try
	{
		tmp = parentType.newInstance();
		tmp.setId(-1L);
		parentFilter = new Compare.Equal(childKey, tmp);
	}
	catch (InstantiationException | IllegalAccessException e)
	{
		loggerChildCrud.warn("Failed to instance " + parentType + " to create bogus parent filter");

	}
}
 
开发者ID:rlsutton1,项目名称:VaadinUtils,代码行数:20,代码来源:ChildCrudView.java


示例17: createParentFilter

import com.vaadin.data.util.filter.Compare; //导入依赖的package包/类
private void createParentFilter(EntityItem<P> item) throws InstantiationException, IllegalAccessException
{
	parentFilter = new Compare.Equal(childKey, translateParentId(-1l));

	if (item != null)

	{
		EntityItemProperty key = item.getItemProperty(parentKey);
		Preconditions.checkNotNull(key, "parentKey " + parentKey + " doesn't exist in properties");
		parentId = key.getValue();
		if (parentId != null)
		{

			parentFilter = new Compare.Equal(childKey, translateParentId(parentId));

		}

	}
}
 
开发者ID:rlsutton1,项目名称:VaadinUtils,代码行数:20,代码来源:ChildCrudView.java


示例18: setParentFilter

import com.vaadin.data.util.filter.Compare; //导入依赖的package包/类
/**
 * provide the parent ReportParameterTable, this method will attach this
 * parameter as a value change listener so that selections will cascade to
 * the reportparameter
 * 
 * @param parent
 */
public void setParentFilter(ReportParameterSelectionListener<P> parent)
{
	this.parent = parent;
	ValueChangeListener listener = new ValueChangeListener()
	{

		private static final long serialVersionUID = -3033912391060894738L;

		@Override
		public void valueChange(ValueChangeEvent event)
		{
			@SuppressWarnings("unchecked")
			Collection<Long> selectedIds = (Collection<Long>) event.getProperty().getValue();
			applyParentFilters(selectedIds);
		}
	};
	addContainerFilter(new Compare.Equal(getPrimaryKeyFieldName(), -1));

	parent.addSelectionListener(listener);

}
 
开发者ID:rlsutton1,项目名称:VaadinUtils,代码行数:29,代码来源:ReportParameterDependantTable.java


示例19: addParentHandler

import com.vaadin.data.util.filter.Compare; //导入依赖的package包/类
private void addParentHandler(final ComboBox parent, final EntityContainer<E> childContainer,
		final SingularAttribute<E, Parent> childForeignAttribute)
{
	parent.addValueChangeListener(new ValueChangeListener()
	{
		private static final long serialVersionUID = 1L;

		@Override
		public void valueChange(com.vaadin.data.Property.ValueChangeEvent event)
		{
			@SuppressWarnings("unchecked")
			Parent parentEntity = ((Parent) parent.getConvertedValue());

			childContainer.removeAllContainerFilters();
			childContainer.addContainerFilter(new Compare.Equal(childForeignAttribute.getName(), parentEntity));
			DependantComboBox.this.setContainerDataSource(childContainer);
			DependantComboBox.this.setValue(null);
		}
	});
}
 
开发者ID:rlsutton1,项目名称:VaadinUtils,代码行数:21,代码来源:DependantComboBox.java


示例20: PIPResolverComponent

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 PIPResolverComponent(PIPConfiguration configuration) {
	buildMainLayout();
	setCompositionRoot(mainLayout);
	//
	// Save
	//
	this.config = configuration;
	this.resolverContainer.setEntityProvider(new CachingMutableLocalEntityProvider<PIPResolver>(PIPResolver.class, ((XacmlAdminUI)UI.getCurrent()).getEntityManager()));
	this.resolverContainer.addContainerFilter(new Compare.Equal("pipconfiguration", this.config));
	//
	// Initialize GUI
	//
	this.initializeTable();
}
 
开发者ID:apache,项目名称:incubator-openaz,代码行数:22,代码来源:PIPResolverComponent.java



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java PotentialAssignment类代码示例发布时间:2022-05-22
下一篇:
Java NetworkModule类代码示例发布时间:2022-05-22
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap