Author: andrei_exadel
Date: 2008-10-08 09:07:00 -0400 (Wed, 08 Oct 2008)
New Revision: 10694
Added:
trunk/samples/columnsDemo/src/main/java/org/richfaces/samples/
trunk/samples/columnsDemo/src/main/java/org/richfaces/samples/Bean.java
trunk/samples/columnsDemo/src/main/java/org/richfaces/samples/Column.java
Removed:
trunk/samples/columnsDemo/src/main/java/org/richfaces/sandbox/
Log:
Demo update
Added: trunk/samples/columnsDemo/src/main/java/org/richfaces/samples/Bean.java
===================================================================
--- trunk/samples/columnsDemo/src/main/java/org/richfaces/samples/Bean.java
(rev 0)
+++ trunk/samples/columnsDemo/src/main/java/org/richfaces/samples/Bean.java 2008-10-08
13:07:00 UTC (rev 10694)
@@ -0,0 +1,134 @@
+/*
+ * Bean.java Date created: 08.10.2008
+ * Last modified by: $Author$
+ * $Revision$ $Date$
+ */
+
+package org.richfaces.samples;
+
+
+import java.util.ArrayList;
+import java.util.List;
+
+import javax.faces.event.ActionEvent;
+
+/**
+ * Sample session bean
+ * @author Andrey
+ *
+ */
+public class Bean {
+
+ List<Column> columns;
+
+ List<List<String>> data;
+
+ Integer rowsCount;
+
+ Boolean name;
+
+ Boolean type;
+
+ Boolean description;
+
+
+ public Bean() {
+ rowsCount = 5;
+ name = true;
+ type = true;
+ description = true;
+ init();
+ }
+
+ public void apply(ActionEvent event) {
+ init();
+ }
+
+ private void init() {
+ // Init columns
+ columns = new ArrayList<Column>();
+ columns.add(new Column("#"));
+
+ if (name) {
+ columns.add(new Column("Name"));
+ }
+ if (type) {
+ columns.add(new Column("Type"));
+ }
+ if (description) {
+ columns.add(new Column("Description"));
+ }
+
+ //Init model
+ data = new ArrayList<List<String>>();
+ for (int i = 0; i < rowsCount; i++) {
+ data.add(getRow(i));
+ }
+ }
+
+ private List<String> getRow(int row) {
+ List<String> list = new ArrayList<String>();
+ list.add(String.valueOf(row));
+ if (name) {
+ list.add(String.valueOf(Math.random()));
+ }
+
+ if (type) {
+ int i = new Double(Math.random() * 10.0).intValue();
+ if (i <= 3) {
+ list.add("txt");
+ }else if (i <= 6) {
+ list.add("jpeg");
+ }else if (i <= 10) {
+ list.add("xml");
+ }
+ }
+
+ if (description) {
+ list.add("");
+ }
+
+ return list;
+ }
+
+ public List<Column> getColumns() {
+ return columns;
+ }
+
+ public List<List<String>> getData() {
+ return data;
+ }
+
+ public Boolean getName() {
+ return name;
+ }
+
+ public void setName(Boolean name) {
+ this.name = name;
+ }
+
+ public Boolean getType() {
+ return type;
+ }
+
+ public void setType(Boolean type) {
+ this.type = type;
+ }
+
+ public Boolean getDescription() {
+ return description;
+ }
+
+ public void setDescription(Boolean description) {
+ this.description = description;
+ }
+
+ public Integer getRowsCount() {
+ return rowsCount;
+ }
+
+ public void setRowsCount(Integer rowsCount) {
+ this.rowsCount = rowsCount;
+ }
+
+}
Added: trunk/samples/columnsDemo/src/main/java/org/richfaces/samples/Column.java
===================================================================
--- trunk/samples/columnsDemo/src/main/java/org/richfaces/samples/Column.java
(rev 0)
+++ trunk/samples/columnsDemo/src/main/java/org/richfaces/samples/Column.java 2008-10-08
13:07:00 UTC (rev 10694)
@@ -0,0 +1,52 @@
+/*
+ * Column.java Date created: 08.10.2008
+ * Last modified by: $Author$
+ * $Revision$ $Date$
+ */
+
+package org.richfaces.samples;
+
+import org.richfaces.model.Ordering;
+
+/**
+ * Column sample model
+ * @author Andrey
+ *
+ */
+public class Column {
+
+ String name;
+
+ Ordering ordering;
+
+ String filterValue;
+
+ public Column(String name) {
+ this.name = name;
+ }
+
+ public String getName() {
+ return name;
+ }
+
+ public void setName(String name) {
+ this.name = name;
+ }
+
+ public Ordering getOrdering() {
+ return ordering;
+ }
+
+ public void setOrdering(Ordering ordering) {
+ this.ordering = ordering;
+ }
+
+ public String getFilterValue() {
+ return filterValue;
+ }
+
+ public void setFilterValue(String filterValue) {
+ this.filterValue = filterValue;
+ }
+
+}
Show replies by date