Advertisement
Guest User

Untitled

a guest
Apr 25th, 2018
366
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
HTML 5.42 KB | None | 0 0
  1. /*
  2.  * To change this license header, choose License Headers in Project Properties.
  3.  * To change this template file, choose Tools | Templates
  4.  * and open the template in the editor.
  5.  */
  6. package org.foi.nwtis.brukrneti.web.zrna;
  7.  
  8. import java.io.Serializable;
  9. import java.util.ArrayList;
  10. import java.util.Date;
  11. import java.util.List;
  12. import javax.inject.Named;
  13. import javax.enterprise.context.RequestScoped;
  14. import org.foi.nwtis.brukrneti.web.kontrole.Izbornik;
  15. import org.foi.nwtis.brukrneti.web.kontrole.Poruka;
  16.  
  17. /**
  18.  *
  19.  * @author grupa_1
  20.  */
  21. @Named(value = "pregledPoruka")
  22. @RequestScoped
  23. public class PregledPoruka {
  24.     private String posluzitelj;
  25.     private String korisnickoIme;
  26.     private String lozinka;
  27.     private List<Izbornik> nizMapa;
  28.     private String odabranaMapa;
  29.     private List<Poruka> nizPoruka;
  30.     private Integer ukupanBrojPorukaMape;
  31.     private Integer brojPorukaPrikaz;
  32.     private Integer pozicijaOd;
  33.     private Integer pozicijaDo;
  34.  
  35.     /**
  36.      * Creates a new instance of PregledPoruka
  37.      */
  38.     public PregledPoruka() {
  39.         posluzitelj = "127.0.0.1";
  40.         korisnickoIme = "servis@nwtis.nastava.foi.hr";
  41.         lozinka = "123456";
  42.         preuzmiPoruke();
  43.         preuzmiMape();
  44.     }
  45.    
  46.     /**
  47.      * Metoda za preuzimanje mapa
  48.      */
  49.     private void preuzmiMape() {
  50.         nizMapa = new ArrayList<>();
  51.         nizMapa.add(new Izbornik("INBOX", "INBOX"));
  52.         //TODO provjeri da li postoji tražena mapa u sandučiću prema nazivu iz postavki
  53.         nizMapa.add(new Izbornik("NWTiS brukrneti poruke", "NWTiS brukrneti poruke"));
  54.     }
  55.  
  56.     private void preuzmiPoruke() {
  57.         nizPoruka = new ArrayList<>();
  58.         //TODO preuzmi poruke s email poslužitelja
  59.         int i=0;
  60.         nizPoruka.add(new Poruka(new Integer(i++).toString(), new Date(), new Date(), "brukrneti@foi.hr", "Poruka " + i, "{}", Poruka.VrstaPoruka.NWTiS_poruka));
  61.         nizPoruka.add(new Poruka(new Integer(i++).toString(), new Date(), new Date(), "brukrneti@foi.hr", "Poruka " + i, "{}", Poruka.VrstaPoruka.NWTiS_poruka));
  62.         nizPoruka.add(new Poruka(new Integer(i++).toString(), new Date(), new Date(), "brukrneti@foi.hr", "Poruka " + i, "{}", Poruka.VrstaPoruka.NWTiS_poruka));
  63.         nizPoruka.add(new Poruka(new Integer(i++).toString(), new Date(), new Date(), "brukrneti@foi.hr", "Poruka " + i, "{}", Poruka.VrstaPoruka.NWTiS_poruka));
  64.         nizPoruka.add(new Poruka(new Integer(i++).toString(), new Date(), new Date(), "brukrneti@foi.hr", "Poruka " + i, "{}", Poruka.VrstaPoruka.NWTiS_poruka));
  65.         nizPoruka.add(new Poruka(new Integer(i++).toString(), new Date(), new Date(), "brukrneti@foi.hr", "Poruka " + i, "{}", Poruka.VrstaPoruka.NWTiS_poruka));
  66.         nizPoruka.add(new Poruka(new Integer(i++).toString(), new Date(), new Date(), "brukrneti@foi.hr", "Poruka " + i, "{}", Poruka.VrstaPoruka.NWTiS_poruka));
  67.         nizPoruka.add(new Poruka(new Integer(i++).toString(), new Date(), new Date(), "brukrneti@foi.hr", "Poruka " + i, "{}", Poruka.VrstaPoruka.NWTiS_poruka));
  68.         nizPoruka.add(new Poruka(new Integer(i++).toString(), new Date(), new Date(), "brukrneti@foi.hr", "Poruka " + i, "{}", Poruka.VrstaPoruka.NWTiS_poruka));
  69.     }  
  70.    
  71.     public List<Izbornik> getNizMapa() {
  72.         return nizMapa;
  73.     }
  74.     public List<Poruka> getNizPoruka() {
  75.         return nizPoruka;
  76.     }
  77.     public String getOdabranaMapa() {
  78.         return odabranaMapa;
  79.     }
  80.     public void setOdabranaMapa(String odabranaMapa) {
  81.         this.odabranaMapa = odabranaMapa;
  82.     }
  83.     public Integer getUkupanBrojPorukaMape() {
  84.         return ukupanBrojPorukaMape;
  85.     }
  86.  
  87.     public void setUkupanBrojPorukaMape(Integer ukupanBrojPorukaMape) {
  88.         this.ukupanBrojPorukaMape = ukupanBrojPorukaMape;
  89.     }
  90.  
  91.     public Integer getBrojPorukaPrikaz() {
  92.         return brojPorukaPrikaz;
  93.     }
  94.  
  95.     public void setBrojPorukaPrikaz(Integer brojPorukaPrikaz) {
  96.         this.brojPorukaPrikaz = brojPorukaPrikaz;
  97.     }
  98.  
  99.     public Integer getPozicijaOd() {
  100.         return pozicijaOd;
  101.     }
  102.  
  103.     public void setPozicijaOd(Integer pozicijaOd) {
  104.         this.pozicijaOd = pozicijaOd;
  105.     }
  106.  
  107.     public Integer getPozicijaDo() {
  108.         return pozicijaDo;
  109.     }
  110.  
  111.     public void setPozicijaDo(Integer pozicijaDo) {
  112.         this.pozicijaDo = pozicijaDo;
  113.     }
  114.    
  115.    
  116.     /**
  117.      * Metoda za akciju promjenu mape
  118.      */
  119.     public String promjenaMape() {
  120.         return "PromjenaMape";
  121.     }
  122.     /**
  123.      * Metoda za akciju prikaza prethodnih poruka ako iste postoje
  124.      */
  125.     public String prethodnePoruke() {
  126.         return "PrethodnePoruke";
  127.         //TODO u pregledPoruka.xhtml dodat da se gumb ne prikazuje ako nema
  128.         //prethodnih poruka za što koristimo rendered
  129.     }
  130.     /**
  131.      * Metoda za akciju prikaza sljedećih poruka ako iste postoje
  132.      */
  133.     public String sljedecePoruke() {
  134.         return "SljedecePoruke";
  135.         //TODO isto ko slucaj iznad
  136.     }
  137.    
  138.     //dio za navigaciju
  139.     /**
  140.      * Metoda za navigaciju na stranicu index.xhtml
  141.      */
  142.     public String promjenaJezika() {
  143.         return "promjenaJezika";
  144.     }
  145.     /**
  146.      * Metoda za navigaciju na stranicu slanjePoruka.xhtml
  147.      */
  148.     public String slanjePoruka() {
  149.         return "slanjePoruka";
  150.     }
  151.     /**
  152.      * Metoda za navigaciju na stranicu pregledDnevnika.xhtml
  153.      */
  154.     public String pregledDnevnika(){
  155.         return "pregledDnevnika";
  156.     }
  157. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement