Tuesday, October 30, 2012

Re: performance problem on andorid using phonegap

ok, sorry :(
this is the controller:
//=====================================================================

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);

}

}

//=====================================================================
this is the model:

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!


--
You received this message because you are subscribed to the Google Groups "Google Web Toolkit" group.
To view this discussion on the web visit https://groups.google.com/d/msg/google-web-toolkit/-/gI_5sVKaj8YJ.
To post to this group, send email to google-web-toolkit@googlegroups.com.
To unsubscribe from this group, send email to google-web-toolkit+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/google-web-toolkit?hl=en.

No comments:

Post a Comment