Package com.vaadin.event.FieldEvents

Examples of com.vaadin.event.FieldEvents.TextChangeListener


                                ".red { background:red;} "
                                        + ".green { background:green;} .blue { background:blue;} .cyan { background:cyan;} .magenta { background:magenta;}");
            }
        };
        tf2.setTextChangeEventMode(TextChangeEventMode.EAGER);
        tf2.addListener(new TextChangeListener() {
            @Override
            public void textChange(TextChangeEvent event) {
                tf2.setStyleName(getNextStyle());
            }
View Full Code Here


    public void addListener(AbstractField newField) {
        AbstractTextField newTextField = (AbstractTextField) newField;
        newTextField.setTextChangeEventMode(TextChangeEventMode.EAGER);

        newTextField.addListener(new TextChangeListener() {
            @Override
            public void textChange(TextChangeEvent event) {
                AbstractTextField component = (AbstractTextField) event
                        .getComponent();
                cursorPosition.setValue(String.valueOf(component
View Full Code Here

    @Override
    public void setup() {
        TextField tf = new TextField();
        tf.setTextChangeEventMode(TextChangeEventMode.TIMEOUT);
        tf.setTextChangeTimeout(500);
        tf.addListener(new TextChangeListener() {
            @Override
            public void textChange(TextChangeEvent event) {
                log.log("TextChangeEvent: " + event.getText());
            }
        });
View Full Code Here

    protected void setup() {

        final TextField tf = new TextField("Debug");
        getLayout().addComponent(tf);

        tf.addListener(new TextChangeListener() {
            @Override
            public void textChange(TextChangeEvent event) {
                tf.setValue(event.getText());
            }
        });
View Full Code Here

    @Override
    protected void setup() {

        TextField tf = new TextField("Default");

        TextChangeListener inputEventListener = new TextChangeListener() {

            @Override
            public void textChange(TextChangeEvent event) {
                l.log("Text change event for  "
                        + event.getComponent().getCaption()
View Full Code Here

    @Override
    protected void setup() {

        TextField tf = new TextField("Default");

        TextChangeListener inputEventListener = new TextChangeListener() {

            @Override
            public void textChange(TextChangeEvent event) {
                l.log("Text change event, text content currently:'"
                        + event.getText() + "' Cursor at index:"
View Full Code Here

    protected void setup() {
        final TextField field = new TextField();
        field.setImmediate(false);
        field.setTextChangeTimeout(2000);
        field.setTextChangeEventMode(TextChangeEventMode.TIMEOUT);
        field.addListener(new TextChangeListener() {
            @Override
            public void textChange(TextChangeEvent event) {
                // Need to add a listener for events to occur
            }
        });
View Full Code Here

    @Override
    protected void setup() {

        final TextField tf1 = new TextField("Updates value");
        tf1.setTextChangeEventMode(TextChangeEventMode.EAGER);
        tf1.addListener(new TextChangeListener() {
            @Override
            public void textChange(TextChangeEvent event) {
                String text = event.getText();
                if (!text.matches("[a-z]*")) {
                    String newValue = text.replaceAll("[^a-z]", "");
                    tf1.setValue(newValue);
                }
            }
        });

        final TextField tf2 = new TextField("Updates width");
        tf2.setTextChangeEventMode(TextChangeEventMode.EAGER);
        tf2.addListener(new TextChangeListener() {
            @Override
            public void textChange(TextChangeEvent event) {
                String text = event.getText();
                if (!text.matches("[a-z]*")) {
                    tf2.setWidth("100px");
View Full Code Here

        {
            final TextField tf = new TextField("Debug");
            getLayout().addComponent(tf);

            tf.addListener(new TextChangeListener() {
                @Override
                public void textChange(TextChangeEvent event) {
                    System.err.println(tf.getCaption() + " textChange");
                }
            });

            tf.addListener(new ValueChangeListener() {
                @Override
                public void valueChange(ValueChangeEvent event) {
                    System.err.println(tf.getCaption() + " valueChange");
                }
            });

            tf.addListener(new BlurListener() {

                @Override
                public void blur(BlurEvent event) {
                    System.err.println(tf.getCaption() + " blur");
                }
            });

            tf.addListener(new FocusListener() {
                @Override
                public void focus(FocusEvent event) {
                    System.err.println(tf.getCaption() + " focus");
                }
            });

        }

        {
            final TextField tf = new TextField("Label");
            getLayout().addComponent(tf);
            final Label l = new Label();
            getLayout().addComponent(l);
            tf.addListener(new TextChangeListener() {
                @Override
                public void textChange(TextChangeEvent event) {
                    l.setValue(event.getText());
                }
            });

            tf.addListener(new ValueChangeListener() {
                @Override
                public void valueChange(ValueChangeEvent event) {
                    System.err.println(tf.getCaption() + " valueChange");
                }
            });

        }

        {
            final TextField tf = new TextField("Slow label");
            tf.setTextChangeTimeout(2000);
            tf.setImmediate(true);
            getLayout().addComponent(tf);
            final Label l = new Label();
            getLayout().addComponent(l);
            tf.addListener(new TextChangeListener() {

                @Override
                public void textChange(TextChangeEvent event) {
                    l.setValue(event.getText());
                }
            });

            tf.addListener(new ValueChangeListener() {
                @Override
                public void valueChange(ValueChangeEvent event) {
                    System.err.println(tf.getCaption() + " valueChange");
                }
            });

        }

        {
            final TextField tf = new TextField("Uppercase");
            tf.setTextChangeTimeout(1);
            getLayout().addComponent(tf);
            final Label l = new Label();
            getLayout().addComponent(l);
            tf.addListener(new TextChangeListener() {

                @Override
                public void textChange(TextChangeEvent event) {
                    tf.setValue(event.getText().toUpperCase());
                }
            });

            tf.addListener(new ValueChangeListener() {
                @Override
                public void valueChange(ValueChangeEvent event) {
                    System.err.println(tf.getCaption() + " valueChange");
                }
            });

        }

        {
            final TextField[] tfs = new TextField[] { new TextField(),
                    new TextField(), new TextField(), new TextField() };
            HorizontalLayout hl = new HorizontalLayout();
            hl.setCaption("Blää");
            getLayout().addComponent(hl);
            for (TextField tf : tfs) {
                tf.setColumns(4);
                tf.setTextChangeEventMode(TextChangeEventMode.EAGER);
                hl.addComponent(tf);

                tf.addListener(new TextChangeListener() {

                    @Override
                    public void textChange(TextChangeEvent event) {
                        String txt = event.getText();
                        int len = txt.length();
View Full Code Here

    }

    private TextField makeTextField(final String colType) {
        TextField t = new TextField(colType);

        t.addListener(new TextChangeListener() {
            SimpleStringFilter filter = null;

            public void textChange(TextChangeEvent event) {
                Filterable f = (Filterable) m_table.getContainerDataSource();
View Full Code Here

TOP

Related Classes of com.vaadin.event.FieldEvents.TextChangeListener

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.