Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
Clear All
new posts

    Upgrade from 2.5 to 4.0

    Be sure your post includes:

    2. browser(s) and version(s) involved: Firefox 22, on OpenSuse 12.3

    I have a LoginWidget which uses 2 textitems, 2 linkitems, and 2 buttons.
    This was working with SmartGWT 2.5, but I upgraded to GWT 2.5.1 and SmartGWT from 2.t to 4.0. Here are the definitions.

    Code:
    private TextItem loginUserField = new TextItem(Constants.LOGIN_USERNAME, Constants.TITLE_LOGIN_USERNAME);
        private PasswordItem loginPasswordField =
            new PasswordItem(Constants.LOGIN_PASSWORD, Constants.TITLE_LOGIN_PASSWORD);
        private LinkItem loginForgotUsernameField = new LinkItem(Constants.LOGIN_FORGOT_USERNAME);
        private LinkItem loginForgotPasswordField = new LinkItem(Constants.LOGIN_FORGOT_PASSWORD);
    Here is the code that builds the login form:
    Code:
    private DynamicForm getLoginForm()
        {
            loginForm = new DynamicForm();
            loginForm.setBorder("3px solid black");
            loginForm.setPadding(Constants.UI_PADDING_2);
            loginForm.setAutoHeight();
            loginForm.setDataSource(loginDS);
            loginForm.setNumCols(2);
            loginForm.setAutoFocus(true);
            loginForm.setTitleWidth(200);
            loginForm.setWidth(400);
            loginForm.setAlign(Alignment.CENTER);
            loginForm.setSaveOnEnter(true);
            loginForm.setLayoutAlign(VerticalAlignment.CENTER);
    
            loginUserField.setIconVAlign(VerticalAlignment.CENTER);
            loginUserField.setTabIndex(0);
            loginUserField.setRequired(true);
            loginUserField.setSelectOnFocus(true);
            loginUserField.setWidth(150);
    
            loginForgotUsernameField.setTitle(" ");
            loginForgotUsernameField.setLinkTitle(Constants.TITLE_LOGIN_FORGOT_USERNAME);
            loginForgotUsernameField.addClickHandler(new ClickHandler()
            {
    
                @Override
                public void onClick(ClickEvent event)
                {
                    // SC.say("Hello World: forgot username");
                    setupForgtUsernameFormWindow();
    
                }
            });
    
            loginPasswordField.setTabIndex(1);
            loginPasswordField.setRequired(true);
            loginPasswordField.setWidth(150);
    
            loginForgotPasswordField.setTitle(" ");
            loginForgotPasswordField.setLinkTitle(Constants.TITLE_LOGIN_FORGOT_PASSWORD);
            loginForgotPasswordField.addClickHandler(new ClickHandler()
            {
                public void onClick(ClickEvent event)
                {
                    String username = loginUserField.getValueAsString();
    
                    if (username == null)
                    {
                        SC.say("Must enter username first!");
                    }
                    else
                    {
                        // SC.say("Hello World: forgot password");
                        Criteria c = new Criteria();
                        c.addCriteria(Constants.USER_USERNAME, username);
    
                        // fetch User based on username
                        loginDS.fetchData(c, new DSCallback()
                        {
    
                            @Override
                            public void execute(DSResponse response, Object rawData, DSRequest request)
                            {
                                // SC.say("test", response.getAttribute("data"));
                                _userDto = (UserDTO) response.getAttributeAsObject("user");
    
                                if (_userDto == null)
                                {
                                    SC.say("Unable to find user with this username");
                                }
                                else
                                {
                                    setupForgtPasswordFormWindow();
                                }
                            }
    
                        });
                    }
    
                }
            });
    
            loginForm.setFields(loginUserField, loginForgotUsernameField, loginPasswordField, loginForgotPasswordField);
            loginForm.setAutoFocus(true);
    
            return loginForm;
        }
    So, what is happening is that the two textboxes are not editable, I cannot enter in any data to the text boxes. The Link items are appearing as blank textboxes rather than links.

    I deleted my "target" directory, and rebuilt the application with maven, refreshed the project, cleaned the project, and refreshed again, but to no avail. I am sure if I started a fresh project this would work well. Is there any link to help in upgrading? Is there any other place I need to clean out?

    Thanks!
    Tom

    #2
    Upgrade Issues

    Just for anyone who needs this help, it turns out it must have been some sort of internal difference between the versions of SmartGWT ... in 2.5 it worked, but in 4.0 it didn't.

    1) The first thing I did was create a new SmartGWT 4.0 application being over all my old code, and I got the same issue.

    2) I created a new SmartGWT 4.0 application, and create a new login form for myself and that seemed to work.

    3) I backed up my old LoginWidget to have a copy, then I stripped it down to nothing. I slowly add piece by piece back until I discover what was broken.

    The login form was originally attached to the datasource in 2.5, in 4.0 I changed that. Since in both versions, when you hit the login button, it makes a loginDS.fetch with the criteria of the username and password. since I am calling a fetch against the loginDS (RestDataSource) directly, there was no need to attach the loginDS to the form, which was making it not work the way I expected it to.

    Again, it didn't matter in 2.5, but it did in 4.0.

    Comment

    Working...
    X