Re: Ajax Panels Direction

2009-12-06 Thread bassglider
Hi Steve,

First off I'd like to thank you, you helped me get really close to the
issue, however the panel doesn't seem to be replaced.  A new panel is
created above the old one :\  Here is what I came up with


final Panel image = new AjaxLazyLoadPanel(image) {
  /**
   * Makes object serializable.
   */
  private static final long serialVersionUID = 1L;

  @Override
  public Component getLazyLoadComponent(String id) {
return (new ChartPanel(id));
  }
};

add(image);

AjaxFormValidatingBehavior.addToAllFormComponents(form,
onchange, Duration.ONE_SECOND);

form.add(new AjaxButton(ajax-button, form) {

  private static final long serialVersionUID = 1L;

  @Override
  protected void onSubmit(AjaxRequestTarget target, Form? form) {
// repaint the feedback panel so that it is hidden
target.addComponent(feedback);
System.out.println(Ajax Submitted!);
Component newImagePanel = new AjaxLazyLoadPanel(image) {
  private static final long serialVersionUID = 1L;

  @Override
  public Component getLazyLoadComponent(String id) {
return (new ChartPanel(id));
  }
};
newImagePanel.setOutputMarkupId(true);
image.replaceWith(newImagePanel);
target.addComponent(newImagePanel);

  }


On Sun, Dec 6, 2009 at 12:54 PM, Steve Swinsburg
steve.swinsb...@gmail.com wrote:
 Hi,

 Yes you can do the processing for the form in the onSubmit of the ajax submit 
 button, then just replace the current panel with the new one.

  - outside your onSubmit hold a reference to your current panel:
 final Component thisPanel = this;

  - inside your onSubmit after processing the data:

        Component newPanel = new SomeOtherPanel(id, someParam);
        newPanel.setOutputMarkupId(true);
        thisPanel.replaceWith(newPanel);
        target.addComponent(newPanel);

 Thats what I do.

 cheers,
 Steve

 On 06/12/2009, at 2:27 PM, bassglider wrote:

 Ok, I think I'm getting somewhere after a few hours, I have two
 textfields, when the user hits the ajax submit button, the panel
 should be replaced with a new panel.  I'm thinking that
 onSubmit(AjaxRequestTarget target, Form? form)
 should be able to take the input of the textfields and call the method
 to update the image panel with a new image panel based on the new
 values in the textfields.

 Any ideas?



 FormString form = new FormString(Chart);

    TextFieldDate dateBegin =
        new TextFieldDate(beginningDate, new
 PropertyModelDate(session, beginningDate));
    dateBegin.add(new DatePicker());
    dateBegin.setRequired(true);
    form.add(dateBegin);

    TextFieldDate endingDate =
        new TextFieldDate(endingDate, new
 PropertyModelDate(session, endingDate));
    endingDate.add(new DatePicker());
    endingDate.setRequired(true);
    form.add(endingDate);

    CreateChart(this);
    AjaxFormValidatingBehavior.addToAllFormComponents(form,
 onchange, Duration.ONE_SECOND);

    form.add(new AjaxButton(ajax-button, form) {

      private static final long serialVersionUID = 1L;

     �...@override
      protected void onSubmit(AjaxRequestTarget target, Form? form) {
        // repaint the feedback panel so that it is hidden
        target.addComponent(feedback);
        System.out.println(Ajax Submitted! + feedback.toString());

      }

 


 private Panel CreateChart(Panel pan) {
    pan.add(new AjaxLazyLoadPanel(image) {
      /**
       * Makes object serializable.
       */
      private static final long serialVersionUID = 1L;

     �...@override
      public Component getLazyLoadComponent(String id) {
        return (new ChartPanel(id));
      }
    });
    return pan;
  }



 On Sat, Dec 5, 2009 at 2:51 PM, bassglider bassgli...@gmail.com wrote:
 Hi Everyone,

 I was wondering if someone could point to the right direction
 (examples, classes) for the following scenario:

 I have a few text fields inside a panel, when one of the text fields
 is changed, I'd like to call a method with updates a panel within the
 current panel.

 Currently I have the two text fields in the panel with the other panel
 that displays the image, I just need to figure out how to call that
 method when these forms are changed and I'm sure I can figure out the
 rest from there.

 Any direction is helpful


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




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



Re: Remote Image Generation Null Pointer

2009-12-05 Thread bassglider
WebComponent was a perfect fit, thank you.

A somewhat related problem exists however.

I load this Image using AjaxLazyLoadPanel like so:

add(new AjaxLazyLoadPanel(image) {
  /**
   * Makes object serializable.
   */
  private static final long serialVersionUID = 1L;

  @Override
  public Component getLazyLoadComponent(String id) {
return (new ChartPanel(id));
  }
});

class ChartPanel extends Panel {

  private static final long serialVersionUID = 1L;

  /**
   * Constructor for ChartPanel.
   *
   * @param - The id to use
   *
   */
  public ChartPanel(String id) {
super(id);
addChart(this);
  }

which calls my the addChart() that works now since I switched to WebComponent.

The lazy loading image (the spinning waiter) continues to spin after
the image is loaded.

Am I missing something obvious here to make it stop?

Thanks



On Sat, Dec 5, 2009 at 3:33 AM, bgooren b...@iswd.nl wrote:

 If you want to generate the URL yourself and want to keep using the code you
 have already written, use a WebComponent instead of an Image:

 WebComponent dynamicImage = new WebComponent(image);
 dynamicImage.add(new AttributeModifier(src, true, new
 AbstractReadOnlyModel() {} ) );

 Otherwise, as suggested by the previous reply, look into
 DynamicImageResource.


 bassglider wrote:

 Hi Everyone,

 I am attempting to load an image that takes some time.  I can load a
 remote image using the URL, but when it takes time to gather the data
 and then get the url, I get this:

 [java] 11174 [btpool0-1] ERROR org.apache.wicket.RequestCycle -
 Exception in rendering component: [Component id = image]
     [java] org.apache.wicket.WicketRuntimeException: Exception in
 rendering component: [Component id = image]
     [java]     at
 org.apache.wicket.Component.renderComponent(Component.java:2656)
     [java]     at
 org.apache.wicket.markup.html.WebComponent.onRender(WebComponent.java:62)
     [java]     at org.apache.wicket.Component.render(Component.java:2448)


 I read that it could be from the thread expiring or the page trying to
 modify itself after it is rendered(?)

 So I tried adding this to my Application

 �...@override
  protected void init() {
    super.init();

    //remove thread monitoring from resource watcher
    this.getResourceSettings().setResourcePollFrequency(null);
  }


 It had no effect on the issue.  Any suggestions or remedies would be
 greatly appreciated.

 Here is the code I am using:


  Image dynamicImage = new Image(image);
    dynamicImage.add(new AttributeModifier(src, true, new
 AbstractReadOnlyModel() {

      private static final long serialVersionUID = 1L;

      /**
       * {...@inheritdoc}
       */
     �...@override
      public final Object getObject() {
        GoogleChart chart = new GoogleChart(http://xx:/x/;);
        String url = chart.getChart (value, 2009-11-15, 2009-11-15,
            , july, true, false );
        System.out.println(GETCHART URL:  + url);
        //String url = http://xx/PleaseStandBy.jpg;;
        return url;
      }
    }));
    dynamicImage.setOutputMarkupId(true);
    add(dynamicImage);

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




 --
 View this message in context: 
 http://old.nabble.com/Remote-Image-Generation-Null-Pointer-tp26653612p26655670.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



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



Ajax Panels Direction

2009-12-05 Thread bassglider
Hi Everyone,

I was wondering if someone could point to the right direction
(examples, classes) for the following scenario:

I have a few text fields inside a panel, when one of the text fields
is changed, I'd like to call a method with updates a panel within the
current panel.

Currently I have the two text fields in the panel with the other panel
that displays the image, I just need to figure out how to call that
method when these forms are changed and I'm sure I can figure out the
rest from there.

Any direction is helpful

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



Re: Ajax Panels Direction

2009-12-05 Thread bassglider
Ok, I think I'm getting somewhere after a few hours, I have two
textfields, when the user hits the ajax submit button, the panel
should be replaced with a new panel.  I'm thinking that
onSubmit(AjaxRequestTarget target, Form? form)
should be able to take the input of the textfields and call the method
to update the image panel with a new image panel based on the new
values in the textfields.

Any ideas?



FormString form = new FormString(Chart);

TextFieldDate dateBegin =
new TextFieldDate(beginningDate, new
PropertyModelDate(session, beginningDate));
dateBegin.add(new DatePicker());
dateBegin.setRequired(true);
form.add(dateBegin);

TextFieldDate endingDate =
new TextFieldDate(endingDate, new
PropertyModelDate(session, endingDate));
endingDate.add(new DatePicker());
endingDate.setRequired(true);
form.add(endingDate);

CreateChart(this);
AjaxFormValidatingBehavior.addToAllFormComponents(form,
onchange, Duration.ONE_SECOND);

form.add(new AjaxButton(ajax-button, form) {

  private static final long serialVersionUID = 1L;

  @Override
  protected void onSubmit(AjaxRequestTarget target, Form? form) {
// repaint the feedback panel so that it is hidden
target.addComponent(feedback);
System.out.println(Ajax Submitted! + feedback.toString());

  }




private Panel CreateChart(Panel pan) {
pan.add(new AjaxLazyLoadPanel(image) {
  /**
   * Makes object serializable.
   */
  private static final long serialVersionUID = 1L;

  @Override
  public Component getLazyLoadComponent(String id) {
return (new ChartPanel(id));
  }
});
return pan;
  }



On Sat, Dec 5, 2009 at 2:51 PM, bassglider bassgli...@gmail.com wrote:
 Hi Everyone,

 I was wondering if someone could point to the right direction
 (examples, classes) for the following scenario:

 I have a few text fields inside a panel, when one of the text fields
 is changed, I'd like to call a method with updates a panel within the
 current panel.

 Currently I have the two text fields in the panel with the other panel
 that displays the image, I just need to figure out how to call that
 method when these forms are changed and I'm sure I can figure out the
 rest from there.

 Any direction is helpful


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



Remote Image Generation Null Pointer

2009-12-04 Thread bassglider
Hi Everyone,

I am attempting to load an image that takes some time.  I can load a
remote image using the URL, but when it takes time to gather the data
and then get the url, I get this:

[java] 11174 [btpool0-1] ERROR org.apache.wicket.RequestCycle -
Exception in rendering component: [Component id = image]
[java] org.apache.wicket.WicketRuntimeException: Exception in
rendering component: [Component id = image]
[java] at
org.apache.wicket.Component.renderComponent(Component.java:2656)
[java] at
org.apache.wicket.markup.html.WebComponent.onRender(WebComponent.java:62)
[java] at org.apache.wicket.Component.render(Component.java:2448)


I read that it could be from the thread expiring or the page trying to
modify itself after it is rendered(?)

So I tried adding this to my Application

 @Override
 protected void init() {
   super.init();

   //remove thread monitoring from resource watcher
   this.getResourceSettings().setResourcePollFrequency(null);
 }


It had no effect on the issue.  Any suggestions or remedies would be
greatly appreciated.

Here is the code I am using:


 Image dynamicImage = new Image(image);
   dynamicImage.add(new AttributeModifier(src, true, new
AbstractReadOnlyModelObject() {

 private static final long serialVersionUID = 1L;

 /**
  * {...@inheritdoc}
  */
 @Override
 public final Object getObject() {
   GoogleChart chart = new GoogleChart(http://xx:/x/;);
   String url = chart.getChart (value, 2009-11-15, 2009-11-15,
   , july, true, false );
   System.out.println(GETCHART URL:  + url);
   //String url = http://xx/PleaseStandBy.jpg;;
   return url;
 }
   }));
   dynamicImage.setOutputMarkupId(true);
   add(dynamicImage);

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