public DialogBoxAlterarSenha(EstradaSolidariaServiceAsync estradaSolidariaService) {

    this.estradaService = estradaSolidariaService;
    this.idSessao = EstradaSolidaria.getIdSessaoAberta();

    setHTML("Editar senha");

    AbsolutePanel absolutePanel = new AbsolutePanel();
    setWidget(absolutePanel);
    absolutePanel.setSize("349px", "154px");

    Label lblSenha = new Label("Senha:");
    absolutePanel.add(lblSenha, 10, 20);

    Label lblConfirmeASenh = new Label("Confirme a senha:");
    absolutePanel.add(lblConfirmeASenh, 10, 53);

    textBoxSenha = new PasswordTextBox();
    textBoxSenha.addKeyPressHandler(
        new KeyPressHandler() {
          public void onKeyPress(KeyPressEvent event) {
            lblMensagemdeerro.setVisible(false);
            lblErro.setVisible(false);
          }
        });
    absolutePanel.add(textBoxSenha, 165, 20);

    textBoxSenha2 = new PasswordTextBox();
    textBoxSenha2.addKeyPressHandler(
        new KeyPressHandler() {
          public void onKeyPress(KeyPressEvent event) {
            lblMensagemdeerro.setVisible(false);
            lblErro.setVisible(false);
          }
        });
    absolutePanel.add(textBoxSenha2, 165, 53);

    TextButton txtbtnEnviar = new TextButton("Enviar");
    txtbtnEnviar.addClickHandler(
        new ClickHandler() {
          public void onClick(ClickEvent event) {
            if (!textBoxSenha.getText().equals(textBoxSenha2.getText())) {
              lblMensagemdeerro.setText("Redigite a senha");
              lblMensagemdeerro.setVisible(true);
              lblErro.setVisible(true);
            } else {
              editarSenhaGUI(idSessao, textBoxSenha2.getText());
            }
          }
        });
    absolutePanel.add(txtbtnEnviar, 181, 105);

    TextButton txtbtnCancelar = new TextButton("Cancelar");
    txtbtnCancelar.addClickHandler(
        new ClickHandler() {
          public void onClick(ClickEvent arg0) {
            hide();
          }
        });
    absolutePanel.add(txtbtnCancelar, 249, 105);

    lblMensagemdeerro = new Label("MensagemDeErro");
    lblMensagemdeerro.setStyleName("gwt-LabelEstradaSolidaria5");
    absolutePanel.add(lblMensagemdeerro, 10, 84);
    lblMensagemdeerro.setVisible(false);

    lblErro = new Label("*");
    lblErro.setStyleName("gwt-LabelEstradaSolidaria5");
    absolutePanel.add(lblErro, 336, 53);
    lblErro.setSize("13px", "16px");
    lblErro.setVisible(false);
  }
