You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@struts.apache.org by mu...@apache.org on 2007/04/04 02:18:48 UTC
svn commit: r525338 - in /struts/struts2/trunk:
apps/showcase/src/main/webapp/ajax/tabbedpanel/
plugins/dojo/src/main/java/org/apache/struts2/dojo/components/
plugins/dojo/src/main/java/org/apache/struts2/dojo/views/jsp/ui/
plugins/dojo/src/main/resour...
Author: musachy
Date: Tue Apr 3 17:18:47 2007
New Revision: 525338
URL: http://svn.apache.org/viewvc?view=rev&rev=525338
Log:
WW-1860 Add "preload" attribute to div tag on Dojo plugin
Added:
struts/struts2/trunk/plugins/dojo/src/profile/struts.profile.js
Modified:
struts/struts2/trunk/apps/showcase/src/main/webapp/ajax/tabbedpanel/example3.jsp
struts/struts2/trunk/plugins/dojo/src/main/java/org/apache/struts2/dojo/components/Div.java
struts/struts2/trunk/plugins/dojo/src/main/java/org/apache/struts2/dojo/views/jsp/ui/DivTag.java
struts/struts2/trunk/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/struts/widget/BindDiv.js
struts/struts2/trunk/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/struts_dojo.js
struts/struts2/trunk/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/struts_dojo.js.uncompressed.js
struts/struts2/trunk/plugins/dojo/src/main/resources/template/ajax/div.ftl
Modified: struts/struts2/trunk/apps/showcase/src/main/webapp/ajax/tabbedpanel/example3.jsp
URL: http://svn.apache.org/viewvc/struts/struts2/trunk/apps/showcase/src/main/webapp/ajax/tabbedpanel/example3.jsp?view=diff&rev=525338&r1=525337&r2=525338
==============================================================================
--- struts/struts2/trunk/apps/showcase/src/main/webapp/ajax/tabbedpanel/example3.jsp (original)
+++ struts/struts2/trunk/apps/showcase/src/main/webapp/ajax/tabbedpanel/example3.jsp Tue Apr 3 17:18:47 2007
@@ -39,7 +39,7 @@
<s:textfield name="tt2" label="Test Text2" />
</s:form>
</sx:div>
- <sx:div href="%{ajaxTest}" id="ryh1" label="remote one" />
+ <sx:div href="%{ajaxTest}" id="ryh1" label="remote one" preload="false"/>
<sx:div id="middle" label="middle">
middle tab<br/>
<s:form >
@@ -47,7 +47,7 @@
<s:textfield name="tt2" label="Test Text442" />
</s:form>
</sx:div>
- <sx:div href="%{ajaxTest}" id="ryh21" label="remote right" />
+ <sx:div href="%{ajaxTest}" id="ryh21" label="remote right" preload="false"/>
</sx:tabbedpanel>
<!--// END SNIPPET: tabbedpanel-tag-->
</td>
Modified: struts/struts2/trunk/plugins/dojo/src/main/java/org/apache/struts2/dojo/components/Div.java
URL: http://svn.apache.org/viewvc/struts/struts2/trunk/plugins/dojo/src/main/java/org/apache/struts2/dojo/components/Div.java?view=diff&rev=525338&r1=525337&r2=525338
==============================================================================
--- struts/struts2/trunk/plugins/dojo/src/main/java/org/apache/struts2/dojo/components/Div.java (original)
+++ struts/struts2/trunk/plugins/dojo/src/main/java/org/apache/struts2/dojo/components/Div.java Tue Apr 3 17:18:47 2007
@@ -73,6 +73,7 @@
protected String refreshOnShow;
protected String separateScripts;
protected String closable;
+ protected String preload;
public Div(ValueStack stack, HttpServletRequest request, HttpServletResponse response) {
super(stack, request, response);
@@ -105,6 +106,8 @@
addParameter("separateScripts", findValue(separateScripts, Boolean.class));
if (closable != null)
addParameter("closable", findValue(closable, Boolean.class));
+ if (preload != null)
+ addParameter("preload", findValue(preload, Boolean.class));
}
@StrutsTagAttribute(description="Start timer automatically", type="Boolean", defaultValue="true")
@@ -145,5 +148,10 @@
@StrutsTagAttribute(description="Show a close button when the div is inside a 'tabbedpanel'", defaultValue="false")
public void setClosable(String closable) {
this.closable = closable;
+ }
+
+ @StrutsTagAttribute(description="Load content when page is loaded", type="Boolean", defaultValue="true")
+ public void setPreload(String preload) {
+ this.preload = preload;
}
}
Modified: struts/struts2/trunk/plugins/dojo/src/main/java/org/apache/struts2/dojo/views/jsp/ui/DivTag.java
URL: http://svn.apache.org/viewvc/struts/struts2/trunk/plugins/dojo/src/main/java/org/apache/struts2/dojo/views/jsp/ui/DivTag.java?view=diff&rev=525338&r1=525337&r2=525338
==============================================================================
--- struts/struts2/trunk/plugins/dojo/src/main/java/org/apache/struts2/dojo/views/jsp/ui/DivTag.java (original)
+++ struts/struts2/trunk/plugins/dojo/src/main/java/org/apache/struts2/dojo/views/jsp/ui/DivTag.java Tue Apr 3 17:18:47 2007
@@ -40,6 +40,7 @@
protected String refreshOnShow;
protected String separateScripts;
protected String closable;
+ protected String preload;
public Component getBean(ValueStack stack, HttpServletRequest req, HttpServletResponse res) {
return new Div(stack, req, res);
@@ -57,6 +58,7 @@
div.setRefreshOnShow(refreshOnShow);
div.setSeparateScripts(separateScripts);
div.setClosable(closable);
+ div.setPreload(preload);
}
public void setAutoStart(String autoStart) {
@@ -89,5 +91,9 @@
public void setClosable(String closable) {
this.closable = closable;
+ }
+
+ public void setPreload(String preload) {
+ this.preload = preload;
}
}
Modified: struts/struts2/trunk/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/struts/widget/BindDiv.js
URL: http://svn.apache.org/viewvc/struts/struts2/trunk/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/struts/widget/BindDiv.js?view=diff&rev=525338&r1=525337&r2=525338
==============================================================================
--- struts/struts2/trunk/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/struts/widget/BindDiv.js (original)
+++ struts/struts2/trunk/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/struts/widget/BindDiv.js Tue Apr 3 17:18:47 2007
@@ -16,7 +16,8 @@
cacheContent : false,
refreshOnShow : false,
executeScripts : false,
-
+ preload : true,
+
//update times
updateFreq : 0,
delay : 0,
@@ -49,7 +50,6 @@
formId : "",
formFilter : "",
- firstTime : true,
indicator: "",
@@ -131,7 +131,9 @@
},
postCreate : function(args, frag) {
- struts.widget.BindDiv.superclass.postCreate.apply(this);
+ if (this.handler !== "") {
+ this.setHandler(this.handler);
+ }
var self = this;
var hitchedRefresh = function() {
@@ -228,16 +230,14 @@
if(!dojo.string.isBlank(this.errorNotifyTopics)) {
this.errorNotifyTopicsArray = this.errorNotifyTopics.split(",");
}
+
+ if(this.isShowing() && this.preload && this.updateFreq <= 0 && this.delay <= 0) {
+ this.loadContents();
+ }
},
_downloadExternalContent: function(url, useCache) {
- if(this.firstTime) {
- this.firstTime = false;
- if(this.delay > 0) {
- return;
- }
- }
-
+
var request = {cancel: false};
this.notify(this.widgetId, "before", request);
if(request.cancel) {
Modified: struts/struts2/trunk/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/struts_dojo.js
URL: http://svn.apache.org/viewvc/struts/struts2/trunk/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/struts_dojo.js?view=diff&rev=525338&r1=525337&r2=525338
==============================================================================
--- struts/struts2/trunk/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/struts_dojo.js (original)
+++ struts/struts2/trunk/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/struts_dojo.js Tue Apr 3 17:18:47 2007
@@ -13829,7 +13829,7 @@
dj_global.clearInterval(this.timer);
}});
dojo.provide("struts.widget.BindDiv");
-dojo.widget.defineWidget("struts.widget.BindDiv",dojo.widget.ContentPane,{widgetType:"BindDiv",href:"",extractContent:false,parseContent:false,cacheContent:false,refreshOnShow:false,executeScripts:false,updateFreq:0,delay:0,autoStart:true,timer:null,loadingText:"Loading...",showLoading:true,errorText:"",showError:true,listenTopics:"",notifyTopics:"",notifyTopicsArray:null,stopTimerListenTopics:"",startTimerListenTopics:"",beforeNotifyTopics:"",beforeNotifyTopicsArray:null,afterNotifyTopics:"",afterNotifyTopicsArray:null,errorNotifyTopics:"",errorNotifyTopicsArray:null,beforeLoading:"",afterLoading:"",formId:"",formFilter:"",firstTime:true,indicator:"",parseContent:true,onDownloadStart:function(_ba1){
+dojo.widget.defineWidget("struts.widget.BindDiv",dojo.widget.ContentPane,{widgetType:"BindDiv",href:"",extractContent:false,parseContent:false,cacheContent:false,refreshOnShow:false,executeScripts:false,preload:true,updateFreq:0,delay:0,autoStart:true,timer:null,loadingText:"Loading...",showLoading:true,errorText:"",showError:true,listenTopics:"",notifyTopics:"",notifyTopicsArray:null,stopTimerListenTopics:"",startTimerListenTopics:"",beforeNotifyTopics:"",beforeNotifyTopicsArray:null,afterNotifyTopics:"",afterNotifyTopicsArray:null,errorNotifyTopics:"",errorNotifyTopicsArray:null,beforeLoading:"",afterLoading:"",formId:"",formFilter:"",indicator:"",parseContent:true,onDownloadStart:function(_ba1){
if(!this.showLoading){
_ba1.returnValue=false;
return;
@@ -13889,7 +13889,9 @@
});
}
},postCreate:function(args,frag){
-struts.widget.BindDiv.superclass.postCreate.apply(this);
+if(this.handler!==""){
+this.setHandler(this.handler);
+}
var self=this;
var _bb5=function(){
dojo.lang.hitch(self,"refresh")();
@@ -13960,13 +13962,10 @@
if(!dojo.string.isBlank(this.errorNotifyTopics)){
this.errorNotifyTopicsArray=this.errorNotifyTopics.split(",");
}
-},_downloadExternalContent:function(url,_bbe){
-if(this.firstTime){
-this.firstTime=false;
-if(this.delay>0){
-return;
-}
+if(this.isShowing()&&this.preload&&this.updateFreq<=0&&this.delay<=0){
+this.loadContents();
}
+},_downloadExternalContent:function(url,_bbe){
var _bbf={cancel:false};
this.notify(this.widgetId,"before",_bbf);
if(_bbf.cancel){
Modified: struts/struts2/trunk/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/struts_dojo.js.uncompressed.js
URL: http://svn.apache.org/viewvc/struts/struts2/trunk/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/struts_dojo.js.uncompressed.js?view=diff&rev=525338&r1=525337&r2=525338
==============================================================================
--- struts/struts2/trunk/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/struts_dojo.js.uncompressed.js (original)
+++ struts/struts2/trunk/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/struts_dojo.js.uncompressed.js Tue Apr 3 17:18:47 2007
@@ -22436,7 +22436,8 @@
cacheContent : false,
refreshOnShow : false,
executeScripts : false,
-
+ preload : true,
+
//update times
updateFreq : 0,
delay : 0,
@@ -22469,7 +22470,6 @@
formId : "",
formFilter : "",
- firstTime : true,
indicator: "",
@@ -22551,7 +22551,9 @@
},
postCreate : function(args, frag) {
- struts.widget.BindDiv.superclass.postCreate.apply(this);
+ if (this.handler !== "") {
+ this.setHandler(this.handler);
+ }
var self = this;
var hitchedRefresh = function() {
@@ -22648,16 +22650,14 @@
if(!dojo.string.isBlank(this.errorNotifyTopics)) {
this.errorNotifyTopicsArray = this.errorNotifyTopics.split(",");
}
+
+ if(this.isShowing() && this.preload && this.updateFreq <= 0 && this.delay <= 0) {
+ this.loadContents();
+ }
},
_downloadExternalContent: function(url, useCache) {
- if(this.firstTime) {
- this.firstTime = false;
- if(this.delay > 0) {
- return;
- }
- }
-
+
var request = {cancel: false};
this.notify(this.widgetId, "before", request);
if(request.cancel) {
Modified: struts/struts2/trunk/plugins/dojo/src/main/resources/template/ajax/div.ftl
URL: http://svn.apache.org/viewvc/struts/struts2/trunk/plugins/dojo/src/main/resources/template/ajax/div.ftl?view=diff&rev=525338&r1=525337&r2=525338
==============================================================================
--- struts/struts2/trunk/plugins/dojo/src/main/resources/template/ajax/div.ftl (original)
+++ struts/struts2/trunk/plugins/dojo/src/main/resources/template/ajax/div.ftl Tue Apr 3 17:18:47 2007
@@ -23,6 +23,9 @@
<#if parameters.separateScripts?exists>
scriptSeparation="${parameters.separateScripts?string?html}"<#rt/>
</#if>
+ <#if parameters.preload?exists>
+ preload="${parameters.preload?string?html}"<#rt/>
+ </#if>
<#include "/${parameters.templateDir}/ajax/ajax-common.ftl" />
<#include "/${parameters.templateDir}/simple/scripting-events.ftl" />
<#include "/${parameters.templateDir}/simple/common-attributes.ftl" />
Added: struts/struts2/trunk/plugins/dojo/src/profile/struts.profile.js
URL: http://svn.apache.org/viewvc/struts/struts2/trunk/plugins/dojo/src/profile/struts.profile.js?view=auto&rev=525338
==============================================================================
--- struts/struts2/trunk/plugins/dojo/src/profile/struts.profile.js (added)
+++ struts/struts2/trunk/plugins/dojo/src/profile/struts.profile.js Tue Apr 3 17:18:47 2007
@@ -0,0 +1,15 @@
+var dependencies = [
+ "dojo.io.*",
+ "dojo.io.BrowserIO",
+ "dojo.event.*",
+ "dojo.lfx.*",
+ "dojo.namespaces.*",
+ "dojo.widget.Editor2",
+ "struts.widget.*",
+];
+
+dependencies.prefixes = [
+ ["struts", "../struts/2_1/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/struts"]
+];
+
+load("getDependencyList.js");