@@ -8,11 +8,8 @@ import com.google.gwt.core.client.GWT; | |||
import com.google.gwt.user.client.ui.Widget; | |||
import com.vaadin.terminal.gwt.client.ui.VFilterSelect; | |||
import com.vaadin.terminal.gwt.client.ui.VListSelect; | |||
import com.vaadin.terminal.gwt.client.ui.VPasswordField; | |||
import com.vaadin.terminal.gwt.client.ui.VSplitPanelHorizontal; | |||
import com.vaadin.terminal.gwt.client.ui.VSplitPanelVertical; | |||
import com.vaadin.terminal.gwt.client.ui.VTextArea; | |||
import com.vaadin.terminal.gwt.client.ui.VTextField; | |||
import com.vaadin.terminal.gwt.client.ui.VUnknownComponent; | |||
import com.vaadin.terminal.gwt.client.ui.VView; | |||
import com.vaadin.terminal.gwt.client.ui.VWindow; | |||
@@ -86,12 +83,6 @@ public class WidgetSet { | |||
return VListSelect.class; | |||
} | |||
} | |||
} else if (widgetClass == VTextField.class) { | |||
if (uidl.hasAttribute("multiline")) { | |||
return VTextArea.class; | |||
} else if (uidl.hasAttribute("secret")) { | |||
return VPasswordField.class; | |||
} | |||
} else if (widgetClass == VSplitPanelHorizontal.class | |||
&& uidl.hasAttribute("vertical")) { | |||
return VSplitPanelVertical.class; | |||
@@ -141,9 +132,6 @@ public class WidgetSet { | |||
*/ | |||
if (fullyqualifiedName.equals("com.vaadin.ui.Select")) { | |||
loadImplementation(VListSelect.class); | |||
} else if (fullyqualifiedName.equals("com.vaadin.ui.TextField")) { | |||
loadImplementation(VTextArea.class); | |||
loadImplementation(VPasswordField.class); | |||
} else if (fullyqualifiedName.equals("com.vaadin.ui.SplitPanel")) { | |||
loadImplementation(VSplitPanelVertical.class); | |||
} |
@@ -5,8 +5,6 @@ | |||
package com.vaadin.ui; | |||
import com.vaadin.data.Property; | |||
import com.vaadin.terminal.PaintException; | |||
import com.vaadin.terminal.PaintTarget; | |||
import com.vaadin.terminal.gwt.client.ui.VTextField; | |||
import com.vaadin.ui.ClientWidget.LoadStyle; | |||
@@ -34,26 +32,6 @@ import com.vaadin.ui.ClientWidget.LoadStyle; | |||
@ClientWidget(value = VTextField.class, loadStyle = LoadStyle.EAGER) | |||
public class TextField extends AbstractTextField { | |||
/** | |||
* Tells if input is used to enter sensitive information that is not echoed | |||
* to display. Typically passwords. | |||
*/ | |||
@Deprecated | |||
private boolean secret = false; | |||
/** | |||
* Number of visible rows in a multiline TextField. Value 0 implies a | |||
* single-line text-editor. | |||
*/ | |||
@Deprecated | |||
private int rows = 0; | |||
/** | |||
* Tells if word-wrapping should be used in multiline mode. | |||
*/ | |||
@Deprecated | |||
private boolean wordwrap = true; | |||
/** | |||
* Constructs an empty <code>TextField</code> with no caption. | |||
*/ | |||
@@ -106,7 +84,7 @@ public class TextField extends AbstractTextField { | |||
* | |||
* @param caption | |||
* the caption <code>String</code> for the editor. | |||
* @param text | |||
* @param value | |||
* the initial text content of the editor. | |||
*/ | |||
public TextField(String caption, String value) { | |||
@@ -114,180 +92,4 @@ public class TextField extends AbstractTextField { | |||
setCaption(caption); | |||
} | |||
/** | |||
* Gets the secret property. If a field is used to enter secret information | |||
* the information is not echoed to display. | |||
* | |||
* @return <code>true</code> if the field is used to enter secret | |||
* information, <code>false</code> otherwise. | |||
* | |||
* @deprecated Starting from 6.5 use {@link PasswordField} instead for | |||
* secret text input. | |||
*/ | |||
@Deprecated | |||
public boolean isSecret() { | |||
return secret; | |||
} | |||
/** | |||
* Sets the secret property on and off. If a field is used to enter secret | |||
* information the information is not echoed to display. | |||
* | |||
* @param secret | |||
* the value specifying if the field is used to enter secret | |||
* information. | |||
* @deprecated Starting from 6.5 use {@link PasswordField} instead for | |||
* secret text input. | |||
*/ | |||
@Deprecated | |||
public void setSecret(boolean secret) { | |||
if (this.secret != secret) { | |||
this.secret = secret; | |||
requestRepaint(); | |||
} | |||
} | |||
@Override | |||
public void paintContent(PaintTarget target) throws PaintException { | |||
if (isSecret()) { | |||
target.addAttribute("secret", true); | |||
} | |||
final int rows = getRows(); | |||
if (rows != 0) { | |||
target.addAttribute("rows", rows); | |||
target.addAttribute("multiline", true); | |||
if (!isWordwrap()) { | |||
// Wordwrap is only painted if turned off to minimize | |||
// communications | |||
target.addAttribute("wordwrap", false); | |||
} | |||
} | |||
super.paintContent(target); | |||
} | |||
/** | |||
* Gets the number of rows in the editor. If the number of rows is set to 0, | |||
* the actual number of displayed rows is determined implicitly by the | |||
* adapter. | |||
* | |||
* @return number of explicitly set rows. | |||
* @deprecated Starting from 6.5 use {@link TextArea} for a multi-line text | |||
* input. | |||
* | |||
*/ | |||
@Deprecated | |||
public int getRows() { | |||
return rows; | |||
} | |||
/** | |||
* Sets the number of rows in the editor. | |||
* | |||
* @param rows | |||
* the number of rows for this editor. | |||
* | |||
* @deprecated Starting from 6.5 use {@link TextArea} for a multi-line text | |||
* input. | |||
*/ | |||
@Deprecated | |||
public void setRows(int rows) { | |||
if (rows < 0) { | |||
rows = 0; | |||
} | |||
if (this.rows != rows) { | |||
this.rows = rows; | |||
requestRepaint(); | |||
} | |||
} | |||
/** | |||
* Tests if the editor is in word-wrap mode. | |||
* | |||
* @return <code>true</code> if the component is in the word-wrap mode, | |||
* <code>false</code> if not. | |||
* @deprecated Starting from 6.5 use {@link TextArea} for a multi-line text | |||
* input. | |||
*/ | |||
@Deprecated | |||
public boolean isWordwrap() { | |||
return wordwrap; | |||
} | |||
/** | |||
* Sets the editor's word-wrap mode on or off. | |||
* | |||
* @param wordwrap | |||
* the boolean value specifying if the editor should be in | |||
* word-wrap mode after the call or not. | |||
* | |||
* @deprecated Starting from 6.5 use {@link TextArea} for a multi-line text | |||
* input. | |||
*/ | |||
@Deprecated | |||
public void setWordwrap(boolean wordwrap) { | |||
if (this.wordwrap != wordwrap) { | |||
this.wordwrap = wordwrap; | |||
requestRepaint(); | |||
} | |||
} | |||
/** | |||
* Sets the height of the {@link TextField} instance. | |||
* | |||
* <p> | |||
* Setting height for {@link TextField} also has a side-effect that puts | |||
* {@link TextField} into multiline mode (aka "textarea"). Multiline mode | |||
* can also be achieved by calling {@link #setRows(int)}. The height value | |||
* overrides the number of rows set by {@link #setRows(int)}. | |||
* <p> | |||
* If you want to set height of single line {@link TextField}, call | |||
* {@link #setRows(int)} with value 0 after setting the height. Setting rows | |||
* to 0 resets the side-effect. | |||
* <p> | |||
* Starting from 6.5 you should use {@link TextArea} instead of | |||
* {@link TextField} for multiline text input. | |||
* | |||
* | |||
* @see com.vaadin.ui.AbstractComponent#setHeight(float, int) | |||
*/ | |||
@Override | |||
public void setHeight(float height, int unit) { | |||
super.setHeight(height, unit); | |||
if (height > 1 && getClass() == TextField.class) { | |||
/* | |||
* In html based terminals we most commonly want to make component | |||
* to be textarea if height is defined. Setting row field above 0 | |||
* will render component as textarea. | |||
*/ | |||
setRows(2); | |||
} | |||
} | |||
/** | |||
* Sets the height of the {@link TextField} instance. | |||
* | |||
* <p> | |||
* Setting height for {@link TextField} also has a side-effect that puts | |||
* {@link TextField} into multiline mode (aka "textarea"). Multiline mode | |||
* can also be achieved by calling {@link #setRows(int)}. The height value | |||
* overrides the number of rows set by {@link #setRows(int)}. | |||
* <p> | |||
* If you want to set height of single line {@link TextField}, call | |||
* {@link #setRows(int)} with value 0 after setting the height. Setting rows | |||
* to 0 resets the side-effect. | |||
* | |||
* @see com.vaadin.ui.AbstractComponent#setHeight(java.lang.String) | |||
*/ | |||
@Override | |||
public void setHeight(String height) { | |||
// will call setHeight(float, int) the actually does the magic. Method | |||
// is overridden just to document side-effects. | |||
super.setHeight(height); | |||
} | |||
} |
@@ -9,6 +9,7 @@ import com.vaadin.ui.Component; | |||
import com.vaadin.ui.FormLayout; | |||
import com.vaadin.ui.HorizontalLayout; | |||
import com.vaadin.ui.Label; | |||
import com.vaadin.ui.PasswordField; | |||
import com.vaadin.ui.Root; | |||
import com.vaadin.ui.TextField; | |||
import com.vaadin.ui.VerticalLayout; | |||
@@ -38,9 +39,8 @@ public class ErrorInUnloadEvent extends AbstractTestCase { | |||
FormLayout formLayout = new FormLayout(); | |||
final TextField userField = new TextField("Username"); | |||
userField.setDebugId("user"); | |||
final TextField passwordField = new TextField("Password"); | |||
final PasswordField passwordField = new PasswordField("Password"); | |||
passwordField.setDebugId("pwd"); | |||
passwordField.setSecret(true); | |||
Button login = new Button("login"); | |||
login.setDebugId("loginButton"); | |||
login.setClickShortcut(KeyCode.ENTER); | |||
@@ -51,8 +51,8 @@ public class ErrorInUnloadEvent extends AbstractTestCase { | |||
login.addListener(new ClickListener() { | |||
public void buttonClick(final ClickEvent event) { | |||
String username = (String) userField.getValue(); | |||
String password = (String) passwordField.getValue(); | |||
String username = userField.getValue(); | |||
String password = passwordField.getValue(); | |||
setUser(username); | |||
showMainWindow(); |
@@ -1,59 +0,0 @@ | |||
package com.vaadin.tests.components.formlayout; | |||
import com.vaadin.data.Property.ValueChangeEvent; | |||
import com.vaadin.data.Property.ValueChangeListener; | |||
import com.vaadin.tests.components.TestBase; | |||
import com.vaadin.ui.CheckBox; | |||
import com.vaadin.ui.FormLayout; | |||
import com.vaadin.ui.TextField; | |||
public class FormLayoutReplaceComponent extends TestBase { | |||
@Override | |||
protected void setup() { | |||
addComponent(new FL()); | |||
} | |||
public class FL extends FormLayout implements ValueChangeListener { | |||
private TextField messages; | |||
private CheckBox control; | |||
@SuppressWarnings("deprecation") | |||
public FL() { | |||
setCaption("Test"); | |||
control = new CheckBox("Messages On/Off"); | |||
control.addListener(this); | |||
control.setImmediate(true); | |||
addComponent(control); | |||
// The bug is in replaceComponent, triggered when VTextField is | |||
// replaced by VTextArea so cannot replace this with TextArea. | |||
messages = new TextField("Messages"); | |||
messages.setRows(10); | |||
messages.setColumns(40); | |||
messages.setVisible(false); | |||
messages.setEnabled(false); | |||
addComponent(messages); | |||
} | |||
public void valueChange(ValueChangeEvent event) { | |||
if (event.getProperty() == control) { | |||
messages.setVisible(control.getValue()); | |||
} | |||
} | |||
} | |||
@Override | |||
protected String getDescription() { | |||
return "Check or uncheck the CheckBox to show/hide the messages field inside the FormLayout."; | |||
} | |||
@Override | |||
protected Integer getTicketNumber() { | |||
return 6308; | |||
} | |||
} |
@@ -7,18 +7,18 @@ import com.vaadin.ui.Button.ClickListener; | |||
import com.vaadin.ui.NativeSelect; | |||
import com.vaadin.ui.Notification; | |||
import com.vaadin.ui.Root; | |||
import com.vaadin.ui.TextField; | |||
import com.vaadin.ui.TextArea; | |||
public class Notifications extends TestBase implements ClickListener { | |||
private static final String CAPTION = "CAPTION"; | |||
private TextField tf; | |||
private TextArea tf; | |||
private NativeSelect type; | |||
@SuppressWarnings("deprecation") | |||
@Override | |||
protected void setup() { | |||
tf = new TextField("Text", "Hello world"); | |||
tf = new TextArea("Text", "Hello world"); | |||
tf.setRows(10); | |||
addComponent(tf); | |||
type = new NativeSelect(); | |||
@@ -51,7 +51,7 @@ public class Notifications extends TestBase implements ClickListener { | |||
} | |||
public void buttonClick(ClickEvent event) { | |||
Notification n = new Notification((String) tf.getValue(), | |||
Notification n = new Notification(tf.getValue(), | |||
(Integer) type.getValue()); | |||
Root.getCurrentRoot().showNotification(n); | |||
@@ -10,34 +10,28 @@ import com.vaadin.ui.CheckBox; | |||
import com.vaadin.ui.FormLayout; | |||
import com.vaadin.ui.HorizontalLayout; | |||
import com.vaadin.ui.Panel; | |||
import com.vaadin.ui.TextArea; | |||
import com.vaadin.ui.TextField; | |||
public class SelectionAndCursorPosition extends TestBase { | |||
TextField tf = new TextField(); | |||
TextField tf = createTextField(); | |||
TextArea ta = createTextArea(); | |||
@Override | |||
protected void setup() { | |||
tf.setCaption("Text field"); | |||
tf.setValue("So we have some text to select"); | |||
tf.setWidth("400px"); | |||
FormLayout fl = new FormLayout(); | |||
Panel panel = new Panel(fl); | |||
panel.setCaption("Hackers panel"); | |||
CheckBox ml = new CheckBox("Multiline"); | |||
ml.setImmediate(true); | |||
ml.addListener(new Property.ValueChangeListener() { | |||
@SuppressWarnings("deprecation") | |||
public void valueChange(ValueChangeEvent event) { | |||
if (tf.getHeight() < 0) { | |||
tf.setHeight("50px"); | |||
if (tf.getApplication() == null) { | |||
replaceComponent(ta, tf); | |||
} else { | |||
tf.setSizeUndefined(); | |||
tf.setRows(0); | |||
replaceComponent(tf, ta); | |||
} | |||
tf.setWidth("400px"); | |||
} | |||
}); | |||
fl.addComponent(ml); | |||
@@ -58,8 +52,8 @@ public class SelectionAndCursorPosition extends TestBase { | |||
b = new Button("select"); | |||
b.addListener(new ClickListener() { | |||
public void buttonClick(ClickEvent event) { | |||
int startPos = Integer.parseInt((String) start.getValue()); | |||
int lenght = Integer.parseInt((String) length.getValue()); | |||
int startPos = Integer.parseInt(start.getValue()); | |||
int lenght = Integer.parseInt(length.getValue()); | |||
tf.setSelectionRange(startPos, lenght); | |||
} | |||
}); | |||
@@ -74,7 +68,7 @@ public class SelectionAndCursorPosition extends TestBase { | |||
b = new Button("set"); | |||
b.addListener(new ClickListener() { | |||
public void buttonClick(ClickEvent event) { | |||
int startPos = Integer.parseInt((String) pos.getValue()); | |||
int startPos = Integer.parseInt(pos.getValue()); | |||
tf.setCursorPosition(startPos); | |||
} | |||
}); | |||
@@ -90,6 +84,25 @@ public class SelectionAndCursorPosition extends TestBase { | |||
} | |||
private static TextField createTextField() { | |||
TextField tf = new TextField(); | |||
tf.setCaption("Text field"); | |||
tf.setValue("So we have some text to select"); | |||
tf.setWidth("400px"); | |||
return tf; | |||
} | |||
private static TextArea createTextArea() { | |||
TextArea ta = new TextArea(); | |||
ta.setCaption("Text area"); | |||
ta.setValue("So we have some text to select"); | |||
ta.setWidth("400px"); | |||
ta.setHeight("50px"); | |||
return ta; | |||
} | |||
@Override | |||
protected String getDescription() { | |||
return "For usability reasons it is often essential that developer " |
@@ -3,6 +3,7 @@ package com.vaadin.tests.components.textfield; | |||
import com.vaadin.tests.components.TestBase; | |||
import com.vaadin.ui.Component; | |||
import com.vaadin.ui.CssLayout; | |||
import com.vaadin.ui.TextArea; | |||
import com.vaadin.ui.TextField; | |||
import com.vaadin.ui.VerticalLayout; | |||
@@ -37,10 +38,10 @@ public class SizedTextFields extends TestBase { | |||
vl.setHeight("40px"); | |||
vl.setWidth("200px"); | |||
tf = new TextField(); | |||
tf.setRows(2); // make it text area, instead of oneliner | |||
tf.setSizeFull(); | |||
vl.addComponent(tf); | |||
TextArea ta = new TextArea(); | |||
ta.setRows(2); // make it text area, instead of oneliner | |||
ta.setSizeFull(); | |||
vl.addComponent(ta); | |||
vl.setCaption("Fullsize textarea in 100px height 200px width box"); | |||
cssLayout.addComponent(vl); | |||
@@ -1,7 +1,5 @@ | |||
package com.vaadin.tests.components.textfield; | |||
import java.util.LinkedHashMap; | |||
import com.vaadin.event.FieldEvents.TextChangeListener; | |||
import com.vaadin.tests.components.abstractfield.AbstractTextFieldTest; | |||
import com.vaadin.ui.TextField; | |||
@@ -9,27 +7,6 @@ import com.vaadin.ui.TextField; | |||
public class TextFieldTest extends AbstractTextFieldTest<TextField> implements | |||
TextChangeListener { | |||
private Command<TextField, Boolean> secretCommand = new Command<TextField, Boolean>() { | |||
@SuppressWarnings("deprecation") | |||
public void execute(TextField c, Boolean value, Object data) { | |||
c.setSecret(value); | |||
} | |||
}; | |||
private Command<TextField, Boolean> wordwrapCommand = new Command<TextField, Boolean>() { | |||
@SuppressWarnings("deprecation") | |||
public void execute(TextField c, Boolean value, Object data) { | |||
c.setWordwrap(value); | |||
} | |||
}; | |||
private Command<TextField, Integer> rowsCommand = new Command<TextField, Integer>() { | |||
@SuppressWarnings("deprecation") | |||
public void execute(TextField c, Integer value, Object data) { | |||
c.setRows(value); | |||
} | |||
}; | |||
@Override | |||
protected Class<TextField> getTestClass() { | |||
return TextField.class; | |||
@@ -38,22 +15,6 @@ public class TextFieldTest extends AbstractTextFieldTest<TextField> implements | |||
@Override | |||
protected void createActions() { | |||
super.createActions(); | |||
createSecretAction(CATEGORY_FEATURES); | |||
createWordwrapAction(CATEGORY_FEATURES); | |||
createRowsAction(CATEGORY_FEATURES); | |||
} | |||
private void createRowsAction(String category) { | |||
LinkedHashMap<String, Integer> options = createIntegerOptions(20); | |||
createSelectAction("Rows", category, options, "0", rowsCommand); | |||
} | |||
private void createSecretAction(String category) { | |||
createBooleanAction("Secret", category, false, secretCommand); | |||
} | |||
private void createWordwrapAction(String category) { | |||
createBooleanAction("Wordwrap", category, false, wordwrapCommand); | |||
} | |||
} |
@@ -5,11 +5,11 @@ import com.vaadin.data.Property.ValueChangeListener; | |||
import com.vaadin.tests.components.TestBase; | |||
import com.vaadin.ui.CheckBox; | |||
import com.vaadin.ui.FormLayout; | |||
import com.vaadin.ui.TextField; | |||
import com.vaadin.ui.TextArea; | |||
public class FormLayoutWithInvisibleComponent extends TestBase { | |||
private TextField messages; | |||
private TextArea messages; | |||
@Override | |||
protected String getDescription() { | |||
@@ -37,7 +37,7 @@ public class FormLayoutWithInvisibleComponent extends TestBase { | |||
control.setImmediate(true); | |||
formLayout.addComponent(control); | |||
messages = new TextField("Messages hidden"); | |||
messages = new TextArea("Messages hidden"); | |||
messages.setRows(10); | |||
messages.setColumns(40); | |||
messages.setVisible(false); |
@@ -1,157 +0,0 @@ | |||
package com.vaadin.tests.layouts; | |||
import com.vaadin.tests.components.TestBase; | |||
import com.vaadin.ui.AbsoluteLayout; | |||
import com.vaadin.ui.AbstractLayout; | |||
import com.vaadin.ui.Button; | |||
import com.vaadin.ui.Button.ClickEvent; | |||
import com.vaadin.ui.CssLayout; | |||
import com.vaadin.ui.GridLayout; | |||
import com.vaadin.ui.HorizontalLayout; | |||
import com.vaadin.ui.TextField; | |||
import com.vaadin.ui.VerticalLayout; | |||
@SuppressWarnings("deprecation") | |||
public class WidgetImplementationSwap extends TestBase { | |||
@Override | |||
protected void setup() { | |||
setTheme("tests-tickets"); | |||
{ | |||
final AbstractLayout layout = new AbsoluteLayout(); | |||
layout.setCaption(layout.getClass().getSimpleName()); | |||
layout.setStyleName("borders"); | |||
layout.setWidth("500px"); | |||
layout.setHeight("50px"); | |||
addComponent(layout); | |||
final TextField tf = new TextField(); | |||
layout.addComponent(tf); | |||
Button b = new Button("-> TextArea", new Button.ClickListener() { | |||
public void buttonClick(ClickEvent event) { | |||
if (tf.getRows() == 0) { | |||
tf.setRows(3); | |||
event.getButton().setCaption("Move"); | |||
} else { | |||
layout.setCaption(layout.getClass().getSimpleName() | |||
+ " done"); | |||
event.getButton().setCaption("done"); | |||
} | |||
} | |||
}); | |||
addComponent(b); | |||
} | |||
{ | |||
final AbstractLayout layout = new VerticalLayout(); | |||
layout.setCaption(layout.getClass().getSimpleName()); | |||
layout.setStyleName("borders"); | |||
layout.setWidth("500px"); | |||
layout.setHeight("50px"); | |||
addComponent(layout); | |||
final TextField tf = new TextField(); | |||
layout.addComponent(tf); | |||
Button b = new Button("-> TextArea", new Button.ClickListener() { | |||
public void buttonClick(ClickEvent event) { | |||
if (tf.getRows() == 0) { | |||
tf.setRows(3); | |||
event.getButton().setCaption("Move"); | |||
} else { | |||
layout.setCaption(layout.getClass().getSimpleName() | |||
+ " done"); | |||
event.getButton().setCaption("done"); | |||
} | |||
} | |||
}); | |||
addComponent(b); | |||
} | |||
{ | |||
final AbstractLayout layout = new HorizontalLayout(); | |||
layout.setCaption(layout.getClass().getSimpleName()); | |||
layout.setStyleName("borders"); | |||
layout.setWidth("500px"); | |||
layout.setHeight("50px"); | |||
addComponent(layout); | |||
final TextField tf = new TextField(); | |||
layout.addComponent(tf); | |||
Button b = new Button("-> TextArea", new Button.ClickListener() { | |||
public void buttonClick(ClickEvent event) { | |||
if (tf.getRows() == 0) { | |||
tf.setRows(3); | |||
event.getButton().setCaption("Move"); | |||
} else { | |||
layout.setCaption(layout.getClass().getSimpleName() | |||
+ " done"); | |||
event.getButton().setCaption("done"); | |||
} | |||
} | |||
}); | |||
addComponent(b); | |||
} | |||
{ | |||
final AbstractLayout layout = new GridLayout(); | |||
layout.setCaption(layout.getClass().getSimpleName()); | |||
layout.setStyleName("borders"); | |||
layout.setWidth("500px"); | |||
layout.setHeight("50px"); | |||
addComponent(layout); | |||
final TextField tf = new TextField(); | |||
layout.addComponent(tf); | |||
Button b = new Button("-> TextArea", new Button.ClickListener() { | |||
public void buttonClick(ClickEvent event) { | |||
if (tf.getRows() == 0) { | |||
tf.setRows(3); | |||
event.getButton().setCaption("Move"); | |||
} else { | |||
layout.setCaption(layout.getClass().getSimpleName() | |||
+ " done"); | |||
event.getButton().setCaption("done"); | |||
} | |||
} | |||
}); | |||
addComponent(b); | |||
} | |||
{ | |||
final AbstractLayout layout = new CssLayout(); | |||
layout.setCaption(layout.getClass().getSimpleName()); | |||
layout.setStyleName("borders"); | |||
layout.setWidth("500px"); | |||
layout.setHeight("50px"); | |||
addComponent(layout); | |||
final TextField tf = new TextField(); | |||
layout.addComponent(tf); | |||
Button b = new Button("-> TextArea", new Button.ClickListener() { | |||
public void buttonClick(ClickEvent event) { | |||
if (tf.getRows() == 0) { | |||
tf.setRows(3); | |||
event.getButton().setCaption("Move"); | |||
} else { | |||
layout.setCaption(layout.getClass().getSimpleName() | |||
+ " done"); | |||
event.getButton().setCaption("done"); | |||
} | |||
} | |||
}); | |||
addComponent(b); | |||
} | |||
} | |||
@Override | |||
protected String getDescription() { | |||
return "First click turns TextField into a TextArea (on the client); second click modifies the layout - widget should still be a TextArea."; | |||
} | |||
@Override | |||
protected Integer getTicketNumber() { | |||
return 5457; | |||
} | |||
} |