com.vaadin.shared.ui.combobox.FilteringMode Java Examples

The following examples show how to use com.vaadin.shared.ui.combobox.FilteringMode. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: ZookeeperAppClearUI.java    From dubbox with Apache License 2.0 5 votes vote down vote up
/**
 * 创建消费者列表
 * @return
 */
private ComboBox createConsumerBox() {
    consumerBox = new ComboBox("消费者");
    consumerBox.setWidth("100%");
    consumerBox.setFilteringMode(FilteringMode.CONTAINS);
    reloadConsumerBox();
    return consumerBox;
}
 
Example #2
Source File: ZookeeperAppSwitchUI.java    From dubbox with Apache License 2.0 5 votes vote down vote up
/**
 * 创建消费者列表
 * @return
 */
private ComboBox createConsumerBox() {
    consumerBox = new ComboBox("消费者");
    consumerBox.setWidth("100%");
    consumerBox.setFilteringMode(FilteringMode.CONTAINS);
    reloadConsumerBox();
    return consumerBox;
}
 
Example #3
Source File: ZookeeperAppSwitchUI.java    From dubbox with Apache License 2.0 5 votes vote down vote up
/**
 * 创建提供者列表
 * @return
 */
private ComboBox createProviderBox() {
    providerBox = new ComboBox("提供者");
    providerBox.setWidth("100%");
    providerBox.setFilteringMode(FilteringMode.CONTAINS);
    reloadProviderBox();
    return providerBox;
}
 
Example #4
Source File: ZookeeperAppViewUI.java    From dubbox with Apache License 2.0 5 votes vote down vote up
/**
 * 创建查看列表
 * @return
 */
private ComboBox createViewBox() {
    viewBox = new ComboBox();
    viewBox.setWidth("100%");
    viewBox.setFilteringMode(FilteringMode.OFF);
    viewBox.setTextInputAllowed(false);
    reloadConsumerViewBox();
    return viewBox;
}
 
Example #5
Source File: ZookeeperAppClearUI.java    From dubbo-switch with Apache License 2.0 5 votes vote down vote up
/**
 * 创建消费者列表
 * @return
 */
private ComboBox createConsumerBox() {
    consumerBox = new ComboBox("消费者");
    consumerBox.setWidth("100%");
    consumerBox.setFilteringMode(FilteringMode.CONTAINS);
    reloadConsumerBox();
    return consumerBox;
}
 
Example #6
Source File: ZookeeperAppSwitchUI.java    From dubbo-switch with Apache License 2.0 5 votes vote down vote up
/**
 * 创建消费者列表
 * @return
 */
private ComboBox createConsumerBox() {
    consumerBox = new ComboBox("消费者");
    consumerBox.setWidth("100%");
    consumerBox.setFilteringMode(FilteringMode.CONTAINS);
    reloadConsumerBox();
    return consumerBox;
}
 
Example #7
Source File: ZookeeperAppSwitchUI.java    From dubbo-switch with Apache License 2.0 5 votes vote down vote up
/**
 * 创建提供者列表
 * @return
 */
private ComboBox createProviderBox() {
    providerBox = new ComboBox("提供者");
    providerBox.setWidth("100%");
    providerBox.setFilteringMode(FilteringMode.CONTAINS);
    reloadProviderBox();
    return providerBox;
}
 
Example #8
Source File: ZookeeperAppViewUI.java    From dubbo-switch with Apache License 2.0 5 votes vote down vote up
/**
 * 创建查看列表
 * @return
 */
private ComboBox createViewBox() {
    viewBox = new ComboBox();
    viewBox.setWidth("100%");
    viewBox.setFilteringMode(FilteringMode.OFF);
    viewBox.setTextInputAllowed(false);
    reloadConsumerViewBox();
    return viewBox;
}
 
