Hi,

I'm trying my First steps on the wave with a simple robot that replaces
instances of [search] with [found] and colours them red.
Strangely this works most of the times....

When the blip contains [search][search][search][search] it only changes the
first one.
In the debugging log there is mention of 4 operations to the blip. It even
appends a text stating that it changed 4 occurrences.
(see below)

In the client I can only see one (1) [search] changing to [found]. The
append is never shown.
Only when the last one is changed it changes to red.

Ideas?

Now the strangest thing: whenever this any text between the [search]'s, even
a single space, the robot works as expected and changes the four instances.
No append is shown.

Ideas?

My code:
        String searchText = "[search]";
        String replaceText = "[found]";
        Range range = null;
        while (view.getText().toLowerCase().indexOf(searchText) >= 0) {
        
log.info("IndexOf="+(view.getText().toLowerCase().indexOf(searchText)));
                int start =
view.getText().toLowerCase().indexOf(searchText);
                range = new Range(start, start + searchText.length());
                view.replace(range, replaceText);
                range = new Range(start,start + replaceText.length());
                view.setAnnotation(range, "style/color", "rgb(255, 0, 0)");
                numberReplaced++;
        }
        view.appendStyledText(new StyledText(numberReplaced +"\n replaces
done", StyleType.ITALIC));

Met vriendelijke groet / with kind regards, Hans Nouwens.

The debug log of the first event with 4 [search] occurrences:

org.nouwens.wave.MyFirsty.MyFirstyWaveServlet processEvents: IndexOf=0 
org.nouwens.wave.MyFirsty.MyFirstyWaveServlet processEvents: IndexOf=7 
org.nouwens.wave.MyFirsty.MyFirstyWaveServlet processEvents: IndexOf=14 
org.nouwens.wave.MyFirsty.MyFirstyWaveServlet processEvents: IndexOf=21

com.google.wave.api.AbstractRobotServlet serializeOperations: Outgoing
operations:
{"javaClass":"com.google.wave.api.impl.OperationMessageBundle","operations":
{"javaClass":"java.util.ArrayList","list":[{"index":-1,"waveletId":"wavesand
box.com!conv+root","blipId":"b+3in3A4ZaO","javaClass":"com.google.wave.api.i
mpl.OperationImpl","property":{"start":0,"javaClass":"com.google.wave.api.Ra
nge","end":8},"waveId":"wavesandbox.com!w+3in3A4ZaM","type":"DOCUMENT_DELETE
"},{"index":0,"waveletId":"wavesandbox.com!conv+root","blipId":"b+3in3A4ZaO"
,"javaClass":"com.google.wave.api.impl.OperationImpl","property":"[found]","
waveId":"wavesandbox.com!w+3in3A4ZaM","type":"DOCUMENT_INSERT"},{"index":0,"
waveletId":"wavesandbox.com!conv+root","blipId":"b+3in3A4ZaO","javaClass":"c
om.google.wave.api.impl.OperationImpl","property":{"range":{"start":0,"javaC
lass":"com.google.wave.api.Range","end":37},"name":"style/color","value":"rg
b(255, 0,
0)","javaClass":"com.google.wave.api.Annotation"},"waveId":"wavesandbox.com!
w+3in3A4ZaM","type":"DOCUMENT_ANNOTATION_SET"},{"index":0,"waveletId":"waves
andbox.com!conv+root","blipId":"b+3in3A4ZaO","javaClass":"com.google.wave.ap
i.impl.OperationImpl","property":{"range":{"start":0,"javaClass":"com.google
.wave.api.Range","end":37},"name":"style/fontWeight","value":"bold","javaCla
ss":"com.google.wave.api.Annotation"},"waveId":"wavesandbox.com!w+3in3A4ZaM"
,"type":"DOCUMENT_ANNOTATION_SET"},{"index":-1,"waveletId":"wavesandbox.com!
conv+root","blipId":"b+3in3A4ZaO","javaClass":"com.google.wave.api.impl.Oper
ationImpl","property":{"start":7,"javaClass":"com.google.wave.api.Range","en
d":15},"waveId":"wavesandbox.com!w+3in3A4ZaM","type":"DOCUMENT_DELETE"},{"in
dex":7,"waveletId":"wavesandbox.com!conv+root","blipId":"b+3in3A4ZaO","javaC
lass":"com.google.wave.api.impl.OperationImpl","property":"[found]","waveId"
:"wavesandbox.com!w+3in3A4ZaM","type":"DOCUMENT_INSERT"},{"index":0,"wavelet
Id":"wavesandbox.com!conv+root","blipId":"b+3in3A4ZaO","javaClass":"com.goog
le.wave.api.impl.OperationImpl","property":{"range":{"start":7,"javaClass":"
com.google.wave.api.Range","end":37},"name":"style/color","value":"rgb(255,
0,
0)","javaClass":"com.google.wave.api.Annotation"},"waveId":"wavesandbox.com!
w+3in3A4ZaM","type":"DOCUMENT_ANNOTATION_SET"},{"index":0,"waveletId":"waves
andbox.com!conv+root","blipId":"b+3in3A4ZaO","javaClass":"com.google.wave.ap
i.impl.OperationImpl","property":{"range":{"start":7,"javaClass":"com.google
.wave.api.Range","end":37},"name":"style/fontWeight","value":"bold","javaCla
ss":"com.google.wave.api.Annotation"},"waveId":"wavesandbox.com!w+3in3A4ZaM"
,"type":"DOCUMENT_ANNOTATION_SET"},{"index":-1,"waveletId":"wavesandbox.com!
conv+root","blipId":"b+3in3A4ZaO","javaClass":"com.google.wave.api.impl.Oper
ationImpl","property":{"start":14,"javaClass":"com.google.wave.api.Range","e
nd":22},"waveId":"wavesandbox.com!w+3in3A4ZaM","type":"DOCUMENT_DELETE"},{"i
ndex":14,"waveletId":"wavesandbox.com!conv+root","blipId":"b+3in3A4ZaO","jav
aClass":"com.google.wave.api.impl.OperationImpl","property":"[found]","waveI
d":"wavesandbox.com!w+3in3A4ZaM","type":"DOCUMENT_INSERT"},{"index":0,"wavel
etId":"wavesandbox.com!conv+root","blipId":"b+3in3A4ZaO","javaClass":"com.go
ogle.wave.api.impl.OperationImpl","property":{"range":{"start":14,"javaClass
":"com.google.wave.api.Range","end":37},"name":"style/color","value":"rgb(25
5, 0,
0)","javaClass":"com.google.wave.api.Annotation"},"waveId":"wavesandbox.com!
w+3in3A4ZaM","type":"DOCUMENT_ANNOTATION_SET"},{"index":0,"waveletId":"waves
andbox.com!conv+root","blipId":"b+3in3A4ZaO","javaClass":"com.google.wave.ap
i.impl.OperationImpl","property":{"range":{"start":14,"javaClass":"com.googl
e.wave.api.Range","end":37},"name":"style/fontWeight","value":"bold","javaCl
ass":"com.google.wave.api.Annotation"},"waveId":"wavesandbox.com!w+3in3A4ZaM
","type":"DOCUMENT_ANNOTATION_SET"},{"index":-1,"waveletId":"wavesandbox.com
!conv+root","blipId":"b+3in3A4ZaO","javaClass":"com.google.wave.api.impl.Ope
rationImpl","property":{"start":21,"javaClass":"com.google.wave.api.Range","
end":29},"waveId":"wavesandbox.com!w+3in3A4ZaM","type":"DOCUMENT_DELETE"},{"
index":21,"waveletId":"wavesandbox.com!conv+root","blipId":"b+3in3A4ZaO","ja
vaClass":"com.google.wave.api.impl.OperationImpl","property":"[found]\n","wa
veId":"wavesandbox.com!w+3in3A4ZaM","type":"DOCUMENT_INSERT"},{"index":0,"wa
veletId":"wavesandbox.com!conv+root","blipId":"b+3in3A4ZaO","javaClass":"com
.google.wave.api.impl.OperationImpl","property":{"range":{"start":21,"javaCl
ass":"com.google.wave.api.Range","end":28},"name":"style/color","value":"rgb
(255, 0,
0)","javaClass":"com.google.wave.api.Annotation"},"waveId":"wavesandbox.com!
w+3in3A4ZaM","type":"DOCUMENT_ANNOTATION_SET"},{"index":0,"waveletId":"waves
andbox.com!conv+root","blipId":"b+3in3A4ZaO","javaClass":"com.google.wave.ap
i.impl.OperationImpl","property":{"range":{"start":21,"javaClass":"com.googl
e.wave.api.Range","end":28},"name":"style/fontWeight","value":"bold","javaCl
ass":"com.google.wave.api.Annotation"},"waveId":"wavesandbox.com!w+3in3A4ZaM
","type":"DOCUMENT_ANNOTATION_SET"},{"index":1,"waveletId":"wavesandbox.com!
conv+root","blipId":"b+3in3A4ZaO","javaClass":"com.google.wave.api.impl.Oper
ationImpl","property":"4 replaces
done","waveId":"wavesandbox.com!w+3in3A4ZaM","type":"DOCUMENT_APPEND_STYLED_
TEXT"}]},"version":"1.01"}


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

Reply via email to