<h:form id="form"> <p:growl id="msgs" showDetail="true" skipDetailIfEqualsSummary="true" /> <h3 style="margin-top:0">Basic</h3> <p:tabView> <p:tab title="Godfather Part I"> <h:panelGrid columns="2" cellpadding="10"> <p:graphicImage name="demo/images/godfather/godfather1.jpg" /> <h:outputText value="The story begins as Don Vito Corleone, the head of a New York Mafia family, oversees his daughter's wedding. His beloved son Michael has just come home from the war, but does not intend to become part of his father's business. Through Michael's life the nature of the family business becomes clear. The business of the family is just like the head of the family, kind and benevolent to those who give respect, but given to ruthless violence whenever anything stands against the good of the family." /> </h:panelGrid> </p:tab> <p:tab title="Godfather Part II"> <h:panelGrid columns="2" cellpadding="10"> <p:graphicImage name="demo/images/godfather/godfather2.jpg" /> <h:outputText value="Francis Ford Coppola's legendary continuation and sequel to his landmark 1972 film, The_Godfather, parallels the young Vito Corleone's rise with his son Michael's spiritual fall, deepening The_Godfather's depiction of the dark side of the American dream. In the early 1900s, the child Vito flees his Sicilian village for America after the local Mafia kills his family. Vito struggles to make a living, legally or illegally, for his wife and growing brood in Little Italy, killing the local Black Hand Fanucci after he demands his customary cut of the tyro's business. With Fanucci gone, Vito's communal stature grows." /> </h:panelGrid> </p:tab> <p:tab title="Godfather Part III"> <h:panelGrid columns="2" cellpadding="10"> <p:graphicImage name="demo/images/godfather/godfather3.jpg" /> <h:outputText value="After a break of more than 15 years, director Francis Ford Coppola and writer Mario Puzo returned to the well for this third and final story of the fictional Corleone crime family. Two decades have passed, and crime kingpin Michael Corleone, now divorced from his wife Kay has nearly succeeded in keeping his promise that his family would one day be completely legitimate." /> </h:panelGrid> </p:tab> </p:tabView> <h3>On-Demand Loading</h3> <p:tabView dynamic="true" cache="true" effect="fold"> <p:tab title="Godfather Part I"> <h:panelGrid columns="2" cellpadding="10"> <p:graphicImage name="demo/images/godfather/godfather1.jpg" /> <h:outputText value="The story begins as Don Vito Corleone, the head of a New York Mafia family, oversees his daughter's wedding. His beloved son Michael has just come home from the war, but does not intend to become part of his father's business. Through Michael's life the nature of the family business becomes clear. The business of the family is just like the head of the family, kind and benevolent to those who give respect, but given to ruthless violence whenever anything stands against the good of the family." /> </h:panelGrid> </p:tab> <p:tab title="Godfather Part II"> <h:panelGrid columns="2" cellpadding="10"> <p:graphicImage name="demo/images/godfather/godfather2.jpg" /> <h:outputText value="Francis Ford Coppola's legendary continuation and sequel to his landmark 1972 film, The_Godfather, parallels the young Vito Corleone's rise with his son Michael's spiritual fall, deepening The_Godfather's depiction of the dark side of the American dream. In the early 1900s, the child Vito flees his Sicilian village for America after the local Mafia kills his family. Vito struggles to make a living, legally or illegally, for his wife and growing brood in Little Italy, killing the local Black Hand Fanucci after he demands his customary cut of the tyro's business. With Fanucci gone, Vito's communal stature grows." /> </h:panelGrid> </p:tab> <p:tab title="Godfather Part III"> <h:panelGrid columns="2" cellpadding="10"> <p:graphicImage name="demo/images/godfather/godfather3.jpg" /> <h:outputText value="After a break of more than 15 years, director Francis Ford Coppola and writer Mario Puzo returned to the well for this third and final story of the fictional Corleone crime family. Two decades have passed, and crime kingpin Michael Corleone, now divorced from his wife Kay has nearly succeeded in keeping his promise that his family would one day be completely legitimate." /> </h:panelGrid> </p:tab> </p:tabView> <h3>Events</h3> <p:tabView> <p:ajax event="tabChange" listener="#{tabbedView.onTabChange}" update=":form:msgs"/> <p:ajax event="tabClose" listener="#{tabbedView.onTabClose}" update=":form:msgs"/> <p:tab title="Godfather Part I"> <h:panelGrid columns="2" cellpadding="10"> <p:graphicImage name="demo/images/godfather/godfather1.jpg" /> <h:outputText value="The story begins as Don Vito Corleone, the head of a New York Mafia family, oversees his daughter's wedding. His beloved son Michael has just come home from the war, but does not intend to become part of his father's business. Through Michael's life the nature of the family business becomes clear. The business of the family is just like the head of the family, kind and benevolent to those who give respect, but given to ruthless violence whenever anything stands against the good of the family." /> </h:panelGrid> </p:tab> <p:tab title="Godfather Part II" closable="true"> <h:panelGrid columns="2" cellpadding="10"> <p:graphicImage name="demo/images/godfather/godfather2.jpg" /> <h:outputText value="Francis Ford Coppola's legendary continuation and sequel to his landmark 1972 film, The_Godfather, parallels the young Vito Corleone's rise with his son Michael's spiritual fall, deepening The_Godfather's depiction of the dark side of the American dream. In the early 1900s, the child Vito flees his Sicilian village for America after the local Mafia kills his family. Vito struggles to make a living, legally or illegally, for his wife and growing brood in Little Italy, killing the local Black Hand Fanucci after he demands his customary cut of the tyro's business. With Fanucci gone, Vito's communal stature grows." /> </h:panelGrid> </p:tab> <p:tab title="Godfather Part III" closable="true"> <h:panelGrid columns="2" cellpadding="10"> <p:graphicImage name="demo/images/godfather/godfather3.jpg" /> <h:outputText value="After a break of more than 15 years, director Francis Ford Coppola and writer Mario Puzo returned to the well for this third and final story of the fictional Corleone crime family. Two decades have passed, and crime kingpin Michael Corleone, now divorced from his wife Kay has nearly succeeded in keeping his promise that his family would one day be completely legitimate." /> </h:panelGrid> </p:tab> </p:tabView> <h3>DataModel</h3> <p:tabView value="#{tabbedView.cars}" var="car"> <p:tab title="Car - #{car.id}"> <h:panelGrid columns="2" cellpadding="5"> <f:facet name="header"> <p:graphicImage name="demo/images/car/#{car.brand}-big.gif" /> </f:facet> <h:outputText value="Brand:" style="font-weight: bold"/> <h:outputText value="#{car.brand}" /> <h:outputText value="Year:" style="font-weight: bold"/> <h:outputText value="#{car.year}" /> <h:outputText value="Color:" style="font-weight: bold"/> <h:outputText value="#{car.color}" /> </h:panelGrid> </p:tab> </p:tabView> <h3>DataModel - Dynamic rendered Tabs</h3> <p:tabView value="#{tabbedView.cars}" var="car"> <p:tab title="Car - #{car.id}" rendered="#{car.brand eq 'BMW'}"> <h:panelGrid columns="2" cellpadding="5"> <f:facet name="header"> <p:graphicImage name="demo/images/car/#{car.brand}-big.gif" /> </f:facet> <h:outputText value="Brand:" style="font-weight: bold"/> <h:outputText value="#{car.brand}" /> <h:outputText value="Year:" style="font-weight: bold"/> <h:outputText value="#{car.year}" /> <h:outputText value="Color:" style="font-weight: bold"/> <h:outputText value="#{car.color}" /> </h:panelGrid> </p:tab> </p:tabView> <h3>Scrollable</h3> <p:tabView scrollable="true"> <p:tab title="Tab 1">Tab 1 Content</p:tab> <p:tab title="Tab 2">Tab 2 Content</p:tab> <p:tab title="Tab 3">Tab 3 Content</p:tab> <p:tab title="Tab 4">Tab 4 Content</p:tab> <p:tab title="Tab 5">Tab 5 Content</p:tab> <p:tab title="Tab 6">Tab 6 Content</p:tab> <p:tab title="Tab 7">Tab 7 Content</p:tab> <p:tab title="Tab 8">Tab 8 Content</p:tab> <p:tab title="Tab 9">Tab 9 Content</p:tab> <p:tab title="Tab 10">Tab 10 Content</p:tab> <p:tab title="Tab 11">Tab 11 Content</p:tab> <p:tab title="Tab 12">Tab 12 Content</p:tab> <p:tab title="Tab 13">Tab 13 Content</p:tab> <p:tab title="Tab 14">Tab 14 Content</p:tab> <p:tab title="Tab 15">Tab 15 Content</p:tab> <p:tab title="Tab 16">Tab 16 Content</p:tab> <p:tab title="Tab 17">Tab 17 Content</p:tab> <p:tab title="Tab 18">Tab 18 Content</p:tab> <p:tab title="Tab 19">Tab 19 Content</p:tab> <p:tab title="Tab 20">Tab 20 Content</p:tab> <p:tab title="Tab 21">Tab 21 Content</p:tab> <p:tab title="Tab 22">Tab 22 Content</p:tab> <p:tab title="Tab 23">Tab 23 Content</p:tab> <p:tab title="Tab 24">Tab 24 Content</p:tab> <p:tab title="Tab 25">Tab 25 Content</p:tab> </p:tabView> <h3>Orientation - Top|Bottom|Left|Right</h3> <p:tabView orientation="left"> <p:tab title="Godfather Part I"> <h:panelGrid columns="2" cellpadding="10"> <p:graphicImage name="demo/images/godfather/godfather1.jpg" /> <h:outputText value="The story begins as Don Vito Corleone, the head of a New York Mafia family, oversees his daughter's wedding. His beloved son Michael has just come home from the war, but does not intend to become part of his father's business. Through Michael's life the nature of the family business becomes clear. The business of the family is just like the head of the family, kind and benevolent to those who give respect, but given to ruthless violence whenever anything stands against the good of the family." /> </h:panelGrid> </p:tab> <p:tab title="Godfather Part II"> <h:panelGrid columns="2" cellpadding="10"> <p:graphicImage name="demo/images/godfather/godfather2.jpg" /> <h:outputText value="Francis Ford Coppola's legendary continuation and sequel to his landmark 1972 film, The_Godfather, parallels the young Vito Corleone's rise with his son Michael's spiritual fall, deepening The_Godfather's depiction of the dark side of the American dream. In the early 1900s, the child Vito flees his Sicilian village for America after the local Mafia kills his family. Vito struggles to make a living, legally or illegally, for his wife and growing brood in Little Italy, killing the local Black Hand Fanucci after he demands his customary cut of the tyro's business. With Fanucci gone, Vito's communal stature grows." /> </h:panelGrid> </p:tab> <p:tab title="Godfather Part III"> <h:panelGrid columns="2" cellpadding="10"> <p:graphicImage name="demo/images/godfather/godfather3.jpg" /> <h:outputText value="After a break of more than 15 years, director Francis Ford Coppola and writer Mario Puzo returned to the well for this third and final story of the fictional Corleone crime family. Two decades have passed, and crime kingpin Michael Corleone, now divorced from his wife Kay has nearly succeeded in keeping his promise that his family would one day be completely legitimate." /> </h:panelGrid> </p:tab> </p:tabView> <h3>Actions Facet</h3> <p:tabView> <p:tab title="Godfather Part I"> <f:facet name="actions"> <p:menuButton value="Options"> <p:menuitem value="Save" icon="pi pi-save"/> <p:menuitem value="Update" icon="pi pi-refresh"/> <p:menuitem value="Delete" ajax="false" icon="pi pi-times"/> <p:separator /> <p:menuitem value="Homepage" url="http://www.primefaces.org" icon="pi pi-home"/> </p:menuButton> <p:menuButton value="Settings"> <p:menuitem value="Toggle" url="#" icon="pi pi-clone" /> <p:menuitem value="Remove" url="#" icon="pi pi-times" /> </p:menuButton> </f:facet> <h:panelGrid columns="2" cellpadding="10"> <p:graphicImage name="demo/images/godfather/godfather1.jpg" /> <h:outputText value="The story begins as Don Vito Corleone, the head of a New York Mafia family, oversees his daughter's wedding. His beloved son Michael has just come home from the war, but does not intend to become part of his father's business. Through Michael's life the nature of the family business becomes clear. The business of the family is just like the head of the family, kind and benevolent to those who give respect, but given to ruthless violence whenever anything stands against the good of the family." /> </h:panelGrid> </p:tab> <p:tab title="Godfather Part II"> <f:facet name="actions"> <p:button value="Process" /> </f:facet> <h:panelGrid columns="2" cellpadding="10"> <p:graphicImage name="demo/images/godfather/godfather2.jpg" /> <h:outputText value="Francis Ford Coppola's legendary continuation and sequel to his landmark 1972 film, The_Godfather, parallels the young Vito Corleone's rise with his son Michael's spiritual fall, deepening The_Godfather's depiction of the dark side of the American dream. In the early 1900s, the child Vito flees his Sicilian village for America after the local Mafia kills his family. Vito struggles to make a living, legally or illegally, for his wife and growing brood in Little Italy, killing the local Black Hand Fanucci after he demands his customary cut of the tyro's business. With Fanucci gone, Vito's communal stature grows." /> </h:panelGrid> </p:tab> <p:tab title="Godfather Part III"> <h:panelGrid columns="2" cellpadding="10"> <p:graphicImage name="demo/images/godfather/godfather3.jpg" /> <h:outputText value="After a break of more than 15 years, director Francis Ford Coppola and writer Mario Puzo returned to the well for this third and final story of the fictional Corleone crime family. Two decades have passed, and crime kingpin Michael Corleone, now divorced from his wife Kay has nearly succeeded in keeping his promise that his family would one day be completely legitimate." /> </h:panelGrid> </p:tab> </p:tabView> </h:form>
@Named @RequestScoped public class TabbedView { private List<Car> cars; @PostConstruct public void init() { cars = new ArrayList<Car>(); cars.add(new Car("Y25YIH5", "Fiat", 2014, "Black", 10000, true)); cars.add(new Car("JHF261G", "BMW", 2013, "Blue", 50000, true)); cars.add(new Car("HSFY23H", "Ford", 2012, "Black", 35000, false)); cars.add(new Car("GMDK353", "Volvo", 2014, "White", 40000, true)); cars.add(new Car("345GKM5", "Jaguar", 2011, "Gray", 48000, false)); cars.add(new Car("JIF261G", "BMW", 2011, "White", 52000, true)); } public List<Car> getCars() { return cars; } public void onTabChange(TabChangeEvent event) { FacesMessage msg = new FacesMessage("Tab Changed", "Active Tab: " + event.getTab().getTitle()); FacesContext.getCurrentInstance().addMessage(null, msg); } public void onTabClose(TabCloseEvent event) { FacesMessage msg = new FacesMessage("Tab Closed", "Closed tab: " + event.getTab().getTitle()); FacesContext.getCurrentInstance().addMessage(null, msg); } }
public class Car implements Serializable { public String id; public String brand; public int year; public String color; public int price; public boolean sold; public Car() {} public Car(String id, String brand, int year, String color) { this.id = id; this.brand = brand; this.year = year; this.color = color; } public Car(String id, String brand, int year, String color, int price, boolean sold) { this.id = id; this.brand = brand; this.year = year; this.color = color; this.price = price; this.sold = sold; } public String getId() { return id; } public void setId(String id) { this.id = id; } public String getBrand() { return brand; } public void setBrand(String brand) { this.brand = brand; } public int getYear() { return year; } public void setYear(int year) { this.year = year; } public String getColor() { return color; } public void setColor(String color) { this.color = color; } public int getPrice() { return price; } public void setPrice(int price) { this.price = price; } public boolean isSold() { return sold; } public void setSold(boolean sold) { this.sold = sold; } @Override public int hashCode() { int hash = 7; hash = 59 * hash + (this.id != null ? this.id.hashCode() : 0); return hash; } @Override public boolean equals(Object obj) { if (obj == null) { return false; } if (getClass() != obj.getClass()) { return false; } final Car other = (Car) obj; if ((this.id == null) ? (other.id != null) : !this.id.equals(other.id)) { return false; } return true; } }