You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@myfaces.apache.org by we...@apache.org on 2006/05/20 11:47:32 UTC
svn commit: r407975 - in /myfaces/tobago/trunk:
core/src/main/java/org/apache/myfaces/tobago/
core/src/main/java/org/apache/myfaces/tobago/component/
core/src/main/java/org/apache/myfaces/tobago/taglib/component/
example/demo/src/main/webapp/overview/ ...
Author: weber
Date: Sat May 20 02:47:32 2006
New Revision: 407975
URL: http://svn.apache.org/viewvc?rev=407975&view=rev
Log:
TOBAGO-74 (autoreload for sheet)
Modified:
myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/TobagoConstants.java
myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/component/UIData.java
myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/taglib/component/SheetTag.java
myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/taglib/component/SheetTagDeclaration.java
myfaces/tobago/trunk/example/demo/src/main/webapp/overview/sheetControl.jsp
myfaces/tobago/trunk/theme/scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/SheetRenderer.java
myfaces/tobago/trunk/theme/standard/src/main/resources/org/apache/myfaces/tobago/renderkit/html/standard/standard/script/tobago-sheet.js
Modified: myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/TobagoConstants.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/TobagoConstants.java?rev=407975&r1=407974&r2=407975&view=diff
==============================================================================
--- myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/TobagoConstants.java (original)
+++ myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/TobagoConstants.java Sat May 20 02:47:32 2006
@@ -26,6 +26,7 @@
public static final String ATTR_ACTION_LISTENER = "actionListener";
public static final String ATTR_ALIGN = "align";
public static final String ATTR_ALT = "alt";
+ public static final String ATTR_AUTO_RELOAD = "autoReload";
public static final String ATTR_BODY_CONTENT = "bodyContent";
public static final String ATTR_BORDER = "border";
public static final String ATTR_CHARSET = "charset";
Modified: myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/component/UIData.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/component/UIData.java?rev=407975&r1=407974&r2=407975&view=diff
==============================================================================
--- myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/component/UIData.java (original)
+++ myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/component/UIData.java Sat May 20 02:47:32 2006
@@ -82,6 +82,7 @@
private String showPageRange;
private String showDirectLinks;
private Integer directLinkCount;
+ private Integer autoReload;
public void encodeBegin(FacesContext facesContext) throws IOException {
UILayout.prepareDimension(facesContext, this);
@@ -437,7 +438,7 @@
public Object saveState(FacesContext context) {
- Object[] saveState = new Object[9];
+ Object[] saveState = new Object[10];
saveState[0] = super.saveState(context);
saveState[1] = sheetState;
saveState[2] = saveAttachedState(context, sortActionListener);
@@ -447,6 +448,7 @@
saveState[6] = showPageRange;
saveState[7] = showDirectLinks;
saveState[8] = directLinkCount;
+ saveState[9] = autoReload;
return saveState;
}
@@ -461,6 +463,7 @@
showPageRange = (String) values[6];
showDirectLinks = (String) values[7];
directLinkCount = (Integer) values[8];
+ autoReload = (Integer) values[9];
}
@@ -589,7 +592,15 @@
this.showHeader = showHeader;
}
- public void encodeAjax(FacesContext facesContext) throws IOException {
+ public Integer getAutoReload() {
+ return autoReload;
+ }
+
+ public void setAutoReload(Integer autoReload) {
+ this.autoReload = autoReload;
+ }
+
+ public void encodeAjax(FacesContext facesContext) throws IOException {
setupState(facesContext);
prepareDimensions(facesContext);
AjaxUtils.encodeAjaxComponent(facesContext, this);
Modified: myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/taglib/component/SheetTag.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/taglib/component/SheetTag.java?rev=407975&r1=407974&r2=407975&view=diff
==============================================================================
--- myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/taglib/component/SheetTag.java (original)
+++ myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/taglib/component/SheetTag.java Sat May 20 02:47:32 2006
@@ -16,6 +16,7 @@
* limitations under the License.
*/
+import static org.apache.myfaces.tobago.TobagoConstants.ATTR_AUTO_RELOAD;
import static org.apache.myfaces.tobago.TobagoConstants.ATTR_COLUMNS;
import static org.apache.myfaces.tobago.TobagoConstants.ATTR_DIRECT_LINK_COUNT;
import static org.apache.myfaces.tobago.TobagoConstants.ATTR_FIRST;
@@ -49,6 +50,7 @@
private String state;
private String stateChangeListener;
private String sortActionListener;
+ private String autoReload;
public String getComponentType() {
// TODO: implement uidata with overridden processUpdates to store state
@@ -71,6 +73,7 @@
state = null;
stateChangeListener = null;
sortActionListener = null;
+ autoReload = null;
}
protected void setProperties(UIComponent component) {
@@ -83,6 +86,7 @@
ComponentUtil.setBooleanProperty(data, ATTR_SHOW_HEADER, showHeader);
ComponentUtil.setIntegerProperty(data, ATTR_FIRST, first);
ComponentUtil.setIntegerProperty(data, ATTR_ROWS, rows);
+ ComponentUtil.setIntegerProperty(data, ATTR_AUTO_RELOAD, autoReload);
ComponentUtil.setStringProperty(data, ATTR_COLUMNS, columns);
ComponentUtil.setStringProperty(data, ATTR_VALUE, value);
ComponentUtil.setStringProperty(data, ATTR_FORCE_VERTICAL_SCROLLBAR, forceVerticalScrollbar);
@@ -185,5 +189,12 @@
this.sortActionListener = sortActionListener;
}
+ public String getAutoReload() {
+ return autoReload;
+ }
+
+ public void setAutoReload(String autoReload) {
+ this.autoReload = autoReload;
+ }
}
Modified: myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/taglib/component/SheetTagDeclaration.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/taglib/component/SheetTagDeclaration.java?rev=407975&r1=407974&r2=407975&view=diff
==============================================================================
--- myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/taglib/component/SheetTagDeclaration.java (original)
+++ myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/taglib/component/SheetTagDeclaration.java Sat May 20 02:47:32 2006
@@ -75,6 +75,13 @@
void setRows(String pagingLength);
/**
+ * Time in milliseconds after which the sheet content is automaticaly reloaded.
+ */
+ @TagAttribute
+ @UIComponentTagAttribute(type = "java.lang.Integer")
+ void setAutoReload(String autoReload);
+
+ /**
* Zero-relative row number of the first row to be displayed.
*/
@TagAttribute
Modified: myfaces/tobago/trunk/example/demo/src/main/webapp/overview/sheetControl.jsp
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/example/demo/src/main/webapp/overview/sheetControl.jsp?rev=407975&r1=407974&r2=407975&view=diff
==============================================================================
--- myfaces/tobago/trunk/example/demo/src/main/webapp/overview/sheetControl.jsp (original)
+++ myfaces/tobago/trunk/example/demo/src/main/webapp/overview/sheetControl.jsp Sat May 20 02:47:32 2006
@@ -117,7 +117,8 @@
pagingLength="#{overviewController.sheetConfig.sheetPagingLength}"
directLinkCount="#{overviewController.sheetConfig.sheetDirectLinkCount}"
stateChangeListener="#{demo.stateChangeListener}"
- sortActionListener="#{overviewController.sheetSorter}">
+ sortActionListener="#{overviewController.sheetSorter}"
+ autoReload="1000" >
<tc:column label="#{overviewBundle.solarArrayName}" id="name" sortable="true">
<tc:out value="#{luminary.name}" id="t_name" />
</tc:column>
Modified: myfaces/tobago/trunk/theme/scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/SheetRenderer.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/theme/scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/SheetRenderer.java?rev=407975&r1=407974&r2=407975&view=diff
==============================================================================
--- myfaces/tobago/trunk/theme/scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/SheetRenderer.java (original)
+++ myfaces/tobago/trunk/theme/scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/SheetRenderer.java Sat May 20 02:47:32 2006
@@ -111,7 +111,7 @@
final String[] scripts = new String[]{"script/tobago-sheet.js"};
final String[] cmds = {
"new Tobago.Sheet(\"" + sheetId + "\", " + ajaxEnabled
- + ", \"" + checked + "\", \"" + unchecked + "\");"
+ + ", \"" + checked + "\", \"" + unchecked + "\", "+ data.getAutoReload() + ");"
};
ComponentUtil.addStyles(data, styles);
Modified: myfaces/tobago/trunk/theme/standard/src/main/resources/org/apache/myfaces/tobago/renderkit/html/standard/standard/script/tobago-sheet.js
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/theme/standard/src/main/resources/org/apache/myfaces/tobago/renderkit/html/standard/standard/script/tobago-sheet.js?rev=407975&r1=407974&r2=407975&view=diff
==============================================================================
--- myfaces/tobago/trunk/theme/standard/src/main/resources/org/apache/myfaces/tobago/renderkit/html/standard/standard/script/tobago-sheet.js (original)
+++ myfaces/tobago/trunk/theme/standard/src/main/resources/org/apache/myfaces/tobago/renderkit/html/standard/standard/script/tobago-sheet.js Sat May 20 02:47:32 2006
@@ -39,12 +39,13 @@
};
-Tobago.Sheet = function(sheetId, enableAjax, checkedImage, uncheckedImage) {
+Tobago.Sheet = function(sheetId, enableAjax, checkedImage, uncheckedImage, autoReload) {
this.startTime = new Date();
this.id = sheetId;
this.ajaxEnabled = enableAjax;
this.checkedImage = checkedImage;
this.uncheckedImage = uncheckedImage;
+ this.autoReload = autoReload;
this.resizerId = undefined;
this.oldX = 0;
@@ -60,7 +61,8 @@
this.headerWidthsId = this.id + Tobago.SUB_COMPONENT_SEP + "widths"
if (this.ajaxEnabled) {
- // option are onyl used for ajax request
+ Tobago.ajaxComponents[this.id] = this;
+ // option are onyl used for ajax request
this.options = {
method: 'post',
asynchronous: true,
@@ -301,8 +303,8 @@
}
};
-Tobago.Sheet.prototype.onComplete = function() {
- LOG.debug("sheet reloaded");
+Tobago.Sheet.prototype.onComplete = function(transport) {
+ LOG.debug("sheet reloaded : " + transport.responseText.substr(0,20));
this.setup();
};
@@ -356,6 +358,10 @@
this.setupPagingLinks();
this.setupPagePaging();
this.setupRowPaging();
+ }
+ if (typeof this.autoReload == "number" && Tobago.element(this.contentDivId)) {
+ clearTimeout(this.reloadTimer);
+ this.reloadTimer = setTimeout(Tobago.bind2(this, "reloadWithAction", this.id), this.autoReload);
}
this.setupEnd = new Date();
};