Package com.vaadin.ui

Examples of com.vaadin.ui.TextField


        final LegacyWindow mainWin = new LegacyWindow(
                "Test app for max length feature");
        setMainWindow(mainWin);

        final TextField tx = new TextField(
                "Textfield with maxlenght 10, single row");
        tx.setImmediate(true);
        tx.setMaxLength(10);

        final Label l = new Label();

        Button b = new Button("Check value");
        b.addListener(new Button.ClickListener() {

            @Override
            public void buttonClick(ClickEvent event) {
                l.setValue("Length: " + tx.getValue().toString().length()
                        + " Content: " + tx.getValue());
            }
        });

        mainWin.addComponent(tx);
        mainWin.addComponent(b);
View Full Code Here


                        updatePageLengthLabel();
                    }
                });
        addComponent(updateButton);

        TextField tableHeight = new TextField("Table height",
                new MethodProperty<String>(this, "tableHeight"));
        tableHeight.setImmediate(true);
        addComponent(tableHeight);
    }
View Full Code Here

            for (int j = 0; j < INITIAL_COMPONENTS; j++) {
                cb.addItem("option " + i + " " + j);
            }
            testContainer.addComponent(cb);

            TextField tf = new TextField("TextField " + i);
            tf.setDescription("DESC SDKJSDF");
            tf.setComponentError(new UserError("dsfjklsdf"));
            testContainer.addComponent(tf);

            testContainer.addComponent(new DateField("DateField" + i));

            testContainer.addComponent(new Button("Button" + i));
View Full Code Here

                        + "should have low memory consumption."));

        main.addComponent(new Label(
                "Clicking on button b updates information about upload components status or same with garbage collector."));

        textField = new TextField("Test field");
        textFieldValue = new Label();
        main.addComponent(textField);
        main.addComponent(textFieldValue);

        up = new Upload("Upload", buffer);
View Full Code Here

            result = new Button();
            result.setCaption("Button component " + caption);
            break;
        case 2:
            // TextField
            result = new TextField();
            result.setCaption("TextField component " + caption);
            break;
        case 3:
            // Select
            result = new Select("Select " + caption);
View Full Code Here

public class TestReadOnlyValidation {

    @Test
    public void testIntegerValidation() {
        TextField field = new TextField();
        field.addValidator(new IntegerValidator("Enter a Valid Number"));
        field.setValue(String.valueOf(10));
        field.validate();
    }
View Full Code Here

public class TestEventRouter extends TestCase {

    int innerListenerCalls = 0;

    public void testAddInEventListener() {
        final TextField tf = new TextField();

        final ValueChangeListener outer = new ValueChangeListener() {

            @Override
            public void valueChange(ValueChangeEvent event) {
                ValueChangeListener inner = new ValueChangeListener() {

                    @Override
                    public void valueChange(ValueChangeEvent event) {
                        innerListenerCalls++;
                        System.out.println("The inner listener was called");
                    }
                };

                tf.addListener(inner);
            }
        };

        tf.addListener(outer);
        tf.setValue("abc"); // No inner listener calls, adds one inner
        tf.setValue("def"); // One inner listener call, adds one inner
        tf.setValue("ghi"); // Two inner listener calls, adds one inner
        assert (innerListenerCalls == 3);
    }
View Full Code Here

public class TestTextFieldValueChange extends
        AbstractTestFieldValueChange<String> {

    @Override
    protected void setUp() throws Exception {
        super.setUp(new TextField());
    }
View Full Code Here

    @Override
    protected void setup() {
        final Log log = new Log(5);

        final TextField textField = new TextField();
        Button button = new Button("Show Text", new ClickListener() {
            @Override
            public void buttonClick(ClickEvent event) {
                log.log("Field value: " + textField.getValue());
            }
        });
        button.setClickShortcut(KeyCode.ESCAPE);

        final CheckBox inputPromptSelection = new CheckBox("Input prompt");
        inputPromptSelection.setImmediate(true);
        inputPromptSelection.addListener(new ValueChangeListener() {
            @Override
            public void valueChange(ValueChangeEvent event) {
                if (event.getProperty().getValue() == Boolean.TRUE) {
                    textField.setInputPrompt("Input prompt");
                } else {
                    textField.setInputPrompt(null);
                }
                log.log("Set input prompt: " + textField.getInputPrompt());
            }
        });
        inputPromptSelection.setImmediate(true);

        addComponent(textField);
View Full Code Here

        componentWithLongTooltip.setId("longTooltip");
        componentWithLongTooltip.setDescription(LONG_TOOLTIP_TEXT);

        VerticalLayout vl = new VerticalLayout();

        TextField component1 = new TextField("TextField");
        component1.setId("component1");
        TextField component2 = new TextField("TextField");
        TextField component3 = new TextField("TextField");
        TextField component4 = new TextField("TextField");
        TextField component5 = new TextField("TextField");
        TextField component6 = new TextField("TextField");
        TextField component7 = new TextField("TextField");
        TextField component8 = new TextField("TextField");

        // some count of any components should be added before (between) buttons
        // to make defect reproducible
        vl.addComponents(component1, component2, component2, component3,
                component4, component5, component5, component6, component7,
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.