Package com.vaadin.ui

Examples of com.vaadin.ui.TextField


    Log l = new Log(10);

    @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()
                        + ", text content currently:'" + event.getText()
                        + "' Cursor at index:" + event.getCursorPosition());
            }
        };

        tf.addListener(inputEventListener);

        getLayout().addComponent(tf);

        TextField eager = new TextField("Eager");
        eager.addListener(inputEventListener);
        eager.setTextChangeEventMode(TextChangeEventMode.EAGER);
        getLayout().addComponent(eager);

        TextField to = new TextField("Timeout 3s");
        to.addListener(inputEventListener);
        to.setTextChangeEventMode(TextChangeEventMode.TIMEOUT);
        to.setTextChangeTimeout(3000);
        getLayout().addComponent(to);

        TextArea ta = new TextArea("Default text area");
        ta.addListener(inputEventListener);
        getLayout().addComponent(ta);
View Full Code Here


        GridLayout layout = new GridLayout(2, 2);
        layout.setSpacing(true);

        @SuppressWarnings("unused")
        int nr = 5;
        TextField tf;
        tf = new TextField("TextField (tabIndex 1)");
        tf.setTabIndex(1);
        tf.focus();
        layout.addComponent(tf);
        layout.addComponent(new TextField("TextField without tab index"));
        layout.addComponent(new TextField("TextField without tab index"));
        layout.addComponent(new TextField("TextField without tab index"));
        layout.addComponent(new TextField("TextField without tab index"));
        tf = new TextField("TextField (tabIndex 2)");
        tf.setTabIndex(2);
        layout.addComponent(tf);

        w.setContent(layout);
    }
View Full Code Here

        VerticalLayout layout = new VerticalLayout();
        layout.setMargin(true);
        final Window window = new Window("Focus test window", layout);
        layout.setSizeUndefined();

        layout.addComponent(new TextField());
        window.addListener(new FocusListener() {
            @Override
            public void focus(FocusEvent event) {
                Notification.show("Focused window");
            }
        });

        window.addListener(new BlurListener() {
            @Override
            public void blur(BlurEvent event) {
                Notification.show("Blurred window");
            }
        });

        window.addActionHandler(new Handler() {

            private Action[] s = new Action[] { new ShortcutAction("^Save") };

            @Override
            public Action[] getActions(Object target, Object sender) {
                return s;
            }

            @Override
            public void handleAction(Action action, Object sender, Object target) {
                Notification.show("Action!");
            }
        });

        UI main = getLayout().getUI();

        main.addWindow(window);

        ((ComponentContainer) main.getContent()).addComponent(new TextField());

        Button button = new Button("Bring to front (should focus too)",
                new Button.ClickListener() {
                    @Override
                    public void buttonClick(ClickEvent event) {
View Full Code Here

        setMainWindow(w);

        int index = 1;

        GridLayout layout = new GridLayout(2, 2);
        TextField f1 = new TextField("1");
        f1.setTabIndex(index++);
        TextField f2 = new TextField("2");
        f2.setTabIndex(index++);

        DateField f3 = new DateField("3");
        f3.setTabIndex(index++);
        ComboBox cb = new ComboBox("4");
        cb.setTabIndex(index++);
View Full Code Here

    @Override
    protected void setUp() throws Exception {
        super.setUp();

        field = new TextField();
        field.setInvalidAllowed(false);
        property = new ObjectProperty<String>("original");
        field.setPropertyDataSource(property);
    }
View Full Code Here

    @Override
    protected void setUp() throws Exception {
        super.setUp();

        field = new TextField() {
            @Override
            public void markAsDirty() {
                repainted++;
                super.markAsDirty();
            }
View Full Code Here

    @Override
    protected void setUp() throws Exception {
        super.setUp();

        field = new TextField();
        field.setInvalidAllowed(false);
    }
View Full Code Here

        testDefaultAlignment(horizontalLayout);
    }

    public void testDefaultAlignment(AbstractOrderedLayout layout) {
        Label label = new Label("A label");
        TextField tf = new TextField("A TextField");
        layout.addComponent(label);
        layout.addComponent(tf);
        Assert.assertEquals(Alignment.TOP_LEFT,
                layout.getComponentAlignment(label));
        Assert.assertEquals(Alignment.TOP_LEFT,
View Full Code Here

        testAlteredDefaultAlignment(horizontalLayout);
    }

    public void testAlteredDefaultAlignment(AbstractOrderedLayout layout) {
        Label label = new Label("A label");
        TextField tf = new TextField("A TextField");
        layout.setDefaultComponentAlignment(Alignment.MIDDLE_CENTER);
        layout.addComponent(label);
        layout.addComponent(tf);
        Assert.assertEquals(Alignment.MIDDLE_CENTER,
                layout.getComponentAlignment(label));
View Full Code Here

                    field.addValidator(new AlwaysFailValidator());
                }
            }
        };

        form.addField("Field", new TextField("Text"));
        form.addField("Date", new DateField("Date"));
        // not good for automated testing with screenshots when null
        // form.addField("Inline Date", new InlineDateField("Date"));
        // same as basic DateField
        // form.addField("Popup Date", new PopupDateField("Date"));
View Full Code Here

TOP

Related Classes of com.vaadin.ui.TextField

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.