Well I am using tapestry4.0-4beta version.
Let me give the code details to you,
My .html file contains:
/**********************************************************************/
<span jwcid="@Any" id="linkPart" >
<span jwcid="@If" condition="ognl:!importing" >
<div class="progressStart">
<a jwcid="progressLink" >Start</a>
</div>
</span>
<span jwcid="@If" condition="ognl:importing" >
<div class="progressStart">
<a jwcid="progressCancel" >Cancel</a>
</div>
</span>
</span>
<!-- End Task Progress invoker -->
<!-- Task progress -->
<span jwcid="progress" />
<!-- End Task progress -->
<script type="text/javascript">
var linkString = '<span jwcid="@Insert" raw="true"
value="ognl:components.progress.linkString" />';
var startObject = new Object();
startObject.ajaxUpdate = function(ajaxElement, responseElement,
elementId) {
if (!document.progUpdater) {
document.progUpdater = new
Ajax.PeriodicalUpdater('progress', linkString, {asynchronous:true,
evalScripts:true, decay:1.2, freqency:0.4} );
Effect.Appear(elementId);
}
}
var cancelObject = new Object();
cancelObject.ajaxUpdate = function(ajaxElement, responseElement,
elementId) {
if (document.progUpdater) {
document.progUpdater.stop();
document.progUpdater = null;
Effect.Fade(elementId);
}
<span jwcid="@tacos:Refresh"
updateComponents="ognl:{'linkPart'}" />
}
var progressComplete = new Object();
progressComplete.progressFinished = function(elementId) {
if (document.progUpdater) {
document.progUpdater.stop();
document.progUpdater = null;
Effect.Fade(elementId);
}
<span jwcid="@tacos:Refresh"
updateComponents="ognl:{'linkPart'}" />
}
</script>
/**********************************************************************/
My .page contains:
/**************************************************************************/
<page-specification class="com.pages.ProgressBarImpl">
<property name="progressWorker" persist="session" />
<property name="startTime" persist="session" />
<component id="progressLink" type="tacos:AjaxDirectLink">
<binding name="listener" value="listener:startTask"/>
<binding name="updateComponents" value="ognl:{'linkPart'}"/>
<binding name="processScripts" value="ognl:false" />
<binding name="updateObject" value="literal:startObject" />
<binding name="direct" value="ognl:false" />
</component>
<component id="progressCancel" type="tacos:AjaxDirectLink">
<binding name="listener"
value="ognl:components.progress.listeners.cancelTask"/>
<binding name="updateComponents" value="ognl:{'linkPart'}"/>
<binding name="processScripts" value="ognl:false" />
<binding name="updateObject" value="literal:cancelObject" />
<binding name="direct" value="ognl:false" />
</component>
<component id="progress" type="tacos:ProgressBar">
<binding name="reloadseconds" value="1" />
<binding name="worker" value="ognl:progressWorker" />
<binding name="id" value="literal:progress" />
<binding name="onCompleteObject" value="literal:progressComplete" />
</component>
<inject property="ajaxEngineService" object="service:tacos.ajaxdirect"
/>
</page-specification>
/**************************************************************************/
My .java file contains:
/**************************************************************************/
public abstract class ProgressBarImpl extends BasePage implements IDirect{
@InjectObject("spring:profileService")
public abstract ProfileService getProfileService();
@Bean(ValidationDelegate.class)
public abstract IValidationDelegate getDelegate();
/** Logger */
//private static final Log log =
LogFactory.getLog(ProgressCounter.class);
/** Injected ajax engine */
public abstract AjaxDirectService getAjaxEngineService();
/** Worker doing import */
public abstract ProgressWorkThread getProgressWorker();
/** sets worker doing import */
public abstract void setProgressWorker(ProgressWorkThread worker);
/** Set time - in milliseconds - that worker started */
public abstract void setStartTime(long time);
/** Gets start time */
public abstract long getStartTime();
/**
*
* @return True if currently importing a casebase file.
*/
public boolean isImporting()
{
return getProgressWorker() != null &&
!getProgressWorker().isComplete();
}
/**
* Calculates amount of time left, in minutes, for task.
* @return
*/
public String getEstimatedTimeLeft()
{
if (getProgressWorker() == null)
return "0 min";
//Get values so they don't change on us
double currentProgress = getProgressWorker().getCurrentProgress();
double totalProgress = getProgressWorker().getTotalProgress();
double avgDuration =
(System.currentTimeMillis() - getStartTime()) / currentProgress;
double remainingDuration =
(totalProgress - getProgressWorker().getCurrentProgress()) *
avgDuration;
long durationFormat = Math.round(remainingDuration);
return String.valueOf(durationFormat);
//DurationFormatUtils.formatDurationHMS(Math.round(remainingDuration));
}
/**
* Generates a link to refresh with.
*/
public String getRefreshLink()
{
return getAjaxEngineService().getLink(getPage().getRequestCycle(),
new AjaxDirectServiceParameter(this, new Object[0], new String[] {
"linkPart" },new String[0], false)).getAbsoluteURL();
}
/**
* [EMAIL PROTECTED]
*/
public void trigger(IRequestCycle cycle)
{
}
/**
* Starts the progress task.
* @param cycle
* @throws Exception
*/
public void startTask(IRequestCycle cycle)
throws Exception
{
if (isImporting())
return;
//log.debug("startTask");
setProgressWorker(null);
//Start task
ProgressWorkThread worker = new ProgressWorkThread();
setProgressWorker(worker);
worker.start();
setStartTime(System.currentTimeMillis());
}
}
/**************************************************************************/
Please let me know, where am I going wrong.... I got struck for last 2 days
here...
Need help badly,
Well thanks in Advance,
Regards,
Anjali
-----Original Message-----
From: Jesse Kuhnert [mailto:[EMAIL PROTECTED]
Sent: Monday, September 19, 2005 5:22 PM
To: Tapestry users
Subject: Re: Need help in How to show Progress bar through tapestry4.0v
Can you paste the complete page specification you are using to embed the
progressbar? It looks somehow mis-configured to me. Or, you could possibly
be using the wrong version of tapestry. The current progressbar requires
tapestry4 at a minnimum.
jesse
On 9/19/05, Anjali Abraham <[EMAIL PROTECTED]> wrote:
>
> Hi,
> I have tried the same example for displaying the progress bar
> through Tapestry4.0 which is given in the link below...
> http://tacos.sourceforge.net/components/ProgressBar.html
> <http://tacos.sourceforge.net/components/ProgressBar.html>
>
> I am getting this error:
> org.apache.hivemind.ApplicationRuntimeException
> org.apache.tapestry.engine.IEngineService.getLink
> (Lorg/apache/tapestry/IRequ
> estCycle;ZLjava/lang/Object;)Lorg/apache/tapestry/engine/ILink;
> component: [EMAIL PROTECTED]
> location: context:/WEB-INF/progressbar.page, line 6, column 63
> 1 <?xml version="1.0"?>
> 2 <!DOCTYPE page-specification PUBLIC
> 3 "-//Apache Software Foundation//Tapestry Specification 4.0//EN"
> 4 "http://jakarta.apache.org/tapestry/dtd/Tapestry_4_0.dtd">
> 5
> 6 <page-specification class="com.spogger.pages.ProgressBarImpl">
> 7
> 8 <property name="progressWorker" persist="session" />
> 9 <property name="startTime" persist="session" />
> 10
> 11 <component id="progressLink" type="tacos:AjaxDirectLink">
>
>
> java.lang.NoSuchMethodError
> org.apache.tapestry.engine.IEngineService.getLink
> (Lorg/apache/tapestry/IRequ
> estCycle;ZLjava/lang/Object;)Lorg/apache/tapestry/engine/ILink;
> Stack Trace:
> net.sf.tacos.ajax.components.AjaxDirectLink.getLink(AjaxDirectLink.java
> :72)
>
> Can Anybody help me out, what else I need to do to display a progress bar
> on
> my page...
>
> Please respond,
> Thanks In advance,
>
>
> Regards,
> Anjali
>
> -----Original Message-----
> From: Juan E. Maya [mailto:[EMAIL PROTECTED]
> Sent: Friday, September 16, 2005 4:06 PM
> To: Tapestry users
> Subject: Re: Need help in How to show Progress bar through tapestry4.0v
>
> It works for me...I guess you have problems to access the port 8080.
> are u behind a proxy?
> You can check http://tacos.sourceforge.net/
> Download the samples and check the progress bar component.
>
> On 9/16/05, Anjali Abraham <[EMAIL PROTECTED]> wrote:
> > Couldn't open that link.....???
> >
> > Regards,
> > Anjali
> >
> > -----Original Message-----
> > From: Juan E. Maya [mailto:[EMAIL PROTECTED]
> > Sent: Friday, September 16, 2005 3:25 PM
> > To: Tapestry users
> > Subject: Re: Need help in How to show Progress bar through tapestry4.0v
> >
> > You should check out the progress bar from tacos:
> > http://tacos.mine.nu:8080/tacos-demo4/app?page=ProgressBar&service=page
> >
> > On 9/16/05, Anjali Abraham <[EMAIL PROTECTED]> wrote:
> > > Hi All,
> > > I need help on how to show Progress bar using tapestry4.0v.
> > > What codes need to be added in my .html, .page and .java files.
> > >
> > > Thanks in Advance,
> > >
> > > Regards,
> > > Anjali
> > >
> > >
> > >
> >
> > ---------------------------------------------------------------------
> > 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]
> >
> >
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>