2 * Copyright 2012 Vaadin Ltd.
4 * Licensed under the Apache License, Version 2.0 (the "License"); you may not
5 * use this file except in compliance with the License. You may obtain a copy of
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
12 * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
13 * License for the specific language governing permissions and limitations under
16 package com.vaadin.tests.components.textfield;
18 import com.vaadin.server.VaadinRequest;
19 import com.vaadin.tests.components.AbstractTestUI;
20 import com.vaadin.v7.data.util.BeanItem;
21 import com.vaadin.v7.ui.TextField;
23 public class TextFieldWithDataSourceAndInputPrompt extends AbstractTestUI {
24 public static class Pojo {
25 private String string;
27 public String getString() {
31 public void setString(String string) {
37 protected void setup(VaadinRequest request) {
38 TextField textField = new TextField("TextField with null value");
39 textField.setInputPrompt("Me is input prompt");
40 textField.setNullRepresentation(null);
41 textField.setValue(null);
42 addComponent(textField);
44 TextField textField2 = new TextField(
45 "TextField with null data source value");
46 textField2.setInputPrompt("Me is input prompt");
47 textField2.setNullRepresentation(null);
48 BeanItem<Pojo> beanItem = new BeanItem<Pojo>(new Pojo());
49 textField2.setPropertyDataSource(beanItem.getItemProperty("string"));
50 addComponent(textField2);
54 protected String getTestDescription() {
55 return "Input prompt should be shown when data source provides null";
59 protected Integer getTicketNumber() {