I have a LoginView which is displayed in a PopupPanel on which I set
setGlassEnabled(true)

The issue is, that the content of the panel itself are grayed out too.
Everything works, it is just gray.

I would be thankful to know what I am doing wrong.

There are two files involved: LoginView.ui.xml and LoginView.java

this is LoginView.ui.xml:
<!DOCTYPE ui:UiBinder
            SYSTEM "http://dl.google.com/gwt/DTD/xhtml.ent";
            >
<ui:UiBinder xmlns:ui='urn:ui:com.google.gwt.uibinder'
             xmlns:g='urn:import:com.google.gwt.user.client.ui'>
   <g:HTMLPanel>
         <table>
            <tr>
               <td>
                  <g:Label ui:field="lblTenant">Tenant</g:Label>
               </td>
               <td>
                  <g:ListBox multipleSelect="false" name="tenant"
ui:field="tenant"/>
               </td>
            </tr>
            <tr>
               <td>
                  <g:Label ui:field="lblUserName">User Name</g:Label>
               </td>
               <td>
                  <g:TextBox name="userName" ui:field="userName"/>
               </td>
            </tr>
            <tr>
               <td>
                  <g:Label ui:field="lblPassword">Password</g:Label>
               </td>
               <td>
                  <g:PasswordTextBox name="password"
ui:field="password"/>
               </td>
            </tr>
         </table>
         <g:Button ui:field="submit">Login</g:Button>
   </g:HTMLPanel>
</ui:UiBinder>

and this is the LoginView.java


package ch.sertal.vision.client.view;

import ch.sertal.vision.client.i18n.LoginConstants;
import ch.sertal.vision.client.model.ClientTenant;
import ch.sertal.vision.client.view.interfaces.ILoginView;
import com.google.gwt.core.client.GWT;
import com.google.gwt.event.dom.client.*;
import com.google.gwt.uibinder.client.UiBinder;
import com.google.gwt.uibinder.client.UiField;
import com.google.gwt.user.client.ui.*;
import com.google.inject.Inject;
import com.google.inject.Singleton;

import java.util.ArrayList;
import java.util.List;
import java.util.TreeSet;

/**
 * Created by IntelliJ IDEA.
 * User: micharoon
 * Date: 3/20/11
 * Time: 5:50 PM
 * To change this template use File | Settings | File Templates.
 */
@Singleton
public class LoginView extends Composite implements ILoginView {
   private static LoginConstants c = GWT.create(LoginConstants.class);

   @UiField
   TextBox userName;
   @UiField
   TextBox password;
   @UiField
   ListBox tenant;
   @UiField
   Button submit;
   @UiField
   Label lblPassword;
   @UiField
   Label lblUserName;
   @UiField
   Label lblTenant;

   DecoratedPopupPanel popupPanel;

   private int selectedTenant = -1;

   private ArrayList<ClientTenant> tenants;

   private Presenter presenter;

   interface LoginViewUiBinder extends UiBinder<Widget, LoginView> {}

   private static final LoginViewUiBinder binder =
GWT.create( LoginViewUiBinder.class );

   @Inject
   public LoginView() {
      initWidget(binder.createAndBindUi(this));
      tenant.addChangeHandler(new ChangeHandler() {
         @Override
         public void onChange(ChangeEvent changeEvent) {
            selectedTenant = tenant.getSelectedIndex();
         }
      });
      popupPanel = new DecoratedPopupPanel(false, true);
      popupPanel.add(this);
   }

   public TextBox getUserName() {
      return userName;
   }

   public TextBox getPassword() {
      return password;
   }

   public String getTenant() {
      return tenants.get(tenant.getSelectedIndex()).getTechName();
   }

   public void setTenant(String tenantName){
      for(ClientTenant tenant : tenants) {
         if(tenant.getTechName().equals(tenantName)){
            this.tenant.setSelectedIndex(tenants.indexOf(tenant));
            selectedTenant = tenants.indexOf(tenant);
            this.tenant.setEnabled(false);
            return;
         }
      }
      this.tenant.setEnabled(true);
   }

   public void setTenants(ArrayList<ClientTenant> tenants) {
      this.tenants = tenants;

      if(tenant != null)
         for(int i=tenant.getItemCount()-1; i >= 0; i--){
            tenant.removeItem(i);
         }

      for(ClientTenant t : tenants) {
         tenant.addItem(t.getName(c.locale()));
      }

      if(selectedTenant > -1){
         tenant.setSelectedIndex(selectedTenant);
      }
   }

   public Button getSubmit() {
      return submit;
   }

   @Override
   public void setPresenter(Presenter presenter) {
      this.presenter = presenter;
   }

   @Override
   public void show() {
      lblPassword.setText(c.password());
      lblTenant.setText(c.tenant());
      lblUserName.setText(c.userName());

      getSubmit().addClickHandler(new ClickHandler() {
         @Override
         public void onClick(ClickEvent clickEvent) {
            presenter.doLogin();
         }
      });

      KeyPressHandler loginOnReturn = new KeyPressHandler() {
         @Override
         public void onKeyPress(KeyPressEvent event) {
            if(event.getCharCode() == 10 | event.getCharCode() == 13){
               presenter.doLogin();
            }
         }
      };

      getUserName().addKeyPressHandler(loginOnReturn);
      getPassword().addKeyPressHandler(loginOnReturn);

      popupPanel.setGlassEnabled(false);

      popupPanel.center();
   }

   @Override
   public void hide() {
      popupPanel.hide();
   }


}

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

Reply via email to