Example #2
0
  @Override
  public void onModuleLoad() {
    box = new AutoProgressMessageBox("Por favor espere", "Carregando sistema...");
    box.setProgressText("Iniciando...");
    box.auto();
    box.show();

    Timer t =
        new Timer() {

          // float i;
          @Override
          public void run() {
            // box.updateProgress(i / 100, "{0}% Completo");
            // i += 10;
            // ageitar contadores
            servico.iniciaSistema(
                new AsyncCallback<String>() {

                  @Override
                  public void onFailure(Throwable caught) {
                    AlertMessageBox d =
                        new AlertMessageBox(
                            "Desculpe", "Erro ao carregar sistema." + caught.getMessage());
                    // d.addHideHandler(hideHandler);
                    d.show();
                    // cancel();

                  }

                  @Override
                  public void onSuccess(String result) {
                    // AlertMessageBox d = new AlertMessageBox("Alerta", "OK");
                    // d.addHideHandler(hideHandler);
                    // d.show();
                  }
                });
            // if (i > 100) {
            //  cancel();

            // }
            box.hide();
            cancel();
          }
        };
    t.scheduleRepeating(3000);

    // painel principal
    rootPanel = RootPanel.get();

    Image image_5 = new Image("imagens/imagemPojeto.png");
    rootPanel.add(image_5, 0, 0);
    image_5.setSize("100%", "570px");

    final Label lblLogin = new Label("Login:"******"Senha:");
    rootPanel.add(lblSenha, 627, 285);

    // botao criar conta
    final TextButton txtbtnCriarContaAgora = new TextButton("Criar Conta Agora");
    txtbtnCriarContaAgora.addClickHandler(
        new ClickHandler() {

          @Override
          public void onClick(ClickEvent event) {
            CriarConta conta = new CriarConta();
            conta.load();
          }
        });
    rootPanel.add(txtbtnCriarContaAgora, 329, 360);

    Hyperlink htmlEsqueceuASenha = new Hyperlink("Esqueceu a senha?", true, "");
    // htmlEsqueceuASenha.setStyleName("serverResponseLabelError");
    htmlEsqueceuASenha.addClickHandler(
        new ClickHandler() {

          @Override
          public void onClick(ClickEvent event) {
            SenhaEsquecida senhaEsquecida = new SenhaEsquecida();
            senhaEsquecida.carregar();
          }
        });

    final TextBox textBox = new TextBox();
    // rootPanel.add(textBox, 676, 200);

    final PasswordTextBox passwordTextBox = new PasswordTextBox();

    passwordTextBox.setSize("161px", "16px");

    // botao logar
    final TextButton txtbtnLogar = new TextButton("Logar");
    txtbtnLogar.addClickHandler(
        new ClickHandler() {

          @Override
          public void onClick(ClickEvent event) {
            servico.getSenhaUsuarioLogin(
                textBox.getText(),
                new AsyncCallback<String>() {

                  @Override
                  public void onFailure(Throwable caught) {
                    AlertMessageBox d = new AlertMessageBox("Alerta", caught.getMessage());
                    d.show();
                  }

                  @Override
                  public void onSuccess(String result) {
                    if (passwordTextBox.getText().equals(result)) {
                      Logado log = new Logado(textBox.getText().trim(), result);
                      rootPanel.add(log.asWidget());
                    } else {
                      AlertMessageBox d = new AlertMessageBox("Alerta", "Senha incorreta.");
                      d.show();
                    }
                  }
                });
          }
        });
    rootPanel.add(txtbtnLogar, 676, 315);
    rootPanel.add(textBox, 676, 250);
    rootPanel.add(passwordTextBox, 678, 285);
    rootPanel.add(htmlEsqueceuASenha, 676, 342);
  }
  public StateEditarPerfil(EstradaSolidariaServiceAsync estradaSolidariaService, String[] result) {
    this.estradaService = estradaSolidariaService;
    this.idSessaoAberta = EstradaSolidaria.getIdSessaoAberta();
    this.dadosUsuario = result;

    Resources resources = GWT.create(Resources.class);

    AbsolutePanel absolutePanel_EditarPerfil = new AbsolutePanel();
    absolutePanel_EditarPerfil.setStylePrimaryName("painelPerfil3");
    initWidget(absolutePanel_EditarPerfil);
    absolutePanel_EditarPerfil.setSize("873px", "433px");

    Label lblEditarPerfil = new Label("Editar Perfil");
    lblEditarPerfil.setStyleName("gwt-LabelEstradaSolidaria2");
    absolutePanel_EditarPerfil.add(lblEditarPerfil, 183, 10);

    AbsolutePanel absolutePanel_1 = new AbsolutePanel();
    absolutePanel_EditarPerfil.add(absolutePanel_1, 54, 48);
    absolutePanel_1.setSize("812px", "375px");

    Label lblNewLabel = new Label("Login:"******"Editar");
    absolutePanel_1.add(txtBtnEditarLogin, 84, 32);

    textBoxNovoLogin = new TextBox();
    textBoxNovoLogin.addKeyPressHandler(
        new KeyPressHandler() {
          public void onKeyPress(KeyPressEvent event) {
            lblMensagemDeErroLogin.setVisible(false);
          }
        });
    absolutePanel_1.add(textBoxNovoLogin, 145, 32);
    textBoxNovoLogin.setVisible(false);

    txtbtnLoginOk = new TextButton("OK");
    txtbtnLoginOk.addClickHandler(
        new ClickHandler() {
          public void onClick(ClickEvent event) {
            editarLoginGUI(idSessaoAberta, textBoxNovoLogin.getText());
          }
        });
    absolutePanel_1.add(txtbtnLoginOk, 306, 32);
    txtbtnLoginOk.setVisible(false);

    Label lblSenha = new Label("Senha:");
    absolutePanel_1.add(lblSenha, 473, 10);

    TextButton txtbtnAlterarSenha = new TextButton("Alterar senha");
    txtbtnAlterarSenha.addClickHandler(
        new ClickHandler() {
          public void onClick(ClickEvent event) {
            DialogBox newDialog = new DialogBoxAlterarSenha(estradaService);
            newDialog.center();
            newDialog.show();
          }
        });
    absolutePanel_1.add(txtbtnAlterarSenha, 473, 32);

    Label lblNome = new Label("Nome:");
    absolutePanel_1.add(lblNome, 10, 85);

    lblNomeusuario = new Label(dadosUsuario[2]);
    absolutePanel_1.add(lblNomeusuario, 74, 85);

    TextButton btnEditarNome = new TextButton("Editar");
    absolutePanel_1.add(btnEditarNome, 85, 107);

    textBoxNovoNome = new TextBox();
    textBoxNovoNome.addKeyPressHandler(
        new KeyPressHandler() {
          public void onKeyPress(KeyPressEvent event) {
            lblMensagemDeErroNome.setVisible(false);
          }
        });
    absolutePanel_1.add(textBoxNovoNome, 145, 107);
    textBoxNovoNome.setVisible(false);

    txtbtnNomeOk = new TextButton("OK");
    txtbtnNomeOk.addClickHandler(
        new ClickHandler() {
          public void onClick(ClickEvent event) {
            editarNomeGUI(idSessaoAberta, textBoxNovoNome.getText());
          }
        });
    absolutePanel_1.add(txtbtnNomeOk, 306, 107);
    txtbtnNomeOk.setVisible(false);

    Label lblEmail = new Label("Email:");
    absolutePanel_1.add(lblEmail, 10, 164);

    lblEmaildousuario = new Label(dadosUsuario[4]);
    absolutePanel_1.add(lblEmaildousuario, 74, 164);

    TextButton btnEditarEmail = new TextButton("Editar");
    absolutePanel_1.add(btnEditarEmail, 85, 184);

    textBoxNovoEmail = new TextBox();
    textBoxNovoEmail.addKeyPressHandler(
        new KeyPressHandler() {
          public void onKeyPress(KeyPressEvent event) {
            lblMensagemDeErroEmail.setVisible(false);
          }
        });
    absolutePanel_1.add(textBoxNovoEmail, 145, 184);
    textBoxNovoEmail.setVisible(false);

    txtbtnEmailOk = new TextButton("OK");
    txtbtnEmailOk.addClickHandler(
        new ClickHandler() {
          public void onClick(ClickEvent event) {
            editarEmailGUI(idSessaoAberta, textBoxNovoEmail.getText());
          }
        });
    absolutePanel_1.add(txtbtnEmailOk, 306, 184);
    txtbtnEmailOk.setVisible(false);

    Label lblEndereo = new Label("Endereço:");
    absolutePanel_1.add(lblEndereo, 9, 243);

    lblEnderecodousuario = new Label(dadosUsuario[3]);
    absolutePanel_1.add(lblEnderecodousuario, 74, 243);

    TextButton btnEditarEndereco = new TextButton("Editar");
    absolutePanel_1.add(btnEditarEndereco, 85, 265);

    textBoxNovoEndereco = new TextBox();
    textBoxNovoEndereco.addKeyPressHandler(
        new KeyPressHandler() {
          public void onKeyPress(KeyPressEvent event) {
            lblMensagemDeErroEndereco.setVisible(false);
          }
        });
    absolutePanel_1.add(textBoxNovoEndereco, 145, 265);
    textBoxNovoEndereco.setVisible(false);

    txtbtnEnderecoOk = new TextButton("OK");
    txtbtnEnderecoOk.addClickHandler(
        new ClickHandler() {
          public void onClick(ClickEvent event) {
            editarEnderecoGUI(idSessaoAberta, textBoxNovoEndereco.getText());
          }
        });
    absolutePanel_1.add(txtbtnEnderecoOk, 306, 265);
    txtbtnEnderecoOk.setVisible(false);

    FileUpload fileUpload = new FileUpload();
    absolutePanel_1.add(fileUpload, 473, 319);
    fileUpload.setSize("330px", "22px");

    Image image = new Image(resources.getGenericUserImage());
    absolutePanel_1.add(image, 473, 174);
    image.setSize("126px", "139px");

    lblMensagemDeErroLogin = new Label("erro login");
    lblMensagemDeErroLogin.setStyleName("gwt-LabelEstradaSolidaria5");
    absolutePanel_1.add(lblMensagemDeErroLogin, 145, 62);
    lblMensagemDeErroLogin.setVisible(false);

    lblMensagemDeErroNome = new Label("erro nome");
    lblMensagemDeErroNome.setStyleName("gwt-LabelEstradaSolidaria5");
    absolutePanel_1.add(lblMensagemDeErroNome, 145, 141);
    lblMensagemDeErroNome.setVisible(false);

    lblMensagemDeErroEmail = new Label("erro email");
    lblMensagemDeErroEmail.setStyleName("gwt-LabelEstradaSolidaria5");
    absolutePanel_1.add(lblMensagemDeErroEmail, 145, 218);
    lblMensagemDeErroEmail.setVisible(false);

    lblMensagemDeErroEndereco = new Label("erro endereco");
    lblMensagemDeErroEndereco.setStyleName("gwt-LabelEstradaSolidaria5");
    absolutePanel_1.add(lblMensagemDeErroEndereco, 145, 297);
    lblMensagemDeErroEndereco.setVisible(false);

    btnEditarEndereco.addClickHandler(
        new ClickHandler() {
          public void onClick(ClickEvent event) {
            textBoxNovoEndereco.setVisible(true);
            txtbtnEnderecoOk.setVisible(true);
          }
        });

    btnEditarEmail.addClickHandler(
        new ClickHandler() {
          public void onClick(ClickEvent event) {
            textBoxNovoEmail.setVisible(true);
            txtbtnEmailOk.setVisible(true);
          }
        });

    btnEditarNome.addClickHandler(
        new ClickHandler() {
          public void onClick(ClickEvent event) {
            textBoxNovoNome.setVisible(true);
            txtbtnNomeOk.setVisible(true);
          }
        });

    txtBtnEditarLogin.addClickHandler(
        new ClickHandler() {
          public void onClick(ClickEvent event) {
            textBoxNovoLogin.setVisible(true);
            txtbtnLoginOk.setVisible(true);
          }
        });
  }