Re: [Google Wave APIs] Re: Java API: How to edit a blip that a user submits?

2009-12-14 Thread pamela (Google Employee)
Links are stored as annotations. You should search through the annotations
for keys that are either "link/manual" or "link/auto". More information on
annotations is here:
http://code.google.com/apis/wave/extensions/robots/index.html#Annotations

- pamela

On Tue, Dec 15, 2009 at 9:15 AM, Dean C  wrote:

> It seems I had to delete the bot from the wave, and re-add it to the
> wave to trigger it using the new version. It now appears to be working
> correctly. But one follow up question: I want to extract any links the
> user posts on a blip. Should I be looking for link syntax in
> the blip?
>
> On Dec 14, 1:38 am, MiloDC  wrote:
> > Blip blip = e.getBlip();
> > TextView textView = blip.getDocument();
> > textView.delete();
> > textView.append("test");
> >
> > On Dec 12, 6:52 am, Dean C  wrote:
> >
> >
> >
> > > I am trying to get my robot to take a users blip and edit the text.
> > > For testing purposes I'm simply trying to replace all the text that
> > > they typed with my own. I am using the following code:
> >
> > >   public void processEvents(RobotMessageBundle bundle)
> > >   {
> > > // get the wavelet
> > > Wavelet wavelet = bundle.getWavelet();
> >
> > > // otherwise iterate through our bundle of events
> > > for (Event e: bundle.getEvents())
> > > {
> > >   if (e.getType() == EventType.BLIP_SUBMITTED)
> > >   {
> > >   // get the creator of the blip
> > >   String blipSubmitter = e.getBlip().getCreator();
> >
> > >   // get the blip
> > >   Blip blip = e.getBlip();
> > >   TextView textView = blip.getDocument();
> >
> > >   // get what the user entered
> > >   String userInput = textView.getText();
> >
> > >   textView.replace("test");
> >
> > >   }
> > > }
> > >   }
> >
> > > Unfortunately, it's simply not replacing the users input with my test
> > > string. Any ideas why? I am sure it is something obvious and simple :)
>
> --
>
> You received this message because you are subscribed to the Google Groups
> "Google Wave API" group.
> To post to this group, send email to google-wave-...@googlegroups.com.
> To unsubscribe from this group, send email to
> google-wave-api+unsubscr...@googlegroups.com
> .
> For more options, visit this group at
> http://groups.google.com/group/google-wave-api?hl=en.
>
>
>

--

You received this message because you are subscribed to the Google Groups 
"Google Wave API" group.
To post to this group, send email to google-wave-...@googlegroups.com.
To unsubscribe from this group, send email to 
google-wave-api+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/google-wave-api?hl=en.




[Google Wave APIs] Re: Java API: How to edit a blip that a user submits?

2009-12-14 Thread Dean C
It seems I had to delete the bot from the wave, and re-add it to the
wave to trigger it using the new version. It now appears to be working
correctly. But one follow up question: I want to extract any links the
user posts on a blip. Should I be looking for link syntax in
the blip?

On Dec 14, 1:38 am, MiloDC  wrote:
> Blip blip = e.getBlip();
> TextView textView = blip.getDocument();
> textView.delete();
> textView.append("test");
>
> On Dec 12, 6:52 am, Dean C  wrote:
>
>
>
> > I am trying to get my robot to take a users blip and edit the text.
> > For testing purposes I'm simply trying to replace all the text that
> > they typed with my own. I am using the following code:
>
> >   public void processEvents(RobotMessageBundle bundle)
> >   {
> >         // get the wavelet
> >     Wavelet wavelet = bundle.getWavelet();
>
> >     // otherwise iterate through our bundle of events
> >     for (Event e: bundle.getEvents())
> >     {
> >       if (e.getType() == EventType.BLIP_SUBMITTED)
> >       {
> >           // get the creator of the blip
> >           String blipSubmitter = e.getBlip().getCreator();
>
> >           // get the blip
> >           Blip blip = e.getBlip();
> >           TextView textView = blip.getDocument();
>
> >           // get what the user entered
> >           String userInput = textView.getText();
>
> >           textView.replace("test");
>
> >       }
> >     }
> >   }
>
> > Unfortunately, it's simply not replacing the users input with my test
> > string. Any ideas why? I am sure it is something obvious and simple :)

--

You received this message because you are subscribed to the Google Groups 
"Google Wave API" group.
To post to this group, send email to google-wave-...@googlegroups.com.
To unsubscribe from this group, send email to 
google-wave-api+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/google-wave-api?hl=en.




[Google Wave APIs] Re: Java API: How to edit a blip that a user submits?

2009-12-13 Thread MiloDC
Blip blip = e.getBlip();
TextView textView = blip.getDocument();
textView.delete();
textView.append("test");



On Dec 12, 6:52 am, Dean C  wrote:
> I am trying to get my robot to take a users blip and edit the text.
> For testing purposes I'm simply trying to replace all the text that
> they typed with my own. I am using the following code:
>
>   public void processEvents(RobotMessageBundle bundle)
>   {
>         // get the wavelet
>     Wavelet wavelet = bundle.getWavelet();
>
>     // otherwise iterate through our bundle of events
>     for (Event e: bundle.getEvents())
>     {
>       if (e.getType() == EventType.BLIP_SUBMITTED)
>       {
>           // get the creator of the blip
>           String blipSubmitter = e.getBlip().getCreator();
>
>           // get the blip
>           Blip blip = e.getBlip();
>           TextView textView = blip.getDocument();
>
>           // get what the user entered
>           String userInput = textView.getText();
>
>           textView.replace("test");
>
>       }
>     }
>   }
>
> Unfortunately, it's simply not replacing the users input with my test
> string. Any ideas why? I am sure it is something obvious and simple :)

--

You received this message because you are subscribed to the Google Groups 
"Google Wave API" group.
To post to this group, send email to google-wave-...@googlegroups.com.
To unsubscribe from this group, send email to 
google-wave-api+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/google-wave-api?hl=en.




[Google Wave APIs] Re: Java API: How to edit a blip that a user submits?

2009-12-13 Thread DJT
The code seems right to me. Did you see the comments in the API?

This is equivalent to the two operations, deleteText() and appendText
() and affects existing annotations and entities accordingly.
http://wave-robot-java-client.googlecode.com/svn/trunk/doc/com/google/wave/api/TextView.html#replace(java.lang.String)

Have a try^^


On 12 Dez., 15:52, Dean C  wrote:
> I am trying to get my robot to take a users blip and edit the text.
> For testing purposes I'm simply trying to replace all the text that
> they typed with my own. I am using the following code:
>
>   public void processEvents(RobotMessageBundle bundle)
>   {
>         // get the wavelet
>     Wavelet wavelet = bundle.getWavelet();
>
>     // otherwise iterate through our bundle of events
>     for (Event e: bundle.getEvents())
>     {
>       if (e.getType() == EventType.BLIP_SUBMITTED)
>       {
>           // get the creator of the blip
>           String blipSubmitter = e.getBlip().getCreator();
>
>           // get the blip
>           Blip blip = e.getBlip();
>           TextView textView = blip.getDocument();
>
>           // get what the user entered
>           String userInput = textView.getText();
>
>           textView.replace("test");
>
>       }
>     }
>   }
>
> Unfortunately, it's simply not replacing the users input with my test
> string. Any ideas why? I am sure it is something obvious and simple :)

--

You received this message because you are subscribed to the Google Groups 
"Google Wave API" group.
To post to this group, send email to google-wave-...@googlegroups.com.
To unsubscribe from this group, send email to 
google-wave-api+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/google-wave-api?hl=en.