Skip to content
Snippets Groups Projects
Commit fa7130d9 authored by Falucho's avatar Falucho
Browse files

front end

parent 654ce355
No related branches found
Tags REP_v2.0
No related merge requests found
package uy.edu.fing.tse.jsf;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import uy.edu.fing.tse.central.business.BusinessLocal;
import uy.edu.fing.tse.central.business.common.Notifier;
import uy.edu.fing.tse.dto.Peripherical;
import javax.annotation.PostConstruct;
import javax.ejb.EJB;
import javax.faces.event.AbortProcessingException;
import javax.faces.event.AjaxBehaviorEvent;
import javax.faces.push.Push;
import javax.faces.push.PushContext;
import javax.faces.view.ViewScoped;
import javax.inject.Inject;
import javax.inject.Named;
import java.io.Serializable;
import java.time.LocalDateTime;
import java.util.ArrayList;
import java.util.List;
@ViewScoped
@Named("faller")
public class RequestBean implements Serializable {
private static final long serialVersionUID = 4465735311570405045L;
private static final Logger LOG = LoggerFactory.getLogger(RequestBean.class);
@EJB
private BusinessLocal negocio;
@Inject
@Push
PushContext channel;
private Peripherical peri;
private String name = "German";
private String async;
private List<String> mensaje = new ArrayList<>();
@PostConstruct
public void init() {
LOG.info("Init");
mensaje.add("INIT");
Notifier.subscribe("test", this::pushToChannel);
}
public void pushed(AjaxBehaviorEvent e) throws AbortProcessingException {
LOG.info("ajax pushed: " + e.toString());
mensaje.add("ajaxListenerEvent is sent at: " + LocalDateTime.now());
}
public void commandScriptExecuted() {
LOG.info("commandScriptExecuted pushed.");
mensaje.add("commandScriptExecuted message is sent at: " + LocalDateTime.now());
}
public void pushToChannel(String s) {
mensaje.add("Push: " + s);
channel.send("updatemsg");
}
public void hacerAlgo() {
LOG.info("hacerAlgo");
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getAsync() {
return async;
}
public void setAsync(String async) {
this.async = async;
}
public Peripherical getPeri() {
return peri;
}
public void setPeri(Peripherical peri) {
this.peri = peri;
}
public List<String> getMensajes() {
return mensaje;
}
public void setMensajes(List<String> mensaje) {
this.mensaje = mensaje;
}
}
package uy.edu.fing.tse.jsf;
package uy.edu.fing.tse.jsf.ws.sample;
import javax.faces.event.AbortProcessingException;
import javax.faces.event.AjaxBehaviorEvent;
......
......@@ -33,18 +33,15 @@
<h:body>
<header>
<h1>BackOffice - feiknius</h1>
<p:panelMenu rendered="#{session.getAttribute('user')!=null}">
</p:panelMenu>
<p:commandButton value="Salir" action="#{userLoginView.logout()}"
rendered="#{session.getAttribute('user')!=null}"/>
<p:commandButton value="Listar Hechos" action="gestionhechos.xhtml?faces-redirect=true"
async="true"/>
<p:commandButton value="Publicar Hechos" action="publicarcancelar.xhtml?faces-redirect=true"
async="true" rendered="#{session.getAttribute('role') == 'Submitter'}"/>
<h:form>
<p:megaMenu orientation="horizontal" style="margin-top:20px"
rendered="#{session.getAttribute('user')!=null}">
<p:menuitem value="Salir" action="#{userLoginView.logout()}"/>
<p:menuitem value="Listar Hechos" action="gestionhechos.xhtml?faces-redirect=true" async="true"/>
<p:menuitem value="Publicar Hechos" action="publicarcancelar.xhtml?faces-redirect=true" async="true"
rendered="#{session.getAttribute('role') == 'Submitter'}"/>
</p:megaMenu>
</h:form>
</header>
<!-- Menús, headers y t0do lo que vaya antes del contenido -->
<p:messages/>
......
......@@ -2,15 +2,8 @@
<html lang="en">
<head>
<meta charset="UTF-8">
<title>TSE 2019 - Practico JSF</title>
<meta http-equiv="refresh" content="0; url=getNoticias.xhtml">
<title>BackOffice - feiknius</title>
<meta http-equiv="refresh" content="0; url=gestionhechos.xhtml">
</head>
<body>
<h1>TSE 2019 - Practico JSF</h1>
<br>
<a href="getNoticias.xhtml">getNoticias</a>
</body>
<body></body>
</html>
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment