hi all guys!i develop a very small application to test gwt the first time..so using MVC i create a button and a teextarea, pressing the button the number in the textfiel growing upthis is the entry point:public void onModuleLoad() {
//MODEL
ModelP model = new ModelP();
//VIEW
ViewP view = new ViewP(model);
//CONTROLLER
ControllerP controller = new ControllerP(model, view);
}
in the model there is a varaible and a function to increment the variable;
in the view there is simply a button and a textarea
in the controller there is a clickListener that listens the button and increment the variable.. very simple a stupid program, non css , non html changes.. nothing..
i only add this line <inherits name='com.google.gwt.user.User'/> in the xml to maintain the compatibility with android ICS..
when i run this program in my android ics phone (512ram, 1ghz cpu) using phonegap the program is terribly slow (on the pc is perfectly fast), i mean…if i press the button, the textfield
growing up after 1 second! :(
can you help me? :)
thanks a lot!
public class ControllerP {
private ModelP model;
private ViewP view;
ControllerP(ModelP model, ViewP view) {
this.model = model;
this.view = view;
view.addButtonListener(new ButtonListener());
}
class ButtonListener implements ClickHandler {
@Override
public void onClick(ClickEvent event) {
model.incrementI();
view.aggiornaI();
view.button.setFocus(true);
}
}
public class ModelP {
public int i;
public ModelP() {
i = 0;
}
public void incrementI() {
i++;
}
}
//=====================================================================
this is the view:
public class ViewP {
public TextBox textBox;
public ModelP model;
public Button button;
public ViewP(ModelP model) {
this.model = model;
textBox = new TextBox();
textBox.setText("hello world!");
textBox.setReadOnly(true);
button = new Button("click");
RootPanel.get("button_container").add(button);
RootPanel.get("text_container").add(textBox);
button.setFocus(true);
}
public void addButtonListener(ClickHandler handler) {
button.addClickHandler(handler);
}
public void aggiornaI() {
textBox.setText(model.getI()+"");
header.setText(model.getInUso());
}
}
the css for the textBox and the button position:
#button_container {
position: absolute;
top: 6em;
left: 1em;
}
#text_container {
position: absolute;
top: 6em;
left: 10em;
}
and finally in the html file i add only this:
<div id="header_container"></div>
<div id="button_container"></div>
<div id="tab_container"></div>
<div id="text_container"></div>
<div id="image_container"></div>
very very simple, and very fast on the pc..but on the phone is incredibly slow
thanks a lot for the help!