Robot selector and action

7 views
Skip to first unread message

Alex

unread,
Jul 16, 2010, 2:40:12 AM7/16/10
to Google Wave API
i have a few question for the selectors and action (java api)

the blip.first(String arg); is the arg a regular expression or just a
normal string? i tried regular expression \[new\], it matches only \
[new\] and not [new].

and once i get the BlipContentRefs, i tried the delete() method and
then add a gadget, but the specified string is still in the blip and
this cause a infinite loop of onDocumentChangedEvent.

how do i prevent the infinite loop? the delete() method dont seem to
work.

and i have tried using
Map<String, String> restrictions = new HashMap<String, String>();
BlipIterator iterator = new BlipIterator.ElementIterator(blip,
ElementType.GADGET, restrictions, -1);
int start = iterator.next().getStart();
as suggested in http://wave-api-faq.appspot.com/#elementindex

to chk if the gadget exist in the blip, but eclipse complain that
BlipIterator.ElementIterator is not visible.

Joe Gregorio

unread,
Jul 19, 2010, 1:07:06 PM7/19/10
to google-...@googlegroups.com
On Fri, Jul 16, 2010 at 2:40 AM, Alex <monste...@gmail.com> wrote:
i have a few question for the selectors and action (java api)

the blip.first(String arg); is the arg a regular expression or just a
normal string? i tried regular expression \[new\], it matches only \
[new\] and not [new].

That is just a normal string. You can do event filtering using regular expressions, but
that is done using a @Capability annotation in Java:

 

and once i get the BlipContentRefs, i tried the delete() method and
then add a gadget, but the specified string is still in the blip and
this cause a infinite loop of onDocumentChangedEvent.

Can you try just deleting the text first and not inserting the gadget and
determine if that still causes an infinite loop?

  Thanks,
  -joe

--
Joe Gregorio
Developer Relations, Google Wave

 

how do i prevent the infinite loop? the delete() method dont seem to
work.

and i have tried using
Map<String, String> restrictions = new HashMap<String, String>();
         BlipIterator iterator = new BlipIterator.ElementIterator(blip,
ElementType.GADGET, restrictions, -1);
         int start = iterator.next().getStart();
as suggested in http://wave-api-faq.appspot.com/#elementindex

to chk if the gadget exist in the blip, but eclipse complain that
BlipIterator.ElementIterator is not visible.

--
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-...@googlegroups.com.
To unsubscribe from this group, send email to google-wave-a...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/google-wave-api?hl=en.


Alex

unread,
Jul 20, 2010, 9:59:24 AM7/20/10
to Google Wave API
ok thanks,

for blip.first(String arg);
what does it return if the content of the blip does not contains the
arg?
and how do we know if the given arg does not exist in the blip?

currently i am using blip.getContent().contains(arg) before i call
blip.first(arg)


On Jul 19, 1:07 pm, Joe Gregorio <j...@bitworking.org> wrote:
> On Fri, Jul 16, 2010 at 2:40 AM, Alex <monsterno...@gmail.com> wrote:
> > i have a few question for the selectors and action (java api)
>
> > the blip.first(String arg); is the arg a regular expression or just a
> > normal string? i tried regular expression \[new\], it matches only \
> > [new\] and not [new].
>
> That is just a normal string. You can do event filtering using regular
> expressions, but
> that is done using a @Capability annotation in Java:
>
> http://code.google.com/apis/wave/extensions/robots/events.html#EventF...
>
>
>
> > and once i get the BlipContentRefs, i tried the delete() method and
> > then add a gadget, but the specified string is still in the blip and
> > this cause a infinite loop of onDocumentChangedEvent.
>
> Can you try just deleting the text first and not inserting the gadget and
> determine if that still causes an infinite loop?
>
>   Thanks,
>   -joe
>
> --
> Joe Gregorio
> Developer Relations, Google Wave
>
>
>
> > how do i prevent the infinite loop? the delete() method dont seem to
> > work.
>
> > and i have tried using
> > Map<String, String> restrictions = new HashMap<String, String>();
> >          BlipIterator iterator = new BlipIterator.ElementIterator(blip,
> > ElementType.GADGET, restrictions, -1);
> >          int start = iterator.next().getStart();
> > as suggested inhttp://wave-api-faq.appspot.com/#elementindex
>
> > to chk if the gadget exist in the blip, but eclipse complain that
> > BlipIterator.ElementIterator is not visible.
>
> > --
> > 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-...@googlegroups.com.
> > To unsubscribe from this group, send email to
> > google-wave-a...@googlegroups.com<google-wave-api%2Bunsu...@googlegroups.com>
> > .
Reply all
Reply to author
Forward
0 new messages