Would something like this include all the current functionality in
BindDiv? (events for stop/start timer, refresh, start after a delay,
advisor via dojo's "handler" property). This way BindDiv will be easier
to maintain (dojo's ContentPane + timer) and the Tab widget can be
deleted (doesn't add anything to this one). By the way this doesn't work
on AMD 64/firefox/linux due to a dojo's bug.
dojo.provide("struts.widgets.BindDiv");
dojo.require("dojo.widget.*");
dojo.require("dojo.io.*");
dojo.require("dojo.widget.Container");
dojo.require("dojo.widget.ContentPane");
dojo.require("dojo.animation.Timer");
struts.widgets.BindDiv = function() {
dojo.widget.html.ContentPane.call(this);
var self = this;
this.widgetType = "BindDiv";
this.href = "";
this.extractContent = false;
this.parseContent = false;
this.cacheContent = false;
this.frequency = 0;
this.delay = 0;
this.startTimer = false;
this.timer = null;
//pub/sub events
this.refreshListenTopics = "";
this.stopTimerListenTopics = "";
this.startTimerListenTopics = "";
this.postCreate = function() {
if(self.frequency > 0) {
self.timer = new dojo.animation.Timer(self.frequency);
self.timer.onTick = self.reloadContents;
//start the timer
if(self.startTimer) {
//start after delay
dojo.debug("starting timer after " + self.delay);
dojo.lang.setTimeout(self.delay, self.startTimer);
}
}
//attach listeners
if(!dojo.string.isBlank(self.refreshListenTopics)) {
dojo.debug("Listening to " + self.refreshListenTopics);
dojo.event.topic.subscribe(self.refreshListenTopics, self,
"reloadContents");
}
if(!dojo.string.isBlank(self.stopTimerListenTopics)) {
dojo.debug("Listening to " + self.stopTimerListenTopics);
dojo.event.topic.subscribe(self.stopTimerListenTopics, self,
"stopTimer");
}
if(!dojo.string.isBlank(self.startTimerListenTopics)) {
dojo.debug("Listening to " + self.startTimerListenTopics);
dojo.event.topic.subscribe(self.startTimerListenTopics, self,
"startTimer");
}
};
this.reloadContents = function() {
//refresh is not visible in ContentPane
self.isLoaded = false;
self.loadContents();
};
this.stopTimer = function() {
dojo.debug("stopping timer");
self.timer.stop();
};
this.startTimer = function() {
dojo.debug("starting timer with frequency " + self.frequency);
self.timer.start();
};
};
dojo.inherits(struts.widgets.BindDiv, dojo.widget.html.ContentPane);
dojo.widget.tags.addParseTreeHandler("dojo:BindDiv");
Musachy Barroso wrote:
I was looking at the Div/Panel classes and I think we need to do some
changes, right now Panel extends Div and PanelTag exteds DivTag. The
problem is that the new PanelTag wraps dojo's ContentPane, while
DivTag wraps HTMLBindDiv(from struts), and they are quite different. I
think we should replace HTMLBindDiv with an implementation that
extends dojo's ContentPane and add a timer to it for the auto refresh.
what do you guys think?
musachy
Ian Roughley wrote:
Yes - this was the direction that we wanted to go in. Try to do as
much as possible in dojo and provide light wrappers in Struts. When
we first implemented the tabs, there was no such dojo
implementation. The one feature that we had that you should check
that has been implemented in dojo is the pub/sub events - so there
should be events that each tabs listens to to refresh itself.
I think as Don pointed out, we want to keep a very lightweight
wrapper in struts and have all the work being done in dojo.
The other big thing that would be a great help is converting the code
from dojo 0.2 to 0.3 :)
Ian
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]