diff --git a/backoffice/src/main/java/uy/edu/fing/tse/jsf/RequestBean.java b/backoffice/src/main/java/uy/edu/fing/tse/jsf/RequestBean.java deleted file mode 100644 index b73c2ca0a6f5d84b4a4c2707f5118da762e7f26a..0000000000000000000000000000000000000000 --- a/backoffice/src/main/java/uy/edu/fing/tse/jsf/RequestBean.java +++ /dev/null @@ -1,107 +0,0 @@ -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; - } -} - - - diff --git a/backoffice/src/main/java/uy/edu/fing/tse/jsf/AjaxBean.java b/backoffice/src/main/java/uy/edu/fing/tse/jsf/ws/sample/AjaxBean.java similarity index 97% rename from backoffice/src/main/java/uy/edu/fing/tse/jsf/AjaxBean.java rename to backoffice/src/main/java/uy/edu/fing/tse/jsf/ws/sample/AjaxBean.java index da97badf2ccec58a7d30e0629b2877cd0ffa310d..95c9d14a5e9c7eb31246a397c678e753e7302145 100644 --- a/backoffice/src/main/java/uy/edu/fing/tse/jsf/AjaxBean.java +++ b/backoffice/src/main/java/uy/edu/fing/tse/jsf/ws/sample/AjaxBean.java @@ -1,4 +1,4 @@ -package uy.edu.fing.tse.jsf; +package uy.edu.fing.tse.jsf.ws.sample; import javax.faces.event.AbortProcessingException; import javax.faces.event.AjaxBehaviorEvent; diff --git a/backoffice/src/main/webapp/WEB-INF/templates/template.xhtml b/backoffice/src/main/webapp/WEB-INF/templates/template.xhtml index 0bd403f4163bb07b7ff12f0754d974cdf96aa180..7f24bbd18c2517856e5f3b13b3263cb2f63dac4b 100644 --- a/backoffice/src/main/webapp/WEB-INF/templates/template.xhtml +++ b/backoffice/src/main/webapp/WEB-INF/templates/template.xhtml @@ -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/> diff --git a/backoffice/src/main/webapp/jsf/index.html b/backoffice/src/main/webapp/jsf/index.html index 425f74d6ea6b17ee38d63ce205b64c590b59d260..dda0a23c87ec9e23f66da54dad08efe4293982b3 100644 --- a/backoffice/src/main/webapp/jsf/index.html +++ b/backoffice/src/main/webapp/jsf/index.html @@ -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 diff --git a/backoffice/src/main/webapp/jsf/getNoticias.xhtml b/backoffice/src/main/webapp/jsf/practico/getNoticias.xhtml similarity index 100% rename from backoffice/src/main/webapp/jsf/getNoticias.xhtml rename to backoffice/src/main/webapp/jsf/practico/getNoticias.xhtml diff --git a/backoffice/src/main/webapp/jsf/noticia.xhtml b/backoffice/src/main/webapp/jsf/practico/noticia.xhtml similarity index 100% rename from backoffice/src/main/webapp/jsf/noticia.xhtml rename to backoffice/src/main/webapp/jsf/practico/noticia.xhtml diff --git a/backoffice/src/main/webapp/jsf/ajax.xhtml b/backoffice/src/main/webapp/jsf/webSocketSample/ajax.xhtml similarity index 100% rename from backoffice/src/main/webapp/jsf/ajax.xhtml rename to backoffice/src/main/webapp/jsf/webSocketSample/ajax.xhtml