Cambios menores en vista home y managed Bean pasado a ViewScoped.
This commit is contained in:
@@ -8,6 +8,9 @@
|
|||||||
<h:form>
|
<h:form>
|
||||||
<p:panel header="Pagina principal">
|
<p:panel header="Pagina principal">
|
||||||
<div class="ui-g ui-fluid">
|
<div class="ui-g ui-fluid">
|
||||||
|
<div class="ui-g-12 ui-md-12">
|
||||||
|
Logeado como: <h:outputLabel value="#{home.userDisplayName}" style="font-weight: bold;" />
|
||||||
|
</div>
|
||||||
<div class="ui-g-2 ui-md-2">
|
<div class="ui-g-2 ui-md-2">
|
||||||
<p:outputLabel for="selectorTema" value="Cambio de tema" />
|
<p:outputLabel for="selectorTema" value="Cambio de tema" />
|
||||||
</div>
|
</div>
|
||||||
@@ -22,32 +25,6 @@
|
|||||||
<p:commandButton value="Usar tema" update="messages" action="#{sessionPreferences.updateCurrentTheme}" icon="pi pi-save" />
|
<p:commandButton value="Usar tema" update="messages" action="#{sessionPreferences.updateCurrentTheme}" icon="pi pi-save" />
|
||||||
</div>
|
</div>
|
||||||
<div class="ui-g-5 ui-md-5" />
|
<div class="ui-g-5 ui-md-5" />
|
||||||
|
|
||||||
<div class="ui-g-2 ui-md-2">
|
|
||||||
<div class="ui-inputgroup">
|
|
||||||
<p:calendar pattern="dd/MM/yyyy" showButtonPanel="true" autocomplete="true" />
|
|
||||||
<p:commandButton value="Fecha" />
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="ui-g-10 ui-md-10" />
|
|
||||||
|
|
||||||
<div class="ui-g-2 ui-md-2">
|
|
||||||
<h:outputLabel value="Fecha" />
|
|
||||||
<p:calendar pattern="dd/MM/yyyy" showButtonPanel="true" autocomplete="true" />
|
|
||||||
</div>
|
|
||||||
<div class="ui-g-10 ui-md-10" />
|
|
||||||
|
|
||||||
<div class="ui-g-12">
|
|
||||||
<h:outputLabel value="Rich Text Editor" />
|
|
||||||
</div>
|
|
||||||
<div class="ui-g-12 ui-md-12">
|
|
||||||
<p:editor />
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="ui-g-12 ui-md-12">
|
|
||||||
<h:outputLabel value="Logeado como:" />
|
|
||||||
<p:inputText readonly="true" value="#{home.userName}" />
|
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
</p:panel>
|
</p:panel>
|
||||||
</h:form>
|
</h:form>
|
||||||
|
|||||||
@@ -4,8 +4,8 @@ import java.io.Serializable;
|
|||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import javax.annotation.PostConstruct;
|
import javax.annotation.PostConstruct;
|
||||||
import javax.enterprise.context.RequestScoped;
|
|
||||||
import javax.faces.application.FacesMessage;
|
import javax.faces.application.FacesMessage;
|
||||||
|
import javax.faces.view.ViewScoped;
|
||||||
import javax.inject.Named;
|
import javax.inject.Named;
|
||||||
|
|
||||||
import common.UserType;
|
import common.UserType;
|
||||||
@@ -16,22 +16,23 @@ import common.UserType;
|
|||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
@Named("home")
|
@Named("home")
|
||||||
@RequestScoped
|
@ViewScoped
|
||||||
public class homeMBean extends ManagedBeanBase implements Serializable {
|
public class homeMBean extends ManagedBeanBase implements Serializable {
|
||||||
|
|
||||||
private static final long serialVersionUID = 1L;
|
private static final long serialVersionUID = 1L;
|
||||||
private boolean isLogedIn;
|
private boolean isLogedIn;
|
||||||
private String userId;
|
private String userId;
|
||||||
private String userName;
|
private String userName;
|
||||||
|
private String userDisplayName;
|
||||||
private UserType userType;
|
private UserType userType;
|
||||||
private int refresh;
|
|
||||||
|
|
||||||
@PostConstruct
|
@PostConstruct
|
||||||
public void init() {
|
public void init() {
|
||||||
isLogedIn = SessionUtils.isLogedIn();
|
this.isLogedIn = SessionUtils.isLogedIn();
|
||||||
userName = SessionUtils.getUserName();
|
this.userName = SessionUtils.getUserName();
|
||||||
userId = SessionUtils.getUserId();
|
this.userDisplayName = SessionUtils.getUserDisplayName();
|
||||||
userType = SessionUtils.getUserType();
|
this.userId = SessionUtils.getUserId();
|
||||||
|
this.userType = SessionUtils.getUserType();
|
||||||
|
|
||||||
FacesMessage message = SessionUtils.getMessage();
|
FacesMessage message = SessionUtils.getMessage();
|
||||||
|
|
||||||
@@ -54,6 +55,13 @@ public class homeMBean extends ManagedBeanBase implements Serializable {
|
|||||||
else
|
else
|
||||||
return this.userName;
|
return this.userName;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public String getUserDisplayName() {
|
||||||
|
if (this.isLogedIn == false)
|
||||||
|
return "Invitado";
|
||||||
|
else
|
||||||
|
return this.userDisplayName;
|
||||||
|
}
|
||||||
|
|
||||||
public String getUserId() {
|
public String getUserId() {
|
||||||
return this.userId;
|
return this.userId;
|
||||||
@@ -63,14 +71,6 @@ public class homeMBean extends ManagedBeanBase implements Serializable {
|
|||||||
return this.userType.getUserTypename();
|
return this.userType.getUserTypename();
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getRefresh() {
|
|
||||||
return refresh;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setRefresh(int refresh) {
|
|
||||||
this.refresh = refresh;
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean isPatient() {
|
public boolean isPatient() {
|
||||||
return (this.userType == UserType.PATIENT);
|
return (this.userType == UserType.PATIENT);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user