Re: Restarting AjaxLazyLoadingPanel

2009-11-12 Thread rjohara

We are after the same behavior, as well.  During the initial page load, the
AjaxLazyLoadPanel works great.  However, after hiding/showing the image
(using an AjaxLink), the panel no longer loads.  I tried using the custom
ReloadingAjaxLazyPanel, too, and the results were the same as replacing with
a new panel instance.  Any ideas?  Below is a code snippet:

final Label gbrowseHideShowLabel = new Label(gbrowseHideShowLabel,
new LoadableDetachableModel() {
protected Object load() {
return gbrowseHideShowText;
}
});
gbrowseHideShowLabel.setOutputMarkupId(true);
gbrowseLazyLoaded = getNewGbrowseLazyLoaded();
add(gbrowseLazyLoaded);
AjaxLink gbrowseHideShow = new AjaxLink(gbrowseHideShow) {
public void onClick(AjaxRequestTarget target) {
if (!gbrowseVisible) {
gbrowseVisible = true;
gbrowseHideShowText = Hide image;
user.setImageViewer(true);
} else {
gbrowseVisible = false;
gbrowseHideShowText = Show image;
user.setImageViewer(false);
}
target.addComponent(gbrowseHideShowLabel);
AjaxLazyLoadPanel newPanel = getNewGbrowseLazyLoaded();
newPanel.setOutputMarkupId(true);
getGbrowseLazyLoaded().replaceWith(newPanel);
setGbrowseLazyLoaded(newPanel);
target.addComponent(newPanel);
}
};
gbrowseHideShow.add(gbrowseHideShowLabel);
add(gbrowseHideShow);

Thanks,
Ryan


igor.vaynberg wrote:
 
 you can just replace the entire panel with a new instance.
 
 -igor
 
 On Sat, May 30, 2009 at 3:11 AM, Antony Stubbs antony.stu...@gmail.com
 wrote:
 We use AjaxLazyLoadingPanel, and want to be able to trigger the process
 of
 showing the indicator, and requesting the panels contents with a separate
 Ajax request, after the first complete render has finished. I.e. do the
 whole process over and over, without having to reload the entire page.

 I came up with this, which I was surprised actually worked first try :)
 gotta love Wicket.

 But perhaps there's a better way to do it ? A simpler way? Something I'm
 missing? I tried simply replacing the lazy loading panel with a new
 instance
 of one but that didn't seem to have an effect - I think the magic is in
 the
 adding a new AbstractAjaxBehaviour on each request.


 import org.apache.wicket.Component;
 import org.apache.wicket.ajax.AbstractDefaultAjaxBehavior;
 import org.apache.wicket.ajax.AjaxRequestTarget;
 import org.apache.wicket.extensions.ajax.markup.html.AjaxLazyLoadPanel;
 import org.apache.wicket.markup.html.IHeaderResponse;

 /**
  * An {...@link AjaxLazyLoadPanel} extension which allows it to
  * {...@link #restart(AjaxRequestTarget)} the process of showing the loading
  * indicator, then load it's contents using a separate Ajax request.
  *
  * @author Antony Stubbs
  */
 abstract public class ReloadingAjaxLazyPanel extends AjaxLazyLoadPanel {

    private static final long serialVersionUID = 1L;

    public ReloadingAjaxLazyPanel(String id) {
        super( id );
    }

    /**
     * Causes the {...@link AjaxLazyLoadPanel} to re-display the loading
 indicator,
     * then in a seperate ajax request, get it's contents.
     *
     * @param target
     */
    public void restart(AjaxRequestTarget target) {
        target.addComponent( this );

        // replace panel contents with loading icon
        Component loadingComponent = getLoadingComponent( content );

        this.replace( loadingComponent );

        // add ajax behaviour to install call back
        loadingComponent.add( new AbstractDefaultAjaxBehavior() {

            private static final long serialVersionUID = 1L;

           �...@override
            protected void respond(AjaxRequestTarget target) {
                Component component =
 ReloadingAjaxLazyPanel.this.getLazyLoadComponent( content );
                ReloadingAjaxLazyPanel.this.replace(
 component.setRenderBodyOnly( true ) );
                target.addComponent( ReloadingAjaxLazyPanel.this );
                // setState((byte)2);
            }

           �...@override
            public void renderHead(IHeaderResponse response) {
                super.renderHead( response );
                response.renderOnDomReadyJavascript(
 getCallbackScript().toString() );
            }

        } );
    }

 }

 As you can see, there is duplication from AjaxLazyLoadingPanel - which
 would
 need re-factoring in order to remove. - no problem there.
 But also, because the setState method is private, I can't use that state
 system.

 Regards,
 Antony Stubbs,
 NZ
 http://friendfeed.com/astubbs


 
 -
 To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
 For additional commands, 

Re: Adding wicketstuff-scriptaculous dependency

2009-01-15 Thread rjohara

I am still having troubles adding the wicketstuff-scriptaculous dependency,
even though I had no trouble adding wicketstuff-minis.  After looking at
http://wicketstuff.org/maven/repository/org/wicketstuff/wicketstuff-scriptaculous/1.4-SNAPSHOT/,
I noticed that filenames contain a timestamp.  Could the problem related to
this?  The error I'm receiving from Maven is:

[ERROR] Failed to resolve artifact, possibly due to a repository list that
is not appropriately equipped for this artifact's metadata.

Thanks,
Ryan


rjohara wrote:
 
 you need to have a scriptaculous dependency in your project's pom.xml
 
 Thanks for the response.  I'm having trouble adding the dependency to my
 pom.xml.  Below is my pom.xml dependency definition:
 
 dependency
 groupIdorg.wicketstuff/groupId
 artifactIdwicketstuff-scriptaculous/artifactId
 version1.4-SNAPSHOT/version
 /dependency
 
 Has anyone recently added this dependency successfully?  Any help is
 appreciated.
 
 Thanks,
 Ryan
 

-- 
View this message in context: 
http://www.nabble.com/PrototipBehaviour-problems-tp21424534p21488090.html
Sent from the Wicket - User mailing list archive at Nabble.com.


-
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org



Re: PrototipBehaviour problems

2009-01-14 Thread rjohara

 you need to have a scriptaculous dependency in your project's pom.xml

Thanks for the response.  I'm having trouble adding the dependency to my
pom.xml.  Below is my pom.xml dependency definition:

dependency
groupIdorg.wicketstuff/groupId
artifactIdwicketstuff-scriptaculous/artifactId
version1.4-SNAPSHOT/version
/dependency

Has anyone recently added this dependency successfully?  Any help is
appreciated.

Thanks,
Ryan
-- 
View this message in context: 
http://www.nabble.com/PrototipBehaviour-problems-tp21424534p21463033.html
Sent from the Wicket - User mailing list archive at Nabble.com.


-
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org