Hi, Ed
i just read from the forum you sent.... if you don't mind, can you give more
example ? because i based on the in instruction , i still cant get it. An no
idea for this part
getBodyContainer().addOnLoadModifier(
new ClickOnceOnLoadModel( modalWindowOpeningLink ), null
);
As my code structure this like this way
public class LastThirtyDaysLineChart extends CommonPage{
// main contructor. Initial the page to show what
public LastThirtyDaysLineChart () {
// 1. display the feedback panel
add(new FeedbackPanel("feedback"));
// 2. display the component defined in form
add(new LastThirtyDaysLineChartForm("LastThirtyDaysLineChartForm"));
}
// the form declare the component in order display in the web browser
private class LastThirtyDaysLineChartFormextends Form{
// 3. so, is the main source to get the data from Database in order
to generate the chart
generate Time series chart...
}
}
So, in which part i need to generate the ModalWindow with no onClick event
...Mean once this page is load, the modal window will auto prompt on
screen...
Can you give some instruction to me ? thanks in advance
Ed_ wrote:
>
>
> Thanks Ryan,
>
> First pass this has worked well for me. Appreciate your detailed
> instructions. Maybe these can be added to the open issue history itself
> for other folks till the issue gets closed.
>
> I assume you have to be developer to make changes to the change history.
>
> -ed
>
>> From: [EMAIL PROTECTED]
>> Subject: Re: modal window question - opening a modal window on page load
>> Date: Sun, 9 Sep 2007 22:24:03 -0700
>> To: [email protected]
>>
>> There is an open issue about this: http://issues.apache.org/jira/
>> browse/WICKET-12
>> Read the discussion for some background and possible solutions.
>>
>> I needed to do the same thing on a couple of pages. First, I tried
>> using getWindowOpenJavascript() on the modal window (called via
>> reflection as it's a private method) to get the needed JS, but I
>> think I ran into a few issues which I've now forgotten (private
>> 'shown' variable wasn't set?).
>>
>> What I ended up doing was to use JavaScript to call the onclick()
>> method of a link that opens the modal window from my page's onload
>> function. Since the modal window is a JavaScript construct anyway I
>> don't think using JS for the "auto-open" behavior is weird.
>>
>>
>> The following model ensures that a component is "clicked" only one
>> time, when the page is initially loaded (probably a common use case).
>> If you want to open the modal window on every page load, just check
>> out the JavaScript and the basic concept. This is written for Wicket
>> 1.2 but a similar approach should work for 1.3.
>>
>> public class ClickOnceOnLoadModel extends AbstractReadOnlyModel {
>> private final Component component;
>> private boolean clicked = false;
>>
>> public ClickOnceOnLoadModel(Component component) {
>> this.component = component;
>> }
>>
>> @Override
>> public Object getObject(Component cmp) {
>> if ( !this.clicked ) {
>> this.clicked = true;
>> return getClickJs();
>> }
>> return null;
>> }
>>
>> private String getClickJs() {
>> StringBuilder sb = new StringBuilder( 64 );
>> sb.append( "var e=document.getElementById('" );
>> sb.append( this.component.getMarkupId() );
>> sb.append( "');e.onclick();" );
>> return sb.toString();
>> }
>> }
>>
>>
>> You would use it like this:
>>
>> // Page constructor
>> public MyPage() {
>> getBodyContainer().addOnLoadModifier(
>> new ClickOnceOnLoadModel( modalWindowOpeningLink ), null );
>> }
>>
>>
>> This of course requires a link on your page that opens the same modal
>> window you want to open automatically. If you really don't want such
>> a link, you could always hide it with CSS.
>>
>> If there are more elegant solutions (and I'm sure there are), you'll
>> probably hear about them soon...
>>
>> -Ryan
>>
>> On Sep 9, 2007, at 8:04 PM, Ed _ wrote:
>>
>> >
>> > I want to bring up a modal window when I load a page, ie without
>> > clicking a link. I want to use it to prompt the user to enter some
>> > data on the home page before he can proceed. So somehow I have to
>> > enable the show function, how do I do that.
>> >
>> > I tried to do something as follows -
>> >
>> > FormPanel form = new FormPanel(modal.getContentId(),
>> > StoreBasePath, strId, title);
>> > form.setOutputMarkupId(true);
>> > modal.setContent(form);
>> > modal.setTitle("This is modal window with panel
>> > content.");
>> > modal.setCookieName("modalform");
>> > AjaxRequestTarget target = new AjaxRequestTarget();
>> > modal.show(target);
>> >
>> > java.lang.IllegalStateException: No Page found for component
>> > [MarkupContainer [Component id = ModalWindow, page = <No Page>,
>> > path = FormPanel:ModalWindow.ModalWindow]]
>> > at wicket.Component.getPage(Component.java:1037)
>> > at wicket.RequestCycle.urlFor(RequestCycle.java:655)
>> > at wicket.Component.urlFor(Component.java:2307)
>> > at wicket.behavior.AbstractAjaxBehavior.getCallbackUrl
>> > (AbstractAjaxBehavior.java:143)
>> > at wicket.ajax.AbstractDefaultAjaxBehavior.getCallbackScript
>> > (AbstractDefaultAjaxBehavior.java:131)
>> >
>> >
>> > is there a way to do this.
>> >
>> > thanks
>> >
>> > _________________________________________________________________
>> > Gear up for Halo® 3 with free downloads and an exclusive offer.
>> > It’s our way of saying thanks for using Windows Live™.
>> > http://gethalo3gear.com?ocid=SeptemberWLHalo3_WLHMTxt_2
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: [EMAIL PROTECTED]
>> For additional commands, e-mail: [EMAIL PROTECTED]
>>
>
> _________________________________________________________________
> Gear up for Halo® 3 with free downloads and an exclusive offer. It’s our
> way of saying thanks for using Windows Live™.
> http://gethalo3gear.com?ocid=SeptemberWLHalo3_WLHMTxt_2
>
--
View this message in context:
http://www.nabble.com/modal-window-question---opening-a-modal-window-on-page-load-tp12586008p15151127.html
Sent from the Wicket - User mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]