JBoss Rich Faces SVN: r10609 - in trunk/test-applications/facelets/src/main/java: extendedDataTable and 1 other directory.
by richfaces-svn-commits@lists.jboss.org
Author: mvitenkov
Date: 2008-09-29 14:14:39 -0400 (Mon, 29 Sep 2008)
New Revision: 10609
Added:
trunk/test-applications/facelets/src/main/java/extendedDataTable/
trunk/test-applications/facelets/src/main/java/extendedDataTable/DemoPatient.java
trunk/test-applications/facelets/src/main/java/extendedDataTable/DemoPatientProvider.java
trunk/test-applications/facelets/src/main/java/extendedDataTable/ExtendedDataTableBB.java
trunk/test-applications/facelets/src/main/java/extendedDataTable/ExtendedDataTableControlBean.java
Log:
+java beans extendedDataTable
Added: trunk/test-applications/facelets/src/main/java/extendedDataTable/DemoPatient.java
===================================================================
--- trunk/test-applications/facelets/src/main/java/extendedDataTable/DemoPatient.java (rev 0)
+++ trunk/test-applications/facelets/src/main/java/extendedDataTable/DemoPatient.java 2008-09-29 18:14:39 UTC (rev 10609)
@@ -0,0 +1,86 @@
+package extendedDataTable;
+
+import java.io.Serializable;
+import java.util.Date;
+
+/**
+ * @author pkawiak
+ */
+
+public class DemoPatient implements Serializable{
+
+ /**
+ *
+ */
+ private static final long serialVersionUID = -2265498014894008031L;
+ private Integer id;
+ private String firstName;
+ private String lastName;
+ private Date admissionDate;
+
+ DemoPatient(Integer id, String firstName, String lastName, Date admissionDate) {
+ this.id = id;
+ this.firstName = firstName;
+ this.lastName = lastName;
+ this.admissionDate = admissionDate;
+ }
+
+ /**
+ * @return the id
+ */
+ public Integer getId() {
+ return id;
+ }
+
+ /**
+ * @param id the id to set
+ */
+ public void setId(Integer id) {
+ this.id = id;
+ }
+
+ /**
+ * @return the firstName
+ */
+ public String getFirstName() {
+ return firstName;
+ }
+
+ /**
+ * @param firstName the firstName to set
+ */
+ public void setFirstName(String firstName) {
+ this.firstName = firstName;
+ }
+
+ /**
+ * @return the lastName
+ */
+ public String getLastName() {
+ return lastName;
+ }
+
+ /**
+ * @param lastName the lastName to set
+ */
+ public void setLastName(String lastName) {
+ this.lastName = lastName;
+ }
+
+ /**
+ * @return the admissionDate
+ */
+ public Date getAdmissionDate() {
+ return admissionDate;
+ }
+
+ /**
+ * @param admissionDate the admissionDate to set
+ */
+ public void setAdmissionDate(Date admissionDate) {
+ this.admissionDate = admissionDate;
+ }
+
+
+
+}
Added: trunk/test-applications/facelets/src/main/java/extendedDataTable/DemoPatientProvider.java
===================================================================
--- trunk/test-applications/facelets/src/main/java/extendedDataTable/DemoPatientProvider.java (rev 0)
+++ trunk/test-applications/facelets/src/main/java/extendedDataTable/DemoPatientProvider.java 2008-09-29 18:14:39 UTC (rev 10609)
@@ -0,0 +1,125 @@
+package extendedDataTable;
+
+import java.util.ArrayList;
+import java.util.Date;
+import java.util.List;
+import java.util.Random;
+
+import org.richfaces.model.DataProvider;
+
+/**
+ * @author pkawiak
+ *
+ */
+
+public class DemoPatientProvider implements DataProvider<DemoPatient>{
+
+ /**
+ *
+ */
+ private static final long serialVersionUID = 7038048580234887663L;
+
+ private String allFirstNames[] = {
+ "Aaron", "Abbott", "Abel", "Abner",
+ "Abraham", "Adam", "Addison", "Adler",
+ "Adley", "Adrian", "Aedan", "Aiken",
+ "Alan", "Alastair", "Albern", "Albert",
+ "Albion", "Alden", "Aldis", "Aldrich",
+ "Alexander", "Alfie", "Alfred", "Algernon",
+ "Alston", "Alton", "Alvin", "Ambrose",
+ "Amery", "Amos", "Andrew", "Angus",
+ "Ansel", "Anthony", "Archer", "Archibald",
+ "Arlen", "Arnold", "Arthur", "Arvel",
+ "Atwater", "Atwood", "Aubrey", "Austin",
+ "Małgorzata", "Paweł", "Piotr"
+ };
+
+ private String allLastNames[] = {
+ "Brown", "Smith", "Patel",
+ "Jones", "Williams", "Johnson",
+ "Taylor", "Thomas", "Roberts",
+ "Khan", "Lewis", "Jackson",
+ "Clarke", "James", "Phillips",
+ "Wilson", "Ali", "Mason",
+ "Davies", "Rodriguez", "Cox",
+ "Alexander", "Popiołek", "Buda",
+ "Goławski", "Kawiak", "Mitchel"
+
+ };
+
+ private List<DemoPatient> items;
+ private Integer itemsNumber;
+
+ private Random random = new Random();
+ private long now = new Date().getTime();
+
+
+ public DemoPatientProvider(Integer itemsNumber) {
+ super();
+ this.itemsNumber = itemsNumber;
+ }
+
+ private Date generateRandomDate(){
+ return new Date(Math.abs(random.nextLong()%now));
+ }
+
+ private String generateRandomFirstName() {
+ int rand = Math.abs(random.nextInt());
+ return allFirstNames[rand%(allFirstNames.length)];
+ }
+
+ private String generateRandomLastName() {
+ int rand = Math.abs(random.nextInt());
+ return allLastNames[rand%(allLastNames.length)];
+ }
+
+ /* (non-Javadoc)
+ * @see org.richfaces.model.DataProvider#getItemByKey(java.lang.Object)
+ */
+ public DemoPatient getItemByKey(Object key) {
+ if (key == null)
+ return null;
+ for (DemoPatient entity : getItems()){
+ if (entity.getId().equals(key))
+ return entity;
+ }
+ return null;
+ }
+
+ protected List<DemoPatient> getItems() {
+ if (items == null){
+ int l = itemsNumber;
+ items = new ArrayList<DemoPatient>(l);
+ for (int i=0;i<l;i++) {
+ items.add(new DemoPatient(i,
+ generateRandomFirstName(),
+ generateRandomLastName(),
+ generateRandomDate()));
+ }
+
+ }
+ return items;
+ }
+
+ /* (non-Javadoc)
+ * @see org.richfaces.model.DataProvider#getItemsByRange(int, int)
+ */
+ public List<DemoPatient> getItemsByRange(int firstRow, int lastRow) {
+ return getItems().subList(firstRow, lastRow);
+ }
+
+ /* (non-Javadoc)
+ * @see org.richfaces.model.DataProvider#getKey(java.lang.Object)
+ */
+ public Object getKey(DemoPatient item) {
+ return item.getId();
+ }
+
+ /* (non-Javadoc)
+ * @see org.richfaces.model.DataProvider#getRowCount()
+ */
+ public int getRowCount() {
+ return getItems().size();
+ }
+
+}
\ No newline at end of file
Added: trunk/test-applications/facelets/src/main/java/extendedDataTable/ExtendedDataTableBB.java
===================================================================
--- trunk/test-applications/facelets/src/main/java/extendedDataTable/ExtendedDataTableBB.java (rev 0)
+++ trunk/test-applications/facelets/src/main/java/extendedDataTable/ExtendedDataTableBB.java 2008-09-29 18:14:39 UTC (rev 10609)
@@ -0,0 +1,115 @@
+package extendedDataTable;
+
+import java.util.ArrayList;
+import java.util.Comparator;
+import java.util.Iterator;
+import java.util.List;
+
+import javax.faces.context.FacesContext;
+import javax.servlet.http.Cookie;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+
+import org.richfaces.model.ExtendedTableDataModel;
+import org.richfaces.model.selection.SimpleSelection;
+
+/**
+ * @author mvitenkov
+ *
+ */
+public class ExtendedDataTableBB {
+
+ private SimpleSelection selection = new SimpleSelection();
+ private List<DemoPatient> selectedItems;
+ private Comparator<DemoPatient> dateComparator;
+ private String tableState = null;
+ private ExtendedTableDataModel<DemoPatient> dataModel;
+ private Integer patientsNumber = 100;
+
+ public ExtendedDataTableBB() {
+ }
+
+ public ExtendedTableDataModel<DemoPatient> getDataModel(){
+ if (dataModel == null){
+ dataModel = new ExtendedTableDataModel<DemoPatient>(new DemoPatientProvider(patientsNumber));
+ }
+ return dataModel;
+ }
+
+ public SimpleSelection getSelection() {
+ return selection;
+ }
+
+ public void setSelection(SimpleSelection selection) {
+ this.selection = selection;
+ }
+
+ public String takeSelection() {
+ getSelectedItems().clear();
+ Iterator<Object> iterator = getSelection().getKeys();
+ while (iterator.hasNext()){
+ Object key = iterator.next();
+ selectedItems.add(getDataModel().getObjectByKey(key));
+ }
+ return null;
+ }
+
+ public Integer getPatientsNumber() {
+ return patientsNumber;
+ }
+
+ public void setPatientsNumber(Integer patientsNumber) {
+ if (patientsNumber != this.patientsNumber) {
+ dataModel = new ExtendedTableDataModel<DemoPatient>(new DemoPatientProvider(patientsNumber));
+ }
+ this.patientsNumber = patientsNumber;
+ }
+
+ public List<DemoPatient> getSelectedItems() {
+ if (selectedItems == null){
+ selectedItems = new ArrayList<DemoPatient>();
+ }
+ return selectedItems;
+ }
+
+ public void setSelectedItems(List<DemoPatient> selectedItems) {
+ this.selectedItems = selectedItems;
+ }
+
+ public String getTableState() {
+ if (tableState == null){
+ //try to get state from cookies
+ Cookie[] cookies = ((HttpServletRequest)FacesContext.getCurrentInstance().getExternalContext().getRequest()).getCookies();
+ if (cookies != null){
+ for (Cookie c : cookies){
+ if (c.getName().equals("g3demoTabelState")){
+ tableState = c.getValue();
+ break;
+ }
+ }
+ }
+ }
+ return tableState;
+ }
+
+ public void setTableState(String tableState) {
+ this.tableState = tableState;
+ //save state in cookies
+ Cookie stateCookie = new Cookie("g3demoTabelState", this.tableState);
+ ((HttpServletResponse)FacesContext.getCurrentInstance().getExternalContext().getResponse()).addCookie(stateCookie);
+ }
+
+ public Comparator<DemoPatient> getDateComparator(){
+ if (dateComparator == null){
+ dateComparator = new Comparator<DemoPatient>(){
+
+ public int compare(DemoPatient o1, DemoPatient o2) {
+ return o1.getAdmissionDate().compareTo(o2.getAdmissionDate());
+ }
+
+ };
+ }
+ return dateComparator;
+ }
+
+}
Added: trunk/test-applications/facelets/src/main/java/extendedDataTable/ExtendedDataTableControlBean.java
===================================================================
--- trunk/test-applications/facelets/src/main/java/extendedDataTable/ExtendedDataTableControlBean.java (rev 0)
+++ trunk/test-applications/facelets/src/main/java/extendedDataTable/ExtendedDataTableControlBean.java 2008-09-29 18:14:39 UTC (rev 10609)
@@ -0,0 +1,215 @@
+package extendedDataTable;
+
+import java.util.ArrayList;
+import java.util.List;
+import org.richfaces.component.html.HtmlExtendedDataTable;
+
+import util.componentInfo.ComponentInfo;
+
+import javax.faces.event.ActionEvent;
+import javax.faces.context.FacesContext;
+import javax.faces.model.SelectItem;
+
+public class ExtendedDataTableControlBean {
+
+ private String width = "100%";
+ private String height = "500px";
+ private List<SelectItem> sortModeSelectItems = new ArrayList<SelectItem>();
+ private List<SelectItem> selectionModeSelectItems = new ArrayList<SelectItem>();
+ private String sortMode;
+ private String selectionMode;
+ private Integer rowsNumber;
+ private boolean paginated = false;
+ private HtmlExtendedDataTable extDTable = null;
+ private String bindLabel;
+ private String border;
+ private String cellpadding;
+ private String cellspacing;
+ private String dir;
+ private int first;
+ private String frame;
+ private String groupingColumn;
+ private boolean rendered;
+ private String sortPriority;
+
+ public String getSortPriority() {
+ return sortPriority;
+ }
+
+ public void setSortPriority(String sortPriority) {
+ this.sortPriority = sortPriority;
+ }
+
+ public boolean isRendered() {
+ return rendered;
+ }
+
+ public void setRendered(boolean rendered) {
+ this.rendered = rendered;
+ }
+
+ public String getGroupingColumn() {
+ return groupingColumn;
+ }
+
+ public void setGroupingColumn(String groupingColumn) {
+ this.groupingColumn = groupingColumn;
+ }
+
+ public String getFrame() {
+ return frame;
+ }
+
+ public void setFrame(String frame) {
+ this.frame = frame;
+ }
+
+ public int getFirst() {
+ return first;
+ }
+
+ public void setFirst(int first) {
+ this.first = first;
+ }
+
+ public String getDir() {
+ return dir;
+ }
+
+ public void setDir(String dir) {
+ this.dir = dir;
+ }
+
+ public String getCellpadding() {
+ return cellpadding;
+ }
+
+ public void setCellpadding(String cellpadding) {
+ this.cellpadding = cellpadding;
+ }
+
+ public String getCellspacing() {
+ return cellspacing;
+ }
+
+ public void setCellspacing(String cellspacing) {
+ this.cellspacing = cellspacing;
+ }
+
+ public String getBorder() {
+ return border;
+ }
+
+ public void setBorder(String border) {
+ this.border = border;
+ }
+
+ public HtmlExtendedDataTable getExtDTable() {
+ return extDTable;
+ }
+
+ public void setExtDTable(HtmlExtendedDataTable extDTable) {
+ this.extDTable = extDTable;
+ }
+
+ public void checkBinding(ActionEvent actionEvent){
+ FacesContext context = FacesContext.getCurrentInstance();
+ bindLabel = extDTable.getBaseClientId(context);
+ }
+ public void addExtDTable(){
+ ComponentInfo info = ComponentInfo.getInstance();
+ info.addField(extDTable);
+ }
+
+ public ExtendedDataTableControlBean() {
+ sortModeSelectItems.add(new SelectItem("single", "single"));
+ sortModeSelectItems.add(new SelectItem("multi", "multi"));
+ selectionModeSelectItems.add(new SelectItem("single", "single"));
+ selectionModeSelectItems.add(new SelectItem("multi", "multi"));
+ selectionModeSelectItems.add(new SelectItem("none", "none"));
+ bindLabel = "click binding";
+ border = "1px";
+ cellpadding = "1px";
+ cellspacing = "1px";
+ dir = "LTR";
+ first = 0;
+ frame = "void";
+ rendered = true;
+ }
+
+ public boolean isPaginated() {
+ return paginated;
+ }
+
+ public void setPaginated(boolean paginated) {
+ this.paginated = paginated;
+ }
+
+ public Integer getRowsNumber() {
+ return rowsNumber;
+ }
+
+ public void setRowsNumber(Integer rowsNumber) {
+ this.rowsNumber = rowsNumber;
+ }
+
+ public List<SelectItem> getSelectionModeSelectItems() {
+ return selectionModeSelectItems;
+ }
+
+ public void setSelectionModeSelectItems(
+ List<SelectItem> selectionModeSelectItems) {
+ this.selectionModeSelectItems = selectionModeSelectItems;
+ }
+
+
+
+ public List<SelectItem> getSortModeSelectItems() {
+ return sortModeSelectItems;
+ }
+
+ public void setSortModeSelectItems(List<SelectItem> sortModeSelectItems) {
+ this.sortModeSelectItems = sortModeSelectItems;
+ }
+
+ public String getSortMode() {
+ return sortMode;
+ }
+
+ public void setSortMode(String sortMode) {
+ this.sortMode = sortMode;
+ }
+
+ public String getSelectionMode() {
+ return selectionMode;
+ }
+
+ public void setSelectionMode(String selectionMode) {
+ this.selectionMode = selectionMode;
+ }
+
+ public String getWidth() {
+ return width;
+ }
+
+ public void setWidth(String width) {
+ this.width = width;
+ }
+
+ public String getHeight() {
+ return height;
+ }
+
+ public void setHeight(String height) {
+ this.height = height;
+ }
+
+ public String getBindLabel() {
+ return bindLabel;
+ }
+
+ public void setBindLabel(String bindLabel) {
+ this.bindLabel = bindLabel;
+ }
+
+}
16 years, 3 months
JBoss Rich Faces SVN: r10608 - trunk/test-applications/facelets/src/main/java/rich.
by richfaces-svn-commits@lists.jboss.org
Author: mvitenkov
Date: 2008-09-29 14:14:01 -0400 (Mon, 29 Sep 2008)
New Revision: 10608
Modified:
trunk/test-applications/facelets/src/main/java/rich/RichBean.java
Log:
+extendedDataTable
Modified: trunk/test-applications/facelets/src/main/java/rich/RichBean.java
===================================================================
--- trunk/test-applications/facelets/src/main/java/rich/RichBean.java 2008-09-29 18:13:36 UTC (rev 10607)
+++ trunk/test-applications/facelets/src/main/java/rich/RichBean.java 2008-09-29 18:14:01 UTC (rev 10608)
@@ -73,6 +73,7 @@
map.add("HotKey", add("/HotKey/HotKey", new boolean [] {false, false, false}));
map.add("Validator", add("/Validator/Validator", new boolean [] {true, true, true}));
map.add("DataGrid", add("/DataGrid/DataGrid", new boolean [] {false, true, false}));
+ map.add("ExtendedDataTable", add("/ExtendedDataTable/ExtendedDataTable", new boolean [] {false, true, false}));
Iterator<String> iterator = map.getSet().iterator();
while(iterator.hasNext()){
list.add(new SelectItem(iterator.next()));
16 years, 3 months
JBoss Rich Faces SVN: r10607 - in trunk/test-applications/facelets/src/main/webapp: ExtendedDataTable and 1 other directory.
by richfaces-svn-commits@lists.jboss.org
Author: mvitenkov
Date: 2008-09-29 14:13:36 -0400 (Mon, 29 Sep 2008)
New Revision: 10607
Added:
trunk/test-applications/facelets/src/main/webapp/ExtendedDataTable/
trunk/test-applications/facelets/src/main/webapp/ExtendedDataTable/ExtendedDataTable.xhtml
trunk/test-applications/facelets/src/main/webapp/ExtendedDataTable/ExtendedDataTableDefault.xhtml
trunk/test-applications/facelets/src/main/webapp/ExtendedDataTable/ExtendedDataTableProperty.xhtml
trunk/test-applications/facelets/src/main/webapp/ExtendedDataTable/ExtendedDataTableStraightforward.xhtml
Log:
xhtml for rich:extendedDataTable component
Added: trunk/test-applications/facelets/src/main/webapp/ExtendedDataTable/ExtendedDataTable.xhtml
===================================================================
--- trunk/test-applications/facelets/src/main/webapp/ExtendedDataTable/ExtendedDataTable.xhtml (rev 0)
+++ trunk/test-applications/facelets/src/main/webapp/ExtendedDataTable/ExtendedDataTable.xhtml 2008-09-29 18:13:36 UTC (rev 10607)
@@ -0,0 +1,107 @@
+<f:subview xmlns:ui="http://java.sun.com/jsf/facelets"
+ xmlns:f="http://java.sun.com/jsf/core"
+ xmlns:a4j="http://richfaces.org/a4j"
+ xmlns:h="http://java.sun.com/jsf/html"
+ xmlns:rich="http://richfaces.org/rich" id="extendedDataTableSubviewID">
+
+ <style type="text/css">
+.leftColumn {
+ width: 50%;
+ height: 100%;
+}
+
+.rightColumn {
+ width: 50%;
+ height: 100%;
+}
+
+.table {
+ cell-padding: 10;
+ cell-spacing: 10;
+}
+
+.mainPanel {
+ width: 100%;
+ height: 100%;
+}
+
+.leftPanel {
+ width: 100%;
+ height: 100%;
+}
+
+.rightPanel {
+ width: 100%;
+ height: 100%;
+}
+</style>
+
+ <rich:extendedDataTable id="demoTable"
+ value="#{extendedDataTableBean.dataModel}" var="patient"
+ style="margin: 0 auto;"
+ rows="#{extendedDataTableControlBean.rowsNumber}"
+ width="#{extendedDataTableControlBean.width}"
+ height="#{extendedDataTableControlBean.height}"
+ selectedClass="dataTableSelectedRow" footerClass="demo-footer"
+ sortMode="#{extendedDataTableControlBean.sortMode}"
+ selectionMode="#{extendedDataTableControlBean.selectionMode}"
+ selection="#{extendedDataTableBean.selection}" rowKeyVar="rkvar"
+ tableState="#{extendedDataTableBean.tableState}"
+ binding="#{extendedDataTableControlBean.extDTable}"
+ onclick="#{event.onclick}" ondblclick="#{event.ondblclick}"
+ onkeydown="#{event.onkeydown}" onkeypress="#{event.onkeypress}"
+ onkeyup="#{event.onkeyup}" onmousedown="#{event.onmousedown}"
+ onmousemove="#{event.onmousemove}" onmouseout="#{event.onmouseout}"
+ onmouseover="#{event.onmouseover}" onmouseup="#{event.onmouseup}"
+ onRowClick="#{event.onRowClick}"
+ onRowDblClick="#{event.onRowDblClick}"
+ onRowMouseDown="#{event.onRowMouseDown}"
+ onRowMouseMove="#{event.onRowMouseMove}"
+ onRowMouseOut="#{event.onRowMouseOut}"
+ onRowMouseOver="#{event.onRowMouseOver}"
+ onRowMouseUp="#{event.onRowMouseUp}"
+ onselectionchange="#{event.onselectionchange}"
+ border="#{extendedDataTableControlBean.border}"
+ cellpadding="#{extendedDataTableControlBean.cellpadding}"
+ cellspacing="#{extendedDataTableControlBean.cellspacing}"
+ dir="#{extendedDataTableControlBean.dir}"
+ first="#{extendedDataTableControlBean.first}"
+ frame="#{extendedDataTableControlBean.frame}"
+ groupingColumn="#{extendedDataTableControlBean.groupingColumn}"
+ rendered="#{extendedDataTableControlBean.rendered}"
+ sortPriority="#{extendedDataTableControlBean.sortPriority}">
+ <rich:column id="firstName" headerClass="dataTableHeader" width="25%"
+ label="First name" sortable="true" sortBy="#{patient.firstName}"
+ filterBy="#{patient.firstName}" filterEvent="onkeyup">
+ <f:facet name="header">
+ <h:outputText value="First name" />
+ </f:facet>
+ <h:outputText id="text" value="#{patient.firstName}">
+ <rich:toolTip value="sasasasasasa" />
+ </h:outputText>
+ </rich:column>
+ <rich:column id="lastName" headerClass="dataTableHeader" width="25%"
+ label="Last name" sortable="true" sortBy="#{patient.lastName}"
+ filterBy="#{patient.lastName}" filterEvent="onkeyup">
+ <f:facet name="header">
+ <h:outputText value="Last name" />
+ </f:facet>
+ <h:outputText value="#{patient.lastName}" />
+ </rich:column>
+ <rich:column id="admissionDate" headerClass="dataTableHeader"
+ width="50%" label="Admission name" sortable="true"
+ sortBy="#{patient.admissionDate}">
+ <f:facet name="header">
+ <h:outputText value="Admission name" />
+ </f:facet>
+ <h:outputText value="#{patient.admissionDate}" />
+ </rich:column>
+ <a4j:support event="onselectionchange"
+ action="#{extendedDataTableBean.takeSelection}"
+ reRender="selectedPatients">
+ </a4j:support>
+ </rich:extendedDataTable>
+ <rich:datascroller style="width: #{extendedDataTableControlBean.width}"
+ rendered="#{extendedDataTableControlBean.paginated}" for="demoTable">
+ </rich:datascroller>
+</f:subview>
\ No newline at end of file
Added: trunk/test-applications/facelets/src/main/webapp/ExtendedDataTable/ExtendedDataTableDefault.xhtml
===================================================================
Added: trunk/test-applications/facelets/src/main/webapp/ExtendedDataTable/ExtendedDataTableProperty.xhtml
===================================================================
--- trunk/test-applications/facelets/src/main/webapp/ExtendedDataTable/ExtendedDataTableProperty.xhtml (rev 0)
+++ trunk/test-applications/facelets/src/main/webapp/ExtendedDataTable/ExtendedDataTableProperty.xhtml 2008-09-29 18:13:36 UTC (rev 10607)
@@ -0,0 +1,141 @@
+<f:subview xmlns:ui="http://java.sun.com/jsf/facelets"
+ xmlns:f="http://java.sun.com/jsf/core"
+ xmlns:a4j="http://richfaces.org/a4j"
+ xmlns:h="http://java.sun.com/jsf/html"
+ xmlns:rich="http://richfaces.org/rich"
+ id="extendedDataTablePropertySubviewID">
+
+ <h:panelGrid columns="2">
+ <h:outputLabel value="Width" for="tableWidthInput" />
+ <h:inputText id="tableWidthInput"
+ value="#{extendedDataTableControlBean.width}">
+ <a4j:support event="onchange" reRender="demoTable"></a4j:support>
+ </h:inputText>
+
+ <h:outputLabel value="Height" for="tableHeightInput" />
+ <h:inputText id="tableHeightInput"
+ value="#{extendedDataTableControlBean.height}">
+ <a4j:support event="onchange" reRender="demoTable"></a4j:support>
+ </h:inputText>
+
+ <h:outputLabel value="Number of patients"
+ for="tablePatientsNumberInput" />
+ <h:inputText id="tablePatientsNumberInput"
+ value="#{extendedDataTableBean.patientsNumber}">
+ <a4j:support event="onchange" reRender="demoTable"></a4j:support>
+ </h:inputText>
+
+ <h:outputLabel value="Sort mode" for="tableSortModeSelect" />
+ <h:selectOneMenu id="tableSortModeSelect"
+ value="#{extendedDataTableControlBean.sortMode}">
+ <f:selectItems
+ value="#{extendedDataTableControlBean.sortModeSelectItems}" />
+ <a4j:support event="onchange" reRender="demoTable"></a4j:support>
+ </h:selectOneMenu>
+
+ <h:outputLabel value="Selection mode" for="tableSelectionModeSelect" />
+ <h:selectOneMenu id="tableSelectionModeSelect"
+ value="#{extendedDataTableControlBean.selectionMode}">
+ <f:selectItems
+ value="#{extendedDataTableControlBean.selectionModeSelectItems}" />
+ <a4j:support event="onchange" reRender="demoTable"></a4j:support>
+ </h:selectOneMenu>
+
+ <h:outputText value="paginated" />
+ <h:selectBooleanCheckbox id="paginatedCheckbox"
+ value="#{extendedDataTableControlBean.paginated}" onclick="submit()" />
+
+ <h:outputLabel value="Number of rows" for="tableRowsNumberInput" />
+ <h:inputText id="tableRowsNumberInput"
+ value="#{extendedDataTableControlBean.rowsNumber}">
+ <a4j:support event="onchange" reRender="demoTable"></a4j:support>
+ </h:inputText>
+
+ <h:commandButton value="binding"
+ actionListener="#{extendedDataTableControlBean.checkBinding}" />
+ <h:outputText value="#{extendedDataTableControlBean.bindLabel}"
+ id="bindLabel" />
+
+ <h:outputText value="border" />
+ <h:inputText value="#{extendedDataTableControlBean.border}">
+ <a4j:support event="onchange" reRender="demoTable"></a4j:support>
+ </h:inputText>
+
+ <h:outputText value="cellpadding" />
+ <h:inputText value="#{extendedDataTableControlBean.cellpadding}">
+ <a4j:support event="onchange" reRender="demoTable"></a4j:support>
+ </h:inputText>
+
+ <h:outputText value="cellspacing" />
+ <h:inputText value="#{extendedDataTableControlBean.cellspacing}">
+ <a4j:support event="onchange" reRender="demoTable"></a4j:support>
+ </h:inputText>
+
+ <h:outputText value="dir" />
+ <h:selectOneRadio value="#{extendedDataTableControlBean.dir}">
+ <f:selectItem itemLabel="RTL" itemValue="RTL" />
+ <f:selectItem itemLabel="LTR" itemValue="LTR" />
+ <a4j:support event="onchange" reRender="demoTable"></a4j:support>
+ </h:selectOneRadio>
+
+ <h:outputText value="first" />
+ <h:inputText value="#{extendedDataTableControlBean.first}">
+ <a4j:support event="onchange" reRender="demoTable"></a4j:support>
+ </h:inputText>
+
+ <h:outputText value="frame" />
+ <h:panelGroup>
+ <h:inputText value="#{extendedDataTableControlBean.frame}"
+ id="inputFrame">
+ <a4j:support event="onchange" reRender="demoTable"></a4j:support>
+ </h:inputText>
+ <h:outputLabel value="void, above, below, hsides, lhs, rhs, vsides, box and border" for="inputFrame" />
+ </h:panelGroup>
+
+ <h:outputText value="groupingColumn" />
+ <h:inputText value="#{extendedDataTableControlBean.groupingColumn}">
+ <a4j:support event="onchange" reRender="demoTable"></a4j:support>
+ </h:inputText>
+
+ <h:outputText value="rendered" />
+ <h:selectBooleanCheckbox
+ value="#{extendedDataTableControlBean.rendered}" onclick="submit()" />
+
+ <h:outputText value="sortPriority" />
+ <h:inputText value="#{extendedDataTableControlBean.sortPriority}">
+ <a4j:support event="onchange" reRender="demoTable"></a4j:support>
+ </h:inputText>
+
+ </h:panelGrid>
+ <br />
+ <h:commandButton value="add test"
+ action="#{extendedDataTableControlBean.addExtDTable}"></h:commandButton>
+ <a4j:commandButton value="Update values" reRender="mainPanel">
+ </a4j:commandButton>
+ <br />
+
+ <rich:spacer height="5px" width="100%">
+ </rich:spacer>
+ <rich:dataTable id="selectedPatients"
+ value="#{extendedDataTableBean.selectedItems}" var="selectedPatient">
+ <f:facet name="header">
+ <h:outputText value="Selected patient" />
+ </f:facet>
+ <rich:column id="selectedFirstName" headerClass="dataTableHeader"
+ label="First name">
+ <f:facet name="header">
+ <h:outputText value="First name" />
+ </f:facet>
+ <h:outputText value="#{selectedPatient.firstName}" />
+ </rich:column>
+ <rich:column id="selectedLastName" headerClass="dataTableHeader"
+ label="Last name">
+ <f:facet name="header">
+ <h:outputText value="Last name" />
+ </f:facet>
+ <h:outputText value="#{selectedPatient.lastName}" />
+ </rich:column>
+ </rich:dataTable>
+ <rich:messages>
+ </rich:messages>
+</f:subview>
\ No newline at end of file
Added: trunk/test-applications/facelets/src/main/webapp/ExtendedDataTable/ExtendedDataTableStraightforward.xhtml
===================================================================
--- trunk/test-applications/facelets/src/main/webapp/ExtendedDataTable/ExtendedDataTableStraightforward.xhtml (rev 0)
+++ trunk/test-applications/facelets/src/main/webapp/ExtendedDataTable/ExtendedDataTableStraightforward.xhtml 2008-09-29 18:13:36 UTC (rev 10607)
@@ -0,0 +1,8 @@
+<f:subview xmlns:ui="http://java.sun.com/jsf/facelets"
+ xmlns:f="http://java.sun.com/jsf/core"
+ xmlns:a4j="http://richfaces.org/a4j"
+ xmlns:h="http://java.sun.com/jsf/html"
+ xmlns:rich="http://richfaces.org/rich"
+ id="extendedDataTablePropertySubviewID">
+<!-- Insert your custom tests here -->
+</f:subview>
\ No newline at end of file
16 years, 3 months
JBoss Rich Faces SVN: r10606 - trunk/test-applications/jsp/src/main/java/extendedDataTable.
by richfaces-svn-commits@lists.jboss.org
Author: mvitenkov
Date: 2008-09-29 13:13:28 -0400 (Mon, 29 Sep 2008)
New Revision: 10606
Modified:
trunk/test-applications/jsp/src/main/java/extendedDataTable/ExtendedDataTableBB.java
Log:
Modified: trunk/test-applications/jsp/src/main/java/extendedDataTable/ExtendedDataTableBB.java
===================================================================
--- trunk/test-applications/jsp/src/main/java/extendedDataTable/ExtendedDataTableBB.java 2008-09-29 17:04:45 UTC (rev 10605)
+++ trunk/test-applications/jsp/src/main/java/extendedDataTable/ExtendedDataTableBB.java 2008-09-29 17:13:28 UTC (rev 10606)
@@ -14,7 +14,7 @@
import org.richfaces.model.selection.SimpleSelection;
/**
- * @author pkawiak
+ * @author mvitenkov
*
*/
public class ExtendedDataTableBB {
16 years, 3 months
JBoss Rich Faces SVN: r10605 - trunk/test-applications/jsp/src/main/webapp/ExtendedDataTable.
by richfaces-svn-commits@lists.jboss.org
Author: mvitenkov
Date: 2008-09-29 13:04:45 -0400 (Mon, 29 Sep 2008)
New Revision: 10605
Modified:
trunk/test-applications/jsp/src/main/webapp/ExtendedDataTable/ExtendedDataTable.jsp
trunk/test-applications/jsp/src/main/webapp/ExtendedDataTable/ExtendedDataTableProperty.jsp
Log:
Modified: trunk/test-applications/jsp/src/main/webapp/ExtendedDataTable/ExtendedDataTable.jsp
===================================================================
--- trunk/test-applications/jsp/src/main/webapp/ExtendedDataTable/ExtendedDataTable.jsp 2008-09-29 16:46:52 UTC (rev 10604)
+++ trunk/test-applications/jsp/src/main/webapp/ExtendedDataTable/ExtendedDataTable.jsp 2008-09-29 17:04:45 UTC (rev 10605)
@@ -70,30 +70,30 @@
rendered="#{extendedDataTableControlBean.rendered}"
sortPriority="#{extendedDataTableControlBean.sortPriority}">
<rich:column id="firstName" headerClass="dataTableHeader" width="25%"
- label="#{msg['patient.firstName']}" sortable="true"
+ label="First name" sortable="true"
sortBy="#{patient.firstName}" filterBy="#{patient.firstName}"
filterEvent="onkeyup">
<f:facet name="header">
- <h:outputText value="#{msg['patient.firstName']}" />
+ <h:outputText value="First name" />
</f:facet>
<h:outputText id="text" value="#{patient.firstName}">
<rich:toolTip value="sasasasasasa" />
</h:outputText>
</rich:column>
<rich:column id="lastName" headerClass="dataTableHeader" width="25%"
- label="#{msg['patient.lastName']}" sortable="true"
+ label="Last name" sortable="true"
sortBy="#{patient.lastName}" filterBy="#{patient.lastName}"
filterEvent="onkeyup">
<f:facet name="header">
- <h:outputText value="#{msg['patient.lastName']}" />
+ <h:outputText value="Last name" />
</f:facet>
<h:outputText value="#{patient.lastName}" />
</rich:column>
<rich:column id="admissionDate" headerClass="dataTableHeader"
- width="50%" label="#{msg['patient.admissionDate']}" sortable="true"
+ width="50%" label="Admission name" sortable="true"
sortBy="#{patient.admissionDate}">
<f:facet name="header">
- <h:outputText value="#{msg['patient.admissionDate']}" />
+ <h:outputText value="Admission name" />
</f:facet>
<h:outputText value="#{patient.admissionDate}" />
</rich:column>
Modified: trunk/test-applications/jsp/src/main/webapp/ExtendedDataTable/ExtendedDataTableProperty.jsp
===================================================================
--- trunk/test-applications/jsp/src/main/webapp/ExtendedDataTable/ExtendedDataTableProperty.jsp 2008-09-29 16:46:52 UTC (rev 10604)
+++ trunk/test-applications/jsp/src/main/webapp/ExtendedDataTable/ExtendedDataTableProperty.jsp 2008-09-29 17:04:45 UTC (rev 10605)
@@ -6,26 +6,26 @@
<f:subview id="extendedDataTablePropertySubviewID">
<h:panelGrid columns="2">
- <h:outputLabel value="#{msg['table.width']}" for="tableWidthInput" />
+ <h:outputLabel value="Width" for="tableWidthInput" />
<h:inputText id="tableWidthInput"
value="#{extendedDataTableControlBean.width}">
<a4j:support event="onchange" reRender="demoTable"></a4j:support>
</h:inputText>
- <h:outputLabel value="#{msg['table.height']}" for="tableHeightInput" />
+ <h:outputLabel value="Height" for="tableHeightInput" />
<h:inputText id="tableHeightInput"
value="#{extendedDataTableControlBean.height}">
<a4j:support event="onchange" reRender="demoTable"></a4j:support>
</h:inputText>
- <h:outputLabel value="#{msg['table.patientsNumber']}"
+ <h:outputLabel value="Number of patients"
for="tablePatientsNumberInput" />
<h:inputText id="tablePatientsNumberInput"
value="#{extendedDataTableBean.patientsNumber}">
<a4j:support event="onchange" reRender="demoTable"></a4j:support>
</h:inputText>
- <h:outputLabel value="#{msg['table.sortMode']}"
+ <h:outputLabel value="Sort mode"
for="tableSortModeSelect" />
<h:selectOneMenu id="tableSortModeSelect"
value="#{extendedDataTableControlBean.sortMode}">
@@ -34,7 +34,7 @@
<a4j:support event="onchange" reRender="demoTable"></a4j:support>
</h:selectOneMenu>
- <h:outputLabel value="#{msg['table.selectionMode']}"
+ <h:outputLabel value="Selection mode"
for="tableSelectionModeSelect" />
<h:selectOneMenu id="tableSelectionModeSelect"
value="#{extendedDataTableControlBean.selectionMode}">
@@ -43,11 +43,11 @@
<a4j:support event="onchange" reRender="demoTable"></a4j:support>
</h:selectOneMenu>
- <h:outputText value="#{msg['table.paginated']}" />
+ <h:outputText value="paginated" />
<h:selectBooleanCheckbox id="paginatedCheckbox"
value="#{extendedDataTableControlBean.paginated}" onclick="submit()" />
- <h:outputLabel value="#{msg['table.rowsNumber']}"
+ <h:outputLabel value="Number of rows"
for="tableRowsNumberInput" />
<h:inputText id="tableRowsNumberInput"
value="#{extendedDataTableControlBean.rowsNumber}">
@@ -114,7 +114,7 @@
<br />
<h:commandButton value="add test"
action="#{extendedDataTableControlBean.addExtDTable}"></h:commandButton>
- <a4j:commandButton value="#{msg['table.update']}" reRender="mainPanel">
+ <a4j:commandButton value="Update values" reRender="mainPanel">
</a4j:commandButton>
<br />
@@ -123,19 +123,19 @@
<rich:dataTable id="selectedPatients"
value="#{extendedDataTableBean.selectedItems}" var="selectedPatient">
<f:facet name="header">
- <h:outputText value="#{msg['table.selectedPatients']}" />
+ <h:outputText value="Selected patient" />
</f:facet>
<rich:column id="selectedFirstName" headerClass="dataTableHeader"
- label="#{msg['patient.firstName']}">
+ label="First name">
<f:facet name="header">
- <h:outputText value="#{msg['patient.firstName']}" />
+ <h:outputText value="First name" />
</f:facet>
<h:outputText value="#{selectedPatient.firstName}" />
</rich:column>
<rich:column id="selectedLastName" headerClass="dataTableHeader"
- label="#{msg['patient.lastName']}">
+ label="Last name">
<f:facet name="header">
- <h:outputText value="#{msg['patient.lastName']}" />
+ <h:outputText value="Last name" />
</f:facet>
<h:outputText value="#{selectedPatient.lastName}" />
</rich:column>
16 years, 3 months
JBoss Rich Faces SVN: r10604 - trunk/framework/impl/src/main/javascript/ajaxjsf.
by richfaces-svn-commits@lists.jboss.org
Author: pyaschenko
Date: 2008-09-29 12:46:52 -0400 (Mon, 29 Sep 2008)
New Revision: 10604
Modified:
trunk/framework/impl/src/main/javascript/ajaxjsf/JSFAJAX.js
Log:
editor: added onbeforeajax event listeners process (draft)
Modified: trunk/framework/impl/src/main/javascript/ajaxjsf/JSFAJAX.js
===================================================================
--- trunk/framework/impl/src/main/javascript/ajaxjsf/JSFAJAX.js 2008-09-29 14:40:16 UTC (rev 10603)
+++ trunk/framework/impl/src/main/javascript/ajaxjsf/JSFAJAX.js 2008-09-29 16:46:52 UTC (rev 10604)
@@ -552,6 +552,10 @@
this.onafterajax = onafterajax;
};
+A4J.AJAX.AjaxListener = function(type, callback){
+ this[type] = callback;
+};
+
A4J.AJAX._listeners= [];
A4J.AJAX.AddListener = function(listener){
A4J.AJAX._listeners.push(listener);
@@ -559,7 +563,15 @@
A4J.AJAX.removeListeners = function(listener){
A4J.AJAX._listeners = [];
};
+A4J.AJAX.removeListener = function(listener){
+ for (var i=A4J.AJAX._listeners.length-1;i>=0;i--){
+ if (A4J.AJAX._listeners[i] == listener){
+ A4J.AJAX._listeners.splice(i,1);
+ }
+ }
+};
+
//head element transformers
A4J.AJAX.HeadElementTransformer = function(elt){
this.elt = elt;
@@ -753,6 +765,13 @@
// statusID - DOM id request status tags.
// oncomplete - function for call after complete request.
A4J.AJAX.SubmitRequest = function( containerId, formId ,domEvt , options ) {
+ // Process listeners.
+ for(var li = 0; li < A4J.AJAX._listeners.length; li++){
+ var listener = A4J.AJAX._listeners[li];
+ if(listener.onbeforeajax){
+ listener.onbeforeajax(formId,domEvt,options);
+ }
+ }
// First - run onsubmit event for client-side validation.
LOG.debug("NEW AJAX REQUEST !!! with form :"+formId );
// var form = A4J.AJAX.locateForm(event);
16 years, 3 months
JBoss Rich Faces SVN: r10603 - in trunk/test-applications/seleniumTest/richfaces/src: main/webapp/WEB-INF and 4 other directories.
by richfaces-svn-commits@lists.jboss.org
Author: andrei_exadel
Date: 2008-09-29 10:40:16 -0400 (Mon, 29 Sep 2008)
New Revision: 10603
Added:
trunk/test-applications/seleniumTest/richfaces/src/main/java/org/ajax4jsf/bean/DataScrollerBean.java
trunk/test-applications/seleniumTest/richfaces/src/main/webapp/pages/dataScroller/
trunk/test-applications/seleniumTest/richfaces/src/main/webapp/pages/dataScroller/dataScroller.xhtml
trunk/test-applications/seleniumTest/richfaces/src/test/java/org/richfaces/testng/DataScrollerTest.java
Modified:
trunk/test-applications/seleniumTest/richfaces/src/main/java/org/ajax4jsf/bean/IndexBean.java
trunk/test-applications/seleniumTest/richfaces/src/main/webapp/WEB-INF/.faces-config.xml.jsfdia
trunk/test-applications/seleniumTest/richfaces/src/main/webapp/WEB-INF/faces-config.xml
trunk/test-applications/seleniumTest/richfaces/src/test/java/org/richfaces/SeleniumTestBase.java
Log:
Datascroller test (Initial version)
Added: trunk/test-applications/seleniumTest/richfaces/src/main/java/org/ajax4jsf/bean/DataScrollerBean.java
===================================================================
--- trunk/test-applications/seleniumTest/richfaces/src/main/java/org/ajax4jsf/bean/DataScrollerBean.java (rev 0)
+++ trunk/test-applications/seleniumTest/richfaces/src/main/java/org/ajax4jsf/bean/DataScrollerBean.java 2008-09-29 14:40:16 UTC (rev 10603)
@@ -0,0 +1,137 @@
+/*
+ * DataScrollerBean.java Date created: 29.09.2008
+ * Last modified by: $Author$
+ * $Revision$ $Date$
+ */
+
+package org.ajax4jsf.bean;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import javax.faces.event.ActionEvent;
+
+/**
+ * Bean class for dataScroller component testing
+ * @author Andrey Markavtsov
+ *
+ */
+@SuppressWarnings("unchecked")
+public class DataScrollerBean {
+
+ private boolean rendered = true;
+
+ private List data;
+
+ private Integer tableRows = 1;
+
+ private Integer totalRows = 10;
+
+ private Integer maxPages = 10;
+
+ private Integer page;
+
+ public DataScrollerBean() {
+ init();
+ }
+
+ private void init() {
+ data = new ArrayList();
+ for (int i = 0; i < totalRows; i++) {
+ String content = "Page " + (i / tableRows + 1);
+ data.add(new Object [] {i + 1, content});
+ }
+ }
+
+ public void apply(ActionEvent event) {
+ init();
+ }
+
+ /**
+ * @return the rendered
+ */
+ public boolean isRendered() {
+ return rendered;
+ }
+
+ /**
+ * @param rendered the rendered to set
+ */
+ public void setRendered(boolean rendered) {
+ this.rendered = rendered;
+ }
+
+ /**
+ * @return the data
+ */
+ public List getData() {
+ return data;
+ }
+
+ /**
+ * @param data the data to set
+ */
+ public void setData(List data) {
+ this.data = data;
+ }
+
+ /**
+ * @return the tableRows
+ */
+ public Integer getTableRows() {
+ return tableRows;
+ }
+
+ /**
+ * @param tableRows the tableRows to set
+ */
+ public void setTableRows(Integer tableRows) {
+ this.tableRows = tableRows;
+ }
+
+ /**
+ * @return the totalRows
+ */
+ public Integer getTotalRows() {
+ return totalRows;
+ }
+
+ /**
+ * @param totalRows the totalRows to set
+ */
+ public void setTotalRows(Integer totalRows) {
+ this.totalRows = totalRows;
+ }
+
+ /**
+ * @return the maxPages
+ */
+ public Integer getMaxPages() {
+ return maxPages;
+ }
+
+ /**
+ * @param maxPages the maxPages to set
+ */
+ public void setMaxPages(Integer maxPages) {
+ this.maxPages = maxPages;
+ }
+
+ /**
+ * @return the page
+ */
+ public Integer getPage() {
+ return page;
+ }
+
+ /**
+ * @param page the page to set
+ */
+ public void setPage(Integer page) {
+ this.page = page;
+ }
+
+
+
+
+}
Modified: trunk/test-applications/seleniumTest/richfaces/src/main/java/org/ajax4jsf/bean/IndexBean.java
===================================================================
--- trunk/test-applications/seleniumTest/richfaces/src/main/java/org/ajax4jsf/bean/IndexBean.java 2008-09-29 14:33:38 UTC (rev 10602)
+++ trunk/test-applications/seleniumTest/richfaces/src/main/java/org/ajax4jsf/bean/IndexBean.java 2008-09-29 14:40:16 UTC (rev 10603)
@@ -96,6 +96,7 @@
list.add(new ComponentItem("<rich:inputNumberSlider>", "inputNumberSlider/inputNumberSliderTest.xhtml"));
list.add(new ComponentItem("<rich:modalPanel>", "modalPanel/modalPanelTest.xhtml"));
list.add(new ComponentItem("<rich:toolBar>", "toolBar/toolBarTest.xhtml"));
+ list.add(new ComponentItem("<rich:datascroller>", "dataScroller/dataScroller.xhtml"));
sortList();
Modified: trunk/test-applications/seleniumTest/richfaces/src/main/webapp/WEB-INF/.faces-config.xml.jsfdia
===================================================================
--- trunk/test-applications/seleniumTest/richfaces/src/main/webapp/WEB-INF/.faces-config.xml.jsfdia 2008-09-29 14:33:38 UTC (rev 10602)
+++ trunk/test-applications/seleniumTest/richfaces/src/main/webapp/WEB-INF/.faces-config.xml.jsfdia 2008-09-29 14:40:16 UTC (rev 10603)
@@ -1,2 +1,25 @@
<?xml version="1.0" encoding="UTF-8"?>
-<PROCESS ENTITY="JSFProcess"/>
+<PROCESS ENTITY="JSFProcess">
+ <PROCESS-ITEM ENTITY="JSFProcessGroup"
+ NAME="rules:#pages#ajaxInclude#step1.xhtml"
+ PATH="/pages/ajaxInclude/step1.xhtml" SHAPE="32,17,0,0">
+ <PROCESS-ITEM ENTITY="JSFProcessItem"
+ ID="rules:#pages#ajaxInclude#step1.xhtml:0" NAME="item" PATH="/pages/ajaxInclude/step1.xhtml">
+ <PROCESS-ITEM-OUTPUT ENTITY="JSFProcessItemOutput"
+ ID="next::#pages#ajaxInclude#step2.xhtml" NAME="output"
+ PATH="/pages/ajaxInclude/step2.xhtml"
+ TARGET="rules:#pages#ajaxInclude#step2.xhtml" TITLE="next"/>
+ </PROCESS-ITEM>
+ </PROCESS-ITEM>
+ <PROCESS-ITEM ENTITY="JSFProcessGroup"
+ NAME="rules:#pages#ajaxInclude#step2.xhtml"
+ PATH="/pages/ajaxInclude/step2.xhtml" SHAPE="240,33,0,0">
+ <PROCESS-ITEM ENTITY="JSFProcessItem"
+ ID="rules:#pages#ajaxInclude#step2.xhtml:0" NAME="item" PATH="/pages/ajaxInclude/step2.xhtml">
+ <PROCESS-ITEM-OUTPUT ENTITY="JSFProcessItemOutput"
+ ID="previous::#pages#ajaxInclude#step1.xhtml" NAME="output"
+ PATH="/pages/ajaxInclude/step1.xhtml"
+ TARGET="rules:#pages#ajaxInclude#step1.xhtml" TITLE="previous"/>
+ </PROCESS-ITEM>
+ </PROCESS-ITEM>
+</PROCESS>
Modified: trunk/test-applications/seleniumTest/richfaces/src/main/webapp/WEB-INF/faces-config.xml
===================================================================
--- trunk/test-applications/seleniumTest/richfaces/src/main/webapp/WEB-INF/faces-config.xml 2008-09-29 14:33:38 UTC (rev 10602)
+++ trunk/test-applications/seleniumTest/richfaces/src/main/webapp/WEB-INF/faces-config.xml 2008-09-29 14:40:16 UTC (rev 10603)
@@ -230,6 +230,11 @@
<managed-bean-name>dndBean</managed-bean-name>
<managed-bean-class>org.ajax4jsf.bean.DnDBean</managed-bean-class>
<managed-bean-scope>session</managed-bean-scope>
+ </managed-bean>
+ <managed-bean>
+ <managed-bean-name>dataScrollerBean</managed-bean-name>
+ <managed-bean-class>org.ajax4jsf.bean.DataScrollerBean</managed-bean-class>
+ <managed-bean-scope>session</managed-bean-scope>
</managed-bean>
<navigation-rule>
<from-view-id>/pages/ajaxInclude/step1.xhtml</from-view-id>
Added: trunk/test-applications/seleniumTest/richfaces/src/main/webapp/pages/dataScroller/dataScroller.xhtml
===================================================================
--- trunk/test-applications/seleniumTest/richfaces/src/main/webapp/pages/dataScroller/dataScroller.xhtml (rev 0)
+++ trunk/test-applications/seleniumTest/richfaces/src/main/webapp/pages/dataScroller/dataScroller.xhtml 2008-09-29 14:40:16 UTC (rev 10603)
@@ -0,0 +1,50 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml"
+ xmlns:a4j="http://richfaces.org/a4j"
+ xmlns:rich="http://richfaces.org/rich"
+ xmlns:h="http://java.sun.com/jsf/html"
+ xmlns:f="http://java.sun.com/jsf/core"
+ xmlns:ui="http://java.sun.com/jsf/facelets">
+
+<ui:composition template="#{templateBean.template}">
+ <ui:define name="component">
+ <h:form id="_controls">
+ <table>
+ <tr>
+ <td>Total Rows:</td><td><h:inputText value="#{dataScrollerBean.totalRows}" /></td>
+ </tr>
+ <tr>
+ <td>Table Rows:</td><td><h:inputText value="#{dataScrollerBean.tableRows}" /></td>
+ </tr>
+ </table>
+ <h:commandButton id="apply" actionListener="#{dataScrollerBean.apply}" value="apply"/>
+ </h:form>
+ <br/>
+ <h:form id="_data">
+ <rich:datascroller id="scroller"
+ rendered="#{dataScrollerBean.rendered}"
+ for="tbl"
+ align="left"
+ maxPages="#{dataScrollerBean.maxPages}"
+ page="#{dataScrollerBean.page}"
+ />
+
+ <br/><br/>
+ <rich:dataTable id="tbl" value="#{dataScrollerBean.data}" rows="#{dataScrollerBean.tableRows}" var="var">
+ <rich:column>
+ <f:facet name="header">
+ <h:outputText value="#" />
+ </f:facet>
+ <h:outputText value="#{var[0]}" />
+ </rich:column>
+ <rich:column>
+ <f:facet name="header">
+ <h:outputText value="Data" />
+ </f:facet>
+ <h:outputText value="#{var[1]}" />
+ </rich:column>
+ </rich:dataTable>
+ </h:form>
+ </ui:define>
+</ui:composition>
+</html>
\ No newline at end of file
Modified: trunk/test-applications/seleniumTest/richfaces/src/test/java/org/richfaces/SeleniumTestBase.java
===================================================================
--- trunk/test-applications/seleniumTest/richfaces/src/test/java/org/richfaces/SeleniumTestBase.java 2008-09-29 14:33:38 UTC (rev 10602)
+++ trunk/test-applications/seleniumTest/richfaces/src/test/java/org/richfaces/SeleniumTestBase.java 2008-09-29 14:40:16 UTC (rev 10603)
@@ -799,12 +799,22 @@
* @param tableId id of table to be checked
*/
public void assertColumnsCount(int i, String tableId) {
+ assertColumnsCount(i, tableId, "");
+ }
+
+ /**
+ * Asserts that expected columns count equals actual one.
+ * @param i the expected columns count
+ * @param tableId id of table to be checked
+ * @param message - error message to insert in log
+ */
+ public void assertColumnsCount(int i, String tableId, String mesage) {
StringBuffer script = new StringBuffer("$('");
script.append(tableId);
script.append("').rows[0].cells.length");
String count = runScript(script.toString());
- Assert.assertEquals(count, String.valueOf(i));
+ Assert.assertEquals(count, String.valueOf(i), mesage);
}
/**
@@ -845,4 +855,26 @@
return runScript("fireMouseEvent('" + id + "','" + eventName + "', "
+ x + "," + y + ","+ctrl+");");
}
+
+ /**
+ * Check is DOM element contain defined class names
+ * @param id - Element DOM id
+ * @param classNames - Class names to check
+ * @param message - Message will be inserted in the log after test failure
+ * @param isId - Pass true if ID is string, false - if ID is expression to load appropriate DOM element
+ */
+ public void assertClassNames(String id, String[] classNames, String message, boolean isId) {
+ for (String s : classNames) {
+ String result = null;
+ if (isId) {
+ runScript("$('"+id+"').hasClassName('"+s+"')", false).toLowerCase();
+ }else {
+ runScript("$("+id+").hasClassName('"+s+"')", false).toLowerCase();
+ }
+ if (Boolean.FALSE.toString().toLowerCase().equals(result)) {
+ Assert.fail(message + " Element [id="+id+"] should contain class name '"+s+"'");
+ }
+ }
+ }
+
}
Added: trunk/test-applications/seleniumTest/richfaces/src/test/java/org/richfaces/testng/DataScrollerTest.java
===================================================================
--- trunk/test-applications/seleniumTest/richfaces/src/test/java/org/richfaces/testng/DataScrollerTest.java (rev 0)
+++ trunk/test-applications/seleniumTest/richfaces/src/test/java/org/richfaces/testng/DataScrollerTest.java 2008-09-29 14:40:16 UTC (rev 10603)
@@ -0,0 +1,152 @@
+/*
+ * DataScrollerTest.java Date created: 29.09.2008
+ * Last modified by: $Author$
+ * $Revision$ $Date$
+ */
+
+package org.richfaces.testng;
+
+import org.ajax4jsf.template.Template;
+import org.richfaces.SeleniumTestBase;
+import org.testng.Assert;
+import org.testng.annotations.Test;
+
+/**
+ * DataScroller selenium test class
+ * @author Andrey Markavtsov
+ *
+ */
+public class DataScrollerTest extends SeleniumTestBase {
+
+ String dataScrollerId;
+
+ String dataScrollerTableId;
+
+ String dataTableId;
+
+ @Test
+ public void testDataScroller(Template template) {
+ renderPage(template);
+ String parentId = getParentId();
+ dataScrollerId = parentId + "_data:scroller";
+ dataScrollerTableId = parentId + "_data:scroller_table";
+ dataTableId = (!template.getName().equals(Template.DATA_TABLE.getName())) ? parentId + "_data:tbl" : parentId + "_data:tbl:0";
+
+ testRendering();
+ }
+
+ private void testRendering() {
+ assertClassNames(dataScrollerId,new String []
+ {"dr-dscr",
+ "rich-datascr"},
+ "DataScroller rendering failed: ", true);
+
+ assertClassNames(dataScrollerTableId,new String []
+ {"dr-dscr-t",
+ "rich-dtascroller-table"},
+ "DataScroller rendering failed: ", true);
+
+ testPageCount();
+ testControls();
+ testData(1,"Page 1");
+ }
+
+ private void testPageCount() {
+ assertColumnsCount(16, dataScrollerTableId, "DataScroller inner table contains invalid columns count");
+ String text = selenium.getTable("id=" + dataScrollerTableId + ".0.3");
+ Assert.assertEquals("1", text, "DataScroller does not contain first page link or its position is invalid");
+ text = selenium.getTable("id=" + dataScrollerTableId + ".0.7");
+ Assert.assertEquals("5", text, "DataScroller does not contain 5th page link or its position is invalid");
+ text = selenium.getTable("id=" + dataScrollerTableId + ".0.12");
+ Assert.assertEquals("10", text, "DataScroller does not contain 10th page link or its position is invalid");
+ }
+
+ private void testControls() {
+ // Check '��' link
+ String text = selenium.getTable("id=" + dataScrollerTableId + ".0.0");
+ Assert.assertEquals("��", text, "DataScroller does not contain '��' link or its position is invalid");
+ assertClassNames(getPageLinkRefScript(0),new String []
+ {"dr-dscr-button-dsbld",
+ "rich-datascr-button-dsbld",
+ "dr-dscr-button",
+ "rich-datascr-button"
+ },
+ "DataScroller rendering failed: ", false);
+
+ // Check '�' link
+ text = selenium.getTable("id=" + dataScrollerTableId + ".0.1");
+ Assert.assertEquals("�", text, "DataScroller does not contain '�' link or its position is invalid");
+ assertClassNames(getPageLinkRefScript(1),new String []
+ {"dr-dscr-button-dsbld",
+ "rich-datascr-button-dsbld",
+ "dr-dscr-button",
+ "rich-datascr-button"
+ },
+ "DataScroller rendering failed: ", false);
+
+ // Check '1' link
+ text = selenium.getTable("id=" + dataScrollerTableId + ".0.3");
+ Assert.assertEquals("1", text, "DataScroller does not contain '1' link or its position is invalid");
+ assertClassNames(getPageLinkRefScript(3),new String []
+ {"dr-dscr-act",
+ "rich-datascr-act"
+ },
+ "DataScroller rendering failed: ", false);
+
+ // Check '5' link
+ text = selenium.getTable("id=" + dataScrollerTableId + ".0.7");
+ Assert.assertEquals("5", text, "DataScroller does not contain '5' link or its position is invalid");
+ assertClassNames(getPageLinkRefScript(7),new String []
+ {"dr-dscr-inact",
+ "rich-datascr-inact"
+ },
+ "DataScroller rendering failed: ", false);
+
+ // Check '�' link
+ text = selenium.getTable("id=" + dataScrollerTableId + ".0.14");
+ Assert.assertEquals("�", text, "DataScroller does not contain '�' link or its position is invalid");
+ assertClassNames(getPageLinkRefScript(14),new String []
+ {"dr-dscr-button",
+ "rich-datascr-button"
+ },
+ "DataScroller rendering failed: ", false);
+
+ // Check '��' link
+ text = selenium.getTable("id=" + dataScrollerTableId + ".0.15");
+ Assert.assertEquals("��", text, "DataScroller does not contain '��' link or its position is invalid");
+ assertClassNames(getPageLinkRefScript(15),new String []
+ {"dr-dscr-button",
+ "rich-datascr-button"
+ },
+ "DataScroller rendering failed: ", false);
+
+ }
+
+ private void testData(int rowCount, String data) {
+ assertRowsCount(rowCount, dataTableId);
+
+ for (int i=1; i <= rowCount; i++) {
+ String text = selenium.getTable("id=" + dataTableId + "."+rowCount+".1");
+ Assert.assertEquals(data, text,"Data Table content is invalid");
+ }
+ }
+
+ private String getPageLinkRefScript(int n) {
+ StringBuffer b = new StringBuffer(WINDOW_JS_RESOLVER);
+ b.append("$('");
+ b.append(dataScrollerTableId);
+ b.append("').rows[0].cells[");
+ b.append(n);
+ b.append("]");
+ return b.toString();
+ }
+
+ /* (non-Javadoc)
+ * @see org.richfaces.SeleniumTestBase#getTestUrl()
+ */
+ @Override
+ public String getTestUrl() {
+ return "pages/dataScroller/dataScroller.xhtml";
+ }
+
+}
16 years, 3 months
JBoss Rich Faces SVN: r10602 - in trunk/framework: impl/src/main/java/org/ajax4jsf/model and 1 other directories.
by richfaces-svn-commits@lists.jboss.org
Author: konstantin.mishin
Date: 2008-09-29 10:33:38 -0400 (Mon, 29 Sep 2008)
New Revision: 10602
Added:
trunk/framework/impl/src/main/java/org/ajax4jsf/model/
trunk/framework/impl/src/main/java/org/ajax4jsf/model/QueueImpl.java
trunk/framework/test/src/test/java/org/ajax4jsf/model/QueueImplTest.java
Log:
Implementation Queue and its test.
Added: trunk/framework/impl/src/main/java/org/ajax4jsf/model/QueueImpl.java
===================================================================
--- trunk/framework/impl/src/main/java/org/ajax4jsf/model/QueueImpl.java (rev 0)
+++ trunk/framework/impl/src/main/java/org/ajax4jsf/model/QueueImpl.java 2008-09-29 14:33:38 UTC (rev 10602)
@@ -0,0 +1,96 @@
+package org.ajax4jsf.model;
+
+import javax.el.ValueExpression;
+import javax.faces.context.FacesContext;
+
+/**
+ * @author Konstantin Mishin
+ *
+ */
+public class QueueImpl implements Queue {
+
+ private FacesContext context;
+
+ private ValueExpression nameExpression;
+
+ private ValueExpression requestDelayExpression;
+
+ private ValueExpression timeoutExpression;
+
+ private ValueExpression ignoreDupResponsesExpression;
+
+ private ValueExpression limitToListExpression;
+
+ public QueueImpl() {
+ this(null);
+ }
+
+ public QueueImpl(FacesContext context) {
+ if(context == null) {
+ this.context = FacesContext.getCurrentInstance();
+ } else {
+ this.context = context;
+ }
+ }
+
+ public String getName() {
+ String name = null;
+ if (nameExpression != null) {
+ name = (String) nameExpression.getValue(context.getELContext());
+ }
+ return name;
+ }
+
+ public Integer getRequestDelay() {
+ Integer requestDelay = null;
+ if (requestDelayExpression != null) {
+ requestDelay = (Integer) requestDelayExpression.getValue(context.getELContext());
+ }
+ return requestDelay;
+ }
+
+ public Integer getTimeout() {
+ Integer timeout = null;
+ if (timeoutExpression != null) {
+ timeout = (Integer) timeoutExpression.getValue(context.getELContext());
+ }
+ return timeout;
+ }
+
+ public Boolean getIgnoreDupResponses() {
+ Boolean ignoreDupResponses = null;
+ if (ignoreDupResponsesExpression != null) {
+ ignoreDupResponses = (Boolean) ignoreDupResponsesExpression.getValue(context.getELContext());
+ }
+ return ignoreDupResponses;
+ }
+
+ public Boolean getLimitToList() {
+ Boolean limitToList = null;
+ if (limitToListExpression != null) {
+ limitToList = (Boolean) limitToListExpression.getValue(context.getELContext());
+ }
+ return limitToList;
+ }
+
+ public void setNameExpression(ValueExpression nameExpression) {
+ this.nameExpression = nameExpression;
+ }
+
+ public void setRequestDelayExpression(ValueExpression requestDelayExpression) {
+ this.requestDelayExpression = requestDelayExpression;
+ }
+
+ public void setTimeoutExpression(ValueExpression timeoutExpression) {
+ this.timeoutExpression = timeoutExpression;
+ }
+
+ public void setIgnoreDupResponsesExpression(
+ ValueExpression ignoreDupResponsesExpression) {
+ this.ignoreDupResponsesExpression = ignoreDupResponsesExpression;
+ }
+
+ public void setLimitToListExpression(ValueExpression limitToListExpression) {
+ this.limitToListExpression = limitToListExpression;
+ }
+}
Added: trunk/framework/test/src/test/java/org/ajax4jsf/model/QueueImplTest.java
===================================================================
--- trunk/framework/test/src/test/java/org/ajax4jsf/model/QueueImplTest.java (rev 0)
+++ trunk/framework/test/src/test/java/org/ajax4jsf/model/QueueImplTest.java 2008-09-29 14:33:38 UTC (rev 10602)
@@ -0,0 +1,100 @@
+/**
+ *
+ */
+package org.ajax4jsf.model;
+
+import javax.el.ValueExpression;
+
+import org.ajax4jsf.tests.AbstractAjax4JsfTestCase;
+import org.ajax4jsf.tests.MockQueue;
+
+/**
+ * @author Konstantin Mishin
+ *
+ */
+public class QueueImplTest extends AbstractAjax4JsfTestCase {
+
+
+ MockQueue mockQueue;
+ QueueImpl queue;
+
+ /**
+ * @param name
+ */
+ public QueueImplTest(String name) {
+ super(name);
+ }
+
+ /* (non-Javadoc)
+ * @see org.ajax4jsf.tests.AbstractAjax4JsfTestCase#setUp()
+ */
+ public void setUp() throws Exception {
+ super.setUp();
+ mockQueue = new MockQueue();
+ externalContext.getRequestMap().put("queue", mockQueue);
+ queue = new QueueImpl();
+ }
+
+ /* (non-Javadoc)
+ * @see org.ajax4jsf.tests.AbstractAjax4JsfTestCase#tearDown()
+ */
+ public void tearDown() throws Exception {
+ queue = null;
+ externalContext.getRequestMap().remove("queue");
+ mockQueue = null;
+ super.tearDown();
+ }
+
+ /**
+ * Test method for {@link org.ajax4jsf.model.QueueImpl#QueueImpl()}.
+ */
+ public void testQueueImpl() {
+ assertNotNull(new QueueImpl());
+ }
+
+ /**
+ * Test method for {@link org.ajax4jsf.model.QueueImpl#getName()}.
+ */
+ public void testGetName() {
+ ValueExpression expression = expressionFactory.createValueExpression(elContext, "#{queue.name}", String.class);
+ queue.setNameExpression(expression);
+ assertEquals(mockQueue.getName(), queue.getName());
+ }
+
+ /**
+ * Test method for {@link org.ajax4jsf.model.QueueImpl#getRequestDelay()}.
+ */
+ public void testGetRequestDelay() {
+ ValueExpression expression = expressionFactory.createValueExpression(elContext, "#{queue.requestDelay}", Integer.class);
+ queue.setRequestDelayExpression(expression);
+ assertEquals(mockQueue.getRequestDelay(), queue.getRequestDelay());
+ }
+
+ /**
+ * Test method for {@link org.ajax4jsf.model.QueueImpl#getTimeout()}.
+ */
+ public void testGetTimeout() {
+ ValueExpression expression = expressionFactory.createValueExpression(elContext, "#{queue.timeout}", Integer.class);
+ queue.setTimeoutExpression(expression);
+ assertEquals(mockQueue.getTimeout(), queue.getTimeout());
+ }
+
+ /**
+ * Test method for {@link org.ajax4jsf.model.QueueImpl#isIgnoreDupResponses()}.
+ */
+ public void testIsIgnoreDupResponses() {
+ ValueExpression expression = expressionFactory.createValueExpression(elContext, "#{queue.ignoreDupResponses}", Boolean.class);
+ queue.setIgnoreDupResponsesExpression(expression);
+ assertEquals(mockQueue.getIgnoreDupResponses(), queue.getIgnoreDupResponses());
+ }
+
+ /**
+ * Test method for {@link org.ajax4jsf.model.QueueImpl#isLimitToList()}.
+ */
+ public void testIsLimitToList() {
+ ValueExpression expression = expressionFactory.createValueExpression(elContext, "#{queue.limitToList}", Boolean.class);
+ queue.setLimitToListExpression(expression);
+ assertEquals(mockQueue.getLimitToList(), queue.getLimitToList());
+ }
+
+}
16 years, 3 months
JBoss Rich Faces SVN: r10601 - in trunk/framework: test/src/main/java/org/ajax4jsf/tests and 1 other directory.
by richfaces-svn-commits@lists.jboss.org
Author: konstantin.mishin
Date: 2008-09-29 10:29:12 -0400 (Mon, 29 Sep 2008)
New Revision: 10601
Modified:
trunk/framework/api/src/main/java/org/ajax4jsf/model/Queue.java
trunk/framework/test/src/main/java/org/ajax4jsf/tests/MockQueue.java
Log:
small fix
Modified: trunk/framework/api/src/main/java/org/ajax4jsf/model/Queue.java
===================================================================
--- trunk/framework/api/src/main/java/org/ajax4jsf/model/Queue.java 2008-09-29 14:19:35 UTC (rev 10600)
+++ trunk/framework/api/src/main/java/org/ajax4jsf/model/Queue.java 2008-09-29 14:29:12 UTC (rev 10601)
@@ -15,7 +15,7 @@
Integer getTimeout();
- Boolean isLimitToList();
+ Boolean getLimitToList();
- Boolean isIgnoreDupResponses();
+ Boolean getIgnoreDupResponses();
}
Modified: trunk/framework/test/src/main/java/org/ajax4jsf/tests/MockQueue.java
===================================================================
--- trunk/framework/test/src/main/java/org/ajax4jsf/tests/MockQueue.java 2008-09-29 14:19:35 UTC (rev 10600)
+++ trunk/framework/test/src/main/java/org/ajax4jsf/tests/MockQueue.java 2008-09-29 14:29:12 UTC (rev 10601)
@@ -23,11 +23,12 @@
return 2;
}
- public Boolean isIgnoreDupResponses() {
+
+ public Boolean getIgnoreDupResponses() {
return true;
}
- public Boolean isLimitToList() {
+ public Boolean getLimitToList() {
return false;
}
16 years, 3 months
JBoss Rich Faces SVN: r10600 - management/design/queue.
by richfaces-svn-commits@lists.jboss.org
Author: ilya_shaikovsky
Date: 2008-09-29 10:19:35 -0400 (Mon, 29 Sep 2008)
New Revision: 10600
Modified:
management/design/queue/RS - queue.doc
Log:
update with js api and changing component to tag.
Modified: management/design/queue/RS - queue.doc
===================================================================
(Binary files differ)
16 years, 3 months