481 public void sendInputMethodEvent(int id, long when, String text,
482 int[] clauseBoundary, String[] clauseReading,
483 int[] attributeBoundary, byte[] attributeValue,
484 int commitedTextLength, int caretPos, int visiblePos)
485 {
486
487 AttributedCharacterIterator iterator = null;
488
489 if (text!=null) {
490
491 // construct AttributedString
492 AttributedString attrStr = new AttributedString(text);
493
494 // set Language Information
495 attrStr.addAttribute(Attribute.LANGUAGE,
496 Locale.getDefault(), 0, text.length());
497
498 // set Clause and Reading Information
499 if (clauseBoundary!=null && clauseReading!=null &&
500 clauseReading.length!=0 && clauseBoundary.length==clauseReading.length+1 &&
501 clauseBoundary[0]==0 && clauseBoundary[clauseReading.length]==text.length() )
502 {
503 for (int i=0; i<clauseBoundary.length-1; i++) {
504 attrStr.addAttribute(Attribute.INPUT_METHOD_SEGMENT,
505 new Annotation(null), clauseBoundary[i], clauseBoundary[i+1]);
506 attrStr.addAttribute(Attribute.READING,
507 new Annotation(clauseReading[i]), clauseBoundary[i], clauseBoundary[i+1]);
508 }
509 } else {
510 // if (clauseBoundary != null)
511 // System.out.println("Invalid clause information!");
512
513 attrStr.addAttribute(Attribute.INPUT_METHOD_SEGMENT,
514 new Annotation(null), 0, text.length());
515 attrStr.addAttribute(Attribute.READING,
516 new Annotation(""), 0, text.length());
517 }
518
519 // set Hilight Information
520 if (attributeBoundary!=null && attributeValue!=null &&
521 attributeValue.length!=0 && attributeBoundary.length==attributeValue.length+1 &&
|
481 public void sendInputMethodEvent(int id, long when, String text,
482 int[] clauseBoundary, String[] clauseReading,
483 int[] attributeBoundary, byte[] attributeValue,
484 int commitedTextLength, int caretPos, int visiblePos)
485 {
486
487 AttributedCharacterIterator iterator = null;
488
489 if (text!=null) {
490
491 // construct AttributedString
492 AttributedString attrStr = new AttributedString(text);
493
494 // set Language Information
495 attrStr.addAttribute(Attribute.LANGUAGE,
496 Locale.getDefault(), 0, text.length());
497
498 // set Clause and Reading Information
499 if (clauseBoundary!=null && clauseReading!=null &&
500 clauseReading.length!=0 && clauseBoundary.length==clauseReading.length+1 &&
501 clauseBoundary[0]==0 && clauseBoundary[clauseReading.length]<=text.length() )
502 {
503 for (int i=0; i<clauseBoundary.length-1; i++) {
504 attrStr.addAttribute(Attribute.INPUT_METHOD_SEGMENT,
505 new Annotation(null), clauseBoundary[i], clauseBoundary[i+1]);
506 attrStr.addAttribute(Attribute.READING,
507 new Annotation(clauseReading[i]), clauseBoundary[i], clauseBoundary[i+1]);
508 }
509 } else {
510 // if (clauseBoundary != null)
511 // System.out.println("Invalid clause information!");
512
513 attrStr.addAttribute(Attribute.INPUT_METHOD_SEGMENT,
514 new Annotation(null), 0, text.length());
515 attrStr.addAttribute(Attribute.READING,
516 new Annotation(""), 0, text.length());
517 }
518
519 // set Hilight Information
520 if (attributeBoundary!=null && attributeValue!=null &&
521 attributeValue.length!=0 && attributeBoundary.length==attributeValue.length+1 &&
|