PDA

View Full Version : [CLOSED] [1.2.4]Viewport breaks errorIcon after resizing



r_q_d
14 May 2009, 12:52 PM
I posted a forums thread at http://extjs.com/forum/showthread.php?t=68527 but nobody answers.

Since I think it is very obvious and can reproduce it repeatedly, I here report it as a bug.

the platform I used is:
1. GXT1.2.4
2. GWT 1.5.3
3. Java 1.5.0_17
4. Windows xp.

the problem shows up both on host mode and standard web mode.

Here is the steps to re-produce:

1. run the following attached simple test code at host mode.
2. input something less than 5 characters in the TextField, click the submit button.
3. the ErrorIcon should shows up, when you mouse over it, the error message will show up.
4. Now re-size the browser(or host mode window), the ErrorIcon disappear.
5. now no matter what invalid value you input, and then click the submit button, the error icon will never show up any more.

Attached pictures shows the screens ***with*** errorIcon and ***without*** errorIcon.

However, this mis-behavior only happens when the Viewport is used. If I do not use the class Viewport, then every things works perfectly.

Here is the source code that used to show the error:




import com.extjs.gxt.ui.client.event.ComponentEvent;
import com.extjs.gxt.ui.client.event.SelectionListener;
import com.extjs.gxt.ui.client.widget.Container;
import com.extjs.gxt.ui.client.widget.HorizontalPanel;
import com.extjs.gxt.ui.client.widget.MessageBox;
import com.extjs.gxt.ui.client.widget.Viewport;
import com.extjs.gxt.ui.client.widget.button.Button;
import com.extjs.gxt.ui.client.widget.form.Field;
import com.extjs.gxt.ui.client.widget.form.TextField;
import com.extjs.gxt.ui.client.widget.form.Validator;
import com.google.gwt.core.client.EntryPoint;
import com.google.gwt.user.client.ui.RootPanel;

public class TestErrorIconApp implements EntryPoint {

private static TextField<String> txtValue = null;

public void onModuleLoad() {
RootPanel.get("GwtRootPanel").add(generateContainer());
}

public static Container generateContainer(){
HorizontalPanel hPanel = new HorizontalPanel();
hPanel.setSpacing(30);

txtValue = new TextField<String>();
txtValue.setAllowBlank(false);
txtValue.setValidateOnBlur(false);
txtValue.setValidator(new Validator<String, Field<String>>() {
public String validate(Field<String> field, String value) {
if (value != null && value.length() < 5) {
return "must be 5 or more";
}
return null;
}
});
hPanel.add(txtValue);

Button btnSubmit = new Button("Submit");
btnSubmit.addSelectionListener(new SelectionListener<ComponentEvent>() {
public void componentSelected(ComponentEvent ce) {
if (!txtValue.isValid()) {
return;
}
txtValue.clearInvalid();

MessageBox.info("Your input is ", txtValue.getRawValue(), null);
}
});
hPanel.add(btnSubmit);

//if we do not Viewport, then errorIcon works
//return hPanel;

//If we use Viewport, then errorIcon does not work
Viewport viewport=new Viewport();
viewport.add(hPanel);
return viewport;
}
}

r_q_d
15 May 2009, 7:15 AM
I found a workaround for this is to add all the fields in a FormPanel.

sven
15 May 2009, 7:17 AM
It is bound to TableLayout and there is not really a fix for that. You cant really call it an issue, as the way tablelayout works brake it.