1. SmartGWT lgpl-5.0-p20150628
2. Firefox 39.0
3. No server side component necessary
Basic steps to create the applications:
1, Create a datasource which is pointing to somewhere
2, Create a timer that periodically fetches the datasource
3, Create a form
4, Add a textItem to the form with mask AND setMaskSaveLiterals set to true
5, Display form
6, Start application
Steps to reproduce the bug:
7, Enter some digits in the textfield (like 55) and wait till the timer starts a database fetch
8, The cursor is jumping to the end of the textitem
If I remove either the automatic fetch OR the setMaskSaveLiterals() option then cursor does not move in case of timer action is executed.
public class SmartGWTTextItem implements EntryPoint {
CountryDS dataSource = CountryDS.getInstance();
/**
* This is the entry point method.
*/
public void onModuleLoad() {
Timer t = new Timer() {
@Override
public void run() {
updateMethod();
}
};
t.scheduleRepeating(5000);
DynamicForm form = new DynamicForm();
form.setWidth(400);
TextItem dateField = new TextItem("date", "My custom date");
dateField.setMask("##-##-####");
dateField.setMaskSaveLiterals(true);
form.setFields(dateField);
form.draw();
}
private void updateMethod(){
dataSource.fetchData(new Criteria(), new DSCallback() {
@Override
public void execute(DSResponse dsResponse, Object data, DSRequest dsRequest) {
// do nothing
}
});
}
private static class CountryDS extends DataSource {
// The DataSource would normally be defined external to any classes that use it.
private static CountryDS instance = null;
public static CountryDS getInstance() {
if (instance == null) {
instance = new CountryDS("countryDS_JSON");
}
return instance;
}
public CountryDS(String id) {
setID(id);
setDataFormat(DSDataFormat.JSON);
DataSourceField countryCodeField = new DataSourceField("countryCode", FieldType.TEXT, "Code");
DataSourceField countryNameField = new DataSourceField("countryName", FieldType.TEXT, "Country");
DataSourceField capitalField = new DataSourceField("capital", FieldType.TEXT, "Capital");
setFields(countryCodeField, countryNameField, capitalField);
setDataURL("ds/countryData.json");
}
}
}
2. Firefox 39.0
3. No server side component necessary
Basic steps to create the applications:
1, Create a datasource which is pointing to somewhere
2, Create a timer that periodically fetches the datasource
3, Create a form
4, Add a textItem to the form with mask AND setMaskSaveLiterals set to true
5, Display form
6, Start application
Steps to reproduce the bug:
7, Enter some digits in the textfield (like 55) and wait till the timer starts a database fetch
8, The cursor is jumping to the end of the textitem
If I remove either the automatic fetch OR the setMaskSaveLiterals() option then cursor does not move in case of timer action is executed.
public class SmartGWTTextItem implements EntryPoint {
CountryDS dataSource = CountryDS.getInstance();
/**
* This is the entry point method.
*/
public void onModuleLoad() {
Timer t = new Timer() {
@Override
public void run() {
updateMethod();
}
};
t.scheduleRepeating(5000);
DynamicForm form = new DynamicForm();
form.setWidth(400);
TextItem dateField = new TextItem("date", "My custom date");
dateField.setMask("##-##-####");
dateField.setMaskSaveLiterals(true);
form.setFields(dateField);
form.draw();
}
private void updateMethod(){
dataSource.fetchData(new Criteria(), new DSCallback() {
@Override
public void execute(DSResponse dsResponse, Object data, DSRequest dsRequest) {
// do nothing
}
});
}
private static class CountryDS extends DataSource {
// The DataSource would normally be defined external to any classes that use it.
private static CountryDS instance = null;
public static CountryDS getInstance() {
if (instance == null) {
instance = new CountryDS("countryDS_JSON");
}
return instance;
}
public CountryDS(String id) {
setID(id);
setDataFormat(DSDataFormat.JSON);
DataSourceField countryCodeField = new DataSourceField("countryCode", FieldType.TEXT, "Code");
DataSourceField countryNameField = new DataSourceField("countryName", FieldType.TEXT, "Country");
DataSourceField capitalField = new DataSourceField("capital", FieldType.TEXT, "Capital");
setFields(countryCodeField, countryNameField, capitalField);
setDataURL("ds/countryData.json");
}
}
}
Comment