예제 #1
0
  public void onSuccessfulLogin2() {

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

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

    /**
     * ******************************************** Cabecera
     * ******************************************************
     */
    HorizontalLayout headHorizontalLayout = new HorizontalLayout();
    headHorizontalLayout.setWidth("100%");
    headHorizontalLayout.setHeight("80");
    logoPNG = new Embedded(null, new ThemeResource("images/logo.png"));
    logoPNG.setWidth("140");
    logoPNG.setHeight("60");
    headHorizontalLayout.addComponent(logoPNG);
    headHorizontalLayout.setComponentAlignment(logoPNG, Alignment.MIDDLE_LEFT);
    headHorizontalLayout.setExpandRatio(logoPNG, 3);
    UserTab userTab = new UserTab(this);
    headHorizontalLayout.addComponent(userTab);
    headHorizontalLayout.setComponentAlignment(userTab, Alignment.MIDDLE_RIGHT);
    headHorizontalLayout.setExpandRatio(userTab, 1);
    /**
     * *********************************************************************
     * ***************************************
     */
    /**
     * ******************************************** Barra Menú
     * ****************************************************
     */
    toolbar = new YacareToolbar(this);
    /**
     * *********************************************************************
     * ***************************************
     */
    /**
     * ******************************************** Cuerpo de página
     * **********************************************
     */
    bodyPageVerticalLayout = new VerticalLayout();
    bodyPageVerticalLayout.addComponent(headHorizontalLayout);
    bodyPageVerticalLayout.addComponent(toolbar);
    YacareFooter footer = new YacareFooter();
    bodyPageVerticalLayout.addComponent(footer);
    bodyPageVerticalLayout.setComponentAlignment(footer, Alignment.BOTTOM_CENTER);
    /**
     * *********************************************************************
     * ***************************************
     */
    getMainWindow().setContent(bodyPageVerticalLayout);
  }
예제 #2
0
  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);
  }