Java 类com.vaadin.ui.AbstractTextField.TextChangeEventMode 实例源码

项目:metl    文件:EditTextConstant.java   
protected void buildUI() {
    ButtonBar buttonBar = new ButtonBar();
    addComponent(buttonBar);

    editor = CommonUiUtils.createAceEditor();
    editor.setTextChangeEventMode(TextChangeEventMode.LAZY);
    editor.setTextChangeTimeout(200);
    editor.setMode(AceMode.text);
    editor.setValue(component.get(TextConstant.SETTING_TEXT));
    editor.addTextChangeListener(new TextChangeListener() {
        public void textChange(TextChangeEvent event) {
            Setting data = component.findSetting(TextConstant.SETTING_TEXT);
            data.setValue(event.getText());
            context.getConfigurationService().save(data);
        }
    });

    addComponent(editor);
    setExpandRatio(editor, 1);
}
项目:metl    文件:EditWebPanel.java   
protected void buildUI() {
    ButtonBar buttonBar = new ButtonBar();
    addComponent(buttonBar);

    editor = CommonUiUtils.createAceEditor();
    editor.setTextChangeEventMode(TextChangeEventMode.LAZY);
    editor.setTextChangeTimeout(200);
    editor.setMode(AceMode.xml);
    editor.setValue(component.get(Web.BODY_TEXT));
    editor.addTextChangeListener(new TextChangeListener() {
        public void textChange(TextChangeEvent event) {
            component.put(Web.BODY_TEXT, event.getText());
            context.getConfigurationService().save(component.findSetting(Web.BODY_TEXT));
        }
    });

    addComponent(editor);
    setExpandRatio(editor, 1);
}
项目:hawkbit    文件:AutoCompleteTextFieldComponent.java   
private TextField createSearchField() {
    final TextField textField = new TextFieldBuilder().immediate(true).id(UIComponentIdProvider.CUSTOM_FILTER_QUERY)
            .maxLengthAllowed(SPUILabelDefinitions.TARGET_FILTER_QUERY_TEXT_FIELD_LENGTH).buildTextComponent();
    textField.addStyleName("target-filter-textfield");
    textField.setWidth(900.0F, Unit.PIXELS);
    textField.setTextChangeEventMode(TextChangeEventMode.EAGER);
    textField.setImmediate(true);
    textField.setTextChangeTimeout(100);
    return textField;
}
项目:hawkbit    文件:AbstractMetadataPopupLayout.java   
private TextField createKeyTextField() {
    final TextField keyField = new TextFieldBuilder().caption(i18n.getMessage("textfield.key")).required(true)
            .prompt(i18n.getMessage("textfield.key")).immediate(true)
            .id(UIComponentIdProvider.METADATA_KEY_FIELD_ID).maxLengthAllowed(MetaData.KEY_MAX_SIZE)
            .buildTextComponent();
    keyField.addTextChangeListener(this::onKeyChange);
    keyField.setTextChangeEventMode(TextChangeEventMode.EAGER);
    keyField.setWidth("100%");
    return keyField;
}
项目:hawkbit    文件:AbstractMetadataPopupLayout.java   
private TextArea createValueTextField() {
    valueTextArea = new TextAreaBuilder().caption(i18n.getMessage("textfield.value")).required(true)
            .prompt(i18n.getMessage("textfield.value")).immediate(true).id(UIComponentIdProvider.METADATA_VALUE_ID)
            .maxLengthAllowed(MetaData.VALUE_MAX_SIZE).buildTextComponent();
    valueTextArea.setNullRepresentation("");
    valueTextArea.setSizeFull();
    valueTextArea.setHeight(100, Unit.PERCENTAGE);
    valueTextArea.addTextChangeListener(this::onValueChange);
    valueTextArea.setTextChangeEventMode(TextChangeEventMode.EAGER);
    return valueTextArea;
}
项目:hawkbit    文件:TextFieldBuilder.java   
/**
 * Create a search text field.
 * 
 * @param textChangeListener
 *            listener when text is changed.
 * @return the textfield
 */
