public void attach() {

    super.attach();
    x = 0;
    this.setHeight("100%");
    buildview();
  }
示例#2
0
  /*
   * Why do I need to override this method just so I can put some data in the
   * VerticalComponentGroup? Was expecting some kind of listener or abstract
   * init method instead.
   */
  @Override
  protected void onBecomingVisible() {
    super.onBecomingVisible();

    // Would rather use a listener than overriding methods
    updateList();
  }
示例#3
0
  public void attach() {

    buildview();
    //	this.setCaption("New Nurse");
    //	getWindow().setClosable(true);
    navigationView.setCaption("New Nurse");
    setWidth("100%");
    setHeight("80%");
    this.setClosable(true);
    this.setModal(true);
  }
示例#4
0
  @SuppressWarnings("serial")
  public NotAllowedPopover() {
    setWidth("75%");

    VerticalLayout layout = new VerticalLayout();
    layout.setMargin(true);
    layout.setSpacing(true);
    setHeight("150px");

    Label lbl;
    layout.addComponent(
        lbl =
            new Label(
                "This mmowgli game does not allow guest access.  Thank you for your interest."));

    layout.setExpandRatio(lbl, 1.0f);
    Button closeButt;
    layout.addComponent(closeButt = new Button("Close"));

    NavigationView nv = new NavigationView(layout);
    nv.setCaption("Access Not Allowed");
    setContent(nv);
    this.center();

    closeButt.addClickListener(
        new ClickListener() {
          @Override
          public void buttonClick(ClickEvent event) {
            HSess.init();
            GameLinks links = GameLinks.getTL();
            HSess.close();

            UI.getCurrent().getPage().setLocation(links.getThanksForInterestLink());
            getSession().close();
          }
        });
  }
示例#5
0
  private void buildview() {
    // TODO Auto-generated method stub
    adnurse.setCaption("Add Nurse");
    adnurse.getLayout().addComponent(SSN);
    SSN.setRequired(true);
    Validator ssnValidator =
        new RegexpValidator("[0-9]{6}-[0-9]{3}[0-9a-zA-Z]", "SSN must be in the form 123456-123X.");
    SSN.addValidator(ssnValidator);
    adnurse.getLayout().addComponent(Fname);
    Fname.setRequired(true);
    adnurse.getLayout().addComponent(Lname);
    Lname.setRequired(true);
    adnurse.getLayout().addComponent(Email);
    Email.addValidator(new EmailValidator("Invalid Email Address"));
    adnurse.getLayout().addComponent(Phone);
    adnurse.getLayout().addComponent(Password);
    Password.setRequired(true);
    adnurse.getLayout().addComponent(P2);
    P2.setRequired(true);
    adnurse.setFooter(new VerticalLayout());
    HorizontalLayout bar = new HorizontalLayout();
    adnurse.getFooter().addComponent(bar);

    save.addListener(
        new ClickListener() {

          public void buttonClick(ClickEvent event) {
            // TODO Auto-generated method stub

            if (SSN.isValid() == false) {
              // getWindow().showNotification("INCORRECT SSN");
              getWindow().showNotification("Incorrect SSN", Window.Notification.TYPE_ERROR_MESSAGE);
            }
            if (Fname.isValid() == false) {
              // fname= Fname.getValue().toString();
              // Fname.setValue("");
              getWindow()
                  .showNotification("Enter first name", Window.Notification.TYPE_ERROR_MESSAGE);
            }

            if (Lname.isValid() == false) {
              getWindow()
                  .showNotification("Enter Last name", Window.Notification.TYPE_ERROR_MESSAGE);
            }

            // fname= Fname.getValue().toString();
            // lname = Lname.getValue().toString();
            // email =Email.getValue().toString();
            // phone = Phone.getValue().toString();

            if (Password.getValue().toString().equals(P2.getValue().toString())) {
              if (Password.isValid()) {
                password = Password.getValue().toString();
                // Password.setValue("");
                // P2.setValue("");
              } else {
                Password.setValue("");
                P2.setValue("");
                getWindow()
                    .showNotification("Invalid Password", Window.Notification.TYPE_ERROR_MESSAGE);
              }

            } else {
              Password.setValue("");
              P2.setValue("");
              getWindow()
                  .showNotification(
                      "Password Doesn't Match", Window.Notification.TYPE_ERROR_MESSAGE);
            }
            //	password = Password.getValue().toString();
            //	pt.addnurse(ssn,fname,lname,email,phone,password);
            if (SSN.isValid() == true
                && Fname.isValid() == true
                && Lname.isValid() == true
                && Password.isValid() == true
                && Password.getValue().toString().equals(P2.getValue().toString()) == true) {

              ssn = SSN.getValue().toString();
              fname = Fname.getValue().toString();
              lname = Lname.getValue().toString();
              email = Email.getValue().toString();
              phone = Phone.getValue().toString();
              password = Password.getValue().toString();
              pt.addnurse(ssn, fname, lname, email, phone, password);
              SSN.setValue("");
              Fname.setValue("");
              Lname.setValue("");
              Password.setValue("");
              P2.setValue("");
              Email.setValue("");
              Phone.setValue("");
              getWindow()
                  .showNotification(
                      "Welcome To Smart Dosing", Window.Notification.TYPE_HUMANIZED_MESSAGE);
            }
          }
        });
    cancel.addListener(
        new ClickListener() {

          public void buttonClick(ClickEvent event) {
            // TODO Auto-generated method stub
            close();
          }
        });

    Button close =
        new Button(
            null,
            new ClickListener() {

              public void buttonClick(ClickEvent event) {
                event
                    .getButton()
                    .getWindow()
                    .getParent()
                    .removeWindow(event.getButton().getWindow());
              }
            });
    close.setIcon(new ThemeResource("logout.png"));

    navigationView.setRightComponent(close);
    save.setWidth("40%");
    cancel.setWidth("40%");
    bar.addComponent(save);
    bar.addComponent(cancel);
    adn.addComponent(adnurse);
    setContent(navigationView);
  }