Author: tkuprevich
Date: 2008-07-07 11:39:11 -0400 (Mon, 07 Jul 2008)
New Revision: 9432
Modified:
trunk/test-applications/facelets/src/main/java/scrollableDataTable/ScrollableDataTable.java
Log:
Modified:
trunk/test-applications/facelets/src/main/java/scrollableDataTable/ScrollableDataTable.java
===================================================================
---
trunk/test-applications/facelets/src/main/java/scrollableDataTable/ScrollableDataTable.java 2008-07-07
15:38:16 UTC (rev 9431)
+++
trunk/test-applications/facelets/src/main/java/scrollableDataTable/ScrollableDataTable.java 2008-07-07
15:39:11 UTC (rev 9432)
@@ -1,13 +1,15 @@
package scrollableDataTable;
import java.util.ArrayList;
+import java.util.GregorianCalendar;
import org.ajax4jsf.model.DataComponentState;
+import org.richfaces.component.html.HtmlScrollableDataTable;
import org.richfaces.model.selection.Selection;
+import util.componentInfo.ComponentInfo;
import util.data.Data;
-
/**
* @author AYanul
*
@@ -34,7 +36,31 @@
private String activeRowKey;
private Selection selection;
private boolean ajaxSingle;
+ private GregorianCalendar date;
+ private HtmlScrollableDataTable htmlScrollableDataTable = null;
+
+ public void addHtmlScrollableDataTable(){
+ ComponentInfo info = ComponentInfo.getInstance();
+ info.addField(htmlScrollableDataTable);
+ }
+
+ public HtmlScrollableDataTable getHtmlScrollableDataTable() {
+ return htmlScrollableDataTable;
+ }
+ public void setHtmlScrollableDataTable(
+ HtmlScrollableDataTable htmlScrollableDataTable) {
+ this.htmlScrollableDataTable = htmlScrollableDataTable;
+ }
+
+ public GregorianCalendar getDate() {
+ return date;
+ }
+
+ public void setDate(GregorianCalendar date) {
+ this.date = date;
+ }
+
public ScrollableDataTable() {
sortMode = "single";
width = "400px";
@@ -50,6 +76,7 @@
bypassUpdates = false;
ignoreDupResponses = false;
ajaxSingle = false;
+ date = new GregorianCalendar();
addNewItem();
}
@@ -161,14 +188,16 @@
this.hideWhenScrolling = hideWhenScrolling;
}
- public void addNewItem() {
+ public void addNewItem() {
if(dataLength < 0) dataLength = 0;
if(data.size() > dataLength)
- for(int i = dataLength; i < data.size(); )
+ for(int i = data.size() - 1; i >= dataLength; i--)
data.remove(i);
else
- for(int i = data.size() + 1; i <= dataLength; i++)
- data.add(new Data(i, "Text " + i, "Link " + i, "select"
+(i % 5), Data.statusIcon[i % 5]));
+ for(int i = data.size(); i < dataLength; i++){
+ date.set(2008, 5, 14, 3, i);
+ data.add(new Data(i, "Text " + i, "Link " + i, "select"
+(i % 5), Data.statusIcon[i % 5], date.getTime()));
+ }
}
public ArrayList<Data> getData() {