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


Java SimpleStringFilter类代码示例

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


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

示例1: getManufacturingFilterListener

import com.vaadin.data.util.filter.SimpleStringFilter; //导入依赖的package包/类
/**
 * Returns the TextChangeListener that gets triggered
 * 
 * @return
 */
private TextChangeListener getManufacturingFilterListener() {
	return new TextChangeListener() {

		/**
		 * 
		 */
		private static final long serialVersionUID = -2368474286053602744L;

		@Override
		public void textChange(TextChangeEvent event) {
			String newValue = (String) event.getText();
			@SuppressWarnings("unchecked")
			BeanItemContainer<VehicleInfo> container = ((BeanItemContainer<VehicleInfo>) grid
					.getContainerDataSource());
			// This is important, this removes the previous filter that was
			// used to filter the container
			container.removeContainerFilters(MANUFACTURER);
			if (null != newValue && !newValue.isEmpty()) {
				container.addContainerFilter(new SimpleStringFilter(
						MANUFACTURER, newValue, true, false));
			}
			grid.recalculateColumnWidths();
		}
	};
}
 
开发者ID:KrishnaPhani,项目名称:KrishnasSpace,代码行数:31,代码来源:FilterGrid.java

示例2: addDateFilter

import com.vaadin.data.util.filter.SimpleStringFilter; //导入依赖的package包/类
/**
 * Ajoute un filtre en DateField sur une liste de colonnes
 * 
 * @param filterRow
 * @param container
 * @param propertys
 */
private void addDateFilter(String... propertys) {
	for (String property : propertys) {
		HeaderCell cell = getFilterCell(property);
		LocalDateField filterField = new LocalDateField(true);
		filterField.setImmediate(true);
		filterField.setWidth(100, Unit.PERCENTAGE);
		filterField.addValueChangeListener(change -> {
			LocalDate value = filterField.getValue();
			// Can't modify filters so need to replace
			container.removeContainerFilters(property);
			// (Re)create the filter if necessary
			if (value != null) {
				container.addContainerFilter(new SimpleStringFilter(property, value.toString(), true, false));
			}
			fireFilterListener();
		});
		cell.setComponent(filterField);
	}
}
 
开发者ID:EsupPortail,项目名称:esup-ecandidat,代码行数:27,代码来源:GridFormatting.java

示例3: addComboBoxFilters

import com.vaadin.data.util.filter.SimpleStringFilter; //导入依赖的package包/类
/**
 * Ajoute un filtre en combobox String sur une colonne
 * 
 * @param property
 * @param cb
 */
public void addComboBoxFilters(String property, ComboBox cb, String libNull) {
	HeaderCell cell = getFilterCell(property);
	cb.addValueChangeListener(e -> {
		container.removeContainerFilters(property);
		if (cb.getValue() != null && !((String) cb.getValue()).isEmpty()
				&& !((String) cb.getValue()).equals(libNull)) {
			container.addContainerFilter(new SimpleStringFilter(property, (String) cb.getValue(), true, true));
		} else if (cb.getValue() != null && !((String) cb.getValue()).isEmpty()
				&& ((String) cb.getValue()).equals(libNull)) {
			container.addContainerFilter(new IsNull(property));
		}
		fireFilterListener();
		fireFilterListener();
	});
	cb.setImmediate(true);
	cb.setWidth(100, Unit.PERCENTAGE);
	cb.addStyleName(ValoTheme.COMBOBOX_TINY);
	cell.setComponent(cb);
}
 
开发者ID:EsupPortail,项目名称:esup-ecandidat,代码行数:26,代码来源:GridFormatting.java

示例4: equals

