DWR 3.0.M1: setting img value to bufferedimage

View: New views
3 Messages — Rating Filter:   Alert me  

DWR 3.0.M1: setting img value to bufferedimage

by Daniel Gresh :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi,

I recently switched to dwr3.0.m1 to use the features that have a
built-in converted for BufferedImage, and I've been going by some of the
examples in the .war file to return a BufferedImage and display it on
the page. However, when I run the function that should display the image
on the page, nothing seems to happen, although I have followed the
example in the .war file almost exactly.

Here is the java method signature:

public BufferedImage uploadImage(String cameraName, int cameraFrame)

Here is the javascript source:

            function captureVigraImage() {
                var divElement = document.getElementById('imageCapture1');
                var cameraName = dwr.util.getValue('cameraName2');
                var frameNumber = dwr.util.getValue('channelNumber');
                VigraMain.uploadImage(cameraName, frameNumber,
vigraImageCaptured());
                divElement.innerHTML = "image captured";
            }

            function vigraImageCaptured(data) {
                var divElement = document.getElementById('toReplace1');
                divElement.innerHTML = "callback function";
                dwr.util.setValue('imageCapture2', data);
            }

And finally, here is the relevant html source:

        <h2>Image capture form</h2>
        <form>
            <table>
                <tr>
                    <td>
                        Camera name:
                    </td>
                    <td>
                        <input id="cameraName2" type="text" />
                    </td>
                </tr>
                <tr>
                    <td>
                        Channel number:
                    </td>
                    <td>
                        <input id="channelNumber" type="text" />
                    </td>
                </tr>
            </table>
            <br />
            <input type="button" onClick="captureVigraImage()"
value="Capture" />
        </form>
        <img id="imageCapture2" src="javascript:void(0);"/>

I know that the callback from the Java method is being called, as I see
"callback function" displayed on the page from the innerHTML call. Is
there something I am missing from the examples in the .war file? Is
there anything else I need to do? I know the image isn't an empty image
or a 0x0 image or anything like that. I must be missing something, but I
cannot figure it out.

If anyone has any suggestions I will appreciate them greatly.

Thanks,
Dan


--
Dan Gresh
Lab Technician -- EP Controls
Laboratory for Laser Energetics
(585) 275-4819


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@...
For additional commands, e-mail: users-help@...


Re: DWR 3.0.M1: setting img value to bufferedimage

by XMaNIaC :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

I can see a little error in the call. Try:

VigraMain.uploadImage(cameraName, frameNumber, vigraImageCaptured);

On Wed, Apr 23, 2008 at 6:31 PM, Daniel Gresh <dgresh@...> wrote:
Hi,

I recently switched to dwr3.0.m1 to use the features that have a built-in converted for BufferedImage, and I've been going by some of the examples in the .war file to return a BufferedImage and display it on the page. However, when I run the function that should display the image on the page, nothing seems to happen, although I have followed the example in the .war file almost exactly.

Here is the java method signature:

public BufferedImage uploadImage(String cameraName, int cameraFrame)

Here is the javascript source:

          function captureVigraImage() {
              var divElement = document.getElementById('imageCapture1');
              var cameraName = dwr.util.getValue('cameraName2');
              var frameNumber = dwr.util.getValue('channelNumber');
              VigraMain.uploadImage(cameraName, frameNumber, vigraImageCaptured());
              divElement.innerHTML = "image captured";
          }

          function vigraImageCaptured(data) {
              var divElement = document.getElementById('toReplace1');
              divElement.innerHTML = "callback function";
              dwr.util.setValue('imageCapture2', data);
          }

And finally, here is the relevant html source:

      <h2>Image capture form</h2>
      <form>
          <table>
              <tr>
                  <td>
                      Camera name:
                  </td>
                  <td>
                      <input id="cameraName2" type="text" />
                  </td>
              </tr>
              <tr>
                  <td>
                      Channel number:
                  </td>
                  <td>
                      <input id="channelNumber" type="text" />
                  </td>
              </tr>
          </table>
          <br />
          <input type="button" onClick="captureVigraImage()" value="Capture" />
      </form>
      <img id="imageCapture2" src="javascript:void(0);"/>

