From 538543a7a010d6309707c8a81c5c5597c208e8d0 Mon Sep 17 00:00:00 2001 From: rmpestano Date: Fri, 19 Apr 2019 22:15:18 -0300 Subject: [PATCH 1/5] refs adminfaces/admin-template#175 --- pom.xml | 4 +- .../adminfaces/starter/bean/CarListMB.java | 5 +- .../adminfaces/starter/bean/IndexMB.java | 86 +++++++++++++++++++ .../github/adminfaces/starter/util/Utils.java | 5 +- src/main/webapp/index.xhtml | 37 +++++++- 5 files changed, 131 insertions(+), 6 deletions(-) create mode 100644 src/main/java/com/github/adminfaces/starter/bean/IndexMB.java diff --git a/pom.xml b/pom.xml index 666016a..70f5310 100755 --- a/pom.xml +++ b/pom.xml @@ -1,7 +1,7 @@ + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd" + xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> 4.0.0 com.github.adminfaces admin-starter diff --git a/src/main/java/com/github/adminfaces/starter/bean/CarListMB.java b/src/main/java/com/github/adminfaces/starter/bean/CarListMB.java index 3df4ee3..0f1aa61 100644 --- a/src/main/java/com/github/adminfaces/starter/bean/CarListMB.java +++ b/src/main/java/com/github/adminfaces/starter/bean/CarListMB.java @@ -36,7 +36,7 @@ public class CarListMB implements Serializable { List selectedCars; //cars selected in checkbox column List filteredValue;// datatable filteredValue attribute (column filters) - + @PostConstruct public void initDataModel() { cars = new LazyDataModel() { @@ -68,6 +68,8 @@ public Car getRowData(String key) { return carService.findById(new Integer(key)); } }; + + } public void clear() { @@ -135,4 +137,5 @@ public Integer getId() { public void setId(Integer id) { this.id = id; } + } diff --git a/src/main/java/com/github/adminfaces/starter/bean/IndexMB.java b/src/main/java/com/github/adminfaces/starter/bean/IndexMB.java new file mode 100644 index 0000000..16d1ea7 --- /dev/null +++ b/src/main/java/com/github/adminfaces/starter/bean/IndexMB.java @@ -0,0 +1,86 @@ +/* + * To change this license header, choose License Headers in Project Properties. + * To change this template file, choose Tools | Templates + * and open the template in the editor. + */ +package com.github.adminfaces.starter.bean; + +import java.io.Serializable; +import java.util.ArrayList; +import java.util.List; +import java.util.stream.IntStream; +import javax.annotation.PostConstruct; +import javax.inject.Named; +import org.omnifaces.cdi.ViewScoped; + +/** + * + * @author rmpestano + */ +@Named +@ViewScoped +public class IndexMB implements Serializable { + + List itens; + + List subItens; + + List filteredSubItens = new ArrayList<>(); + + String selectedItem; + + String selectedSubItem; + + @PostConstruct + public void init() { + itens = new ArrayList<>(15); + subItens = new ArrayList<>(150); + + IntStream.rangeClosed(1, 15) + .forEach(i -> { + itens.add("item " + i); + IntStream.rangeClosed(1, 10) + .forEach(j -> { + subItens.add("subitem " + i + "" + j); + }); + }); + } + + public List getItens() { + return itens; + } + + public void setItens(List itens) { + this.itens = itens; + } + + public List getFilteredSubItens() { + return filteredSubItens; + } + + public void setFilteredSubItens(List filteredSubItens) { + this.filteredSubItens = filteredSubItens; + } + + public String getSelectedItem() { + return selectedItem; + } + + public void setSelectedItem(String selectedItem) { + this.selectedItem = selectedItem; + } + + public String getSelectedSubItem() { + return selectedSubItem; + } + + public void setSelectedSubItem(String selectedSubItem) { + this.selectedSubItem = selectedSubItem; + } + + public void onItemChange() { + filteredSubItens.clear(); + subItens.stream().filter(subItem -> selectedItem != null && subItem.contains(selectedItem)) + .forEach(filteredSubItens::add); + } +} diff --git a/src/main/java/com/github/adminfaces/starter/util/Utils.java b/src/main/java/com/github/adminfaces/starter/util/Utils.java index 88847a3..e495d3b 100644 --- a/src/main/java/com/github/adminfaces/starter/util/Utils.java +++ b/src/main/java/com/github/adminfaces/starter/util/Utils.java @@ -11,21 +11,22 @@ import java.util.ArrayList; import java.util.List; import java.util.stream.IntStream; +import javax.inject.Named; /** * Created by rmpestano on 07/02/17. */ +@Named @ApplicationScoped public class Utils implements Serializable { private List cars; - @PostConstruct public void init() { cars = new ArrayList<>(); IntStream.rangeClosed(1, 50) - .forEach(i -> cars.add(create(i))); + .forEach(i -> cars.add(create(i))); } private static Car create(int i) { diff --git a/src/main/webapp/index.xhtml b/src/main/webapp/index.xhtml index 6746cbc..5409d47 100644 --- a/src/main/webapp/index.xhtml +++ b/src/main/webapp/index.xhtml @@ -2,7 +2,9 @@ + template="#{layoutMB.template}" + xmlns:f="http://xmlns.jcp.org/jsf/core" + xmlns:h="http://xmlns.jcp.org/jsf/html"> @@ -19,6 +21,39 @@ +
+ + + +
+
+
+ +
+
+ + + + + +
+
+ +
+
+ +
+
+ + + + +
+
+
+
+
+ From 4589131f418dbf0cd22f1866d6587c9218516eba Mon Sep 17 00:00:00 2001 From: rmpestano Date: Fri, 19 Apr 2019 22:27:08 -0300 Subject: [PATCH 2/5] refs adminfaces/admin-template#175 --- pom.xml | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/pom.xml b/pom.xml index 70f5310..e8e3c59 100755 --- a/pom.xml +++ b/pom.xml @@ -37,6 +37,11 @@ 6.1.1 + + org.omnifaces + omnifaces + 3.2 + From 49f47aa0a96541d028e26b7ce131da0fedeb48a2 Mon Sep 17 00:00:00 2001 From: rmpestano Date: Sat, 1 Jun 2019 19:25:29 -0300 Subject: [PATCH 3/5] update to AF 1.0.1 --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index e8e3c59..ab127db 100755 --- a/pom.xml +++ b/pom.xml @@ -11,7 +11,7 @@ UTF-8 - 1.0.0 + 1.0.1 From 68f71f4eb4b5832115b165d7a7d10583ed69b224 Mon Sep 17 00:00:00 2001 From: rmpestano Date: Sun, 2 Jun 2019 10:55:07 -0300 Subject: [PATCH 4/5] update to AdminFaces 1.0.2 --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index ab127db..3908540 100755 --- a/pom.xml +++ b/pom.xml @@ -11,7 +11,7 @@ UTF-8 - 1.0.1 + 1.0.2 From 4a295e091652f0104db1aa5a1062bfa5426186e4 Mon Sep 17 00:00:00 2001 From: rmpestano Date: Sat, 29 Jun 2019 11:17:46 -0300 Subject: [PATCH 5/5] fix swarm profile --- pom.xml | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/pom.xml b/pom.xml index 3908540..36a587e 100755 --- a/pom.xml +++ b/pom.xml @@ -98,6 +98,11 @@ ejb ${version.wildfly-swarm} + + org.omnifaces + omnifaces + 2.1 +