import com.vaadin.data.util.filter.SimpleStringFilter; //导入依赖的package包/类
@Override
public boolean equals(Object obj) {
	if (obj == null) {
		return false;
	}

	// Only ones of the objects of the same class can be equal
	if (!(obj instanceof SimpleStringFilter)) {
		return false;
	}
	final SimpleStringFilter o = (SimpleStringFilter) obj;

	// Checks the properties one by one
	if (propertyId != o.getPropertyId() && o.getPropertyId() != null && !o.getPropertyId().equals(propertyId)) {
		return false;
	}
	if (filterString != o.getFilterString() && o.getFilterString() != null
			&& !o.getFilterString().equals(filterString)) {
		return false;
	}
	return true;
}
 
开发者ID:EsupPortail,项目名称:esup-ecandidat,代码行数:23,代码来源:InsensitiveStringFilter.java

示例5: getCategoryFilterListener

import com.vaadin.data.util.filter.SimpleStringFilter; //导入依赖的package包/类
/**
 * @return
 */
private ValueChangeListener getCategoryFilterListener() {
	return new ValueChangeListener() {

		/**
		 * 
		 */
		private static final long serialVersionUID = -2368474286053602744L;

		@SuppressWarnings("unchecked")
		@Override
		public void valueChange(ValueChangeEvent event) {
			String newValue = (String) event.getProperty().getValue();
			BeanItemContainer<VehicleInfo> container = ((BeanItemContainer<VehicleInfo>) grid
					.getContainerDataSource());
			container.removeContainerFilters(CATEGORY);
			if (null != newValue && !newValue.isEmpty()) {
				container.addContainerFilter(new SimpleStringFilter(
						CATEGORY, newValue, true, true));
			}
		}
	};
}
 
开发者ID:KrishnaPhani,项目名称:KrishnasSpace,代码行数:26,代码来源:FilterGrid.java

示例6: addColumn

import com.vaadin.data.util.filter.SimpleStringFilter; //导入依赖的package包/类
protected void addColumn(String propertyId, HeaderRow filterRow) {
    grid.getColumn(propertyId).setEditable(false);
    HeaderCell cell = filterRow.getCell(propertyId);
    TextField filterField = new TextField();
    filterField.setInputPrompt("Filter");
    filterField.setImmediate(true);
    filterField.addStyleName(ValoTheme.TEXTFIELD_TINY);
    filterField.setWidth(100, Unit.PERCENTAGE);
    filterField.addTextChangeListener(change -> {
        container.removeContainerFilters(propertyId);
        if (!change.getText().isEmpty()) {
            container.addContainerFilter(
                    new SimpleStringFilter(propertyId, change.getText(), true, false));
        }
    });
    cell.setComponent(filterField);
}
 
开发者ID:JumpMind,项目名称:metl,代码行数:18,代码来源:EditExcelReaderPanel.java

示例7: filterForString

import com.vaadin.data.util.filter.SimpleStringFilter; //导入依赖的package包/类
protected Container.Filter filterForString(Object propertyId, String pattern) {
    // if ends with one WILDCARD
    if (pattern.endsWith(WILDCARD)) {
        // strip it, and check recursively (to strip any other *'s)
        return filterForString(propertyId, pattern.substring(0, pattern.length()-1));
    } else if (pattern.startsWith(WILDCARD)) {
        // if it starts with a WILDCARD, then strip it
        // and look for the pattern anywhere in the word
        do {
            pattern = pattern.substring(1, pattern.length());
        } while (pattern.startsWith(WILDCARD));
        return new SimpleStringFilter(propertyId, pattern, true, false);
    }

    return new SimpleStringFilter(propertyId, pattern, true, true);
}
 
开发者ID:tyl,项目名称:field-binder,代码行数:17,代码来源:DefaultFilterFactory.java

示例8: testClearToFindOnEmptyFilteredContainer

import com.vaadin.data.util.filter.SimpleStringFilter; //导入依赖的package包/类
@Test
public void testClearToFindOnEmptyFilteredContainer() {
    final FilterableListContainer<Person> container =
            new FilterableListContainer <Person>(Person.class);

    container.setCollection(new ArrayList<Person>(){{
        add(new Person("aa"));
        add(new Person("ab"));
    }});

    container.addContainerFilter(new SimpleStringFilter("name", "x", true, false));


    final FindButtonBar findButtonBar = new FindButtonBar();
    findButtonBar.getNavigation().setContainer(container);

    assertEquals(0, container.size());

    assertButtonsEnabled(findButtonBar.getClearToFindButton());
    assertButtonsDisabled(findButtonBar.getFindButton());
}
 
开发者ID:tyl,项目名称:field-binder,代码行数:22,代码来源:FindButtonBarTest.java

示例9: addContainerFilter

import com.vaadin.data.util.filter.SimpleStringFilter; //导入依赖的package包/类
/**
 * HbnContainer only supports old style addContainerFilter(Object, String, boolean booblean) API and
 * {@link SimpleStringFilter}. Support for this newer API maybe in upcoming versions.
 * 
 * Also note that for complex filtering it is possible to override {@link #getBaseCriteria()} method and add filter
 * so the query directly.
 */
// TODO support new filtering api properly
@Override
public void addContainerFilter(Filter filter) throws UnsupportedFilterException
{
	logger.executionTrace();

	if (!(filter instanceof SimpleStringFilter))
	{
		final String message = "HbnContainer only supports old style addContainerFilter(Object, String, boolean booblean) API";
		throw new UnsupportedFilterException(message);
	}

	final SimpleStringFilter sf = (SimpleStringFilter) filter;
	final String filterString = sf.getFilterString();
	final Object propertyId = sf.getPropertyId();
	final boolean ignoreCase = sf.isIgnoreCase();
	final boolean onlyMatchPrefix = sf.isOnlyMatchPrefix();

	addContainerFilter(propertyId, filterString, "", ignoreCase, onlyMatchPrefix); // TODO: empty string?
}
 
开发者ID:alejandro-du,项目名称:enterprise-app,代码行数:28,代码来源:CustomHbnContainer.java

示例10: removeContainerFilter

import com.vaadin.data.util.filter.SimpleStringFilter; //导入依赖的package包/类
/**
 * This is an internal HbnContainer utility method that removes the given container filter.
 */
@Override
public void removeContainerFilter(Filter filter)
{
	logger.executionTrace();

	// TODO support new filtering api properly
	// TODO the workaround for SimpleStringFilter works wrong, but hopefully will be good enough for now

	if (filter instanceof SimpleStringFilter)
	{
		final SimpleStringFilter sf = (SimpleStringFilter) filter;
		final Object propertyId = sf.getPropertyId();
		removeContainerFilters(propertyId);
	}
}
 
开发者ID:alejandro-du,项目名称:enterprise-app,代码行数:19,代码来源:CustomHbnContainer.java

示例11: getContainerFilter

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

示例12: filter

import com.vaadin.data.util.filter.SimpleStringFilter; //导入依赖的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));
    }
}
 
开发者ID:peholmst,项目名称:vaadin-mockapp,代码行数:17,代码来源:SampleTableView.java

示例13: buildFilter

import com.vaadin.data.util.filter.SimpleStringFilter; //导入依赖的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();
	container.addContainerFilter(new SimpleStringFilter(SiScolEtablissement_.libEtb.getName(), filterString, true, false));
	return null;
}
 
开发者ID:EsupPortail,项目名称:esup-ecandidat,代码行数:10,代码来源:ComboBoxEtablissement.java

示例14: buildFilter

import com.vaadin.data.util.filter.SimpleStringFilter; //导入依赖的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();
	container.addContainerFilter(new SimpleStringFilter(SiScolCommune_.libCom.getName(), filterString, true, false));
	return null;
}
 
开发者ID:EsupPortail,项目名称:esup-ecandidat,代码行数:10,代码来源:ComboBoxCommune.java

示例15: buildFilter

import com.vaadin.data.util.filter.SimpleStringFilter; //导入依赖的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;
}
 
开发者ID:EsupPortail,项目名称:esup-ecandidat,代码行数:13,代码来源:ComboBoxDepartement.java


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