I know that the callback from the Java method is being called, as I see "callback function" displayed on the page from the innerHTML call. Is there something I am missing from the examples in the .war file? Is there anything else I need to do? I know the image isn't an empty image or a 0x0 image or anything like that. I must be missing something, but I cannot figure it out.

If anyone has any suggestions I will appreciate them greatly.

Thanks,
Dan


--
Dan Gresh
Lab Technician -- EP Controls
Laboratory for Laser Energetics
(585) 275-4819


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@...
For additional commands, e-mail: users-help@...



Re: DWR 3.0.M1: setting img value to bufferedimage

by Daniel Gresh :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi,

You were correct about the error in the call. It seems to work fine now.

Thanks a lot!
Dan

Jose Noheda wrote:

> I can see a little error in the call. Try:
>
> VigraMain.uploadImage(cameraName, frameNumber, vigraImageCaptured);
>
> On Wed, Apr 23, 2008 at 6:31 PM, Daniel Gresh
> <dgresh@... <mailto:dgresh@...>> wrote:
>
>     Hi,
>
>     I recently switched to dwr3.0.m1 to use the features that have a
>     built-in converted for BufferedImage, and I've been going by some
>     of the examples in the .war file to return a BufferedImage and
>     display it on the page. However, when I run the function that
>     should display the image on the page, nothing seems to happen,
>     although I have followed the example in the .war file almost exactly.
>
>     Here is the java method signature:
>
>     public BufferedImage uploadImage(String cameraName, int cameraFrame)
>
>     Here is the javascript source:
>
>               function captureVigraImage() {
>                   var divElement =
>     document.getElementById('imageCapture1');
>                   var cameraName = dwr.util.getValue('cameraName2');
>                   var frameNumber = dwr.util.getValue('channelNumber');
>                   VigraMain.uploadImage(cameraName, frameNumber,
>     vigraImageCaptured());
>                   divElement.innerHTML = "image captured";
>               }
>
>               function vigraImageCaptured(data) {
>                   var divElement = document.getElementById('toReplace1');
>                   divElement.innerHTML = "callback function";
>                   dwr.util.setValue('imageCapture2', data);
>               }
>
>     And finally, here is the relevant html source:
>
>           <h2>Image capture form</h2>
>           <form>
>               <table>
>                   <tr>
>                       <td>
>                           Camera name:
>                       </td>
>                       <td>
>                           <input id="cameraName2" type="text" />
>                       </td>
>                   </tr>
>                   <tr>
>                       <td>
>                           Channel number:
>                       </td>
>                       <td>
>                           <input id="channelNumber" type="text" />
>                       </td>
>                   </tr>
>               </table>
>               <br />
>               <input type="button" onClick="captureVigraImage()"
>     value="Capture" />
>           </form>
>           <img id="imageCapture2" src="javascript:void(0);"/>
>
>     I know that the callback from the Java method is being called, as
>     I see "callback function" displayed on the page from the innerHTML
>     call. Is there something I am missing from the examples in the
>     .war file? Is there anything else I need to do? I know the image
>     isn't an empty image or a 0x0 image or anything like that. I must
>     be missing something, but I cannot figure it out.
>
>     If anyone has any suggestions I will appreciate them greatly.
>
>     Thanks,
>     Dan
>
>
>     --
>     Dan Gresh
>     Lab Technician -- EP Controls
>     Laboratory for Laser Energetics
>     (585) 275-4819
>
>
>     ---------------------------------------------------------------------
>     To unsubscribe, e-mail: users-unsubscribe@...
>     <mailto:users-unsubscribe@...>
>     For additional commands, e-mail: users-help@...
>     <mailto:users-help@...>
>
>

--
Dan Gresh
Lab Technician -- EP Controls
Laboratory for Laser Energetics
(585) 275-4819


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@...
For additional commands, e-mail: users-help@...