Example #1
0
  public void loadStudents(List<Enrollment> enrs) {
    lstStudents.removeAllItems();

    for (Enrollment enr : enrs) {
      lstStudents.addItem(enr);
      StringBuffer caption = new StringBuffer();

      PhysicalPerson person = enr.getAdmissionAct().getStudent().getPhysicalPerson();

      if (person.getIdentificationNumber() != null) {
        caption.append(person.getIdentificationNumber() + "-");
      } else {
        caption.append("-- ");
      }

      if (person.getLastName() != null) {
        caption.append(person.getLastName() + ", ");
      } else {
        caption.append("--");
      }

      if (person.getName() != null) {
        caption.append(person.getName());
      } else {
        caption.append("--");
      }

      lstStudents.setItemCaption(enr, caption.toString());
    }
  }
Example #2
0
  public void search(String filter) {
    PhysicalPerson physicalPersonFilter = new PhysicalPerson();

    Integer idNmb = null;

    try {
      idNmb = Integer.parseInt(filter);
      physicalPersonFilter.setLastName(null);
      physicalPersonFilter.setIdentificationNumber(filter);
    } catch (Exception e) {
      physicalPersonFilter.setLastName(filter.trim());
      physicalPersonFilter.setIdentificationNumber(null);
    }

    try {
      List<Enrollment> lstEnr = widget.getFilter(physicalPersonFilter);
      loadStudents(lstEnr);
      removeItemLeftIfExistRight();

    } catch (Exception e) {
      e.printStackTrace();
    }
  }
  public void onSuccessfulLogin() {

    userCurrent = ((User) getUser());

    this.context = (WebApplicationContext) getContext();
    context
        .getHttpSession()
        .setAttribute("session", HibernateUtil.getSessionFactory().openSession());
    context.getHttpSession().setAttribute("userName", userCurrent.getName());
    context.getHttpSession().setAttribute("user", userCurrent);

    controlUserPermissions = new ControlUserPermissions(userCurrent, context);

    String propName = this.getProperty("pathEntityOrder");
    String propPath =
        this.getContext().getBaseDirectory().getAbsolutePath() + File.separator + propName;
    HibernateUtil.getEntityOrder(propPath);

    // cargar foto
    PhysicalPerson physicalPerson = userCurrent.getPhysicalPerson();
    String fileName = "";

    Embedded embedded = null;
    if (physicalPerson != null
        && physicalPerson.getDocumentObject() != null
        && physicalPerson.getDocumentObject().getName() != null) {
      fileName = physicalPerson.getDocumentObject().getName();

      if (checkFile(
          fileName,
          FactoryI18nManager.getI18nManager().getPathMessages("url.path.upload.photos")
              + File.separatorChar)) {
        FileResource resource =
            new FileResource(
                new File(
                    (FactoryI18nManager.getI18nManager().getPathMessages("url.path.upload.photos")
                        + File.separatorChar
                        + fileName)),
                this);
        embedded = new Embedded(null, resource);
      } else {
        embedded = new Embedded(null, new ThemeResource("images/apps/persona.gif"));
      }
    } else {
      embedded = new Embedded(null, new ThemeResource("images/apps/persona.gif"));
    }

    embedded.setWidth("63");
    embedded.setHeight("100%");

    logoHeaderPNG = new Embedded(null, new ThemeResource("images/apps/yacare.png"));
    logoHeaderPNG.setWidth("70");
    logoHeaderPNG.setHeight("50");

    descriptionPNG = new Embedded(null, new ThemeResource("images/apps/yacareDescription.png"));
    descriptionPNG.setWidth("420");
    descriptionPNG.setHeight("20");

    HorizontalLayout logosLayout = new HorizontalLayout();
    // logosLayout.setSpacing(true);
    logosLayout.addComponent(logoHeaderPNG);
    logosLayout.setComponentAlignment(logoHeaderPNG, Alignment.MIDDLE_CENTER);
    logosLayout.addComponent(descriptionPNG);
    logosLayout.setComponentAlignment(descriptionPNG, Alignment.MIDDLE_CENTER);
    logosLayout.setMargin(false, false, false, false);

    UserTabHeader userTab =
        new UserTabHeader(
            userCurrent.getPhysicalPerson().getLastName()
                + ", "
                + userCurrent.getPhysicalPerson().getName(),
            userCurrent.getName(),
            embedded,
            getURL().getPath());

    /**
     * ******************************************** Cabecera
     * ******************************************************
     */
    HorizontalLayout headHorizontalLayout = new HorizontalLayout();
    headHorizontalLayout.setWidth("100%");
    headHorizontalLayout.setHeight("50");
    headHorizontalLayout.addComponent(logosLayout);
    headHorizontalLayout.setComponentAlignment(logosLayout, Alignment.MIDDLE_LEFT);
    headHorizontalLayout.setExpandRatio(logosLayout, 3);
    headHorizontalLayout.addComponent(userTab);
    headHorizontalLayout.setComponentAlignment(userTab, Alignment.MIDDLE_RIGHT);
    headHorizontalLayout.setExpandRatio(userTab, 1);
    /**
     * ************************************************************************************************************
     */
    /**
     * ******************************************** Barra Menú
     * ****************************************************
     */
    toolbar = new YacareToolbar(this);
    /**
     * ************************************************************************************************************
     */
    /**
     * ******************************************** Footer
     * ****************************************************
     */
    YacareFooter footer = new YacareFooter();
    /**
     * ********************************************
     * ****************************************************
     */
    VerticalLayout vl = new VerticalLayout();
    vl.setWidth("100%");
    vl.setSpacing(false);
    vl.setMargin(false);
    vl.addComponent(headHorizontalLayout);
    vl.addComponent(toolbar);
    /**
     * ******************************************** Cuerpo de página
     * **********************************************
     */
    verticalLayout = new VerticalLayout();
    verticalLayout.setSpacing(false);
    verticalLayout.setMargin(false);
    verticalLayout.setSizeFull();
    verticalLayout.addComponent(vl);
    verticalLayout.setComponentAlignment(vl, Alignment.TOP_CENTER);
    verticalLayout.addComponent(footer);
    verticalLayout.setComponentAlignment(footer, Alignment.BOTTOM_CENTER);
    /**
     * ************************************************************************************************************
     */
    getMainWindow().setContent(verticalLayout);
  }