aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/com/vaadin/terminal/gwt/client/ui/VTextArea.java28
1 files changed, 15 insertions, 13 deletions
diff --git a/src/com/vaadin/terminal/gwt/client/ui/VTextArea.java b/src/com/vaadin/terminal/gwt/client/ui/VTextArea.java
index 4ab27646ed..a90a5679d9 100644
--- a/src/com/vaadin/terminal/gwt/client/ui/VTextArea.java
+++ b/src/com/vaadin/terminal/gwt/client/ui/VTextArea.java
@@ -63,18 +63,6 @@ public class VTextArea extends VTextField {
enforceMaxLength();
}
- private void enforceMaxLength() {
- if (getMaxLength() >= 0) {
- Scheduler.get().scheduleDeferred(new Command() {
- public void execute() {
- if (getText().length() > getMaxLength()) {
- setText(getText().substring(0, getMaxLength()));
- }
- }
- });
- }
- }
-
public void onChange(ChangeEvent event) {
// Opera does not support paste events so this enforces max length
// for Opera.
@@ -83,6 +71,18 @@ public class VTextArea extends VTextField {
}
+ protected void enforceMaxLength() {
+ if (getMaxLength() >= 0) {
+ Scheduler.get().scheduleDeferred(new Command() {
+ public void execute() {
+ if (getText().length() > getMaxLength()) {
+ setText(getText().substring(0, getMaxLength()));
+ }
+ }
+ });
+ }
+ }
+
protected boolean browserSupportsMaxLengthAttribute() {
BrowserInfo info = BrowserInfo.get();
if (info.isFirefox() && info.isBrowserVersionNewerOrEqual(4, 0)) {
@@ -105,7 +105,9 @@ public class VTextArea extends VTextField {
if (browserSupportsMaxLengthAttribute) {
super.updateMaxLength(maxLength);
} else {
- // Handled automatically by MaxLengthHandler
+ // Events handled by MaxLengthHandler. This call enforces max length
+ // when the max length value has changed
+ enforceMaxLength();
}
}