Example #9
Source File: DistributionSetSelectComboBox.java    From hawkbit with Eclipse Public License 1.0 5 votes vote down vote up
private void initDataSource() {
    final Container container = createContainer();
    container.addContainerProperty(SPUILabelDefinitions.VAR_NAME_VERSION, String.class, null);

    setItemCaptionMode(ItemCaptionMode.PROPERTY);
    setItemCaptionPropertyId(SPUILabelDefinitions.VAR_NAME_VERSION);
    setFilteringMode(FilteringMode.CONTAINS);

    setContainerDataSource(container);
}
 
Example #10
Source File: DistributionSetSelectComboBox.java    From hawkbit with Eclipse Public License 1.0 5 votes vote down vote up
/**
 * Overriden not to update the filter when the filterstring (value of
 * combobox input) was not changed. Otherwise, it would lead to additional
 * database requests during combobox page change while scrolling instead of
 * retreiving items from container cache.
 * 
 * @param filterString
 *            value of combobox input
 * @param filteringMode
 *            the filtering mode (starts_with, contains)
 * @return SimpleStringFilter to transfer filterstring in container
 */
@Override
protected Filter buildFilter(final String filterString, final FilteringMode filteringMode) {
    if (filterStringIsNotChanged(filterString)) {
        return null;
    }

    final Filter filter = super.buildFilter(filterString, filteringMode);

    refreshContainerIfFilterStringBecomesEmpty(filterString);

    lastFilterString = filterString;
    return filter;
}
 
Example #11
Source File: TargetBulkUpdateWindowLayout.java    From hawkbit with Eclipse Public License 1.0 5 votes vote down vote up
private ComboBox getDsComboField() {
    final Container container = createContainer();
    final ComboBox dsComboBox = SPUIComponentProvider.getComboBox(i18n.getMessage("bulkupload.ds.name"), "", null,
            null, false, "", i18n.getMessage("bulkupload.ds.name"));
    dsComboBox.setSizeUndefined();
    dsComboBox.addStyleName(SPUIDefinitions.BULK_UPLOD_DS_COMBO_STYLE);
    dsComboBox.setImmediate(true);
    dsComboBox.setFilteringMode(FilteringMode.STARTSWITH);
    dsComboBox.setPageLength(7);
    dsComboBox.setContainerDataSource(container);
    dsComboBox.setItemCaptionPropertyId(SPUILabelDefinitions.VAR_NAME_VERSION);
    dsComboBox.setId(UIComponentIdProvider.BULK_UPLOAD_DS_COMBO);
    dsComboBox.setWidth("100%");
    return dsComboBox;
}
 
Example #12
Source File: AttributeValueEditorWindow.java    From XACML with MIT License 4 votes vote down vote up
protected void initializeCombo() {
	this.comboBoxDatatype.setContainerDataSource(((XacmlAdminUI) UI.getCurrent()).getDatatypes());
	this.comboBoxDatatype.setItemCaptionMode(ItemCaptionMode.PROPERTY);
	this.comboBoxDatatype.setItemCaptionPropertyId("xacmlId");
	this.comboBoxDatatype.setFilteringMode(FilteringMode.CONTAINS);
	this.comboBoxDatatype.setImmediate(true);
	this.comboBoxDatatype.setNullSelectionAllowed(false);
	this.comboBoxDatatype.setConverter(new SingleSelectConverter<Object>(this.comboBoxDatatype));
	//
	// Select a value if its defined
	//
	if (this.datatypeRestriction != null) {
		this.comboBoxDatatype.select(this.datatypeRestriction.getId());
	} else if (this.value.getDataType() != null) {
		this.comboBoxDatatype.select(JPAUtils.findDatatype(this.value.getDataType()).getId());
	}
	//
	// Can the user change the datatype?
	//
	if (this.datatypeRestriction != null) {
		this.comboBoxDatatype.setEnabled(false);
		return;
	}
	//
	// Listen to events
	//
	this.comboBoxDatatype.addValueChangeListener(new ValueChangeListener() {
		private static final long serialVersionUID = 1L;

		@Override
		public void valueChange(ValueChangeEvent event) {
			Object id = self.comboBoxDatatype.getValue();
			assert (id != null);
			//
			// Get the entity and save it
			//
			EntityItem<Datatype> entity = ((XacmlAdminUI) UI.getCurrent()).getDatatypes().getItem(id);
			self.value.setDataType(entity.getEntity().getXacmlId());
			//
			// Reset the validator
			//
			self.textFieldValue.removeAllValidators();
			Validator validator = ValidatorFactory.newInstance(entity.getEntity());
			if (validator != null) {
				self.textFieldValue.addValidator(validator);
			}
		}
	});
}
 
