PDA

View Full Version : [FIXED] Window won't show



gslender
31 May 2008, 1:32 AM
The following snippet demonstrates the bug...

Window shows in IE7 hosted browser.

In FF2.0.0.14 and IE7 native compiled browser the window won't show??



public class ModalCloseWindowTest implements EntryPoint {

public void onModuleLoad() {

ContentPanel cp = new ContentPanel();
cp.setHeading("Test");
cp.setSize(400,300);
Button test = new Button("test");
SelectionListener listener = new SelectionListener()
{
public void componentSelected(ComponentEvent be)
{
RegisterWindow rw = new RegisterWindow();
rw.show();
}
};
test.removeAllListeners();
test.addSelectionListener(listener);
cp.add(test);

FormPanel fp = new FormPanel();
fp.setHeading("Simple Form");
TextField text = new TextField();
text.setFieldLabel("Name");
text.setEmptyText("Enter your full name");
text.setAllowBlank(false);
text.setMinLength(4);
fp.add(text);


cp.add(fp);

final Viewport vp = new Viewport();
// vp.setLayout(new FitLayout());
vp.add(cp);
vp.layout();

RootPanel.get().add(vp);

}

public class RegisterWindow extends Window
{
public RegisterWindow()
{
super();
setClosable(true);
setModal(true);
setHeading("Registration");
setWidth(500);
setLayout(new FillLayout());

final FormPanel panel = new FormPanel();
panel.setHeaderVisible(false);
panel.setFieldWidth(300);
panel.setLabelWidth(100);
panel.setLabelAlign(LabelAlign.RIGHT);
panel.setButtonAlign(HorizontalAlignment.RIGHT);

final TextField firstnameTxtFld = new TextField();
firstnameTxtFld.setFieldLabel("First Name");
firstnameTxtFld.setEmptyText("Your first name");
firstnameTxtFld.setAllowBlank(false);
firstnameTxtFld.setSelectOnFocus(true);
panel.add(firstnameTxtFld);

final TextField lastnameTxtFld = new TextField();
lastnameTxtFld.setFieldLabel("Last Name");
lastnameTxtFld.setEmptyText("Your last name");
lastnameTxtFld.setAllowBlank(false);
lastnameTxtFld.setSelectOnFocus(true);
panel.add(lastnameTxtFld);

final TextField emailTxtFld = new TextField();
emailTxtFld.setFieldLabel("Email");
emailTxtFld.setEmptyText("A valid email address");
emailTxtFld.setAllowBlank(false);
emailTxtFld.setSelectOnFocus(true);
panel.add(emailTxtFld);

final TextField usernameTxtFld = new TextField();
usernameTxtFld.setFieldLabel("Username");
usernameTxtFld.setEmptyText("Provide a username");
usernameTxtFld.setAllowBlank(false);
usernameTxtFld.setSelectOnFocus(true);
panel.add(usernameTxtFld);

final TextField pwd1TxtFld = new TextField();
pwd1TxtFld.setPassword(true);
pwd1TxtFld.setAllowBlank(false);
pwd1TxtFld.setFieldLabel("Password");
pwd1TxtFld.setSelectOnFocus(true);
panel.add(pwd1TxtFld);

final TextField pwd2TxtFld = new TextField();
pwd2TxtFld.setPassword(true);
pwd2TxtFld.setFieldLabel("Password (again)");
pwd2TxtFld.setSelectOnFocus(true);
pwd2TxtFld.setValidator(new Validator(){
public String validate(Field field, String value) {
if (!value.equals((String)pwd1TxtFld.getValue())) return "Passwords do not match";
return null;
}});
panel.add(pwd2TxtFld);

final TextArea termsTxtArea = new TextArea();
termsTxtArea.setFieldLabel("Terms & <br>Conditions");
termsTxtArea.setValue("Standard Terms and Conditions\n\nPLEASE READ VERY CAREFULLY THESE TERMS AND CONDITIONS AND THE WEBSITE BEFORE REGISTERING. PARTICIPATION INDICATES THAT YOU ACCEPT THESE TERMS AND CONDITIONS. IF YOU DO NOT ACCEPT THESE TERMS AND CONDITIONS, PLEASE DO NOT REGISTER FOR OR PARTICIPATE IN THIS ONLINE PROGRAM.");
termsTxtArea.setReadOnly(true);
termsTxtArea.setHeight(200);
panel.add(termsTxtArea);

final CheckBox accepttermsChkBox = new CheckBox();
accepttermsChkBox.setFieldLabel("Agreement");
accepttermsChkBox.setBoxLabel("I accept the Terms & Conditions above");
panel.add(accepttermsChkBox);

final Button registerBtn = new Button("Register");
panel.addButton(registerBtn);

registerBtn.addSelectionListener(new SelectionListener()
{
public void componentSelected(ComponentEvent ce)
{
Boolean value = (Boolean)accepttermsChkBox.getValue();

}
});

add(panel);

DeferredCommand.addCommand(new Command()
{
public void execute()
{
layout();
}
});
}
}
}

darrellmeyer
31 May 2008, 4:35 PM
Fix is in SVN.