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":"wavesandbox.com!conv+root","blipId":"b+3in3A4ZaO","javaClass":"com.google.wave.api.impl.OperationImpl","property":{"start":0,"javaClass":"com.google.wave.api.Range","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":"com.google.wave.api.impl.OperationImpl","property":{"range":{"start":0,"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":"wavesandbox.com!conv+root","blipId":"b+3in3A4ZaO","javaClass":"com.google.wave.api.impl.OperationImpl","property":{"range":{"start":0,"javaClass":"com.google.wave.api.Range","end":37},"name":"style/fontWeight","value":"bold","javaClass":"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.OperationImpl","property":{"start":7,"javaClass":"com.google.wave.api.Range","end":15},"waveId":"wavesandbox.com!w+3in3A4ZaM","type":"DOCUMENT_DELETE"},{"index":7,"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":"com.google.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":"wavesandbox.com!conv+root","blipId":"b+3in3A4ZaO","javaClass":"com.google.wave.api.impl.OperationImpl","property":{"range":{"start":7,"javaClass":"com.google.wave.api.Range","end":37},"name":"style/fontWeight","value":"bold","javaClass":"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.OperationImpl","property":{"start":14,"javaClass":"com.google.wave.api.Range","end":22},"waveId":"wavesandbox.com!w+3in3A4ZaM","type":"DOCUMENT_DELETE"},{"index":14,"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":"com.google.wave.api.impl.OperationImpl","property":{"range":{"start":14,"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":"wavesandbox.com!conv+root","blipId":"b+3in3A4ZaO","javaClass":"com.google.wave.api.impl.OperationImpl","property":{"range":{"start":14,"javaClass":"com.google.wave.api.Range","end":37},"name":"style/fontWeight","value":"bold","javaClass":"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.OperationImpl","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","javaClass":"com.google.wave.api.impl.OperationImpl","property":"[found]\n","waveId":"wavesandbox.com!w+3in3A4ZaM","type":"DOCUMENT_INSERT"},{"index":0,"waveletId":"wavesandbox.com!conv+root","blipId":"b+3in3A4ZaO","javaClass":"com.google.wave.api.impl.OperationImpl","property":{"range":{"start":21,"javaClass":"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":"wavesandbox.com!conv+root","blipId":"b+3in3A4ZaO","javaClass":"com.google.wave.api.impl.OperationImpl","property":{"range":{"start":21,"javaClass":"com.google.wave.api.Range","end":28},"name":"style/fontWeight","value":"bold","javaClass":"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.OperationImpl","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 google-wave-api@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
-~----------~----~----~----~------~----~------~--~---

Reply via email to