1 package org.informagen.echo.app;
2
3 import nextapp.echo.app.text.Document;
4 import nextapp.echo.app.TextField;
5
6 import nextapp.echo.webcontainer.sync.component.TextComponentPeer;
7
8 public class SyncTextField extends TextField {
9
10 public static final String PROPERTY_SYNC_DELAY = "syncDelay";
11
12 private int delayInMillis = 0;
13
14
15 public SyncTextField() {
16 super();
17 }
18
19 public SyncTextField(Document document, String text, int columns) {
20 super(document, text, columns);
21 }
22
23 public SyncTextField(Document document) {
24 super(document);
25 }
26
27
28
29
30
31
32
33 public void setSyncDelay(int delayInMillis) {
34 int oldValue = this.delayInMillis;
35 this.delayInMillis = delayInMillis;
36
37 if(delayInMillis < 0)
38 this.set(TextComponentPeer.PROPERTY_SYNC_MODE, new Integer(TextComponentPeer.SYNC_ON_ACTION));
39 else {
40 this.set(TextComponentPeer.PROPERTY_SYNC_MODE, new Integer(TextComponentPeer.SYNC_ON_CHANGE));
41
42
43
44 }
45 }
46
47 public int getSyncDelay() {
48 return delayInMillis;
49 }
50
51 }