Rev 210 | Details | Compare with Previous | Last modification | View Log | RSS feed
| Rev | Author | Line No. | Line |
|---|---|---|---|
| 210 | espaco | 1 | package br.com.ec.controller; |
| 2 | |||
| 3 | import java.util.HashMap; |
||
| 4 | import java.util.Map; |
||
| 5 | |||
| 6 | import javax.faces.application.FacesMessage; |
||
| 242 | espaco | 7 | import javax.inject.Named; |
| 210 | espaco | 8 | |
| 9 | import org.primefaces.PrimeFaces; |
||
| 10 | import org.primefaces.event.SelectEvent; |
||
| 11 | import org.springframework.context.annotation.Scope; |
||
| 12 | |||
| 242 | espaco | 13 | @Named |
| 210 | espaco | 14 | @Scope("view") |
| 15 | public class DFView { |
||
| 16 | |||
| 17 | public void viewProducts() { |
||
| 18 | Map<String,Object> options = new HashMap<>(); |
||
| 19 | options.put("resizable", false); |
||
| 20 | PrimeFaces.current().dialog().openDynamic("viewProducts", options, null); |
||
| 21 | } |
||
| 22 | |||
| 23 | public void viewProductsCustomized() { |
||
| 24 | Map<String,Object> options = new HashMap<>(); |
||
| 25 | options.put("modal", true); |
||
| 26 | options.put("width", 640); |
||
| 27 | options.put("height", 340); |
||
| 28 | options.put("contentWidth", "100%"); |
||
| 29 | options.put("contentHeight", "100%"); |
||
| 30 | options.put("headerElement", "customheader"); |
||
| 31 | |||
| 32 | PrimeFaces.current().dialog().openDynamic("viewProducts", options, null); |
||
| 33 | } |
||
| 34 | |||
| 35 | public void chooseProduct() { |
||
| 36 | Map<String,Object> options = new HashMap<>(); |
||
| 37 | options.put("resizable", false); |
||
| 38 | options.put("draggable", false); |
||
| 39 | options.put("modal", true); |
||
| 40 | PrimeFaces.current().dialog().openDynamic("selectProduct", options, null); |
||
| 41 | } |
||
| 42 | |||
| 43 | public void onProductChosen(SelectEvent event) { |
||
| 44 | /* |
||
| 45 | Product product = (Product) event.getObject(); |
||
| 46 | FacesMessage message = new FacesMessage(FacesMessage.SEVERITY_INFO, "Product Selected", "Name:" + product.getName()); |
||
| 47 | |||
| 48 | FacesContext.getCurrentInstance().addMessage(null, message); |
||
| 49 | */ |
||
| 50 | } |
||
| 51 | |||
| 52 | public void showMessage() { |
||
| 53 | FacesMessage message = new FacesMessage(FacesMessage.SEVERITY_INFO, "Message", " Always Bet on Prime!"); |
||
| 54 | |||
| 55 | PrimeFaces.current().dialog().showMessageDynamic(message); |
||
| 56 | } |
||
| 57 | } |