Example #13
Source File: SchemaSelectorComponent.java    From RDFUnit with Apache License 2.0 4 votes vote down vote up
public SchemaSelectorComponent() {

        VerticalLayout p = new VerticalLayout();
        addComponent(p);

        //Label
        p.addComponent(new Label("Test against the following schemas"));

        // generate container
        Container tokens = generateTestContainer();

        VerticalLayout lo = new VerticalLayout();
        lo.setSpacing(true);

        //Taken/adapted from Vaadin:TokenField example
        tokenField = new TokenField(lo) {

            // dialog if not in 'address book', otherwise just add
            @Override protected void onTokenInput(Object tokenId) {
                Set<Object> set = (Set<Object>) getValue();
                SchemaSource s = null;
                if (tokenId != null) {
                    if (tokenId instanceof SchemaSource) {
                        s = SchemaSourceFactory.copySchemaSource((SchemaSource) tokenId);
                    }
                    if (tokenId instanceof String) {
                        Optional<SchemaSource> src = SchemaService.getSourceFromPrefix(RDFUnitDemoSession.getBaseDir(), (String) tokenId);
                        if (src.isPresent()) {
                            s = SchemaSourceFactory.copySchemaSource(src.get());
                        }
                    }
                }


                if (set != null && set.contains(s)) {
                    // duplicate
                    Notification.show(getTokenCaption(tokenId)
                            + " already exists");
                } else {
                    if (s == null || !cb.containsId(s)) {
                        // don't add directly,
                        // show custom "add to address book" dialog
                        UI.getCurrent().addWindow(new EditContactWindow(
                                tokenId != null ? tokenId.toString() : "", this));
                    } else {
                        // it's in the 'address book', just add
                        addToken(SchemaSourceFactory.copySchemaSource(s));
                    }
                }
            }

            // show confirm dialog
            @Override protected void onTokenClick(final Object tokenId) {
                UI.getCurrent().addWindow(
                        new RemoveWindow((SchemaSource) tokenId, this));
            }

            // just delete, no confirm
            @Override protected void onTokenDelete(Object tokenId) {
                this.removeToken(tokenId);
            }

            // custom caption + style if not in 'address book'
            @Override protected void configureTokenButton(Object tokenId,
                                                Button button) {
                super.configureTokenButton(tokenId, button);
                // custom caption
                button.setCaption(tokenId.toString());
                // width
                button.setWidth("100%");

                if (!cb.containsId(tokenId)) {
                    // it's not in the address book; style
                    button
                            .addStyleName(TokenField.STYLE_BUTTON_EMPHAZISED);
                }
            }
        };
        p.addComponent(tokenField);
        // This would turn on the "fake tekstfield" look:
        tokenField.setStyleName(TokenField.STYLE_TOKENFIELD);
        tokenField.setWidth("100%");
        tokenField.setInputWidth("100%");
        tokenField.setContainerDataSource(tokens); // 'address book'
        tokenField.setFilteringMode(FilteringMode.CONTAINS); // suggest
        tokenField.setInputPrompt("Enter prefix or URI");
        tokenField.setRememberNewTokens(false); // we'll do this via the dialog
        tokenField.setImmediate(true);
    }