// MPL License text (see http://www.mozilla.org/MPL/) <ui:composition xmlns="http://www.w3.org/1999/xhtml" xmlns:h="http://java.sun.com/jsf/html" xmlns:f="http://java.sun.com/jsf/core" xmlns:c="http://java.sun.com/jsp/jstl/core" xmlns:ace="http://www.icefaces.org/icefaces/components" xmlns:icecore="http://www.icefaces.org/icefaces/core" xmlns:ui="http://java.sun.com/jsf/facelets" template="/resources/templates/content-template.xhtml"> <ui:param name="title" value="#{msgs['example.core.push.title']}"/> <ui:param name="description" value="#{msgs['example.core.push.description']}"/> <ui:param name="resourceValue" value="#{pushBean.exampleResource}"/> <ui:param name="wikiResources" value="#{pushResources.wikiResources}"/> <ui:param name="tldResources" value="#{pushResources.tldResources}"/> <ui:define name="example"> <icecore:push group="#{pushWindowScopeBean.group}"/> <h:form> <ace:selectMenu value="#{pushWindowScopeBean.strategyIndex}" label="Select push strategy:" labelPosition="left" actionListener="#{pushWindowScopeBean.updateStrategy}"> <f:selectItem itemValue="0" itemLabel="-"/> <f:selectItem itemValue="1" itemLabel="Update page every second"/> <f:selectItem itemValue="2" itemLabel="Update page every 2 seconds 5 times"/> <f:selectItem itemValue="3" itemLabel="Update page once after 3 second delay"/> <ace:ajax execute="@this" render="@all"/> </ace:selectMenu> <ace:panel> <ace:chart id="chart" animated="false" value="#{pushWindowScopeBean.barData}" stackSeries="false" defaultAxesConfig="#{pushWindowScopeBean.defaultAxis}" xAxis="#{pushWindowScopeBean.axisX}" yAxis="#{pushWindowScopeBean.axisY}" legend="true" legendPlacement="OUTSIDE_GRID" highlighter="true" highlighterLocation="N" highlighterShowMarker="false" highlighterBringSeriesToFront="true"/> <ace:dataTable id="table" value="#{pushWindowScopeBean.items}" var="item" paginatorPosition="bottom" rows="10"> <ace:column headerText="A"> <h:outputText value="#{item.a}"/> </ace:column> <ace:column headerText="B"> <h:outputText value="#{item.b}"/> </ace:column> <ace:column headerText="C"> <h:outputText value="#{item.c}"/> </ace:column> <ace:column headerText="D"> <h:outputText value="#{item.d}"/> </ace:column> </ace:dataTable> </ace:panel> </h:form> </ui:define> </ui:composition>
/* MPL License text (see http://www.mozilla.org/MPL/) */ package org.icefaces.samples.showcase.example.core.push; import org.icefaces.samples.showcase.metadata.annotation.*; import org.icefaces.samples.showcase.metadata.context.ComponentExampleImpl; import javax.annotation.PostConstruct; import javax.faces.bean.CustomScoped; import javax.faces.bean.ManagedBean; import java.io.Serializable; import org.icefaces.samples.showcase.util.FacesUtils; @ComponentExample( title = "example.core.push.title", description = "example.core.push.description", example = "/resources/examples/core/push/push.xhtml" ) @ExampleResources( resources ={ // xhtml @ExampleResource(type = ResourceType.xhtml, title="push.xhtml", resource = "/resources/examples/core/push/push.xhtml"), // Java Source @ExampleResource(type = ResourceType.java, title="PushBean.java", resource = "/WEB-INF/classes/org/icefaces/samples/showcase"+ "/example/core/push/PushBean.java") } ) @Menu( title = "menu.core.push.subMenu.title", menuLinks = { @MenuLink(title = "menu.core.push.subMenu.main", isDefault = true, exampleBeanName = PushBean.BEAN_NAME) } ) @ManagedBean(name = PushBean.BEAN_NAME) @CustomScoped(value = "#{window}") public class PushBean extends ComponentExampleImpl<PushBean> implements Serializable { public static final String BEAN_NAME = "pushBean"; public String getBeanName() { return BEAN_NAME; } public PushBean() { super(PushBean.class); } @PostConstruct public void initMetaData() { super.initMetaData(); } public void selected() { PushWindowScopeBean managedBean = (PushWindowScopeBean) FacesUtils.getManagedBean(PushWindowScopeBean.BEAN_NAME); managedBean.selected(); } public void deselected() { PushWindowScopeBean managedBean = (PushWindowScopeBean) FacesUtils.getManagedBean(PushWindowScopeBean.BEAN_NAME); managedBean.deselected(); } }