public TextField createSearchField(final TextChangeListener textChangeListener) {
    final TextField textField = style("filter-box").styleName("text-style filter-box-hide").buildTextComponent();
    textField.setWidth(100.0F, Unit.PERCENTAGE);
    textField.addTextChangeListener(textChangeListener);
    textField.setTextChangeEventMode(TextChangeEventMode.LAZY);
    // 1 seconds timeout.
    textField.setTextChangeTimeout(1000);
    return textField;
}
项目:metl    文件:ButtonBar.java   
public TextField addFilter() {
    TextField textField = new TextField();
    textField.setColumns(15);
    textField.addStyleName(ValoTheme.TEXTFIELD_INLINE_ICON);
    textField.setInputPrompt("Filter");
    textField.setIcon(FontAwesome.SEARCH);
    textField.setTextChangeEventMode(TextChangeEventMode.LAZY);
    textField.setTextChangeTimeout(500);
    textField.setNullRepresentation("");
    wrapper.addComponent(textField);
    wrapper.setComponentAlignment(textField, Alignment.BOTTOM_RIGHT);
    return textField;
}
项目:holon-vaadin7    文件:NumberField.java   
@Override
public NumberInputBuilder<T> textChangeEventMode(TextChangeEventMode inputEventMode) {
    getInstance().setTextChangeEventMode(inputEventMode);
    return builder();
}
项目:holon-vaadin7    文件:AbstractStringFieldBuilder.java   
@Override
public StringInputBuilder textChangeEventMode(TextChangeEventMode inputEventMode) {
    getInstance().setTextChangeEventMode(inputEventMode);
    return builder();
}
项目:metl    文件:EditMappingPanel.java   
protected void buildUI() {
    ButtonBar buttonBar = new ButtonBar();
    if (!readOnly) {
        addComponent(buttonBar);
        Button autoMapButton = buttonBar.addButton("Auto Map", FontAwesome.FLASH);
        removeButton = buttonBar.addButton("Remove", FontAwesome.TRASH_O);
        removeButton.setEnabled(false);
        autoMapButton.addClickListener(new AutoMapListener());
        removeButton.addClickListener(new RemoveListener());
    }
    buttonBar.addButtonRight("Export", FontAwesome.DOWNLOAD, (e)->export());

    HorizontalLayout titleHeader = new HorizontalLayout();
    titleHeader.setSpacing(true);
    titleHeader.setMargin(new MarginInfo(false, true, false, true));
    titleHeader.setWidth(100f, Unit.PERCENTAGE);
    titleHeader.addComponent(
            new Label("<b>Input Model:</b> &nbsp;" + (component.getInputModel() != null ? component.getInputModel().getName() : "?"),
                    ContentMode.HTML));
    titleHeader.addComponent(
            new Label("<b>Output Model:</b> &nbsp;" + (component.getOutputModel() != null ? component.getOutputModel().getName() : "?"),
                    ContentMode.HTML));
    addComponent(titleHeader);

    HorizontalLayout filterHeader = new HorizontalLayout();
    filterHeader.setSpacing(true);
    filterHeader.setMargin(new MarginInfo(true, true, true, true));
    filterHeader.setWidth(100f, Unit.PERCENTAGE);
    HorizontalLayout srcFilterHeader = new HorizontalLayout();
    srcFilterHeader.setSpacing(true);
    srcFilterHeader.setDefaultComponentAlignment(Alignment.MIDDLE_LEFT);
    filterHeader.addComponent(srcFilterHeader);
    HorizontalLayout dstFilterHeader = new HorizontalLayout();
    dstFilterHeader.setSpacing(true);
    dstFilterHeader.setDefaultComponentAlignment(Alignment.MIDDLE_LEFT);
    filterHeader.addComponent(dstFilterHeader);
    addComponent(filterHeader);

    srcTextFilter = new TextField();
    srcTextFilter.setWidth(20, Unit.EM);
    srcTextFilter.setInputPrompt("Filter");
    srcTextFilter.addStyleName(ValoTheme.TEXTFIELD_INLINE_ICON);
    srcTextFilter.setIcon(FontAwesome.SEARCH);
    srcTextFilter.setImmediate(true);
    srcTextFilter.setTextChangeEventMode(TextChangeEventMode.LAZY);
    srcTextFilter.setTextChangeTimeout(200);
    srcTextFilter.addTextChangeListener(new FilterInputTextListener());
    srcFilterHeader.addComponent(srcTextFilter);

    srcMapFilter = new CheckBox("Mapped Only");
    srcMapFilter.addValueChangeListener(new FilterSrcMapListener());
    srcFilterHeader.addComponent(srcMapFilter);

    dstTextFilter = new TextField();
    dstTextFilter.setWidth(20, Unit.EM);
    dstTextFilter.setInputPrompt("Filter");
    dstTextFilter.addStyleName(ValoTheme.TEXTFIELD_INLINE_ICON);
    dstTextFilter.setIcon(FontAwesome.SEARCH);
    dstTextFilter.setImmediate(true);
    dstTextFilter.setTextChangeEventMode(TextChangeEventMode.LAZY);
    dstTextFilter.setTextChangeTimeout(200);
    dstTextFilter.addTextChangeListener(new FilterOutputTextListener());
    dstFilterHeader.addComponent(dstTextFilter);

    dstMapFilter = new CheckBox("Mapped Only");
    dstMapFilter.addValueChangeListener(new FilterDstMapListener());
    dstFilterHeader.addComponent(dstMapFilter);

    Panel panel = new Panel();
    VerticalLayout vlay = new VerticalLayout();
    vlay.setSizeFull();
    diagram = new MappingDiagram(context, component, readOnly);
    diagram.setSizeFull();
    vlay.addComponent(diagram);
    panel.setContent(vlay);
    panel.setSizeFull();
    addComponent(panel);
    setExpandRatio(panel, 1.0f);
    diagram.addListener(new EventListener());
}
项目:metl    文件:EditFlowPalette.java   
public EditFlowPalette(EditFlowPanel designFlowLayout, ApplicationContext context, String projectVersionId) {
    this.context = context;
    this.designFlowLayout = designFlowLayout;
    this.projectVersionId = projectVersionId;

    final int WIDTH = 150;

    setHeight(100, Unit.PERCENTAGE);
    setWidth(WIDTH, Unit.PIXELS);

    HorizontalLayout topWrapper = new HorizontalLayout();
    topWrapper.setMargin(new MarginInfo(true, false, false, false));
    HorizontalLayout top = new HorizontalLayout();
    top.addStyleName(ButtonBar.STYLE);
    top.setMargin(true);
    topWrapper.addComponent(top);

    addComponent(topWrapper);

    TextField filterField = new TextField();
    filterField.setWidth(WIDTH-30, Unit.PIXELS);
    filterField.setInputPrompt("Filter");
    filterField.addStyleName(ValoTheme.TEXTFIELD_INLINE_ICON);
    filterField.setIcon(FontAwesome.SEARCH);
    filterField.setImmediate(true);
    filterField.setTextChangeEventMode(TextChangeEventMode.LAZY);
    filterField.setTextChangeTimeout(200);
    filterField.addTextChangeListener((event) -> {
        filterText = event.getText().toLowerCase();
        populateComponentPalette();
    });
    top.addComponent(filterField);

    Panel panel = new Panel();
    panel.setSizeFull();
    panel.addStyleName(ValoTheme.PANEL_BORDERLESS);
    panel.addStyleName(ValoTheme.PANEL_SCROLL_INDICATOR);

    componentLayout = new VerticalLayout();
    componentLayout.setMargin(new MarginInfo(true, false, false, false));
    componentLayout.addStyleName("scrollable");
    panel.setContent(componentLayout);

    addComponent(panel);
    setExpandRatio(panel, 1);

    populateComponentPalette();

}
项目:VaadinUtils    文件:SearchableGrid.java   
protected AbstractLayout buildSearchBar()
{
    final VerticalLayout layout = new VerticalLayout();
    layout.setWidth(100, Unit.PERCENTAGE);
    searchField.setWidth(100, Unit.PERCENTAGE);
    searchBar = layout;

    basicSearchLayout = new HorizontalLayout();
    basicSearchLayout.setWidth(100, Unit.PERCENTAGE);
    layout.addComponent(basicSearchLayout);

    final AbstractLayout advancedSearch = buildAdvancedSearch();
    if (advancedSearch != null)
    {
        basicSearchLayout.addComponent(advancedSearchButton);
    }

    searchField.setInputPrompt("Search");
    searchField.setId("searchField");
    searchField.setTextChangeEventMode(TextChangeEventMode.LAZY);
    searchField.setImmediate(true);
    searchField.addTextChangeListener(new TextChangeListener()
    {
        private static final long serialVersionUID = 1L;

        @Override
        public void textChange(final TextChangeEvent event)
        {
            filterString = event.getText().trim();
            triggerFilter(filterString);
        }

    });

    // clear button
    final Button clear = createClearButton();

    basicSearchLayout.addComponent(clear);
    basicSearchLayout.setComponentAlignment(clear, Alignment.MIDDLE_LEFT);
    basicSearchLayout.addComponent(searchField);
    basicSearchLayout.setExpandRatio(searchField, 1.0f);

    searchField.focus();

    return layout;
}
项目:VaadinUtils    文件:SearchableSelectableEntityTable.java   
protected AbstractLayout buildSearchBar()
{
    VerticalLayout layout = new VerticalLayout();
    layout.setWidth(100, Unit.PERCENTAGE);
    searchField.setWidth(100, Unit.PERCENTAGE);
    searchBar = layout;

    HorizontalLayout basicSearchLayout = new HorizontalLayout();
    basicSearchLayout.setWidth(100, Unit.PERCENTAGE);
    layout.addComponent(basicSearchLayout);

    AbstractLayout advancedSearch = buildAdvancedSearch();
    if (advancedSearch != null)
    {
        basicSearchLayout.addComponent(advancedSearchCheckbox);
    }

    searchField.setInputPrompt("Search");
    searchField.setId("searchField");
    searchField.setTextChangeEventMode(TextChangeEventMode.LAZY);
    searchField.setImmediate(true);
    searchField.addTextChangeListener(new TextChangeListener()
    {
        private static final long serialVersionUID = 1L;

        @Override
        public void textChange(final TextChangeEvent event)
        {
            filterString = event.getText().trim();
            triggerFilter(filterString);
        }

    });

    // clear button
    Button clear = createClearButton();
    basicSearchLayout.addComponent(clear);
    basicSearchLayout.setComponentAlignment(clear, Alignment.MIDDLE_CENTER);

    basicSearchLayout.addComponent(searchField);
    basicSearchLayout.setExpandRatio(searchField, 1.0f);

    searchField.focus();

    return layout;
}
项目:eywa    文件:DemoUI.java   
@Override
protected void init(VaadinRequest request) {

    VerticalLayout center = new VerticalLayout();
    setContent(center);
    center.setSizeFull();

    VerticalLayout layout = new VerticalLayout();
    layout.setMargin(true);
    layout.setSizeUndefined();
    center.addComponent(layout);
    center.setComponentAlignment(layout, Alignment.MIDDLE_CENTER);

    EywaProperty<String> p = new EywaProperty<String>("shared-textfield",
            String.class);
    if (p.getValue() == null) {
        p.setValue("Share text area");
    }
    final TextArea ta = new TextArea(p);
    ta.setWidth("300px");
    ta.setHeight("200px");
    layout.addComponent(ta);
    ta.setTextChangeEventMode(TextChangeEventMode.EAGER);
    ta.addTextChangeListener(new TextChangeListener() {
        public void textChange(TextChangeEvent event) {
            ta.setValue(event.getText());
        }
    });

    final Slider slider = new Slider(0.0, 100.0, 1);
    slider.setPropertyDataSource(new EywaProperty<Double>("shared-slider",
            Double.class));
    layout.addComponent(slider);
    slider.setImmediate(true);
    layout.addComponent(slider);
    slider.setWidth("300px");

    layout.addComponent(new Link("Open this in new window",
            new ExternalResource(getPage().getLocation().toString()), ""
                    + System.currentTimeMillis(), 400, 300,
            BorderStyle.MINIMAL));
}
项目:holon-vaadin7    文件:NumberField.java   
/**
 * Sets the mode how the TextField triggers {@link TextChangeEvent}s.
 * @param inputEventMode the new mode
 * @see TextChangeEventMode
 */
public void setTextChangeEventMode(TextChangeEventMode inputEventMode) {
    getInternalField().setTextChangeEventMode(inputEventMode);
}
项目:holon-vaadin7    文件:NumberField.java   
/**
 * Gets the current {@link TextChangeEventMode}
 * @return the mode used to trigger {@link TextChangeEvent}s.
 */
public TextChangeEventMode getTextChangeEventMode() {
    return getInternalField().getTextChangeEventMode();
}
项目:holon-vaadin7    文件:TextInputBuilder.java   
/**
 * Sets the mode how the TextField triggers {@link TextChangeEvent}s.
 * @param inputEventMode the new mode
 * @see TextChangeEventMode
 * @return this
 */
B textChangeEventMode(TextChangeEventMode inputEventMode);